Skip to content

Commit

Permalink
[FAB-3317] Update peer CouchDB timeout
Browse files Browse the repository at this point in the history
Occasionally CouchDB doesn't respond for (exactly) 30s.
This is most often seen in create database calls
which happens frequently during unit tests.

The default peer behavior was to retry couch after 20s,
and therefore these occurrences disrupt unit tests and
causes them to fail occasionally.

This change will set the peer CouchDB timeout to 35s for now,
in order to avoid the retries in the peer avoid the unit test problems.

After the root problem in CouchDB is resolved, the default may
change back to 20s.

Change-Id: Id688e2e137b8354512b6543fc63ad3e59a1040eb
Signed-off-by: denyeart <enyeart@us.ibm.com>
  • Loading branch information
denyeart committed Apr 21, 2017
1 parent 42bfa2e commit 5628d8e
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/chaincode/chaincodetest.yaml
Expand Up @@ -433,7 +433,7 @@ ledger:
# Number of retries for CouchDB errors during peer startup
maxRetriesOnStartup: 10
# CouchDB request timeout (unit: duration, e.g. 20s)
requestTimeout: 20s
requestTimeout: 35s


# historyDatabase - options are true or false
Expand Down
Expand Up @@ -48,7 +48,7 @@ func TestMain(m *testing.M) {
viper.Set("ledger.state.couchDBConfig.password", "")
viper.Set("ledger.state.couchDBConfig.maxRetries", 3)
viper.Set("ledger.state.couchDBConfig.maxRetriesOnStartup", 10)
viper.Set("ledger.state.couchDBConfig.requestTimeout", time.Second*20)
viper.Set("ledger.state.couchDBConfig.requestTimeout", time.Second*35)

//run the actual test
result := m.Run()
Expand Down
2 changes: 1 addition & 1 deletion core/ledger/kvledger/txmgmt/txmgr/commontests/pkg_test.go
Expand Up @@ -113,7 +113,7 @@ func (env *couchDBLockBasedEnv) init(t *testing.T, testLedgerID string) {
viper.Set("ledger.state.couchDBConfig.password", "")
viper.Set("ledger.state.couchDBConfig.maxRetries", 3)
viper.Set("ledger.state.couchDBConfig.maxRetriesOnStartup", 10)
viper.Set("ledger.state.couchDBConfig.requestTimeout", time.Second*20)
viper.Set("ledger.state.couchDBConfig.requestTimeout", time.Second*35)
testDBEnv := statecouchdb.NewTestVDBEnv(t)
testDB, err := testDBEnv.DBProvider.GetDBHandle(testLedgerID)
testutil.AssertNoError(t, err, "")
Expand Down
2 changes: 1 addition & 1 deletion core/ledger/ledgerconfig/ledger_config_test.go
Expand Up @@ -57,7 +57,7 @@ func TestGetCouchDBDefinition(t *testing.T) {
testutil.AssertEquals(t, couchDBDef.Password, "")
testutil.AssertEquals(t, couchDBDef.MaxRetries, 3)
testutil.AssertEquals(t, couchDBDef.MaxRetriesOnStartup, 10)
testutil.AssertEquals(t, couchDBDef.RequestTimeout, time.Second*20)
testutil.AssertEquals(t, couchDBDef.RequestTimeout, time.Second*35)
}

func TestIsHistoryDBEnabledDefault(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion core/ledger/util/couchdb/couchdb_test.go
Expand Up @@ -78,7 +78,7 @@ func TestMain(m *testing.M) {
viper.Set("ledger.state.couchDBConfig.password", "")
viper.Set("ledger.state.couchDBConfig.maxRetries", 3)
viper.Set("ledger.state.couchDBConfig.maxRetriesOnStartup", 10)
viper.Set("ledger.state.couchDBConfig.requestTimeout", time.Second*20)
viper.Set("ledger.state.couchDBConfig.requestTimeout", time.Second*35)

// Create CouchDB definition from config parameters
couchDBDef = ledgerconfig.GetCouchDBDefinition()
Expand Down
2 changes: 1 addition & 1 deletion peer/core.yaml
Expand Up @@ -389,7 +389,7 @@ ledger:
# Number of retries for CouchDB errors during peer startup
maxRetriesOnStartup: 10
# CouchDB request timeout (unit: duration, e.g. 20s)
requestTimeout: 20s
requestTimeout: 35s

# historyDatabase - options are true or false
# Indicates if the history of key updates should be stored in goleveldb
Expand Down

0 comments on commit 5628d8e

Please sign in to comment.