From c034f1cfa7148283351a38f87a5f7da88649c082 Mon Sep 17 00:00:00 2001 From: zhaobingyu <1783692558@qq.com> Date: Sat, 23 Jul 2022 14:47:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3issue=20--=20=E5=88=97?= =?UTF-8?q?=E5=AD=98=E5=8A=A0=E5=94=AF=E4=B8=80=E7=B4=A2=E5=BC=95=E6=8F=92?= =?UTF-8?q?100=E4=B8=87=E6=95=B0=E6=8D=AE=E6=85=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storage/cstore/cstore_allocspace.cpp | 44 +------------------ .../storage/cstore/cstore_insert.cpp | 5 +-- src/include/storage/cstore/cstorealloc.h | 1 - 3 files changed, 2 insertions(+), 48 deletions(-) diff --git a/src/gausskernel/storage/cstore/cstore_allocspace.cpp b/src/gausskernel/storage/cstore/cstore_allocspace.cpp index 0d0710779..e4241af13 100644 --- a/src/gausskernel/storage/cstore/cstore_allocspace.cpp +++ b/src/gausskernel/storage/cstore/cstore_allocspace.cpp @@ -383,49 +383,7 @@ bool CStoreAllocator::ColSpaceCacheExist(const CFileNode* cnodes, int nColumn) LWLockRelease(CStoreColspaceCacheLock); return found; -} - -/** - * science we loose lock after get max cuid we will doubt the max cuid system - * here we recheck max cuid located in index - * we want to make sure if there is on another larger cuid in index - */ -uint32 CStoreAllocator::recheck_max_cuid(Relation m_rel, uint32 max_cuid, int index_num, Relation* m_idxRelation) -{ - bool find = false; - List* index_rel_list = NIL; - - for (int i = 0; i < index_num; ++i) { - Oid am_oid = m_idxRelation[i]->rd_rel->relam; - if (am_oid == CBTREE_AM_OID || am_oid == CGIN_AM_OID) { - index_rel_list = lappend(index_rel_list, m_idxRelation[i]); - } - } - - if (list_length(index_rel_list) == 0) { - return max_cuid; - } - uint32 max_idx_cuid = CStore::GetMaxIndexCUID(m_rel, index_rel_list) + 1; - list_free_ext(index_rel_list); - - if (max_idx_cuid == MaxCUID) { - ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_RESOURCES), - errmsg("No CUID is left for new CU in relation \"%u\".", m_rel->rd_id))); - } - - if (max_idx_cuid > max_cuid) { - CStoreColFileDesc* entry = NULL; - CStoreColumnFileTag tag(m_rel->rd_node, VirtualSpaceCacheColID, MAIN_FORKNUM); - (void)LWLockAcquire(CStoreColspaceCacheLock, LW_EXCLUSIVE); - entry = (CStoreColFileDesc*)hash_search(CStoreColspaceCache, (void*)&tag, HASH_FIND, &find); - Assert(find); - entry->maxCuid = max_idx_cuid + 1; - LWLockRelease(CStoreColspaceCacheLock); - return max_idx_cuid; - } - return max_cuid; -} - +} void CStoreFreeSpace::Initialize(int maxSize) { diff --git a/src/gausskernel/storage/cstore/cstore_insert.cpp b/src/gausskernel/storage/cstore/cstore_insert.cpp index 49633c614..df2e75025 100644 --- a/src/gausskernel/storage/cstore/cstore_insert.cpp +++ b/src/gausskernel/storage/cstore/cstore_insert.cpp @@ -1341,10 +1341,7 @@ void CStoreInsert::SaveAll(int options, _in_ const char* delBitmap) /* step 1: Lock relation for extension */ LockRelationForExtension(m_relation, ExclusiveLock); uint32 curCUID = CStoreAllocator::GetNextCUID(m_relation); - if (m_resultRelInfo != NULL && m_resultRelInfo->ri_NumIndices > 0) { - curCUID = CStoreAllocator::recheck_max_cuid( - m_relation, curCUID, m_resultRelInfo->ri_NumIndices, m_idxRelation); - } + for (col = 0; col < attno; ++col) { if (m_relation->rd_att->attrs[col]->attisdropped) continue; diff --git a/src/include/storage/cstore/cstorealloc.h b/src/include/storage/cstore/cstorealloc.h index e2a0fce5e..63a43c4b2 100644 --- a/src/include/storage/cstore/cstorealloc.h +++ b/src/include/storage/cstore/cstorealloc.h @@ -133,7 +133,6 @@ public: static uint64 GetExtendOffset(uint64 max_offset); static uint32 CalcExtendSize(uint64 cu_offset, uint32 cu_size, uint64 extend_offset); - static uint32 recheck_max_cuid(Relation m_rel, uint32 max_cuid, int index_num, Relation* m_idxRelation); }; #endif