Skip to content

Commit 9f2423c

Browse files
committed
FAB-15086 Replace GetMaxBlockFileSize w/ constant
ledgerconfig.GetMaxBlockFileSize returns a fixed value. Simply replace with a constant at place of use in ledgerstorage. Change-Id: Ib61336d0aaced42d98f8e189725ed007d05cb39f Signed-off-by: Gari Singh <gari.r.singh@gmail.com>
1 parent 39c2a56 commit 9f2423c

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

core/ledger/ledgerconfig/ledger_config.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,6 @@ func GetCouchdbRedologsPath() string {
8484
return filepath.Join(GetRootPath(), couchdbRedoLogPath)
8585
}
8686

87-
// GetMaxBlockfileSize returns maximum size of the block file
88-
func GetMaxBlockfileSize() int {
89-
return 64 * 1024 * 1024
90-
}
91-
9287
// GetTotalQueryLimit exposes the totalLimit variable
9388
func GetTotalQueryLimit() int {
9489
totalQueryLimit := viper.GetInt(confTotalQueryLimit)

core/ledger/ledgerconfig/ledger_config_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,6 @@ func TestIsHistoryDBEnabledFalse(t *testing.T) {
156156
assert.False(t, updatedValue) //test config returns false
157157
}
158158

159-
func TestGetMaxBlockfileSize(t *testing.T) {
160-
assert.Equal(t, 67108864, GetMaxBlockfileSize())
161-
}
162-
163159
func setUpCoreYAMLConfig() {
164160
//call a helper method to load the core.yaml
165161
ledgertestutil.SetupCoreYAMLConfig()

core/ledger/ledgerstorage/store.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import (
2121
"github.com/pkg/errors"
2222
)
2323

24+
const maxBlockFileSize = 64 * 1024 * 1024
25+
2426
var logger = flogging.MustGetLogger("ledgerstorage")
2527

2628
// Provider encapusaltes two providers 1) block store provider and 2) and pvt data store provider
@@ -49,7 +51,7 @@ func NewProvider() *Provider {
4951
}
5052
indexConfig := &blkstorage.IndexConfig{AttrsToIndex: attrsToIndex}
5153
blockStoreProvider := fsblkstorage.NewProvider(
52-
fsblkstorage.NewConf(ledgerconfig.GetBlockStorePath(), ledgerconfig.GetMaxBlockfileSize()),
54+
fsblkstorage.NewConf(ledgerconfig.GetBlockStorePath(), maxBlockFileSize),
5355
indexConfig)
5456

5557
pvtStoreProvider := pvtdatastorage.NewProvider()

core/ledger/ledgerstorage/store_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func TestStoreWithExistingBlockchain(t *testing.T) {
123123
}
124124
indexConfig := &blkstorage.IndexConfig{AttrsToIndex: attrsToIndex}
125125
blockStoreProvider := fsblkstorage.NewProvider(
126-
fsblkstorage.NewConf(ledgerconfig.GetBlockStorePath(), ledgerconfig.GetMaxBlockfileSize()),
126+
fsblkstorage.NewConf(ledgerconfig.GetBlockStorePath(), maxBlockFileSize),
127127
indexConfig)
128128

129129
blkStore, err := blockStoreProvider.OpenBlockStore(testLedgerid)

0 commit comments

Comments
 (0)