Copilot commented on code in PR #15595:
URL: https://github.com/apache/iotdb/pull/15595#discussion_r2113055455
##########
integration-test/src/test/java/org/apache/iotdb/subscription/it/triple/treemodel/regression/pullconsumer/mode/IoTDBSnapshotDevicePullConsumerDataSetIT.java:
##########
@@ -148,5 +148,8 @@ public void do_test()
consume_data(consumer, session_dest);
check_count(8, "select count(s_0) from " + device, "Consume data again:" +
pattern);
check_count(8, "select count(s_1) from " + device, "Consumption data:
s_1");
+ while (!consumer.allTopicMessagesHaveBeenConsumed()) {
Review Comment:
This busy-wait loop lacks a timeout or failure condition, which can hang the
test indefinitely. Add a maximum wait time or a timeout assertion to prevent CI
stalls.
```suggestion
check_count(8, "select count(s_1) from " + device, "Consumption data:
s_1");
long startTime = System.currentTimeMillis();
long timeout = 30000; // 30 seconds timeout
while (!consumer.allTopicMessagesHaveBeenConsumed()) {
if (System.currentTimeMillis() - startTime > timeout) {
throw new InterruptedException("Timeout reached while waiting for
all topic messages to be consumed.");
}
```
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/subscription/broker/SubscriptionBroker.java:
##########
@@ -339,6 +339,25 @@ public boolean isCommitContextOutdated(final
SubscriptionCommitContext commitCon
return prefetchingQueue.isCommitContextOutdated(commitContext);
}
+ public List<String> fetchTopicNamesToUnsubscribe(final Set<String>
topicNames) {
+ final List<String> topicNamesToUnsubscribe = new ArrayList<>();
+
+ for (final String topicName : topicNames) {
+ final SubscriptionPrefetchingQueue prefetchingQueue =
+ topicNameToPrefetchingQueue.get(topicName);
+ // If there is no prefetching queue for the topic, check if it's
completed
+ if (Objects.isNull(prefetchingQueue) &&
completedTopicNames.containsKey(topicName)) {
+ LOGGER.info(
Review Comment:
[nitpick] Logging each completed topic at INFO level on every heartbeat may
flood the logs under high heartbeat frequency. Consider lowering this to DEBUG
or batching these messages.
```suggestion
LOGGER.debug(
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]