Skip to content

chore(wal): non-WAL to WAL, WAL to non-WAL table conversions#2947

Merged
ideoma merged 18 commits intomasterfrom
ia_wal_conv
Jan 27, 2023
Merged

chore(wal): non-WAL to WAL, WAL to non-WAL table conversions#2947
ideoma merged 18 commits intomasterfrom
ia_wal_conv

Conversation

@glasstiger
Copy link
Contributor

@glasstiger glasstiger commented Jan 24, 2023

  • non-WAL to WAL table conversion
  • WAL to non-WAL table conversion

Syntax:

ALTER TABLE <tablename>` SET TYPE WAL;
ALTER TABLE <tablename>` SET TYPE BYPASS WAL;

Alter statement only creates a _convert file in the table directory.
The actual conversion happens on restart when the _convert file is detected.
The file is 1 byte long.

  • 0: convert to non-WAL
  • 1: convert to WAL

If the table is already the requested type no conversion takes place.
_convert file is removed after conversion.

@glasstiger glasstiger marked this pull request as draft January 24, 2023 18:21
@glasstiger glasstiger marked this pull request as ready for review January 25, 2023 21:07
@ideoma
Copy link
Collaborator

ideoma commented Jan 27, 2023

Can we add a test which coverts to WAL and back several times before restart and checks that last command wins?
Also that if WAL table is suspended, conversion to non-WAL still works.

@glasstiger
Copy link
Contributor Author

glasstiger commented Jan 27, 2023

Can we add a test which coverts to WAL and back several times before restart and checks that last command wins?

Have this already.
AlterTableSetTypeTest.testConvertRandom()
Overwrites the _convert file 30 times and checks the content each time.


Also that if WAL table is suspended, conversion to non-WAL still works.

This will not work as it is now.
will try to move the code to create the _convert file from TableWriter to SqlCompiler, as you suggested in another comment.

ideoma
ideoma previously approved these changes Jan 27, 2023
@ideoma
Copy link
Collaborator

ideoma commented Jan 27, 2023

[PR Coverage check]

😍 pass : 224 / 275 (81.45%)

file detail

path covered line new line coverage
🔵 io/questdb/cairo/CairoException.java 0 2 00.00%
🔵 io/questdb/ServerMain.java 1 7 14.29%
🔵 io/questdb/cairo/TableNameRegistryFileStore.java 40 52 76.92%
🔵 io/questdb/cairo/wal/seq/TableSequencerAPI.java 8 10 80.00%
🔵 io/questdb/cairo/TableConverter.java 78 96 81.25%
🔵 io/questdb/cairo/CairoEngine.java 13 16 81.25%
🔵 io/questdb/griffin/SqlCompiler.java 26 32 81.25%
🔵 io/questdb/cairo/TableUtils.java 29 31 93.55%
🔵 io/questdb/Bootstrap.java 9 9 100.00%
🔵 io/questdb/cairo/TableNameRegistry.java 2 2 100.00%
🔵 io/questdb/PropServerConfiguration.java 5 5 100.00%
🔵 io/questdb/cairo/DefaultCairoConfiguration.java 1 1 100.00%
🔵 io/questdb/cairo/TableNameRegistryRW.java 1 1 100.00%
🔵 io/questdb/griffin/CompiledQueryImpl.java 2 2 100.00%
🔵 io/questdb/PropertyKey.java 1 1 100.00%
🔵 io/questdb/cairo/TableNameRegistryRO.java 1 1 100.00%
🔵 io/questdb/griffin/SqlKeywords.java 7 7 100.00%

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