!2343 修改问题:账本数据库历史表中,rec_num字段作为主键出现了重复

Merge pull request !2343 from ashnah/for_legder
This commit is contained in:
opengauss-bot
2022-11-28 07:15:18 +00:00
committed by Gitee
3 changed files with 3 additions and 2 deletions

View File

@ -482,6 +482,7 @@ Datum ledger_hist_archive(PG_FUNCTION_ARGS)
/* Do insertion for unified row. */
simple_heap_insert(histRel, tuple);
CatalogUpdateIndexes(histRel,tuple);
heap_freetuple(tuple);
/*

View File

@ -160,8 +160,7 @@ uint64 get_next_recnum(Oid histoid)
uint64 res;
RecNumItem *item = (RecNumItem *)hash_search(g_recnum_cache, &histoid, HASH_FIND, &found);
if (found) {
res = item->rec_num;
pg_atomic_add_fetch_u64(&item->rec_num, 1);
res = pg_atomic_fetch_add_u64(&item->rec_num, 1);
} else {
LWLockRelease(BlockchainVersionLock);
LWLockAcquire(BlockchainVersionLock, LW_EXCLUSIVE);

View File

@ -512,6 +512,7 @@ bool hist_table_record_internal(Oid hist_oid, const uint64 *hash_ins, const uint
HeapTuple tuple = heap_form_tuple(hist_desc, values, nulls);
simple_heap_insert(hist_rel, tuple);
CatalogUpdateIndexes(hist_rel,tuple);
heap_freetuple(tuple);
heap_close(hist_rel, RowExclusiveLock);