Skip to content

[improvement](hive) Batch Hive metastore partition access - #67186

Merged
CalvinKirs merged 36 commits into
apache:masterfrom
CalvinKirs:batch_interface
Sep 10, 2026
Merged

CalvinKirs merged 36 commits into
apache:masterfrom
CalvinKirs:batch_interface

Conversation

@CalvinKirs

@CalvinKirs CalvinKirs commented Aug 27, 2026

Copy link
Copy Markdown
Member

What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary:

Hive tables with very large partition counts could either issue one HMS partition-object RPC per partition on legacy caller paths or send every partition name in one unbounded getPartitionsByNames request. The first form creates excessive serial RPC latency; the second risks Thrift/HMS message limits and large temporary allocations.

This PR narrows the change to the shared HMS partition-object boundary. Callers continue to submit one logical partition-name list through HmsClient#getPartitions; the existing cache aggregates misses, one HMS batch executor owns bounded chunking, adaptive fallback and strict response validation, and a leaf transport performs one getPartitionsByNames invocation per physical attempt. Query, statistics, write and Hive-backed MTMV callers therefore receive the same batching behavior without implementing their own chunk/retry loops.

Common HMS batch execution

  • hive.hms_partitions_batch_size_per_rpc bounds each physical partition-object request; the default is 5,000.
  • Explicit message/frame/request-size and partition-limit failures halve the effective batch size until success or the minimum batch size of one.
  • The reduced successful size is reused for the remaining partitions in the logical request.
  • The reduction ladder is naturally bounded by the configured maximum and minimum batch sizes. Individual blocking calls continue to use the existing HMS connection/socket timeout; this PR does not advertise a separate fallback wall-clock deadline that cannot interrupt an active synchronous RPC.
  • Ordinary connection outages, authentication/setup failures, malformed results and local failures are not replayed through the halving ladder.
  • Hive's standard hive.metastore.limit.partition.request / “partitions scanned ... exceeds limit” failure is recognized.
  • With hive.metastore.client.pool.size=0, successful chunks in one logical request reuse one temporary HMS client. A failed physical call taints and destroys that client before a fallback attempt creates another.
  • Hive and Hudi bind and validate the same batch-size setting through HmsClientConfig.
  • Batch request and transport types remain package-private HMS implementation details.

Strict result integrity

  • Requested names are parsed once per layer into canonical ordered partition-value identities.
  • Duplicate request identities and inconsistent partition-key layouts fail before HMS access.
  • Every physical response is checked for missing, duplicate, unexpected, null and invalid-arity partition objects.
  • HMS response order is not trusted; a valid response is reconstructed in exact request order.
  • Any integrity mismatch fails the whole logical request with bounded diagnostics. Partial results are neither returned nor published to cache.
  • Mixed cache hit/miss requests fetch all misses in one logical delegate call, rebuild caller order, and retain the existing invalidation-generation fence.

Narrow MTMV bulk adapter

  • MTMVRelatedTableIf#getPartitionSnapshots has a compatibility default that retains the existing scalar loop for non-bulk table implementations.
  • The plugin-driven external-table adapter overrides it and calls the connector bulk freshness API once for the requested table/partition union.
  • Hive implements that bulk API with one logical HmsClient#getPartitions call; the common executor then splits it into bounded physical requests.
  • MTMVRefreshContext keeps only a request-scoped table → partition → snapshot cache. It unions mapped base partitions before the existing loops in sync, need-refresh, display, persistence and rewrite paths.
  • Persisted partition-name mismatches are rejected locally before remote freshness loading.
  • MTMVTask preloads the complete need-refresh union before splitting execution groups, so the default one-partition group size cannot regress first/manual/COMPLETE refreshes to singleton HMS requests.
  • Existing MTMV mapping semantics, base-version, lock and persisted-snapshot lifecycles remain unchanged. Task-captured MVCC pins are threaded through mapping/alignment and the bulk loader, and the new bulk freshness load runs outside the task's table locks.

With the default batch size, a cold 120,000-partition logical object request becomes 24 bounded requests instead of one 120,000-name request. A 160,000-partition Hive-backed MTMV union becomes one logical bulk load and 32 bounded physical requests, rather than one object request per mapped partition.

Query Profile observability

  • Hive table scans publish one aggregated Connector Metadata Access profile through the existing ConnectorScanProfile hook.
  • The profile reports logical requests and requested items, physical batch attempts and items, smallest/largest batch sizes, fallback reductions, total logical elapsed time, total batch-call elapsed time, and maximum batch-call latency.
  • Partition-batch scan mode aggregates all asynchronous 1,024-partition scan batches before publishing the profile.
  • Synchronous planning failures and asynchronous dispatch that stops before every logical batch is submitted still drain completed metadata diagnostics exactly once; profile-finalization failures do not mask the primary planning failure.
  • Cache hits remain visible as logical requested items with zero physical batch attempts.
  • The implementation returns immutable result-plus-stats data from the common executor; it does not put observers, callbacks, or mutable execution state into HmsPartitionRequest.

Scope boundaries:

  • This PR targets the master Thrift-HMS path used by Hive/Hudi. Iceberg, Paimon and non-HMS metadata protocols keep their own implementations.
  • 4.0/4.1 backports require separate path-specific changes and validation.
  • Query cancellation/deadline propagation through name listing, authentication, pool/client creation, retry and active wire calls is out of scope.
  • A separate fallback wall-clock deadline is also out of scope; implementing one correctly requires the same client-taint and late-call cleanup lifecycle as active-call cancellation.
  • Connector-wide process metrics, source tagging, and non-scan metadata spans remain out of scope; this PR adds only lightweight Hive scan Profile output through the existing scan-profile SPI.
  • Cache single-flight/admission/progressive publication, statistics sampling-policy changes and Cloud MTMV preload policy are out of scope.
  • Split-assignment first-split timeout and SplitSource lifecycle behavior are unchanged.
  • Real HMS performance results and their end-to-end scope boundary are documented below.

Release note

Hive Metastore partition-object access now uses configurable bounded RPC batches, strict response validation, and adaptive fallback for explicit oversized-request failures. Hive-backed MTMV partition freshness is aggregated into bulk logical requests before HMS batching. Hive Query Profile also shows the resulting partition-batch request shape and elapsed time.

Deterministic request-shape evidence

Scenario Previous / unsafe shape This PR
Master 120,000-partition object load 1 unbounded request containing 120,000 names 24 requests, each at most 5,000 names
Legacy scalar caller shape, 120,000 objects Approximately 120,000 object requests 24 bounded object requests
Hive-backed MTMV, 160,000 mapped objects Approximately 160,000 singleton object requests 1 logical bulk load, split into 32 physical requests
Injected server limit above 625 names Large request fails 5000 → 2500 → 1250 → 625, then all objects complete
Pool disabled, successful multi-chunk request A new client per chunk in the initial implementation One temporary client reused for all successful chunks

These rows describe deterministic orchestration and request shape. Real HMS measurements follow.

Real HMS performance evidence

Both measurements used a Hive 2.3.2 Metastore backed by PostgreSQL 9.5.3 over loopback Thrift TCP. The partition cache was excluded from the timed A/B reads, returned counts and checksums matched, and the default physical batch size was 5,000.

The large-scale transport benchmark reproduced the exact before/after HMS API shapes against 120,000 real partitions. The before side issued one getPartitionsByNames(singleton) call per partition; the after side issued bounded getPartitionsByNames calls:

Partitions Before This PR shape Speedup Latency reduction
1,000 4.180 s / 1,000 RPCs 0.056 s / 1 RPC 74.24x 98.653%
10,000 41.670 s / 10,000 RPCs 0.535 s / 2 RPCs 77.92x 98.717%
120,000 509.368 s / 120,000 RPCs 5.622 s / 24 RPCs 90.60x 98.896%

A separate small-scale run used freshly compiled current-head (cd5db406e18cb5a7808e6c8b393d82fb82684d74) Doris production classes. Class-load tracing confirmed the path CachingHmsClient -> ThriftHmsClient -> HmsPartitionBatchExecutor -> real HMS/PostgreSQL. Both sides preconstructed the same names and warmed the connection before timing; the before side reproduced the singleton Doris call shape and the after side made one logical bulk call:

Partitions Before Current-head batch Speedup Latency reduction
10 65.900 ms / 10 RPCs 8.119 ms / 1 RPC 8.12x 87.680%
100 552.685 ms / 100 RPCs 16.462 ms / 1 RPC 33.57x 97.021%
1,000 4,657.364 ms / 1,000 RPCs 64.102 ms / 1 RPC 72.66x 98.624%
5,000 22,420.043 ms / 5,000 RPCs 281.926 ms / 1 RPC 79.52x 98.743%

The 120,000-partition run isolates the real HMS transport/database bottleneck and does not include Doris conversion. The current-head run includes Doris conversion, cache lookup, identity parsing, strict reordering and batch execution, but directly invokes the production classes rather than running a full FE/BE SQL or MTMV refresh. End-to-end improvement therefore still depends on the share of refresh/query latency originally spent in HMS metadata access.

