Skip to content

fix(core): fix occasional errors in result set size calculation#6351

Merged
bluestreak01 merged 24 commits intomasterfrom
ia_fix_calc_size
Nov 11, 2025
Merged

fix(core): fix occasional errors in result set size calculation#6351
bluestreak01 merged 24 commits intomasterfrom
ia_fix_calc_size

Conversation

@glasstiger
Copy link
Copy Markdown
Contributor

@glasstiger glasstiger commented Nov 5, 2025

The web console displayed incorrect result set size, when the size of the first partition of the query's result exceeded the configured maximum page frame size.
Modified the size calculation in page frame cursors to account for the remaining size of the backing partition.

In addition also fixed few other size calculation related bugs in this PR.
Some factories did not account for the rows already consumed from the cursor.
Also fixes PgAttrDefFunctionFactory, the cursor was resetting automatically without calling toTop().

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 5, 2025

Walkthrough

Adds per-frame remaining-row tracking to PageFrameCursor implementations, removes a static RecordCursor.calculateSize utility, and updates size-calculation flows to account for remaining rows; expands related tests and introduces new calculateSize implementations for interval partition cursors.

Changes

Cohort / File(s) Summary
Core cursor API
core/src/main/java/io/questdb/cairo/sql/PageFrameCursor.java, core/src/main/java/io/questdb/cairo/sql/RecordCursor.java
Added instance API to expose remaining rows in current interval (default on PageFrameCursor). Removed static calculateSize(RecordCursor, SqlExecutionCircuitBreaker, Counter) utility from RecordCursor. Javadoc wording updated.
Page-frame cursor implementations
core/src/main/java/io/questdb/griffin/engine/table/BwdTableReaderPageFrameCursor.java, core/src/main/java/io/questdb/griffin/engine/table/FwdTableReaderPageFrameCursor.java, core/src/main/java/io/questdb/griffin/engine/functions/table/ReadParquetPageFrameCursor.java, core/src/main/java/io/questdb/griffin/engine/table/SelectedRecordCursorFactory.java
Added remainingRowsInInterval fields and public getRemainingRowsInInterval() getters to forward/backward/native/parquet/selected cursor classes; native/parquet implementations set/return appropriate values (parquet returns 0).
Partition interval cursors
core/src/main/java/io/questdb/cairo/IntervalBwdPartitionFrameCursor.java, core/src/main/java/io/questdb/cairo/IntervalFwdPartitionFrameCursor.java, core/src/main/java/io/questdb/cairo/AbstractIntervalPartitionFrameCursor.java
Added calculateSize(RecordCursor.Counter) implementations to forward/backward interval partition cursors that iterate intervals/partitions and update the counter; removed the override from AbstractIntervalPartitionFrameCursor.
PageFrameRecordCursorImpl / joins / arrays
core/src/main/java/io/questdb/griffin/engine/table/PageFrameRecordCursorImpl.java, core/src/main/java/io/questdb/griffin/engine/join/HashJoinLightRecordCursorFactory.java, core/src/main/java/io/questdb/cairo/RecordArray.java
PageFrameRecordCursorImpl.calculateSize now adds frameCursor.getRemainingRowsInInterval() before delegating to frameCursor.calculateSize. Hash-join size path now traverses remaining slave chain to update counter. RecordArray gained size tracking, navigation helpers, clear/put, and a calculateSize(counter) method.
Tests and test harness
core/src/test/java/io/questdb/test/griffin/engine/table/PageFrameRecordCursorImplFactoryTest.java, core/src/test/java/io/questdb/test/AbstractCairoTest.java, core/src/test/java/io/questdb/test/cairo/wal/WalTableSqlTest.java
Large expansion of PageFrameRecordCursorImplFactoryTest with many new variants; AbstractCairoTest.assertCursor materializes size by calling cursor.calculateSize when unknown; WAL tests refactored string literals to Java text blocks for readability.
Catalogue cursor state handling
core/src/main/java/io/questdb/griffin/engine/functions/catalogue/PgAttrDefFunctionFactory.java
Internal refactor: introduced explicit tri-state sentinel (-1/0/>0) for file descriptor state and updated close/hasNext/toTop/next0 flows (no public API changes).

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant PageFrameRecordCursorImpl as PFImpl
    participant FrameCursor
    participant Counter

    Caller->>PFImpl: calculateSize(counter)
    PFImpl->>FrameCursor: clear()           %% reset current frame cursor state
    PFImpl->>FrameCursor: getRemainingRowsInInterval()
    FrameCursor-->>PFImpl: remainingRows
    PFImpl->>Counter: add(remainingRows)
    PFImpl->>FrameCursor: calculateSize(counter)  %% delegate remaining traversal
    FrameCursor-->>Counter: add(..)                %% frameCursor updates counter further
    PFImpl-->>Caller: return
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Multiple areas touched with non-uniform changes (API additions, removals, new traversal logic, test explosion).
  • Review focus:
    • Correctness of remaining-rows calculations in Fwd/Bwd/native implementations.
    • Ensure removal of static RecordCursor.calculateSize did not leave call sites unresolved.
    • Interval partition calculateSize implementations for off-by-one and DataUnavailableException handling.
    • Hash-join traversal changes to confirm no double-counting or cursor side-effects.
    • RecordArray lifecycle (clear/put/size) and interactions with existing callers.
    • Large test additions — sanity-check a representative subset rather than every generated case.

