muttakin2301/ccr_train_1000 huggingface dataset:
Code review comment: Can't we simply return `values.clone`?

Code before review:
public byte[] getBytes() {
BByteArray copy = (BByteArray) this.copy();
return copy.values;
}

Line under review: return copy.values;

Code after addressing the review:
public byte[] getBytes() {
return values.clone();
}
Code review comment: the `hashCode` is also inefficient

Code before review:
public int hashCode() {
return Objects.hashCode(this.toString());
}

Line under review: return Objects.hashCode(this.toString());

Code after addressing the review:
public int hashCode() {
return Objects.hashCode(this.sql);
}
Code review comment: I think this deserves a "final" here, and the line below too.

Code before review:
public static void main(String[] args) throws Exception {
ServerConfiguration configuration = new ServerConfiguration();
CmdLineParser parser = new CmdLineParser(configuration);
try {
parser.parseArgument(args);
fromConfig(configuration).run();
} catch (CmdLineException e) {
LOG.error("Unable to parse command line arguments {}", Arrays.asList(args), e);
throw new IllegalArgumentException("Unable to parse command line arguments.", e);
} catch (Exception e) {
LOG.error("Hit exception with SamzaJobServer. Exiting...", e);
throw e;
}
}

Line under review: ServerConfiguration configuration = new ServerConfiguration();

Code after addressing the review:
public static void main(String[] args) throws Exception {
final ServerConfiguration configuration = new ServerConfiguration();
final CmdLineParser parser = new CmdLineParser(configuration);
try {
parser.parseArgument(args);
fromConfig(configuration).run();
} catch (CmdLineException e) {
LOG.error("Unable to parse command line arguments {}", Arrays.asList(args), e);
throw new IllegalArgumentException("Unable to parse command line arguments.", e);
} catch (Exception e) {
LOG.error("Hit exception with SamzaJobServer. Exiting...", e);
throw e;
}
}
Code review comment: The above TODO can be removed.

Code before review:
protected void createColumnAndViewDefs(Analyzer analyzer) throws AnalysisException, UserException {
if (cols != null) {
if (cols.size() != viewDefStmt.getColLabels().size()) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_VIEW_WRONG_LIST);
}
for (int i = 0; i < cols.size(); ++i) {
Type type = viewDefStmt.getBaseTblResultExprs().get(i).getType().clone();
Column col = new Column(cols.get(i).getColName(), type);
col.setComment(cols.get(i).getComment());
finalCols.add(col);
}
} else {
for (int i = 0; i < viewDefStmt.getBaseTblResultExprs().size(); ++i) {
Type type = viewDefStmt.getBaseTblResultExprs().get(i).getType().clone();
finalCols.add(new Column(viewDefStmt.getColLabels().get(i), type));
}
}
Set<String> colSets = Sets.newTreeSet(String.CASE_INSENSITIVE_ORDER);
for (Column col : finalCols) {
if (!colSets.add(col.getName())) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_DUP_FIELDNAME, col.getName());
}
}
originalViewDef = viewDefStmt.toSql();
if (cols == null) {
inlineViewDef = originalViewDef;
return;
}
Analyzer tmpAnalyzer = new Analyzer(analyzer);
List<String> colNames = cols.stream().map(c -> c.getColName()).collect(Collectors.toList());
cloneStmt.substituteSelectList(tmpAnalyzer, colNames);
inlineViewDef = cloneStmt.toSql();
}

Line under review: Type type = viewDefStmt.getBaseTblResultExprs().get(i).getType().clone();

Code after addressing the review:
protected void createColumnAndViewDefs(Analyzer analyzer) throws AnalysisException, UserException {
if (cols != null) {
if (cols.size() != viewDefStmt.getColLabels().size()) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_VIEW_WRONG_LIST);
}
for (int i = 0; i < cols.size(); ++i) {
Type type = viewDefStmt.getBaseTblResultExprs().get(i).getType().clone();
Column col = new Column(cols.get(i).getColName(), type);
col.setComment(cols.get(i).getComment());
finalCols.add(col);
}
} else {
for (int i = 0; i < viewDefStmt.getBaseTblResultExprs().size(); ++i) {
Type type = viewDefStmt.getBaseTblResultExprs().get(i).getType().clone();
finalCols.add(new Column(viewDefStmt.getColLabels().get(i), type));
}
}
Set<String> colSets = Sets.newTreeSet(String.CASE_INSENSITIVE_ORDER);
for (Column col : finalCols) {
if (!colSets.add(col.getName())) {
ErrorReport.reportAnalysisException(ErrorCode.ERR_DUP_FIELDNAME, col.getName());
}
}
originalViewDef = viewDefStmt.toSql();
if (cols == null) {
inlineViewDef = originalViewDef;
return;
}
Analyzer tmpAnalyzer = new Analyzer(analyzer);
List<String> colNames = cols.stream().map(c -> c.getColName()).collect(Collectors.toList());
cloneStmt.substituteSelectList(tmpAnalyzer, colNames);
inlineViewDef = cloneStmt.toSql();
}
Code review comment: Then maybe we substitute `Set<CoLocationGroupDesc>` with `Map<AbstractID, CoLocationGroupDesc>`? ``` final Set<CoLocationGroupDesc> coLocationGroupDescs = getVertices()     .stream()     .map(vertex -> CoLocationGroupDesc.from(vertex.getCoLocationGroup()))     .collect(Collectors.toMap(CoLocationGroupDesc::getId, d -> d))     .values()     .stream()     .collect(Collectors.toSet()); ```  It can be also in a for-loop, but it is nit anyways so I think it is ok as it is. Maybe, at least a comment why we do it like this: `because equals ...`.

Code before review:
public Set<CoLocationGroupDesc> getCoLocationGroupDescriptors() {
final Set<CoLocationGroup> coLocationGroups = new HashSet<>();
for (JobVertex vertex : getVertices()) {
CoLocationGroup coLocationGroup = vertex.getCoLocationGroup();
if (coLocationGroup != null) {
coLocationGroups.add(coLocationGroup);
}
}
final Set<CoLocationGroupDesc> coLocationGroupDescs = coLocationGroups
.stream()
.map(CoLocationGroupDesc::from)
.collect(Collectors.toSet());
return Collections.unmodifiableSet(coLocationGroupDescs);
}

Line under review: }