Validation

  • Latest review increment: 13 HMS batch-executor tests and 20 PluginDriven scan batch/profile tests passed; Hive/Hudi catalog-property tests also passed.

  • 111 focused FE-core tests passed: MTMV refresh context, partition utilities, rewrite, task, and plugin-driven MVCC table paths.

  • 72 focused connector tests passed: HMS batching/cache/Thrift integration, Hive freshness, and connector SPI surface.

  • The final no-cache 60-module Maven validate reactor passed with zero Checkstyle violations.

  • git diff --check passed.

  • Effective PR diff against its master base: 43 files, 3,086 additions and 207 deletions, excluding the uncommitted design/review documents.

  • Three independent final review scopes converged with no new P1/P2 findings after fixing task preloading, pool-disabled client reuse, and Hive's standard partition-limit classifier.

  • The standard targeted FE test runner compiled the current-head 60-module reactor successfully after the worktree's standard prebuilt third-party package was restored. HmsPartitionBatchExecutorTest ran 13 tests with no failures or errors.

Full Doris MTMV refresh version A/B

A real binary-version A/B ran REFRESH MATERIALIZED VIEW ... COMPLETE against a Hive table with 100 partition metadata rows and empty S3 prefixes in local MinIO. The before side used the released Doris 4.1.3-rc02 FE (7126cf65d96); the after side used this PR’s FE (cd5db406e18cb5a7808e6c8b393d82fb82684d74). Both sides used the same running Doris 4.1.3-rc02 BE, Hive Metastore, PostgreSQL, MinIO data, catalog properties, and MV definition. To preserve the exact MV and cluster state, current-head FE started from a copy of the measured 4.1.3 FE metadata and upgraded it in place.

Both Doris partition caches were disabled. Each FE version had one excluded warm-up followed by five serialized measured COMPLETE refreshes.

FE version Five measured refreshes Mean Median Physical partition-object RPCs / refresh
Doris 4.1.3-rc02 (7126cf65d96) 2641, 2317, 2410, 2299, 2143 ms 2362.0 ms 2317 ms 300 get_partition
PR head (cd5db406e18) 661, 648, 515, 598, 525 ms 589.4 ms 598 ms 3 getPartitionsByNames

This is a measured 4.01x full-refresh speedup, 75.05% mean latency reduction, and 100x physical RPC reduction (99%). The three remaining batched calls are the refresh path’s three independent partition-metadata stages; each stage loads all 100 objects in one physical request, whereas 4.1.3 issues 100 scalar requests per stage. Durations are FE task-start to MTMVService.refreshComplete timestamps; RPC counts and method names come from the Hive Metastore log.

Environment: same running Doris 4.1.3-rc02 BE (7126cf65d96) for both sides; Hive Metastore 2.3.2 + PostgreSQL 9.5.3 + MinIO on the same host. Empty partition data deliberately isolates metadata/MV orchestration from file-scan cost, so this is a real end-to-end MTMV refresh version A/B but not a representative data-scan benchmark.

Scaling note: with N partitions, Doris 4.1.3 performs approximately 3N remote partition-object calls in this refresh path. This PR performs approximately 3 × ceil(N / batchSize) calls (the default batch size is 5,000). Both versions still read, deserialize, and process N partition objects, so total work retains an O(N) component; the improvement removes the per-partition network round trips rather than making refresh time constant. The speedup therefore generally grows with partition count until HMS serialization, Doris object processing, or MV partition work becomes dominant.

@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@morrySnow morrySnow changed the title [improvement](fe) Batch Hive metastore partition access [improvement](hive) Batch Hive metastore partition access Aug 27, 2026
Issue Number: None

Related PR: None

Problem Summary: Hive tables with very large partition counts could issue one HMS RPC per partition or one unbounded getPartitionsByNames request. This caused excessive serial RPC latency and exposed Thrift message-size, timeout, memory, cancellation, cache-concurrency, and observability gaps. Add one HMS-owned bounded batch loader with adaptive halving for classified Thrift failures, strict result-integrity validation, request deadline and cancellation, physical RPC metrics, and Query Profile events. Reuse it from query, MTMV, statistics, display, and regular write partition-object paths, and coalesce concurrent cache misses per partition with bounded FIFO load slots.

Hive metastore partition-object access is now bounded, cancellable, observable, and shared across query, MTMV, statistics, display, and write paths.

- Test: Unit Test
    - HMS batch, cache, and pool tests
    - Hive metadata and transaction tests
    - MTMV and connector profile tests
- Behavior changed: Yes (large Hive partition-object reads use bounded HMS batches with adaptive fallback and strict integrity checks)
- Does this need documentation: No
@CalvinKirs

Copy link
Copy Markdown
Member Author

run buildall

@CalvinKirs

Copy link
Copy Markdown
Member Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes. Three review rounds converged cleanly—all final-round reviewers returned NO_NEW_VALUABLE_FINDINGS—on nine distinct issues: five P1 correctness/compatibility/capacity problems and four P2 lifecycle/observability problems. The review is complete rather than capped.

Critical checkpoint conclusions:

  • Goal and proof: the PR establishes the intended common HMS batching, integrity, cancellation, cache-coordination, and telemetry path, and the added unit tests prove many normal/error paths. The nine inline defects prevent the implementation from safely meeting the full contract.
  • Scope and clarity: this is a justified but broad 58-file cross-cutting change. The raw-loader/cache/SPI decomposition is generally clear; the remaining defects concentrate at ownership and phase boundaries.
  • Concurrency: query/MTMV/display request threads coordinate through per-key in-flight state, FIFO slots, and striped locks while HMS RPCs stay outside locks. Normal owner/waiter cleanup and lock ordering are sound, but refresh can miss a newly registered publisher, cache-disabled traffic bypasses admission, and MTMV local mapping/version capture is not atomic.
  • Lifecycle/static state: task-owned StatementContext cleanup and successful connector replacement are sound. Temporary validation contexts and superseded failed-init contexts leak shared metrics references. No C++ static-initialization concern applies.
  • Configuration: the new HMS batch/fallback properties are validated and wired consistently through Hive and Hudi; they are catalog-scoped rather than dynamic process variables. Disabling partition retention incorrectly disables the pool-derived admission bound.
  • Compatibility: the public connector SPI surface changes without the repository-mandated 7.0 major bump, so the major-only plugin gate permits incompatible 6.x linkage. No storage-format or FE/BE protocol change is present.
  • Parallel paths: all eight production partition-object callers and Hive/Hudi construction were traced. Query/write/statistics sources and sessions are propagated; SHOW/display purpose is not, and the analogous task/display MTMV phase split needs the same ownership fix.
  • Conditions and error handling: strict identity/order validation, typed integrity failures, statement deadlines, and cancellation/pool-taint boundaries are otherwise sound. The generic TTransportException condition is too broad, and the MTMV outside-lock predicate is too broad.
  • Tests and results: changed tests cover batching, fallback state, result integrity, owner/waiter cleanup, cancellation, metrics/profile aggregation, and MTMV bulk caching. Missing decisive coverage is called out inline for refresh registration, disabled-cache zero-pool concurrency, mixed/cloud mapping races, context ownership, DISPLAY, outer logical-event aggregation, and process wait metrics. Per the review prompt, I ran no build or tests. Current CI has green style/security/coverage contexts; FE UT, compile, performance, and automated review are still pending.
  • Observability: event schema/cardinality and profile serialization are generally sound, but context leaks, DISPLAY mislabelling, caller-event misaggregation, and missing process wait metrics make the advertised telemetry inaccurate.
  • Transactions, persistence, writes, and FE/BE variables: no transaction protocol, persisted schema, EditLog payload, storage format, or FE-to-BE variable was added. Replay initialization and Hive write/transaction callers were audited; their accepted issue is the shared context lifecycle leak, not transaction atomicity.
  • Performance: bounded physical batches and single-flight improve the intended large-partition path, but ordinary outages can be amplified through the halving ladder and cache-disabled zero-pool traffic can open unbounded concurrent clients.
  • Other applicable checks: this PR is FE Java only, so BE memory tracking, nullable-column handling, delete bitmaps, and C++ static/TU rules are not applicable. No additional issue survived the final changed-file and missed-path sweep.

No additional user-provided review focus was supplied.