Possibly related PRs

Suggested labels

Bug

Suggested reviewers

  • RaphDal

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.08% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: fixing errors in result set size calculation by accounting for remaining partition size in page frame cursors.
Description check ✅ Passed The PR description accurately describes the changeset, explaining the root cause (result set size calculation error when first partition exceeds max page frame size) and the fixes applied (accounting for remaining partition size, fixing other size calculation bugs, addressing cursor reset issues).
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ia_fix_calc_size

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@bluestreak01
Copy link
Copy Markdown
Member

@CodeRabbit review

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 5, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

ideoma
ideoma previously approved these changes Nov 7, 2025
@glasstiger glasstiger added the DO NOT MERGE These changes should not be merged to main branch label Nov 8, 2025
@glasstiger glasstiger removed the DO NOT MERGE These changes should not be merged to main branch label Nov 10, 2025
@bluestreak01
Copy link
Copy Markdown
Member

@CodeRabbit there were more places where size wasn't calculated correctly, can you review the new changes?

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 10, 2025

@bluestreak01: I'll review the new changes where additional size calculation issues were fixed.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (3)
core/src/main/java/io/questdb/griffin/engine/join/HashJoinLightRecordCursorFactory.java (1)

197-214: Logic is correct for remaining-size calculation, but consider documenting side effects.

The addition of lines 199-202 correctly accounts for remaining slave-chain entries before counting matches from subsequent master records. This properly computes the remaining result-set size (not the total size from the beginning), which aligns with the PR's objective of fixing size-calculation errors when cursors are partially consumed.

However, the method has significant side effects that should be documented:

  1. Destructive operation: calculateSize exhausts both slaveChainCursor and masterCursor by advancing them to completion. Subsequent hasNext() calls will return false unless toTop() is called.

  2. Non-idempotent: Multiple calls to calculateSize will yield different results (first call counts remaining records, second call returns 0).

  3. Naming ambiguity: The method name suggests a read-only calculation, but it mutates cursor state. Consider adding a JavaDoc comment clarifying that this method computes the remaining size and advances the cursors as a side effect.

Consider adding JavaDoc to clarify the semantics:

/**
 * Calculates the number of records remaining in this cursor.
 * <p>
 * WARNING: This method advances both the slave-chain cursor and master cursor
 * to completion as a side effect. After calling this method, hasNext() will
 * return false unless toTop() is called first.
 *
 * @param circuitBreaker circuit breaker for long-running operations
 * @param counter accumulator for the count
 */
