From 138132f78faf2a348232b841046fdb139dbe1c79 Mon Sep 17 00:00:00 2001 From: movead Date: Mon, 20 Feb 2023 17:05:13 +0800 Subject: [PATCH 1/3] when do timecapsule for DROP or TRUNCATE it will find the most new one to operator --- src/gausskernel/storage/tcap/tcap_manager.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/gausskernel/storage/tcap/tcap_manager.cpp b/src/gausskernel/storage/tcap/tcap_manager.cpp index bec2aa4e7b..84f1e9b7bf 100644 --- a/src/gausskernel/storage/tcap/tcap_manager.cpp +++ b/src/gausskernel/storage/tcap/tcap_manager.cpp @@ -282,11 +282,15 @@ static bool TrFetchOrinameImpl(Oid nspId, const char *oriname, TrObjType type, SysScanDesc sd; ScanKeyData skey[3]; HeapTuple tup; + TrObjDesc tempDesc; + errno_t rc = 0; bool found = false; if (!OidIsValid(nspId)) { return false; } + rc = memset_s(&tempDesc, sizeof(TrObjDesc), 0, sizeof(TrObjDesc)); + securec_check(rc, "\0", "\0"); rbRel = heap_open(RecyclebinRelationId, AccessShareLock); @@ -307,14 +311,22 @@ static bool TrFetchOrinameImpl(Oid nspId, const char *oriname, TrObjType type, continue; } - found = true; TrDescRead(desc, tup); - break; + + if(!found || desc->recyclecsn > tempDesc.recyclecsn) { + found = true; + rc = memcpy_s(&tempDesc, sizeof(TrObjDesc), desc, sizeof(TrObjDesc)); + securec_check(rc, "\0", "\0"); + } } systable_endscan(sd); heap_close(rbRel, AccessShareLock); + if(found) { + rc = memcpy_s(desc, sizeof(TrObjDesc), &tempDesc, sizeof(TrObjDesc)); + securec_check(rc, "\0", "\0"); + } return found; } -- Gitee From 61397299947e373337ddc6e519bbcc5dc869f332 Mon Sep 17 00:00:00 2001 From: movead Date: Tue, 21 Feb 2023 09:40:46 +0800 Subject: [PATCH 2/3] push build --- src/gausskernel/storage/tcap/tcap_manager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gausskernel/storage/tcap/tcap_manager.cpp b/src/gausskernel/storage/tcap/tcap_manager.cpp index 84f1e9b7bf..baea397372 100644 --- a/src/gausskernel/storage/tcap/tcap_manager.cpp +++ b/src/gausskernel/storage/tcap/tcap_manager.cpp @@ -327,6 +327,7 @@ static bool TrFetchOrinameImpl(Oid nspId, const char *oriname, TrObjType type, rc = memcpy_s(desc, sizeof(TrObjDesc), &tempDesc, sizeof(TrObjDesc)); securec_check(rc, "\0", "\0"); } + return found; } -- Gitee From 7967f4c2ec1938ecc34b050a6e9314c02168c57d Mon Sep 17 00:00:00 2001 From: movead Date: Wed, 15 Mar 2023 16:56:48 +0800 Subject: [PATCH 3/3] push build --- src/gausskernel/storage/tcap/tcap_manager.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gausskernel/storage/tcap/tcap_manager.cpp b/src/gausskernel/storage/tcap/tcap_manager.cpp index baea397372..84f1e9b7bf 100644 --- a/src/gausskernel/storage/tcap/tcap_manager.cpp +++ b/src/gausskernel/storage/tcap/tcap_manager.cpp @@ -327,7 +327,6 @@ static bool TrFetchOrinameImpl(Oid nspId, const char *oriname, TrObjType type, rc = memcpy_s(desc, sizeof(TrObjDesc), &tempDesc, sizeof(TrObjDesc)); securec_check(rc, "\0", "\0"); } - return found; } -- Gitee