github-actions[bot] commented on code in PR #66287:
URL: https://github.com/apache/doris/pull/66287#discussion_r3682055289


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/stream/TableStreamManager.java:
##########
@@ -314,27 +314,17 @@ public void 
fillTableStreamValuesMetadataResult(List<TRow> dataBatch) {
                             trow.addToColumnValue(new 
TCell().setStringVal(stream.getScanTypeString()));
                             // STREAM_COMMENT
                             trow.addToColumnValue(new 
TCell().setStringVal(stream.getComment()));
+                            List<String> baseTableQualifiers = 
stream.getBaseTableFullQualifiers();
+                            // BASE_TABLE_NAME

Review Comment:
   **[P1] Use live qualifiers while the base table is available**
   
   `TableStreamBaseTableInfo` keeps the creation-time names but resolves 
internal tables by ID. After a supported same-ID rename (`ALTER TABLE old 
RENAME new` or `RECOVER TABLE old AS new`), this line still emits `old` even 
though the stream resolves successfully and is reported enabled; `SHOW CREATE 
STREAM` emits `new`, and callers filtering `table_streams` by the current base 
name miss the stream. Resolve `baseTable` first and use 
`baseTable.getFullQualifiers()` when it is non-null, falling back to the stored 
qualifiers only for the unavailable-table case.



##########
fe/fe-core/src/main/java/org/apache/doris/catalog/stream/BaseTableStream.java:
##########
@@ -113,6 +115,9 @@ public BaseTableStream(String streamName, List<Column> 
fullSchema, TableIf baseT
     }
 
     public TableIf getBaseTableNullable() {
+        if (baseTable instanceof Table && ((Table) baseTable).isDropped) {
+            baseTable = null;

Review Comment:
   **[P1] Snapshot the volatile base table before dereferencing it**
   
   The two `baseTable` occurrences in this condition are separate volatile 
reads. After a drop marks the cached table dropped, two concurrent readers can 
both pass the `instanceof`; one can then execute `baseTable = null` before the 
other evaluates `((Table) baseTable).isDropped`, causing that reader to 
dereference null. Concurrent `table_streams` requests are sufficient because 
the stream read lock admits multiple readers. Copy the field to one local 
snapshot, inspect that snapshot, and resolve/publish the replacement once.



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