forked from TrueCloudLab/frostfs-node
[#576] Set SyncWrites for badger writecache by default
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.WithMaxObjectSize(wcRead.maxObjSize),
|
||||||
writecachebadger.WithFlushWorkersCount(wcRead.flushWorkerCount),
|
writecachebadger.WithFlushWorkersCount(wcRead.flushWorkerCount),
|
||||||
writecachebadger.WithMaxCacheSize(wcRead.sizeLimit),
|
writecachebadger.WithMaxCacheSize(wcRead.sizeLimit),
|
||||||
writecachebadger.WithNoSync(wcRead.noSync),
|
|
||||||
writecachebadger.WithLogger(c.log),
|
writecachebadger.WithLogger(c.log),
|
||||||
writecachebadger.WithGCInterval(wcRead.gcInterval),
|
writecachebadger.WithGCInterval(wcRead.gcInterval),
|
||||||
)
|
)
|
||||||
|
|
|
@ -47,8 +47,6 @@ type options struct {
|
||||||
maxCacheSize uint64
|
maxCacheSize uint64
|
||||||
// objCounters contains atomic counters for the number of objects stored in cache.
|
// objCounters contains atomic counters for the number of objects stored in cache.
|
||||||
objCounters counters
|
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 is the function called when encountering disk errors in background workers.
|
||||||
reportError func(string, error)
|
reportError func(string, error)
|
||||||
// metrics is metrics implementation
|
// 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.
|
// WithReportErrorFunc sets error reporting function.
|
||||||
func WithReportErrorFunc(f func(string, error)) Option {
|
func WithReportErrorFunc(f func(string, error)) Option {
|
||||||
return func(o *options) {
|
return func(o *options) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
func OpenDB(p string, ro bool, l *logger.Logger) (*badger.DB, error) {
|
func OpenDB(p string, ro bool, l *logger.Logger) (*badger.DB, error) {
|
||||||
return badger.Open(badger.DefaultOptions(p).
|
return badger.Open(badger.DefaultOptions(p).
|
||||||
WithReadOnly(ro).
|
WithReadOnly(ro).
|
||||||
|
WithSyncWrites(true).
|
||||||
WithLoggingLevel(badger.ERROR).
|
WithLoggingLevel(badger.ERROR).
|
||||||
WithLogger(badgerLoggerWrapper{l}))
|
WithLogger(badgerLoggerWrapper{l}))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue