This is an automated email from the ASF dual-hosted git repository.
JingsongLi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 7cda1c4675 [core] Add interrupt coverage for snapshot existence
retries (#9745)
7cda1c4675 is described below
commit 7cda1c4675e1d051565a80c838d3be8910474a62
Author: Xingyi Lee <[email protected]>
AuthorDate: Sat Sep 12 21:37:52 2026 +0800
[core] Add interrupt coverage for snapshot existence retries (#9745)
---
.../org/apache/paimon/utils/SnapshotManagerTest.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git
a/paimon-core/src/test/java/org/apache/paimon/utils/SnapshotManagerTest.java
b/paimon-core/src/test/java/org/apache/paimon/utils/SnapshotManagerTest.java
index 1d30c0f882..c6dddc6dca 100644
--- a/paimon-core/src/test/java/org/apache/paimon/utils/SnapshotManagerTest.java
+++ b/paimon-core/src/test/java/org/apache/paimon/utils/SnapshotManagerTest.java
@@ -121,6 +121,25 @@ public class SnapshotManagerTest {
Mockito.verify(fileIO,
Mockito.times(3)).exists(Mockito.any(Path.class));
}
+ @Test
+ public void testSnapshotExistsRestoresInterruptedStatus() throws
IOException {
+ FileIO fileIO = Mockito.mock(FileIO.class);
+ Mockito.when(fileIO.exists(Mockito.any(Path.class)))
+ .thenThrow(new IOException("Temporary failure"));
+ SnapshotManager snapshotManager = newSnapshotManager(fileIO, new
Path(tempDir.toString()));
+
+ Thread.currentThread().interrupt();
+ try {
+ assertThatThrownBy(() -> snapshotManager.snapshotExists(2))
+ .hasMessageContaining("Interrupted while checking whether
snapshot #2 exists")
+ .hasCauseInstanceOf(InterruptedException.class);
+ assertThat(Thread.currentThread().isInterrupted()).isTrue();
+ Mockito.verify(fileIO).exists(Mockito.any(Path.class));
+ } finally {
+ Thread.interrupted();
+ }
+ }
+
@ParameterizedTest
@ValueSource(booleans = {true, false})
public void testEarliestSnapshot(boolean isRaceCondition) throws
IOException {