From aac98ec5be16d650be0165d5b56165bc6d9a12ea Mon Sep 17 00:00:00 2001 From: Nathan VanBenschoten Date: Wed, 21 Dec 2022 22:39:28 -0500 Subject: [PATCH] go.mod: bump Pebble to pick up DB.ApplyNoSyncWait Picks up github.com/cockroachdb/pebble/pull/2117. Release note: None Epic: None --- DEPS.bzl | 6 +++--- build/bazelutil/distdir_files.bzl | 2 +- go.mod | 2 ++ go.sum | 4 ++-- pkg/kv/kvserver/spanset/batch.go | 8 ++++++++ pkg/storage/engine.go | 9 +++++++++ pkg/storage/pebble_batch.go | 24 ++++++++++++++++++++++++ 7 files changed, 49 insertions(+), 6 deletions(-) diff --git a/DEPS.bzl b/DEPS.bzl index 2f3eb60099fb..bb62e19a46e3 100644 --- a/DEPS.bzl +++ b/DEPS.bzl @@ -1485,10 +1485,10 @@ def go_deps(): patches = [ "@com_github_cockroachdb_cockroach//build/patches:com_github_cockroachdb_pebble.patch", ], - sha256 = "1bc07fb5a406d3f408e7a58ce0186ff40fc0dc5d996773f465cd593d22e6ce51", - strip_prefix = "github.com/cockroachdb/pebble@v0.0.0-20221221181305-caecab07d786", + sha256 = "0688a209d85935802977716c6772c7969384ab346195c51128aa8f814628b356", + strip_prefix = "github.com/nvanbenschoten/pebble@v0.0.0-20221222033003-850d76c06155", urls = [ - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20221221181305-caecab07d786.zip", + "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/nvanbenschoten/pebble/com_github_nvanbenschoten_pebble-v0.0.0-20221222033003-850d76c06155.zip", ], ) go_repository( diff --git a/build/bazelutil/distdir_files.bzl b/build/bazelutil/distdir_files.bzl index e7d75d1f7fb9..31f80b9f88f3 100644 --- a/build/bazelutil/distdir_files.bzl +++ b/build/bazelutil/distdir_files.bzl @@ -193,7 +193,6 @@ DISTDIR_FILES = { "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/google-api-go-client/com_github_cockroachdb_google_api_go_client-v0.80.1-0.20221117193156-6a9f7150cb93.zip": "b3378c579f4f4340403038305907d672c86f615f8233118a8873ebe4229c4f39", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/gostdlib/com_github_cockroachdb_gostdlib-v1.19.0.zip": "c4d516bcfe8c07b6fc09b8a9a07a95065b36c2855627cb3514e40c98f872b69e", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/logtags/com_github_cockroachdb_logtags-v0.0.0-20211118104740-dabe8e521a4f.zip": "1972c3f171f118add3fd9e64bcea6cbb9959a3b7fa0ada308e8a7310813fea74", - "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/pebble/com_github_cockroachdb_pebble-v0.0.0-20221221181305-caecab07d786.zip": "1bc07fb5a406d3f408e7a58ce0186ff40fc0dc5d996773f465cd593d22e6ce51", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/redact/com_github_cockroachdb_redact-v1.1.3.zip": "7778b1e4485e4f17f35e5e592d87eb99c29e173ac9507801d000ad76dd0c261e", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/returncheck/com_github_cockroachdb_returncheck-v0.0.0-20200612231554-92cdbca611dd.zip": "ce92ba4352deec995b1f2eecf16eba7f5d51f5aa245a1c362dfe24c83d31f82b", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/cockroachdb/sentry-go/com_github_cockroachdb_sentry_go-v0.6.1-cockroachdb.2.zip": "fbb2207d02aecfdd411b1357efe1192dbb827959e36b7cab7491731ac55935c9", @@ -669,6 +668,7 @@ DISTDIR_FILES = { "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/nightlyone/lockfile/com_github_nightlyone_lockfile-v1.0.0.zip": "0abd22d55b704c18426167732414806b2a70d99bce65fa9f943cb88c185689ad", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/nishanths/predeclared/com_github_nishanths_predeclared-v0.0.0-20200524104333-86fad755b4d3.zip": "f3a40ab7d3e0570570e7bc41a6cc7b08b3e23df5ef5f08553ef622a3752d6e03", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/nkovacs/streamquote/com_github_nkovacs_streamquote-v0.0.0-20170412213628-49af9bddb229.zip": "679a789b4b1409ea81054cb12e5f8441199f5fb17d4a2d3510c51f3aa5f3f0cc", + "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/nvanbenschoten/pebble/com_github_nvanbenschoten_pebble-v0.0.0-20221222033003-850d76c06155.zip": "0688a209d85935802977716c6772c7969384ab346195c51128aa8f814628b356", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/nxadm/tail/com_github_nxadm_tail-v1.4.4.zip": "c9bb9d05b3afd1bacc35e7d305a22b07cd7db38f5fabd4ccd95a9227c5709890", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/oklog/oklog/com_github_oklog_oklog-v0.3.2.zip": "b37d032de5b0dd5e96063c06b77fcb29a692a07bd52a4d99a361f2fef68822ec", "https://storage.googleapis.com/cockroach-godeps/gomod/github.com/oklog/run/com_github_oklog_run-v1.1.0.zip": "d6f69fc71aa155043f926c2a98fc1e5b3a8ebab422f2f36d785cfba38a7ebee4", diff --git a/go.mod b/go.mod index 22997220b083..78f84728589b 100644 --- a/go.mod +++ b/go.mod @@ -410,3 +410,5 @@ replace github.com/knz/go-libedit => github.com/otan-cockroach/go-libedit v1.10. replace github.com/docker/docker => github.com/moby/moby v20.10.6+incompatible replace google.golang.org/api v0.80.0 => github.com/cockroachdb/google-api-go-client v0.80.1-0.20221117193156-6a9f7150cb93 + +replace github.com/cockroachdb/pebble => github.com/nvanbenschoten/pebble v0.0.0-20221222033003-850d76c06155 diff --git a/go.sum b/go.sum index c5864a099bbf..a495ee1fe22a 100644 --- a/go.sum +++ b/go.sum @@ -474,8 +474,6 @@ github.com/cockroachdb/gostdlib v1.19.0/go.mod h1:+dqqpARXbE/gRDEhCak6dm0l14AaTy github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f/go.mod h1:i/u985jwjWRlyHXQbwatDASoW0RMlZ/3i9yJHE2xLkI= github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f h1:6jduT9Hfc0njg5jJ1DdKCFPdMBrp/mdZfCpa5h+WM74= github.com/cockroachdb/logtags v0.0.0-20211118104740-dabe8e521a4f/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v0.0.0-20221221181305-caecab07d786 h1:KSCL38HF82L/pXHwetSLd8hYQTdyb84gn7dAoLxFO+s= -github.com/cockroachdb/pebble v0.0.0-20221221181305-caecab07d786/go.mod h1:JsehdjcR1QgLZkqBeYrbVdE3cdxbdrycA/PN+Cg+RNw= github.com/cockroachdb/redact v1.1.3 h1:AKZds10rFSIj7qADf0g46UixK8NNLwWTNdCIGS5wfSQ= github.com/cockroachdb/redact v1.1.3/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/returncheck v0.0.0-20200612231554-92cdbca611dd h1:KFOt5I9nEKZgCnOSmy8r4Oykh8BYQO8bFOTgHDS8YZA= @@ -1759,6 +1757,8 @@ github.com/nightlyone/lockfile v1.0.0 h1:RHep2cFKK4PonZJDdEl4GmkabuhbsRMgk/k3uAm github.com/nightlyone/lockfile v1.0.0/go.mod h1:rywoIealpdNse2r832aiD9jRk8ErCatROs6LzC841CI= github.com/nishanths/predeclared v0.0.0-20200524104333-86fad755b4d3/go.mod h1:nt3d53pc1VYcphSCIaYAJtnPYnr3Zyn8fMq2wvPGPso= github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E= +github.com/nvanbenschoten/pebble v0.0.0-20221222033003-850d76c06155 h1:hse+HD7z2QJr5A9JSHcc9ow2RoTOIhPzGR9+1Wnrf0U= +github.com/nvanbenschoten/pebble v0.0.0-20221222033003-850d76c06155/go.mod h1:JsehdjcR1QgLZkqBeYrbVdE3cdxbdrycA/PN+Cg+RNw= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= diff --git a/pkg/kv/kvserver/spanset/batch.go b/pkg/kv/kvserver/spanset/batch.go index 653b168c9d63..c7a094fe09db 100644 --- a/pkg/kv/kvserver/spanset/batch.go +++ b/pkg/kv/kvserver/spanset/batch.go @@ -742,6 +742,14 @@ func (s spanSetBatch) Commit(sync bool) error { return s.b.Commit(sync) } +func (s spanSetBatch) CommitNoSyncWait() error { + return s.b.CommitNoSyncWait() +} + +func (s spanSetBatch) SyncWait() error { + return s.b.CommitNoSyncWait() +} + func (s spanSetBatch) Empty() bool { return s.b.Empty() } diff --git a/pkg/storage/engine.go b/pkg/storage/engine.go index 9873ed2234ac..dec8211e79cf 100644 --- a/pkg/storage/engine.go +++ b/pkg/storage/engine.go @@ -961,6 +961,15 @@ type Batch interface { // engine. This is a noop unless the batch was created via NewBatch(). If // sync is true, the batch is synchronously committed to disk. Commit(sync bool) error + // CommitNoSyncWait atomically applies any batched updates to the underlying + // engine and initiates a synchronous disk write, but does not wait for that + // write to complete. The caller must call SyncWait to wait for the fsync to + // complete. The caller must not Close the Batch without first calling + // SyncWait. + CommitNoSyncWait() error + // SyncWait waits for the disk write initiated by a call to CommitNoSyncWait + // to complete. + SyncWait() error // Empty returns whether the batch has been written to or not. Empty() bool // Count returns the number of memtable-modifying operations in the batch. diff --git a/pkg/storage/pebble_batch.go b/pkg/storage/pebble_batch.go index 8febdc3a5d7f..e82cc4f7050b 100644 --- a/pkg/storage/pebble_batch.go +++ b/pkg/storage/pebble_batch.go @@ -549,6 +549,30 @@ func (p *pebbleBatch) Commit(sync bool) error { return err } +// CommitNoSyncWait implements the Batch interface. +func (p *pebbleBatch) CommitNoSyncWait() error { + if p.batch == nil { + panic("called with nil batch") + } + err := p.db.ApplyNoSyncWait(p.batch, pebble.Sync) + if err != nil { + panic(err) + } + return err +} + +// SyncWait implements the Batch interface. +func (p *pebbleBatch) SyncWait() error { + if p.batch == nil { + panic("called with nil batch") + } + err := p.batch.SyncWait() + if err != nil { + panic(err) + } + return err +} + // Empty implements the Batch interface. func (p *pebbleBatch) Empty() bool { return p.batch.Count() == 0