muttakin2301/ccr_train_1000 huggingface dataset:
Code review comment: updated.

Code before review:
public void addLinkTest() {
final RecordEventsSpanImpl testSpan =
(RecordEventsSpanImpl) tracer.spanBuilder("new-test-span").startSpan();
final Context traceContext = tracingContext.addData(SPAN_CONTEXT_KEY, testSpan.getContext());
final RecordEventsSpanImpl parentSpanImpl = (RecordEventsSpanImpl) parentSpan;
openCensusTracer.addLink(traceContext);
Assert.assertEquals(parentSpanImpl.toSpanData().getContext().getTraceId(),
testSpan.toSpanData().getContext().getTraceId());
}

Line under review: Assert.assertEquals(parentSpanImpl.toSpanData().getContext().getTraceId(),

Code after addressing the review:
public void addLinkTest() {
final RecordEventsSpanImpl testSpan =
(RecordEventsSpanImpl) tracer.spanBuilder("new-test-span").startSpan();
final Context traceContext = tracingContext.addData(SPAN_CONTEXT_KEY, testSpan.getContext());
final RecordEventsSpanImpl parentSpanImpl = (RecordEventsSpanImpl) parentSpan;
final Link expectedLink = Link.fromSpanContext(testSpan.getContext(), Link.Type.PARENT_LINKED_SPAN);
openCensusTracer.addLink(traceContext);
Link createdLink = parentSpanImpl.toSpanData().getLinks().getLinks().get(0);
Assert.assertEquals(expectedLink.getTraceId(), createdLink.getTraceId());
Assert.assertEquals(expectedLink.getSpanId(), createdLink.getSpanId());
}
Code review comment: OK, thanks, I merged it.

Code before review:
private static void logGuessedPath(String guessedPath) {
System.err.println("======================================================================================");
System.err.println("  native.image.path was not set, making a guess for the correct path of native image");
System.err.println("  guessed path: " + guessedPath);
System.err.println("======================================================================================");
}

Line under review: System.err.println("======================================================================================");

Code after addressing the review:
private static void logGuessedPath(String guessedPath) {
System.err.println("======================================================================================");
System.err.println("  native.image.path was not set, making a guess for the correct path of native image");
System.err.println("  guessed path: " + guessedPath);
System.err.println("======================================================================================");
}
Code review comment: Currently the `throwable` is handled.

Code before review:
private void startJobMasterServiceProcessAsync(UUID leaderSessionId) {
boolean isValid;
synchronized (lock) {
isValid = isValidLeader(leaderSessionId);
}
if (isValid) {
sequentialOperation =
sequentialOperation.thenCompose(
unused ->
runIfValidLeader(
leaderSessionId,
() ->
jobResultStore.hasJobResultEntryAsync(
getJobID()),
"verify jbb result entry")
.handle(
(hasJobResult, throwable) -> {
if (hasJobResult == null) {
return null;
}
if (hasJobResult) {
runIfValidLeader(
leaderSessionId,
() -> {
jobAlreadyDone(
leaderSessionId);
return CompletableFuture
.completedFuture(
null);
},
"check completed job");
} else {
runIfValidLeader(
leaderSessionId,
() -> {
ThrowingRunnable.unchecked(
() ->
createNewJobMasterServiceProcess(
leaderSessionId))
.run();
return CompletableFuture
.completedFuture(
null);
},
"create new job master service process");
}
return null;
}));
} else {
LOG.trace(
"Ignore leader action '{}' because the leadership runner is no longer the valid leader for {}.",
"verify job scheduling status and create JobMasterServiceProcess",
leaderSessionId);
}
handleAsyncOperationError(sequentialOperation, "Could not start the job manager.");
}

Line under review: if (hasJobResult == null) {

Code after addressing the review:
private void startJobMasterServiceProcessAsync(UUID leaderSessionId) {
sequentialOperation =
sequentialOperation.thenCompose(
unused ->
supplyAsyncIfValidLeader(
leaderSessionId,
() ->
jobResultStore.hasJobResultEntryAsync(
getJobID()),
() ->
FutureUtils.completedExceptionally(
new LeadershipLostException(
"The leadership is lost.")))
.handle(
(hasJobResult, throwable) -> {
if (throwable
instanceof LeadershipLostException) {
printLogIfNotValidLeader(
"verify job result entry",
leaderSessionId);
return null;
} else if (throwable != null) {
ExceptionUtils.rethrow(throwable);
}
if (hasJobResult) {
handleJobAlreadyDoneIfValidLeader(
leaderSessionId);
} else {
createNewJobMasterServiceProcessIfValidLeader(
leaderSessionId);
}
return null;
}));
handleAsyncOperationError(sequentialOperation, "Could not start the job manager.");
}
Code review comment: "false" has to be a constant. 

Code before review:
private void addPackageInfo(BPackageSymbol packageSymbol, ProgramFile programFile) {
BLangPackage pkgNode = this.packageCache.get(packageSymbol.pkgID);
if (pkgNode == null) {
packageSymbol.imports.forEach(importPkdSymbol -> addPackageInfo(importPkdSymbol, programFile));
if (!programFile.packageFileMap.containsKey(packageSymbol.pkgID.toString())
&& !packageSymbol.pkgID.orgName.equals(Names.BUILTIN_ORG)) {
programFile.packageFileMap.put(packageSymbol.pkgID.toString(), packageSymbol.packageFile);
}
return;
}
HashSet<BLangImportPackage> importPkgList = new HashSet<>();
importPkgList.addAll(pkgNode.imports);
String testsEnabled = options.get(CompilerOptionName.SKIP_TESTS);
if (testsEnabled != null && testsEnabled.equals("false")) {
pkgNode.getTestablePkgs().forEach(testablePackage -> importPkgList.addAll(testablePackage.imports));
}
importPkgList.forEach(importPkdNode -> addPackageInfo(importPkdNode.symbol, programFile));
if (!programFile.packageFileMap.containsKey(packageSymbol.pkgID.toString())
&& !packageSymbol.pkgID.orgName.equals(Names.BUILTIN_ORG)) {
programFile.packageFileMap.put(packageSymbol.pkgID.toString(), packageSymbol.packageFile);
}
}

Line under review: if (testsEnabled != null && testsEnabled.equals("false")) {

Code after addressing the review:
private void addPackageInfo(BPackageSymbol packageSymbol, ProgramFile programFile) {
BLangPackage pkgNode = this.packageCache.get(packageSymbol.pkgID);
if (pkgNode == null) {
packageSymbol.imports.forEach(importPkdSymbol -> addPackageInfo(importPkdSymbol, programFile));
if (!programFile.packageFileMap.containsKey(packageSymbol.pkgID.toString())
&& !packageSymbol.pkgID.orgName.equals(Names.BUILTIN_ORG)) {
programFile.packageFileMap.put(packageSymbol.pkgID.toString(), packageSymbol.packageFile);
}
return;
}
HashSet<BLangImportPackage> importPkgList = new HashSet<>();
importPkgList.addAll(pkgNode.imports);
String testsEnabled = options.get(CompilerOptionName.SKIP_TESTS);
if (testsEnabled != null && testsEnabled.equals("false")) {
pkgNode.getTestablePkgs().forEach(testablePackage -> importPkgList.addAll(testablePackage.imports));
}
importPkgList.forEach(importPkdNode -> addPackageInfo(importPkdNode.symbol, programFile));
if (!programFile.packageFileMap.containsKey(packageSymbol.pkgID.toString())
&& !packageSymbol.pkgID.orgName.equals(Names.BUILTIN_ORG)) {
programFile.packageFileMap.put(packageSymbol.pkgID.toString(), packageSymbol.packageFile);
}
}
Code review comment: Before this change, the following didn't apply the actual config: https://github.com/quarkusio/quarkus/blob/2b4496718ec46836e2775f669c7c8c5f970ccaa1/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java#L73-L74 because `quarkus.log-build-time.min-level` was looked up, which obviously doesn't exist.

Code before review:
public static void handleObject(Object o) {
final SmallRyeConfig config = (SmallRyeConfig) ConfigProvider.getConfig();
final String clsNameSuffix = getClassNameSuffix(o);
if (clsNameSuffix == null) {
return;
}
final Class<?> cls = o.getClass();
final String name;
ConfigRoot configRoot = cls.getAnnotation(ConfigRoot.class);
if (configRoot != null && !configRoot.name().equals(ConfigItem.HYPHENATED_ELEMENT_NAME)) {
name = configRoot.name();
if (name.startsWith("<<")) {
throw new IllegalArgumentException("Found unsupported @ConfigRoot.name = " + name + " on " + cls);
}
} else {
name = dashify(cls.getSimpleName().substring(0, cls.getSimpleName().length() - clsNameSuffix.length()));
}
handleObject(QUARKUS_PROPERTY_PREFIX + name, o, config, gatherQuarkusPropertyNames(config));
}

Line under review: final Class<?> cls = o.getClass();

Code after addressing the review:
public static void handleObject(Object o) {
final SmallRyeConfig config = (SmallRyeConfig) ConfigProvider.getConfig();
final String clsNameSuffix = getClassNameSuffix(o);
if (clsNameSuffix == null) {
return;
}
final Class<?> cls = o.getClass();
final String name;
ConfigRoot configRoot = cls.getAnnotation(ConfigRoot.class);
if (configRoot != null && !configRoot.name().equals(ConfigItem.HYPHENATED_ELEMENT_NAME)) {
name = configRoot.name();
if (name.startsWith("<<")) {
throw new IllegalArgumentException("Found unsupported @ConfigRoot.name = " + name + " on " + cls);
}
} else {
name = dashify(cls.getSimpleName().substring(0, cls.getSimpleName().length() - clsNameSuffix.length()));
}
handleObject(QUARKUS_PROPERTY_PREFIX + name, o, config, gatherQuarkusPropertyNames(config));
}
Code review comment: move these lines out, then the next comment line is unnecesary

Code before review:
void testSchemaIncludeOption() {
Map<String, String> options = getAllOptions();
options.put("debezium-json.schema-include", "true");
final DebeziumJsonDeserializationSchema expectedDeser =
new DebeziumJsonDeserializationSchema(
PHYSICAL_DATA_TYPE,
Collections.emptyList(),
InternalTypeInfo.of(PHYSICAL_DATA_TYPE.getLogicalType()),
true,
true,
TimestampFormat.ISO_8601);
final DynamicTableSource actualSource = createTableSource(SCHEMA, options);
TestDynamicTableFactory.DynamicTableSourceMock scanSourceMock =
(TestDynamicTableFactory.DynamicTableSourceMock) actualSource;
DeserializationSchema<RowData> actualDeser =
scanSourceMock.valueFormat.createRuntimeDecoder(
ScanRuntimeProviderContext.INSTANCE, PHYSICAL_DATA_TYPE);
assertThat(actualDeser).isEqualTo(expectedDeser);
assertThatThrownBy(
() -> {
final DynamicTableSink actualSink = createTableSink(SCHEMA, options);
TestDynamicTableFactory.DynamicTableSinkMock sinkMock =
(TestDynamicTableFactory.DynamicTableSinkMock) actualSink;
sinkMock.valueFormat.createRuntimeEncoder(
new SinkRuntimeProviderContext(false), PHYSICAL_DATA_TYPE);
fail();
})
.satisfies(
anyCauseMatches(
RuntimeException.class,
"Debezium JSON serialization doesn't support "
+ "'debezium-json.schema-include' option been set to true."));
}

Line under review: (TestDynamicTableFactory.DynamicTableSinkMock) actualSink;

Code after addressing the review:
void testSchemaIncludeOption() {
Map<String, String> options = getAllOptions();
options.put("debezium-json.schema-include", "true");
final DebeziumJsonDeserializationSchema expectedDeser =
new DebeziumJsonDeserializationSchema(
PHYSICAL_DATA_TYPE,
Collections.emptyList(),
InternalTypeInfo.of(PHYSICAL_DATA_TYPE.getLogicalType()),
true,
true,
TimestampFormat.ISO_8601);
final DynamicTableSource actualSource = createTableSource(SCHEMA, options);
TestDynamicTableFactory.DynamicTableSourceMock scanSourceMock =
(TestDynamicTableFactory.DynamicTableSourceMock) actualSource;
DeserializationSchema<RowData> actualDeser =
scanSourceMock.valueFormat.createRuntimeDecoder(
ScanRuntimeProviderContext.INSTANCE, PHYSICAL_DATA_TYPE);
assertThat(actualDeser).isEqualTo(expectedDeser);
assertThatThrownBy(
() -> {
final DynamicTableSink actualSink = createTableSink(SCHEMA, options);
TestDynamicTableFactory.DynamicTableSinkMock sinkMock =
(TestDynamicTableFactory.DynamicTableSinkMock) actualSink;
sinkMock.valueFormat.createRuntimeEncoder(
new SinkRuntimeProviderContext(false), PHYSICAL_DATA_TYPE);
})
.satisfies(
anyCauseMatches(
RuntimeException.class,
"Debezium JSON serialization doesn't support "
+ "'debezium-json.schema-include' option been set to true."));
}
Code review comment: no

Code before review:
private void doPreHeat() {
List<ResultRow> recentStatsUpdatedCols = null;
long retryTimes = 0;
while (retryTimes < StatisticConstants.PRELOAD_RETRY_TIMES) {
try {
recentStatsUpdatedCols = StatisticsRepository.fetchRecentStatsUpdatedCol();
break;
} catch (Throwable t) {
}
retryTimes++;
try {
Thread.sleep(StatisticConstants.PRELOAD_RETRY_INTERVAL_IN_SECONDS);
} catch (Throwable t) {
}
}
if (CollectionUtils.isEmpty(recentStatsUpdatedCols)) {
return;
}
for (ResultRow r : recentStatsUpdatedCols) {
try {
String tblId = r.getColumnValue("tbl_id");
String idxId = r.getColumnValue("idx_id");
String colId = r.getColumnValue("col_id");
final StatisticsCacheKey k =
new StatisticsCacheKey(Long.parseLong(tblId), Long.parseLong(idxId), colId);
final ColumnStatistic c = ColumnStatistic.fromResultRow(r);
CompletableFuture<Optional<ColumnStatistic>> f = new CompletableFuture<Optional<ColumnStatistic>>() {
@Override
public Optional<ColumnStatistic> get() throws InterruptedException, ExecutionException {
return Optional.of(c);
}
@Override
public boolean isDone() {
return true;
}
@Override
public boolean complete(Optional<ColumnStatistic> value) {
return true;
}
@Override
public Optional<ColumnStatistic> join() {
return Optional.of(c);
}
};
columnStatisticsCache.put(k, f);
} catch (Throwable t) {
LOG.warn("Error when preheating stats cache", t);
}
}
}

Line under review: try {

Code after addressing the review:
private void doPreHeat() {
List<ResultRow> recentStatsUpdatedCols = null;
long retryTimes = 0;
while (retryTimes < StatisticConstants.PRELOAD_RETRY_TIMES) {
try {
recentStatsUpdatedCols = StatisticsRepository.fetchRecentStatsUpdatedCol();
break;
} catch (Throwable t) {
}
retryTimes++;
try {
Thread.sleep(StatisticConstants.PRELOAD_RETRY_INTERVAL_IN_SECONDS);
} catch (Throwable t) {
}
}
if (CollectionUtils.isEmpty(recentStatsUpdatedCols)) {
return;
}
for (ResultRow r : recentStatsUpdatedCols) {
try {
String tblId = r.getColumnValue("tbl_id");
String idxId = r.getColumnValue("idx_id");
String colId = r.getColumnValue("col_id");
final StatisticsCacheKey k =
new StatisticsCacheKey(Long.parseLong(tblId), Long.parseLong(idxId), colId);
final ColumnStatistic c = ColumnStatistic.fromResultRow(r);
CompletableFuture<Optional<ColumnStatistic>> f = new CompletableFuture<Optional<ColumnStatistic>>() {
@Override
public Optional<ColumnStatistic> get() throws InterruptedException, ExecutionException {
return Optional.of(c);
}
@Override
public boolean isDone() {
return true;
}
@Override
public boolean complete(Optional<ColumnStatistic> value) {
return true;
}
@Override
public Optional<ColumnStatistic> join() {
return Optional.of(c);
}
};
columnStatisticsCache.put(k, f);
} catch (Throwable t) {
LOG.warn("Error when preheating stats cache", t);
}
}
}
Code review comment: ```suggestion                 throw new WebSocketServerException("Unable to obtain the connection from the Vert.x duplicated context"); ```

Code before review:
public Supplier<Object> connectionSupplier() {
return new Supplier<Object>() {
@Override
public Object get() {
Context context = Vertx.currentContext();
if (context != null && VertxContext.isDuplicatedContext(context)) {
Object connection = context.getLocal(WEB_SOCKET_CONN_KEY);
if (connection != null) {
return connection;
}
}
throw new WebSocketServerException("Unable to obtain the connection from the Vertx duplicated context");
}
};
}

Line under review: throw new WebSocketServerException("Unable to obtain the connection from the Vertx duplicated context");

Code after addressing the review:
public Supplier<Object> connectionSupplier() {
return new Supplier<Object>() {
@Override
public Object get() {
Context context = Vertx.currentContext();
if (context != null && VertxContext.isDuplicatedContext(context)) {
Object connection = context.getLocal(WEB_SOCKET_CONN_KEY);
if (connection != null) {
return connection;
}
}
throw new WebSocketServerException("Unable to obtain the connection from the Vert.x duplicated context");
}
};
}
Code review comment: >MSICredentials() [](start = 49, length = 16)  Replaced our custom implementations with this API. Verified it works on vm. #Resolved

Code before review:
public CompletableFuture<SecurityToken> getSecurityTokenAsync(String audience) {
CompletableFuture<SecurityToken> tokenGeneratingFuture = new CompletableFuture<>();
MessagingFactory.INTERNAL_THREAD_POOL.execute(() -> {
try {
MSICredentials credentials = new MSICredentials();
String rawToken = credentials.getToken(SecurityConstants.SERVICEBUS_AAD_AUDIENCE_RESOURCE_URL);
Date expiry = getExpirationDateTimeUtcFromToken(rawToken);
tokenGeneratingFuture.complete(new SecurityToken(SecurityTokenType.JWT, audience, rawToken, Instant.now(), expiry.toInstant()));
} catch (IOException e) {
TRACE_LOGGER.error("ManagedIdentity token generation failed.", e);
tokenGeneratingFuture.completeExceptionally(e);
} catch (ParseException e) {
TRACE_LOGGER.error("Could not parse the expiry time from the Managed Identity token string.", e);
tokenGeneratingFuture.completeExceptionally(e);
}
});
return tokenGeneratingFuture;
}

Line under review: MSICredentials credentials = new MSICredentials();

Code after addressing the review:
public CompletableFuture<SecurityToken> getSecurityTokenAsync(String audience) {
CompletableFuture<SecurityToken> tokenGeneratingFuture = new CompletableFuture<>();
MessagingFactory.INTERNAL_THREAD_POOL.execute(() -> {
try {
MSICredentials credentials = new MSICredentials();
String rawToken = credentials.getToken(SecurityConstants.SERVICEBUS_AAD_AUDIENCE_RESOURCE_URL);
Date expiry = getExpirationDateTimeUtcFromToken(rawToken);
tokenGeneratingFuture.complete(new SecurityToken(SecurityTokenType.JWT, audience, rawToken, Instant.now(), expiry.toInstant()));
} catch (IOException e) {
TRACE_LOGGER.error("ManagedIdentity token generation failed.", e);
tokenGeneratingFuture.completeExceptionally(e);
} catch (ParseException e) {
TRACE_LOGGER.error("Could not parse the expiry time from the Managed Identity token string.", e);
tokenGeneratingFuture.completeExceptionally(e);
}
});
return tokenGeneratingFuture;
}
Code review comment: Done

Code before review:
public boolean replaceMatch(Pattern pattern, Function<Match, String> replacer) {
Optional<Match> match = moveForwardToStartOfMatch(pattern);
if (!match.isPresent()) {
return false;
}
textBuffer.delete(match.get().startOfMatch(), match.get().endOfMatch());
write(replacer.apply(match.get()));
return true;
}


Code after addressing the review:
public boolean replaceMatch(Pattern pattern, Function<Match, String> replacer) {
Optional<Match> match = moveForwardToStartOfMatch(pattern);
if (!match.isPresent()) {
return false;
}
textBuffer.delete(match.get().startOfMatch(), match.get().endOfMatch());
write(replacer.apply(match.get()));
return true;
}
Code review comment: Done

Code before review:
new BundleProgressHandler() {
@Override
public void onProgress(ProcessBundleProgressResponse progress) {
if (progress.hasSplit()) {
feeder.split(progress.getSplit());
}
}
@Override
public void onCompleted(ProcessBundleResponse response) {
if (response.hasSplit()) {
feeder.split(response.getSplit());
}
}
});

Line under review: feeder.split(progress.getSplit());

Code after addressing the review:
new BundleProgressHandler() {
@Override
public void onProgress(ProcessBundleProgressResponse progress) {
if (progress.hasSplit()) {
feeder.split(progress.getSplit());
}
}
@Override
public void onCompleted(ProcessBundleResponse response) {
if (response.hasSplit()) {
feeder.split(response.getSplit());
}
}
}
Code review comment: `node.getKind()` can be extracted out to a variable.

Code before review:
private void updateAndCleanPrevEnvsForNarrowedEnvFollowingIfWithoutElse(BLangNode node) {
if (node.getKind() != NodeKind.IF && node.getKind() != NodeKind.BLOCK &&
node.getKind() != NodeKind.BLOCK_FUNCTION_BODY) {
return;
}
if (node.getKind() == NodeKind.BLOCK || node.getKind() == NodeKind.BLOCK_FUNCTION_BODY) {
if (this.prevEnvs.peek() != null && this.prevEnvs.peek().node == node) {
this.prevEnvs.pop();
}
return;
}
BLangIf ifNode = (BLangIf) node;
if (ifNode.elseStmt == null && this.notCompletedNormally) {
BLangExpression expr = ifNode.expr;
boolean constTrueCondition =
ConditionResolver.checkConstCondition(types, symTable, expr) == symTable.trueType;
if (!constTrueCondition) {
SymbolEnv narrowedEnv = typeNarrower.evaluateFalsityFollowingIfWithoutElse(expr, env);
this.prevEnvs.push(narrowedEnv);
}
this.notCompletedNormally = constTrueCondition;
}
}

Line under review: if (node.getKind() != NodeKind.IF && node.getKind() != NodeKind.BLOCK &&

Code after addressing the review:
private void updateAndCleanPrevEnvsForNarrowedEnvFollowingIfWithoutElse(BLangNode node) {
if (node.getKind() != NodeKind.IF && node.getKind() != NodeKind.BLOCK &&
node.getKind() != NodeKind.BLOCK_FUNCTION_BODY) {
return;
}
if (node.getKind() == NodeKind.BLOCK || node.getKind() == NodeKind.BLOCK_FUNCTION_BODY) {
if (this.prevEnvs.peek() != null && this.prevEnvs.peek().node == node) {
this.prevEnvs.pop();
}
return;
}
BLangIf ifNode = (BLangIf) node;
if (ifNode.elseStmt == null && this.notCompletedNormally) {
BLangExpression expr = ifNode.expr;
boolean constTrueCondition =
ConditionResolver.checkConstCondition(types, symTable, expr) == symTable.trueType;
if (!constTrueCondition) {
SymbolEnv narrowedEnv = typeNarrower.evaluateFalsityFollowingIfWithoutElse(expr, env);
this.prevEnvs.push(narrowedEnv);
}
this.notCompletedNormally = constTrueCondition;
}
}
Code review comment: `cursorsOfFinishedSplits.keySet().removeAll(cursors.keySet())`

Code before review:
public void notifyCheckpointComplete(long checkpointId) throws Exception {
LOG.debug("Committing cursors for checkpoint {}", checkpointId);
Map<TopicPartition, MessageId> cursors = cursorsToCommit.get(checkpointId);
try {
((PulsarOrderedFetcherManager<OUT>) splitFetcherManager).acknowledgeMessages(cursors);
LOG.debug("Successfully acknowledge cursors for checkpoint {}", checkpointId);
cursorsOfFinishedSplits
.entrySet()
.removeIf(entry -> cursors.containsKey(entry.getKey()));
while (!cursorsToCommit.isEmpty() && cursorsToCommit.firstKey() <= checkpointId) {
cursorsToCommit.remove(cursorsToCommit.firstKey());
}
} catch (Exception e) {
LOG.error("Failed to acknowledge cursors for checkpoint {}", checkpointId, e);
}
}

Line under review: .removeIf(entry -> cursors.containsKey(entry.getKey()));

Code after addressing the review:
public void notifyCheckpointComplete(long checkpointId) throws Exception {
LOG.debug("Committing cursors for checkpoint {}", checkpointId);
Map<TopicPartition, MessageId> cursors = cursorsToCommit.get(checkpointId);
try {
((PulsarOrderedFetcherManager<OUT>) splitFetcherManager).acknowledgeMessages(cursors);
LOG.debug("Successfully acknowledge cursors for checkpoint {}", checkpointId);
cursorsOfFinishedSplits.keySet().removeAll(cursors.keySet());
cursorsToCommit.headMap(checkpointId + 1).clear();
} catch (Exception e) {
LOG.error("Failed to acknowledge cursors for checkpoint {}", checkpointId, e);
cursorCommitThrowable.compareAndSet(null, e);
}
}
Code review comment: See https://github.com/quarkusio/quarkus/blob/master/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/SyntheticBeanBuildItem.java#L75 .

Code before review:
public Supplier<CacheManager> getCacheManagerSupplier(Set<String> cacheNames) {
Objects.requireNonNull(cacheNames);
CacheManager cacheManager;
if (cacheNames.isEmpty()) {
cacheManager = new CacheManagerImpl(Collections.emptyMap());
} else {
Map<String, Cache> caches = new HashMap<>(cacheNames.size() + 1, 1.0F);
NoOpCache cache = new NoOpCache();
for (String cacheName : cacheNames) {
caches.put(cacheName, cache);
}
cacheManager = new CacheManagerImpl(caches);
}
return new Supplier<CacheManager>() {
@Override
public CacheManager get() {
return cacheManager;
}
};
}

Line under review: cacheManager = new CacheManagerImpl(caches);

Code after addressing the review:
public Supplier<CacheManager> getCacheManagerSupplier(Set<String> cacheNames) {
Objects.requireNonNull(cacheNames);
return new Supplier<CacheManager>() {
@Override
public CacheManager get() {
if (cacheNames.isEmpty()) {
return new CacheManagerImpl(Collections.emptyMap());
} else {
Map<String, Cache> caches = new HashMap<>(cacheNames.size() + 1, 1.0F);
NoOpCache cache = new NoOpCache();
for (String cacheName : cacheNames) {
caches.put(cacheName, cache);
}
return new CacheManagerImpl(caches);
}
}
};
}
Code review comment: For now, mentioned that this method will disregard non-record type members as a comment.

Code before review:
public static String getModifiedSignature(DocumentServiceContext context, String signature) {
Matcher matcher = TYPE_NAME_DECOMPOSE_PATTERN.matcher(signature);
while (matcher.find()) {
String orgName = matcher.group(1);
String moduleName = matcher.group(2);
String matchedString = matcher.group();
String modulePrefix = getModulePrefix(context, orgName, moduleName);
String replaceText = modulePrefix.isEmpty() ? matchedString + Names.VERSION_SEPARATOR : matchedString;
signature = signature.replace(replaceText, modulePrefix);
}
return signature;
}

Line under review: }

Code after addressing the review:
public static String getModifiedSignature(DocumentServiceContext context, String signature) {
Matcher matcher = TYPE_NAME_DECOMPOSE_PATTERN.matcher(signature);
while (matcher.find()) {
String orgName = matcher.group(1);
String moduleName = matcher.group(2);
String matchedString = matcher.group();
String modulePrefix = getModulePrefix(context, orgName, moduleName);
String replaceText = modulePrefix.isEmpty() ? matchedString + Names.VERSION_SEPARATOR : matchedString;
signature = signature.replace(replaceText, modulePrefix);
}
return signature;
}
Code review comment: Yeah, I think there are a lot of cases where we end up wrapping an exception type in the type itself. I agree, we should look into offering a convenience method for this.

Code before review:
private int getJavaVersion() {
String version = System.getProperty("java.version");
if (CoreUtils.isNullOrEmpty(version)) {
throw LOGGER.logExceptionAsError(new RuntimeException("Can't find 'java.version' system property."));
}
if (version.startsWith("1.")) {
if (version.length() < 3) {
throw LOGGER.logExceptionAsError(new RuntimeException("Can't parse 'java.version':" + version));
}
try {
return Integer.parseInt(version.substring(2, 3));
} catch (Exception t) {
throw LOGGER.logExceptionAsError(new RuntimeException("Can't parse 'java.version':" + version, t));
}
} else {
int idx = version.indexOf(".");
if (idx == -1) {
return Integer.parseInt(version);
}
try {
return Integer.parseInt(version.substring(0, idx));
} catch (Exception t) {
throw LOGGER.logExceptionAsError(new RuntimeException("Can't parse 'java.version':" + version, t));
}
}
}

Line under review: throw LOGGER.logExceptionAsError(new RuntimeException("Can't parse 'java.version':" + version, t));

Code after addressing the review:
private int getJavaVersion() {
String version = System.getProperty("java.version");
if (CoreUtils.isNullOrEmpty(version)) {
throw LOGGER.logExceptionAsError(new RuntimeException("Can't find 'java.version' system property."));
}
if (version.startsWith("1.")) {
if (version.length() < 3) {
throw LOGGER.logExceptionAsError(new RuntimeException("Can't parse 'java.version':" + version));
}
try {
return Integer.parseInt(version.substring(2, 3));
} catch (Exception t) {
throw LOGGER.logExceptionAsError(new RuntimeException("Can't parse 'java.version':" + version, t));
}
} else {
int idx = version.indexOf(".");
if (idx == -1) {
return Integer.parseInt(version);
}
try {
return Integer.parseInt(version.substring(0, idx));
} catch (Exception t) {
throw LOGGER.logExceptionAsError(new RuntimeException("Can't parse 'java.version':" + version, t));
}
}
}
Code review comment: What is usually a varying string? The project path ?  Can you please share an example? 

Code before review:
public void testAnnotationAccess() throws BallerinaTestException, IOException {
String endString = " SEVERE {b7a.log.crash} - ";
String firstString = "We thank you for helping make us better.";
String[] args = mergeCoverageArgs(new String[]{"annotation-access"});
String output = balClient.runMainAndReadStdOut("test", args,
new HashMap<>(), projectPath, true);
output = CommonUtils.replaceVaryingString(firstString, endString, output);
AssertionUtils.assertOutput("BasicCasesTest-testAnnotationAccess.txt", output);
}

Line under review: output = CommonUtils.replaceVaryingString(firstString, endString, output);

Code after addressing the review:
public void testAnnotationAccess() throws BallerinaTestException, IOException {
String endString = " SEVERE {b7a.log.crash} - ";
String firstString = "We thank you for helping make us better.";
String[] args = mergeCoverageArgs(new String[]{"annotation-access"});
String output = balClient.runMainAndReadStdOut("test", args,
new HashMap<>(), projectPath, true);
output = CommonUtils.replaceVaryingString(firstString, endString, output);
AssertionUtils.assertOutput("BasicCasesTest-testAnnotationAccess.txt", output);
}
Code review comment: Can't put it after `INSTANCE `, because must after `private Constructor`

Code before review:
public static PipelineJobExecutor getInstance() {
return INSTANCE;
}

Line under review: }

Code after addressing the review:
public static PipelineJobExecutor getInstance() {
return INSTANCE;
}
Code review comment: ```suggestion     byte[] byteArray = rawString.getBytes(StandardCharsets.US_ASCII); ```

Code before review:
public void testNestedContext() throws Exception {
DataSampler sampler = new DataSampler();
String rawString = "hello";
byte[] byteArray = rawString.getBytes(Charset.forName("ASCII"));
ByteArrayCoder coder = ByteArrayCoder.of();
sampler.sampleOutput("pcollection-id", coder).sample(byteArray);
BeamFnApi.InstructionResponse samples = getAllSamples(sampler);
assertHasSamples(samples, "pcollection-id", Collections.singleton(encodeByteArray(byteArray)));
}

Line under review: byte[] byteArray = rawString.getBytes(Charset.forName("ASCII"));

Code after addressing the review:
public void testNestedContext() throws Exception {
DataSampler sampler = new DataSampler();
String rawString = "hello";
byte[] byteArray = rawString.getBytes(StandardCharsets.US_ASCII);
ByteArrayCoder coder = ByteArrayCoder.of();
sampler.sampleOutput("pcollection-id", coder).sample(byteArray);
BeamFnApi.InstructionResponse samples = getAllSamples(sampler);
assertHasSamples(samples, "pcollection-id", Collections.singleton(encodeByteArray(byteArray)));
}
Code review comment: Why is  `0 < minGroupsUpRatio < 0.01`  disallowed?

Code before review:
private static Optional<Integer> maxGroupsAllowedDown(ModelElement tuning, boolean allowMoreThanOneContentGroupDown, int numberOfLeafGroups) {
var minGroupsUpRatio = tuning.childAsDouble("min-group-up-ratio");
if (minGroupsUpRatio != null) {
if (minGroupsUpRatio < 0.01 || minGroupsUpRatio > 1)
throw new IllegalArgumentException("min-groups-up-ratio must be between 0.01 and 1, got " + minGroupsUpRatio);
double minGroupsUp = minGroupsUpRatio * numberOfLeafGroups;
var maxGroupsAllowedDown = Math.max(1, numberOfLeafGroups - (int) Math.ceil(minGroupsUp));
return allowMoreThanOneContentGroupDown ? Optional.of(maxGroupsAllowedDown) : Optional.empty();
}
return Optional.empty();
}

Line under review: if (minGroupsUpRatio < 0.01 || minGroupsUpRatio > 1)

Code after addressing the review:
private static Optional<Integer> maxGroupsAllowedDown(ModelElement tuning, boolean allowMoreThanOneContentGroupDown, int numberOfLeafGroups) {
var groupsAllowedDownRatio = tuning.childAsDouble("groups-allowed-down-ratio");
if (groupsAllowedDownRatio != null) {
if (groupsAllowedDownRatio < 0 || groupsAllowedDownRatio > 1)
throw new IllegalArgumentException("groups-allowed-down-ratio must be between 0 and 1, got " + groupsAllowedDownRatio);
var maxGroupsAllowedDown = Math.max(1, (int) Math.floor(groupsAllowedDownRatio * numberOfLeafGroups));
return allowMoreThanOneContentGroupDown ? Optional.of(maxGroupsAllowedDown) : Optional.empty();
}
return Optional.empty();
}
Code review comment: ```suggestion                             assertThat(optionalCause.get())                                     .hasMessage(exceptionMessage); ```

Code before review:
public void testRunAsyncCausesFatalError() throws Exception {
new Context() {
{
final String exceptionMessage = "runAsyncCausesFatalError";
addContainerRequestFutures.add(CompletableFuture.completedFuture(null));
testingYarnAMRMClientAsyncBuilder.setGetMatchingRequestsFunction(
ignored -> {
throw new RuntimeException(exceptionMessage);
});
final CompletableFuture<Throwable> throwableCompletableFuture =
new CompletableFuture<>();
resourceEventHandlerBuilder.setOnErrorConsumer(
throwableCompletableFuture::complete);
runTest(
() -> {
runInMainThread(
() ->
getDriver()
.requestResource(
testingTaskExecutorProcessSpec));
resourceManagerClientCallbackHandler.onContainersAllocated(
ImmutableList.of(testingContainer));
Throwable t =
throwableCompletableFuture.get(TIMEOUT_SEC, TimeUnit.SECONDS);
final Optional<RuntimeException> optionalCause =
ExceptionUtils.findThrowable(t, RuntimeException.class);
assertThat(optionalCause).isPresent();
assertThat(optionalCause.get().getMessage())
.isEqualTo(exceptionMessage);
});
}
};
}

Line under review: .isEqualTo(exceptionMessage);

Code after addressing the review:
public void testRunAsyncCausesFatalError() throws Exception {
new Context() {
{
final String exceptionMessage = "runAsyncCausesFatalError";
addContainerRequestFutures.add(CompletableFuture.completedFuture(null));
testingYarnAMRMClientAsyncBuilder.setGetMatchingRequestsFunction(
ignored -> {
throw new RuntimeException(exceptionMessage);
});
final CompletableFuture<Throwable> throwableCompletableFuture =
new CompletableFuture<>();
resourceEventHandlerBuilder.setOnErrorConsumer(
throwableCompletableFuture::complete);
runTest(
() -> {
runInMainThread(
() ->
getDriver()
.requestResource(
testingTaskExecutorProcessSpec));
resourceManagerClientCallbackHandler.onContainersAllocated(
ImmutableList.of(testingContainer));
Throwable t =
throwableCompletableFuture.get(TIMEOUT_SEC, TimeUnit.SECONDS);
final Optional<RuntimeException> optionalCause =
ExceptionUtils.findThrowable(t, RuntimeException.class);
assertThat(optionalCause).isPresent();
assertThat(optionalCause.get()).hasMessage(exceptionMessage);
});
}
};
}
Code review comment: Thanks for the suggestion @becketqin ! Implemented in f7c873d

Code before review:
private boolean offsetCommitEnabledManually() {
boolean autoCommit =
props.containsKey(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG)
&& Boolean.parseBoolean(
props.getProperty(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG));
boolean commitOnCheckpoint =
props.containsKey(KafkaSourceOptions.COMMIT_OFFSETS_ON_CHECKPOINT.key())
&& Boolean.parseBoolean(
props.getProperty(
KafkaSourceOptions.COMMIT_OFFSETS_ON_CHECKPOINT.key()));
return autoCommit || commitOnCheckpoint;
}

Line under review: props.containsKey(KafkaSourceOptions.COMMIT_OFFSETS_ON_CHECKPOINT.key())

Code after addressing the review:
private boolean offsetCommitEnabledManually() {
boolean autoCommit =
props.containsKey(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG)
&& Boolean.parseBoolean(
props.getProperty(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG));
boolean commitOnCheckpoint =
props.containsKey(KafkaSourceOptions.COMMIT_OFFSETS_ON_CHECKPOINT.key())
&& Boolean.parseBoolean(
props.getProperty(
KafkaSourceOptions.COMMIT_OFFSETS_ON_CHECKPOINT.key()));
return autoCommit || commitOnCheckpoint;
}
Code review comment: Updated to multiplying total cost by `getRowType().getFieldCount()` stead of just `getRowCount`.

Code before review:
public BeamSqlTable getBeamSqlTable() {
return beamTable;
}

Line under review: }

Code after addressing the review:
public BeamSqlTable getBeamSqlTable() {
return beamTable;
}
Code review comment: there are easier ways to go about this, like `JobMasterTriggerSavepointITCase.NoOpBlockingInvokable`.

Code before review:
public void testPutSuspendedJobOnClusterShutdown() throws Exception {
final Duration timeout = Duration.ofSeconds(5);
try (final MiniCluster miniCluster =
new PersistingMiniCluster(new MiniClusterConfiguration.Builder().build())) {
miniCluster.start();
final JobVertex vertex = new JobVertex("blockingVertex");
vertex.setInvokableClass(BlockingNoOpInvokable.class);
final JobGraph jobGraph = JobGraphTestUtils.streamingJobGraph(vertex);
final JobID jobId = jobGraph.getJobID();
miniCluster.submitJob(jobGraph);
CommonTestUtils.waitUntilCondition(
() -> {
try {
if (miniCluster.getJobStatus(jobId).get() != JobStatus.RUNNING) {
return false;
}
} catch (Exception e) {
if (ExceptionUtils.findThrowable(e, FlinkJobNotFoundException.class)
.isPresent()) {
return false;
}
throw e;
}
for (AccessExecutionVertex executionVertex :
miniCluster
.getExecutionGraph(jobId)
.get()
.getAllExecutionVertices()) {
if (executionVertex.getExecutionState() == ExecutionState.RUNNING) {
continue;
}
return false;
}
return true;
},
Deadline.fromNow(timeout));
}
}

Line under review: if (miniCluster.getJobStatus(jobId).get() != JobStatus.RUNNING) {

Code after addressing the review:
public void testPutSuspendedJobOnClusterShutdown() throws Exception {
try (final MiniCluster miniCluster =
new PersistingMiniCluster(new MiniClusterConfiguration.Builder().build())) {
miniCluster.start();
final JobVertex vertex = new JobVertex("blockingVertex");
vertex.setInvokableClass(SignallingBlockingNoOpInvokable.class);
final JobGraph jobGraph = JobGraphTestUtils.streamingJobGraph(vertex);
miniCluster.submitJob(jobGraph);
SignallingBlockingNoOpInvokable.LATCH.await();
}
}
Code review comment: Hi @zzzwjZhang, you can read ShardingSphere code conduct first - https://shardingsphere.apache.org/community/en/involved/conduct/code/. We recommend using assertThat over assertEquals.

Code before review:
public void testMaskIfPlainValueIsLess() {
String result = keepFirstNLastMMaskAlgorithm.mask("abc");
assertEquals("abc", result);
}

Line under review: assertEquals("abc", result);

Code after addressing the review:
public void testMaskIfPlainValueIsLess() {
String actual = keepFirstNLastMMaskAlgorithm.mask("abc");
assertThat(actual, is("abc"));
}
Code review comment: Yea, the default value should be null. Also the property name should be something line `quarkus.test.integration-jvm-arg-line` to fit in with our naming convention, and also to make it clear where this applies so you have something like:  ```     /**      * JVM parameters that are used to launch jar based integration tests.      */     @ConfigItem     String integrationJvmArgLine;  ```

Code before review:
private JarLauncher(Path jarPath, Config config) {
this(jarPath,
config.getValue("quarkus.http.test-port", OptionalInt.class).orElse(DEFAULT_PORT),
config.getValue("quarkus.http.test-ssl-port", OptionalInt.class).orElse(DEFAULT_HTTPS_PORT),
config.getValue("quarkus.test.jar-wait-time", OptionalLong.class).orElse(DEFAULT_JAR_WAIT_TIME),
config.getOptionalValue("quarkus.test.argLine", String.class).orElse(null),
config.getOptionalValue("quarkus.test.native-image-profile", String.class)
.orElse(null));
}

Line under review: config.getOptionalValue("quarkus.test.argLine", String.class).orElse(null),

Code after addressing the review:
private JarLauncher(Path jarPath, Config config) {
this(jarPath,
config.getValue("quarkus.http.test-port", OptionalInt.class).orElse(DEFAULT_PORT),
config.getValue("quarkus.http.test-ssl-port", OptionalInt.class).orElse(DEFAULT_HTTPS_PORT),
config.getValue("quarkus.test.jar-wait-time", OptionalLong.class).orElse(DEFAULT_JAR_WAIT_TIME),
config.getOptionalValue("quarkus.test.argLine", String.class).orElse(null),
config.getOptionalValue("quarkus.test.native-image-profile", String.class)
.orElse(null));
}
Code review comment: Thanks @fapaul for the explanation! I think perhaps `CommittableSummary` is also the subclass of the the `CommittableMessage`  and it should be able to be mixed in the returned list? And passing `committer` is indeed required, but it seems fine from my side~  Also may I have a double confirmation that It seems with the current implementation we'll emit `CommittableSummary` whenever we commit some committables instead of only when checkpointing? It seems to me it is to deal with the case that for unaligned checkpoint, the barrier might jump over all the summary and committable messages~ It should be also the reason we support receive multiple summary from one subtask for the same checkpoint, do I understand right~? 

Code before review:
private void commitAndEmitCheckpoints() throws IOException, InterruptedException {
for (CheckpointCommittableManager<CommT> manager :
committableCollector.getCheckpointCommittablesUpTo(lastCompletedCheckpointId)) {
boolean fullyReceived = manager.getCheckpointId() == lastCompletedCheckpointId;
commitAndEmit(manager, fullyReceived);
}
if (!committableCollector.isFinished()) {
retryWithDelay();
}
}


Code after addressing the review:
private void commitAndEmitCheckpoints() throws IOException, InterruptedException {
for (CheckpointCommittableManager<CommT> manager :
committableCollector.getCheckpointCommittablesUpTo(lastCompletedCheckpointId)) {
boolean fullyReceived = manager.getCheckpointId() == lastCompletedCheckpointId;
commitAndEmit(manager, fullyReceived);
}
if (!committableCollector.isFinished()) {
retryWithDelay();
}
}
Code review comment: argh formatting isnt setup properly yet...

Code before review:
public static Object[] parameters() {
return new Object[][]{new Object[]{true}, new Object[]{false}};
}

Line under review: return new Object[][]{new Object[]{true}, new Object[]{false}};

Code after addressing the review:
public static Object[] parameters() {
return new Object[][] {new Object[] {true}, new Object[] {false}};
}