@Override
public void calculateSize(SqlExecutionCircuitBreaker circuitBreaker, Counter counter) {
core/src/test/java/io/questdb/test/AbstractCairoTest.java (1)

271-285: Good addition; guard against long→int overflow when picking skip.

If count > Integer.MAX_VALUE, (int) count truncates. Clamp the bound before rnd.nextInt.

-                final int skip = rnd.nextBoolean() ? rnd.nextInt((int) count) : 0;
+                final int skipBound = count > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) count;
+                final int skip = rnd.nextBoolean() ? rnd.nextInt(skipBound) : 0;
core/src/test/java/io/questdb/test/griffin/engine/table/PageFrameRecordCursorImplFactoryTest.java (1)

1065-1158: Add DESC interval tests to exercise backward size-calculation.

You cover interval paths in ASC; mirror a few with ORDER_DESC to hit IntervalBwdPartitionFrameCursor.calculateSize.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b4196e2 and 4920975.

📒 Files selected for processing (15)
  • core/src/main/java/io/questdb/cairo/AbstractIntervalPartitionFrameCursor.java (0 hunks)
  • core/src/main/java/io/questdb/cairo/IntervalBwdPartitionFrameCursor.java (2 hunks)
  • core/src/main/java/io/questdb/cairo/IntervalFwdPartitionFrameCursor.java (2 hunks)
  • core/src/main/java/io/questdb/cairo/RecordArray.java (3 hunks)
  • core/src/main/java/io/questdb/cairo/sql/PageFrameCursor.java (3 hunks)
  • core/src/main/java/io/questdb/griffin/engine/functions/catalogue/PgAttrDefFunctionFactory.java (5 hunks)
  • core/src/main/java/io/questdb/griffin/engine/functions/table/ReadParquetPageFrameCursor.java (1 hunks)
  • core/src/main/java/io/questdb/griffin/engine/join/HashJoinLightRecordCursorFactory.java (1 hunks)
  • core/src/main/java/io/questdb/griffin/engine/table/BwdTableReaderPageFrameCursor.java (3 hunks)
  • core/src/main/java/io/questdb/griffin/engine/table/FwdTableReaderPageFrameCursor.java (3 hunks)
  • core/src/main/java/io/questdb/griffin/engine/table/PageFrameRecordCursorImpl.java (1 hunks)
  • core/src/main/java/io/questdb/griffin/engine/table/SelectedRecordCursorFactory.java (1 hunks)
  • core/src/test/java/io/questdb/test/AbstractCairoTest.java (2 hunks)
  • core/src/test/java/io/questdb/test/cairo/wal/WalTableSqlTest.java (34 hunks)
  • core/src/test/java/io/questdb/test/griffin/engine/table/PageFrameRecordCursorImplFactoryTest.java (6 hunks)
💤 Files with no reviewable changes (1)
  • core/src/main/java/io/questdb/cairo/AbstractIntervalPartitionFrameCursor.java
🚧 Files skipped from review as they are similar to previous changes (3)
  • core/src/main/java/io/questdb/griffin/engine/table/FwdTableReaderPageFrameCursor.java
  • core/src/main/java/io/questdb/griffin/engine/table/BwdTableReaderPageFrameCursor.java
  • core/src/main/java/io/questdb/cairo/sql/PageFrameCursor.java
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-11-10T14:28:48.307Z
Learnt from: mtopolnik
Repo: questdb/questdb PR: 0
File: :0-0
Timestamp: 2025-11-10T14:28:48.307Z
Learning: In AsOfJoinDenseRecordCursorFactoryBase.java, the `backwardScanExhausted` flag is intentionally NOT reset in `toTop()` because backward scan results are reusable across cursor rewinds. The backward scan caches historical matches that remain valid when the cursor is rewound.

Applied to files:

  • core/src/main/java/io/questdb/cairo/IntervalBwdPartitionFrameCursor.java
  • core/src/test/java/io/questdb/test/AbstractCairoTest.java
  • core/src/main/java/io/questdb/griffin/engine/join/HashJoinLightRecordCursorFactory.java
  • core/src/main/java/io/questdb/cairo/RecordArray.java
  • core/src/test/java/io/questdb/test/griffin/engine/table/PageFrameRecordCursorImplFactoryTest.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (29)
  • GitHub Check: New pull request (Coverage Report Coverage Report)
  • GitHub Check: New pull request (Rust Test and Lint on linux-jdk17)
  • GitHub Check: New pull request (Hosted Running tests on windows-other-2)
  • GitHub Check: New pull request (Hosted Running tests on windows-other-1)
  • GitHub Check: New pull request (Hosted Running tests on windows-pgwire)
  • GitHub Check: New pull request (Hosted Running tests on windows-cairo-2)
  • GitHub Check: New pull request (Hosted Running tests on windows-cairo-1)
  • GitHub Check: New pull request (Hosted Running tests on windows-fuzz2)
  • GitHub Check: New pull request (SelfHosted Running tests with cover on linux-other)
  • GitHub Check: New pull request (Hosted Running tests on windows-fuzz1)
  • GitHub Check: New pull request (SelfHosted Running tests with cover on linux-pgwire)
  • GitHub Check: New pull request (Hosted Running tests on windows-griffin-sub)
  • GitHub Check: New pull request (SelfHosted Running tests with cover on linux-cairo-sub)
  • GitHub Check: New pull request (Hosted Running tests on windows-griffin-base)
  • GitHub Check: New pull request (SelfHosted Running tests with cover on linux-cairo-root)
  • GitHub Check: New pull request (Hosted Running tests on mac-other)
  • GitHub Check: New pull request (SelfHosted Running tests with cover on linux-fuzz2)
  • GitHub Check: New pull request (Hosted Running tests on mac-pgwire)
  • GitHub Check: New pull request (SelfHosted Running tests with cover on linux-fuzz1)
  • GitHub Check: New pull request (Hosted Running tests on mac-cairo-fuzz)
  • GitHub Check: New pull request (SelfHosted Running tests with cover on linux-griffin-sub)
  • GitHub Check: New pull request (Hosted Running tests on mac-cairo)
  • GitHub Check: New pull request (SelfHosted Running tests with cover on linux-griffin-root)
  • GitHub Check: New pull request (SelfHosted Griffin And Fuzz tests on linux-arm64)
  • GitHub Check: New pull request (Hosted Running tests on mac-griffin)
  • GitHub Check: New pull request (SelfHosted Other tests on linux-x64-zfs)
  • GitHub Check: New pull request (SelfHosted Griffin And Fuzz tests on linux-x64-zfs)
  • GitHub Check: New pull request (SelfHosted Other tests on linux-arm64)
  • GitHub Check: New pull request (Check Changes Check changes)
🔇 Additional comments (7)
core/src/test/java/io/questdb/test/cairo/wal/WalTableSqlTest.java (1)

125-130: LGTM! Excellent refactoring to text blocks.

The conversion from string concatenation to Java text blocks significantly improves readability and maintainability of test expectations and SQL statements. The functional behavior remains unchanged.

Also applies to: 174-180, 218-222, 262-266, 303-307, 431-436, 523-527, 543-548, 590-593, 620-623, 635-638, 649-652, 664-667, 767-770, 801-809, 836-840, 864-871, 901-911, 953-956, 1133-1140, 1147-1150, 1434-1437, 1570-1577, 1583-1587, 1628-1634, 1681-1684, 1723-1727, 1749-1753, 1813-1817, 1839-1843, 1900-1906, 1916-1922, 1956-1964, 2115-2119, 2178-2184, 2350-2359, 2361-2366, 2373-2378, 2383-2386

