jiangzzhu commented on code in PR #37459:
URL: https://github.com/apache/beam/pull/37459#discussion_r2760325312


##########
sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/spanner/changestreams/action/QueryChangeStreamAction.java:
##########
@@ -379,4 +387,16 @@ private Timestamp getNextReadChangeStreamEndTimestamp() {
     final Timestamp current = Timestamp.now();
     return Timestamp.ofTimeSecondsAndNanos(current.getSeconds() + 2 * 60, 
current.getNanos());
   }
+
+  // For Mutable Change Stream, Spanner only allow the max query end timestamp 
to be 30 minutes in
+  // the future.
+  private Timestamp getBoundedQueryEndTimestamp(Timestamp endTimestamp) {
+    if (this.isMutableChangeStream) {
+      final Timestamp current = Timestamp.now();
+      Timestamp maxTimestamp =
+          Timestamp.ofTimeSecondsAndNanos(current.getSeconds() + 30 * 60, 
current.getNanos());
+      return maxTimestamp.compareTo(endTimestamp) < 0 ? maxTimestamp : 
endTimestamp;
+    }
+    return endTimestamp;
+  }

Review Comment:
   Maybe define MAX_FUTURE_END_TIME_SCEONDS = 30 * 60 into constant value of 
the class, in case we need to tune it in the future. 



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