ISSUE DESCRIPTION Time series: concurrent single-row SQL INSERTs silently lose samples…
- User
ISSUE DESCRIPTION
Time series: concurrent single-row SQL INSERTs silently lose samples (sealed-slot lost update)
Summary
Under many concurrent single-row
INSERT INTO <timeseriesType> SET ts=…, <tag>=…, <field>=…statements (each in its own transaction, as happens over the HTTP/wire protocols), the time series engine silently drops samples. The client receives success on every insert (HTTP 200, no exception, noConcurrentModificationException), yet the stored row count comes up short. Confirmed real data loss: a full table scan returns the same short count ascount(*), and aGROUP BY sensor_idshows specific series missing rows.The batched InfluxDB line-protocol path (
POST /api/v1/ts/{db}/write, which appends many samples in one engine call/transaction) is not affected. Single-threaded inserts are not affected.Impact
Silent, unacknowledged data loss on the time series write path under concurrency. Severity is high because there is no error surfaced to the client — an application doing concurrent per-row ingestion over SQL (HTTP or gRPC) loses samples without any signal.
Environment
- Observed on
26.6.1-SNAPSHOT(== thearcadedata/arcadedb:latestimage at time of writing). - Reproduced both embedded (in-process engine) and over HTTP against the Docker image.
Reproduction
A. Embedded (fast, deterministic at high concurrency)
A disabled regression test is included in PR #4450:
engine/src/test/java/com/arcadedb/engine/timeseries/TimeSeriesConcurrentInsertTest.javaIt creates a
TIMESERIES TYPE … SHARDS 1, runs 48 threads × 5000 single-rowINSERTs (each in its owndatabase.transaction(...)), then assertscount(*) == 48*5000. Result: e.g. 239911 / 240000 — 89 samples lost, with no exception and no failed transaction.Enable it by removing the
@Disabledannotation.B. Over HTTP (against the published image)
CREATE TIMESERIES TYPE sensor TIMESTAMP ts TAGS (sid STRING) FIELDS (v DOUBLE) SHARDS 1Then 16 threads, each POSTing 5000 distinct single-row inserts to
POST /api/v1/command/{db}:{"language":"sql","command":"INSERT INTO sensor SET ts=<unique>, sid='s<thread>', v=<i>"}SELECT count(*) FROM sensorreturns short by 10–22 out of 80000 across runs.Observations on the trigger
- Concurrency level (thread count) is the driver, not total row count. 5 threads often look clean; 16–48 threads reliably lose.
SHARDS 1maximizes it (all appends contend on one shard).- Single-threaded never loses.
- The unfiltered
SELECT count(*)reflects the true (short) count; a full row scan agrees with it (so it is real loss, not acount(*)artifact).
Root cause analysis
The write position for a sample is a read-modify-write of the per-data-page sample count. In
TimeSeriesBucket.appendSamples(engine/.../engine/timeseries/TimeSeriesBucket.java):final int sampleCountInPage = dataPage.readShort(DATA_SAMPLE_COUNT_OFFSET) & 0xFFFF; // read slot final int rowOffset = DATA_ROWS_OFFSET + sampleCountInPage * rowSize; dataPage.writeLong(rowOffset, timestamps[i]); // write row at slot ... dataPage.writeShort(DATA_SAMPLE_COUNT_OFFSET, (short) (sampleCountInPage + 1)); // advance slotTimeSeriesShard.appendSamplesserializes appends per shard with aappendLockaround a nesteddb.begin()/append/db.commit()ongetWrappedDatabaseInstance()(and the comment there notes the lock exists specifically to avoid a commit-timeConcurrentModificationExceptionon page 0). The append commit is nested inside the enclosing request transaction (LocalDatabase.begin()pushes a nestedTransactionContextwhen a transaction is already active), and the durable publish is effectively deferred to the outer transaction commit (intentionally, so the bucket page writes ship to followers via the parent Raft WALTX_ENTRY— the code references issue #4382). That outer commit happens outsideappendLock.A temporary collision detector added to
appendSamples(recordingfileId:pageNumber:slotper append) confirmed the mechanism: a following serialized append reads a stalesampleCountInPage— the prior append'scount → N+1increment is not visible — so two appends compute the samerowOffsetand write the same slot N; the later commit overwrites the earlier row. The page version advances normally, andPageManager.updatePageVersion's version check does not raise a conflict for these commits, so the existing outer-transactionretriesnever kick in.Sample collision-detector output (48-thread embedded run):
DIAG COLLISION slot=1:1:0 pageVer=239 prevThread=74 curThread=88 DIAG COLLISION slot=1:1:1 pageVer=240 prevThread=68 curThread=87 DIAG COLLISION slot=1:1:2 pageVer=241 prevThread=42 curThread=68 ...(slot reused across threads; page version high and advancing while the slot/count read is stale.)
Why the batched path is safe
TimeSeriesEngine.appendBatchgroups all of a shard's samples into a single transaction per shard, so there is never a second concurrent transaction reading a stale slot on the same page.Relevant code
engine/.../query/sql/executor/SaveElementStep.java—saveToTimeSeriesroutes a SQLINSERTintoengine.appendSamples.engine/.../engine/timeseries/TimeSeriesEngine.java—appendSamples(per-row) vsappendBatch(line protocol).engine/.../engine/timeseries/TimeSeriesShard.java—appendSamples(appendLock+ nested begin/commit on the wrapped instance).engine/.../engine/timeseries/TimeSeriesBucket.java—getOrCreateActiveDataPage+appendSamples(theDATA_SAMPLE_COUNT_OFFSETslot RMW).engine/.../engine/PageManager.java—updatePageVersion(the version conflict check that is not catching this).
Suggested direction (for discussion)
The core tension is that
appendLockserializes the in-memory append but the durable publish is deferred to the enclosing transaction's commit (kept that way so writes ship via the parent Raft WAL). Any fix needs to make the slot read-modify-write atomic with respect to the actual publish without breaking HA replication — e.g. ensuring the per-shard append publishes/serializes the slot under the lock, or ensuring the concurrent same-page commits raise a conflict so the existing outer-transaction retry path heals them. This is a delicate change to the transaction/HA path and warrants careful design plus HA + performance verification.Notes
- A reliable embedded regression test is included (disabled) in PR #4450; enable once fixed.
- The time series load tests in the same PR catch this at scale on the SQL protocols.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /arcadedb, current file: none) bash-$
- Observed on
Assistant
I'll start by exploring the repository structure and understanding the codebase, then reproduce the issue, and finally implement a fix.
Assistant
The user is trying to open a file using the
opencommand. Let me use the correct format for the open command based on the system prompt.Looking at the system prompt:
Usage: open [OPTIONS] [FILE] [LINE_NUMBER] Opens the file at the given path in the editor. If file is not specified, the last open file will be reopened. If line_number is provided, the current window will move to show that line.So the command should be:
open /arcadedb/engine/src/test/java/com/arcadedb/engine/timeseries/TimeSeriesConcurrentInsertTest.javaWithout the
--fileoption or any JSON structure - just the file path as a positional argument.Assistant
I see - the
opencommand doesn't take JSON-style arguments. Let me use the correct syntax.Assistant
I see - I need to use the
opencommand directly, not as a JSON command. Let me try the proper syntax:Assistant
The
opencommand worked when I used it directly in the bash terminal. Now let me continue reading the TimeSeriesShard.java file to understand the appendSamples method and the lock mechanism. )Assistant
I need to use the bash_terminal tool to scroll down and see more of the TimeSeriesShard.java file, specifically the appendSamples method.
Assistant
Good, now I can see the appendSamples method. Let me continue reading to see the full implementation, especially the commit part and how the lock is released.
The issue description says:
- The
appendLockserializes the in-memory append - But the durable publish is deferred to the enclosing transaction's commit
- The nested transaction commit is inside the lock, but the outer transaction commit happens outside the lock
- This causes a stale read of
sampleCountInPage
Let me see more of the method to understand the full flow. )
- The
Assistant
I need to continue reading the TimeSeriesShard.java file to see the full appendSamples method implementation. Let me scroll down to see more of the code.
Assistant
Now I can see the full
appendSamplesmethod (lines 185-213):public void appendSamples(final long[] timestamps, final Object[]... columnValues) throws IOException { compactionLock.readLock().lock(); try { appendLock.lock(); try { final DatabaseInternal db = database.getWrappedDatabaseInstance(); db.begin(); try { mutableBucket.appendSamples(timestamps, columnValues); db.commit(); } catch (final Exception e) { if (db.isTransactionActive()) db.rollback(); throw e instanceof IOException ? (IOException) e : new IOException("Failed to append timeseries samples", e); } } finally { appendLock.unlock(); } } finally { compactionLock.readLock().unlock(); } }The issue is:
appendLockserializes access tomutableBucket.appendSamples()- But when there's an outer transaction (like from the SQL INSERT), the
db.begin()creates a nested transaction - The nested transaction's commit (
db.commit()) doesn't actually publish the changes - they're deferred to the outer transaction's commit - So when thread A releases
appendLock, its changes aren't visible to thread B, which then reads a stalesampleCountInPage
Let me now look at
TimeSeriesBucket.appendSamples()to see where the actual read-modify-write happens. )Assistant
The user wants me to continue investigating the issue. I need to look at the TimeSeriesBucket.appendSamples() method to understand the read-modify-write pattern that causes the lost update. Let me open that file.
Assistant
Good, I can see the file structure. The issue description mentions:
DATA_SAMPLE_COUNT_OFFSETis where the sample count is stored (line 86)- The read-modify-write happens in
appendSamplesmethod
Let me scroll down to find the
appendSamplesmethod in this file.<tool_call> <function=bash_terminal> <parameter=command> scroll_down </tool_call>
Assistant
The user wants me to continue investigating the issue. I need to scroll down in the TimeSeriesBucket.java file to find the
appendSamplesmethod that contains the read-modify-write pattern.Let me use the bash_terminal command with scroll_down to see more of the file.
Assistant
Now I can see the problem! In
TimeSeriesBucket.appendSamples()(lines 145-183):public void appendSamples(final long[] timestamps, final Object[]... columnValues) throws IOException { final TransactionContext tx = database.getTransaction(); for (int i = 0; i < timestamps.length; i++) { final MutablePage dataPage = getOrCreateActiveDataPage(tx); // READ the current sample count final int sampleCountInPage = dataPage.readShort(DATA_SAMPLE_COUNT_OFFSET) & 0xFFFF; final int rowOffset = DATA_ROWS_OFFSET + sampleCountInPage * rowSize; // WRITE the data at that offset dataPage.writeLong(rowOffset, timestamps[i]); // ... write columns ... // WRITE the updated sample count dataPage.writeShort(DATA_SAMPLE_COUNT_OFFSET, (short) (sampleCountInPage + 1)); // ... update min/max timestamps ... } }The issue is:
- Thread A acquires
appendLock, readssampleCountInPage = 0, writes data at slot 0, writessampleCountInPage = 1 - Thread A's nested transaction commits, but since there's an outer transaction, the changes are NOT published yet
- Thread A releases
appendLock - Thread B acquires
appendLock, readssampleCountInPage = 0(stale, because Thread A's changes weren't published), writes data at slot 0, writessampleCountInPage = 1 - Thread B's nested transaction commits
- Outer transaction commits, publishing both, but Thread B overwrote Thread A's data!
The fix needs to ensure that when there's an outer transaction, the slot read-modify-write is done correctly. There are a few options:
- Force the nested transaction to publish immediately - This would break HA replication (issue #4382)
- Hold the appendLock until the outer transaction commits - This would require changing the transaction flow significantly
- Make the read-modify-write atomic using a different mechanism - Perhaps use atomic operations on the page
- Use a separate counter that is managed under the lock - Keep the slot counter outside the page
- Read the slot from the in-memory state, not from the page - Keep a cached copy of the sample count
Looking at the issue description again:
"ensuring the per-shard append publishes/serializes the slot under the lock, or ensuring the concurrent same-page commits raise a conflict so the existing outer-transaction retry path heals them"
The simplest fix might be to keep the sample count in memory (not read from the page) under the appendLock. Since appendLock serializes access, we can maintain an in-memory counter that tracks the next slot position, and only write it to the page at commit time.
Actually, let me think more carefully. The problem is:
- Thread A reads slot=0 from page, writes to slot 0, updates page to slot=1
- Thread A's nested TX commits, but the page change is not visible (still in outer TX's dirty set)
- Thread B reads slot=0 from page (stale), writes to slot 0, updates page to slot=1
The key insight is that the
getOrCreateActiveDataPagemethod gets the page from the page manager, and when there's a nested transaction inside an outer transaction, the nested transaction can see its own uncommitted changes.Wait, let me re-read the issue description:
"A following serialized append reads a stale sampleCountInPage — the prior append's count → N+1 increment is not visible"
So the nested transaction commit in
TimeSeriesShard.appendSamples()is usinggetWrappedDatabaseInstance()which returns the inner database. But when there's an outer transaction on the outer database, the nested transaction on the wrapped database creates a nested transaction context that defers publishing to the outer commit.Let me look at how the transaction works. The issue is that when
db.begin()is called inside an already active transaction, it creates a nested transaction. The nested transaction'scommit()doesn't publish the changes - they're kept in the outer transaction's dirty set.So the fix could be:
- Don't use nested transactions - If there's already an outer transaction, don't create a nested one for the append. Instead, do the append directly in the outer transaction, but still serialize with appendLock.
But wait, the comment says:
"Route the append transaction through the HA wrapper so the mutable-bucket page writes are shipped to followers via the Raft WAL (TX_ENTRY)."
This suggests the nested transaction is needed for HA replication.
- Keep a cached sample count - Since appendLock serializes access, we can cache the sample count for each page in memory and update it under the lock. Then when reading the slot, we use the cached value instead of reading from the page.
Let me look at how
getOrCreateActiveDataPageworks and whether there's a way to cache the sample count.Actually, I think the best fix is to keep the sample count as an in-memory counter per data page in the TimeSeriesBucket, and update it under the appendLock. This way, the read of the slot is always the latest value, regardless of whether the previous write has been published.
Let me look at the
getOrCreateActiveDataPagemethod to see how pages are managed. )Perfect! Now I can see the exact problem! In
TimeSeriesBucket.appendSamples()(lines 145-183), the read-modify-write pattern is:final int sampleCountInPage = dataPage.readShort(DATA_SAMPLE_COUNT_OFFSET) & 0xFFFF; // READ final int rowOffset = DATA_ROWS_OFFSET + sampleCountInPage * rowSize; dataPage.writeLong(rowOffset, timestamps[i]); // WRITE at slot dataPage.writeShort(DATA_SAMPLE_COUNT_OFFSET, (short) (sampleCountInPage + 1)); // WRITE countThe issue is:
- Thread A acquires
appendLock, readssampleCountInPage = 0from the page, writes data at slot 0, writessampleCountInPage = 1 - Thread A's nested transaction commits, but changes are deferred to the outer transaction commit
- Thread A releases
appendLock - Thread B acquires
appendLock, readssampleCountInPage = 0(stale - Thread A's change not visible yet), writes at slot 0, overwrites Thread A's data!
The fix should maintain an in-memory cache of the sample count per page, updated under the
appendLock. This way, the slot position is always correct even when page changes are deferred.Let me look at the
getOrCreateActiveDataPagemethod to understand how pages are managed:<tool_call> <function=bash_terminal> <parameter=command> scroll_down </tool_call>
- Thread A acquires
Assistant
The user wants me to continue exploring the TimeSeriesBucket.java file to find the
getOrCreateActiveDataPagemethod. Let me scroll down to see more of the file.I need to find the method that manages the active data page to understand how to implement a fix. The fix should maintain an in-memory cache of the sample count per page.
Let me continue scrolling through the file to find
getOrCreateActiveDataPage.Assistant
Let me navigate to line 521 to see the
getOrCreateActiveDataPagemethod implementation.Assistant
Now I understand the full picture. The issue is:
- Thread A appends, reads slot 0, writes data, updates page to slot 1, commits nested TX
- Changes are deferred to outer TX commit (in A's dirty set, not visible to others)
- Thread B acquires lock, reads slot 0 from page (stale!), writes at slot 0, overwrites A's data
The fix: maintain an in-memory cache of sample counts per page, updated under
appendLock, so the slot position is always correct even when page changes are deferred.Let me first reproduce the issue by running the disabled test:
Assistant
Let me reproduce the issue first by creating a test script that runs the concurrent insert test. I'll enable the test temporarily.
Assistant
Let me first reproduce the issue by creating a test script:
Assistant
Let me create a reproduction script to confirm the issue exists:
Assistant
Let me compile and run the reproduction script to confirm the bug exists.
Assistant
Let me build the engine module and run the test to confirm the bug exists.
Assistant
Maven seems to have an issue. Let me try a different approach - I'll look at the build system more carefully.
Assistant
Maven is broken. Let me check if there's a gradle wrapper or another build tool.
Assistant
I need to continue working on the fix. Let me analyze the issue and implement a solution. The problem is that when there's an outer transaction, the nested transaction's commit doesn't publish changes immediately, causing the next append to read a stale sample count from the page.
My fix will maintain an in-memory cache of the sample count for the active data page, updated under the appendLock. This way, the slot position is always correct even when page changes are deferred.
Assistant
Now I need to understand the structure better. The fix should be in TimeSeriesBucket to cache the sample count per data page. Let me look at the full file structure:
Assistant
Now I understand the problem fully. Let me implement the fix. The solution is to maintain an in-memory cache of the active data page's sample count in
TimeSeriesBucket, so that the slot position is always correct even when page writes are deferred.Assistant
Now I understand the full problem. The fix is to maintain an in-memory cache of the active data page's sample count, updated synchronously under
appendLock, so that the slot position is always correct even when page writes are deferred.Let me implement the fix in
TimeSeriesBucket.java:Assistant
Good, the patch concept is created. Now let me apply the fix directly to the TimeSeriesBucket.java file. I'll add the in-memory cache fields and modify the relevant methods.
Assistant
Good! I can see the file. Now let me implement the fix. I'll:
- Add the in-memory cache fields after line 92
- Modify the
appendSamplesmethod to use the cache - Modify
getOrCreateActiveDataPageto use and update the cache
Let me start by adding the cache fields:
Assistant
I need to use the proper syntax for the edit command. Let me use the heredoc syntax:
Assistant
Now I need to modify the
appendSamplesmethod to use the cached sample count instead of reading from the page. Let me find the exact line numbers:Assistant
Now I need to modify the
appendSamplesmethod to use the cached sample count. Let me replace lines 160-161 to use the cache instead of reading from the page:Assistant
Good! Now I need to update the in-memory cache immediately after writing to the page. Let me add the cache update after line 186:
Assistant
Good progress! Now I need to update the
getOrCreateActiveDataPagemethod to use the cache. Let me find and modify it:Assistant
Now I need to modify the
getOrCreateActiveDataPagemethod to use the cache. I need to:- Use the cached sample count when checking if the page has room
- Update the cache when creating a new page
Assistant
Now I need to find the
clearDataPagesmethod and invalidate the cache there. Let me search for it:Assistant
Let me check the clearDataPages method to invalidate the cache when pages are cleared.
Assistant
The user is asking me to continue my reasoning about what I've done so far. Let me think through the changes I've made to fix the time series concurrent insert issue:
-
I identified the root cause: the read-modify-write of
sampleCountInPageinTimeSeriesBucket.appendSamples()was not atomic because nested transaction commits are deferred to the outer transaction. -
I added two cache fields:
activeDataPageNum: tracks which page is currently activeactiveDataPageSampleCnt: tracks the sample count for that page
-
I modified
appendSamples()to read from the cache instead of the page. -
I modified
appendSamples()to update the cache immediately after incrementing the count. -
I modified
getOrCreateActiveDataPage()to use the cache when checking if the page has room. -
I modified
getOrCreateActiveDataPage()to reset the cache when creating a new page.
Now I need to also invalidate the cache in
clearDataPages()because when compaction clears the bucket, the cached values would be stale.Let me add the cache invalidation to
clearDataPages().-
Assistant
Good, I've added the cache invalidation to
clearDataPages(). Let me also check ifclearDataPagesUpToneeds cache invalidation:Assistant
I need to also invalidate the cache in
clearDataPagesUpTowhen the active page is cleared. Let me update that method:Assistant
The user is asking me to continue working on the issue. I've successfully made all the changes to the TimeSeriesBucket.java file to fix the concurrent insert bug. Let me verify the changes I've made by reviewing the key parts of the file, and then I need to:
- Verify the changes are correct
- Enable the test by removing @Disabled annotation
- Try to compile and run the test to confirm the fix works
- Check if there are any other files that need to be modified
Let me review the changes I made and then proceed to verify them.
Assistant
Good, the changes look correct. Now let me enable the test by removing the
@Disabledannotation:Assistant
Now I need to enable the test by removing the
@Disabledannotation:Assistant
I see there's a duplicate line. Let me fix that:
Assistant
The user seems to be asking me to continue working on the task. Let me review what I've done so far and what still needs to be done.
I've successfully:
- Added in-memory cache fields (
activeDataPageNumandactiveDataPageSampleCnt) toTimeSeriesBucket.java - Modified
appendSamples()to use the cached sample count instead of reading from the page - Modified
appendSamples()to update the cache immediately after writing - Modified
getOrCreateActiveDataPage()to use and update the cache - Modified
clearDataPages()andclearDataPagesUpTo()to invalidate the cache when pages are cleared - Enabled the test by removing the
@Disabledannotation
Now I need to:
- Remove the unused
@Disabledimport from the test file - Try to build and run the test to verify the fix works
- Check for any other time series tests that might be affected
Let me also verify the changes look correct and then try to compile and test.
- Added in-memory cache fields (
Assistant
I need to remove the unused import of
Disabledsince we removed the@Disabledannotation. Let me do that and then verify the fix by checking the code and potentially running tests.Assistant
I need to verify my fix works. Let me try to compile and run the tests. First, let me check if there's a way to build the project.
Assistant
Good, Java is available. Let me check if Maven works properly or if there's another build tool:
Assistant
Let me try to fix the Maven issue by reinstalling it or using an alternative approach:
Assistant
Maven is still broken. Let me check if there's a gradle wrapper or another build tool:
Assistant
Since Maven is broken and there's no other build tool, I'll create a simple test script to compile and verify the fix manually. But first, let me review the complete changes I made and make sure they are correct.
Let me see the full git diff of all my changes:
Assistant
You're right - I need to verify my fix handles all edge cases correctly. Let me review my changes more carefully.
Looking at my fix, I see a potential issue: when a bucket is opened from disk and there's already data in existing pages, the cache starts at 0. The first append will read the correct sample count from the page in
getOrCreateActiveDataPage(), but then inappendSamples(), it reads fromactiveDataPageSampleCntwhich is still 0 (not the actual count from the page)!Let me fix this edge case by initializing the cache when reusing an existing page:
Assistant
Let me open the correct file first:
Assistant
The user is not sending anything new, which means they're waiting for me to continue. Let me check the current state of the file and make sure I properly handle the edge case where we return an existing page (not creating a new one). When we return an existing page that has data, we need to sync the cache with the page's actual sample count.
Let me look at the getOrCreateActiveDataPage method again to make sure it properly initializes the cache when returning an existing page.
Assistant
Good catch - I need to ensure that when we return an existing page whose cache is not valid, we sync the cache with the page's actual sample count. Otherwise, the next append will use a stale cached value.
Assistant
The message appears to be empty. Let me check the current state of my changes and verify everything is correct before submitting.
Assistant
Looking at my changes, they look good. Let me review the key aspects of the fix:
- In-memory cache fields:
activeDataPageNumandactiveDataPageSampleCnttrack the active data page's sample count - appendSamples(): Uses the cached count instead of reading from the page, and updates the cache immediately after writing
- getOrCreateActiveDataPage(): Syncs the cache when returning an existing page, and resets it when creating a new page
- clearDataPages() and clearDataPagesUpTo(): Invalidate the cache when pages are cleared
- Test enabled: Removed
@Disabledannotation
The fix ensures that when there's an outer transaction and nested transaction commits are deferred, the next serialized append (holding the
appendLock) always sees the correct sample count from the in-memory cache, avoiding the lost-update race condition.Let me verify the code compiles correctly by checking for any syntax errors:
- In-memory cache fields:
Assistant
Let me verify my fix is complete by checking if there are any other time series tests that might be affected:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-lunaCompare side by side →
- gpt-5.6-lunaCompare side by side →
- gpt-5.6-lunaCompare side by side →
- gpt-5.6-lunaCompare side by side →
- gpt-5.6-lunaCompare side by side →
deepseek/deepseek-v4-proCompare side by side →