Code after addressing the review:
public Set<CoLocationGroupDesc> getCoLocationGroupDescriptors() {
final Set<CoLocationGroupDesc> coLocationGroups = IterableUtils
.toStream(getVertices())
.map(JobVertex::getCoLocationGroup)
.filter(Objects::nonNull)
.distinct()
.map(CoLocationGroupDesc::from)
.collect(Collectors.toSet());
return Collections.unmodifiableSet(coLocationGroups);
}
Code review comment: Oh, I see! You cache the `Uni` and resubscribe to it every time (well Quarkus does).  That's actually interesting, but I'm not sure it's what the user would expect.   Imagine:  ```java @GET public Uni<String> callMyRemoteService() {    return webClient.send().map(r -> r.bodyAsString()); } ```  Basically, it calls a remote service.   If you cache the result, what would/should happen?  1. the response is cached - the users will get the same response, avoiding calls to the remote service 2. the uni is cached - to every time there is a request, there is another subscription calling the remote service  I would have said 1, but it looks like 2 has been implemented. Can you confirm?  

Code before review:
public Uni<String> cachedMethod(String key) {
invocations++;
return Uni.createFrom().item(() -> new String());
}

Line under review: return Uni.createFrom().item(() -> new String());

Code after addressing the review:
public Uni<String> cachedMethod(String key) {
invocations++;
return Uni.createFrom().item(() -> {
subscriptions++;
return "" + subscriptions;
});
}
Code review comment: Currently, the shift operation for tuples is not supported by the runtime. Therefore the runtime checks if the object performing the shift is an array and if not, throws an `OperationNotSupported` exception. The changes proposed in this PR allows the use of shift operation on tuples but this also allows the risk of running into mutations that violate the inherent type of the tuple (as shown in the previous comment). The check in question is added to make sure that never happens.

Code before review:
private void validateTupleSizeAndInherentType() {
int numOfMandatoryTypes = this.tupleType.getTupleTypes().size();
if (numOfMandatoryTypes >= this.getLength()) {
throw ErrorHelper.getRuntimeException(
getModulePrefixedReason(ARRAY_LANG_LIB, SIZE_MISMATCH_ERROR_IDENTIFIER),
ErrorCodes.INVALID_MEMBER_SIZE, numOfMandatoryTypes + 1, this.getLength());
}
for (int i = 1; i <= numOfMandatoryTypes; i++) {
if (!TypeChecker.checkIsType(this.getRefValue(i), this.tupleType.getTupleTypes().get(i - 1))) {
throw ErrorHelper.getRuntimeException(
getModulePrefixedReason(ARRAY_LANG_LIB, INHERENT_TYPE_VIOLATION_ERROR_IDENTIFIER),
ErrorCodes.INCOMPATIBLE_TYPE, this.tupleType.getTupleTypes().get(i - 1),
(i == numOfMandatoryTypes) ?
this.tupleType.getRestType() : this.tupleType.getTupleTypes().get(i));
}
}
}

Line under review: this.tupleType.getRestType() : this.tupleType.getTupleTypes().get(i));

Code after addressing the review:
private void validateTupleSizeAndInherentType() {
List<Type> tupleTypesList = this.tupleType.getTupleTypes();
int numOfMandatoryTypes = tupleTypesList.size();
if (numOfMandatoryTypes >= this.getLength()) {
throw ErrorHelper.getRuntimeException(getModulePrefixedReason(ARRAY_LANG_LIB,
OPERATION_NOT_SUPPORTED_IDENTIFIER), ErrorCodes.INVALID_TUPLE_MEMBER_SIZE, "shift");
}
for (int i = 1; i <= numOfMandatoryTypes; i++) {
if (!TypeChecker.checkIsType(this.getRefValue(i), tupleTypesList.get(i - 1))) {
throw ErrorHelper.getRuntimeException(getModulePrefixedReason(ARRAY_LANG_LIB,
INHERENT_TYPE_VIOLATION_ERROR_IDENTIFIER), ErrorCodes.INCOMPATIBLE_TYPE,
tupleTypesList.get(i - 1), (i == numOfMandatoryTypes) ?
this.tupleType.getRestType() : tupleTypesList.get(i));
}
}
}
Code review comment: These two return two different results.  Original one is : 2 ^ (tryCount-1) Now: (tryCount -1) ^ 2  What if tryCount = 1, does delay expect to be negative?

Code before review:
long calculateDelayInMs(int tryCount) {
long delay;
switch (this.retryPolicyType) {
case EXPONENTIAL:
delay = ((tryCount - 1) * (tryCount - 1) - 1L) * this.retryDelayInMs;
break;
case FIXED:
delay = this.retryDelayInMs;
break;
default:
throw logger.logExceptionAsError(new IllegalArgumentException("Invalid retry policy type."));
}
return Math.min(delay, this.maxRetryDelayInMs);
}

Line under review: delay = ((tryCount - 1) * (tryCount - 1) - 1L) * this.retryDelayInMs;

Code after addressing the review:
long calculateDelayInMs(int tryCount) {
long delay;
switch (this.retryPolicyType) {
case EXPONENTIAL:
delay = ((tryCount - 1) * (tryCount - 1) - 1L) * this.retryDelayInMs;
break;
case FIXED:
delay = this.retryDelayInMs;
break;
default:
throw logger.logExceptionAsError(new IllegalArgumentException("Invalid retry policy type."));
}
return Math.min(delay, this.maxRetryDelayInMs);
}
Code review comment: Why have we commented out these lines?

Code before review:
public void process(ServiceNode serviceNode, List<AnnotationAttachmentNode> annotations) {
List<BLangFunction> resources = (List<BLangFunction>) serviceNode.getResources();
resources.forEach(res -> validate(serviceNode.getName().getValue(), res, this.diagnosticLog));
}


Code after addressing the review:
public void process(ServiceNode serviceNode, List<AnnotationAttachmentNode> annotations) {
List<BLangFunction> resources = (List<BLangFunction>) serviceNode.getResources();
resources.forEach(res -> validate(serviceNode.getName().getValue(), res, this.diagnosticLog));
}
Code review comment: WDYM? The class now *potentially* holds two annotation targets. So we first try to create the String representation with the method param AT and if not present, we fallback to the original target.

