-
-
Notifications
You must be signed in to change notification settings - Fork 537
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
sql-server: Add behavior: auto_gc_behavior: enable. #8849
Open
reltuk
wants to merge
17
commits into
main
Choose a base branch
from
aaron/autogc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
dc4b94d
sql-server: Add behavior: auto_gc_behavior: enable.
reltuk 9b53d20
go: cmd: sqlserver: Fix nil SIGSEGV on AutoGCBehavior read in init.
reltuk 62e5032
integration-tests/go-sql-server-driver: auto_gc_test.go: Tweak assert…
reltuk f509d98
go: sqle: auto_gc.go: Make sure the safepoint controller works on the…
reltuk 10dfcec
[ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/upda…
reltuk 2a47d40
go: sqle: auto_gc: Responding to PR feedback. Comments and cleanup.
reltuk 7c9c808
Merge remote-tracking branch 'origin/main' into aaron/autogc
reltuk 1e20b67
Merge remote-tracking branch 'origin/main' into aaron/autogc
reltuk 20f38ca
Merge remote-tracking branch 'origin/main' into aaron/autogc
reltuk 69630e1
go: auto_gc: Add a heuristic which allows followers in cluster replic…
reltuk 1438933
integration-tests: go-sql-server-driver: auto_gc_test: Add a skipped …
reltuk efb5edc
go: sqle: auto_gc: Move to a background thread which periodically che…
reltuk 97fd0f8
Merge remote-tracking branch 'origin/main' into aaron/autogc
reltuk e4a4b5d
go: store,remotesrv: Improve logging. Improve gRPC error statuses for…
reltuk 4ce49e6
go: store/nbs: store.go: Fix GetManyCompressed to not redeliver chunk…
reltuk 837ae43
integration-tests/go-sql-server-driver: auto_gc_test.go: Bring down a…
reltuk 36b39df
Merge remote-tracking branch 'origin/main' into aaron/autogc
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 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 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 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 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 |
---|---|---|
|
@@ -1917,23 +1917,71 @@ func (ddb *DoltDB) IsTableFileStore() bool { | |
|
||
// ChunkJournal returns the ChunkJournal for this DoltDB, if one is in use. | ||
func (ddb *DoltDB) ChunkJournal() *nbs.ChunkJournal { | ||
tableFileStore, ok := datas.ChunkStoreFromDatabase(ddb.db).(chunks.TableFileStore) | ||
if !ok { | ||
return nil | ||
} | ||
cs := datas.ChunkStoreFromDatabase(ddb.db) | ||
|
||
generationalNbs, ok := tableFileStore.(*nbs.GenerationalNBS) | ||
if !ok { | ||
return nil | ||
if generationalNBS, ok := cs.(*nbs.GenerationalNBS); ok { | ||
cs = generationalNBS.NewGen() | ||
} | ||
|
||
newGen := generationalNbs.NewGen() | ||
nbs, ok := newGen.(*nbs.NomsBlockStore) | ||
if !ok { | ||
if nbsStore, ok := cs.(*nbs.NomsBlockStore); ok { | ||
return nbsStore.ChunkJournal() | ||
} else { | ||
return nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't this impossible? Store is set in both cases above |
||
} | ||
} | ||
|
||
// An approximate representation of how large the on-disk storage is for a DoltDB. | ||
type StoreSizes struct { | ||
// For ChunkJournal stores, this will be size of the journal file. A size | ||
// of zero does not mean the store is not journaled. The store could be | ||
// journaled, and the journal could be empty. | ||
JournalBytes uint64 | ||
// For Generational storages this will be the size of the new gen. It will | ||
// include any JournalBytes. A size of zero does not mean the store is not | ||
// generational, since it could be the case that the store is generational | ||
// but everything in it is in the old gen. In practice, given how we build | ||
// oldgen references today, this will never be the case--there is always | ||
// a little bit of data that only goes in the newgen. | ||
NewGenBytes uint64 | ||
// This is the approximate total on-disk storage overhead of the store. | ||
// It includes Journal and NewGenBytes, if there are any. | ||
TotalBytes uint64 | ||
} | ||
|
||
return nbs.ChunkJournal() | ||
func (ddb *DoltDB) StoreSizes(ctx context.Context) (StoreSizes, error) { | ||
cs := datas.ChunkStoreFromDatabase(ddb.db) | ||
if generationalNBS, ok := cs.(*nbs.GenerationalNBS); ok { | ||
newgen := generationalNBS.NewGen() | ||
newgenSz, err := newgen.(chunks.TableFileStore).Size(ctx) | ||
if err != nil { | ||
return StoreSizes{}, err | ||
} | ||
totalSz, err := cs.(chunks.TableFileStore).Size(ctx) | ||
if err != nil { | ||
return StoreSizes{}, err | ||
} | ||
journal := newgen.(*nbs.NomsBlockStore).ChunkJournal() | ||
if journal != nil { | ||
return StoreSizes{ | ||
JournalBytes: uint64(journal.Size()), | ||
NewGenBytes: newgenSz, | ||
TotalBytes: totalSz, | ||
}, nil | ||
} else { | ||
return StoreSizes{ | ||
NewGenBytes: newgenSz, | ||
TotalBytes: totalSz, | ||
}, nil | ||
} | ||
} else { | ||
totalSz, err := cs.(chunks.TableFileStore).Size(ctx) | ||
if err != nil { | ||
return StoreSizes{}, err | ||
} | ||
return StoreSizes{ | ||
TotalBytes: totalSz, | ||
}, nil | ||
} | ||
} | ||
|
||
func (ddb *DoltDB) TableFileStoreHasJournal(ctx context.Context) (bool, error) { | ||
|
This file contains 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 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 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might add a note why making a copy here is important