nhuantho commented on code in PR #2477:
URL: https://github.com/apache/fluss/pull/2477#discussion_r2762067605
##########
fluss-flink/fluss-flink-common/src/test/java/org/apache/fluss/flink/source/ChangelogVirtualTableITCase.java:
##########
@@ -377,6 +377,25 @@ public void testChangelogWithScanStartupMode() throws
Exception {
.containsExactlyInAnyOrder(
"+I[+I, 3, 1970-01-01T00:00:00.200Z, 4, v4]",
"+I[+I, 4, 1970-01-01T00:00:00.200Z, 5, v5]");
+
+ // 3. Test scan.startup.mode='latest' - should only read new records
after subscription
+ String optionsLatest = " /*+ OPTIONS('scan.startup.mode' = 'latest')
*/";
+ String queryLatest = "SELECT id FROM startup_mode_test$changelog" +
optionsLatest;
+ CloseableIterator<Row> rowIterLatest =
tEnv.executeSql(queryLatest).collect();
+ List<String> latestResults = new ArrayList<>();
+ for (int attempt = 0; attempt < 10; attempt++) {
+ // Write a new record (with id larger than 5)
+ int rowId = 6 + attempt;
+ writeRows(conn, tablePath, Arrays.asList(row(rowId, "v" + rowId)),
false);
+
+ // Try to fetch one record with a 5-second timeout
+ latestResults = collectRowsWithTimeout(rowIterLatest, 1,
Duration.ofSeconds(5));
Review Comment:
@MehulBatra, from my side, Copilot was suggested incorrectly:
* Proposal:
* Fetch timeout: 5s -> **Copilot**: `latestResults =
collectRowsWithTimeout(rowIterLatest, 1, Duration.ofSeconds(1)); `
* Repeat step 1 for 10 times -> **Copilot**: `for (int attempt = 0;
attempt < 5; attempt++)`
--
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]