ryucc commented on code in PR #27131:
URL: https://github.com/apache/beam/pull/27131#discussion_r1230447970


##########
runners/samza/src/main/java/org/apache/beam/runners/samza/runtime/PortableBundleManager.java:
##########
@@ -110,15 +112,22 @@ private void scheduleNextBundleCheck() {
   @Override
   public void tryStartBundle() {
 
-    currentBundleElementCount++;
+    currentBundleElementCount.incrementAndGet();
+    LOG.debug(
+        "tryStartBundle: elementCount={}, Bundle={}", 
currentBundleElementCount, this.toString());
 
-    if (!isBundleStarted) {
+    if (isBundleStarted.compareAndSet(false, true)) {
       LOG.debug("Starting a new bundle.");
-      isBundleStarted = true;
-      bundleStartTime = System.currentTimeMillis();
-      pendingBundleCount++;
+      bundleStartTime.set(System.currentTimeMillis());
+      pendingBundleCount.getAndIncrement();
       bundleProgressListener.onBundleStarted();
     }
+
+    if (!isBundleStarted.get() && currentBundleElementCount.get() != 0) {
+      LOG.warn(
+          "tryStartBundle: isBundleStarted = false, but 
currentBundleElementCount = {}",
+          currentBundleElementCount);

Review Comment:
   Will do, thought of putting in a separate method, but would lose the method 
name log. Guess it doesn't matter that much.
   



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