[#576] Set SyncWrites for badger writecache by default
Some checks failed
Build / Build Components (1.19) (pull_request) Failing after 3s
Build / Build Components (1.20) (pull_request) Failing after 2s
Tests and linters / Tests (1.19) (pull_request) Failing after 3s
Tests and linters / Tests with -race (pull_request) Failing after 3s
Tests and linters / Lint (pull_request) Failing after 12s
Tests and linters / Staticcheck (pull_request) Failing after 3s
Vulncheck / Vulncheck (pull_request) Successful in 5m46s
Tests and linters / Tests (1.20) (pull_request) Successful in 11m37s
Some checks failed
Build / Build Components (1.19) (pull_request) Failing after 3s
Build / Build Components (1.20) (pull_request) Failing after 2s
Tests and linters / Tests (1.19) (pull_request) Failing after 3s
Tests and linters / Tests with -race (pull_request) Failing after 3s
Tests and linters / Lint (pull_request) Failing after 12s
Tests and linters / Staticcheck (pull_request) Failing after 3s
Vulncheck / Vulncheck (pull_request) Successful in 5m46s
Tests and linters / Tests (1.20) (pull_request) Successful in 11m37s
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
parent
8d589314b5
commit
ae322e9f73
3 changed files with 1 additions and 13 deletions
|
@ -734,7 +734,6 @@ func (c *cfg) getWriteCacheOpts(shCfg shardCfg) writecacheconfig.Options {
|
|||
writecachebadger.WithMaxObjectSize(wcRead.maxObjSize),
|
||||
writecachebadger.WithFlushWorkersCount(wcRead.flushWorkerCount),
|
||||
writecachebadger.WithMaxCacheSize(wcRead.sizeLimit),
|
||||
writecachebadger.WithNoSync(wcRead.noSync),
|
||||
writecachebadger.WithLogger(c.log),
|
||||
writecachebadger.WithGCInterval(wcRead.gcInterval),
|
||||
)
|
||||
|
|
|
@ -47,8 +47,6 @@ type options struct {
|
|||
maxCacheSize uint64
|
||||
// objCounters contains atomic counters for the number of objects stored in cache.
|
||||
objCounters counters
|
||||
// noSync is true iff FSTree allows unsynchronized writes.
|
||||
noSync bool
|
||||
// reportError is the function called when encountering disk errors in background workers.
|
||||
reportError func(string, error)
|
||||
// metrics is metrics implementation
|
||||
|
@ -109,16 +107,6 @@ func WithMaxCacheSize(sz uint64) Option {
|
|||
}
|
||||
}
|
||||
|
||||
// WithNoSync sets an option to allow returning to caller on PUT before write is persisted.
|
||||
// Note, that we use this flag for FSTree only and DO NOT use it for a bolt DB because
|
||||
// we cannot yet properly handle the corrupted database during the startup. This SHOULD NOT
|
||||
// be relied upon and may be changed in future.
|
||||
func WithNoSync(noSync bool) Option {
|
||||
return func(o *options) {
|
||||
o.noSync = noSync
|
||||
}
|
||||
}
|
||||
|
||||
// WithReportErrorFunc sets error reporting function.
|
||||
func WithReportErrorFunc(f func(string, error)) Option {
|
||||
return func(o *options) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
func OpenDB(p string, ro bool, l *logger.Logger) (*badger.DB, error) {
|
||||
return badger.Open(badger.DefaultOptions(p).
|
||||
WithReadOnly(ro).
|
||||
WithSyncWrites(true).
|
||||
WithLoggingLevel(badger.ERROR).
|
||||
WithLogger(badgerLoggerWrapper{l}))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue