This is an automated email from the ASF dual-hosted git repository.

jt2594838 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 2abe6e925eb [Pipe] Refresh credential user IDs and retain privilege 
metadata across retries (#18914)
2abe6e925eb is described below

commit 2abe6e925eb76b47157421beb8e697704872d072
Author: Caideyipi <[email protected]>
AuthorDate: Tue Oct 20 10:07:32 2026 +0800

    [Pipe] Refresh credential user IDs and retain privilege metadata across 
retries (#18914)
    
    * [Pipe] Refresh pipe user id when credentials change
    
    * [Pipe] Preserve TsFile privilege metadata across retries
---
 .../event/common/tsfile/PipeTsFileInsertionEvent.java   |  7 +++----
 .../db/pipe/event/PipeTsFileInsertionEventTest.java     | 17 ++++++++++++++++-
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/PipeTsFileInsertionEvent.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/PipeTsFileInsertionEvent.java
index a83a027627b..5d06cf577b4 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/PipeTsFileInsertionEvent.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/event/common/tsfile/PipeTsFileInsertionEvent.java
@@ -573,6 +573,9 @@ public class PipeTsFileInsertionEvent extends 
PipeInsertionEvent
               holderMessage),
           e);
     } finally {
+      // Retries must repeat the privilege check, so release its metadata only 
with the event.
+      tableNames = null;
+      treeSchemaMap = null;
       if (Objects.nonNull(pipeName)) {
         try {
           PipeDataNodeSinglePipeMetrics.getInstance()
@@ -949,10 +952,6 @@ public class PipeTsFileInsertionEvent extends 
PipeInsertionEvent
                   e.getMessage());
       LOGGER.warn(errorMsg, e);
       throw new PipeException(errorMsg, e);
-    } finally {
-      // GC useless
-      tableNames = null;
-      treeSchemaMap = null;
     }
   }
 
diff --git 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/event/PipeTsFileInsertionEventTest.java
 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/event/PipeTsFileInsertionEventTest.java
index 61e68055f90..e905e201ec2 100644
--- 
a/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/event/PipeTsFileInsertionEventTest.java
+++ 
b/iotdb-core/datanode/src/test/java/org/apache/iotdb/db/pipe/event/PipeTsFileInsertionEventTest.java
@@ -188,7 +188,8 @@ public class PipeTsFileInsertionEventTest {
             TsFileNameGenerator.generateNewTsFilePath(
                 TestConstant.BASE_OUTPUT_PATH + 
IoTDBConstant.SEQUENCE_FOLDER_NAME, 1, 1, 1, 1));
     try {
-      AuthorityChecker.setAccessControl(new TestAccessControl());
+      final TestAccessControl accessControl = Mockito.spy(new 
TestAccessControl());
+      AuthorityChecker.setAccessControl(accessControl);
 
       final TsFileResource resource = new TsFileResource(file);
       try (CompactionTestFileWriter writer = new 
CompactionTestFileWriter(resource)) {
@@ -234,6 +235,18 @@ public class PipeTsFileInsertionEventTest {
               Long.MIN_VALUE,
               Long.MAX_VALUE);
       Assert.assertThrows(AccessDeniedException.class, 
tableEvent::throwIfNoPrivilege);
+      // A denied event must remain retryable until SELECT is granted.
+      Assert.assertThrows(AccessDeniedException.class, 
tableEvent::throwIfNoPrivilege);
+      Mockito.doReturn(true)
+          .when(accessControl)
+          .checkCanSelectFromTable4Pipe(Mockito.anyString(), Mockito.any(), 
Mockito.any());
+      tableEvent.throwIfNoPrivilege();
+      // Processing can fail after a successful check, so the next attempt 
must check again.
+      tableEvent.throwIfNoPrivilege();
+      Mockito.doReturn(false)
+          .when(accessControl)
+          .checkCanSelectFromTable4Pipe(Mockito.anyString(), Mockito.any(), 
Mockito.any());
+      Assert.assertThrows(AccessDeniedException.class, 
tableEvent::throwIfNoPrivilege);
       tableEvent.close();
 
       final PipeTsFileInsertionEvent treeEvent =
@@ -265,6 +278,8 @@ public class PipeTsFileInsertionEventTest {
 
       treeEvent.setTreeSchemaMap(Collections.singletonMap(deviceID, new 
String[] {"s0", "s1"}));
       Assert.assertThrows(AccessDeniedException.class, 
treeEvent::throwIfNoPrivilege);
+      // Retrying a realtime event must not fall back to the historical coarse 
filter.
+      Assert.assertThrows(AccessDeniedException.class, 
treeEvent::throwIfNoPrivilege);
 
       treeEvent.close();
     } finally {

Reply via email to