core/src/main/java/io/questdb/griffin/engine/table/SelectedRecordCursorFactory.java (1)

342-346: Delegation is correct.

Propagating getRemainingRowsInInterval() keeps wrappers in sync with base behavior.

core/src/main/java/io/questdb/griffin/engine/functions/table/ReadParquetPageFrameCursor.java (1)

97-101: Reasonable default for Parquet.

Returning 0 avoids double-counting and matches the non-interval nature of this cursor.

core/src/main/java/io/questdb/cairo/RecordArray.java (1)

94-99: put(Record) looks good.

The write path is correct and pairs with beginRecord()/recordSink.copy().

core/src/test/java/io/questdb/test/griffin/engine/table/PageFrameRecordCursorImplFactoryTest.java (2)

69-155: Solid functional test for symbol index + full partition path.

Covers the projection/indexed row-cursor factory path well.


881-927: Helper test path is clean and asserts skip + calculateSize correctly.

Good to validate both ASC and DESC orders via the same helper.

core/src/main/java/io/questdb/griffin/engine/table/PageFrameRecordCursorImpl.java (1)

84-87: Verification complete: all PageFrameCursor implementations define getRemainingRowsInInterval().

The codebase contains 4 concrete implementations, all with the method defined:

  • BwdTableReaderPageFrameCursor (line 97)
  • FwdTableReaderPageFrameCursor (line 98)
  • SelectedPageFrameCursor (line 343)
  • ReadParquetPageFrameCursor (line 98)

The method is properly declared in the PageFrameCursor interface, and TablePageFrameCursor correctly extends it. The code addition at lines 84-87 is sound and complete.

@glasstiger
Copy link
Copy Markdown
Contributor Author

[PR Coverage check]

😍 pass : 117 / 147 (79.59%)

file detail

path covered line new line coverage
🔵 io/questdb/griffin/engine/table/SelectedRecordCursorFactory.java 0 1 00.00%
🔵 io/questdb/griffin/engine/join/HashJoinLightRecordCursorFactory.java 1 3 33.33%
🔵 io/questdb/cairo/IntervalBwdPartitionFrameCursor.java 39 55 70.91%
🔵 io/questdb/griffin/engine/functions/catalogue/PgAttrDefFunctionFactory.java 11 14 78.57%
🔵 io/questdb/cairo/IntervalFwdPartitionFrameCursor.java 47 55 85.45%
🔵 io/questdb/griffin/engine/table/FwdTableReaderPageFrameCursor.java 2 2 100.00%
🔵 io/questdb/griffin/engine/table/BwdTableReaderPageFrameCursor.java 2 2 100.00%
🔵 io/questdb/griffin/engine/table/PageFrameRecordCursorImpl.java 1 1 100.00%
🔵 io/questdb/griffin/engine/functions/table/ReadParquetPageFrameCursor.java 1 1 100.00%
🔵 io/questdb/cairo/RecordArray.java 13 13 100.00%

@bluestreak01
Copy link
Copy Markdown
Member

CI was OOM killed perhaps:

