修改账本数据库历史表中主键rec_num字段重复的问题
This commit is contained in:
@ -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);
|
||||
|
||||
/*
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user