-
-
Notifications
You must be signed in to change notification settings - Fork 596
go: cmd/dolt: sql.go: Enable Auto GC when running dolt sql.
#9726
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0516d5d
bats: Add a failing bats test demonstrating that SQL imports through …
reltuk 0510550
go/cmd/dolt: commands/sql: Enable Auto GC for dolt sql.
reltuk 2fb5423
go: cmd/dolt: sql.go: Add a flag that allows disabling auto-gc.
reltuk 4e6b1af
[ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/upda…
reltuk 09bcb61
go: doltcore/sqle: auto_gc: Avoid deadlocking if background threads s…
reltuk f45ad2a
Update go/libraries/doltcore/sqle/auto_gc.go
reltuk c2cf39e
Update go/libraries/doltcore/sqle/auto_gc.go
reltuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| function randint(n) | ||
| { | ||
| return int(n * rand()) | ||
| } | ||
| function valueslines(n) | ||
| { | ||
| end = ")," | ||
| for (i = 0; i < n; i++) { | ||
| if (i == n-1) { | ||
| end = ");" | ||
| } | ||
| print "(" randint(65536) ",", randint(65536) ",", randint(65536) ",", randint(65536) end; | ||
| } | ||
| } | ||
| BEGIN { | ||
| print "DROP TABLE IF EXISTS vals;"; | ||
| print "CREATE TABLE vals (c1 int, c2 int, c3 int, c4 int);"; | ||
| for (j = 0; j < 256; j++) { | ||
| print "INSERT INTO vals VALUES"; | ||
| valueslines(1024); | ||
| } | ||
| } | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!/usr/bin/env bats | ||
| load $BATS_TEST_DIRNAME/helper/common.bash | ||
|
|
||
| setup() { | ||
| setup_common | ||
| } | ||
|
|
||
| teardown() { | ||
| assert_feature_version | ||
| teardown_common | ||
| } | ||
|
|
||
| @test "sql-auto-gc: import through 'dolt sql' runs auto gc" { | ||
| if [ "$SQL_ENGINE" = "remote-engine" ]; then | ||
| skip "dolt sql does not control auto GC behavior when in remote mode" | ||
| fi | ||
|
|
||
| before=$(du -sk .dolt | awk '{print $1}') | ||
| awk -f $BATS_TEST_DIRNAME/gen_vals.awk | dolt sql | ||
| after=$(du -sk .dolt | awk '{print $1}') | ||
| [[ after-before -lt 524288 ]] || (echo ".dolt should be less than 512MB after the import" && false) | ||
| tablefiles=$(ls -1 .dolt/noms/ | egrep '[0-9a-v]{32}' | egrep -v 'v{32}') | ||
| [[ $(echo "$tablefiles" | wc -l) -eq 1 ]] || (echo ".dolt/noms should have one table file" && false) | ||
| } | ||
|
|
||
| @test "sql-auto-gc: import through 'dolt sql' can disable auto gc" { | ||
| if [ "$SQL_ENGINE" = "remote-engine" ]; then | ||
| skip "dolt sql does not control auto GC behavior when in remote mode" | ||
| fi | ||
|
|
||
| before=$(du -sk .dolt | awk '{print $1}') | ||
| awk -f $BATS_TEST_DIRNAME/gen_vals.awk | dolt sql --disable-auto-gc | ||
| after=$(du -sk .dolt | awk '{print $1}') | ||
| [[ after-before -gt 524288 ]] || (echo ".dolt should be more than 512MB after the import" && false) | ||
| if ls -1 .dolt/noms/ | egrep '[0-9a-v]{32}' | egrep -v 'v{32}'; then | ||
| echo ".dolt/noms should have two non-journal table files"; | ||
| false | ||
| fi | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.