Skip to content

Commit

Permalink
SNOW-1759821
Browse files Browse the repository at this point in the history
[GitHub] Too many Warnings: "might have an offset token mismatch based on the provided offset token verification logic"
  • Loading branch information
sfc-gh-achyzy committed Oct 23, 2024
1 parent 1302e36 commit a3044d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,14 @@ public class StreamingUtils {
public static final String STREAMING_CONSTANT_OAUTH_CLIENT_SECRET = "oauth_client_secret";
public static final String STREAMING_CONSTANT_OAUTH_REFRESH_TOKEN = "oauth_refresh_token";

// Offset verification function to verify that the current start offset has to be the previous end
// offset + 1, note that there are some false positives when SMT is used.
// Offset verification function to verify that the current start offset has to incremental,
// note that there are some false positives when SMT is used.
public static final OffsetTokenVerificationFunction offsetTokenVerificationFunction =
(prevBatchEndOffset, curBatchStartOffset, curBatchEndOffset, rowCount) -> {
if (prevBatchEndOffset != null && curBatchStartOffset != null) {
long curStart = Long.parseLong(curBatchStartOffset);
long prevEnd = Long.parseLong(prevBatchEndOffset);
if (curStart != prevEnd + 1) {
return false;
}
return curStart > prevEnd;
}
return true;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,7 @@ public void testOffsetTokenVerificationFunction() {
Assert.assertTrue(StreamingUtils.offsetTokenVerificationFunction.verify("1", "2", "4", 2));
Assert.assertTrue(StreamingUtils.offsetTokenVerificationFunction.verify("1", "2", null, 1));
Assert.assertTrue(StreamingUtils.offsetTokenVerificationFunction.verify(null, null, null, 0));
Assert.assertFalse(StreamingUtils.offsetTokenVerificationFunction.verify("1", "3", "4", 3));
Assert.assertTrue(StreamingUtils.offsetTokenVerificationFunction.verify("1", "3", "4", 3));
Assert.assertFalse(StreamingUtils.offsetTokenVerificationFunction.verify("2", "1", "4", 3));
}

Expand Down

0 comments on commit a3044d4

Please sign in to comment.