Code before review:
public String getTargetInfo() {
if (target == null) {
return "";
}
if (methodParameterTarget != null && Kind.METHOD_PARAMETER.equals(methodParameterTarget.kind())) {
String method = methodParameterTarget.asMethodParameter().method().name();
if (method.equals(Methods.INIT)) {
method = " constructor";
} else {
method = "
}
return "parameter '" + methodParameterTarget.asMethodParameter().name() + "' of "
+ methodParameterTarget.asMethodParameter().method().declaringClass().name() + method;
}
switch (target.kind()) {
case FIELD:
return target.asField().declaringClass().name() + "
case METHOD:
String param = target.asMethod().parameterName(position);
if (param == null || param.isBlank()) {
param = "arg" + position;
}
String method = target.asMethod().name();
if (method.equals(Methods.INIT)) {
method = " constructor";
} else {
method = "
}
return "parameter '" + param + "' of " + target.asMethod().declaringClass().name() + method;
default:
return target.toString();
}
}

Line under review: }

Code after addressing the review:
public String getTargetInfo() {
if (target == null) {
return "";
}
switch (target.kind()) {
case FIELD:
return target.asField().declaringClass().name() + "
case METHOD:
String param = target.asMethod().parameterName(position);
if (param == null || param.isBlank()) {
param = "arg" + position;
}
String method = target.asMethod().name();
if (method.equals(Methods.INIT)) {
method = " constructor";
} else {
method = "
}
return "parameter '" + param + "' of " + target.asMethod().declaringClass().name() + method;
case METHOD_PARAMETER:
String name = methodParameterTarget.asMethodParameter().method().name();
if (name.equals(Methods.INIT)) {
name = " constructor";
} else {
name = "
}
return "parameter '" + methodParameterTarget.asMethodParameter().name() + "' of "
+ methodParameterTarget.asMethodParameter().method().declaringClass().name() + name;
default:
return target.toString();
}
}
Code review comment: Oh, that was because I don't use the consumer created in beforeTest() and create my own. I'll remove it. It's not necessary.

Code before review:
public void receiveUntilTimeoutMultipleTimes() throws IOException {
this.consumer.close();
this.consumer = null;
final int numberOfEvents = 15;
final int numberOfEvents2 = 3;
final String partitionId = "1";
final List<EventData> events = getEventsAsList(numberOfEvents, TestUtils.MESSAGE_TRACKING_ID);
final List<EventData> events2 = getEventsAsList(numberOfEvents2, TestUtils.MESSAGE_TRACKING_ID);
final EventHubConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, partitionId,
EventPosition.fromEnqueuedTime(Instant.now()));
final EventHubProducer producer = client.createProducer(new EventHubProducerOptions().setPartitionId(partitionId));
try {
producer.send(events);
final IterableStream<EventData> receive = consumer.receive(100, Duration.ofSeconds(3));
System.out.println("Sending second batch.");
producer.send(events2);
System.out.println("Receiving second batch.");
final IterableStream<EventData> receive2 = consumer.receive(100, Duration.ofSeconds(5));
final List<EventData> asList = receive.stream().collect(Collectors.toList());
Assert.assertEquals(numberOfEvents, asList.size());
final List<EventData> asList2 = receive2.stream().collect(Collectors.toList());
Assert.assertEquals(numberOfEvents2, asList2.size());
} finally {
dispose(consumer, producer);
}
}

Line under review: this.consumer.close();

Code after addressing the review:
public void receiveUntilTimeoutMultipleTimes() {
final int numberOfEvents = 15;
final int numberOfEvents2 = 3;
final String partitionId = "1";
final List<EventData> events = getEventsAsList(numberOfEvents);
final List<EventData> events2 = getEventsAsList(numberOfEvents2);
final EventHubConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, partitionId,
EventPosition.fromEnqueuedTime(Instant.now()));
final EventHubProducer producer = client.createProducer(new EventHubProducerOptions().setPartitionId(partitionId));
try {
producer.send(events);
final IterableStream<EventData> receive = consumer.receive(100, Duration.ofSeconds(3));
logger.info("Sending second batch.");
producer.send(events2);
logger.info("Receiving second batch.");
final IterableStream<EventData> receive2 = consumer.receive(100, Duration.ofSeconds(5));
final List<EventData> asList = receive.stream().collect(Collectors.toList());
Assert.assertEquals(numberOfEvents, asList.size());
final List<EventData> asList2 = receive2.stream().collect(Collectors.toList());
Assert.assertEquals(numberOfEvents2, asList2.size());
} finally {
dispose(consumer, producer);
}
}
Code review comment: Yea, recording the annotation processing flow and redirecting it to a different element was my preference as well, but I could not see a way to do this because in order to redirect the annotation processing we would need the Visitor instance from the generated accessor method so we could delegate to it. However, the visitor for the generated getter doesn't get created until later on in the code flow after we've processed all of the fields. So at this point it's a dead-end chicken-and-the-egg issue because we cannot delegate to the getter method visitor until after we've scanned the field and determined we need to generate a getter in the first place.  I'm pretty confident in the code and the test coverage (as long as the scope remains moving JAX-B annotations and not other annotations), so I could certainly add a `FIXME` to put myself on the hook for maintaining it in the future.

Code before review:
public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) {
FieldVisitor superVisitor = super.visitField(access, name, descriptor, signature, value);
EntityField ef = fields.get(name);
if (fields == null || ef == null)
return superVisitor;
ef.signature = signature;
return new FieldVisitor(Opcodes.ASM7, superVisitor) {
private Set<String> descriptors = new HashSet<>();
@Override
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
descriptors.add(descriptor);
if (!descriptor.startsWith(JAXB_ANNOTATION_PREFIX)) {
return super.visitAnnotation(descriptor, visible);
}
EntityFieldAnnotation efAnno = new EntityFieldAnnotation(descriptor);
ef.annotations.add(efAnno);
return new AnnotationVisitor(Opcodes.ASM7) {
@Override
public void visit(String name, Object value) {
efAnno.name = name;
efAnno.value = value;
}
};
}
@Override
public void visitEnd() {
super.visitAnnotation(JAXB_TRANSIENT_SIGNATURE, true);
super.visitEnd();
}
};
}

Line under review: return new AnnotationVisitor(Opcodes.ASM7) {

Code after addressing the review:
public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) {
FieldVisitor superVisitor = super.visitField(access, name, descriptor, signature, value);
EntityField ef = fields.get(name);
if (fields == null || ef == null)
return superVisitor;
ef.signature = signature;
return new FieldVisitor(Opcodes.ASM7, superVisitor) {
private Set<String> descriptors = new HashSet<>();
@Override
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
descriptors.add(descriptor);
if (!descriptor.startsWith(JAXB_ANNOTATION_PREFIX)) {
return super.visitAnnotation(descriptor, visible);
} else {
EntityFieldAnnotation efAnno = new EntityFieldAnnotation(descriptor);
ef.annotations.add(efAnno);
return new PanacheMovingAnnotationVisitor(efAnno);
}
}
@Override
public void visitEnd() {
super.visitAnnotation(JAXB_TRANSIENT_SIGNATURE, true);
super.visitEnd();
}
};
}
Code review comment: We will probably want to add configuration properties for these but I'll let our community add them if they need them.

