lukecwik commented on a change in pull request #15235:
URL: https://github.com/apache/beam/pull/15235#discussion_r681952111



##########
File path: 
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/WindmillStateInternals.java
##########
@@ -474,9 +474,12 @@ private WindmillValue(
 
     @Override
     public void clear() {
-      modified = true;
+      // if the value was already null (because it was already cleared) then 
there's no need to

Review comment:
       Did you mean to include this as part of your change?

##########
File path: 
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/WindmillStateInternals.java
##########
@@ -474,9 +474,12 @@ private WindmillValue(
 
     @Override
     public void clear() {
-      modified = true;
+      // if the value was already null (because it was already cleared) then 
there's no need to
+      // mark this as modified again.  This will save having to persist a 
clear that does nothing.

Review comment:
       Wouldn't two calls to `clear()` toggle `modified` from `true` to `false`?
   
   I think you would need to keep track of whether the value state is already 
in a cleared state instead of using ` value == null` as a proxy.
   
   This logic could really use unit tests to validate such simple scenarios.
   




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