You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "zentol (via GitHub)" <gi...@apache.org> on 2024/01/05 15:08:48 UTC

[PR] [FLINK-34004] Harden TestingCheckpointIDCounter [flink]

zentol opened a new pull request, #24032:
URL: https://github.com/apache/flink/pull/24032

   Make the TestingCheckpointIDCounter more safe to use by adding default implementations to all builder components.


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34004] Harden TestingCheckpointIDCounter [flink]

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #24032:
URL: https://github.com/apache/flink/pull/24032#issuecomment-1878827522

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "9a8406e252f89c78bcd4c9beb36e967c18a83045",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "9a8406e252f89c78bcd4c9beb36e967c18a83045",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 9a8406e252f89c78bcd4c9beb36e967c18a83045 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34004] Harden TestingCheckpointIDCounter [flink]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #24032:
URL: https://github.com/apache/flink/pull/24032#issuecomment-2849035735

   This PR has been closed since it has not had any activity in 120 days. 
   If you feel like this was a mistake, or you would like to continue working on it, 
   please feel free to re-open the PR and ask for a review.


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34004] Harden TestingCheckpointIDCounter [flink]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #24032: [FLINK-34004] Harden TestingCheckpointIDCounter
URL: https://github.com/apache/flink/pull/24032


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34004] Harden TestingCheckpointIDCounter [flink]

Posted by "XComp (via GitHub)" <gi...@apache.org>.
XComp commented on code in PR #24032:
URL: https://github.com/apache/flink/pull/24032#discussion_r1462140026


##########
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/TestingCheckpointIDCounter.java:
##########
@@ -91,11 +92,14 @@ public static Builder builder() {
     /** {@code Builder} for creating {@code TestingCheckpointIDCounter} instances. */
     public static class Builder {
 
-        private Runnable startRunnable;
-        private Function<JobStatus, CompletableFuture<Void>> shutdownFunction;
-        private Supplier<Integer> getAndIncrementSupplier;
-        private Supplier<Integer> getSupplier;
-        private Consumer<Long> setCountConsumer;
+        private final AtomicLong defaultCheckpointIdStore = new AtomicLong();

Review Comment:
   Wouldn't it be safer to use a local variable or a parameter in the `build()` method rather than a field? The current approach makes the `AtomicLong` being shared between different `TestingCheckpointIDCounter` instances that are created by the same builder. :thinking: 



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34004] Harden TestingCheckpointIDCounter [flink]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #24032:
URL: https://github.com/apache/flink/pull/24032#issuecomment-2774622758

   This PR is being marked as stale since it has not had any activity in the last 90 days. 
   If you would like to keep this PR alive, please leave a comment asking for a review. 
   If the PR has merge conflicts, update it with the latest from the base branch.
   
   If you are having difficulty finding a reviewer, please reach out to the 
   community, contact details can be found here: https://flink.apache.org/what-is-flink/community/
   
   If this PR is no longer valid or desired, please feel free to close it. 
   If no activity occurs in the next 30 days, it will be automatically closed.


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34004] Harden TestingCheckpointIDCounter [flink]

Posted by "zentol (via GitHub)" <gi...@apache.org>.
zentol commented on code in PR #24032:
URL: https://github.com/apache/flink/pull/24032#discussion_r1474252330


