cgivre commented on PR #3086: URL: https://github.com/apache/drill/pull/3086#issuecomment-7135008224
Thanks for all the work on this. I went through the whole diff and everything looks very good. The design is sound, the exchange serialization fixes are a nice catch (worth calling out in the commit message, since `HashToMergeExchange.distExpr` had no getter at all, so any full physical plan round trip silently produced `expr == null`), and the cache/metric lifecycle and privilege refactor all check out. A few final fixes and then I think we're ready to merge: 1. **`PlanCache.java` (~line 478), `collectQuery`** — the fall-through for an unrecognized node is `return true`. A bare `SqlIdentifier` under `EXPLICIT_TABLE` hits that path, and only `collectFrom` ever calls `resolveTable`, so `TABLE dfs.`users.csvh`` gets cached with empty `tableVersions`/`pluginConfigs`. That means `StoragePlugin.supportPlanCache` is never consulted (so plugins that never opted in can end up cached) and `matchesContext` matches forever, so replacing the underlying file doesn't invalidate the entry. Same applies to a `WITH ... SELECT` body or a UNION branch that is `TABLE t`. Suggest making the fall-through conservative (`return false`) and/or routing `EXPLICIT_TABLE` through `collectFrom`. 2. **`DrillSqlWorker.java` (~line 319)** — `hasMutableAliases(context)` and `isSafeToCache(...)` are evaluated in the `if` condition, outside the try/catch that guarantees fallback to ordinary planning. `hasMutableAliases` lazily constructs `PersistentAliasRegistry`, whose constructor throws `DrillRuntimeException` on a `StoreException`, and the `store.get(...)` can fail against a ZooKeeper-backed store. So a transient alias-store read failure fails the whole query, where the identical failure inside the block would just fall back. Moving both predicates inside the try (or wrapping `hasMutableAliases`) keeps enabling the cache from introducing a new failure mode. 3. **`Foreman.java` (~line 804)** — `pendingPlanCacheInsert.run()` is unwrapped and sits before `initiatingClient.sendResult(...)`, unlike the neighbouring calls which go through `suppressingClose`. `writeAfterSuccess` only guards `RejectedExecutionException`, so anything else escaping aborts `close()` before the result is sent and before `isClosed = true`, leaving the client waiting on a result that never arrives. Wrapping it the same way as its neighbours should do it. 4. **`TextFormatPlugin.java` (~line 155)** (minor) — `supportPlanCache` compares `selectionRoot` and `files.get(0)` only after `getPathWithoutSchemeAndAuthority` on both, so they can differ in scheme/authority, but `planCacheTable` then stats `selection.getSelectionRoot()`. Statting `selection.getFiles().get(0)` instead removes the ambiguity at no cost. One other note, no action needed: `RangePartitionExchange.partitionFunction` and the `OrderedPartitionExchange` fields have the same missing-getter asymmetry, but neither operator is reachable for the formats opted in here, so I'd leave them alone for this PR. -- 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]