Code before review:
public QuarkusPathLocationScanner(Collection<Location> locations) {
LOGGER.debugv("Locations: {0}", locations);
this.scannedResources = new ArrayList<>();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
FileSystemScanner fileSystemScanner = null;
for (String migrationFile : applicationMigrationFiles) {
if (isClassPathResource(locations, migrationFile)) {
LOGGER.debugf("Loading %s", migrationFile);
scannedResources.add(new ClassPathResource(null, migrationFile, classLoader, StandardCharsets.UTF_8));
} else if (migrationFile.startsWith(Location.FILESYSTEM_PREFIX)) {
if (fileSystemScanner == null) {
fileSystemScanner = new FileSystemScanner(StandardCharsets.UTF_8, false, false, false);
}
LOGGER.debugf("Checking %s for migration files", migrationFile);
Collection<LoadableResource> resources = fileSystemScanner.scanForResources(new Location(migrationFile));
LOGGER.debugf("%s contains %d migration files", migrationFile, resources.size());
scannedResources.addAll(resources);
}
}
}

Line under review: fileSystemScanner = new FileSystemScanner(StandardCharsets.UTF_8, false, false, false);

Code after addressing the review:
public QuarkusPathLocationScanner(Collection<Location> locations) {
LOGGER.debugv("Locations: {0}", locations);
this.scannedResources = new ArrayList<>();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
FileSystemScanner fileSystemScanner = null;
for (String migrationFile : applicationMigrationFiles) {
if (isClassPathResource(locations, migrationFile)) {
LOGGER.debugf("Loading %s", migrationFile);
scannedResources.add(new ClassPathResource(null, migrationFile, classLoader, StandardCharsets.UTF_8));
} else if (migrationFile.startsWith(Location.FILESYSTEM_PREFIX)) {
if (fileSystemScanner == null) {
fileSystemScanner = new FileSystemScanner(StandardCharsets.UTF_8, false, false, false);
}
LOGGER.debugf("Checking %s for migration files", migrationFile);
Collection<LoadableResource> resources = fileSystemScanner.scanForResources(new Location(migrationFile));
LOGGER.debugf("%s contains %d migration files", migrationFile, resources.size());
scannedResources.addAll(resources);
}
}
}
Code review comment: Not sure If I understand how more than one node can be set to maintenance (as is the goal when allowing more than one group to be down at a time) if that is the case? This methods checks both wanted state and actual state, so name is a bit misleading.

Code before review:
private Result checkAllNodesAreUp(ClusterState clusterState) {
if (moreThanOneGroupAllowedToBeDown()) return allowSettingOfWantedState();
for (NodeInfo storageNodeInfo : clusterInfo.getStorageNodeInfos()) {
State wantedState = storageNodeInfo.getUserWantedState().getState();
if (wantedState != UP && wantedState != RETIRED) {
return createDisallowed("Another storage node wants state " +
wantedState.toString().toUpperCase() + ": " + storageNodeInfo.getNodeIndex());
}
State state = clusterState.getNodeState(storageNodeInfo.getNode()).getState();
if (state != UP && state != RETIRED) {
return createDisallowed("Another storage node has state " + state.toString().toUpperCase() +
": " + storageNodeInfo.getNodeIndex());
}
}
for (NodeInfo distributorNodeInfo : clusterInfo.getDistributorNodeInfos()) {
State wantedState = distributorNodeInfo.getUserWantedState().getState();
if (wantedState != UP && wantedState != RETIRED) {
return createDisallowed("Another distributor wants state " + wantedState.toString().toUpperCase() +
": " + distributorNodeInfo.getNodeIndex());
}
State state = clusterState.getNodeState(distributorNodeInfo.getNode()).getState();
if (state != UP && state != RETIRED) {
return createDisallowed("Another distributor has state " + state.toString().toUpperCase() +
": " + distributorNodeInfo.getNodeIndex());
}
}
return allowSettingOfWantedState();
}

Line under review: if (moreThanOneGroupAllowedToBeDown()) return allowSettingOfWantedState();

Code after addressing the review:
private Result checkAllNodesAreUp(ClusterState clusterState) {
for (NodeInfo storageNodeInfo : clusterInfo.getStorageNodeInfos()) {
State wantedState = storageNodeInfo.getUserWantedState().getState();
if (wantedState != UP && wantedState != RETIRED) {
return createDisallowed("Another storage node wants state " +
wantedState.toString().toUpperCase() + ": " + storageNodeInfo.getNodeIndex());
}
State state = clusterState.getNodeState(storageNodeInfo.getNode()).getState();
if (state != UP && state != RETIRED) {
return createDisallowed("Another storage node has state " + state.toString().toUpperCase() +
": " + storageNodeInfo.getNodeIndex());
}
}
for (NodeInfo distributorNodeInfo : clusterInfo.getDistributorNodeInfos()) {
State wantedState = distributorNodeInfo.getUserWantedState().getState();
if (wantedState != UP && wantedState != RETIRED) {
return createDisallowed("Another distributor wants state " + wantedState.toString().toUpperCase() +
": " + distributorNodeInfo.getNodeIndex());
}
State state = clusterState.getNodeState(distributorNodeInfo.getNode()).getState();
if (state != UP && state != RETIRED) {
return createDisallowed("Another distributor has state " + state.toString().toUpperCase() +
": " + distributorNodeInfo.getNodeIndex());
}
}
return allowSettingOfWantedState();
}
Code review comment: will there be readme.md file? pls help to add more specific description on uasge of user token. keyvault, mysql flexible, network feature