this.rawStoragePropsSupplier =
Objects.requireNonNull(rawStoragePropsSupplier, "rawStoragePropsSupplier");
this.environment = buildEnvironment();
this.metadataAccessMetrics = new ConnectorMetadataAccessMetrics(catalogName);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Give the validation metrics reference an owner. This constructor now acquires a shared per-catalog metrics reference even for the temporary context created by forCatalogCreationValidation(). CatalogFactory passes that context inline and retains only the connector, while PluginDrivenExternalCatalog explicitly leaves connectorContext null for this validation connector, so neither initialization nor catalog teardown can call DefaultConnectorContext.close() on it. Each create/replay attempt therefore leaves an entry in SHARED_METRICS; after the live catalog records metrics, DROP also cannot unregister those catalog-labelled series because the leaked reference keeps the count nonzero. Please make validation use a non-acquiring metrics sink or give the temporary context an explicit owner that closes it on every success/failure/fallback path. The same ownership rule is also needed for live initialization: construct into a local context, publish it only after connector creation succeeds, and close it on null/throw so repeated retries cannot overwrite and leak failed contexts.

}
// Write binding gained execution-capability methods in this surface revision. A plugin built against
// major 5 must be refused rather than run against a contract it did not compile against.
// Write binding gained execution-capability methods, while metadata access gained operation control,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Bump the connector SPI major for this surface change. This PR adds methods and types to the public connector SPI, but the API is still stamped as 6.0. The policy beside connector.plugin.api.version requires a same-commit major bump for any SPI surface addition, and ApiVersionGate checks only major equality. As written, a plugin compiled against these new APIs is labelled 6.0 and can be accepted by an older 6.0 FE, then fail at first use with NoSuchMethodError/NoClassDefFoundError. Please bump the connector API major (and this assertion) to 7.0 in this commit.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for calling this out. We intentionally will not bump the connector SPI to 7.0 in this PR. The compatibility boundary should be a published connector API version, not every PR that evolves an API which is still unreleased on master. Connector SPI 6.0 was introduced on master on Aug 17, 2026, and no release tag contains that commit, so 6.0 is still the next unpublished surface; this PR updates that same pre-release surface and its frozen baseline before publication. Once 6.0 is released, a subsequent incompatible surface change must bump the major. Bumping the major once per pre-release PR would consume versions without creating a real artifact compatibility boundary. The existing major gate still correctly separates published/older major 5 plugins from the upcoming major 6 API.

try {
invalidateInFlightPartitionLoads(key -> key.matches(dbName, tableName), true);
} finally {
stateLock.unlock();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Keep registration fenced through the cache clear. The state lock is released before partitionsCache.invalidateIf() bumps the generation. A cold request can therefore register after the in-flight scan, start its HMS RPC, then let this refresh clear the cache and return; because that new batch was never marked invalid and publishOwnedPartitions() uses a direct put, its pre-clear load is cached afterward for the full TTL. The same gap exists in partition/DB/catalog invalidation. Please perform the matching cache invalidation under the same stripe(s), or capture/check a refresh epoch at owner publication, and add the mark/register/clear/publish interleaving to the concurrency tests.

}
for (Throwable current = failure.getCause(); current != null; current = current.getCause()) {
String className = current.getClass().getName();
if (className.endsWith(".TTransportException")) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Do not halve batches for every transport outage. This class-name check makes a closed/refused/reset/EOF/timeout TTransportException degradable even though reducing the payload cannot repair the connection. With the defaults, one 5,000-name offset can be replayed 13 times down to size 1 within the 30-second budget, and each logical call sits above Hive's own retry/reconnect proxy and may create/taint another client. That amplifies an HMS outage precisely while it is unhealthy. Please restrict fallback to explicit frame/message/request/partition-limit signals (or a proven oversize transport code), and make ordinary transport failures terminate after the original logical attempt.

int start = 0;
private void loadMissingPartitions(HmsPartitionRequest request, List<String> initialMissNames,
Map<List<String>, HmsPartitionInfo> resultByIdentity) {
if (!partitionsCache.isEffectiveEnabled()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Preserve load admission when partition caching is disabled. This early return skips both single-flight retention and the new window/slot limiter. In the supported hive.metastore.client.pool.size=0 configuration, the constructor deliberately converts zero to one cold-load slot, but every disabled-cache request now bypasses that slot and ThriftHmsClient creates a fresh client per call; N concurrent scans/freshness probes can therefore open N HMS connections. Please keep windowing and slot admission on this path while skipping only cache coordination/publication, and cover zero-pool plus disabled cache concurrently.

MTMVPartitionUtil.addPartition(mtmv, partitionKeyDesc);
}
}
boolean buildContextUnderLock = Config.isNotCloudMode()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Keep local PCT mappings atomic with their versions in mixed MVs. This condition moves the entire context build outside the sorted table locks whenever any base table is MVCC. If the actual PCT table is a local OlapTable, its mapping is copied here at T1, external preload can then block, and the later locked refreshLocalBaseVersions() refreshes only versions—not partitionMappings. A local partition dropped in that window remains in the mapping and makes the locked version lookup fail; an added partition is omitted from comparison/refresh. The base code built both together under the locks. Please split the capture so external pins/I/O stay outside, while local PCT mappings and versions are rebuilt together under the sorted FE locks. Cloud local-only plans also always take this branch and the refresh helper is a no-op there, so preserve an atomic cloud capture as well. Apply the same fix to the analogous PartitionsProcDir branch and add mixed local-PCT/external-MVCC plus cloud local-only race tests.

}
HiveTableHandle hiveHandle = (HiveTableHandle) handle;
List<HmsPartitionInfo> partitions = hmsClient.getPartitions(
session, HmsPartitionAccessSource.MTMV,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Preserve the display source in freshness telemetry. SHOW PARTITIONS now builds and preloads MTMVRefreshContext, reaches these freshness methods, and is always emitted as MTMV here; the sibling whole-table freshness call is hard-coded the same way. There is no production use of the newly added HmsPartitionAccessSource.DISPLAY, so display traffic is indistinguishable from refresh/rewrite work in both process metrics and Query Profile despite the per-source observability contract. Please thread the logical access purpose into this freshness request and emit DISPLAY for the proc/display path, with a production-chain test.

request, initialMissNames, partitionsCache.invalidationGeneration(), resultByIdentity);
return;
}
for (int offset = 0; offset < initialMissNames.size(); offset += partitionLoadWindowSize) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Emit one logical event for the caller's request. The cache splits one business request into partitionLoadWindowSize windows and each copied request invokes the raw loader, whose finally records a completed logical event. A cold 12,000-name call therefore increments LogicalRequests three times; if the third window fails, the single caller-visible request is reported as two successes plus one failure. The cache-disabled path reports the same call once, so success rates and requested-item metrics depend on cache configuration rather than business semantics. All-hit and pure-waiter calls emit no completed business event, and mixed hit/miss calls report only owner misses. Please move event ownership to the outer cache call, aggregate the shared business-request state, and emit exactly once while retaining physical-attempt counters; test all-hit, mixed, pure-waiter, and multi-window later-failure cases.

