summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSulabh Mahajan <sulabh.mahajan@mongodb.com>2022-09-15 09:58:55 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-15 10:29:15 +0000
commit0797ff28efcd7cb954b88658425b7b38c980b605 (patch)
treec668432fdaab555b6a50d2b874f61ac509829f52
parentfa920335ed6a41efa417e5c41940cd28a4a36829 (diff)
downloadmongo-0797ff28efcd7cb954b88658425b7b38c980b605.tar.gz
SERVER-69615 On shutdown retry size storer flush until successful
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp13
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.cpp6
2 files changed, 13 insertions, 6 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
index ca705dbcd9d..9c94932c070 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp
@@ -1342,10 +1342,15 @@ void WiredTigerKVEngine::syncSizeInfo(bool sync) const {
if (!_sizeStorer)
return;
- try {
- _sizeStorer->flush(sync);
- } catch (const WriteConflictException&) {
- // ignore, we'll try again later.
+ while (true) {
+ try {
+ return _sizeStorer->flush(sync);
+ } catch (const WriteConflictException&) {
+ if (!sync) {
+ // ignore, we'll try again later.
+ return;
+ }
+ }
}
}
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.cpp
index 0259e5d50d1..e4b2e3935e2 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_size_storer.cpp
@@ -34,6 +34,7 @@
#include "mongo/bson/bsonobj.h"
#include "mongo/bson/bsonobjbuilder.h"
+#include "mongo/db/concurrency/exception_util.h"
#include "mongo/db/service_context.h"
#include "mongo/db/storage/wiredtiger/wiredtiger_begin_transaction_block.h"
#include "mongo/db/storage/wiredtiger/wiredtiger_customization_hooks.h"
@@ -178,8 +179,9 @@ void WiredTigerSizeStorer::flush(bool syncToDisk) {
// One of the code paths calling this function is when a session is checked back
// into the session cache. This could involve read-only operations which don't
// except write conflicts. If WiredTiger returns WT_ROLLBACK during the flush, we
- // skip flushing.
- return;
+ // return an exception here and let the caller decide whether to ignore it or retry
+ // flushing.
+ throwWriteConflictException("Size storer flush received a rollback.");
}
invariantWTOK(ret, cursor->session);
}