Conversation
…FIFO ### What problem does this PR solve? Problem Summary: Independent bitmap and flush pools allow segment production to outpace bitmap computation. Share foreground workers per resource domain, rotate transactions in FIFO order, and choose commit/write-end/write-time bitmap before flush within each transaction. Preserve per-token completion and background bitmap execution. Execute nested bitmap work inline to avoid same-pool waits. ### Release note Load bitmap and flush use shared workers with transaction FIFO and stage priority. Independent load-bitmap, tablet-bitmap and high-priority flush pools are removed; their sizing settings no longer allocate separate pools. See the design document for transaction grouping and workload-group restoration limitations. ### Check List (For Author) - Test: Unit coverage added; compilation and test execution skipped at requester direction. Static review and clang-format 16 formatting completed. - Behavior changed: Yes, foreground scheduling and resource allocation. - Does this need documentation: Yes, docs/design/load-fifo-scheduling.md.
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
### What problem does this PR solve? Problem Summary: Remove the standalone load scheduling design document because the design is now included directly in the PR description. ### Release note None ### Check List (For Author) - Test: Not run; documentation removal only. Compilation and tests remain skipped at the requester's direction. - Behavior changed: No. - Does this need documentation: The design remains in the PR description.
sollhui
marked this pull request as ready for review
September 22, 2026 09:30
sollhui
requested review from
gavinchou,
liaoxin01,
luwei16 and
yiguolei
as code owners
September 22, 2026 09:30
### What problem does this PR solve? Problem Summary: Define LoadTaskPriority as HIGHEST, HIGH, MID, and LOW so the priority names express scheduling levels. Business submission sites select the level for bitmap and flush stages. Preserve the numeric values and ordering. ### Release note None ### Check List (For Author) - Test: Compilation and tests skipped at requester direction; reviewed renamed references and formatted modified files with clang-format 16. - Behavior changed: No. - Does this need documentation: The inline PR design includes the updated enum.
### What problem does this PR solve? Issue Number: Related PR apache#68385 Problem Summary: Shared bitmap callbacks attach a task context before entering the cloud tablet handler, which attached another context. Inline segment callbacks also attached inside the parent task. This violates AttachTask's non-nesting contract and clears the parent's ResourceContext when the nested scope exits. Attach the submitting context only at asynchronous bitmap worker entry and let inline callbacks inherit the current context and tracker scope. Switch only the MemTracker in the cloud tablet handler. Extend the single-worker nested bitmap test to check context, task ID, and tracker preservation across successive successful children and a failing child. ### Release note Fix nested task-context attachment during shared-pool cloud bitmap computation. ### Check List (For Author) - Test: Extended LoadThreadPoolTest.NestedBitmapRunsInlineWithOneWorker. BE build-hygiene, clang-format 16.0.5, and git diff --check passed. run-be-ut.sh --run --filter='LoadThreadPoolTest.*:LoadTaskQueueTest.*' -j 4 stopped while acquiring the apache-orc dependency because github.com could not be resolved; C++ compilation and unit-test execution did not start. - Behavior changed: Yes, inline bitmap work preserves the parent task context. - Does this need documentation: No
### What problem does this PR solve? Related PR: apache#68385 Problem Summary: Transaction round robin restricts priority to each load. Replace the outer load queue with four global FIFO priority queues per resource domain, remove transaction IDs from scheduling APIs, and promote DUP-key flushes to P1 because these loads have no bitmap stages. Other flushes remain P3. Group row-binlog flushes follow the data table schema. ### Release note Foreground load tasks use global priority within each resource domain. DUP flush and write-end bitmap work share P1; write-time bitmap work uses P2 and other flushes use P3. There is no per-load fairness guarantee. ### Check List (For Author) - Test: Updated queue/token tests and added DUP/MoW/AGG flush ordering coverage. clang-format 16, build hygiene, and git diff --check passed. The targeted BE unit-test command stopped at apache-orc dependency download because github.com could not be resolved; C++ compilation and tests did not run. - Behavior changed: Yes, global task priority replaces transaction round robin and DUP flush moves to P1. - Does this need documentation: Yes, the design is documented in PR apache#68385.
…letes ### What problem does this PR solve? Related PR: apache#68385 Problem Summary: Cloud DELETE agent tasks have no attached ResourceContext, so capturing their workload group unconditionally triggers a DCHECK in debug builds. Record no workload group for unattached callers and route them to the default domain. Bitmap submission failures were counted as unfinished callbacks without retaining their error, so wait() returned generic Cancelled. Persist the original failure and drain all cloud tokens before returning the recorded tablet/submission error. ### Release note Avoid a debug assertion on Cloud DELETE and preserve the original failure reason when bitmap submission is rejected. ### Check List (For Author) - Test: Added contextless cache/workload-group capture and queue-full/stopped-pool/cloud error-precedence unit coverage. clang-format 16, build hygiene, and git diff --check passed. The targeted BE UT command stopped at the JDK environment check; direct java -version reports Failed setting boot class path. C++ compilation and tests did not run. - Behavior changed: Yes, contextless DELETE uses the default domain and original bitmap errors survive wait(). - Does this need documentation: Yes, documented in PR apache#68385.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Problem Summary:
Foreground bitmap computation and memtable flush use separate execution pools, so a bitmap backlog does not directly reduce the rate at which flush workers produce new segments. Share those workers and dispatch ready foreground tasks by global priority within each resource domain. Duplicate-key loads only have flush work, so assign their flushes P1.
Design
Shared execution resources
Foreground bitmap computation and memtable flush share the existing flush workers. The default pool and workload-group pools remain separate. Reuse
ThreadPoolworker management, queue capacity, metrics, and adaptive sizing. Ordinary non-load submissions retain their existing scheduling policy.Remove the independent
LoadCalcDeleteBitmapThreadPool,TabletCalDeleteBitmapThreadPool, and high-priority memtable flush pool. Foreground callers ofTabletCalcDeleteBitmapThreadPoolmove to the shared workers; background compaction and schema-change work retains the general bitmap executor.TaskWP_CALC_DBM_TASKremains the separate request orchestration/waiting pool, andSyncDeleteBitmapThreadPoolremains separate.Global task priority
Each resource domain has four global FIFO queues. Every ready load task enters its priority queue directly. There is no outer load queue, transaction round robin, or transaction ID in the scheduling API. Workers select the highest nonempty priority queue:
HIGHESTHIGHMIDLOWFlush priority is selected from the rowset writer's tablet schema. A group rowset writer's data and row-binlog flushes both follow the main table's priority; a MoW table's row-binlog schema does not promote its flush to P1.
Priority applies across all queued load tasks in a domain. Tasks of the same priority are dispatched in FIFO order, including tasks belonging to different loads or tokens. Running tasks are not preempted, and completion order may differ with multiple workers. Load tokens retain completion/cancellation boundaries but impose no per-load concurrency limit; one token can use all available workers.
Submission, selection, and cancellation use
ThreadPool::_lock. Cancelling a token scans the four queues and removes only that token's tasks, preserving FIFO order for the others. Removed callbacks and their captured resources are destroyed outside the pool mutex.Backpressure after flush
A normal MoW writer creates its bitmap token before flush execution. When a flush produces a segment, it enqueues P2 bitmap work and returns without waiting. Ready P2 work takes precedence over queued P3 flushes across the resource domain. Slow bitmap work occupies shared workers and slows subsequent flushes. Unflushed memtables retain memory, so existing memory limits and write-side waits propagate pressure upstream. Already-running flushes continue; this design adds no bitmap-byte admission budget.
DUP flushes share P1 with write-end bitmap reconciliation, so they take precedence over P2/P3 work. This does not guarantee per-load fairness: sustained P0/P1 traffic can delay lower-priority work.
Dependencies, context, and completion
Cloud commit tablet tasks hold tablet locks while calculating segment bitmaps. A bitmap token created inside a load worker executes its children inline to avoid waiting for children queued to the same pool. This retains serial segment calculation within a cloud tablet; different tablets can run concurrently. Local publish runs outside the shared pool and can submit P0 segment tasks and wait there. Transient publish writers also classify their bitmap work as P0.
Inline children inherit the current task context and tablet memory tracker. Asynchronously submitted bitmap callbacks attach their captured
ResourceContext, and cloud tablet work switches the memory tracker within that attached context.Flush-worker cleanup can release the last rowset-writer reference. Cancelling its P2 token removes queued work, then joins already-running independent bitmap leaves. A worker cannot join its own token. Submitted/completed counters prevent discarded bitmap callbacks from being reported as successful completion during pool shutdown. The selected workload group stays alive until its underlying pool token is released. Submission failures are retained in the bitmap token so
wait()returns the original error instead of a generic cancellation. Cloud request completion drains all submitted tokens before returning its recorded tablet/submission error; a wait failure is used when no earlier error was recorded.Workload-group routing
The cloud transaction cache records the write-stage workload group. Commit selects the tablet's first available cached owner, including subtransaction entries. Cloud DELETE agent tasks have no attached resource context; cache registration records no workload group for them and uses the default domain without calling
resource_ctx()on an unattached thread. Missing entries or a dropped workload group use the default domain. One tablet commit is not split across multiple workload groups. Transaction IDs remain business identifiers but no longer affect task scheduling. No persistent metadata or wire-format change is introduced.Release note
Foreground bitmap work shares memtable flush workers and receives global task priority per resource domain. DUP flushes run at P1; MoW and other flushes run at P3. The former
calc_delete_bitmap_for_load_max_thread,calc_tablet_delete_bitmap_task_max_thread, andhigh_priority_flush_thread_num_per_storesettings remain parseable but no longer size independent pools;is_high_priorityno longer selects a separate pool. Flush sizing/adaptive controls govern shared foreground work, whilecalc_delete_bitmap_max_threadcontinues to size background bitmap work.Check List (For Author)
git diff --checkpassed for the latest changes.bash run-be-ut.sh --run --filter='LoadTaskQueueTest.*:LoadThreadPoolTest.*:MemTableFlushExecutorTest.DuplicateFlushPrecedesWriteTimeBitmap' -j 4. Dependency acquisition failed while fetchingapache-orcbecausegithub.comcould not be resolved. C++ compilation and unit test execution have not completed.LoadThreadPoolTest.*:CloudTxnDeleteBitmapCacheTest.*:CloudEngineCalcDeleteBitmapTaskTest.*) stopped during the JDK environment check; directly invoking the configured JDK reportsFailed setting boot class path. These tests have not compiled or run. clang-format 16, build hygiene, and whitespace checks passed.Check List (For Reviewer who merge this PR)