adiranjan25 commented on code in PR #18823:
URL: https://github.com/apache/iceberg/pull/18823#discussion_r4675575730


##########
flink/v2.3/flink/src/test/java/org/apache/iceberg/flink/maintenance/api/TestJdbcLockFactory.java:
##########
@@ -103,4 +109,78 @@ void testUncheckedSQLExceptionBypassesRetry() throws 
Exception {
           .hasMessageContaining("wrapped");
     }
   }
+
+  @Test
+  void testLockTableInitializationPropagatesDatabaseFailure() {
+    Map<String, String> props = Maps.newHashMap();
+    props.put(INIT_LOCK_TABLES_PROPERTY, "true");
+
+    JdbcLockFactory factory =
+        new JdbcLockFactory(
+            "jdbc:sqlite:file:/nonexistent-iceberg-lock-test-dir/locks.db",
+            "failed-initialization",
+            props);
+
+    assertThatThrownBy(factory::open)
+        .isInstanceOf(UncheckedSQLException.class)
+        .hasMessageContaining("Failed to connect");
+  }
+
+  @Test
+  void testConcurrentLockTableInitialization() throws Exception {

Review Comment:
   Thanks @pvary. Addressed in commit `d2bcc3df0`.
   
   I added `testDeterministicConcurrentLockTableInitialization()`, which uses 
`CountDownLatch` to ensure both connections complete their initial 
table-existence checks before either attempts creation. The test then forces 
the second connection to attempt creation after the first has created the table.
   
   I also verified the regression by temporarily removing the recovery logic, 
which caused the test to fail with the expected SQLite "table already exists" 
exception.
   
   The updated targeted tests pass locally. Appreciate your re-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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to