.success(success)
.build();
try {
request.getMetadataAccessObserver().record(event);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Publish coordination waits to process metrics too. Both in-flight and cold-load-slot wait events are recorded only through the request observer, which is a Query Profile sink and becomes NOOP when profiling is disabled. The catalog observer used by the raw loader never reaches this cache layer, so FE metrics permanently omit both newly advertised wait operations even while reporting their downstream HMS call. Please give the cache the catalog observer and safely publish these events to both sinks, with process-metric coverage when query profiling is disabled.

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 16850 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 7ab8c5329b97a6ac3e9361e593383e5ac0bf6bd8, data reload: false

------ Round 1 ----------------------------------
============================================
q1	17583	3020	3025	3020
q2	2100	270	226	226
q3	10222	897	526	526
q4	4671	247	197	197
q5	7682	574	392	392
q6	140	117	94	94
q7	536	492	389	389
q8	9250	860	894	860
q9	3447	2396	2410	2396
q10	6485	833	706	706
q11	391	193	188	188
q12	610	263	197	197
q13	18132	1515	1184	1184
q14	160	152	135	135
q15	q16	435	398	365	365
q17	1376	910	847	847
q18	3069	2220	2231	2220
q19	1110	863	810	810
q20	360	287	200	200
q21	5262	1666	1890	1666
q22	316	266	232	232
Total cold run time: 93337 ms
Total hot run time: 16850 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	3413	3329	3329	3329
q2	503	381	366	366
q3	2213	2368	2199	2199
q4	1175	1150	875	875
q5	2185	2084	2086	2084
q6	171	124	85	85
q7	1012	916	870	870
q8	1590	1391	1384	1384
q9	3121	3052	3054	3052
q10	1832	1787	1618	1618
q11	356	269	248	248
q12	449	428	345	345
q13	1474	1549	1160	1160
q14	177	179	158	158
q15	q16	396	400	368	368
q17	3558	3369	3290	3290
q18	4827	4392	4680	4392
q19	921	816	891	816
q20	1015	955	813	813
q21	3728	3037	3213	3037
q22	402	347	322	322
Total cold run time: 34518 ms
Total hot run time: 30811 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 81114 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 7ab8c5329b97a6ac3e9361e593383e5ac0bf6bd8, data reload: false

query5	4269	418	341	341
query6	399	133	120	120
query7	4934	397	235	235
query8	310	130	125	125
query9	8692	2849	2837	2837
query10	392	215	181	181
query11	5392	1026	924	924
query12	128	71	76	71
query13	1212	411	323	323
query14	5966	2163	2055	2055
query14_1	1951	1935	1913	1913
query15	171	122	113	113
query16	922	361	345	345
query17	805	459	386	386
query18	2320	315	235	235
query19	165	128	109	109
query20	70	66	68	66
query21	206	105	89	89
query22	5471	5328	5327	5327
query23	6726	6139	6044	6044
query23_1	5966	5934	5926	5926
query24	7315	1101	742	742
query24_1	773	759	770	759
query25	407	289	266	266
query26	1227	234	125	125
query27	2799	430	253	253
query28	4690	1488	1450	1450
query29	913	417	327	327
query30	253	156	128	128
query31	811	399	323	323
query32	128	82	73	73
query33	454	209	180	180
query34	983	810	477	477
query35	397	394	334	334
query36	572	569	521	521
query37	122	81	72	72
query38	1001	836	805	805
query39	468	497	473	473
query39_1	461	482	453	453
query40	201	94	101	94
query41	53	51	52	51
query42	71	69	69	69
query43	234	235	209	209
query44	1023	547	545	545
query45	106	105	96	96
query46	781	833	510	510
query47	753	774	705	705
query48	318	297	245	245
query49	559	255	174	174
query50	734	253	191	191
query51	8039	7849	7942	7849
query52	69	67	60	60
query53	195	191	151	151
query54	220	199	170	170
query55	73	57	55	55
query56	217	166	171	166
query57	692	641	689	641
query58	215	187	171	171
query59	1215	1225	1101	1101
query60	268	196	191	191
query61	140	135	139	135
query62	364	218	181	181
query63	170	142	142	142
query64	2970	803	687	687
query65	1689	1632	1602	1602
query66	1973	346	222	222
query67	9817	9614	9606	9606
query68	2909	1172	712	712
query69	347	219	183	183
query70	680	604	615	604
query71	248	178	164	164
query72	2301	1378	1557	1378
query73	637	574	349	349
query74	1980	1203	1138	1138
query75	1164	1087	943	943
query76	2312	730	555	555
query77	244	251	220	220
query78	3966	3569	3076	3076
query79	2699	800	571	571
query80	1559	328	273	273
query81	496	154	134	134
query82	630	121	99	99
query83	270	206	190	190
query84	291	114	91	91
query85	823	357	299	299
query86	470	183	159	159
query87	1020	971	876	876
query88	2830	2086	2103	2086
query89	280	198	175	175
query90	2015	129	127	127
query91	127	120	99	99
query92	95	72	61	61
query93	1443	1065	703	703
query94	617	254	215	215
query95	528	266	229	229
query96	836	572	269	269
query97	1025	1120	1015	1015
query98	174	133	130	130
query99	419	348	310	310
Total cold run time: 178282 ms
Total hot run time: 81114 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 14.48 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 7ab8c5329b97a6ac3e9361e593383e5ac0bf6bd8, data reload: false

query1	0.00	0.00	0.01
query2	0.08	0.04	0.03
query3	0.24	0.11	0.11
query4	1.60	0.09	0.10
query5	0.18	0.16	0.16
query6	1.25	0.67	0.72
query7	0.03	0.00	0.01
query8	0.04	0.02	0.04
query9	0.29	0.21	0.22
query10	0.33	0.35	0.35
query11	0.16	0.11	0.10
query12	0.15	0.12	0.12
query13	0.30	0.30	0.30
query14	0.44	0.45	0.43
query15	0.35	0.34	0.34
query16	0.22	0.23	0.25
query17	0.67	0.68	0.73
query18	0.18	0.15	0.16
query19	1.16	1.08	1.05
query20	0.01	0.01	0.01
query21	15.43	0.14	0.11
query22	5.08	0.05	0.04
query23	16.16	0.25	0.10
query24	3.04	0.32	0.26
query25	0.12	0.04	0.03
query26	0.81	0.16	0.13
query27	0.02	0.02	0.04
query28	3.61	0.54	0.27
query29	12.48	3.13	2.55
query30	0.26	0.12	0.14
query31	2.76	0.36	0.17
query32	3.51	0.32	0.23
query33	1.36	1.39	1.41
query34	15.35	2.15	1.80
query35	1.76	1.70	1.71
query36	0.46	0.30	0.28
query37	0.07	0.05	0.05
query38	0.05	0.03	0.02
query39	0.03	0.02	0.02
query40	0.13	0.09	0.08
query41	0.08	0.02	0.02
query42	0.03	0.02	0.02
query43	0.04	0.03	0.02
Total cold run time: 90.32 s
Total hot run time: 14.48 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 71.59% (315/440) 🎉
Increment coverage report
Complete coverage report

@CalvinKirs

Copy link
Copy Markdown
Member Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request changes. Three review rounds converged with four additional issues: one P1 cancellation/lifecycle gap and three P2 compatibility/performance gaps. I did not duplicate the eight existing issue threads; their unresolved blockers remain part of this verdict. The live PR still matches the authoritative bundle at head 7ab8c5329b97a6ac3e9361e593383e5ac0bf6bd8. Current CI has compile, FE UT, CheckStyle, P0, non-concurrent, vault, and performance checks passing, while External Regression and cloud_p0 are failing.

Critical checkpoint conclusions:

  • Goal and proof: The PR implements batched/cached HMS partition freshness, cooperative cancellation, telemetry, and MTMV bulk snapshot loading, and its unit tests prove many component paths. It does not fully achieve the stated bounded/large-scale behavior because client construction remains outside cancellation/deadline control, the cache-backed scale path repeats canonicalization, and MTMV can eagerly load a huge union before a locally decisive stale gate.
  • Scope and focus: The 58-file connector/HMS/MTMV change is internally related but not yet safely mergeable. The user focus file contained no additional focus request; the full PR was reviewed.
  • Concurrency and thread safety: Enabled-cache owner/waiter futures, permits, publication, retry cleanup, and lock ordering otherwise balance. Existing threads already cover the cache-invalidation fence and disabled-cache admission bypass; the new P1 below covers synchronous client creation before cancellation can act. Heavy external work is generally moved outside FE locks, subject to the existing mixed local/cloud atomicity thread.
  • Error handling: Strict result-integrity failures and cancellation propagation are fail-loud and preserve causes in the inspected paths. The existing broad transport-fallback thread and the new eager-preload ordering can still amplify or surface avoidable HMS failures.
  • Lifecycle: Watchdog ThreadLocal cleanup, interrupt ownership, pooled-client taint/return, statement pins/scopes, and normal connector-context close were traced. Existing metrics-reference ownership remains a live thread; any fix for client creation must destroy a late result after cancellation, deadline, or concurrent close.
  • Configuration and dynamic behavior: Hive and Hudi bind the same positive batch/timeout properties and defaults through catalog construction/replay. No additional dynamic-update divergence survived review.
  • Compatibility and rolling upgrade: Default SPI methods preserve old implementation linkage, and the existing API-major thread includes the unreleased-6.0 context. Separately, the frozen-surface test omits the new reachable session/control/observer/event/abort contracts and metadata return types, so future incompatible drift can evade the gate.
  • Parallel paths: Query, statistics, MTMV, and write callers plus Hive/Hudi construction were checked. Rewrite, task, metadata/global sync, and proc/display MTMV paths were all traced. The existing DISPLAY-source thread remains the only distinct source-label issue.
  • Special conditionals: Excluded-table and PCT-first comparison semantics are intentional. Existing review context covers transport degradability and cache-disabled branching; the new MTMV finding covers preload ordering before the name-set condition.
  • Test coverage: Added tests cover batching, strict ordering, cache coordination, pool wait cancellation, metrics/profile aggregation, context capture, and 160k aggregation. Missing cases are identified inline: blocking client creation, frozen reachable SPI contracts, cache-backed parse counts, and large name-set mismatch with zero freshness calls.
  • Test results: This review-only environment expressly prohibited builds/tests, so none were run here. No regression .out files changed. Live FE UT/compile/style checks pass, but External Regression and cloud_p0 currently fail.
  • Observability: Process metrics and Query Profile coverage were inspected. Existing threads cover metric reference ownership, fragmented logical events, missing process wait metrics, and DISPLAY attribution; no additional observability issue survived.
  • Transaction and persistence: MTMV refresh snapshot generation, manual/COMPLETE refresh, current-relation resolution, and per-partition persistence inputs were traced. No new EditLog schema is introduced; the existing MTMV mapping/version atomicity thread remains applicable.
  • Data writes and crash behavior: No new BE/storage data-write path is introduced. MTMV refresh scheduling and snapshot capture were checked; no distinct crash leak or partial-write issue survived beyond the live atomicity/lifecycle threads.
  • FE/BE variables: No new FE-to-BE variable or protocol field is introduced.
  • Memory safety and nullable handling: The change is Java/FE-only; BE allocator, C++ lifetime, and nullable-column checkpoints are not applicable. Java ownership and large temporary allocations were reviewed, with the repeated identity allocation issue called out inline.
  • Data correctness: Strict partition identity, duplicate, missing, unexpected, and ordering checks are coherent. Existing threads cover cache freshness fencing and MTMV atomicity; the dismissed display snapshot split predates this PR.
  • Performance: Batching removes per-partition RPCs, but the cache-backed request performs 3N parses on all hits and 6N+C when fully cold, and MTMV may issue a 160k-name freshness load before a set mismatch already proves staleness.
  • Other issues and completion: All candidates are accepted, deduplicated, or dismissed with code evidence. Round 3 ended with NO_NEW_VALUABLE_FINDINGS from both normal full reviews and the independent risk review, so this review is complete.

waitMillis = Math.min(waitMillis, operationRemainingMillis);
}
try {
return clientPool.borrowObject(waitMillis);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Bound HMS client creation with the operation control. On an empty pool, Commons Pool 2.2 runs HmsClientFactory.create() synchronously inside borrowObject(waitMillis) before the timed idle-object wait, so waitMillis does not bound createFreshClient(); the pool-disabled branch calls it directly as well. Kerberos login, DNS, or socket construction can therefore remain stuck after KILL/deadline, before HmsRemoteCallTracking installs its watchdog and before the next checkActive(). Please make creation cancellable/deadline-aware (and destroy any client that completes late) for both branches, with blocking-provider KILL/deadline tests.

return ConnectorStatementScope.NONE;
}

