!12 Fix excessive MOT redo and frequent ckpt issue
Merge pull request !12 from Vinoth/master
This commit is contained in:
@ -39,9 +39,6 @@ BitmapSet::BitmapSet()
|
||||
BitmapSet::BitmapSet(uint8_t* data, uint16_t size) : m_data(data), m_size(size), m_init(true)
|
||||
{}
|
||||
|
||||
BitmapSet::BitmapSet(uint16_t size) : m_data((uint8_t*)malloc(GetLength(size))), m_size(size), m_init(true)
|
||||
{}
|
||||
|
||||
BitmapSet::~BitmapSet()
|
||||
{}
|
||||
|
||||
@ -67,12 +64,6 @@ void BitmapSet::Reset(uint16_t size)
|
||||
securec_check(erc, "\0", "\0");
|
||||
}
|
||||
|
||||
void BitmapSet::Destroy()
|
||||
{
|
||||
free(m_data);
|
||||
m_init = false;
|
||||
}
|
||||
|
||||
void BitmapSet::Clear()
|
||||
{
|
||||
errno_t erc = memset_s(m_data, GetLength(), 0, GetLength());
|
||||
|
@ -55,13 +55,11 @@ public:
|
||||
};
|
||||
|
||||
BitmapSet();
|
||||
explicit BitmapSet(uint16_t size);
|
||||
BitmapSet(uint8_t* data, uint16_t size);
|
||||
~BitmapSet();
|
||||
|
||||
void Init(uint8_t* data, uint16_t size);
|
||||
void Reset();
|
||||
void Destroy();
|
||||
void Clear();
|
||||
void Reset(uint16_t size);
|
||||
void SetBit(uint16_t bit);
|
||||
|
@ -173,8 +173,8 @@ bool Table::AddSecondaryIndex(const string& indexName, Index* index, TxnManager*
|
||||
{
|
||||
// OA: Should we check for duplicate indices with same name?
|
||||
// first create secondary index data
|
||||
bool createdIndexData = (txn != nullptr) ? CreateSecondaryIndexData(index, txn) :
|
||||
CreateSecondaryIndexDataNonTransactional(index, tid);
|
||||
bool createdIndexData =
|
||||
(txn != nullptr) ? CreateSecondaryIndexData(index, txn) : CreateSecondaryIndexDataNonTransactional(index, tid);
|
||||
if (!createdIndexData) {
|
||||
MOT_REPORT_ERROR(MOT_ERROR_INTERNAL,
|
||||
"Add Secondary Index",
|
||||
|
@ -783,6 +783,9 @@ bool CheckpointManager::CreateTpcRecoveryFile(uint64_t checkpointId)
|
||||
break;
|
||||
}
|
||||
|
||||
// this lock is held while serializing the in process transactions call by
|
||||
// checkpoint. It prevents gs_clean removing entries from the in-process map
|
||||
// while they are serialized
|
||||
GetRecoveryManager()->LockInProcessTxns();
|
||||
CheckpointUtils::TpcFileHeader tpcFileHeader;
|
||||
tpcFileHeader.m_magic = CP_MGR_MAGIC;
|
||||
|
@ -1026,10 +1026,6 @@ bool RecoveryManager::SerializeInProcessTxns(int fd)
|
||||
return false;
|
||||
}
|
||||
|
||||
// this lock is held while serializing the in process transactions call by
|
||||
// checkpoint. It prevents gs_clean removing entries from the in-process map
|
||||
// while they are serialized
|
||||
std::lock_guard<std::mutex> lock(m_inProcessTxLock);
|
||||
map<uint64_t, RedoTransactionSegments*>::iterator it = m_inProcessTransactionMap.begin();
|
||||
while (it != m_inProcessTransactionMap.end()) {
|
||||
RedoTransactionSegments* segments = it->second;
|
||||
|
@ -75,6 +75,8 @@ public:
|
||||
if (buf == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
errno_t erc = memset_s(buf, size, 0, size);
|
||||
securec_check(erc, "\0", "\0");
|
||||
return reinterpret_cast<uint8_t*>(buf);
|
||||
}
|
||||
|
||||
|
@ -330,7 +330,7 @@ RC RedoLog::SerializeTransaction()
|
||||
if (m_txn->m_isLightSession)
|
||||
return RC_OK;
|
||||
|
||||
for (uint32_t index = 0; index < m_txn->m_accessMgr->m_rowCnt ; index++) {
|
||||
for (uint32_t index = 0; index < m_txn->m_accessMgr->m_rowCnt; index++) {
|
||||
Access* access = m_txn->m_accessMgr->GetAccessPtr(index);
|
||||
if (access != nullptr) {
|
||||
switch (access->m_type) {
|
||||
|
@ -213,10 +213,8 @@ bool RedoLogWriter::AppendCommitPrepared(RedoLogBuffer& redoLogBuffer, TxnManage
|
||||
bool RedoLogWriter::AppendRollbackPrepared(RedoLogBuffer& redoLogBuffer, TxnManager* txn)
|
||||
{
|
||||
// buffer must have enough space for control entry
|
||||
EndSegmentBlock block(OperationCode::ROLLBACK_PREPARED_TX,
|
||||
0,
|
||||
txn->GetTransactionId(),
|
||||
txn->GetInternalTransactionId());
|
||||
EndSegmentBlock block(
|
||||
OperationCode::ROLLBACK_PREPARED_TX, 0, txn->GetTransactionId(), txn->GetInternalTransactionId());
|
||||
redoLogBuffer.Append(block);
|
||||
return true;
|
||||
}
|
||||
@ -232,10 +230,7 @@ bool RedoLogWriter::AppendRollback(RedoLogBuffer& redoLogBuffer, TxnManager* txn
|
||||
bool RedoLogWriter::AppendPartial(RedoLogBuffer& redoLogBuffer, TxnManager* txn)
|
||||
{
|
||||
// buffer must have enough space for control entry
|
||||
EndSegmentBlock block(OperationCode::PARTIAL_REDO_TX,
|
||||
0,
|
||||
txn->GetTransactionId(),
|
||||
txn->GetInternalTransactionId());
|
||||
EndSegmentBlock block(OperationCode::PARTIAL_REDO_TX, 0, txn->GetTransactionId(), txn->GetInternalTransactionId());
|
||||
redoLogBuffer.Append(block);
|
||||
return true;
|
||||
}
|
||||
|
@ -166,9 +166,15 @@ extern bool PrepareJitContext(JitContext* jitContext)
|
||||
if (buf == NULL) {
|
||||
MOT_LOG_TRACE("Failed to allocate reusable bitmap set for JIT context, aborting jitted code execution");
|
||||
return false; // safe cleanup during destroy
|
||||
} else {
|
||||
jitContext->m_bitmapSet = new (buf) MOT::BitmapSet(fieldCount);
|
||||
}
|
||||
|
||||
uint8_t* bitmapData = (uint8_t*)palloc_top(MOT::BitmapSet::GetLength(fieldCount));
|
||||
if (bitmapData == NULL) {
|
||||
MOT_LOG_TRACE("Failed to allocate reusable bitmap set for JIT context, aborting jitted code execution");
|
||||
pfree_top(buf);
|
||||
return false; // safe cleanup during destroy
|
||||
}
|
||||
jitContext->m_bitmapSet = new (buf) MOT::BitmapSet(bitmapData, fieldCount);
|
||||
}
|
||||
|
||||
// allocate end-iterator key object when executing range UPDATE command or special SELECT commands
|
||||
@ -261,7 +267,7 @@ extern void DestroyJitContext(JitContext* jitContext)
|
||||
|
||||
// cleanup bitmap set
|
||||
if (jitContext->m_bitmapSet != NULL) {
|
||||
jitContext->m_bitmapSet->Destroy();
|
||||
pfree_top(jitContext->m_bitmapSet->GetData());
|
||||
jitContext->m_bitmapSet->MOT::BitmapSet::~BitmapSet();
|
||||
pfree_top(jitContext->m_bitmapSet);
|
||||
jitContext->m_bitmapSet = NULL;
|
||||
|
Reference in New Issue
Block a user