From 5628d8e85c2bb07540e58e382bf0e00bc6208a62 Mon Sep 17 00:00:00 2001 From: denyeart Date: Fri, 21 Apr 2017 16:22:26 -0400 Subject: [PATCH] [FAB-3317] Update peer CouchDB timeout 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 --- core/chaincode/chaincodetest.yaml | 2 +- .../kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test.go | 2 +- core/ledger/kvledger/txmgmt/txmgr/commontests/pkg_test.go | 2 +- core/ledger/ledgerconfig/ledger_config_test.go | 2 +- core/ledger/util/couchdb/couchdb_test.go | 2 +- peer/core.yaml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/chaincode/chaincodetest.yaml b/core/chaincode/chaincodetest.yaml index ac688e7df57..75477e771a7 100644 --- a/core/chaincode/chaincodetest.yaml +++ b/core/chaincode/chaincodetest.yaml @@ -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 diff --git a/core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test.go b/core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test.go index b9dd3df3b6d..921ca73b064 100644 --- a/core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test.go +++ b/core/ledger/kvledger/txmgmt/statedb/statecouchdb/statecouchdb_test.go @@ -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() diff --git a/core/ledger/kvledger/txmgmt/txmgr/commontests/pkg_test.go b/core/ledger/kvledger/txmgmt/txmgr/commontests/pkg_test.go index c404065141e..14b80b69871 100644 --- a/core/ledger/kvledger/txmgmt/txmgr/commontests/pkg_test.go +++ b/core/ledger/kvledger/txmgmt/txmgr/commontests/pkg_test.go @@ -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, "") diff --git a/core/ledger/ledgerconfig/ledger_config_test.go b/core/ledger/ledgerconfig/ledger_config_test.go index bb866766845..3729e7c4647 100644 --- a/core/ledger/ledgerconfig/ledger_config_test.go +++ b/core/ledger/ledgerconfig/ledger_config_test.go @@ -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) { diff --git a/core/ledger/util/couchdb/couchdb_test.go b/core/ledger/util/couchdb/couchdb_test.go index b2547f9091f..6b65ae10dc2 100644 --- a/core/ledger/util/couchdb/couchdb_test.go +++ b/core/ledger/util/couchdb/couchdb_test.go @@ -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() diff --git a/peer/core.yaml b/peer/core.yaml index 197120fc71e..91832bb2c61 100644 --- a/peer/core.yaml +++ b/peer/core.yaml @@ -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