github-actions[bot] commented on code in PR #69501:
URL: https://github.com/apache/doris/pull/69501#discussion_r4358684514
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/ExternalDatabase.java:
##########
@@ -347,6 +350,42 @@ public Optional<T> getTableForReplay(long tableId) {
return Optional.ofNullable(tables.getIfPresent(tableName));
}
+ /**
+ * Captures only a shared base table with a matching retained names
snapshot. Guard order is catalog DB,
+ * table names, then table object, matching incremental name/object
publication. No remote load is performed.
+ */
+ public Optional<Runnable> observeTableLookup(ExternalTable table, Runnable
invalidateMetadata) {
+ if (!initialized ||
extCatalog.shouldBypassSchemaCache(SessionContext.current())) {
+ return Optional.empty();
+ }
+ NameCacheValue names = getTableNamesValue(false);
+ if (names == null ||
!table.getRemoteName().equals(names.remoteNameOfLocalName(table.getName()))) {
+ return Optional.empty();
+ }
+ return extCatalog.observeDatabase(this).flatMap(database ->
+ tableNames.observe("", names).flatMap(membership ->
+ tables.observe(table.getName(), table).map(object ->
() -> MetaCacheCleanup.runDeferred(() -> {
+ // Catalog reset/connector replacement holds this
monitor too. Only local invalidation
+ // runs here; remote reads happened before
entering this guarded commit.
+ synchronized (extCatalog) {
+ if (!initialized || !extCatalog.isInitialized()
+ ||
Env.getCurrentEnv().getCatalogMgr().getCatalog(extCatalog.getId())
+ != extCatalog) {
+ return;
+ }
+ database.runIfCurrent(() ->
membership.invalidateIfCurrent(() ->
Review Comment:
[P2] Fence missing observations across metadata-only refreshes
These registrations stay current across `refreshTableInternal(..., false)`.
With warm Iceberg names/object caches, let query A receive a delayed
missing-table response during an external drop, recreate the same table, then
successfully run `ALTER TABLE t ADD COLUMN` through Doris and reload its
schema. `afterExternalDdl` refreshes connector/schema metadata while retaining
the same FE database, names and object registrations. When A resumes, all three
guards still pass (`viewExists` is false for a base table), so it evicts the
freshly refreshed metadata, current table object/ID and entire names snapshot.
Numeric lookups then fail until name lookup repairs the ID, and listings must
enumerate the database again. External table locks are no-ops, so the
query/ALTER overlap is possible. Advance/check a metadata-refresh generation
while preserving ordinary-write name/object retention, and cover a delayed miss
spanning that refresh.
##########
fe/fe-connector/fe-connector-paimon/src/test/java/org/apache/doris/connector/paimon/PaimonConnectorMetadataReadAuthTest.java:
##########
@@ -156,8 +156,8 @@ public void getTableHandleRunsSeamInsideAuthenticator() {
RecordingPaimonCatalogOps ops = new RecordingPaimonCatalogOps();
RecordingConnectorContext ctx = new RecordingConnectorContext();
ctx.failAuth = true;
- Optional<ConnectorTableHandle> result = metadata(ops,
ctx).getTableHandle(null, "db1", "t1");
- Assertions.assertFalse(result.isPresent());
+ Assertions.assertThrows(DorisConnectorException.class,
Review Comment:
[P2] Remove the imports made obsolete by this assertion
Replacing the `Optional<ConnectorTableHandle>` local removes the last uses
of both `ConnectorTableHandle` and `java.util.Optional`, but their imports at
lines 21 and 34 remain. The inherited Maven Checkstyle execution runs during
`validate`, includes test sources and enables `UnusedImports` with failure on
errors, so normal Paimon/FE validation now fails before tests run. Remove both
imports alongside this change.
--
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]