Code before review:
public static void main(String[] args) throws Exception {
TokenCredential credential = new DefaultAzureCredentialBuilder()
.authorityHost(AzureAuthorityHosts.AZURE_PUBLIC_CLOUD)
.build();
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
HttpPipelinePolicy userTokenPolicy = (context, next) -> {
Mono<String> token = null;
String bearerTokenPrefix = "bearer ";
String authorization = context.getHttpRequest().getHeaders().getValue("Authorization");
if (authorization != null && authorization.toLowerCase(Locale.ROOT).startsWith(bearerTokenPrefix)) {
token = Mono.just(authorization.substring(bearerTokenPrefix.length()));
} else {
token = credential
.getToken(new TokenRequestContext().addScopes(profile.getEnvironment().getResourceManagerEndpoint() + "/.default"))
.map(AccessToken::getToken);
}
return token
.flatMap(accessToken -> {
context.getHttpRequest().getHeaders().set(USER_TOKEN_HEADER, accessToken);
return next.process();
});
};
AzureResourceManager azureResourceManager = AzureResourceManager.authenticate(credential, profile).withDefaultSubscription();
ServiceLinkerManager serviceLinkerManager = ServiceLinkerManager.authenticate(credential, profile);
ServiceLinkerManager serviceLinkerManagerWithUserToken = ServiceLinkerManager.configure().withPolicy(userTokenPolicy).authenticate(credential, profile);
creatSpringCloudAndSQLConnection(azureResourceManager, serviceLinkerManager);
createWebAppAndKeyVaultConnectionWithUserIdentity(azureResourceManager, serviceLinkerManagerWithUserToken);
}


Code after addressing the review:
public static void main(String[] args) throws Exception {
TokenCredential credential = new DefaultAzureCredentialBuilder()
.authorityHost(AzureAuthorityHosts.AZURE_PUBLIC_CLOUD)
.build();
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
HttpPipelinePolicy userTokenPolicy = new UserTokenPolicy(credential, profile.getEnvironment());
AzureResourceManager azureResourceManager = AzureResourceManager.authenticate(credential, profile).withDefaultSubscription();
ServiceLinkerManager serviceLinkerManager = ServiceLinkerManager.authenticate(credential, profile);
ServiceLinkerManager serviceLinkerManagerWithUserToken = ServiceLinkerManager.configure().withPolicy(userTokenPolicy).authenticate(credential, profile);
createSpringCloudAndSQLConnection(azureResourceManager, serviceLinkerManager);
createWebAppAndKeyVaultConnectionWithUserIdentity(azureResourceManager, serviceLinkerManagerWithUserToken);
}
Code review comment: > How do you know you are getting metrics from the pools and they reflect correct values?  Atm I trust the Micormeter code do do that.  Let me try and add something ...

Code before review:
public void testNettyEventExecutorMetrics() {
testNettyMetrics(2L, NettyEventExecutorMetrics.class);
}

Line under review: testNettyMetrics(2L, NettyEventExecutorMetrics.class);

Code after addressing the review:
public void testNettyEventExecutorMetrics() {
testNettyMetrics(2L, NettyEventExecutorMetrics.class);
}
Code review comment: ```suggestion         supportedPlatforms.add(ProgramFileConstants.ANY_PLATFORM); ``` Can we use this content without adding a String here?

Code before review:
private NativeDependencyResolverImpl(BuildContext buildContext, boolean skipCopyLibsFromDist) {
CompilerContext context = buildContext.get(BuildContextField.COMPILER_CONTEXT);
this.buildContext = buildContext;
this.manifest = ManifestProcessor.getInstance(context).getManifest();
this.sourceRootPath = buildContext.get(BuildContextField.SOURCE_ROOT);
this.skipCopyLibsFromDist = skipCopyLibsFromDist;
this.balHomePath = buildContext.get(BuildContextField.HOME_REPO).toString();
supportedPlatforms.add("any");
}

Line under review: supportedPlatforms.add("any");

Code after addressing the review:
private NativeDependencyResolverImpl(BuildContext buildContext, boolean skipCopyLibsFromDist) {
CompilerContext context = buildContext.get(BuildContextField.COMPILER_CONTEXT);
this.buildContext = buildContext;
this.manifest = ManifestProcessor.getInstance(context).getManifest();
this.sourceRootPath = buildContext.get(BuildContextField.SOURCE_ROOT);
this.skipCopyLibsFromDist = skipCopyLibsFromDist;
this.balHomePath = buildContext.get(BuildContextField.HOME_REPO).toString();
supportedPlatforms.add(ProgramFileConstants.ANY_PLATFORM);
}
Code review comment: Don't we need to check for `ERROR_VARIABLE` here? Is it final by default?  I think it is better to add a default clause as well which throws an error to make sure that no unexpected value gets ignored here. WDYT?

Code before review:
private void recursivelySetFinalFlag(BLangVariable variable) {
switch (variable.getKind()) {
case VARIABLE:
variable.symbol.flags |= Flags.FINAL;
break;
case TUPLE_VARIABLE:
((BLangTupleVariable) variable).memberVariables.forEach(this::recursivelySetFinalFlag);
break;
case RECORD_VARIABLE:
((BLangRecordVariable) variable).variableList.forEach(value ->
recursivelySetFinalFlag(value.valueBindingPattern));
break;
}
}

