Copilot commented on code in PR #15624:
URL: https://github.com/apache/iotdb/pull/15624#discussion_r2115575167


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/connection/PipeEventCollector.java:
##########
@@ -142,8 +144,31 @@ private void parseAndCollectEvent(final 
PipeTsFileInsertionEvent sourceEvent) th
     }
 
     try {
-      for (final TabletInsertionEvent parsedEvent : 
sourceEvent.toTabletInsertionEvents()) {
-        collectParsedRawTableEvent((PipeRawTabletInsertionEvent) parsedEvent);
+      final Iterable<TabletInsertionEvent> iterable = 
sourceEvent.toTabletInsertionEvents();
+      final Iterator<TabletInsertionEvent> iterator = iterable.iterator();
+      while (iterator.hasNext()) {
+        final TabletInsertionEvent parsedEvent = iterator.next();
+        int retryCount = 0;

Review Comment:
   The indefinite busy retry loop may cause high CPU usage under continuous OOM 
failures; consider adding a brief sleep or exponential backoff between retries 
to reduce resource contention.
   ```suggestion
           int retryCount = 0;
           long sleepDuration = 100; // Initial backoff duration in milliseconds
           final long maxSleepDuration = 5000; // Maximum backoff duration in 
milliseconds
   ```



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/connection/PipeEventCollector.java:
##########
@@ -142,8 +144,31 @@ private void parseAndCollectEvent(final 
PipeTsFileInsertionEvent sourceEvent) th
     }
 
     try {
-      for (final TabletInsertionEvent parsedEvent : 
sourceEvent.toTabletInsertionEvents()) {
-        collectParsedRawTableEvent((PipeRawTabletInsertionEvent) parsedEvent);
+      final Iterable<TabletInsertionEvent> iterable = 
sourceEvent.toTabletInsertionEvents();
+      final Iterator<TabletInsertionEvent> iterator = iterable.iterator();
+      while (iterator.hasNext()) {
+        final TabletInsertionEvent parsedEvent = iterator.next();
+        int retryCount = 0;
+        while (true) {
+          try {
+            collectParsedRawTableEvent((PipeRawTabletInsertionEvent) 
parsedEvent);
+            break;
+          } catch (final PipeRuntimeOutOfMemoryCriticalException e) {
+            if (retryCount++ % 100 == 0) {

Review Comment:
   [nitpick] Extract the logging threshold `100` into a named constant (e.g., 
`LOG_RETRY_INTERVAL`) for clearer intent and easier future adjustment.
   ```suggestion
               if (retryCount++ % LOG_RETRY_INTERVAL == 0) {
   ```



-- 
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]

Reply via email to