/** Returns cooperative cancellation and deadline control for connector metadata operations. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Freeze the new session/control API in the plugin surface. ConnectorPluginSurfaceTest.FROZEN_TYPES does not include ConnectorSession or the new control/observer/event/abort types, so the regenerated baseline records ConnectorContext#getMetadataAccessObserver() but not these two session methods or the callable contracts they expose. The separate metadata baseline also omits return types. That leaves later removal/re-signing of this new 6.0 surface invisible to the stated compatibility speed bump. This is independent of whether 6.0 is still unpublished: please freeze these reachable SPI types (or recursively freeze reachable SPI contracts), regenerate the baseline, and assert the new methods are present.

operationControl.checkActive();
}
String partitionName = partitionNames.get(i);
HmsPartitionIdentity.ParsedPartitionName parsed = HmsPartitionIdentity.parse(partitionName);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Retain parsed identities across the cache-backed request. This builder validates every partition name with HmsPartitionIdentity.parse() and then discards the result. The normal cold-cache path reparses all names during cache lookup, registration, copied-window construction, raw validation, and final reconstruction—6N+C parse/unescape passes for a fully cold sole owner (roughly 720k canonicalizations for 120k names); even all hits take 3N. The added 120k test covers only the raw loader, so it misses this decorator cost. Please carry immutable parsed keys/values on the request and share/slice them through windows and validation, with a cache-backed large-request parse-count/performance test.

throws AnalysisException {
MTMV mtmv = context.getMtmv();
Set<String> partitionNames = mtmv.getPartitionNames();
context.preloadSnapshots(partitionNames, tables, excludeTables);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Check the persisted partition set before eager freshness loading. This preload fetches partition-detail freshness for the entire mapped PCT union before isSyncWithPartitions() compares the current names with the persisted getPctSnapshots() set. With a coarse mapping over 160k Hive partitions, adding or dropping one partition already proves the MTMV stale locally, but this order now issues the full HMS freshness request first (and can fail before returning that deterministic stale result); the pre-PR path performed the set gate before fetching snapshots. Please make the comparison two-phase—reject name-set mismatches first, then preload only mappings that still need version checks—and add large mismatch coverage asserting no partition-freshness call.

@CalvinKirs

Copy link
Copy Markdown
Member Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the authoritative 58-file bundle and all live/raw review comments through three convergence rounds. Two additional non-duplicate issues remain, alongside the unresolved live blockers, so I am requesting changes.

Key checkpoints: the cross-layer scope matches the stated bounded/cancellable HMS-load and MTMV-freshness goal, and the new request, loader, control, telemetry, and refresh-context helpers generally keep responsibilities clear. Strict response validation/order, typed cancellation, cache/pool cleanup, connector construction, statement-scope closure, and the main query/statistics/scan/write/refresh/rewrite/display paths were traced. The remaining new gaps are (1) rewrite eagerly loading locally rejectable candidates while planner locks are held and (2) equivalent waiters serially replaying a shared integrity failure. Existing threads already fence the other identified concurrency, invalidation, compatibility, metrics, and eager-loading concerns. Hive/Hudi configuration validation and SPI forwarding were checked; this patch changes no storage/EditLog format, transaction protocol, FE/BE wire value, or BE memory/nullability path.

No local build or tests were run because the review bundle forbids them. Current checks show FE UT, compile, P0, nonconcurrent, and vault passing; External Regression and cloud_p0 are failing, with no public failure detail available from the linked TeamCity endpoints. The changed unit tests cover most raw/cache/control and MTMV batch paths, but not the two concurrent/production-chain cases called out inline.

Comment thread fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRewriteUtil.java Outdated
### What problem does this PR solve?

Issue Number: None

Related PR: apache#67186

Problem Summary: The shared Hive metastore partition batch path still had lifecycle, concurrency, compatibility, and MTMV freshness edge cases found during review. Blocking HMS client construction could outlive cancellation, parsed identities were repeatedly rebuilt in cache windows, equivalent waiters could replay terminal integrity failures, and rewrite or refresh paths could preload metadata before deterministic stale gates. This change makes client creation operation-controlled, reuses immutable parsed identities, scopes waiter retries, applies persisted-set gates before freshness loading, and completes SPI and metrics lifecycle coverage.

### Release note

Hive metastore partition batching now has stronger cancellation, concurrent failure sharing, MTMV freshness gating, and connector SPI compatibility checks.

### Check List (For Author)

- Test: Unit Test
    - Targeted FE unit tests for HMS cache concurrency, pool control, batch loading, MTMV rewrite and refresh, metrics, and Connector SPI surface
- Behavior changed: Yes. Equivalent cache waiters share terminal integrity failures, narrower waiters retry independently, and MTMV rewrite skips freshness loads for locally rejected candidates.
- Does this need documentation: No
### What problem does this PR solve?

Issue Number: None

Related PR: apache#67186

Problem Summary: The new connector metadata access source import was placed before lexicographically earlier HMS and connector SPI imports in three Hive connector classes, causing the full FE CheckStyle workflow to fail. Reorder those imports according to the Doris CustomImportOrder rule.

### Release note

None

### Check List (For Author)

- Test: Unit Test
    - cd fe && mvn clean checkstyle:check
- Behavior changed: No
- Does this need documentation: No
@CalvinKirs

Copy link
Copy Markdown
Member Author

/review

@github-actions

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: Your access token could not be refreshed because your refresh token was revoked. Please log out and sign in again.
Workflow run: https://github.com/apache/doris/actions/runs/33137288710

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@CalvinKirs

Copy link
Copy Markdown
Member Author

run buildall

@CalvinKirs

Copy link
Copy Markdown
Member Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for four distinct current-head issues: unbounded outstanding HMS client creators, MTMV persistence losing union batching on first/incomplete or mapping-changed baselines, cloud version RPCs under FE table locks, and nested wait spans inflating the legacy metadata-time total.

Checkpoint conclusions:

  • Goal, focus, and scope: the common bounded HMS path is broadly wired across query, statistics, MTMV, display, transaction, and write callers; no extra user focus was supplied. The first-refresh persistence case still misses the central batching goal.
  • Correctness, conditions, and parallel paths: strict identity/order validation and migrated Hive/Hudi caller paths were checked, including cache-enabled/disabled, pooled/unpooled, first/incomplete/changed MTMV snapshots, local/external/cloud, and success/failure/cancellation branches.
  • Concurrency and lifecycle: cache owner/waiter, invalidation, slot, retry, and publication paths were reviewed. The asynchronous creation fix has no bound on interrupt-ignoring creator tasks.
  • Configuration and compatibility: new property defaults/validation, source/control defaults, connector SPI freezes, and the unreleased-6.0 compatibility context were checked. No new FE-BE wire dependency was introduced.
  • Observability and performance: detailed operation counters remain useful, but the legacy query total double-counts nested waits. The first/incomplete MTMV path can turn a 160k disjoint mapping into roughly 160k logical one-name freshness requests.
  • Transactions, persistence, writes, and atomicity: transaction/write callers use the common API; snapshot persistence has the separate preload-mode bug below, and cloud recapture performs remote work inside metadata locks. Existing live atomicity threads were treated as duplicate fences.
  • Tests/results: reviewed the changed unit tests and the PR's reported 250-partition manual profile. No build or test command was run in this review, as required by the review task; the PR also states the 120k end-to-end case was not rerun. Missing focused coverage is called out inline.

A complete 63-file final sweep and a second full convergence round found no additional distinct issues beyond these four and existing review threads.

Comment thread fe/fe-core/src/main/java/org/apache/doris/common/profile/SummaryProfile.java Outdated
Comment thread fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRefreshContext.java Outdated
Comment thread fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRefreshContext.java Outdated
@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 17284 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 1cd171d3667c98af0dd494649fece917b5cb921a, data reload: false

------ Round 1 ----------------------------------
============================================
q1	17566	3068	3029	3029
q2	2102	254	237	237
q3	10223	868	526	526
q4	4672	258	200	200
q5	7674	590	392	392
q6	137	119	96	96
q7	521	526	393	393
q8	9232	920	945	920
q9	3511	2432	2442	2432
q10	6499	884	758	758
q11	402	201	182	182
q12	625	262	201	201
q13	18119	1539	1167	1167
q14	163	157	145	145
q15	q16	447	407	376	376
q17	1310	883	854	854
q18	3171	2293	2285	2285
q19	1117	929	833	833
q20	372	306	204	204
q21	4864	1820	1917	1820
q22	344	277	234	234
Total cold run time: 93071 ms
Total hot run time: 17284 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	3395	3344	3325	3325
q2	541	413	393	393
q3	2229	2393	2216	2216
q4	1232	1198	923	923
q5	2254	2165	2142	2142
q6	172	119	88	88
q7	1088	962	897	897
q8	1641	1452	1440	1440
q9	3213	3186	3159	3159
q10	1890	1832	1665	1665
q11	363	277	263	263
q12	460	442	350	350
q13	1484	1537	1195	1195
q14	172	183	161	161
q15	q16	419	407	367	367
q17	3693	3458	3289	3289
q18	4927	4535	4949	4535
q19	960	895	874	874
q20	1028	1033	850	850
q21	3990	3238	3283	3238
q22	418	362	333	333
Total cold run time: 35569 ms
Total hot run time: 31703 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 83713 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 1cd171d3667c98af0dd494649fece917b5cb921a, data reload: false

query5	4299	447	343	343
query6	396	143	137	137
query7	4887	419	235	235
query8	303	128	124	124
query9	8676	3019	2998	2998
query10	393	237	191	191
query11	5417	1064	919	919
query12	138	75	72	72
query13	1184	448	330	330
query14	6092	2299	2143	2143
query14_1	2048	2034	2032	2032
query15	178	122	114	114
query16	951	385	362	362
query17	830	453	388	388
query18	2333	330	246	246
query19	163	142	113	113
query20	74	70	71	70
query21	212	104	90	90
query22	5358	5436	5360	5360
query23	6849	6320	6255	6255
query23_1	6229	6414	6096	6096
query24	7305	1118	797	797
query24_1	810	809	813	809
query25	449	319	272	272
query26	1236	240	137	137
query27	2779	424	265	265
query28	4674	1510	1518	1510
query29	943	465	372	372
query30	252	158	131	131
query31	830	410	345	345
query32	134	76	80	76
query33	476	237	196	196
query34	974	839	524	524
query35	404	400	350	350
query36	579	606	547	547
query37	124	80	71	71
query38	1023	859	818	818
query39	506	488	491	488
query39_1	473	491	481	481
query40	209	92	76	76
query41	53	57	55	55
query42	74	70	75	70
query43	242	247	213	213
query44	1021	550	578	550
query45	114	109	97	97
query46	793	804	532	532
query47	781	762	715	715
query48	320	315	218	218
query49	554	253	186	186
query50	727	273	195	195
query51	8004	8045	8124	8045
query52	68	70	59	59
query53	191	204	146	146
query54	238	281	153	153
query55	73	58	57	57
query56	216	185	163	163
query57	709	632	639	632
query58	197	174	165	165
query59	1243	1252	1117	1117
query60	244	191	186	186
query61	122	168	134	134
query62	381	222	179	179
query63	168	153	139	139
query64	2684	699	612	612
query65	1711	1571	1652	1571
query66	1774	263	217	217
query67	9865	9767	9849	9767
query68	3014	1265	739	739
query69	345	225	202	202
query70	675	617	614	614
query71	250	178	166	166
query72	2469	1791	1660	1660
query73	654	576	340	340
query74	2015	1217	1172	1172
query75	1217	1142	992	992
query76	2367	744	562	562
query77	270	265	218	218
query78	3935	3634	3252	3252
query79	2351	869	606	606
query80	1652	362	322	322
query81	497	161	138	138
query82	641	133	101	101
query83	335	215	189	189
query84	293	111	91	91
query85	843	370	315	315
query86	396	174	179	174
query87	1045	992	904	904
query88	2806	2140	2125	2125
query89	292	199	178	178
query90	1943	132	133	132
query91	135	126	104	104
query92	82	71	71	71
query93	1500	1171	725	725
query94	663	287	245	245
query95	534	329	233	233
query96	838	612	272	272
query97	1120	1094	1042	1042
query98	166	132	135	132
query99	416	351	315	315
Total cold run time: 178917 ms
Total hot run time: 83713 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 14.96 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 1cd171d3667c98af0dd494649fece917b5cb921a, data reload: false

query1	0.00	0.01	0.00
query2	0.08	0.04	0.04
query3	0.24	0.11	0.11
query4	1.60	0.11	0.10
query5	0.17	0.16	0.16
query6	1.24	0.71	0.73
query7	0.04	0.01	0.00
query8	0.06	0.03	0.03
query9	0.30	0.22	0.22
query10	0.36	0.36	0.35
query11	0.17	0.11	0.11
query12	0.14	0.12	0.12
query13	0.31	0.31	0.32
query14	0.46	0.48	0.47
query15	0.37	0.36	0.36
query16	0.24	0.22	0.23
query17	0.71	0.74	0.69
query18	0.18	0.16	0.15
query19	1.24	1.19	1.15
query20	0.02	0.01	0.01
query21	15.43	0.18	0.13
query22	5.02	0.05	0.04
query23	16.19	0.25	0.11
query24	3.00	0.30	0.24
query25	0.11	0.03	0.03
query26	0.78	0.17	0.12
query27	0.04	0.03	0.03
query28	3.59	0.56	0.28
query29	12.44	3.19	2.59
query30	0.25	0.11	0.12
query31	2.76	0.39	0.18
query32	3.50	0.31	0.24
query33	1.40	1.41	1.65
query34	15.40	2.27	1.82
query35	1.83	1.78	1.78
query36	0.48	0.30	0.31
query37	0.06	0.04	0.04
query38	0.05	0.03	0.03
query39	0.03	0.02	0.03
query40	0.11	0.08	0.07
query41	0.08	0.04	0.03
query42	0.03	0.02	0.02
query43	0.03	0.03	0.03
Total cold run time: 90.54 s
Total hot run time: 14.96 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 70.45% (379/538) 🎉
Increment coverage report
Complete coverage report

### What problem does this PR solve?

Issue Number: None

Related PR: apache#67186

Problem Summary: Review found four remaining correctness and resource-control gaps in the shared HMS partition batch work. Nested coordination spans double-counted legacy profile time, non-cooperative HMS client creation could grow unbounded daemon threads, MTMV snapshot persistence skipped union preloading for first or changed baselines, and cloud MTMV version refreshes could issue remote calls while FE table locks were held. Count only top-level HMS access in legacy totals, retain bounded client-creation admission until real creator exit, split persistence preloading from comparison gating, and preload cloud MTMV versions before locks while revalidating locked structure from raw local caches.

### Release note

Improve HMS partition batch profiling, cancellation resource bounds, MTMV snapshot batching, and cloud lock behavior.

### Check List (For Author)

- Test: Unit Test
    - SummaryProfileTest, ThriftHmsClientPoolControlTest, MTMVRefreshContextBatchTest, MTMVPartitionUtilTest, MTMVRewriteUtilTest, PreloadExternalMetadataTest (46 tests)
    - MTMVTaskTest and PartitionsProcDirTest (18 tests)
    - cd fe && mvn clean checkstyle:check
- Behavior changed: Yes. Legacy profile totals no longer double-count nested waits, HMS creators are bounded, persistence uses ungated union preloading, and cloud version RPCs run before FE table locks.
- Does this need documentation: No
### What problem does this PR solve?

Issue Number: None

Related PR: apache#67186

Problem Summary: The latest master added a TIMESTAMP_NS rollup test that still called the pre-change MTMV partition-column and range-rollup signatures. After CI rebased the PR, fe-core test compilation failed. Pass Optional.empty() through both calls so the new master test follows the snapshot-aware API introduced by this PR.

### Release note

None

### Check List (For Author)

- Test: Unit Test
    - ./run-fe-ut.sh --run org.apache.doris.mtmv.MTMVRelatedPartitionDescRollUpGeneratorTest,org.apache.doris.mtmv.MTMVTaskTest,org.apache.doris.connector.spi.ConnectorMetadataFreshnessDefaultsTest,org.apache.doris.connector.hive.HiveConnectorMetadataSiblingDelegationTest
- Behavior changed: No
- Does this need documentation: No
@CalvinKirs

Copy link
Copy Markdown
Member Author

run buildall

@CalvinKirs

Copy link
Copy Markdown
Member Author

run performance

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 61.04% (199/326) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 16872 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 7908252fe93cd9b0d1ef2a57ce0827424a5e01ce, data reload: false

------ Round 1 ----------------------------------
============================================
q1	17561	3010	2998	2998
q2	2110	267	233	233
q3	10212	881	526	526
q4	4673	247	205	205
q5	7670	566	385	385
q6	140	119	97	97
q7	523	519	387	387
q8	9242	892	939	892
q9	3467	2399	2395	2395
q10	6511	842	723	723
q11	396	195	187	187
q12	615	254	206	206
q13	18124	1522	1161	1161
q14	160	150	136	136
q15	q16	445	404	369	369
q17	1403	856	872	856
q18	3069	2273	2231	2231
q19	1111	938	789	789
q20	376	286	196	196
q21	5173	1670	1866	1670
q22	334	274	230	230
Total cold run time: 93315 ms
Total hot run time: 16872 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	3338	3290	3265	3265
q2	497	384	397	384
q3	2219	2289	2178	2178
q4	1183	1182	908	908
q5	2229	2123	2107	2107
q6	168	122	89	89
q7	1018	928	877	877
q8	1588	1371	1383	1371
q9	3113	3088	3069	3069
q10	1834	1808	1624	1624
q11	348	264	252	252
q12	456	433	344	344
q13	1487	1543	1155	1155
q14	161	162	164	162
q15	q16	401	400	360	360
q17	3545	3286	3196	3196
q18	4830	4466	4739	4466
q19	852	807	885	807
q20	1022	984	866	866
q21	3856	3119	3284	3119
q22	388	340	331	331
Total cold run time: 34533 ms
Total hot run time: 30930 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 81937 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 7908252fe93cd9b0d1ef2a57ce0827424a5e01ce, data reload: false

query5	4257	406	333	333
query6	375	147	125	125
query7	4961	395	232	232
query8	293	131	124	124
query9	8712	2881	2872	2872
query10	390	226	188	188
query11	5370	1040	925	925
query12	117	70	70	70
query13	1191	456	318	318
query14	6147	2226	2127	2127
query14_1	2009	1964	1969	1964
query15	176	120	112	112
query16	916	383	282	282
query17	782	454	373	373
query18	2329	327	233	233
query19	169	146	116	116
query20	76	69	72	69
query21	198	104	92	92
query22	5359	5442	5243	5243
query23	6841	6105	6169	6105
query23_1	5934	6061	6176	6061
query24	7258	1083	781	781
query24_1	789	796	776	776
query25	391	282	233	233
query26	1222	222	125	125
query27	2813	383	253	253
query28	4724	1487	1497	1487
query29	902	418	339	339
query30	261	159	125	125
query31	823	397	329	329
query32	130	77	72	72
query33	442	216	177	177
query34	984	852	480	480
query35	407	396	351	351
query36	574	581	526	526
query37	125	82	77	77
query38	1012	851	818	818
query39	485	478	462	462
query39_1	474	473	457	457
query40	200	92	79	79
query41	59	53	50	50
query42	75	71	72	71
query43	236	244	206	206
query44	980	533	547	533
query45	113	104	101	101
query46	780	823	521	521
query47	752	765	735	735
query48	287	325	219	219
query49	540	244	192	192
query50	756	274	203	203
query51	8210	8099	8169	8099
query52	72	75	63	63
query53	203	202	158	158
query54	228	187	169	169
query55	75	65	56	56
query56	210	181	189	181
query57	713	679	694	679
query58	219	196	171	171
query59	1206	1207	1082	1082
query60	240	192	186	186
query61	133	129	137	129
query62	355	209	173	173
query63	179	146	144	144
query64	2734	693	593	593
query65	1685	1580	1631	1580
query66	1959	296	212	212
query67	9844	9643	9559	9559
query68	2818	1245	707	707
query69	343	224	207	207
query70	651	661	633	633
query71	252	184	170	170
query72	2314	1645	1728	1645
query73	632	626	343	343
query74	1560	1227	1124	1124
query75	1168	1104	946	946
query76	2298	719	507	507
query77	251	263	213	213
query78	3900	3717	3132	3132
query79	1633	850	582	582
query80	1209	317	272	272
query81	487	158	142	142
query82	675	123	99	99
query83	285	211	191	191
query84	290	114	91	91
query85	762	351	283	283
query86	385	166	172	166
query87	1012	977	886	886
query88	2789	2141	2097	2097
query89	274	203	178	178
query90	1991	132	130	130
query91	132	119	98	98
query92	76	63	69	63
query93	1301	1094	689	689
query94	644	261	234	234
query95	533	240	230	230
query96	773	576	271	271
query97	1051	1065	1051	1051
query98	146	138	131	131
query99	419	365	305	305
Total cold run time: 175971 ms
Total hot run time: 81937 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 14.66 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 7908252fe93cd9b0d1ef2a57ce0827424a5e01ce, data reload: false

query1	0.01	0.01	0.00
query2	0.08	0.04	0.03
query3	0.26	0.10	0.11
query4	1.60	0.09	0.10
query5	0.18	0.16	0.16
query6	1.26	0.69	0.68
query7	0.03	0.00	0.01
query8	0.04	0.03	0.03
query9	0.28	0.22	0.22
query10	0.36	0.34	0.32
query11	0.17	0.12	0.12
query12	0.15	0.12	0.12
query13	0.30	0.30	0.31
query14	0.44	0.46	0.43
query15	0.36	0.34	0.35
query16	0.22	0.20	0.24
query17	0.71	0.70	0.69
query18	0.18	0.17	0.17
query19	1.25	1.19	1.24
query20	0.01	0.01	0.01
query21	15.51	0.16	0.12
query22	5.06	0.05	0.04
query23	16.16	0.25	0.10
query24	3.01	0.31	0.26
query25	0.11	0.04	0.03
query26	0.80	0.16	0.12
query27	0.04	0.04	0.03
query28	3.62	0.57	0.28
query29	12.43	3.17	2.56
query30	0.26	0.12	0.12
query31	2.75	0.36	0.17
query32	3.53	0.32	0.23
query33	1.38	1.38	1.39
query34	15.38	2.18	1.79
query35	1.80	1.73	1.73
query36	0.45	0.29	0.30
query37	0.05	0.04	0.04
query38	0.04	0.03	0.02
query39	0.03	0.02	0.02
query40	0.11	0.08	0.07
query41	0.07	0.02	0.03
query42	0.03	0.02	0.02
query43	0.03	0.03	0.02
Total cold run time: 90.54 s
Total hot run time: 14.66 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 73.62% (240/326) 🎉
Increment coverage report
Complete coverage report

@CalvinKirs
CalvinKirs merged commit bd993f3 into apache:master Sep 10, 2026
36 of 37 checks passed
@CalvinKirs
CalvinKirs deleted the batch_interface branch September 10, 2026 02:13
@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Sep 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

morningman added a commit that referenced this pull request Sep 15, 2026
…on PRs from master in merge order (#67753 #67802 #67814 #67837 #67853 #67876) (#68017)

Cherry-picked from #67753, #67802, #67814, #67837, #67853, #67876

Batch pick of every merged PR carrying the `incremental-computation`
label that `branch-incremental-computation` does not have yet (no
`incremental-computation-picked` label), in the order they landed on
master (`git log --first-parent`). One commit per PR, each created with
`git cherry-pick -x` so the message ends with `(cherry picked from
commit <master sha>)`. Follows the same convention as #67830.

| # | Master commit | PR | Title |
|---|---|---|---|
| 1 | fe39f5b | #67753 | [fix](ivm) Answer FE-computable dry runs on
the frontend instead of a placeholder backend |
| 2 | f8ed33f | #67802 | [fix](ivm) Refresh the surviving partitions
after an IVM baseline rebuild |
| 3 | 7bd89a0 | #67814 | [fix](ivm) Stop the incremental delta from
reading partitions the MV dropped |
| 4 | 3050a9a | #67837 | [fix](ivm) Invalidate the baseline when a
column used by the MV is dropped |
| 5 | 22c95eb | #67853 | [fix](ivm) Carry the row-binlog hidden
columns in the analyzed MTMV schema |
| 6 | 3390a7a | #67876 | [test](ivm) Remove unnecessary cloud skips
from IVM suites |

Not included on purpose:
- The 11 labelled PRs that already carry
`incremental-computation-picked` (#62606 in the fork point, #67508 via
#67712, the nine of #67830).
- #67820 is still open on master; this branch already carries its
content via #67861.

### Prerequisite check

None of the six PRs declares a prerequisite, and none of them needs
another master PR for its behavior. The only master commits that touch
the same files and are not on this branch are unrelated to incremental
computation (#66761 TIMESTAMP_NS, #67545 DLF, #67569 / #67520 / #67835
MySQL-protocol and session refactors, #67186 Hive partition batching,
#67787 SQL cache user variables); they were left out, and two picks
needed a mechanical adaptation because of that:

- **#67753** conflicted in `StmtExecutor.sendMetaData`: master had
already extracted the post-metadata EOF into
`sendMetadataTerminatorIfNeeded(channel)` (#67520, a Connector/J
cursor-fetch fix). The branch keeps its inline EOF block and now sends
it on the given `channel` instead of `context.getMysqlChannel()`, which
is exactly what the extracted helper does on master. Everything else in
the pick is identical to the master commit.
- **#67814** applied cleanly but did not compile: the new
`MTMVPartitionUtil.generateRelatedBasePartitionIds()` returns an
`Optional`, and on master `import java.util.Optional;` came with #67186.
The import was added to the pick commit; that is the only difference
from the master commit.

The other four picks applied without conflicts and are byte-identical to
their master commits (diffs compared with `index`/`@@` lines stripped).
Both adaptations are recorded in the respective commit messages.

### Drift check against master

After the six picks, every touched file is byte-identical to master at
`3390a7a721f` except `MTMV.java`, `MTMVTask.java`,
`MTMVPartitionUtil.java`, `MTMVPartitionUtilTest.java`,
`MTMVTaskTest.java` (differences = #67186 + #67545 + #66761),
`CreateTableInfo.java` (= #67787) and `StmtExecutor.java` (= #67520 +
#67569 + #66761 + the later session refactors #67835 / #67883 + this
branch's #67861). For the first six files, applying those unrelated
master commits on top of the branch's versions reproduces master's files
exactly; for `StmtExecutor.java`, the diff against master right after
#67753 (`fe39f5b6a42`) consists only of #67520 / #67569 / #66761 /
#67861 hunks. So nothing IVM-related is missing. The regression
framework, plugins and the whole `mtmv_p0/ivm` suite/data directories
are identical to master.

### Verification

- FE: `run-fe-ut.sh --run` on this branch (regenerates thrift, compiles
fe-core main + test) with the 17 test classes touched by the picks or
extending the touched `IvmDeltaTestBase`:
17 classes, 404 tests, 0 failures, 0 errors, BUILD SUCCESS (5:19 min) —
`MTMVPlanUtilTest` 24, `IvmAggDeltaHandlerTest` 33,
`IvmDeltaRewriteHelperTest` 17, `IvmNormalizeMTMVJoinTest` 44,
`IvmJoinDeltaHandlerTest` 23, `IvmDeltaRewriteStateTest` 10,
`IvmPlanSignatureGeneratorTest` 22, `IvmBaselineRebuildTest` 28,
`IvmLinearDeltaHandlerTest` 39, `IvmDeltaRewriterTest` 23,
`IvmNormalizeMTMVUnionTest` 10, `MTMVTaskTest` 50,
`MTMVPropertyUtilTest` 13, `MTMVPartitionUtilTest` 16,
`SchemaChangeHandlerTest` 22, `StmtExecutorInternalQueryTest` 3,
`StmtExecutorTest` 27.
- FE checkstyle on fe-core: 0 violations.
- No BE, cloud or thrift changes in this batch.
- All 18 touched groovy files (framework `Suite.groovy`,
`plugin_planner.groovy`, 16 suites) parse cleanly (groovy parser check).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: yujun <yujun@selectdb.com>
morningman added a commit that referenced this pull request Sep 23, 2026
…on PRs from master in merge order (#67347 #68193 #68336 #68170 #68180) (#68405)

Cherry-picked from #67347, #68193, #68336, #68170, #68180

Batch pick of every merged PR carrying the `incremental-computation`
label that `branch-incremental-computation` does not have yet (no
`incremental-computation-picked` label), in the order they landed on
master (`git log --first-parent`). One commit per PR, each ending with
`(cherry picked from commit <master sha>)`. Follows the same convention
as #67830, #68017, #68073, #68151, #68236 and #68303.

| # | Master commit | PR | Title |
|---|---|---|---|
| 1 | a7c0a78 | #67347 | [fix](cloud) bind the packed slice location
lifetime to its writer |
| 2 | addf0c8 | #68193 | [feature](ivm) Add the per-partition
refresh state and its journal channel |
| 3 | e885b46 | #68336 | [refactor](ivm) Rename
IvmInfo.refreshVersion to sequencePrefix |
| 4 | 01efbca | #68170 | [fix](ivm) Fall back to complete refresh
when the IVM stream is unusable |
| 5 | d6c1a2b | #68180 | [fix](ivm) Choose IVM baseline rebuild
partitions from the MV partition mapping |

Not included on purpose:

- The 29 labelled PRs that already carry
`incremental-computation-picked` (every other closed PR with the label).
This batch closes the selection query: 34 closed labelled PRs = 29
already picked + these 5.

### Prerequisite check

- **The IVM series (#68193, #68336, #68170, #68180)** — one series by
the same author, merged 2026-09-21/22, all tracing to issue #65418.
#68193 says in its own description that it "adds the state that the
following PRs need" — `MTMVPartitionState` plus its journal channel —
and #68336 is the rename of the field sitting next to it. The PRs that
consume that state are in this batch too, so the series is carried whole
and in master merge order. Its earlier PRs (#67802, #67837, #67814,
#68138, #67646, #67669, #67575) were picked in the previous rounds.
- **#67347** is standalone (cloud packed-file slice lifetime). Every
file that uses the APIs it changes is in the pick;
`be/src/io/fs/packed_file_system.cpp`, which also reads the global slice
index but is not modified, compiles unchanged against the picked
headers.
- **No unpicked master commit is required by any of the five.** Verified
by compiling, not by inspection alone: the whole FE main + test tree
compiles and the touched unit tests pass (below), and every BE/cloud
file the picks touch passes a `-fsyntax-only` compile with the real
build's flags.
- The unlabelled master commits touching the same files (#67186 Hive
partition batching, #66530 external scan task reuse, #66761
TIMESTAMP_NS, #67545 DLF, #67067 eager-agg) are *not* prerequisites —
see the drift check: none of the picks' own added lines reference what
they introduce.

### Drift check against master

Per pick, `git show` of the branch commit against the master squash,
with `index`/`@@` lines stripped: #67347, #68193 and #68336 are
identical. Two differ, both mechanically:

- **#68170 / `MTMVTask.java`** — master's context around
`executePartitionBasedRefresh` carries #67186's `try` block and snapshot
preload; this branch does not have #67186, so the auto-merge kept the
branch's block. The pick's own added and removed lines are identical to
master's.
- **#68180 / `MTMV.java`** — master's squash also adds `import
org.apache.doris.datasource.mvcc.MvccSnapshot;`, for #67186's
`pinnedSnapshots` overloads of `calculatePartitionMappings` /
`getEffectiveQueryUsedBaseTablePartitionMap`. Those overloads do not
exist here and the pick's new code only calls the single-argument form,
which exists on both sides, so the import is not needed and not carried.

For every file this batch touches, `git diff upstream-apache/master --
<file>` was taken and each master-side line attributed to the unpicked
commit that added it. All 42 files resolve: 37 have no master-side
difference at all, and the 5 that do are fully owned by

| file | master-side lines | owner |
|---|---|---|
| `MTMV.java` | 20 | #67186 |
| `MTMVTask.java` | 46 | #67186, #66530 |
| `MTMVTaskTest.java` | 44 | #67186 |
| `MTMVPartitionUtil.java` | 65 | #67186, #67545 |
| `MTMVRelatedPartitionDescSyncLimitGenerator.java` | 3 | #66761 |

i.e. nothing belonging to the picks is missing, and no unlabelled commit
has to come along.

### Verification

- FE: `run-fe-ut.sh --run` on this branch (regenerates thrift/protobuf,
compiles fe-core main 4480 files + test 1485 files) over the 11 touched
test classes — `AlterMTMVTest` 25, `MTMVTest` 23, `MTMVTaskTest` 48,
`MetaLockUtilsTest` 6, `IvmBaselineRebuildTest` 37,
`IvmAggDeltaHandlerTest` 33, `IvmDeltaRewriteStateTest` 10,
`IvmFailureReasonTest` 1, `IvmInfoTest` 6, `IvmSequenceCalculatorTest`
4, `DatabaseTransactionMgrTest` 20 — **213 tests, 0 failures, 0 errors,
0 skipped, BUILD SUCCESS**.
- FE checkstyle on fe-core: 0 violations.
- BE/cloud: `-fsyntax-only` with the Release flags of the real build and
its own compiler (`/opt/homebrew/opt/llvm@20/bin/clang++`) on
`be/src/io/fs/packed_file_manager.cpp`,
`be/src/io/fs/packed_file_writer.cpp`,
`be/src/cloud/cloud_rowset_writer.cpp` and
`be/test/io/fs/packed_file_manager_test.cpp` (the last with `-DBE_TEST
-fno-access-control`): no errors.
- The three new regression suites parse
(`test_ivm_baseline_marker_scope`, `test_ivm_chained_stream_scope`,
`test_ivm_partitions_fallback_stream_unusable`); their `.out` files are
the upstream ones, unmodified.

---------

Co-authored-by: Xin Liao <liaoxin@selectdb.com>
Co-authored-by: yujun <yujun@selectdb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/4.1.5-merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants