summaryrefslogtreecommitdiff
path: root/db/db_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'db/db_impl.h')
-rw-r--r--db/db_impl.h72
1 files changed, 62 insertions, 10 deletions
diff --git a/db/db_impl.h b/db/db_impl.h
index c07ff4919..7910704a5 100644
--- a/db/db_impl.h
+++ b/db/db_impl.h
@@ -53,6 +53,7 @@ class VersionEdit;
class VersionSet;
class CompactionFilterV2;
class Arena;
+class WriteCallback;
struct JobContext;
class DBImpl : public DB {
@@ -76,6 +77,7 @@ class DBImpl : public DB {
using DB::Write;
virtual Status Write(const WriteOptions& options,
WriteBatch* updates) override;
+
using DB::Get;
virtual Status Get(const ReadOptions& options,
ColumnFamilyHandle* column_family, const Slice& key,
@@ -191,6 +193,34 @@ class DBImpl : public DB {
Status PromoteL0(ColumnFamilyHandle* column_family, int target_level);
+ // Similar to Write() but will call the callback once on the single write
+ // thread to determine whether it is safe to perform the write.
+ virtual Status WriteWithCallback(const WriteOptions& write_options,
+ WriteBatch* my_batch,
+ WriteCallback* callback);
+
+ // Returns the sequence number that is guaranteed to be smaller than or equal
+ // to the sequence number of any key that could be inserted into the current
+ // memtables. It can then be assumed that any write with a larger(or equal)
+ // sequence number will be present in this memtable or a later memtable.
+ //
+ // If the earliest sequence number could not be determined,
+ // kMaxSequenceNumber will be returned.
+ //
+ // If include_history=true, will also search Memtables in MemTableList
+ // History.
+ SequenceNumber GetEarliestMemTableSequenceNumber(SuperVersion* sv,
+ bool include_history);
+
+ // For a given key, check to see if there are any records for this key
+ // in the memtables, including memtable history.
+
+ // On success, *seq will contain the sequence number for the
+ // latest such change or kMaxSequenceNumber if no records were present.
+ // Returns OK on success, other status on error reading memtables.
+ Status GetLatestSequenceForKeyFromMemtable(SuperVersion* sv, const Slice& key,
+ SequenceNumber* seq);
+
#endif // ROCKSDB_LITE
// checks if all live files exist on file system and that their file sizes
@@ -279,6 +309,32 @@ class DBImpl : public DB {
void CancelAllBackgroundWork(bool wait);
+ // Find Super version and reference it. Based on options, it might return
+ // the thread local cached one.
+ // Call ReturnAndCleanupSuperVersion() when it is no longer needed.
+ SuperVersion* GetAndRefSuperVersion(ColumnFamilyData* cfd);
+
+ // Similar to the previous function but looks up based on a column family id.
+ // nullptr will be returned if this column family no longer exists.
+ // REQUIRED: this function should only be called on the write thread or if the
+ // mutex is held.
+ SuperVersion* GetAndRefSuperVersion(uint32_t column_family_id);
+
+ // Un-reference the super version and return it to thread local cache if
+ // needed. If it is the last reference of the super version. Clean it up
+ // after un-referencing it.
+ void ReturnAndCleanupSuperVersion(ColumnFamilyData* cfd, SuperVersion* sv);
+
+ // Similar to the previous function but looks up based on a column family id.
+ // nullptr will be returned if this column family no longer exists.
+ // REQUIRED: this function should only be called on the write thread.
+ void ReturnAndCleanupSuperVersion(uint32_t colun_family_id, SuperVersion* sv);
+
+ // REQUIRED: this function should only be called on the write thread or if the
+ // mutex is held. Return value only valid until next call to this function or
+ // mutex is released.
+ ColumnFamilyHandle* GetColumnFamilyHandle(uint32_t column_family_id);
+
protected:
Env* const env_;
const std::string dbname_;
@@ -301,6 +357,9 @@ class DBImpl : public DB {
void EraseThreadStatusDbInfo() const;
+ Status WriteImpl(const WriteOptions& options, WriteBatch* updates,
+ WriteCallback* callback);
+
private:
friend class DB;
friend class InternalStats;
@@ -309,6 +368,9 @@ class DBImpl : public DB {
#endif
friend struct SuperVersion;
friend class CompactedDBImpl;
+#ifndef NDEBUG
+ friend class XFTransactionWriteHandler;
+#endif
struct CompactionState;
struct WriteContext;
@@ -660,16 +722,6 @@ class DBImpl : public DB {
const MutableCFOptions& mutable_cf_options,
bool dont_schedule_bg_work = false);
- // Find Super version and reference it. Based on options, it might return
- // the thread local cached one.
- inline SuperVersion* GetAndRefSuperVersion(ColumnFamilyData* cfd);
-
- // Un-reference the super version and return it to thread local cache if
- // needed. If it is the last reference of the super version. Clean it up
- // after un-referencing it.
- inline void ReturnAndCleanupSuperVersion(ColumnFamilyData* cfd,
- SuperVersion* sv);
-
#ifndef ROCKSDB_LITE
using DB::GetPropertiesOfAllTables;
virtual Status GetPropertiesOfAllTables(ColumnFamilyHandle* column_family,