Line under review: switch (variable.getKind()) {

Code after addressing the review:
private void recursivelySetFinalFlag(BLangVariable variable) {
if (variable == null) {
return;
}
switch (variable.getKind()) {
case VARIABLE:
if (variable.symbol == null) {
return;
}
variable.symbol.flags |= Flags.FINAL;
break;
case TUPLE_VARIABLE:
BLangTupleVariable tupleVariable = (BLangTupleVariable) variable;
tupleVariable.memberVariables.forEach(this::recursivelySetFinalFlag);
recursivelySetFinalFlag(tupleVariable.restVariable);
break;
case RECORD_VARIABLE:
BLangRecordVariable recordVariable = (BLangRecordVariable) variable;
recordVariable.variableList.forEach(value -> recursivelySetFinalFlag(value.valueBindingPattern));
recursivelySetFinalFlag((BLangVariable) recordVariable.restParam);
break;
case ERROR_VARIABLE:
BLangErrorVariable errorVariable = (BLangErrorVariable) variable;
recursivelySetFinalFlag(errorVariable.reason);
recursivelySetFinalFlag(errorVariable.restDetail);
errorVariable.detail.forEach(bLangErrorDetailEntry ->
recursivelySetFinalFlag(bLangErrorDetailEntry.valueBindingPattern));
break;
}
}
Code review comment: maybe u could use `Utils.toSqlString`, just rename this function to a proper name

Code before review:
public String toString() {
return "CostStateEvent{"
+ "groupExpression=" + getGroupExpression()
+ ", cost=" + cost
+ ", physicalProperties=" + physicalProperties
+ '}';
}

Line under review: + '}';

Code after addressing the review:
public String toString() {
return Utils.toSqlString("CostStateEvent", "groupExpression", getGroupExpression(),
"cost", cost, "physicalProperties", physicalProperties);
}
Code review comment: How about changing the usage of `CompletableFuture` to [1]? Having a completed future will avoid the async aspect of the futures.  [1] https://github.com/ballerina-platform/ballerina-lang/blob/master/language-server/modules/langserver-core/src/main/java/org/ballerinalang/langserver/BallerinaTextDocumentService.java#L138

Code before review:
public CompletableFuture<VariablesResponse> variables(VariablesArguments args) {
VariablesResponse variablesResponse = new VariablesResponse();
try {
Integer frameId = scopeIdToFrameIds.get(args.getVariablesReference());
if (frameId == null) {
variablesResponse.setVariables(computeChildVariables(args));
return CompletableFuture.completedFuture(variablesResponse);
}
StackFrameProxyImpl stackFrame = stackFrames.get(Math.abs(frameId));
if (stackFrame == null) {
variablesResponse.setVariables(new Variable[0]);
return CompletableFuture.completedFuture(variablesResponse);
}
suspendedContext = new SuspendedContext(context, activeThread, stackFrame);
if (frameId < 0) {
variablesResponse.setVariables(computeGlobalScopeVariables(args));
} else {
variablesResponse.setVariables(computeLocalScopeVariables(args));
}
return CompletableFuture.completedFuture(variablesResponse);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
variablesResponse.setVariables(new Variable[0]);
return CompletableFuture.completedFuture(variablesResponse);
}
}

Line under review: return CompletableFuture.completedFuture(variablesResponse);

Code after addressing the review:
public CompletableFuture<VariablesResponse> variables(VariablesArguments args) {
VariablesResponse variablesResponse = new VariablesResponse();
try {
Integer frameId = scopeIdToFrameIds.get(args.getVariablesReference());
if (frameId == null) {
variablesResponse.setVariables(computeChildVariables(args));
return CompletableFuture.completedFuture(variablesResponse);
}
StackFrameProxyImpl stackFrame = stackFrames.get(Math.abs(frameId));
if (stackFrame == null) {
variablesResponse.setVariables(new Variable[0]);
return CompletableFuture.completedFuture(variablesResponse);
}
suspendedContext = new SuspendedContext(context, activeThread, stackFrame);
if (frameId < 0) {
variablesResponse.setVariables(computeGlobalScopeVariables(args));
} else {
variablesResponse.setVariables(computeLocalScopeVariables(args));
}
return CompletableFuture.completedFuture(variablesResponse);
} catch (Exception e) {
LOGGER.error(e.getMessage(), e);
variablesResponse.setVariables(new Variable[0]);
return CompletableFuture.completedFuture(variablesResponse);
}
}
Code review comment: Is this necessary, given that we'll call `FactoryUtil.validateFactoryOptions` and `FactoryUtil.validateUnconsumedKeys` later on?

Code before review:
public DynamicTableSource createDynamicTableSource(Context context) {
createTableFactoryHelper(this, context).validateExcept(FIELDS);
Configuration options = new Configuration();
context.getCatalogTable().getOptions().forEach(options::setString);
TableSchema schema = TableSchemaUtils.getPhysicalSchema(context.getCatalogTable().getSchema());
DataGenerator[] fieldGenerators = new DataGenerator[schema.getFieldCount()];
Set<ConfigOption<?>> optionalOptions = new HashSet<>();
for (int i = 0; i < fieldGenerators.length; i++) {
String name = schema.getFieldNames()[i];
DataType type = schema.getFieldDataTypes()[i];
ConfigOption<String> kind = key(FIELDS + "." + name + "." + KIND)
.stringType().defaultValue(RANDOM);
DataGeneratorContainer container = createContainer(name, type, options.get(kind), options);
fieldGenerators[i] = container.generator;
optionalOptions.add(kind);
optionalOptions.addAll(container.options);
}
FactoryUtil.validateFactoryOptions(new HashSet<>(), optionalOptions, options);
Set<String> consumedOptionKeys = new HashSet<>();
consumedOptionKeys.add(CONNECTOR.key());
consumedOptionKeys.add(ROWS_PER_SECOND.key());
optionalOptions.stream().map(ConfigOption::key).forEach(consumedOptionKeys::add);
FactoryUtil.validateUnconsumedKeys(factoryIdentifier(), options.keySet(), consumedOptionKeys);
return new DataGenTableSource(fieldGenerators, schema, options.get(ROWS_PER_SECOND));
}

Line under review: createTableFactoryHelper(this, context).validateExcept(FIELDS);

Code after addressing the review:
public DynamicTableSource createDynamicTableSource(Context context) {
Configuration options = new Configuration();
context.getCatalogTable().getOptions().forEach(options::setString);
TableSchema schema = TableSchemaUtils.getPhysicalSchema(context.getCatalogTable().getSchema());
DataGenerator[] fieldGenerators = new DataGenerator[schema.getFieldCount()];
Set<ConfigOption<?>> optionalOptions = new HashSet<>();
for (int i = 0; i < fieldGenerators.length; i++) {
String name = schema.getFieldNames()[i];
DataType type = schema.getFieldDataTypes()[i];
ConfigOption<String> kind = key(FIELDS + "." + name + "." + KIND)
.stringType().defaultValue(RANDOM);
DataGeneratorContainer container = createContainer(name, type, options.get(kind), options);
fieldGenerators[i] = container.generator;
optionalOptions.add(kind);
optionalOptions.addAll(container.options);
}
FactoryUtil.validateFactoryOptions(requiredOptions(), optionalOptions, options);
Set<String> consumedOptionKeys = new HashSet<>();
consumedOptionKeys.add(CONNECTOR.key());
consumedOptionKeys.add(ROWS_PER_SECOND.key());
optionalOptions.stream().map(ConfigOption::key).forEach(consumedOptionKeys::add);
FactoryUtil.validateUnconsumedKeys(factoryIdentifier(), options.keySet(), consumedOptionKeys);
return new DataGenTableSource(fieldGenerators, schema, options.get(ROWS_PER_SECOND));
}
Code review comment: nit: can use `hasSize` This also applies to below lines.

Code before review:
void testLazyInitialization() throws Exception {
final int parallelism = 3;
final int configuredMaxParallelism = 12;
final ExecutionJobVertex ejv =
createDynamicExecutionJobVertex(parallelism, configuredMaxParallelism, -1);
Assertions.assertThat(ejv.getParallelism()).isEqualTo(parallelism);
Assertions.assertThat(ejv.getMaxParallelism()).isEqualTo(configuredMaxParallelism);
Assertions.assertThat(ejv.isInitialized()).isFalse();
Assertions.assertThat(ejv.getTaskVertices()).isEmpty();
Assertions.assertThatThrownBy(ejv::getInputs).isInstanceOf(IllegalStateException.class);
Assertions.assertThatThrownBy(ejv::getProducedDataSets)
.isInstanceOf(IllegalStateException.class);
Assertions.assertThatThrownBy(ejv::getSplitAssigner)
.isInstanceOf(IllegalStateException.class);
Assertions.assertThatThrownBy(ejv::getOperatorCoordinators)
.isInstanceOf(IllegalStateException.class);
Assertions.assertThatThrownBy(() -> ejv.connectToPredecessors(Collections.emptyMap()))
.isInstanceOf(IllegalStateException.class);
Assertions.assertThatThrownBy(ejv::executionVertexFinished)
.isInstanceOf(IllegalStateException.class);
Assertions.assertThatThrownBy(ejv::executionVertexUnFinished)
.isInstanceOf(IllegalStateException.class);
initializeVertex(ejv);
Assertions.assertThat(ejv.isInitialized()).isTrue();
Assertions.assertThat(ejv.getTaskVertices().length).isEqualTo(3);
Assertions.assertThat(ejv.getInputs().size()).isEqualTo(0);
Assertions.assertThat(ejv.getProducedDataSets().length).isEqualTo(1);
Assertions.assertThat(ejv.getOperatorCoordinators().size()).isEqualTo(0);
}

Line under review: Assertions.assertThat(ejv.getTaskVertices().length).isEqualTo(3);

Code after addressing the review:
void testLazyInitialization() throws Exception {
final int parallelism = 3;
final int configuredMaxParallelism = 12;
final ExecutionJobVertex ejv =
createDynamicExecutionJobVertex(parallelism, configuredMaxParallelism, -1);
assertThat(ejv.getParallelism()).isEqualTo(parallelism);
assertThat(ejv.getMaxParallelism()).isEqualTo(configuredMaxParallelism);
assertThat(ejv.isInitialized()).isFalse();
assertThat(ejv.getTaskVertices()).isEmpty();
assertThatThrownBy(ejv::getInputs).isInstanceOf(IllegalStateException.class);
assertThatThrownBy(ejv::getProducedDataSets).isInstanceOf(IllegalStateException.class);
assertThatThrownBy(ejv::getSplitAssigner).isInstanceOf(IllegalStateException.class);
assertThatThrownBy(ejv::getOperatorCoordinators).isInstanceOf(IllegalStateException.class);
assertThatThrownBy(() -> ejv.connectToPredecessors(Collections.emptyMap()))
.isInstanceOf(IllegalStateException.class);
assertThatThrownBy(ejv::executionVertexFinished).isInstanceOf(IllegalStateException.class);
assertThatThrownBy(ejv::executionVertexUnFinished)
.isInstanceOf(IllegalStateException.class);
initializeVertex(ejv);
assertThat(ejv.isInitialized()).isTrue();
assertThat(ejv.getTaskVertices()).hasSize(3);
assertThat(ejv.getInputs()).isEmpty();
assertThat(ejv.getProducedDataSets()).hasSize(1);
assertThat(ejv.getOperatorCoordinators()).isEmpty();
}
Code review comment: `describe formatted tbl` => `DESCRIBE FORMATTED `TBL`` ?

Code before review:
public void testDescribeTable() {
sql("describe tbl").ok("DESCRIBE `TBL`");
sql("describe extended tbl").ok("DESCRIBE EXTENDED `TBL`");
sql("describe formatted tbl").ok("DESCRIBE EXTENDED `TBL`");
}

Line under review: }