2025-11-10T22:10:04.8680102Z >>>>= io.questdb.test.FilesTest.testWriteOver2GB
2025-11-10T22:10:08.8211930Z Killed
2025-11-10T22:10:08.8596357Z [1036.165s][info][gc] GC(81) Pause Young (Allocation Failure) 270M->63M(543M) 13.082ms
2025-11-10T22:10:08.8990325Z [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.5.3:test (default-test) on project questdb: 
2025-11-10T22:10:08.8991146Z [ERROR] 
2025-11-10T22:10:08.9018262Z [ERROR] See /azp/_work/1/s/core/target/surefire-reports for the individual test results.
2025-11-10T22:10:08.9019068Z [ERROR] See dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
2025-11-10T22:10:08.9019449Z [ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
2025-11-10T22:10:08.9020733Z [ERROR] Command was /bin/sh -c cd '/azp/_work/1/s/core' && '/usr/lib/jvm/java-17-openjdk-arm64/bin/java' '-ea' '-Dfile.encoding=UTF-8' '-XX:+UseParallelGC' '@/azp/_work/1/s/core/target/surefire/surefireargs-20251110215350224_3' '/azp/_work/1/s/core/target/surefire' '2025-11-10T21-53-50_057-jvmRun1' 'surefire-20251110215350224_1tmp' 'surefire_0-20251110215350224_2tmp'
2025-11-10T22:10:08.9021118Z [ERROR] Error occurred in starting fork, check output in log
2025-11-10T22:10:08.9021425Z [ERROR] Process Exit Code: 137
2025-11-10T22:10:08.9021739Z [ERROR] Crashed tests:
2025-11-10T22:10:08.9022058Z [ERROR] io.questdb.test.FilesTest
2025-11-10T22:10:08.9022912Z [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
2025-11-10T22:10:08.9023532Z [ERROR] Command was /bin/sh -c cd '/azp/_work/1/s/core' && '/usr/lib/jvm/java-17-openjdk-arm64/bin/java' '-ea' '-Dfile.encoding=UTF-8' '-XX:+UseParallelGC' '@/azp/_work/1/s/core/target/surefire/surefireargs-20251110215350224_3' '/azp/_work/1/s/core/target/surefire' '2025-11-10T21-53-50_057-jvmRun1' 'surefire-20251110215350224_1tmp' 'surefire_0-20251110215350224_2tmp'
2025-11-10T22:10:08.9024234Z [ERROR] Error occurred in starting fork, check output in log
2025-11-10T22:10:08.9025776Z [ERROR] Process Exit Code: 137
2025-11-10T22:10:08.9026441Z [ERROR] Crashed tests:
2025-11-10T22:10:08.9026905Z [ERROR] io.questdb.test.FilesTest
2025-11-10T22:10:08.9027495Z [ERROR] 	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:643)
2025-11-10T22:10:08.9028058Z [ERROR] 	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:285)
2025-11-10T22:10:08.9028640Z [ERROR] 	at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:250)
2025-11-10T22:10:08.9029234Z [ERROR] 	at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1337)

@glasstiger
Copy link
Copy Markdown
Contributor Author

Looks like disk was full:

2025-11-10T23:34:03.9000979Z [ERROR] Failures: 
2025-11-10T23:34:03.9002274Z [ERROR]   FilesTest.testWriteOver2GB:1450->lambda$testWriteOver2GB$44:1474 expected:<2147487744> but was:<-1>
2025-11-10T23:34:03.9004277Z [ERROR] Errors: 
2025-11-10T23:34:03.9006368Z [ERROR]   ParallelCsvFileImporterTest.testIndexChunksInBigCsvByDay:2137->assertIndexChunks:3020->executeWithPool:3535->executeWithPool:3545->AbstractCairoTest.assertMemoryLeak:1261->AbstractCairoTest.assertMemoryLeak:1278->AbstractCairoTest.lambda$assertMemoryLeak$9:1283->lambda$executeWithPool$79:3579->execute:3458->lambda$assertIndexChunks$74:3023->assertIndexChunksFor:3046 » TextImport import failed [phase=indexing, msg=`[28] No space left [size=16777216, fd=1221918790497]`]
2025-11-10T23:34:03.9007096Z [ERROR] Tests run: 20049, Failures: 1, Errors: 1, Skipped: 225

ParallelCsvFileImporterTest.testIndexChunksInBigCsvByDay() failed first:

