From f467ee6362a92aced5100087cc307e33dcf34572 Mon Sep 17 00:00:00 2001 From: roseduan Date: Fri, 14 Jun 2024 08:48:15 +0800 Subject: [PATCH] update wal --- db.go | 1 - go.mod | 9 ++++----- go.sum | 10 ++++------ merge.go | 3 --- options.go | 6 ------ 5 files changed, 8 insertions(+), 21 deletions(-) diff --git a/db.go b/db.go index e128413c..c3550100 100644 --- a/db.go +++ b/db.go @@ -157,7 +157,6 @@ func (db *DB) openWalFiles() (*wal.WAL, error) { DirPath: db.options.DirPath, SegmentSize: db.options.SegmentSize, SegmentFileExt: dataFileNameSuffix, - BlockCache: db.options.BlockCache, Sync: db.options.Sync, BytesPerSync: db.options.BytesPerSync, }) diff --git a/go.mod b/go.mod index c4b03360..2d2c8674 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module github.com/rosedblabs/rosedb/v2 -go 1.19 +go 1.21 require ( github.com/google/btree v1.1.2 - github.com/rosedblabs/wal v1.3.6-0.20230924022528-3202245af020 + github.com/rosedblabs/wal v1.3.7 github.com/valyala/bytebufferpool v1.0.0 ) @@ -12,7 +12,6 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/robfig/cron/v3 v3.0.0 // indirect golang.org/x/sys v0.11.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v3 v3.0.1 // indirect @@ -21,6 +20,6 @@ require ( require ( github.com/bwmarrin/snowflake v0.3.0 github.com/gofrs/flock v0.8.1 - github.com/hashicorp/golang-lru/v2 v2.0.4 // indirect - github.com/stretchr/testify v1.8.4 + github.com/robfig/cron/v3 v3.0.0 + github.com/stretchr/testify v1.9.0 ) diff --git a/go.sum b/go.sum index 83493971..481a047d 100644 --- a/go.sum +++ b/go.sum @@ -7,8 +7,6 @@ github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/hashicorp/golang-lru/v2 v2.0.4 h1:7GHuZcgid37q8o5i3QI9KMT4nCWQQ3Kx3Ov6bb9MfK0= -github.com/hashicorp/golang-lru/v2 v2.0.4/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -19,10 +17,10 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/robfig/cron/v3 v3.0.0 h1:kQ6Cb7aHOHTSzNVNEhmp8EcWKLb4CbiMW9h9VyIhO4E= github.com/robfig/cron/v3 v3.0.0/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= -github.com/rosedblabs/wal v1.3.6-0.20230924022528-3202245af020 h1:EA8XGCVg1FDM6Dh4MP4sTsmH3gvjhRtp/N+lbnBwtJE= -github.com/rosedblabs/wal v1.3.6-0.20230924022528-3202245af020/go.mod h1:wdq54KJUyVTOv1uddMc6Cdh2d/YCIo8yjcwJAb1RCEM= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/rosedblabs/wal v1.3.7 h1:ZB/xczf+/fEwbjbPnC/A6DLZRx0rxKgtQsWw2+SxKDg= +github.com/rosedblabs/wal v1.3.7/go.mod h1:DFvhrmTTeiXvn2btXXT2MW9Nvu99PU0g/pKGgh0+T+o= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= diff --git a/merge.go b/merge.go index 85c72712..90031032 100644 --- a/merge.go +++ b/merge.go @@ -196,7 +196,6 @@ func (db *DB) openMergeDB() (*DB, error) { SegmentFileExt: hintFileNameSuffix, Sync: false, BytesPerSync: 0, - BlockCache: 0, }) if err != nil { return nil, err @@ -218,7 +217,6 @@ func (db *DB) openMergeFinishedFile() (*wal.WAL, error) { SegmentFileExt: mergeFinNameSuffix, Sync: false, BytesPerSync: 0, - BlockCache: 0, }) } @@ -327,7 +325,6 @@ func (db *DB) loadIndexFromHintFile() error { // we don't need to rotate the hint file, just write all data to the same file. SegmentSize: math.MaxInt64, SegmentFileExt: hintFileNameSuffix, - BlockCache: 32 * KB * 10, }) if err != nil { return err diff --git a/options.go b/options.go index e8be46e3..2987ae95 100644 --- a/options.go +++ b/options.go @@ -10,11 +10,6 @@ type Options struct { // SegmentSize specifies the maximum size of each segment file in bytes. SegmentSize int64 - // BlockCache specifies the size of the block cache in number of bytes. - // A block cache is used to store recently accessed data blocks, improving read performance. - // If BlockCache is set to 0, no block cache will be used. - BlockCache uint32 - // Sync is whether to synchronize writes through os buffer cache and down onto the actual disk. // Setting sync is required for durability of a single write operation, but also results in slower writes. // @@ -62,7 +57,6 @@ const ( var DefaultOptions = Options{ DirPath: tempDBDir(), SegmentSize: 1 * GB, - BlockCache: 0, Sync: false, BytesPerSync: 0, WatchQueueSize: 0,