From dcd211d811571c4cd826b3144478506ef28ab9d3 Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Thu, 7 Sep 2023 16:04:31 +0400 Subject: [PATCH 1/4] disable leveldb as LID default --- node/config/def.go | 3 +++ node/config/types.go | 5 +++++ node/modules/piecedirectory.go | 7 ++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/node/config/def.go b/node/config/def.go index 5385611b0..8c073eb47 100644 --- a/node/config/def.go +++ b/node/config/def.go @@ -83,6 +83,9 @@ func DefaultBoost() *Boost { Yugabyte: LocalIndexDirectoryYugabyteConfig{ Enabled: false, }, + Leveldb: LocalIndexDirectoryLeveldbConfig{ + Enabled: false, + }, ParallelAddIndexLimit: 4, EmbeddedServicePort: 8042, ServiceApiInfo: "", diff --git a/node/config/types.go b/node/config/types.go index 90ea0fcb0..d056ef62c 100644 --- a/node/config/types.go +++ b/node/config/types.go @@ -401,6 +401,7 @@ type LocalIndexDirectoryYugabyteConfig struct { type LocalIndexDirectoryConfig struct { Yugabyte LocalIndexDirectoryYugabyteConfig + Leveldb LocalIndexDirectoryLeveldbConfig // The maximum number of add index operations allowed to execute in parallel. // The add index operation is executed when a new deal is created - it fetches // the piece from the sealing subsystem, creates an index of where each block @@ -416,3 +417,7 @@ type LocalIndexDirectoryConfig struct { // The RPC timeout when making requests to the boostd-data service ServiceRPCTimeout Duration } + +type LocalIndexDirectoryLeveldbConfig struct { + Enabled bool +} diff --git a/node/modules/piecedirectory.go b/node/modules/piecedirectory.go index 54e95560d..a4c848f01 100644 --- a/node/modules/piecedirectory.go +++ b/node/modules/piecedirectory.go @@ -73,7 +73,7 @@ func NewPieceDirectoryStore(cfg *config.Boost) func(lc fx.Lifecycle, r lotus_rep migrator := yugabyte.NewMigrator(settings, address.Address(maddr)) bdsvc = svc.NewYugabyte(settings, migrator) - default: + case cfg.LocalIndexDirectory.Leveldb.Enabled: log.Infow("local index directory: connecting to leveldb instance") // Setup a local index directory service that connects to the leveldb @@ -82,6 +82,11 @@ func NewPieceDirectoryStore(cfg *config.Boost) func(lc fx.Lifecycle, r lotus_rep if err != nil { return fmt.Errorf("creating leveldb local index directory: %w", err) } + + default: + return fmt.Errorf("starting local index directory client:" + + "either LocalIndexDirectory.Yugabyte{} details must be defined or " + + "LocalIndexDirectory.Leveldb must be enabled") } // Start the embedded local index directory service From 3b78cf6b18a9f250519807f3bd3c2ee328638cc7 Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Thu, 7 Sep 2023 16:36:06 +0400 Subject: [PATCH 2/4] fix docsgen and itests --- node/config/doc_gen.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/node/config/doc_gen.go b/node/config/doc_gen.go index 103f87031..631c1c67e 100644 --- a/node/config/doc_gen.go +++ b/node/config/doc_gen.go @@ -583,6 +583,12 @@ Note that this port must be open on the firewall.`, Comment: ``, }, + { + Name: "Leveldb", + Type: "LocalIndexDirectoryLeveldbConfig", + + Comment: ``, + }, { Name: "ParallelAddIndexLimit", Type: "int", @@ -614,6 +620,14 @@ Set this value to "" if the local index directory data service is embedded.`, Comment: `The RPC timeout when making requests to the boostd-data service`, }, }, + "LocalIndexDirectoryLeveldbConfig": []DocField{ + { + Name: "Enabled", + Type: "bool", + + Comment: ``, + }, + }, "LocalIndexDirectoryYugabyteConfig": []DocField{ { Name: "Enabled", From a1f398b09c4fb1b9333a177891170b1cf6edb63b Mon Sep 17 00:00:00 2001 From: LexLuthr Date: Thu, 7 Sep 2023 16:41:12 +0400 Subject: [PATCH 3/4] fix itest --- itests/framework/framework.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/itests/framework/framework.go b/itests/framework/framework.go index 655e3f2f7..ea76b491f 100644 --- a/itests/framework/framework.go +++ b/itests/framework/framework.go @@ -342,6 +342,9 @@ func (f *TestFramework) Start(opts ...ConfigOpt) error { cfg.Dealmaking.ExpectedSealDuration = 10 + // Enable LID with leveldb + cfg.LocalIndexDirectory.Leveldb.Enabled = true + err = lr.SetConfig(func(raw interface{}) { rcfg := raw.(*config.Boost) *rcfg = *cfg From 501e6375dc5ff6abf612fd1b030abc5deb5ee6fe Mon Sep 17 00:00:00 2001 From: LexLuthr <88259624+LexLuthr@users.noreply.github.com> Date: Thu, 7 Sep 2023 17:10:12 +0400 Subject: [PATCH 4/4] Update node/modules/piecedirectory.go Co-authored-by: dirkmc --- node/modules/piecedirectory.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/node/modules/piecedirectory.go b/node/modules/piecedirectory.go index a4c848f01..53910af1d 100644 --- a/node/modules/piecedirectory.go +++ b/node/modules/piecedirectory.go @@ -84,9 +84,10 @@ func NewPieceDirectoryStore(cfg *config.Boost) func(lc fx.Lifecycle, r lotus_rep } default: - return fmt.Errorf("starting local index directory client:" + - "either LocalIndexDirectory.Yugabyte{} details must be defined or " + - "LocalIndexDirectory.Leveldb must be enabled") + return fmt.Errorf("starting local index directory client: " + + "neither yugabyte nor leveldb is enabled in config - " + + "you must explicitly configure either LocalIndexDirectory.Yugabyte "+ + "or LocalIndexDirectory.Leveldb as the local index directory implementation") } // Start the embedded local index directory service