Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): support WAL sequencer transaction file partitioned format #4194

Merged
merged 82 commits into from
Mar 9, 2024

Conversation

ideoma
Copy link
Collaborator

@ideoma ideoma commented Feb 5, 2024

WAL sequencer file _txnlog records all 28 bytes per transaction and currently there is no way to reduce the space taken by this file. This can add up to many GiB of storage over time. This PR introduces new storage of _txnlog where it is chunked into multiple fixed-size files.

The chunks or parts of _txnlog are stored in _txn_parts subdirectory as files with numeric names:

table/
    txn_seq/
        _txn_parts/
            0
            1
        _txnlog

When all the transactions from the part are fully applied to the table, the part is deleted by WalPurgeJob

"Old" non-chunked sequencer files are fully supported. To switch for a new table to use chunked format a configuration option cairo.default.wal.seq.chunk.txn.count to be set, for example to the value of 5000.

Also, this change adds additional commit details to the sequencer log of the new format:

  • min timestamp of the commit
  • max timestamp of the commit
  • row count of the commit

@ideoma ideoma added the tandem label Feb 15, 2024
@ideoma ideoma marked this pull request as ready for review February 15, 2024 15:59

import static io.questdb.cairo.wal.WalUtils.*;

public class TableTransactionLogV2 implements TableTransactionLogFile {
Copy link
Member

Choose a reason for hiding this comment

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

please document why two implementations are required

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added javadoc


long getPartNo();

// Sets cursor to minimum available position.
Copy link
Member

Choose a reason for hiding this comment

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

terminology, it might be easier to use txn instead, such as min txn, vs minimum position etc

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

renamed to toMinTxn()

@ideoma
Copy link
Collaborator Author

ideoma commented Mar 8, 2024

[PR Coverage check]

😍 pass : 668 / 724 (92.27%)

file detail

path covered line new line coverage
🔵 io/questdb/cairo/wal/DefaultWalListener.java 0 1 00.00%
🔵 io/questdb/cairo/wal/WalUtils.java 9 19 47.37%
🔵 io/questdb/cairo/wal/seq/TableTransactionLogV2.java 234 256 91.41%
🔵 io/questdb/cairo/wal/seq/TableTransactionLog.java 76 83 91.57%
🔵 io/questdb/cairo/wal/seq/TableTransactionLogV1.java 136 149 91.28%
🔵 io/questdb/griffin/engine/functions/catalogue/WalTransactionsFunctionFactory.java 39 41 95.12%
🔵 io/questdb/cairo/wal/WalPurgeJob.java 79 80 98.75%
🔵 io/questdb/std/str/Path.java 9 9 100.00%
🔵 io/questdb/cairo/wal/WalTxnDetails.java 54 54 100.00%
🔵 io/questdb/PropServerConfiguration.java 2 2 100.00%
🔵 io/questdb/cairo/wal/WalWriter.java 1 1 100.00%
🔵 io/questdb/cairo/wal/seq/TableSequencerImpl.java 7 7 100.00%
🔵 io/questdb/cairo/TableUtils.java 3 3 100.00%
🔵 io/questdb/cairo/DefaultCairoConfiguration.java 1 1 100.00%
🔵 io/questdb/cairo/DatabaseSnapshotAgentImpl.java 2 2 100.00%
🔵 io/questdb/ServerMain.java 1 1 100.00%
🔵 io/questdb/PropertyKey.java 2 2 100.00%
🔵 io/questdb/griffin/engine/functions/catalogue/WalTableListFunctionFactory.java 1 1 100.00%
🔵 io/questdb/cairo/wal/seq/TableSequencerAPI.java 2 2 100.00%
🔵 io/questdb/cairo/BinaryAlterSerializer.java 1 1 100.00%
🔵 io/questdb/griffin/SqlCompilerImpl.java 5 5 100.00%
🔵 io/questdb/cutlass/line/udp/AbstractLineProtoUdpReceiver.java 1 1 100.00%
🔵 io/questdb/cairo/DefaultWalJobFactory.java 1 1 100.00%
🔵 io/questdb/cairo/CairoConfigurationWrapper.java 1 1 100.00%
🔵 io/questdb/griffin/engine/ops/AlterOperation.java 1 1 100.00%

@bluestreak01 bluestreak01 merged commit 67d0dab into master Mar 9, 2024
22 checks passed
@bluestreak01 bluestreak01 deleted the feat-chunk-seq-txn-log branch March 9, 2024 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants