summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/wiredtiger/wiredtiger_cursor.h
diff options
context:
space:
mode:
authorJustin Seyster <justin.seyster@mongodb.com>2022-06-29 12:32:12 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-06-29 20:02:02 +0000
commitcb9472afc30d32d1c18691d64899c1aa72cdc43d (patch)
tree924020b6f50ccf365926a2420c64d92e5497a34a /src/mongo/db/storage/wiredtiger/wiredtiger_cursor.h
parentf684488a8509f0a3764fa48221499b9cd508c0e1 (diff)
downloadmongo-cb9472afc30d32d1c18691d64899c1aa72cdc43d.tar.gz
SERVER-65481 Bulk shredding and loading for column store indexes
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_cursor.h')
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_cursor.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_cursor.h b/src/mongo/db/storage/wiredtiger/wiredtiger_cursor.h
index b31f91465cf..716226e45a9 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_cursor.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_cursor.h
@@ -81,4 +81,31 @@ protected:
WT_CURSOR* _cursor = nullptr; // Owned
};
+
+/**
+ * An owning object wrapper for a WT_SESSION and WT_CURSOR configured for bulk loading when
+ * possible. The cursor is created and closed independently of the cursor cache, which does not
+ * store bulk cursors. It uses its own session to avoid hijacking an existing transaction in the
+ * current session.
+ */
+class WiredTigerBulkLoadCursor {
+public:
+ WiredTigerBulkLoadCursor(const std::string& indexUri, OperationContext* opCtx);
+
+ ~WiredTigerBulkLoadCursor() {
+ _cursor->close(_cursor);
+ }
+
+ WT_CURSOR* get() const {
+ return _cursor;
+ }
+
+ WT_CURSOR* operator->() const {
+ return get();
+ }
+
+private:
+ UniqueWiredTigerSession const _session;
+ WT_CURSOR* _cursor = nullptr; // Owned
+};
} // namespace mongo