2025-11-10T23:19:41.5017344Z io.questdb.cairo.CairoException: [28] No space left [size=16777216, fd=1221918790497]
2025-11-10T23:19:41.5017967Z 	at io.questdb.cairo.CairoException.instance(CairoException.java:383)
2025-11-10T23:19:41.5018493Z 	at io.questdb.cairo.CairoException.critical(CairoException.java:77)
2025-11-10T23:19:41.5019061Z 	at io.questdb.cairo.TableUtils.allocateDiskSpace(TableUtils.java:206)
2025-11-10T23:19:41.5019567Z 	at io.questdb.cairo.TableUtils.mapRW(TableUtils.java:1198)
2025-11-10T23:19:41.5020100Z 	at io.questdb.cairo.vm.MemoryPMARImpl.mapPage(MemoryPMARImpl.java:104)
2025-11-10T23:19:41.5020609Z 	at io.questdb.cairo.vm.MemoryPMARImpl.mapWritePage(MemoryPMARImpl.java:164)
2025-11-10T23:19:41.5021138Z 	at io.questdb.cairo.vm.MemoryPARWImpl.pageAt(MemoryPARWImpl.java:1139)
2025-11-10T23:19:41.5021945Z 	at io.questdb.cairo.vm.MemoryPARWImpl.putByte(MemoryPARWImpl.java:548)
2025-11-10T23:19:41.5022507Z 	at io.questdb.cairo.vm.MemoryPARWImpl.putLongBytes(MemoryPARWImpl.java:827)
2025-11-10T23:19:41.5023038Z 	at io.questdb.cairo.vm.MemoryPARWImpl.putLong(MemoryPARWImpl.java:734)
2025-11-10T23:19:41.5023667Z 	at io.questdb.cairo.vm.MemoryPARWImpl.putLong128Slow(MemoryPARWImpl.java:1184)
2025-11-10T23:19:41.5024246Z 	at io.questdb.cairo.vm.MemoryPARWImpl.putLong128(MemoryPARWImpl.java:745)
2025-11-10T23:19:41.5025463Z 	at io.questdb.cutlass.text.CsvFileIndexer$IndexOutputFile.putEntry(CsvFileIndexer.java:746)
2025-11-10T23:19:41.5026011Z 	at io.questdb.cutlass.text.CsvFileIndexer.indexLine(CsvFileIndexer.java:330)
2025-11-10T23:19:41.5026585Z 	at io.questdb.cutlass.text.CsvFileIndexer.onLineEnd(CsvFileIndexer.java:495)
2025-11-10T23:19:41.5027186Z 	at io.questdb.cutlass.text.CsvFileIndexer.parse(CsvFileIndexer.java:556)
2025-11-10T23:19:41.5027781Z 	at io.questdb.cutlass.text.CsvFileIndexer.index(CsvFileIndexer.java:263)
2025-11-10T23:19:41.5028398Z 	at io.questdb.cutlass.text.CopyImportTask$PhaseIndexing.run(CopyImportTask.java:857)
2025-11-10T23:19:41.5029272Z 	at io.questdb.cutlass.text.CopyImportTask.run(CopyImportTask.java:301)
2025-11-10T23:19:41.5029843Z 	at io.questdb.cutlass.text.CopyImportJob.doRun(CopyImportJob.java:100)
2025-11-10T23:19:41.5030446Z 	at io.questdb.mp.AbstractQueueConsumerJob.run(AbstractQueueConsumerJob.java:50)
2025-11-10T23:19:41.5031057Z 	at io.questdb.cutlass.text.ParallelCsvFileImporter.stealWork(ParallelCsvFileImporter.java:1383)
2025-11-10T23:19:41.5031785Z 	at io.questdb.cutlass.text.ParallelCsvFileImporter.collect(ParallelCsvFileImporter.java:766)
2025-11-10T23:19:41.5032461Z 	at io.questdb.cutlass.text.ParallelCsvFileImporter.phaseIndexing(ParallelCsvFileImporter.java:624)
2025-11-10T23:19:41.5033119Z 	at io.questdb.test.cutlass.text.ParallelCsvFileImporterTest.assertIndexChunksFor(ParallelCsvFileImporterTest.java:3046)
2025-11-10T23:19:41.5033781Z 	at io.questdb.test.cutlass.text.ParallelCsvFileImporterTest.lambda$assertIndexChunks$74(ParallelCsvFileImporterTest.java:3023)
2025-11-10T23:19:41.5034463Z 	at io.questdb.test.cutlass.text.ParallelCsvFileImporterTest.execute(ParallelCsvFileImporterTest.java:3458)
2025-11-10T23:19:41.5035123Z 	at io.questdb.test.cutlass.text.ParallelCsvFileImporterTest.lambda$executeWithPool$79(ParallelCsvFileImporterTest.java:3579)
2025-11-10T23:19:41.5035753Z 	at io.questdb.test.AbstractCairoTest.lambda$assertMemoryLeak$9(AbstractCairoTest.java:1283)
2025-11-10T23:19:41.5036372Z 	at io.questdb.test.tools.TestUtils.assertMemoryLeak(TestUtils.java:784)
2025-11-10T23:19:41.5036964Z 	at io.questdb.test.AbstractCairoTest.assertMemoryLeak(AbstractCairoTest.java:1278)
2025-11-10T23:19:41.5037581Z 	at io.questdb.test.AbstractCairoTest.assertMemoryLeak(AbstractCairoTest.java:1261)
2025-11-10T23:19:41.5038224Z 	at io.questdb.test.cutlass.text.ParallelCsvFileImporterTest.executeWithPool(ParallelCsvFileImporterTest.java:3545)
2025-11-10T23:19:41.5038861Z 	at io.questdb.test.cutlass.text.ParallelCsvFileImporterTest.executeWithPool(ParallelCsvFileImporterTest.java:3535)
2025-11-10T23:19:41.5039861Z 	at io.questdb.test.cutlass.text.ParallelCsvFileImporterTest.assertIndexChunks(ParallelCsvFileImporterTest.java:3020)
2025-11-10T23:19:41.5040578Z 	at io.questdb.test.cutlass.text.ParallelCsvFileImporterTest.testIndexChunksInBigCsvByDay(ParallelCsvFileImporterTest.java:2137)

