|
81 | 81 | import java.util.Collections; |
82 | 82 | import java.util.Iterator; |
83 | 83 | import java.util.List; |
84 | | -import java.util.Objects; |
85 | 84 | import java.util.UUID; |
86 | 85 | import java.util.concurrent.TimeUnit; |
| 86 | +import java.util.concurrent.atomic.AtomicReference; |
87 | 87 | import java.util.logging.Logger; |
88 | 88 | import org.apache.avro.Conversions; |
89 | 89 | import org.apache.avro.LogicalTypes; |
@@ -1233,13 +1233,19 @@ private void ProcessRowsAtSnapshot( |
1233 | 1233 | TableReadOptions.newBuilder().setRowRestriction(filter).build()); |
1234 | 1234 | } |
1235 | 1235 |
|
1236 | | - final CreateReadSessionRequest request = createSessionRequestBuilder.build(); |
1237 | | - ReadSession session = |
1238 | | - await() |
1239 | | - .atMost(Duration.ofSeconds(30)) |
1240 | | - .pollInterval(Duration.ofSeconds(1)) |
1241 | | - .ignoreException(NotFoundException.class) |
1242 | | - .until(() -> client.createReadSession(request), Objects::nonNull); |
| 1236 | + CreateReadSessionRequest request = createSessionRequestBuilder.build(); |
| 1237 | + AtomicReference<ReadSession> sessionRef = new AtomicReference<>(); |
| 1238 | + await() |
| 1239 | + .atMost(Duration.ofSeconds(10)) |
| 1240 | + .pollInterval(Duration.ofSeconds(1)) |
| 1241 | + // retry if the newly-created table has not yet fully propagated |
| 1242 | + .ignoreException(NotFoundException.class) |
| 1243 | + .until( |
| 1244 | + () -> { |
| 1245 | + sessionRef.set(client.createReadSession(request)); |
| 1246 | + return true; |
| 1247 | + }); |
| 1248 | + ReadSession session = sessionRef.get(); |
1243 | 1249 | assertEquals( |
1244 | 1250 | 1, |
1245 | 1251 | session.getStreamsCount(), |
|
0 commit comments