feat(sql): extend create table statement syntax to support "IN VOLUME volume-alias"#2931
Merged
bluestreak01 merged 298 commits intomasterfrom Feb 15, 2023
Merged
feat(sql): extend create table statement syntax to support "IN VOLUME volume-alias"#2931bluestreak01 merged 298 commits intomasterfrom
bluestreak01 merged 298 commits intomasterfrom
Conversation
…I to see what happens
…ze as a masked size, with 62nd bit -> partition read-only
… the package can have access to the maps
…airo when you haven't got access to the volume
…l tests to SqlCompilerTest
ideoma
reviewed
Feb 2, 2023
core/src/main/java/io/questdb/cairo/AbstractTableNameRegistry.java
Outdated
Show resolved
Hide resolved
ideoma
reviewed
Feb 8, 2023
…it needs to be added at runtime with docker run --ulimit. See https://docs.docker.com/engine/reference/commandline/run/#ulimit
ideoma
approved these changes
Feb 15, 2023
Collaborator
[PR Coverage check]😍 pass : 320 / 343 (93.29%) file detail
|
puzpuzpuz
approved these changes
Feb 15, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR proposes a syntax extension for the create table statement.
It addresses the issue #2884 and is complementary to PR #2710 .
Documented https://github.com/questdb/questdb.io/pull/1341
Create table syntax
All these are valid statements (also with WAL, and IF NOT EXISTS):
The with part of the statement can happen independently of the partition by statement, where before it could not. If
in volumeis present along with with, a ',' is required (as if it were part of the with clause). If with is not present, thenin volumemust not have the ',' before it.in volumeis always the last part of the create table statement, it is optional.Because the volume path can be quoted, any name is valid for the alias, including names that contain white space.
Behavior
The table will be created in the target volume, and a symbolik link will be created in the table's standard root folder to point to it. From this point forward the table behaves the same way as if it had been created in the main (default) volume, with one exception,
drop tablewill unlink the table, but the data will remain intact in its volume. This will be a problem if you need to create the table again with the same name in that volume. This is intentional and requires that you go manually to the volume and either rename the table folder, or delete it.Configuration
new server.conf attribute
cairo.volumessupports a comma separated list of entries:where the token before the arrow is an alias to the absolute path found after the arrow. Either token can be optionally single quoted.
aliases are case insensitive, you can use the alias typed the way you want, all variations refer to the same alias.
volume paths must be absolute and must exist at bootstap time, as well as at the time of creating the table.
by default
cairo.volumesis an empty list, which means the feature is disabled.In docker container
Given this Dockerfile:
(you would need to build
questdb-6.7.1-SNAPSHOT-no-jre-bin.tar.gz questdb.tar.gzfrom my branch and place it alongside the other ^ ^ Dockerfile)(you would build the image:
docker build -t io.questdb.play:1.0-SNAPSHOT .)This command will work just fine:
docker run --rm \ -p 8888:8888 \ -p 8812:8812 \ -p 9009:9009 \ -p 9000:9000 \ --name questdb-play \ -v /Users/marregui/QUEST/db:/opt/questdb/db \ -v /Users/marregui/QUEST/notebooks:/opt/notebooks \ -v /Users/marregui/QUEST/backups:/opt/backups \ -v /Users/marregui/QUEST/csv:/opt/csv \ -v /Users/marregui/OTHER/volume0:/opt/volume0 \ -v /Users/marregui/OTHER/volume1:/opt/volume1 \ -it io.questdb.play:1.0-SNAPSHOTsegregating the QuestDB file system at that level of granularity.
Notice the
cairo.volumes=volume0->/opt/volume0, volume1->/opt/volume1"in server.conf .Then these queries will work from the web console:
each table will be in a different volume.