##########
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/TestingCheckpointIDCounter.java:
##########
@@ -91,11 +92,14 @@ public static Builder builder() {
     /** {@code Builder} for creating {@code TestingCheckpointIDCounter} instances. */
     public static class Builder {
 
-        private Runnable startRunnable;
-        private Function<JobStatus, CompletableFuture<Void>> shutdownFunction;
-        private Supplier<Integer> getAndIncrementSupplier;
-        private Supplier<Integer> getSupplier;
-        private Consumer<Long> setCountConsumer;
+        private final AtomicLong defaultCheckpointIdStore = new AtomicLong();
+
+        private Runnable startRunnable = () -> {};
+        private Function<JobStatus, CompletableFuture<Void>> shutdownFunction =
+                i -> FutureUtils.completedVoidFuture();
+        private Supplier<Long> getAndIncrementSupplier = defaultCheckpointIdStore::getAndIncrement;
+        private Supplier<Long> getSupplier = defaultCheckpointIdStore::get;
+        private Consumer<Long> setCountConsumer = defaultCheckpointIdStore::set;

Review Comment:
   I wouldn't call this failing early; that would be failing at build() if something wasn't set.
   Arguably it fails at the last possible time; when something is being called that you didn't expect to be called. (if it fails at all and isn't silently swallowed).



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34004] Harden TestingCheckpointIDCounter [flink]

Posted by "zentol (via GitHub)" <gi...@apache.org>.
zentol commented on code in PR #24032:
URL: https://github.com/apache/flink/pull/24032#discussion_r1474251842


##########
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/TestingCheckpointIDCounter.java:
##########
@@ -91,11 +92,14 @@ public static Builder builder() {
     /** {@code Builder} for creating {@code TestingCheckpointIDCounter} instances. */
     public static class Builder {
 
-        private Runnable startRunnable;
-        private Function<JobStatus, CompletableFuture<Void>> shutdownFunction;
-        private Supplier<Integer> getAndIncrementSupplier;
-        private Supplier<Integer> getSupplier;
-        private Consumer<Long> setCountConsumer;
+        private final AtomicLong defaultCheckpointIdStore = new AtomicLong();

Review Comment:
   Indeed, this needs to be fixed.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-34004] Harden TestingCheckpointIDCounter [flink]

Posted by "XComp (via GitHub)" <gi...@apache.org>.
XComp commented on code in PR #24032:
URL: https://github.com/apache/flink/pull/24032#discussion_r1462140026


##########
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/TestingCheckpointIDCounter.java:
##########
@@ -91,11 +92,14 @@ public static Builder builder() {
     /** {@code Builder} for creating {@code TestingCheckpointIDCounter} instances. */
     public static class Builder {
 
-        private Runnable startRunnable;
-        private Function<JobStatus, CompletableFuture<Void>> shutdownFunction;
-        private Supplier<Integer> getAndIncrementSupplier;
-        private Supplier<Integer> getSupplier;
-        private Consumer<Long> setCountConsumer;
+        private final AtomicLong defaultCheckpointIdStore = new AtomicLong();

Review Comment:
   Wouldn't it be safer to use a local variable or a parameter in the `build()` method rather than a field? The current approach makes the `AtomicLong` been shared between different `TestingCheckpointIDCounter` instances that are created by the same builder. :thinking: 



##########
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/TestingCheckpointIDCounter.java:
##########
@@ -91,11 +92,14 @@ public static Builder builder() {
     /** {@code Builder} for creating {@code TestingCheckpointIDCounter} instances. */
     public static class Builder {
 
-        private Runnable startRunnable;
-        private Function<JobStatus, CompletableFuture<Void>> shutdownFunction;
-        private Supplier<Integer> getAndIncrementSupplier;
-        private Supplier<Integer> getSupplier;
-        private Consumer<Long> setCountConsumer;
+        private final AtomicLong defaultCheckpointIdStore = new AtomicLong();
+
+        private Runnable startRunnable = () -> {};
+        private Function<JobStatus, CompletableFuture<Void>> shutdownFunction =
+                i -> FutureUtils.completedVoidFuture();
+        private Supplier<Long> getAndIncrementSupplier = defaultCheckpointIdStore::getAndIncrement;
+        private Supplier<Long> getSupplier = defaultCheckpointIdStore::get;
+        private Consumer<Long> setCountConsumer = defaultCheckpointIdStore::set;

Review Comment:
   Another issue: The old approach "failed early" if the builder wasn't set up properly. The new approach might just cause failures due to an inconsistent state if the contributor uses this test implementation but overwrites not all with*Supplier/Consumer methods.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org