Skip to content

Commit 5e0f280

Browse files
author
Chris Elder
committed
[FAB-3185] move historyDatabase to ledger in core.yaml
historyDatabase is under 'state' section in core.yaml. 'history' should be a peer of 'state', with the config option being called something like enableHistoryDatabase. This will allow for other history config options distinct from state config options. This is the default core.yaml with the new history section and enableHistoryDatabase config option: ledger: blockchain: state: # stateDatabase - options are "goleveldb", "CouchDB" # goleveldb - default state database stored in goleveldb. # CouchDB - store state database in CouchDB stateDatabase: goleveldb couchDBConfig: couchDBAddress: 127.0.0.1:5984 username: password: # Number of retries for CouchDB errors maxRetries: 3 # Number of retries for CouchDB errors during peer startup maxRetriesOnStartup: 10 # CouchDB request timeout (unit: duration, e.g. 20s) requestTimeout: 20s # Limit on the number of records to return per query queryLimit: 10000 history: # enableHistoryDatabase - options are true or false # Indicates if the history of key updates should be stored in goleveldb enableHistoryDatabase: true The history section in chaincodetest.yaml is not used, update it for consistency. Change-Id: I15ac35e280dbf194647ca0c866fcbee515af8a68 Signed-off-by: Chris Elder <[email protected]>
1 parent 7f336b9 commit 5e0f280

File tree

7 files changed

+16
-15
lines changed

7 files changed

+16
-15
lines changed

core/chaincode/chaincodetest.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -435,14 +435,14 @@ ledger:
435435
# CouchDB request timeout (unit: duration, e.g. 20s)
436436
requestTimeout: 20s
437437

438-
439-
# historyDatabase - options are true or false
440-
# Indicates if the history of key updates should be stored in goleveldb
441-
historyDatabase: true
442-
443438
# Limit on the number of records to return per query
444439
queryLimit: 10000
445440

441+
history:
442+
# enableHistoryDatabase - options are true or false
443+
# Indicates if the history of key updates should be stored in goleveldb
444+
enableHistoryDatabase: true
445+
446446

447447
################################################################################
448448
#

core/ledger/kvledger/history/historydb/historyleveldb/historyleveldb_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ func TestHistoryDisabled(t *testing.T) {
195195
env := NewTestHistoryEnv(t)
196196
defer env.cleanup()
197197

198-
viper.Set("ledger.state.historyDatabase", "false")
198+
viper.Set("ledger.history.enableHistoryDatabase", "false")
199199

200200
//no need to pass blockstore into history executore, it won't be used in this test
201201
qhistory, err := env.testHistoryDB.NewHistoryQueryExecutor(nil)

core/ledger/kvledger/history/historydb/historyleveldb/pkg_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type levelDBLockBasedHistoryEnv struct {
4545

4646
func NewTestHistoryEnv(t *testing.T) *levelDBLockBasedHistoryEnv {
4747

48-
viper.Set("ledger.state.historyDatabase", "true")
48+
viper.Set("ledger.history.enableHistoryDatabase", "true")
4949

5050
blockStorageTestEnv := newBlockStorageTestEnv(t)
5151

core/ledger/ledgerconfig/ledger_config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func GetQueryLimit() int {
9999

100100
//IsHistoryDBEnabled exposes the historyDatabase variable
101101
func IsHistoryDBEnabled() bool {
102-
return viper.GetBool("ledger.state.historyDatabase")
102+
return viper.GetBool("ledger.history.enableHistoryDatabase")
103103
}
104104

105105
// IsQueryReadsHashingEnabled enables or disables computing of hash

core/ledger/ledgerconfig/ledger_config_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ func TestIsHistoryDBEnabledDefault(t *testing.T) {
6969
func TestIsHistoryDBEnabledTrue(t *testing.T) {
7070
setUpCoreYAMLConfig()
7171
defer ledgertestutil.ResetConfigToDefaultValues()
72-
viper.Set("ledger.state.historyDatabase", true)
72+
viper.Set("ledger.history.enableHistoryDatabase", true)
7373
updatedValue := IsHistoryDBEnabled()
7474
testutil.AssertEquals(t, updatedValue, true) //test config returns true
7575
}
7676

7777
func TestIsHistoryDBEnabledFalse(t *testing.T) {
7878
setUpCoreYAMLConfig()
7979
defer ledgertestutil.ResetConfigToDefaultValues()
80-
viper.Set("ledger.state.historyDatabase", false)
80+
viper.Set("ledger.history.enableHistoryDatabase", false)
8181
updatedValue := IsHistoryDBEnabled()
8282
testutil.AssertEquals(t, updatedValue, false) //test config returns false
8383
}

core/ledger/testutil/test_util.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func SetupCoreYAMLConfig(coreYamlPath string) {
8484
func ResetConfigToDefaultValues() {
8585
//reset to defaults
8686
viper.Set("ledger.state.stateDatabase", "goleveldb")
87-
viper.Set("ledger.state.historyDatabase", false)
87+
viper.Set("ledger.history.enableHistoryDatabase", false)
8888
}
8989

9090
// SetLogLevel sets up log level

peer/core.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,10 @@ ledger:
394394
# CouchDB request timeout (unit: duration, e.g. 20s)
395395
requestTimeout: 20s
396396

397-
# historyDatabase - options are true or false
398-
# Indicates if the history of key updates should be stored in goleveldb
399-
historyDatabase: true
400-
401397
# Limit on the number of records to return per query
402398
queryLimit: 10000
399+
400+
history:
401+
# enableHistoryDatabase - options are true or false
402+
# Indicates if the history of key updates should be stored in goleveldb
403+
enableHistoryDatabase: true

0 commit comments

Comments
 (0)