Code after addressing the review:
public void testDescribeTable() {
sql("describe tbl").ok("DESCRIBE `TBL`");
sql("describe extended tbl").ok("DESCRIBE EXTENDED `TBL`");
sql("describe formatted tbl").ok("DESCRIBE FORMATTED `TBL`");
}
Code review comment: we should call `view.unsynchronizedGetNumberOfQueuedBuffers` instead.

Code before review:
public int unsynchronizedGetNumberOfQueuedBuffers() {
ResultSubpartitionView view = subpartitionView;
if (view != null) {
return subpartitionView.unsynchronizedGetNumberOfQueuedBuffers();
}
return 0;
}

Line under review: return subpartitionView.unsynchronizedGetNumberOfQueuedBuffers();

Code after addressing the review:
public int unsynchronizedGetNumberOfQueuedBuffers() {
ResultSubpartitionView view = subpartitionView;
if (view != null) {
return view.unsynchronizedGetNumberOfQueuedBuffers();
}
return 0;
}
Code review comment: Why check is isMaterializedView in this function instead of check this outside and call getPartitionNamesToRefreshForMv dirctly?

Code before review:
public Set<String> getUpdatedPartitionNamesOfTable(Table base, boolean withMv) {
if (!base.isLocalTable()) {
return Sets.newHashSet();
}
OlapTable baseTable = (OlapTable) base;
Map<String, BasePartitionInfo> baseTableVisibleVersionMap = getRefreshScheme()
.getAsyncRefreshContext()
.getBaseTableVisibleVersionMap()
.computeIfAbsent(baseTable.getId(), k -> Maps.newHashMap());
Set<String> result = Sets.newHashSet();
for (String partitionName : baseTable.getPartitionNames()) {
if (!baseTableVisibleVersionMap.containsKey(partitionName)
&& baseTable.getPartition(partitionName).getVisibleVersion() != 1) {
result.add(partitionName);
}
}
for (Map.Entry<String, BasePartitionInfo> versionEntry : baseTableVisibleVersionMap.entrySet()) {
String basePartitionName = versionEntry.getKey();
Partition basePartition = baseTable.getPartition(basePartitionName);
if (basePartition == null) {
result.addAll(baseTable.getPartitionNames());
return result;
}
BasePartitionInfo basePartitionInfo = versionEntry.getValue();
if (basePartitionInfo == null
|| basePartitionInfo.getId() != basePartition.getId()
|| basePartition.getVisibleVersion() > basePartitionInfo.getVersion()) {
result.add(basePartitionName);
}
}
if (withMv && baseTable.isMaterializedView()) {
Set<String> partitionNames = ((MaterializedView) baseTable).getPartitionNamesToRefreshForMv();
result.addAll(partitionNames);
}
return result;
}

