From 38430adde9f13837e8869ff0daf4fd5f9c66b4e3 Mon Sep 17 00:00:00 2001 From: Chris Elder Date: Fri, 14 Sep 2018 14:11:39 -0400 Subject: [PATCH] [FAB-12014] Log warning for missing index Currently the warning is only seen in peer logs if couchdb debug is enabled. Peer should log a warning without having to enable couchdb debug. Log warning to peer when "no matching index found" warning comes from couchdb queries. Change-Id: I46a5fa663c502bbdf74261a4925ce54633384d1f Signed-off-by: Chris Elder --- core/ledger/util/couchdb/couchdb.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/ledger/util/couchdb/couchdb.go b/core/ledger/util/couchdb/couchdb.go index 848cc469043..74d6ca9214f 100644 --- a/core/ledger/util/couchdb/couchdb.go +++ b/core/ledger/util/couchdb/couchdb.go @@ -1076,6 +1076,10 @@ func (dbclient *CouchDatabase) QueryDocuments(query string) ([]*QueryResult, str return nil, "", errors.Wrap(err2, "error unmarshalling json data") } + if jsonResponse.Warning != "" { + logger.Warnf("The query [%s] caused the following warning: [%s]", query, jsonResponse.Warning) + } + for _, row := range jsonResponse.Docs { var docMetadata = &DocMetadata{}