From 01798a5cf8d64fea076d54ad7da3f5bda1dd02bf Mon Sep 17 00:00:00 2001 From: Adil Riazudeen <adilr3@illinois.edu> Date: Mon, 29 Nov 2021 02:26:56 -0600 Subject: [PATCH] more persistency stuff --- .vscode/settings.json | 9 ++++++++- src/HashTable.cc | 2 ++ src/ObjectManager.cc | 10 ++++++++-- src/Segment.cc | 2 +- src/btreeRamCloud/Btree.h | 2 ++ 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 7fc4943..108edeb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,6 +16,13 @@ "slist": "cpp", "ostream": "cpp", "fstream": "cpp", - "istream": "cpp" + "istream": "cpp", + "array": "cpp", + "chrono": "cpp", + "functional": "cpp", + "ratio": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp" } } \ No newline at end of file diff --git a/src/HashTable.cc b/src/HashTable.cc index 366c45d..10afbcc 100644 --- a/src/HashTable.cc +++ b/src/HashTable.cc @@ -148,6 +148,8 @@ HashTable::Entry::pack(uint64_t hash, bool chain, uint64_t ptr) uint64_t c = chain ? 1 : 0; assert((hash >> 16) == 0); this->value = ((hash << 48) | (c << 47) | ptr); + + flush(&(this->value),sizeof(uint64_t)); // need flush for persistency } /** diff --git a/src/ObjectManager.cc b/src/ObjectManager.cc index e782684..6089ae0 100644 --- a/src/ObjectManager.cc +++ b/src/ObjectManager.cc @@ -470,21 +470,26 @@ ObjectManager::removeObject(Key& key, RejectRules* rejectRules, appends[1].type = LOG_ENTRY_TYPE_RPCRESULT; } + // flush added to append if (!log.append(appends, (rpcResult ? 2 : 1))) { // The log is out of space. Tell the client to retry and hope // that the cleaner makes space soon. return STATUS_RETRY; } - if (rpcResult && rpcResultPtr) + if (rpcResult && rpcResultPtr){ *rpcResultPtr = appends[1].reference.toInteger(); + flush(rpcResultPtr,sizeof(rpcResultPtr)); + } + mfence(); + TableStats::increment(masterTableMetadata, tablet.tableId, appends[0].buffer.size() + appends[1].buffer.size(), rpcResult ? 2 : 1); segmentManager.raiseSafeVersion(object.getVersion() + 1); - log.free(reference); + log.free(reference); //TODO: does this need a flush? if so, where remove(lock, key); return STATUS_OK; } @@ -2173,6 +2178,7 @@ ObjectManager::flushEntriesToLog(Buffer *logBuffer, uint32_t& numEntries) // persistency added objectMap.insert(key.getHash(), references[i].toInteger()); } + mfence(); tabletManager->incrementWriteCount(key); TableStats::increment(masterTableMetadata, diff --git a/src/Segment.cc b/src/Segment.cc index 0aa3229..dcc2746 100644 --- a/src/Segment.cc +++ b/src/Segment.cc @@ -1002,11 +1002,11 @@ Segment::Reference::getEntry(SegletAllocator* allocator, } if (lengthWithMetadata != NULL){ *lengthWithMetadata = fullLength; + // TODO: check whether needed flush( reinterpret_cast<void*>(reference), fullLength ); - mfence(); } return header->getType(); } diff --git a/src/btreeRamCloud/Btree.h b/src/btreeRamCloud/Btree.h index 0baa94a..1ee05b6 100644 --- a/src/btreeRamCloud/Btree.h +++ b/src/btreeRamCloud/Btree.h @@ -35,6 +35,8 @@ #include "ObjectManager.h" #include "PerfStats.h" +#include "Common.h" + namespace RAMCloud { // Nodes in the B+ tree are stored as RAMCloud objects with the key being a -- GitLab