Skip to content

Commit a029b1e

Browse files
committed
MB-42016: Increase detail in DroppedCollections exceptions
MB shows a throw from Manifest::DroppedCollections::remove, yet the logging and debugger backtrace don't quite make sense. Include a dump of the Manifest in the exception to see if we can solve the issue with a reproduction. Change-Id: Ia8f6a51c7e79b4a2793435c0a3248b9f16e8f097 Reviewed-on: http://review.couchbase.org/c/kv_engine/+/138086 Reviewed-by: Trond Norbye <[email protected]> Tested-by: Jim Walker <[email protected]>
1 parent 1070c0a commit a029b1e

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

engines/ep/src/collections/flush.cc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include "collections/flush.h"
1919
#include "../kvstore.h"
20+
#include "bucket_logger.h"
2021
#include "collections/collection_persisted_stats.h"
2122
#include "collections/kvstore_generated.h"
2223
#include "collections/vbucket_manifest.h"
@@ -139,7 +140,16 @@ void Flush::postCommitMakeStatsVisible() {
139140
}
140141

141142
void Flush::flushSuccess(Vbid vbid, KVBucket& bucket) {
142-
notifyManifestOfAnyDroppedCollections();
143+
try {
144+
notifyManifestOfAnyDroppedCollections();
145+
} catch (const std::exception& e) {
146+
EP_LOG_CRITICAL(
147+
"Flush notifyManifestOfAnyDroppedCollections caught exception "
148+
"for {}",
149+
vbid);
150+
EP_LOG_CRITICAL("{}", e.what());
151+
throw;
152+
}
143153
checkAndTriggerPurge(vbid, bucket);
144154
}
145155

engines/ep/src/collections/vbucket_manifest.cc

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -998,10 +998,13 @@ void Manifest::DroppedCollections::remove(CollectionID cid, uint64_t seqno) {
998998
// had items we created for a collection which is open or was open.
999999
// to not find the collection at all means we have flushed an item
10001000
// to a collection that never existed.
1001-
throw std::logic_error(std::string(__PRETTY_FUNCTION__) +
1001+
std::stringstream ss;
1002+
ss << *this;
1003+
throw std::logic_error(std::string(__PRETTY_FUNCTION__) + ":" +
1004+
std::to_string(__LINE__) +
10021005
" The collection cannot be found collection:" +
1003-
cid.to_string() +
1004-
" seqno:" + std::to_string(seqno));
1006+
cid.to_string() + " seqno:" +
1007+
std::to_string(seqno) + " " + ss.str());
10051008
}
10061009

10071010
auto& [key, vector] = *dropItr;
@@ -1023,9 +1026,14 @@ void Manifest::DroppedCollections::remove(CollectionID cid, uint64_t seqno) {
10231026
return;
10241027
}
10251028

1026-
throw std::logic_error(std::string(__PRETTY_FUNCTION__) +
1027-
" The collection seqno cannot be found collection:" +
1028-
cid.to_string() + " seqno:" + std::to_string(seqno));
1029+
std::stringstream ss;
1030+
ss << *this;
1031+
1032+
throw std::logic_error(std::string(__PRETTY_FUNCTION__) + ":" +
1033+
std::to_string(__LINE__) +
1034+
" The collection@seqno cannot be found collection:" +
1035+
cid.to_string() + " seqno:" + std::to_string(seqno) +
1036+
" " + ss.str());
10291037
}
10301038

10311039
StatsForFlush Manifest::DroppedCollections::get(CollectionID cid,

0 commit comments

Comments
 (0)