Skip to content

Commit

Permalink
chore: make LeanStore runnable on M1 chips (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzix authored Dec 21, 2023
1 parent 623c79b commit 6531d32
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions source/concurrency-recovery/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ void Logging::SubmitWALEntryComplex(u64 totalSize) {
COUNTERS_BLOCK() {
WorkerCounters::myCounters().wal_write_bytes += totalSize;
}
DCHECK(totalSize % 8 == 0);
mWalBuffered += totalSize;
UpdateWalFlushReq();
}
Expand Down
10 changes: 5 additions & 5 deletions source/concurrency-recovery/Recovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,28 @@ void Recovery::Analysis() {
auto walEntry = reinterpret_cast<WALEntry*>(&page);
switch (walEntry->type) {
case WALEntry::TYPE::TX_START: {
DCHECK(bytesRead == walEntry->size);
DCHECK_EQ(bytesRead, walEntry->size);
DCHECK(mActiveTxTable.find(walEntry->mTxId) == mActiveTxTable.end());
mActiveTxTable.emplace(std::make_pair(walEntry->mTxId, offset));
offset += bytesRead;
continue;
}
case WALEntry::TYPE::TX_COMMIT: {
DCHECK(bytesRead == walEntry->size);
DCHECK_EQ(bytesRead, walEntry->size);
DCHECK(mActiveTxTable.find(walEntry->mTxId) != mActiveTxTable.end());
mActiveTxTable[walEntry->mTxId] = offset;
offset += bytesRead;
continue;
}
case WALEntry::TYPE::TX_ABORT: {
DCHECK(bytesRead == walEntry->size);
DCHECK_EQ(bytesRead, walEntry->size);
DCHECK(mActiveTxTable.find(walEntry->mTxId) != mActiveTxTable.end());
mActiveTxTable[walEntry->mTxId] = offset;
offset += bytesRead;
continue;
}
case WALEntry::TYPE::TX_FINISH: {
DCHECK(bytesRead == walEntry->size);
DCHECK_EQ(bytesRead, walEntry->size);
DCHECK(mActiveTxTable.find(walEntry->mTxId) != mActiveTxTable.end());
mActiveTxTable.erase(walEntry->mTxId);
offset += bytesRead;
Expand All @@ -49,7 +49,7 @@ void Recovery::Analysis() {
bytesRead += ReadWalEntry(leftOffset, leftSize, leftDest);

auto complexEntry = reinterpret_cast<WALEntryComplex*>(walEntryPtr);
DCHECK(bytesRead == complexEntry->size);
DCHECK_EQ(bytesRead, complexEntry->size);
DCHECK(mActiveTxTable.find(walEntry->mTxId) != mActiveTxTable.end());
mActiveTxTable[walEntry->mTxId] = offset;

Expand Down
1 change: 0 additions & 1 deletion source/concurrency-recovery/WALEntry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class WALEntry {
<< ", CRC calculated based on the actual WALEntry: " << actualCRC;
}
};

class WALEntrySimple : public WALEntry {
public:
WALEntrySimple(LID lsn, u64 size, TYPE type) : WALEntry(lsn, size, type) {
Expand Down
1 change: 0 additions & 1 deletion source/storage/btree/core/BTreeNode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <cassert>
#include <cstring>
#include <fstream>
#include <immintrin.h>
#include <string>

using namespace std;
Expand Down
1 change: 1 addition & 0 deletions source/storage/buffer-manager/GuardedBufferFrame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ template <typename T> class GuardedBufferFrame {

const auto pageId = mBf->header.mPageId;
const auto treeId = mBf->page.mBTreeId;
payloadSize = ((payloadSize - 1) / 8 + 1) * 8;
// TODO: verify
auto handler =
cr::Worker::my().mLogging.ReserveWALEntryComplex<WT, Args...>(
Expand Down
1 change: 0 additions & 1 deletion source/threads/UT.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "utils/Misc.hpp"
#include "utils/RandomGenerator.hpp"
// -------------------------------------------------------------------------------------
#include <emmintrin.h>
#include <errno.h>
#include <fcntl.h>
#include <libaio.h>
Expand Down

0 comments on commit 6531d32

Please sign in to comment.