Caideyipi commented on code in PR #18648:
URL: https://github.com/apache/iotdb/pull/18648#discussion_r4023973512


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/matcher/CachedSchemaPatternMatcher.java:
##########
@@ -61,7 +61,7 @@ public class CachedSchemaPatternMatcher implements 
PipeDataRegionMatcher {
 
   // Use full cache to avoid queue stuck and block insertion
   protected final Map<IDeviceID, Set<PipeRealtimeDataRegionSource>> 
deviceToSourcesCache;
-  protected final Map<Pair<String, IDeviceID>, 
Set<PipeRealtimeDataRegionSource>>
+  protected final Map<Pair<String, String>, Set<PipeRealtimeDataRegionSource>>

Review Comment:
   **[P2] Prevent stale authorization results from refilling this cache**
   
   `AuthorityChecker.invalidateCache()` currently clears this matcher before 
invalidating the authority cache. That leaves a stale-refill window: a 
concurrent event can miss this cache, read the old authorization result, and 
cache a table-wide denial here. After the grant invalidation completes, later 
events can keep hitting that stale entry, remain unmatched, and advance 
progress until another invalidation or source change.
   
   Please invalidate the authority cache before this matcher (also in 
`invalidateAllCache()`), or coordinate the two caches with a generation/version 
so that an entry computed before invalidation cannot be installed afterward.



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/source/dataregion/realtime/matcher/CachedSchemaPatternMatcher.java:
##########
@@ -144,6 +144,15 @@ public Pair<Set<PipeRealtimeDataRegionSource>, 
Set<PipeRealtimeDataRegionSource>
         return new Pair<>(matchedSources, 
findUnmatchedSources(matchedSources));
       }
 
+      final String tableModelDatabaseName =

Review Comment:
   **[P3] Resolve the table-model database name only for table events**
   
   `getTableModelDatabaseName()` is evaluated before the model check, so every 
insertion event, including tree-model events, now performs its lazy 
`substring`/`toLowerCase` initialization on the realtime write path even though 
the value is only used for table-model matching below. Please move this lookup 
into the table-model branch.



-- 
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]

Reply via email to