!1053 Fix bugs when cstore tables with unique index are updated.

Merge pull request !1053 from Yuejia/optimize
This commit is contained in:
opengauss-bot
2021-07-01 07:39:09 +00:00
committed by Gitee
8 changed files with 232 additions and 41 deletions

View File

@ -40,6 +40,8 @@ public:
void InitSortState();
void InitSortState(_in_ TupleDesc sortTupDesc, _in_ int partidAttNo, _in_ int ctidAttNo);
void PutDeleteBatch(_in_ VectorBatch *batch, _in_ JunkFilter *junkfilter);
void PutDeleteBatchForUpdate(_in_ VectorBatch *batch, _in_ int startIdx=0, _in_ int endIdx=-1);
void PartialDelete();
uint64 ExecDelete();
void setReportErrorForUpdate(bool isEnable)
{

View File

@ -111,6 +111,23 @@ public:
static void InitIndexInsertArg(Relation heap_rel, const int *keys_map, int nkeys, InsertArg &args);
void InitInsertMemArg(Plan *plan, MemInfoArg *ArgmemInfo);
inline CStorePSort* GetSorter()
{
return m_sorter;
}
inline MemoryContext GetTmpMemCnxt()
{
return m_tmpMemCnxt;
}
inline bulkload_rows* GetBufferedBatchRows()
{
return m_bufferedBatchRows;
}
void SortAndInsert(int options);
Relation m_relation;
CU ***m_aio_cu_PPtr;
AioDispatchCUDesc_t ***m_aio_dispath_cudesc;
@ -430,6 +447,7 @@ public:
bool CheckItemIsAlive(ItemPointer tid);
private:
void FreeCache();
inline bool IsDeadRow(uint32 row, unsigned char* cuDelMask);
bool CheckAliveInCache(uint32 CUId, uint32 rownum, bool* found);
@ -440,6 +458,7 @@ private:
Snapshot m_snapshot;
List* m_cuids;
List* m_deletemasks;
List* m_needFreeMasks;
List* m_valids;
};

View File

@ -43,6 +43,11 @@ public:
MemInfoArg *m_insMemInfo;
private:
void BatchDeleteAndInsert(VectorBatch *batch, int oriBatchCols, int options, JunkFilter *junkfilter);
void PartitionBatchDeleteAndInsert(VectorBatch *batch, int oriBatchCols, int options, JunkFilter *junkfilter);
bool CheckHasUniqueIdx();
Relation m_relation;
CStoreDelete *m_delete;
@ -52,6 +57,7 @@ private:
ResultRelInfo *m_resultRelInfo;
EState *m_estate;
bool m_isPartition;
bool m_hasUniqueIdx;
static int BATCHROW_TIMES;
InsertArg m_insert_args;