Fix MOT sentinel size calculation macro
This commit is contained in:
@ -593,6 +593,11 @@ public:
|
||||
return m_keyPool->m_size;
|
||||
}
|
||||
|
||||
inline uint32_t GetSentinelSizeFromPool() const
|
||||
{
|
||||
return m_sentinelPool->m_size;
|
||||
}
|
||||
|
||||
inline void SetUnique(bool unique)
|
||||
{
|
||||
m_unique = unique;
|
||||
|
@ -522,7 +522,8 @@ Row* Table::RemoveRow(Row* row, uint64_t tid, GcManager* gc)
|
||||
if (rc == RC::RC_INDEX_DELETE) {
|
||||
currSentinel = ix->IndexRemove(&key, tid);
|
||||
if (likely(gc != nullptr)) {
|
||||
gc->GcRecordObject(ix->GetIndexId(), currSentinel, nullptr, ix->SentinelDtor, SENTINEL_SIZE);
|
||||
gc->GcRecordObject(
|
||||
ix->GetIndexId(), currSentinel, nullptr, ix->SentinelDtor, SENTINEL_SIZE(ix));
|
||||
gc->GcRecordObject(ix->GetIndexId(), row, nullptr, row->RowDtor, ROW_SIZE_FROM_POOL(this));
|
||||
} else {
|
||||
if (!MOTEngine::GetInstance()->IsRecovering()) {
|
||||
@ -544,7 +545,8 @@ Row* Table::RemoveRow(Row* row, uint64_t tid, GcManager* gc)
|
||||
if (rc == RC::RC_INDEX_DELETE) {
|
||||
currSentinel = ix->IndexRemove(&key, tid);
|
||||
if (likely(gc != nullptr)) {
|
||||
gc->GcRecordObject(ix->GetIndexId(), currSentinel, nullptr, ix->SentinelDtor, SENTINEL_SIZE);
|
||||
gc->GcRecordObject(
|
||||
ix->GetIndexId(), currSentinel, nullptr, ix->SentinelDtor, SENTINEL_SIZE(ix));
|
||||
} else {
|
||||
if (!MOTEngine::GetInstance()->IsRecovering()) {
|
||||
MOT_LOG_ERROR("RemoveRow called without GC when not recovering");
|
||||
@ -592,10 +594,10 @@ Row* Table::RemoveKeyFromIndex(Row* row, Sentinel* sentinel, uint64_t tid, GcMan
|
||||
gc->GcRecordObject(
|
||||
ix->GetIndexId(), currSentinel->GetStable(), nullptr, Row::RowDtor, ROW_SIZE_FROM_POOL(this));
|
||||
}
|
||||
gc->GcRecordObject(ix->GetIndexId(), currSentinel, nullptr, Index::SentinelDtor, SENTINEL_SIZE);
|
||||
gc->GcRecordObject(ix->GetIndexId(), currSentinel, nullptr, Index::SentinelDtor, SENTINEL_SIZE(ix));
|
||||
gc->GcRecordObject(ix->GetIndexId(), OutputRow, nullptr, Row::RowDtor, ROW_SIZE_FROM_POOL(this));
|
||||
} else {
|
||||
gc->GcRecordObject(ix->GetIndexId(), currSentinel, nullptr, Index::SentinelDtor, SENTINEL_SIZE);
|
||||
gc->GcRecordObject(ix->GetIndexId(), currSentinel, nullptr, Index::SentinelDtor, SENTINEL_SIZE(ix));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -261,9 +261,8 @@ enum AccessType : uint8_t {
|
||||
/* Assumed size of a cache line. */
|
||||
#define CACHE_LINE_SIZE 64
|
||||
#define CL_SIZE CACHE_LINE_SIZE
|
||||
#define SENTINEL_SIZE (sizeof(Sentinel) + 8)
|
||||
#define SENTINEL_SIZE(x) x->GetSentinelSizeFromPool()
|
||||
#define KEY_SIZE_FROM_POOL(x) x->getKeyPoolSize()
|
||||
#define S_SENTINEL_SIZE(x) x->getKeyPoolSize() + SENTINEL_SIZE
|
||||
#define ROW_SIZE_FROM_POOL(t) t->GetRowSizeFromPool()
|
||||
#define ONE_MB 1048576
|
||||
|
||||
|
@ -475,7 +475,7 @@ RC TxnManager::RollbackInsert(Access* ac)
|
||||
#endif
|
||||
outputSen = index_->IndexRemove(&m_key, GetThdId());
|
||||
MOT_ASSERT(outputSen != nullptr);
|
||||
GcSessionRecordRcu(index_->GetIndexId(), outputSen, nullptr, Index::SentinelDtor, SENTINEL_SIZE);
|
||||
GcSessionRecordRcu(index_->GetIndexId(), outputSen, nullptr, Index::SentinelDtor, SENTINEL_SIZE(index_));
|
||||
// If we are the owner of the key and insert on top of a deleted row,
|
||||
// lets check if we can reclaim the deleted row
|
||||
if (ac->m_params.IsUpgradeInsert() and index_->IsPrimaryKey()) {
|
||||
@ -973,7 +973,7 @@ end:
|
||||
Sentinel* outputSen = index_->IndexRemove(currentItem->m_key, m_manager->GetThdId());
|
||||
MOT_ASSERT(outputSen != nullptr);
|
||||
m_manager->GcSessionRecordRcu(
|
||||
index_->GetIndexId(), outputSen, nullptr, Index::SentinelDtor, SENTINEL_SIZE);
|
||||
index_->GetIndexId(), outputSen, nullptr, Index::SentinelDtor, SENTINEL_SIZE(index_));
|
||||
m_manager->m_accessMgr->IncreaseTableStat(table);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user