Line under review: Set<String> partitionNames = ((MaterializedView) baseTable).getPartitionNamesToRefreshForMv();

Code after addressing the review:
public Set<String> getUpdatedPartitionNamesOfTable(Table base, boolean withMv) {
if (!base.isLocalTable()) {
return Sets.newHashSet();
}
OlapTable baseTable = (OlapTable) base;
Map<String, BasePartitionInfo> baseTableVisibleVersionMap = getRefreshScheme()
.getAsyncRefreshContext()
.getBaseTableVisibleVersionMap()
.computeIfAbsent(baseTable.getId(), k -> Maps.newHashMap());
Set<String> result = Sets.newHashSet();
for (String partitionName : baseTable.getPartitionNames()) {
if (!baseTableVisibleVersionMap.containsKey(partitionName)
&& baseTable.getPartition(partitionName).getVisibleVersion() != 1) {
result.add(partitionName);
}
}
for (Map.Entry<String, BasePartitionInfo> versionEntry : baseTableVisibleVersionMap.entrySet()) {
String basePartitionName = versionEntry.getKey();
Partition basePartition = baseTable.getPartition(basePartitionName);
if (basePartition == null) {
result.addAll(baseTable.getPartitionNames());
return result;
}
BasePartitionInfo basePartitionInfo = versionEntry.getValue();
if (basePartitionInfo == null
|| basePartitionInfo.getId() != basePartition.getId()
|| basePartition.getVisibleVersion() > basePartitionInfo.getVersion()) {
result.add(basePartitionName);
}
}
if (withMv && baseTable.isMaterializedView()) {
Set<String> partitionNames = ((MaterializedView) baseTable).getPartitionNamesToRefreshForMv();
result.addAll(partitionNames);
}
return result;
}
Code review comment: ```suggestion 		final Optional<AllocatedSlot> freedSlot = slotPool.freeReservedSlot(allocationId, currentTime); ```

Code before review:
public ResourceCounter freeReservedSlot(AllocationID allocationId, @Nullable Throwable cause, long currentTime) {
LOG.debug("Release slot {}.", allocationId);
final Optional<AllocatedSlot> releasedSlot = slotPool.freeReservedSlot(allocationId, currentTime);
Optional<ResourceCounter> previouslyFulfilledRequirement = releasedSlot.map(Collections::singleton).map(this::getFulfilledRequirements);
releasedSlot.ifPresent(allocatedSlot -> {
releasePayload(Collections.singleton(allocatedSlot), cause);
tryToFulfillResourceRequirement(allocatedSlot);
notifyNewSlots.accept(Collections.singletonList(allocatedSlot));
});
return previouslyFulfilledRequirement.orElseGet(ResourceCounter::empty);
}

Line under review: final Optional<AllocatedSlot> releasedSlot = slotPool.freeReservedSlot(allocationId, currentTime);

Code after addressing the review:
public ResourceCounter freeReservedSlot(AllocationID allocationId, @Nullable Throwable cause, long currentTime) {
LOG.debug("Free reserved slot {}.", allocationId);
final Optional<AllocatedSlot> freedSlot = slotPool.freeReservedSlot(allocationId, currentTime);
Optional<ResourceCounter> previouslyFulfilledRequirement = freedSlot.map(Collections::singleton).map(this::getFulfilledRequirements);
freedSlot.ifPresent(allocatedSlot -> {
releasePayload(Collections.singleton(allocatedSlot), cause);
tryToFulfillResourceRequirement(allocatedSlot);
notifyNewSlots.accept(Collections.singletonList(allocatedSlot));
});
return previouslyFulfilledRequirement.orElseGet(ResourceCounter::empty);
}
Code review comment: I think I misunderstood, removed it.

Code before review:
public static boolean usesMultimapState(DoFn<?, ?> doFn) {
return usesGivenStateClass(doFn, MultimapState.class) || requiresTimeSortedInput(doFn);
}

Line under review: return usesGivenStateClass(doFn, MultimapState.class) || requiresTimeSortedInput(doFn);

Code after addressing the review:
public static boolean usesMultimapState(DoFn<?, ?> doFn) {
return usesGivenStateClass(doFn, MultimapState.class);
}
Code review comment: this description is used only for the purpose of logging if the connection is lost (see [ZooKeeperMultipleComponentLeaderElectionDriver:175](https://github.com/apache/flink/blob/23d942cb6bba947ca3844687a65e8d0451c62041/flink-runtime/src/main/java/org/apache/flink/runtime/leaderelection/ZooKeeperMultipleComponentLeaderElectionDriver.java#L175). I couldn't find any code location where the `ZooKeeperMultipleComponentLeaderElectionDriver.toString` method is utilized. Either, we should add some random string here to differentiate different Dispatcher instances or we could remove it entirely (the k8s implementation doesn't make use of it at all but swallows it in `KubernetesMultipleComponentLeaderElectionDriverFactory.create`

Code before review:
private MultipleComponentLeaderElectionService getOrInitializeSingleLeaderElectionService() {
if (multipleComponentLeaderElectionService == null) {
try {
multipleComponentLeaderElectionService =
new DefaultMultipleComponentLeaderElectionService(
fatalErrorHandler,
"Single leader election service.",
new ZooKeeperMultipleComponentLeaderElectionDriverFactory(
leaderNamespacedCuratorFramework));
} catch (Exception e) {
throw new FlinkRuntimeException(
String.format(
"Could not initialize the %s",
DefaultMultipleComponentLeaderElectionService.class
.getSimpleName()),
e);
}
}
return multipleComponentLeaderElectionService;
}

Line under review: "Single leader election service.",

Code after addressing the review:
private MultipleComponentLeaderElectionService getOrInitializeSingleLeaderElectionService() {
synchronized (lock) {
if (multipleComponentLeaderElectionService == null) {
try {
multipleComponentLeaderElectionService =
new DefaultMultipleComponentLeaderElectionService(
fatalErrorHandler,
new ZooKeeperMultipleComponentLeaderElectionDriverFactory(
leaderNamespacedCuratorFramework));
} catch (Exception e) {
throw new FlinkRuntimeException(
String.format(
"Could not initialize the %s",
DefaultMultipleComponentLeaderElectionService.class
.getSimpleName()),
e);
}
}
return multipleComponentLeaderElectionService;
}
}