Searched for No space left in the log, and more tests ran into the problem.
re FilesTest.testWriteOver2GB():

2025-11-10T23:30:13.4625589Z 2025-11-10T23:30:13.459665Z E i.q.t.TestListener ***** Test Failed ***** io.questdb.test.FilesTest.testWriteOver2GB duration_ms=2659 : 
2025-11-10T23:30:13.4626433Z java.lang.AssertionError: expected:<2147487744> but was:<-1>
2025-11-10T23:30:13.4627654Z 	at org.junit.Assert.fail(Assert.java:89)
2025-11-10T23:30:13.4629012Z 	at org.junit.Assert.failNotEquals(Assert.java:835)
2025-11-10T23:30:13.4629882Z 	at org.junit.Assert.assertEquals(Assert.java:647)
2025-11-10T23:30:13.4630837Z 	at org.junit.Assert.assertEquals(Assert.java:633)
2025-11-10T23:30:13.4631702Z 	at io.questdb.test.FilesTest.lambda$testWriteOver2GB$44(FilesTest.java:1474)
2025-11-10T23:30:13.4632586Z 	at io.questdb.test.tools.TestUtils.assertMemoryLeak(TestUtils.java:784)
2025-11-10T23:30:13.4633400Z 	at io.questdb.test.FilesTest.testWriteOver2GB(FilesTest.java:1450)

That -1 is returned by Files.write() which means write failed.
If the test was handling this error, and checking for errno, I think we would have seen errno 28 (No space left on device).

@bluestreak01
Copy link
Copy Markdown
Member

yeah

@bluestreak01 bluestreak01 merged commit e1556a8 into master Nov 11, 2025
37 checks passed
@bluestreak01 bluestreak01 deleted the ia_fix_calc_size branch November 11, 2025 13:20
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.

3 participants