Skip to content

fix(#6281): an index build waits for the async BATCH, not just its tasks, and a flush backlog stays inside its own database - #6290

Merged
lvca merged 13 commits into
mainfrom
issue-6281
Aug 17, 2026
Merged

lvca merged 13 commits into
mainfrom
issue-6281

Conversation

@lvca

@lvca lvca commented Aug 17, 2026

Copy link
Copy Markdown
Member

Closes #6281.

Three independent items, plus an answer to the issue's open question.

Item 1 - two assertions that cannot both hold

Issue5279ConcurrentInsertTest.sustainedConcurrentInsertsOnASingleBucketNeverConflict tolerates up to two conflicts at attempts=1 and then demands the exact full count. A conflict tolerated there means that record was not written, so the run that actually uses the tolerance fails at the count (2000 against 2001) instead of passing at the tolerance meant to absorb it.

Same trap PR #6223 fixed in the sibling Issue5279ConcurrentUpdateTest; the count now subtracts conflicts.get(). Both classes were swept for the shape - nothing else matched.

Item 2 - the real find: a silent, empty index

DatabaseAsyncExecutorImpl.isProcessing() answers about tasks (queued or executing). An async worker begin()s a transaction when it starts and keeps it open across up to ASYNC_TX_BATCH_SIZE (10240 by default) tasks. So an executor whose queues happen to be drained reports itself idle while still holding every record of the current batch uncommitted.

TypeIndexBuilder.create() guarded with:

while (database.isAsyncProcessing())
  database.async().waitCompletion();

On the runs where that predicate answered false, the guard was skipped entirely: the index was built by scanning a bucket that did not contain those records, and they committed afterwards with no entry ever added for them. The result is an index that is empty, readable, and reported healthy by CHECK DATABASE, while every lookup silently answers nothing.

Reproduced deterministically before the fix - 200 records inserted, index.countEntries() = 0, select from V where id = 42 returns nothing:

SCRATCH: isAsyncProcessing=false committedBefore=0
SCRATCH: index V[id] entries=0
SCRATCH: lookupById42=false

The fix is a barrier that cannot be skipped: DatabaseInternal.waitForAsyncCompletion(), a do { waitCompletion() } while (isAsyncProcessing()). waitCompletion() is the only operation that closes the open batch - it enqueues a marker behind everything already submitted on every worker, and that marker commits - so it has to run even when the executor looks idle. It reads the async field rather than async(), which would create the executor, so a database that never used the async API neither waits nor grows a thread pool.

Applied to TypeIndexBuilder, ManualIndexBuilder and RebuildIndexStatement - REBUILD INDEX scans the buckets the same way and had the same exposure.

isProcessing() is deliberately left answering about tasks, with a Javadoc saying so: broadening it to "a transaction is open" would make it permanently true for as long as the workers are alive, which is no answer at all.

The test the issue pointed at was vacuous

ACIDTransactionTest.indexCreationWhileAsyncMustFail expected a NeedRetryException from the creation. That expectation has been dead for years - create() drains the async executor rather than refusing - so the catch was never entered (verified: 0 of 100 runs) and the only assertion left was the record count, which an empty index satisfies just as well as a complete one. That is what it was hiding.

Renamed to indexCreatedWhileAsyncInsertsAreInFlightSurvivesACrash and made to assert the index itself: countEntries() and a lookup for every record, after the crash and recovery.

Item 3 - per-database flush budget

arcadedb.pageFlushQueue was one JVM-wide ArrayBlockingQueue. #6259 took the wait for room out of the page-manager lock, so a full queue stopped freezing the whole JVM - but the coupling itself survived: one database's burst still consumed the admission budget of every other database in the process.

A better alternative than the per-database queue the issue proposes: a per-database budget over ONE unbounded queue. A per-database queue bounds the same thing while forcing the single flush thread to choose between queues on every poll - a fairness policy, and a starvation risk, that a budget over one FIFO queue simply does not have. One queue keeps global FIFO order across databases for free.

slotsInUse: ConcurrentHashMap<BasicDatabase, AtomicInteger> merges the old queue.size() + reservations into ONE count per database, charged at reservation and released only when the batch leaves the queue - so a reservation and the batch it becomes are one continuous occupancy rather than two counters that have to agree. Every enqueue goes through offerBatch, every poll through one release, and the count is asserted never to go negative.

The property given up is named in the code: queue.size() read the truth by construction, and an ArrayBlockingQueue cannot say how many of its elements belong to database D. So is the cost: worst-case occupancy is now pageFlushQueue x open databases batches, the same factor a per-database queue multiplies by, on a number that was never a byte bound to begin with (one batch is one transaction's dirty pages). The bound that is expressed in bytes remains arcadedb.flushSuspendMaxDeferredRAM.

The issue's open question

Item 2's root cause is a property of the index-build guard alone and has nothing to do with #6269: it fires whenever the async queues happen to be drained at the instant of the check, which thread scheduling on a loaded CI box makes more likely on some runs than others. The specific page 0: keys cannot be read (Invalid position ...) warning was not reproduced locally, so I am not claiming it as explained - but the test that produced it now asserts the index rather than a bare warnings count, so a recurrence will say what is wrong instead of only that something is.

Verification

  • New: Issue6281AsyncBatchIndexBuildTest (fails on the previous code: [every record must have an entry in the index] expected 200 but was 0), Issue6281PerDatabaseFlushQueueTest.
  • engine: 12111 tests, 0 failures.
  • server: 783 tests, 0 failures.
  • Full reactor compiles.

…sks, and a flush backlog stays inside its own database

Three independent follow-ups from #6259.

Item 1 - Issue5279ConcurrentInsertTest.sustainedConcurrentInsertsOnASingleBucketNeverConflict tolerated up to
two conflicts at attempts=1 and then demanded the exact full count. A conflict tolerated there means the record
was NOT written, so the two assertions contradict each other and the run that actually uses the tolerance fails
at the count (2000 against 2001) instead of passing at the tolerance meant to absorb it. Same trap PR #6223
fixed in the sibling Update class; the count now subtracts the conflicts. Both classes swept for the shape.

Item 2 - a silent, empty index. DatabaseAsyncExecutorImpl.isProcessing() answers about TASKS, while a worker
opens a transaction when it starts and keeps it open across up to ASYNC_TX_BATCH_SIZE (10240) of them. An
executor whose queues happen to be drained therefore reports itself idle while still holding every record of the
current batch uncommitted. TypeIndexBuilder.create() guarded with

  while (database.isAsyncProcessing()) database.async().waitCompletion();

so on the runs where that predicate answered false the guard was skipped entirely: the index was built by
scanning a bucket that did not contain those records, and they committed afterwards with no entry ever added for
them. The result is an index that is empty, readable, and reported healthy by CHECK DATABASE, while every lookup
answers nothing. Reproduced deterministically (index entries 0 of 200, "select from V where id = 42" empty).

The barrier is now unconditional - DatabaseInternal.waitForAsyncCompletion(), a do/while around waitCompletion(),
which is the only operation that closes the open batch - and is used by TypeIndexBuilder, ManualIndexBuilder and
REBUILD INDEX, which scans the buckets the same way. It reads the async field rather than async(), so a database
that never used the async API neither waits nor grows a thread pool. isProcessing() is deliberately left
answering about tasks: broadening it to "a transaction is open" would make it permanently true.

ACIDTransactionTest.indexCreationWhileAsyncMustFail was vacuous - create() has drained the async executor for
years, so its catch(NeedRetryException) never fired and its only assertion was the record count, which an empty
index satisfies just as well as a complete one. Renamed to indexCreatedWhileAsyncInsertsAreInFlightSurvivesACrash
and made to assert the index: countEntries() and a lookup for every record, after the crash and recovery.

Item 3 - per-database flush budget. arcadedb.pageFlushQueue was one JVM-wide ArrayBlockingQueue: #6259 took the
wait for room out of the page-manager lock, but one database's burst still consumed the admission budget of every
other database in the process. The bound is now per database, held in a single count per database that covers
both halves of an occupancy (reserved by a committer, then occupied by its batch until the flush thread polls
it), and the shared queue carries no capacity of its own. One queue rather than one per database keeps global
FIFO order for free - N queues would force the flush thread to choose between them on every poll, which is a
fairness policy and a starvation risk this design does not have. The cost, stated in the field Javadoc, is that
worst-case occupancy becomes pageFlushQueue x open databases batches.

Regression tests: Issue6281AsyncBatchIndexBuildTest (fails on the previous code with an empty index) and
Issue6281PerDatabaseFlushQueueTest.
@lvca lvca self-assigned this Aug 17, 2026
@codacy-production

codacy-production Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 14 complexity

Metric Results
Complexity 14

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@mergify

mergify Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

Went through the full diff (engine async/index barrier, per-database flush-queue budget, and the two test fixes). Overall this is a careful, well-documented fix with strong regression coverage. A few notes:

Correctness

  • PagesToFlush.database survives removeAllPagesOfDatabase's pages.clear() (PageManagerFlushThread.java:1385-1418), since database is captured as a separate final field at construction rather than derived from pages each time. That means releaseSlotOfPolledBatch still resolves the right (now-removed) map key when a cleared batch is later polled - good, this is exactly what makes the "no negative counter" invariant hold even for batches emptied out from under the queue. Worth calling out because it's easy to assume database would go stale along with pages; it doesn't, and that's why it's safe.
  • waitForAsyncCompletion() (LocalDatabase.java:445-462) reads async once without taking asyncLock, while isAsyncProcessing() (used inside the loop condition, and elsewhere) always takes it before touching the executor. Since async is only ever assigned once (never nulled back out) this looks safe in practice, but it's a small asymmetry with the neighboring method - might be worth a one-line comment on why the lock isn't needed here, so a future reader doesn't have to re-derive it.
  • PageManagerFlushThread(...) now clamps queueCapacity to Math.max(1, ...) where the old ArrayBlockingQueue(queueCapacity) would have thrown IllegalArgumentException on a <= 0 config value. This is a quiet behavior change (misconfiguration that used to fail fast at startup now silently becomes capacity 1) - probably fine, but intentional-looking enough that it might deserve a short comment or a mention in the PAGE_FLUSH_QUEUE javadoc.

Test coverage gap

  • Two white-box tests still bypass the new admission path and call flush.queue.offer(...) directly instead of the new offerBatch(...), unlike every other test file touched in this PR:

    • engine/src/test/java/com/arcadedb/engine/PageManagerFlushSuspendDeferRaceTest.java:95
    • engine/src/test/java/com/arcadedb/engine/FlushRobustnessTest.java:88

    I traced both through releaseSlotOfPolledBatch/slotsInUse and don't think either goes negative or fails an assertion today, because in both cases the fabricated batch is the only thing ever charged against that database's budget in that isolated PageManagerFlushThread instance, so the decrement-on-a-missing-key path (which no-ops) is what fires. But it does mean these two tests silently skip exercising the accounting invariant the offerBatch javadoc says every enqueue must go through ("Package-private rather than private because the white-box tests ... must go through here for the same reason"). Given the PR explicitly swept and updated the other five call sites, these two look like they were simply missed rather than deliberately left as-is - might be worth a follow-up pass.

Minor

  • Issue6281AsyncBatchIndexBuildTest.java's class javadoc has a broken sentence: "The guard that was supposed to ensure that polled database.isAsyncProcessing() and only drained the executor when it answered true." Reads like a clause was dropped mid-edit.
  • Couldn't run mvn -pl engine,server,ha-raft -am compile/verify in this environment (sandboxed, no approval for the Maven invocation), so compilation and the new/updated tests are unverified from my side - the PR description states 12111/783 tests green locally, but that's worth an explicit CI check before merge given the breadth of the PageManagerFlushThread rewrite.

What I liked

  • The root-cause explanation for item 2 (task-completion vs. batch-commit) is precise, and Issue6281AsyncBatchIndexBuildTest.anIndexCreatedOverAnIdleAsyncExecutorStillCoversItsUncommittedBatch reproduces the exact "idle but uncommitted" state rather than relying on timing luck.
  • Folding the reservation and the enqueued-batch's occupancy into one slotsInUse counter (rather than keeping queue.size() + reservations per database) removes a whole class of "two counters that must agree" bugs, and the negative-count assertions plus the dedicated Issue6281PerDatabaseFlushQueueTest back that up well.
  • Issue5279ConcurrentInsertTest's count fix (subtracting conflicts.get()) is a good catch - the old assertion pair really was self-contradictory.

…es, and the two silent contract changes

- PageManagerFlushSuspendDeferRaceTest and FlushRobustnessTest were missed by the sweep that routed every other
  white-box enqueue through offerBatch(). Neither could go negative today - the fabricated batch is the only thing
  ever charged against that database's budget in its own flush-thread instance, so the decrement lands on a missing
  key and no-ops - but both skipped the accounting invariant offerBatch()'s javadoc says every enqueue must exercise.
- waitForAsyncCompletion() reads the async field without asyncLock while isAsyncProcessing() takes it: say why. The
  lock serializes the lazy creation in async(); the field is volatile and never reassigned, not even on close, so the
  read sees either no executor or the one and only one - and a lock there would be held across a blocking wait.
- Math.max(1, pageFlushQueue) is a real contract change now that ArrayBlockingQueue's constructor no longer rejects a
  non-positive value. Documented as deliberate in both the constructor and the setting: with admission as the only
  bound, a budget of 0 refuses every publication for ever, which is worse than the startup failure it replaces.
- Fixed a sentence dropped mid-edit in Issue6281AsyncBatchIndexBuildTest's javadoc.
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

I read through the full diff (engine/server/ha-raft) and cross-checked the two fixes described as "the real find" against the surrounding mechanisms they depend on. Overall this is a very carefully engineered PR: the reasoning is documented in-line at the exact spots a future reader will doubt it, and the regression tests reproduce each bug on the pre-fix code path rather than just asserting the new behavior. I did not run the build myself (tool sandboxing here blocks mvn), so I'm relying on static reading plus the verification the description already reports (12111/783 tests green).

Item 1 - conflict-tolerance/count mismatch

Correct and minimal. Subtracting conflicts.get() from the expected count is the same fix already applied to the sibling Update test in #6223.

Item 2 - waitForAsyncCompletion() barrier

This is the one I dug into hardest, since "the guard barely ever fires but is silently wrong when it doesn't" is an easy claim to get subtly wrong.

  • I verified the actual commit mechanism the whole fix leans on: DatabaseAsyncCompletion.execute() (unmodified by this PR) unconditionally commits if (database.isTransactionActive()), independent of the count % commitEvery boundary in AsyncThread.executeTask(). So waitCompletion()'s marker really does close the open batch even when it doesn't land on a commitEvery boundary — the fix's central assumption holds.
  • LocalDatabase.waitForAsyncCompletion() reading the async field directly (not async()) and without asyncLock is justified correctly: the field is volatile and write-once, so the only two observable states are "no executor" and "the one executor," and the lock exists only to serialize the lazy-construction in async().
  • Confirmed DatabaseInternal.waitForAsyncCompletion() is implemented by all three current implementers (LocalDatabase, ServerDatabase, RaftReplicatedDatabase), so the interface addition doesn't dodge the delegation chain.
  • TypeIndexBuilder/ManualIndexBuilder already hold DatabaseInternal database, so no cast needed there; RebuildIndexStatement casts context.getDatabase(), consistent with the existing idiom in that file.

Minor coverage gap (not a bug): Issue6281AsyncBatchIndexBuildTest and the rewritten ACIDTransactionTest case exercise the TypeIndexBuilder path end-to-end (reproducing an empty index pre-fix). ManualIndexBuilder and RebuildIndexStatement get the identical one-line fix "by analogy" but neither has a dedicated regression test reproducing the bug through their call path specifically. Given how non-obvious this bug is (it doesn't reproduce reliably, per the PR description), a REBUILD INDEX version of Issue6281AsyncBatchIndexBuildTest would be worth having.

Also worth a look (very low severity): RebuildIndexStatement.executeDDL's statsOnly branch (recomputeStatistics, which "rescan[s] the live data") returns before the new waitForAsyncCompletion() call is reached. If BM25 stats are recomputed while an async batch is still open, the recompute could undercount those records too — same root cause as item 2, just against counters instead of an index, and self-healing on a rerun rather than permanently wrong. Might be worth the same barrier for consistency, but I wouldn't block on it.

Item 3 - per-database flush budget

Read PageManagerFlushThread end-to-end against the new slotsInUse: ConcurrentHashMap<BasicDatabase, AtomicInteger> design:

  • The "one continuous occupancy from reservation to poll" invariant is maintained correctly through every path I traced: scheduleFlushOfPages (both the pre-reserved and inline-reserve forms), the deferred-batch resume-on-unsuspend loop, and the shutdown sentinel (which correctly draws on no budget since PagesToFlush.database is null for it).
  • removeAllPagesOfDatabase dropping slotsInUse.remove(database) while batches of that database may still be sitting in the queue is safe: releaseSlotOfPolledBatch looks up by the batch's (stale) database reference, finds nothing, and no-ops — matches the in-line comment's claim exactly.
  • The white-box tests that inject batches directly (PageManagerFlushSuspendDeferRaceTest, FlushRobustnessTest, etc.) were all correctly swept to go through offerBatch(batch, false) so they charge the budget they later release — this was flagged as missed in round 1 and the round-2 commit fixes all of them; I didn't find any remaining direct queue.offer(...) call site outside that sweep.
  • Issue6281PerDatabaseFlushQueueTest is a good regression test — it specifically proves an idle database's committer is not blocked behind another database's exhausted, undrained budget, which is exactly the bug being fixed.

The one tradeoff worth flagging to reviewers/ops rather than to the code itself: worst-case flush-pipeline heap occupancy is now pageFlushQueue × open databases batches instead of a flat pageFlushQueue, since the shared queue no longer has its own capacity. The PR is explicit about this in the field Javadoc and config description, and points at flushSuspendMaxDeferredRAM as the byte-denominated knob — but it's a behavior change worth calling out in the PR description/release notes for anyone running many databases per JVM with a non-default pageFlushQueue, since their effective memory ceiling just changed shape.

Math.max(1, pageFlushQueue) replacing the old IllegalArgumentException on a non-positive value is also a real (and correctly documented) contract change — a pageFlushQueue=0 config that used to fail fast at startup now silently becomes 1 instead. Given it's called out explicitly in both the constructor and the config Javadoc, this seems like an acceptable, deliberate tradeoff rather than an oversight.

Nothing else stood out

No security concerns (no new external input surfaces), no untracked dependencies, and I didn't spot dead code or leftover call sites from the boolean → BasicDatabase signature changes across reserveQueueSlot/releaseQueueReservation/scheduleFlushOfPages (checked every call site in engine/server/ha-raft, main and test).

Nice work on the self-documentation here — the "why," not just the "what," is legible straight from the diff, which made this a much easier review than the line count would suggest.

…oo, and the rebuild claim was too strong

- The barrier now sits AHEAD of RebuildIndexStatement's statsOnly branch, which returns early: that branch
  rescans the same records to recompute the BM25 counters, so it undercounted them by the same window.
- Corrected the barrier's own comment on that path. It claimed a rebuild inside the window loses index entries,
  the way a CREATE INDEX does. It does not: those records staged their index operations when they were saved and
  applying them at commit repopulates what the scan could not see. A regression test written to catch a loss there
  passes with the call removed, which is why there is no such test - shipping one would have been the same vacuous
  coverage this PR removed from ACIDTransactionTest. What the window does cost is a rebuild computed over a partial
  view: the BM25 counters, the misplaced-record detection of #832, and the reported totals.
- Release notes for 26.9.1, including the behaviour change the review asked to be called out: worst-case
  flush-pipeline occupancy is now pageFlushQueue x open databases batches, so a deployment that sized
  pageFlushQueue against total heap should re-check it.
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

This is an unusually well-documented PR - the Javadoc/inline comments consistently explain the why (invariants, prior bugs, alternatives considered), which made this easy to verify. I traced all three items in detail; findings below.

Likely deadlock: waitForAsyncCompletion() called from inside an async executor worker thread (high priority)

LocalDatabase.waitForAsyncCompletion() calls executor.waitCompletion() unconditionally (do { executor.waitCompletion(); } while (isAsyncProcessing());). DatabaseAsyncExecutorImpl.waitCompletion(long) enqueues a completion marker on every worker's queue (including the calling thread's own, if the caller happens to be one of the executor's own AsyncThreads) and then blocks synchronously waiting for each marker's semaphore, in order.

If the calling thread is one of those workers, the marker it just placed on its own queue can never be dequeued - the only consumer of that queue is the thread itself, and it's now parked waiting on the semaphore instead of looping back to poll. That is a self-deadlock, permanently losing one worker.

This is reachable, not theoretical: database.async().command(...) (used by PostCommandHandler for HTTP requests with awaitResponse=false) runs the SQL command on one of the same DatabaseAsyncExecutorImpl worker threads. RebuildIndexStatement.buildIndex() already has an explicit guard for exactly this scenario (issue #2097 - "Index rebuild requires scheduling blocking tasks on all async threads, which will deadlock if we're already running on one of those threads" -> throws NeedRetryException when context.asyncMode is true), with its own regression test Issue2097AsyncRebuildIndexIT (async REBUILD INDEX * over HTTP).

The problem: this PR adds ((DatabaseInternal) database).waitForAsyncCompletion(); at the top of RebuildIndexStatement.executeDDL(), before that asyncMode guard is ever reached (the guard lives inside buildIndex(), called later, and doesn't cover the statsOnly branch at all). So a REBUILD INDEX dispatched via async HTTP now hits the new unconditional wait first and hangs the worker - the #2097 protection becomes dead code for this path.

Worth double-checking whether Issue2097AsyncRebuildIndexIT would actually catch this: it does database.async().waitCompletion(30000) from the test thread and doesn't check the boolean return value, then only asserts the index count is unchanged. Since the new wait hangs before buildIndex() ever touches the index (drop/rebuild happens later), the index would indeed be untouched - so the test would pass green while the worker thread is permanently stuck. That's the same "vacuous test hides a real bug" shape this very PR calls out for ACIDTransactionTest.indexCreationWhileAsyncMustFail.

Same hazard applies to TypeIndexBuilder.create() / ManualIndexBuilder.create(), neither of which has an asyncMode guard at all. Before this PR the old while (isAsyncProcessing()) waitCompletion(); only deadlocked when a task happened to be queued/executing at that instant (probabilistic, apparently never hit in practice). Making the wait unconditional turns that into a certainty whenever CREATE INDEX / a manual index create runs from inside an async worker's own task (e.g. CREATE INDEX ... dispatched the same way over async HTTP).

Suggest: have waitForAsyncCompletion() detect Thread.currentThread() being one of the executor's own workers (the codebase already has this pattern - see offerWaiting's Thread.currentThread() instanceof AsyncThread worker && worker.getOwner() == this) and either fail fast (NeedRetryException, consistent with the existing asyncMode guard) or handle it safely, rather than leaving each call site to reimplement the check inconsistently (currently only RebuildIndexStatement.buildIndex() has any guard, and it's now unreachable).

Item 3 - per-database flush queue budget

Traced every path that adds/removes a batch from queue against slotsInUse (offerBatch, scheduleFlushOfPages, releaseQueueReservation, releaseSlotOfPolledBatch, resumeFlushing's defer/re-enqueue, removeAllPagesOfDatabase, closeAndJoin's sentinel, and all the white-box test call sites routed through offerBatch(..., false)). The accounting is consistently balanced - every enqueue that takes a slot has a matching release, deferred batches release on dequeue and re-reserve on re-enqueue, and a dropped database's budget is removed without producing a negative count on the batches still draining from the queue (covered by aDroppedDatabaseLeavesNoBudgetBehind). Nice test coverage on the concurrency edge cases (aDatabaseAtItsBoundDoesNotHoldTheCommittersOfAnother, theBoundIsPerDatabaseAndTheSharedQueueHasNoneOfItsOwn).

One thing worth flagging prominently to operators (it is mentioned in the config Javadoc and release notes, so this is really just emphasis): arcadedb.pageFlushQueue changes from a JVM-wide cap to a per-database cap with the queue now unbounded (LinkedBlockingQueue). A process hosting many databases that all burst at once has a materially higher worst-case heap footprint than before (pageFlushQueue x open databases batches, each holding deep copies of dirty pages). Given this is a behavior change for anyone who tuned pageFlushQueue against total heap, it might be worth a WARNING-level log line at startup when running many databases with a non-default value, in addition to the docs.

Item 1 - conflict-tolerant assertion fix

Correct and minimal. Confirmed conflicts (an AtomicInteger) is only mutated by the worker threads, and all of them are joined before it's read in the final assertions, so subtracting conflicts.get() from the expected count is safe and matches the sibling Issue5279ConcurrentUpdateTest pattern referenced in the description.

Minor / nit

LocalDatabase.waitForAsyncCompletion()'s do/while calls the void waitCompletion() overload, which internally swallows InterruptedException by restoring the interrupt flag and returning. If interrupted mid-wait, the loop doesn't check Thread.currentThread().isInterrupted() before looping again - if isAsyncProcessing() is still true, the next waitCompletion() call will immediately hit the same interrupted queue-offer and return again, potentially busy-spinning until the batch drains on its own. Same shape as the pre-existing while (isAsyncProcessing()) waitCompletion(); pattern this replaces, so not a new regression, but now that this is a documented, shared API used from four call sites, might be worth breaking out on interrupt.

Overall

Items 1 and 3 look solid and well-tested. Item 2's core fix (the barrier itself, TypeIndexBuilder/ManualIndexBuilder) addresses a real and well-reproduced bug - but the async-worker-thread deadlock risk above seems worth resolving or explicitly ruling out before merge, given it revives a scenario the codebase already had a dedicated regression test for.

…side the executor it waits for

A real regression this PR introduced, correctly caught in review.

waitCompletion() enqueues a marker on EVERY worker - the caller's own included - and blocks until each has run,
and the only consumer of a worker's queue is that worker. A worker that reaches the barrier parks on a marker
nobody can dequeue and is lost for the life of the process. RebuildIndexStatement.buildIndex() has refused
exactly this since issue #2097, but the barrier this PR added at the top of executeDDL() ran ahead of that
guard, and never reached it at all on the statsOnly branch: #2097's protection became dead code for the path it
was written for. Measured, with the guard removed: the surefire fork does not merely fail, it never finishes -
killed after 400s - because the lost worker takes the database's close with it.

- waitForAsyncCompletion() now refuses with NeedRetryException when the caller is one of this executor's own
  workers, using the same owner-checked `instanceof AsyncThread` test offerWaiting already uses. Refusing is the
  only honest answer: skipping the wait would put back the very bug the barrier closes, over the caller's own
  uncommitted batch, and committing that batch here would commit the enclosing task's writes mid-task, which is
  the per-task atomicity AsyncThread.executeTask guards. The guard now lives once, on the operation that cannot
  be satisfied, rather than once per call site that happens to remember it - TypeIndexBuilder and
  ManualIndexBuilder had no such guard at all.
- #2097's own refusal is hoisted to the top of executeDDL(), ahead of the barrier, so it still answers first with
  the message it was written for and its integration test still asserts a refusal from where it expects one.
  Issue2097AsyncRebuildIndexIT: 3 tests green.
- waitForAsyncCompletion()'s loop breaks on interrupt. waitCompletion() answers an interrupt by restoring the
  flag and returning, so the loop would otherwise spin: every further pass interrupted at its first queue offer,
  returning immediately. Pre-existing in the pattern this replaced, but worth closing now that it is shared API.
- Issue6281AsyncBatchIndexBuildTest gains theBarrierRefusesToBeCalledFromOneOfTheExecutorsOwnWorkers.

Not implemented, and why: a startup WARNING when many databases run with a non-default pageFlushQueue. The
database count is not known where the flush thread is built (one JVM-wide thread, constructed once), and the
throttle WARNING already names the database and reports the shared pipeline depth at the moment the budget
actually bites - which is the point at which an operator can act on it. The tuning change is in the config
javadoc and the release notes.

engine: 12112 tests, 0 failures.
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

This is an unusually well-documented PR (four review rounds are visible in the commit history, and it shows). I read through all three items in detail: the Issue5279ConcurrentInsertTest count fix, the waitForAsyncCompletion() barrier (DatabaseInternal/LocalDatabase/DatabaseAsyncExecutorImpl/TypeIndexBuilder/ManualIndexBuilder/RebuildIndexStatement), and the per-database flush budget (PageManagerFlushThread/PageManager/GlobalConfiguration).

Correctness

  • Item 1 (conflict-tolerant count): subtracting conflicts.get() from the expected total is the right fix and mirrors the sibling Issue5279ConcurrentUpdateTest pattern from fix(#6199, #6200): the flush drains wake on the page, and one suspended database's backlog is its own #6223.
  • Item 2 (async batch barrier): I traced the whole call graph - waitForAsyncCompletion() reading the async field directly (not async(), so it never creates an executor on a database that never used one), the own-worker refusal via isCurrentThreadOneOfMyWorkers()/AsyncThread.getOwner(), the do/while that re-checks isAsyncProcessing() to cover tasks submitted by other threads while waiting, and the interrupt handling. All of it checks out, and the new theBarrierRefusesToBeCalledFromOneOfTheExecutorsOwnWorkers test is a good catch of what would otherwise be a real hang (the PR's own commit log shows this was found in review, which is reassuring - it means the hazard was actually exercised, not just reasoned about).
  • The RebuildIndexStatement hoisting of the [SQL] REBUILD INDEX deletes indexes when used via async HTTP-API #2097 refusal ahead of the new barrier is correct and necessary: the statsOnly branch returns before ever reaching the original buildIndex() check, so without the hoist that path would have lost the [SQL] REBUILD INDEX deletes indexes when used via async HTTP-API #2097 protection entirely.
  • Item 3 (per-database flush budget): slotsInUse (ConcurrentHashMap<BasicDatabase, AtomicInteger>) charged once at offerBatch and released once at poll is a clean way to make a reservation and its batch one continuous occupancy. I checked every call site that derives database from pages.getFirst().pageId.getDatabase() (PageManager.reserveFlushQueueSlot/releaseFlushQueueSlot/writePagesNoBackpressure) and the empty-list guards line up with where flushSlotReserved can actually be true, so there's no NoSuchElementException risk from getFirst() on an empty list. The shutdown sentinel (SHUTDOWN_THREAD, database == null) is handled consistently on both the offer and release sides.

One real (minor) issue

PageManagerFlushThread.detachPendingPages() (around line 1506-1509, not touched by this diff) still says:

// Iterated directly rather than through a snapshot: ArrayBlockingQueue's iterator is weakly consistent and
// never throws ConcurrentModificationException, and this runs per replayed page, so the copy would be pure
// overhead. The walk is bounded by the flush queue depth (arcadedb.pageFlushQueue) plus the deferred backlog,

This is now stale on two counts: queue is a LinkedBlockingQueue since this PR (not ArrayBlockingQueue), and its depth is no longer bounded by arcadedb.pageFlushQueue alone - by the PR's own new javadoc a few hundred lines up, worst-case occupancy is pageFlushQueue x open databases. Given how carefully every other comment in this PR was kept in sync with the behavior change, this one slipped through the sweep. Worth a one-line fix while it's fresh.

Test coverage

Strong. Issue6281AsyncBatchIndexBuildTest reproduces the empty-index bug deterministically (idle-executor-but-uncommitted-batch), covers the busy-executor path that always worked, and covers the own-worker refusal with a @Timeout used correctly as a hang detector rather than a latency bound. Issue6281PerDatabaseFlushQueueTest covers the isolation property (item 3's whole point), the per-database multiplication of occupancy, and budget cleanup on database drop. The rewritten ACIDTransactionTest.indexCreatedWhileAsyncInsertsAreInFlightSurvivesACrash is a good example of turning a vacuous assertion (record count, which an empty index also satisfies) into one that actually pins the bug (countEntries() + per-record lookup).

Performance

The queue-unbounding trade-off (JVM-wide ArrayBlockingQueue -> unbounded LinkedBlockingQueue + per-database admission) is explicitly documented, including the worst-case occupancy multiplier and the deliberate choice of one shared queue over N per-database queues to avoid a fairness/starvation problem on the poll side. That reasoning is sound and appropriately conservative (the byte-denominated backstop, flushSuspendMaxDeferredRAM, is called out as the thing to reach for if the batch-count multiplier becomes a real concern).

Security

Nothing notable - no new external inputs, no new dependencies, no serialization changes.

Nice work overall; the only thing I'd actually ask for before merge is the stale comment fix.

…bed the old queue

The only point raised, and correct: the walk in detachPendingPages() named ArrayBlockingQueue's iterator and
claimed the walk is bounded by arcadedb.pageFlushQueue. Both went stale with this PR - the queue is a
LinkedBlockingQueue and its depth is that setting times the number of open databases. The weak-consistency
argument for iterating without a snapshot still holds (LinkedBlockingQueue's iterator is weakly consistent
too), so only the bound and the class name needed correcting.

Swept the rest of the file: every other ArrayBlockingQueue mention is deliberately historical - the field
javadoc explaining what the queue used to be, the slotsInUse javadoc naming the property given up, and the
constructor explaining why the capacity clamp replaced its IllegalArgumentException.
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

This is a large, well-documented change addressing three independent problems from #6281. Overall the reasoning is sound, the fixes are backed by regression tests that fail on the old code, and the javadoc/comments do a good job of explaining why, not just what. A few notes below, none of which I'd consider blockers.

Item 2 (async batch barrier) — solid

  • DatabaseInternal.waitForAsyncCompletion() correctly distinguishes "no tasks queued" from "batch still open," which is the actual bug. Reading the async field directly (not via async()) to avoid lazily creating an executor on a database that never used one is a nice touch, and the comment explaining why no lock is needed for that read (volatile, write-once) is convincing.
  • The own-worker-thread refusal (isCurrentThreadOneOfMyWorkers) reuses the exact AsyncThread/getOwner() pattern already used by offerWaiting, so it's consistent with the existing codebase rather than a new one-off idiom.
  • Verified the wiring: TypeIndexBuilder/ManualIndexBuilder/RebuildIndexStatement all call through DatabaseInternal-typed fields, so the interface addition compiles against all three use sites, and both RaftReplicatedDatabase and ServerDatabase proxy it correctly.

Item 3 (per-database flush budget) — solid, one thing worth double-checking

  • The slotsInUse accounting (reserve → offer without re-incrementing when slotHeld → release on poll) is internally consistent; I traced all the call sites (scheduleFlushOfPages, offerBatch, resumeFlushing's re-enqueue loop, closeAndJoin's sentinel) and the +1/-1 pairs balance in every path, including the white-box tests that now go through offerBatch(batch, false) instead of touching queue.offer directly.
  • removeAllPagesOfDatabase removing the slotsInUse entry while batches for that (now-emptied) database may still be sitting in the queue is fine as implemented — releaseSlotOfPolledBatch no-ops when the map entry is gone — but it does mean that if the same BasicDatabase instance were ever reused for new commits after this cleanup (I don't think it is, in practice — this runs on close/drop), computeIfAbsent would silently start a fresh budget rather than reflecting the batches still physically in the queue. Given the queue is now unbounded and capacity is purely an admission throttle (not a memory bound), this is at most a transient throughput quirk, not a correctness issue. Worth a one-line confirmation that no live-database path re-enters slotsInUse after removeAllPagesOfDatabase, but I couldn't find one.
  • The switch from ArrayBlockingQueue to unbounded LinkedBlockingQueue is a meaningful behavior change (worst case is now pageFlushQueue × open databases batches of real heap) — good that this is called out explicitly in both the field javadoc and the release notes, since it's the kind of thing that bites someone who sized pageFlushQueue against total heap.

Item 1 (RebuildIndexStatement's #2097 guard) — minor nit

  • executeDDL() now throws NeedRetryException for the async-worker-thread case ahead of buildIndex()'s pre-existing identical check (RebuildIndexStatement.java ~line 330). Since buildIndex() has exactly one call site (line 227), reached only after the new check already would have thrown, that older check is now dead code for this path. Not a bug, but:
    • the two error messages differ slightly — the new one (thrown before idx is resolved) says "Cannot rebuild index while running in asynchronous context...", while the old one says "Cannot rebuild index '<name>' while running in asynchronous context...". Since the new check always fires first, callers now silently lose the index name from the error message compared to before. Might be worth carrying the index name up, or just removing the now-unreachable duplicate in buildIndex() with a comment pointing at the hoisted check, so there's a single source of truth for the message.

Test coverage

  • Issue6281AsyncBatchIndexBuildTest and Issue6281PerDatabaseFlushQueueTest both look well constructed — they reproduce the original failure mode deterministically (no sleep-and-hope timing), and the "hang detector, not a latency bound" framing on the @Timeout(60) test matches the project's stated policy on wall-clock assertions.
  • ACIDTransactionTest's renamed test now actually asserts index correctness (countEntries() + per-record lookups) instead of just the record count, closing the exact gap the PR describes.
  • The Issue5279ConcurrentInsertTest fix mirrors fix(#6199, #6200): the flush drains wake on the page, and one suspended database's backlog is its own #6223's fix to the sibling Update test, and the reasoning (a tolerated conflict means the record wasn't written, so the count must subtract it) is correct.

Nothing else stood out

Didn't find any thread-safety, security, or performance issues beyond what's noted above. The queue-doorway invariant ("every enqueue goes through offerBatch") is a good design choice for auditability and I confirmed no other code path writes to PageManagerFlushThread.queue directly.

lvca added 2 commits August 16, 2026 23:43
…nd why dropping a database's budget is safe

Merge of origin/main: the only conflict was docs/release-26.9.1.md, where both sides appended a section at the
end of the file. Both kept, #6196's first since it landed first.

Review round 5, no blockers raised:

- #2097's refusal is now MOVED rather than duplicated. Hoisting it to executeDDL() left the copy in buildIndex()
  unreachable - that method has one call site, below the hoisted check - and the two wordings had already drifted:
  the hoisted one fired before the index was resolved and so dropped the index name from the message. The name is
  carried up instead (and `REBUILD INDEX *`, which names no single index, says so), and buildIndex() keeps a
  comment pointing at where the check went and why it could not have stayed - the statsOnly branch returns without
  ever reaching it.
- Documented, in removeAllPagesOfDatabase, the one-line confirmation the review asked for: nothing re-enters
  slotsInUse for a database after its budget is dropped. Every caller reaches it from LocalDatabase.close() - the
  drop path and the final purge alike - or from the test-only kill simulation, and close() has already set
  open=false, which is what the publication path and flushPage check. A live database never passes through, so a
  later computeIfAbsent cannot mint a budget that disagrees with batches still physically in the queue.

Issue2097AsyncRebuildIndexIT: 3 green. Rebuild/index engine tests: 74 green.
Only conflict was docs/release-26.9.1.md again, where both sides append sections at the end of the file: all of
them kept, in the order they landed (#6267, #6264, #6196, then #6281). GlobalConfiguration.java auto-merged -
main touched a neighbouring setting, this branch rewrote PAGE_FLUSH_QUEUE's description.

Full reactor builds; the flush-pipeline, async-barrier and configuration tests are green on the merge result.
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

This is a well-scoped, well-documented fix for a genuinely nasty correctness bug (item 2: a CREATE INDEX that silently builds an empty index because isAsyncProcessing() answers about queued tasks while a worker can be sitting on a whole uncommitted batch). The reproduction, the regression tests (Issue6281AsyncBatchIndexBuildTest, Issue6281PerDatabaseFlushQueueTest), and the javadoc trail explaining why each decision was made are excellent - future maintainers will thank you for the amount of "why not X" reasoning left in the comments. The five rounds of self-review baked into the commit history (the worker-deadlock refusal, the statsOnly branch ordering, the stale detachPendingPages comment) already closed the sharpest edges I'd normally flag, so most of what follows is smaller.

Correctness / concurrency

I traced the full path: PagesToFlush.database derivation, offerBatch's slotHeld charging, reserveQueueSlot/releaseQueueReservation/releaseSlotOfPolledBatch bookkeeping, the waitForAsyncCompletion() barrier and its isCurrentThreadOneOfMyWorkers() refusal, and the hoisted #2097 check in RebuildIndexStatement.executeDDL(). It all holds together - the accounting is symmetric (every enqueue route now goes through offerBatch, every poll through one release), the negative-count assertions are the right defense, and the worker-thread deadlock the PR itself introduced-then-caught (round 3) is correctly closed with a refusal rather than a silent skip.

One thing worth a second look, not a blocker: PageManager.getStats().pageFlushQueueLength (flushThread.queue.size()) silently changed scale. Before this PR the shared queue was capacity-bound to arcadedb.pageFlushQueue, so this operator-facing stat (exposed via Profiler's JSON, presumably surfaced in Studio/monitoring) topped out at that configured value - "queue length == capacity" meant "the pipeline is full." Now the queue is unbounded and the bound lives per-database in slotsInUse, so queue.size() reports the sum across every open database and can run to pageFlushQueue x open databases with room to spare. Anyone alerting on pageFlushQueueLength >= pageFlushQueue (a natural threshold under the old semantics) now gets a metric that never means what it used to, with no code comment or release-note line calling it out (the release notes cover the pipeline occupancy change qualitatively but not this specific published field). Worth either a one-line doc/comment update at PageManager.java:1356, or - if it's easy given slotsUsedBy(database) already exists - exposing a per-database breakdown the way getDeferredRAMBytesOf(database) does for the RAM cap.

Everything else

Nothing here blocks merging as far as I can tell from static review; the pageFlushQueueLength point is the only thing I'd want a maintainer opinion on before closing.

lvca added 2 commits August 16, 2026 23:54
Same conflict shape as the previous two merges: docs/release-26.9.1.md, where both sides append a section at
the end of the file. All kept, in landing order. Full reactor builds and the flush-pipeline, async-barrier and
configuration tests are green on the merge result.
…ublish the number that still means something

The one point raised, and a fair one. pageFlushQueueLength used to top out at arcadedb.pageFlushQueue, because
that setting WAS the queue's capacity - so "length >= pageFlushQueue" was a natural full-pipeline alert. With the
bound moved per database the field is a sum across every open database and can run to pageFlushQueue x open
databases, which makes that comparison mean nothing. A published field quietly changing scale is worse than one
that changes name.

- pageFlushQueueMaxPerDatabase joins it: the busiest single database's share of the pipeline, which is exactly
  what the setting bounds, so it is the field to alert on and the one that carries the old signal. Surfaced in
  the profiler JSON under that name and in the text dump as flushQueueMaxPerDb, next to flushQueue.
- Both fields document what they are, what they were, and which of them to compare against the setting.
- Release notes call the change out for anyone with an existing alert on the old field.

O(open databases) and read once per stats scrape - never on a write path.
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

I read through the full diff (engine flush pipeline, async executor barrier, index build/rebuild call sites, and the new/updated tests). Overall this is a very well-engineered fix with unusually thorough self-documentation — the commit history shows five review rounds that already caught and fixed several real issues (the statsOnly branch missing the barrier, the own-worker deadlock, the stale detachPendingPages comment, the white-box tests bypassing offerBatch). I verified the current state rather than re-litigating those.

Correctness

  • waitForAsyncCompletion() barrier (LocalDatabase.java): reading async without asyncLock is justified correctly — the field is volatile and, per a check of LocalDatabase.close(), is genuinely never reassigned once set, so the documented "only two possible values" claim holds.
  • Own-worker deadlock refusal: isCurrentThreadOneOfMyWorkers() mirrors the existing offerWaiting owner check, and I traced the interaction with RebuildIndexStatement's pre-existing asyncMode threadlocal check (issue [SQL] REBUILD INDEX deletes indexes when used via async HTTP-API #2097) — they guard different call sites (one is DDL-specific and fires first for that statement, the other is the barrier's own general protection for TypeIndexBuilder/ManualIndexBuilder, which had no such guard before). Not duplicated logic, just two mechanisms that happen to overlap on one call path, and the comments explain why.
  • Per-database slotsInUse accounting: offerBatch is the single door that charges a slot, and I checked every production call site — all three pass slotHeld=true (already reserved); the slotHeld=false bypass is exclusively used by white-box tests that inject batches directly. No production path can under-charge the map.
  • Format string in the throttle warning log (PageManagerFlushThread.reserveQueueSlot): 6 placeholders against 6 args, order checked and correct.
  • resumeFlushing's new !running check: even though break skips setting enqueued = true, the finally block still runs and releases the reservation correctly — no leak on that path.
  • No unbounded-queue fallout found: I grepped for lingering queue.remainingCapacity()/ArrayBlockingQueue production usages after the switch to LinkedBlockingQueue and all remaining test usages are safe operations (isEmpty, contains).

Test coverage

  • Strong: Issue6281AsyncBatchIndexBuildTest reproduces the original silent-empty-index bug deterministically, and Issue6281PerDatabaseFlushQueueTest isolates the cross-database starvation issue with a detached, never-started flush thread standing in for a wedged disk.
  • Two small gaps, both minor:
    1. Math.max(1, ...) clamp for arcadedb.pageFlushQueue <= 0 (PageManagerFlushThread constructor) has no direct test — only documented in comments/javadoc.
    2. The claim that REBUILD INDEX ... statsOnly now computes BM25 counters over the complete data (not just what happened to be committed) isn't asserted by a test — the PR body explains why a "loses entries" regression test would be vacuous here, which is fair, but a test showing the counters differ with/without the barrier would make the improvement itself verifiable rather than just reasoned about.

Minor documentation nit

In GlobalConfiguration.PAGE_FLUSH_QUEUE's new javadoc: "Was a single JVM-wide bound until issue #6281, which made one database's write burst against a slow volume throttle the commits of unrelated databases on idle ones." The antecedent of "which" is ambiguous — grammatically it reads as if issue #6281 caused the throttling bug, when the intent (confirmed by the surrounding PR description) is that the JVM-wide bound caused it and #6281 fixed it. Worth a tighten-up, purely cosmetic.

Performance

  • The documented worst-case pipeline occupancy increase (pageFlushQueue × open databases vs. flat pageFlushQueue) is a real, called-out behavior change for multi-database JVM deployments. It's properly surfaced in the config javadoc and release notes, which is the right way to ship it.
  • The single shared queueSlotLock monitor (rather than per-database) trades a few spurious wakeups for avoiding a map lookup on the hot poll path — reasonable given the herd is bounded by construction, as noted in the comment.

Security

Nothing of concern — no new dependencies, no external input handling changed.

Nit-free areas worth calling out positively

  • The PagesToFlush.database derivation and the isSingleDatabase assertion give the per-database accounting a real backstop against mixed batches.
  • releaseQueueReservation/releaseSlotOfPolledBatch both assert against going negative rather than clamping, consistent with this codebase's stated preference for -ea-visible bugs over silently-hidden ones.

Nice work — this is a genuinely subtle bug (empty-but-healthy index) caught and fixed with real reproduction, and the flush-queue change is a sensible design (budget-over-one-queue vs. N queues) with the tradeoffs made explicit rather than hidden.

@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

Went through the full diff (GlobalConfiguration, DatabaseInternal/LocalDatabase, DatabaseAsyncExecutorImpl, PageManager, PageManagerFlushThread, RebuildIndexStatement, TypeIndexBuilder, ManualIndexBuilder, the wrapper delegates in ServerDatabase/RaftReplicatedDatabase, and the tests). This is an unusually thorough PR - the commit history already shows six self-review rounds, including one where the author caught and fixed a real regression they'd introduced (the barrier deadlocking when called from one of the async executor's own worker threads). Summary of what I checked and what I think is worth a second look.

Item 2 - waitForAsyncCompletion() barrier

The core fix is sound. isAsyncProcessing() reporting on tasks rather than the open batch transaction is a real, well-diagnosed bug, and the repro described (200 async inserts, 0 index entries, select ... where id = 42 empty) is convincing. A few things I verified explicitly:

  • LocalDatabase.waitForAsyncCompletion() reads the async field directly (not async()) so a database that never touched the async API doesn't pay for a thread pool it doesn't need - confirmed by grepping the call sites in TypeIndexBuilder/ManualIndexBuilder/RebuildIndexStatement, all of which run this before any lock is taken, so the no-op path really is free.
  • The own-worker refusal (isCurrentThreadOneOfMyWorkers()) reuses the same AsyncThread-ownership test as offerWaiting, and is now the single place this guard lives instead of being duplicated per call site - good, since TypeIndexBuilder/ManualIndexBuilder had no such guard at all before.
  • RebuildIndexStatement.executeDDL(): the [SQL] REBUILD INDEX deletes indexes when used via async HTTP-API #2097 async-context refusal is correctly hoisted ahead of the new barrier and ahead of the statsOnly early return, so REBUILD INDEX ... statsOnly=true gets the barrier too (this was the round-2 fix, and it's right - statsOnly also scans live data).
  • ACIDTransactionTest.indexCreatedWhileAsyncInsertsAreInFlightSurvivesACrash and the new Issue6281AsyncBatchIndexBuildTest are good regression coverage - the latter specifically reproduces "queues drained, batch still open" rather than just "executor busy," which is the actual bug shape, plus a dedicated test for the own-worker-refusal path with a @Timeout as a hang detector rather than a latency assertion (correctly following the StallAwareStopwatch guidance in CLAUDE.md by not asserting wall-clock).

One thing I'd flag for awareness rather than as a blocker: TypeIndexBuilder.create()/ManualIndexBuilder.create() will now throw NeedRetryException for a CREATE INDEX issued from one of the async executor's own worker threads, which previously could silently proceed (with the old isAsyncProcessing() guard, whether it hung or raced depended on timing). If there's any existing user code that does schema changes from inside an async task, this is a visible behavior change even though it's the correct fix. Might be worth a one-line mention in the release notes alongside the flush-queue behavior change, since that section already sets the precedent of calling out behavior changes explicitly.

Item 3 - per-database flush budget

The slotsInUse: ConcurrentHashMap<BasicDatabase, AtomicInteger> design and the "one queue, budget not queue-per-database" tradeoff are well-reasoned and well-documented in the code itself. Things I specifically checked:

  • offerBatch is the single door onto the queue, and the sweep to route the white-box tests (FlushRobustnessTest, Issue6200PerDatabaseDeferredBacklogTest, the PageManagerFlushSuspend* tests) through it instead of queue.offer() directly looks complete - I didn't find any remaining direct queue.offer(...) call in the test tree.
  • removeAllPagesOfDatabase dropping slotsInUse.remove(database) while batches of that database may still be physically queued: releaseSlotOfPolledBatch correctly no-ops on a missing map entry, and this exact scenario has a dedicated test (aDroppedDatabaseLeavesNoBudgetBehind) that also re-opens the budget afterward. Good.
  • The Math.max(1, ...) clamp on PAGE_FLUSH_QUEUE is consistent between the constructor, the config javadoc, and the release notes.

Two non-blocking observations:

  1. queueSlotLock is one shared monitor for every database's waiters, not one per database - the code openly documents this as a deliberate tradeoff (map-lookup cost on the poll path vs. spurious wakeups on the wait path). Worth calling out explicitly since it's a real scaling axis: with many databases simultaneously near their bound, every poll now wakes every waiter across every database, each of which re-checks its own count and re-parks. The javadoc argues this is "bounded by construction" the same way as deferredRAMLock, which is reasonable for the common case, but it's a different failure mode from the old single-queue design and might be worth a line in the release notes' "worth checking" callout, next to the pageFlushQueue x open databases occupancy note that's already there.
  2. Worst-case pipeline occupancy is now pageFlushQueue x open databases - this is already disclosed prominently in the config javadoc, the field javadoc, and the release notes, which is exactly the right way to handle a real capacity-planning change. No action needed, just confirming it's not an oversight.

Minor/cosmetic

  • docs/release-26.9.1.md: the diff introduces a couple of duplicate blank lines right before two unrelated ## headers (artifacts of the repeated merges called out in the commit history). Harmless, but a quick pass would clean it up.

Test coverage

Strong. Issue6281AsyncBatchIndexBuildTest and Issue6281PerDatabaseFlushQueueTest both target the actual failure mode rather than a proxy for it, the existing flush-queue test suite was mechanically and correctly updated for the new slotsUsedBy/reserveQueueSlot(database) API, and Issue5279ConcurrentInsertTest's fix mirrors the same subtract-the-conflicts pattern already applied to its sibling Update test in #6223, so the two classes are consistent again.

Didn't run the build myself (a full reactor build is more than this review needed), but the PR body's reported numbers (engine 12111-12112 tests, server 783 tests, 0 failures) match the shape of a PR that's been through this many self-review rounds.

Overall: I don't see any correctness blockers. The two non-blocking notes above (the async-context behavior change for CREATE INDEX/ManualIndexBuilder from a worker thread, and the shared-monitor thundering-herd tradeoff under many concurrently-saturated databases) are things I'd want a maintainer's eyes on before merge, but neither looks like it needs code changes - just possibly a documentation nod for the first one.

lvca added 2 commits August 17, 2026 00:18
… all, and it was worse than stated

Three points raised, no blockers. The interesting one was the untested statsOnly claim, and checking it changed
what the claim should say.

- REBUILD INDEX ... WITH statsOnly = true recomputes the BM25 corpus counters by scanning the type and then
  OVERWRITING the counters with what the scan found. Run against an open async batch it finds nothing committed
  and writes "0 documents" over counters the records had already bumped when they were saved. Measured: 0 of 200
  documents counted with the barrier removed, 200 with it. So this is not "computed over a partial view" as the
  previous round's comment hedged - the counters are left wrong, every BM25 score is computed against a corpus of
  zero, and unlike the index-entry case it does not heal itself. Now has a regression test, and the comment and
  release note say what was measured instead of what was reasoned.
- The Math.max(1, pageFlushQueue) clamp has a test: a budget of 0 or -1 becomes 1 and admits exactly one batch.
  It used to be ArrayBlockingQueue's constructor that rejected a non-positive value, and there is no constructor
  left to reject it, so the clamp is now the only thing between a misconfiguration and a pipeline that refuses
  every publication for ever.
- PAGE_FLUSH_QUEUE's javadoc said "...until issue #6281, which made one database's write burst throttle the
  commits of unrelated databases", where "which" reads as if the issue caused the bug rather than fixed it.
  Reworded.

engine: 12204 tests, 0 failures.
…itor trade in the release notes

Three points, all documentation, no blockers raised.

- The release notes now say that CREATE INDEX, a manual index create and REBUILD INDEX raise NeedRetryException
  when run on one of the async executor's own worker threads (awaitResponse=false over HTTP, say). One
  correction to the review's framing: this is not a path that "could silently proceed" before. From a worker,
  isAsyncProcessing() is true by construction - that worker is executing a task - so the old guard always
  entered its loop and always parked on a marker only that same worker could dequeue. The change is a hang
  becoming a clear refusal, which is worth saying plainly either way.
- Named the shared queueSlotLock trade in the same section: with many databases saturating their budgets at
  once, every poll wakes every waiter and each re-checks its own count. Deliberate, and the same shape as the
  deferred-RAM cap, but a different failure mode from the old single-queue design, so it should not have to be
  discovered.
- Collapsed the double blank lines the repeated merges left before two unrelated headers.
@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

This is a well-documented, well-tested PR that fixes a genuinely serious bug (item 2: silent empty indexes from a mis-scoped async guard). The comment density is unusually high but earns its keep here - the reasoning behind each non-obvious choice (barrier placement, unbounded queue + per-database admission instead of per-database queues, NeedRetryException on self-wait, clamping PAGE_FLUSH_QUEUE to 1) is spelled out, and every claim I checked against the code held up.

Item 2 (async batch barrier) - solid

  • waitForAsyncCompletion() correctly reads the raw async field (not async()) to avoid creating an executor on a database that never used one, and correctly refuses (NeedRetryException) rather than deadlocking when called from one of the executor's own worker threads.
  • Hoisting the #2097 refusal from RebuildIndexStatement.buildIndex() up into executeDDL() is correct: it now also covers the statsOnly branch, which previously had no such check at all.
  • ACIDTransactionTest.indexCreationWhileAsyncMustFail was indeed dead (the catch could never fire) - good catch, and turning it into an assertion of the index contents rather than just the record count is the right fix.
  • Test coverage for this item is thorough: idle-but-uncommitted, genuinely-busy, self-wait-refusal, and the statsOnly corpus-counter corruption case all have dedicated tests.

Item 3 (per-database flush budget) - one edge case worth a second look

PageManagerFlushThread.slotsInUse is a ConcurrentHashMap<BasicDatabase, AtomicInteger>. LocalDatabase.equals()/hashCode() are overridden to compare by databasePath, not instance identity (LocalDatabase.java ~2114-2128). Two different LocalDatabase instances opened at the same path are therefore the same map key.

removeAllPagesOfDatabase() (PageManagerFlushThread.java ~1402-1462) clears a closing database's queued batches' page lists and removes its slotsInUse entry, but the now-empty PagesToFlush wrapper objects can still be sitting in queue at that point - the comment at line ~1435 acknowledges this explicitly ("Batches of this database may still be in the queue - emptied above, but still there"). When the flush thread later polls one of those stale wrappers, releaseSlotOfPolledBatch looks up slotsInUse.get(batch.database) using the old, closed instance, which - via path-based equals/hashCode - resolves to whatever entry is currently keyed at that path.

If a new LocalDatabase opens at the same path (e.g. drop() immediately followed by create() at the same location - not unusual in tests, and plausible in restore/re-provision flows) before that stale wrapper is polled, the poll decrements the new instance's budget for a batch that was never charged against it. Best case this trips the assert remaining >= 0 in test lanes; worst case (assertions off in production) it silently lets the new database's admission count drift under its true occupancy, weakening the bound this PR adds.

This "map keyed by Database but equals-by-path" pattern already exists for deferredRAMByDatabase, suspended, flushedPagesPerDatabase etc. in the same class, so it isn't a pattern invented by this PR - but this looks like the first place a stale cross-instance hit produces a budget miscount rather than a RAM-accounting no-op. Given the PR already went through several review rounds on this map's lifecycle ("review of #6281, round 5"), it's possible this was considered and judged an acceptable, narrow-window risk shared with the pre-existing maps - worth confirming rather than assuming it's new. Issue6281PerDatabaseFlushQueueTest.aDroppedDatabaseLeavesNoBudgetBehind reuses the same instance throughout, so it doesn't exercise the cross-instance-same-path timing either way.

Everything else checked out

  • DatabaseInternal.waitForAsyncCompletion() is correctly wired through both RaftReplicatedDatabase and ServerDatabase proxies.
  • PageManager/PageManagerFlushThread call sites (publishPages, writePagesNoBackpressure, reserveFlushQueueSlot, releaseFlushQueueSlot, resumeFlushing, closeAndJoin) were all migrated consistently to the per-database (BasicDatabase) reservation API - no stale queueReservations/ArrayBlockingQueue-shaped call left in main or test code.
  • PAGE_FLUSH_QUEUE clamped to Math.max(1, ...) is correct and matches the new unbounded-queue-plus-admission-only design; the old ArrayBlockingQueue constructor would have thrown on 0/negative, so this is a real, well-documented behavior change (also called out in docs/release-26.9.1.md).
  • Profiler/PPageManagerStats gained pageFlushQueueMaxPerDatabase alongside the now sum-across-databases pageFlushQueueLength, with a clear explanation of why the old metric alone is no longer meaningful for alerting.
  • Item 1 (Issue5279ConcurrentInsertTest) is a straightforward, clearly-explained fix mirroring the sibling test's existing pattern.
  • Test coverage across all three items is strong, including deliberately adversarial cases (self-wait refusal, non-positive queue capacity, cross-database non-interference, dropped-database budget cleanup).

Minor

  • docs/release-26.9.1.md diff includes two stray added blank lines before unrelated existing headers that look like an unintentional side effect of an editor pass rather than content of this PR.

Nice work overall - the empty-index bug (item 2) is a real correctness issue worth fixing promptly, and the flush-queue budget redesign is thoughtful about avoiding the pitfalls of a naive per-database-queue approach.

@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

This is a large, well-scoped PR (three independent items from #6281) that already went through 8 rounds of self-review addressing real issues (the RebuildIndexStatement statsOnly barrier ordering, the own-worker-thread deadlock, stale metric scale, comment drift). I focused on what those rounds might have missed.

Findings

1. slotsInUse is keyed by a path-equals BasicDatabase, not by identity — possible cross-instance accounting corruption on database reopen (PageManagerFlushThread.java)

LocalDatabase.equals()/hashCode() are based on databasePath (LocalDatabase.java:2114-2129), not object identity. removeAllPagesOfDatabase() clears a closed database's pages from batches still sitting in the shared queue but deliberately leaves the (now-empty) PagesToFlush objects there to be polled later — batch.database still points at the old, closed database instance.

If a database is closed and then reopened at the same path before that stale batch is polled, slotsInUse.computeIfAbsent(newInstance, ...) creates a fresh entry, but because oldInstance.equals(newInstance) is true (same path), releaseSlotOfPolledBatch(staleBatch) — which does slotsInUse.get(batch.database) — will resolve to the new database's map entry via equals()/hashCode(), not fail the "database was closed" lookup the code comments assume. That decrements a slot the new database never reserved, which can either assert-fail (remaining >= 0, -ea test lanes) or, in production without assertions, silently hand out one extra admission slot beyond arcadedb.pageFlushQueue for that database.

This pattern isn't unique to slotsInUse — suspended, deferredByDatabase, flushedPagesPerDatabase, deferredRAMByDatabase all key off the same equals()-based Database/BasicDatabase, so it's a pre-existing risk class in this file rather than something newly introduced. But slotsInUse is new, and the invariant it protects (never goes negative) is asserted, so it's worth a test with reopen-at-same-path interleaved with a lingering stale batch, if one doesn't already exist implicitly through TestHelper's reuse of target/databases/... paths across tests.

Things that look solid

  • The waitForAsyncCompletion() barrier design (unconditional wait, async field read without asyncLock, own-worker refusal via AsyncThread.getOwner() == this reference-equality check) is correct and well-reasoned — the own-worker deadlock fix in particular is real and correctly caught in an earlier round.
  • RebuildIndexStatement's ordering (— [SQL] REBUILD INDEX deletes indexes when used via async HTTP-API #2097 refusal, then the barrier, then statsOnly branch) is now correct; the barrier sits ahead of the early-return statsOnly path, which was the bug round 2/3 fixed.
  • PagesToFlush's single-database-per-batch invariant is asserted, so the batch-level database field used throughout the new per-database accounting is trustworthy within a batch's lifetime.
  • The offerBatch() single-entry-point discipline is consistently applied — all white-box test call sites were swept to go through it (confirmed by grep; no stray queue.offer(...) remains).
  • New regression tests (Issue6281AsyncBatchIndexBuildTest, Issue6281PerDatabaseFlushQueueTest) are meaningful: they reproduce the actual bug shape (idle-looking executor with an open uncommitted batch) rather than just re-testing the fix's mechanics, and the statsOnly BM25-corpus-zeroing test in particular is a good catch of a real silent-corruption path.
  • Log message format strings (reserveQueueSlot's WARNING log) were checked against their varargs — placeholders line up.
  • No new dependencies, no System.out debug leftovers found in the diff, tests use AssertJ per project convention.

Minor

  • PageManagerFlushThread.queue remains public final. It's now unbounded (LinkedBlockingQueue) where it used to be capacity-bounded (ArrayBlockingQueue), and the only thing now enforcing the per-database bound is the offerBatch() discipline layered on top — nothing at the type level stops a future caller (or a hastily-written test) from calling queue.offer(...) directly again and silently bypassing slotsInUse accounting the way several existing tests did before this PR's sweep. Worth considering package-private visibility now that admission moved out of the queue itself, if external callers don't need it (test files reading .size()/.isEmpty() could keep same-package access).

…d a reopened database's budget

Both rounds independently found the same real edge case, and it is worth the fix.

LocalDatabase defines equality by database PATH, not by instance. removeAllPagesOfDatabase() emptied a closing
database's queued batches but deliberately left the wrappers in the queue, and their `database` field still
pointed at the closed instance - so a database dropped and recreated at the same path (a restore, a
re-provision, plenty of tests) would have the NEW instance's budget decremented when one of those wrappers was
finally polled. Assertion failure in the -ea lanes; silently one admission slot too many in production.

Two changes, and the test pins the first:

- removeAllPagesOfDatabase() now takes the emptied wrapper OUT of the queue. It carries no pages, so the poll
  would do nothing but release a slot belonging to a budget that has just been dropped. Removing it means the
  window does not exist rather than being survivable.
- A batch carries the AtomicInteger its slot was charged on, captured at offerBatch(), and the release
  decrements THAT rather than looking the database up again. Defence in depth, and measured as such: with the
  queue removal in place the new test passes even with this reverted, because it can no longer reach the
  release. Kept because the removal has to be remembered at every future path that could leave a batch queued
  across a close, and the capture does not. Safe without volatile - written before queue.offer, read after
  queue.poll, and a BlockingQueue gives happens-before between them.

Also from round 10: PageManagerFlushThread.queue drops from public to package-private. While it carried the
capacity a direct queue.offer was merely impolite; now that admission is the only bound and offerBatch is the
one place a slot is charged, a direct offer silently bypasses the accounting - which is what several white-box
tests were doing before this issue swept them. Nothing outside the package used it.

engine: 12205 tests, 0 failures. Full reactor builds.
@codacy-production

codacy-production Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 14 complexity

Metric Results
Complexity 14

View in Codacy

🟢 Coverage 84.00% diff coverage · -6.56% coverage variation

Metric Results
Coverage variation ✅ -6.56% coverage variation
Diff coverage ✅ 84.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (bddef2e) 159127 125655 78.97%
Head commit (929a6ab) 191526 (+32399) 138679 (+13024) 72.41% (-6.56%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#6290) 100 84 84.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@claude

claude Bot commented Aug 17, 2026

Copy link
Copy Markdown

Review

This is a large, carefully-documented PR (10 rounds of self-review are visible in the commit history, and it shows — the javadoc on PageManagerFlushThread explains almost every invariant a reader would otherwise have to reconstruct by hand). I read the full diff plus the current state of the touched files and traced the concurrency claims against the actual implementation (waitCompletion()'s interrupt handling, AsyncThread.getOwner(), LinkedBlockingQueue's happens-before for the unsynchronized slotCharged read). Everything I checked was accurate. One real gap and a couple of minor points below.

Correctness: BucketIndexBuilder.create() is not covered by the new barrier

The PR's stated goal is "an index build waits for the async batch, not just its tasks," and it wires database.waitForAsyncCompletion() into TypeIndexBuilder.create(), ManualIndexBuilder, and the top of RebuildIndexStatement.executeDDL(). But engine/src/main/java/com/arcadedb/schema/BucketIndexBuilder.java (not touched by this PR) is a fourth path into the exact same bucket-scanning code, reachable directly and publicly via Schema.buildBucketIndex(typeName, bucketName, propertyNames).create() (LocalSchema.java:1259). It is safe when called through TypeIndexBuilder (which pays the barrier before delegating down to it), but a caller that goes through Schema.buildBucketIndex(...) directly never passes through TypeIndexBuilder or RebuildIndexStatement, so it never calls waitForAsyncCompletion().

BucketIndexBuilder.create() has its own, older attempt at solving the same problem: it schedules a blocking "pause" task onto every async worker's queue and counts down a CountDownLatch semaphoreToStart when each task starts running (BucketIndexBuilder.java:76-88). But nothing ever calls semaphoreToStart.await() — I grepped the whole engine module and that's the only two references to the variable. So the calling thread never actually waits for the workers to reach the pause point before proceeding to build the index; the mechanism looks like it was meant to block progress until every worker is quiesced but doesn't. Combined with the missing barrier, this path looks susceptible to the same silent-empty-index bug #6281 describes for TypeIndexBuilder.

This is pre-existing code the PR didn't touch, so it may be a deliberate scoping decision, but given the PR's whole premise is "any bucket scan needs this barrier," it's worth either adding waitForAsyncCompletion() to BucketIndexBuilder.create() too (probably trivial, mirroring the other three call sites) or filing a fast-follow issue so the gap doesn't get lost. Happy to be wrong if there's a reason direct bucket-index creation is considered out of scope for #6281.

Everything else checked out

  • LocalDatabase.waitForAsyncCompletion() correctly reads the async field (not async()) to avoid spinning up an executor for a database that never used one, correctly refuses with NeedRetryException when called from one of the executor's own worker threads (verified AsyncThread.getOwner() exists and is used consistently with offerWaiting's existing check), and correctly breaks on Thread.currentThread().isInterrupted() since waitCompletion() swallows InterruptedException and restores the flag rather than propagating it — the do/while would otherwise busy-spin on a cancelled thread, and the fix is right.
  • PageManagerFlushThread's move from a physically-bounded ArrayBlockingQueue to an unbounded LinkedBlockingQueue + per-database slotsInUse admission map is a sound design for the stated goal (stop one database's backlog from throttling another's committers), and the accounting is unusually well defended: PagesToFlush.slotCharged captures the exact counter a slot was charged against at enqueue time specifically to survive a database being closed and reopened at the same path (since LocalDatabase equality is path-based, not instance-based) — that's a real edge case and the fix (carry the reference rather than re-resolving via the map) is the right one.
  • removeAllPagesOfDatabase removing the now-empty PagesToFlush wrapper from the queue (rather than leaving it to be polled and skipped) closes the same stale-budget window for the same reason — good catch in review round 9/10.
  • The Math.max(1, pageFlushQueue) clamp replacing ArrayBlockingQueue's constructor-time rejection of non-positive capacities is a real, documented behavior change and it's called out in both the config javadoc and the release notes, which is the right way to land it.
  • PagesToFlush.isSingleDatabase() assertion and the interrupt-handling in the flush loop are unchanged in substance from before, just re-documented; I didn't find any regressions there.

Test coverage

Issue6281AsyncBatchIndexBuildTest and Issue6281PerDatabaseFlushQueueTest both look like genuine regression tests (they fail on the pre-fix code per the PR description, not just exercise-the-happy-path tests), and the fix for the vacuous ACIDTransactionTest.indexCreationWhileAsyncMustFail (renamed and now asserting countEntries() + per-record lookups instead of just a record count) is a good example of turning a coverage gap into an actual regression test rather than just describing it in a comment. No test exercises BucketIndexBuilder.create() under an in-flight async batch, which lines up with the gap above — if that path is meant to be in scope, that's the test to add.

Minor

  • docs/release-26.9.1.md and the PAGE_FLUSH_QUEUE/Profiler javadoc changes are thorough and correctly flag the pageFlushQueueLength scale change (sum-across-databases now vs. capacity-bound before) as something an existing alert could silently stop meaning what it used to — good, this is exactly the kind of behavior change that's easy to ship quietly.
  • Nothing else jumped out as a performance or security concern; the added map lookups (slotsInUse.computeIfAbsent/get) are O(1) amortized and off any lock-held hot path.

Nice work tracking down a genuinely subtle bug (a predicate that answers about tasks being used to guard against uncommitted batch state) and thank you for the density of in-code reasoning — it made this review much easier to do thoroughly.

… the bucket scan, and it was not covered

A real gap, correctly found. The barrier went into TypeIndexBuilder, ManualIndexBuilder and REBUILD INDEX, but
BucketIndexBuilder.create() is reachable on its own through the public Schema.buildBucketIndex(...) - and that
is how CHECK DATABASE ... FIX rebuilds an index it found damaged (DatabaseChecker). Reached that way it scanned
a bucket that did not yet contain whatever an async worker was still holding in its open batch, and produced
exactly the silently incomplete index this issue is about. The new test fails without the barrier: 0 entries of
200 records.

Paying the barrier twice on the paths that already did costs one marker round-trip per worker on an executor
that is drained by then; missing it once costs an index.

Also removed from that method a CountDownLatch, semaphoreToStart, that the pause tasks counted down and NOTHING
ever awaited - so the build began whether or not the workers had reached the pause it was meant to wait for.
What it was reaching for is what the barrier now provides properly, so it is gone rather than left sitting there
looking like a guard. The pause tasks themselves stay: they keep the workers from writing DURING the build,
which is a different job and one they still do.

engine: 12206 tests, 0 failures. Full reactor builds.
@lvca lvca added this to the 26.9.1 milestone Aug 17, 2026
@lvca
lvca merged commit 7707a2f into main Aug 17, 2026
26 of 28 checks passed
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.00000% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.23%. Comparing base (bddef2e) to head (929a6ab).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...va/com/arcadedb/engine/PageManagerFlushThread.java 72.46% 9 Missing and 10 partials ⚠️
...src/main/java/com/arcadedb/engine/PageManager.java 50.00% 4 Missing ⚠️
...main/java/com/arcadedb/database/LocalDatabase.java 80.00% 1 Missing and 1 partial ⚠️
.../main/java/com/arcadedb/server/ServerDatabase.java 0.00% 2 Missing ⚠️
...dedb/database/async/DatabaseAsyncExecutorImpl.java 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6290      +/-   ##
==========================================
+ Coverage   70.21%   70.23%   +0.01%     
==========================================
  Files        1840     1840              
  Lines      159127   159173      +46     
  Branches    33559    33566       +7     
==========================================
+ Hits       111736   111794      +58     
+ Misses      33511    33506       -5     
+ Partials    13880    13873       -7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Follow-ups from #6259: two engine tests red on the PR's CI but green on main, and the per-database flush queue

1 participant