Skip to content

Commit

Permalink
db: rename Experimental.SharedStorage to RemoteStorage in Options
Browse files Browse the repository at this point in the history
  • Loading branch information
RaduBerinde committed Jul 21, 2023
1 parent c62c912 commit 94f9166
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion cmd/pebble/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func newPebbleDB(dir string) DB {
}

if pathToLocalSharedStorage != "" {
opts.Experimental.SharedStorage = remote.MakeSimpleFactory(map[remote.Locator]remote.Storage{
opts.Experimental.RemoteStorage = remote.MakeSimpleFactory(map[remote.Locator]remote.Storage{
// Store all shared objects on local disk, for convenience.
"": remote.NewLocalFS(pathToLocalSharedStorage, vfs.Default),
})
Expand Down
2 changes: 1 addition & 1 deletion compaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3881,7 +3881,7 @@ func TestCompaction_LogAndApplyFails(t *testing.T) {
func TestSharedObjectDeletePacing(t *testing.T) {
var opts Options
opts.FS = vfs.NewMem()
opts.Experimental.SharedStorage = remote.MakeSimpleFactory(map[remote.Locator]remote.Storage{
opts.Experimental.RemoteStorage = remote.MakeSimpleFactory(map[remote.Locator]remote.Storage{
"": remote.NewInMem(),
})
opts.Experimental.CreateOnShared = true
Expand Down
2 changes: 1 addition & 1 deletion db.go
Original file line number Diff line number Diff line change
Expand Up @@ -2567,7 +2567,7 @@ func firstError(err0, err1 error) error {
// Does nothing if SharedStorage was not set in the options when the DB was
// opened or if the DB is in read-only mode.
func (d *DB) SetCreatorID(creatorID uint64) error {
if d.opts.Experimental.SharedStorage == nil || d.opts.ReadOnly {
if d.opts.Experimental.RemoteStorage == nil || d.opts.ReadOnly {
return nil
}
return d.objProvider.SetCreatorID(objstorage.CreatorID(creatorID))
Expand Down
2 changes: 1 addition & 1 deletion ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ func (d *DB) ingest(
shared []SharedSSTMeta,
exciseSpan KeyRange,
) (IngestOperationStats, error) {
if len(shared) > 0 && d.opts.Experimental.SharedStorage == nil {
if len(shared) > 0 && d.opts.Experimental.RemoteStorage == nil {
panic("cannot ingest shared sstables with nil SharedStorage")
}
if (exciseSpan.Valid() || len(shared) > 0) && d.opts.FormatMajorVersion < ExperimentalFormatVirtualSSTables {
Expand Down
6 changes: 3 additions & 3 deletions ingest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ func TestIngestShared(t *testing.T) {
DebugCheck: DebugCheckLevels,
FormatMajorVersion: ExperimentalFormatVirtualSSTables,
}
opts1.Experimental.SharedStorage = remote.MakeSimpleFactory(map[remote.Locator]remote.Storage{
opts1.Experimental.RemoteStorage = remote.MakeSimpleFactory(map[remote.Locator]remote.Storage{
"": sstorage,
})
opts1.Experimental.CreateOnShared = true
Expand All @@ -790,7 +790,7 @@ func TestIngestShared(t *testing.T) {

opts2 := &Options{}
*opts2 = *opts1
opts2.Experimental.SharedStorage = remote.MakeSimpleFactory(map[remote.Locator]remote.Storage{
opts2.Experimental.RemoteStorage = remote.MakeSimpleFactory(map[remote.Locator]remote.Storage{
"": sstorage,
})
opts2.Experimental.CreateOnShared = true
Expand Down Expand Up @@ -1059,7 +1059,7 @@ func TestSimpleIngestShared(t *testing.T) {
L0CompactionThreshold: 100,
L0StopWritesThreshold: 100,
}
opts.Experimental.SharedStorage = providerSettings.Shared.StorageFactory
opts.Experimental.RemoteStorage = providerSettings.Shared.StorageFactory
opts.Experimental.CreateOnShared = providerSettings.Shared.CreateOnShared
opts.Experimental.CreateOnSharedLocator = providerSettings.Shared.CreateOnSharedLocator

Expand Down
4 changes: 2 additions & 2 deletions metamorphic/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func parseOptions(
return true
case "TestOptions.shared_storage_enabled":
opts.sharedStorageEnabled = true
opts.Opts.Experimental.SharedStorage = remote.MakeSimpleFactory(map[remote.Locator]remote.Storage{
opts.Opts.Experimental.RemoteStorage = remote.MakeSimpleFactory(map[remote.Locator]remote.Storage{
"": remote.NewInMem(),
})
opts.Opts.Experimental.CreateOnShared = true
Expand Down Expand Up @@ -500,7 +500,7 @@ func randomOptions(
// 20% of time, enable shared storage.
if rng.Intn(5) == 0 {
testOpts.sharedStorageEnabled = true
testOpts.Opts.Experimental.SharedStorage = remote.MakeSimpleFactory(map[remote.Locator]remote.Storage{
testOpts.Opts.Experimental.RemoteStorage = remote.MakeSimpleFactory(map[remote.Locator]remote.Storage{
"": remote.NewInMem(),
})
testOpts.Opts.Experimental.CreateOnShared = true
Expand Down
2 changes: 1 addition & 1 deletion metamorphic/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestOptionsRoundtrip(t *testing.T) {
"MaxConcurrentCompactions:",
"Experimental.EnableValueBlocks:",
"Experimental.DisableIngestAsFlushable:",
"Experimental.SharedStorage:",
"Experimental.RemoteStorage:",
// Floating points
"Experimental.PointTombstoneWeight:",
}
Expand Down
2 changes: 1 addition & 1 deletion open.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ func Open(dirname string, opts *Options) (db *DB, _ error) {
NoSyncOnClose: opts.NoSyncOnClose,
BytesPerSync: opts.BytesPerSync,
}
providerSettings.Shared.StorageFactory = opts.Experimental.SharedStorage
providerSettings.Shared.StorageFactory = opts.Experimental.RemoteStorage
providerSettings.Shared.CreateOnShared = opts.Experimental.CreateOnShared
providerSettings.Shared.CreateOnSharedLocator = opts.Experimental.CreateOnSharedLocator
providerSettings.Shared.CacheSizeBytes = opts.Experimental.SecondaryCacheSize
Expand Down
24 changes: 12 additions & 12 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -653,18 +653,18 @@ type Options struct {
// major version is at least `FormatFlushableIngest`.
DisableIngestAsFlushable func() bool

// SharedStorage is a second FS-like storage medium that can be shared
// between multiple Pebble instances. It is used to store sstables only, and
// is managed by objstorage.Provider. Each sstable might only be written to
// by one Pebble instance, but other Pebble instances can possibly read the
// same files if they have the path to get to them. The pebble instance that
// wrote a file should not delete it if other Pebble instances are known to
// be reading this file. This FS is expected to have slower read/write
// performance than the default FS above.
SharedStorage remote.StorageFactory

// If CreateOnShred is true, any new sstables are created on shared storage,
// using CreateOnSharedLocator. Can only be used when SharedStorage is set.
// RemoteStorage enables use of remote storage (e.g. S3) for storing
// sstables. Setting this option enables use of CreateOnShared option and
// allows ingestion of external files.
RemoteStorage remote.StorageFactory

// If CreateOnShared is true, any new sstables are created on remote storage
// (using CreateOnSharedLocator). These sstables can be shared between
// different Pebble instances; the lifecycle of such objects is managed by
// the cluster.
//
// Can only be used when RemoteStorage is set (and recognizes
// CreateOnSharedLocator).
CreateOnShared bool
CreateOnSharedLocator remote.Locator

Expand Down
2 changes: 1 addition & 1 deletion scan_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestScanInternal(t *testing.T) {
sstable.NewTestKeysBlockPropertyCollector,
},
}
opts.Experimental.SharedStorage = remote.MakeSimpleFactory(map[remote.Locator]remote.Storage{
opts.Experimental.RemoteStorage = remote.MakeSimpleFactory(map[remote.Locator]remote.Storage{
"": remote.NewInMem(),
})
opts.Experimental.CreateOnShared = true
Expand Down
2 changes: 1 addition & 1 deletion tool/tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func New(opts ...Option) *T {
func (t *T) ConfigureSharedStorage(
s remote.StorageFactory, createOnShared bool, createOnSharedLocator remote.Locator,
) {
t.opts.Experimental.SharedStorage = s
t.opts.Experimental.RemoteStorage = s
t.opts.Experimental.CreateOnShared = createOnShared
t.opts.Experimental.CreateOnSharedLocator = createOnSharedLocator
}

0 comments on commit 94f9166

Please sign in to comment.