github-actions[bot] commented on code in PR #69458:
URL: https://github.com/apache/doris/pull/69458#discussion_r4357454714
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/plugin/PluginDrivenExternalTable.java:
##########
@@ -119,8 +121,14 @@ public PluginDrivenExternalTable(long id, String name,
String remoteName,
*/
public Optional<ConnectorTableHandle> resolveConnectorTableHandle(
ConnectorSession session, ConnectorMetadata metadata) {
+ Optional<CatalogMetadataChanges.MissingTableObservation> observation =
+ CatalogMetadataChanges.observeTableLookup(this);
String dbName = db != null ? db.getRemoteName() : "";
- return metadata.getTableHandle(session, dbName, getRemoteName());
+ Optional<ConnectorTableHandle> handle =
metadata.getTableHandle(session, dbName, getRemoteName());
+ if (!handle.isPresent()) {
+
observation.ifPresent(CatalogMetadataChanges.MissingTableObservation::missing);
Review Comment:
[P2] Exclude existing views from missing-table repair
For a valid Iceberg view, `tableExists()` is false while `viewExists()` is
true. Such views are still constructed as `PluginDrivenMvccExternalTable`, and
`BindRelation.getLogicalPlan()` calls `loadSnapshots()` before its `isView()`
branch. An ordinary `SELECT` therefore reaches this new `missing()` call
through `materializeLatest()`, evicting the valid view's object, ID, schema and
parent table-name snapshot. Repeated view queries now force remote namespace
listings and adapter recreation instead of retaining that metadata for its
configured TTL. Exclude confirmed views from shared missing-table repair, or
establish that neither a table nor a view exists, and cover a retained Iceberg
view through the MVCC bind path.
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalDatabase.java:
##########
@@ -347,6 +404,21 @@ public Optional<T> getTableForReplay(long tableId) {
return Optional.ofNullable(tables.getIfPresent(tableName));
}
+ /** Captures only the shared base-table instance; transient and bypassed
reads cannot repair it. */
+ public Optional<MetaCache.Observation> observeTableLookup(ExternalTable
table) {
+ if (!initialized || cacheEntriesReleased ||
extCatalog.shouldBypassSchemaCache(SessionContext.current())) {
+ return Optional.empty();
+ }
+ // Transient system/session tables are not this database's retained
base-table instance.
+ NameCacheValue names = getTableNamesValue(false);
+ if (names == null ||
!table.getRemoteName().equals(names.remoteNameOfLocalName(table.getName()))) {
+ return Optional.empty();
+ }
+ // Name refresh can change the canonical spelling without replacing
the old exact table key.
+ return tableNames.observe("", names).flatMap(nameObservation ->
+ tables.observe(table.getName(),
table).map(nameObservation::and));
Review Comment:
[P2] Include the retained parent database in the observation
These tokens only observe this database instance's child entries. During
natural database-cache eviction, `ScopedMetaCache` physically removes the
parent before draining the deferred removal listener that calls
`releaseCachedEntries()`. If an old missing-table lookup is pending, another
query can publish a replacement database and recreated table in that interval.
The old children still have current registrations and `retired == false`, so
the delayed negative passes this check and invalidates the replacement's table,
schema, IDs and names through their shared scopes. Explicit-refresh generation
fencing does not cover this natural-eviction path. Include the exact parent
database registration in the observation, and cover a delayed eviction callback
with replacement publication before the old negative completes.
--
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]