-
-
Notifications
You must be signed in to change notification settings - Fork 539
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
Conversation
When Auto GC is enabled, the running sql-server will periodically collect a Dolt database that is growing in size. This behavior is currently experimental. Tuning the behavior around how often to collect is ongoing work.
…s to be more reliable.
… same database as the auto GC work.
@coffeegoddd DOLT
|
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.
LGTM
// delivers when no GC is currently running. | ||
done chan struct{} | ||
// It simplifies the logic and efficiency of the | ||
// implementation a bit to have a |
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.
have a what?
type autoGCCommitHook struct { | ||
c *AutoGCController | ||
name string | ||
// Always non-nil, if this channel delivers this channel |
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.
Bit of a run-on
…ation to also auto-gc.
…test for auto-gc occurring on a standby replica.
…cks, plus gets triggered by a commit hook. This helps handle the stanbdy replica case, where commits come in through remotesrv directly into the ChunkStore, and not through the datas.Database.
… certain errros that arise after a GC.
…s on waitForGC retry.
…mount of garbage produced by replication test to improve speed.
@coffeegoddd DOLT
|
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.
LGTM, just a couple nits
}, nil | ||
} | ||
} else { | ||
totalSz, err := cs.(chunks.TableFileStore).Size(ctx) |
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.
Worth adding an ok check for this type assertion, rather than panic?
if h.lastSz == nil { | ||
h.lastSz = &sz | ||
} | ||
const size_128mb = (1 << 27) |
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.
Threshold values probably should be defined as constants.
Might also consider making these settable via environment vars. A reasonable testing strategy might be running benchmarks / other heavy IO processes multithreaded with a quite low threshold and making sure perf is reasonable / no deadlock happen.
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.
Anything that needs to be tuneable is gonna be tuneable via config.yaml eventually, but this first pass just has them hard coded...
Same for the timer on the periodic check.
return nil | ||
} | ||
|
||
const checkInterval = 100 * time.Millisecond |
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.
This seems really aggressive. Any reason to be this frequent by default?
Also, make configurable via env?
@coffeegoddd DOLT
|
@coffeegoddd DOLT
|
@coffeegoddd DOLT
|
When Auto GC is enabled, the running sql-server will periodically collect a Dolt database that is growing in size. This behavior is currently experimental. Tuning the behavior around how often to collect is ongoing work.