From bedf71afd281a380cae25ed2728310ca625dbbd8 Mon Sep 17 00:00:00 2001 From: Pavan Deolasee Date: Fri, 4 Aug 2017 13:03:49 +0530 Subject: [PATCH] Correct a mistake occurred during merging sequence.c code We were incorrectly overwriting the 'cached' value in the SeqTable element, thus causing another request to the GTM when nextval is fetched. This resulted in an unintentional gaps in the sequence values. This patch fixes that, though we might still get gaps unless sequence_range is set to 1. But this is by design to reduce repeated round trips to the GTM. --- src/backend/commands/sequence.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index 67aeb512d2..b9cfe989b0 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -945,13 +945,6 @@ nextval_internal(Oid relid, bool check_permissions) log -= fetch; /* adjust for any unfetched numbers */ Assert(log >= 0); - /* save info in local cache */ - elm->last = result; /* last returned number */ - elm->cached = last; /* last fetched number */ - elm->last_valid = true; - - last_used_seq = elm; - /* * If something needs to be WAL logged, acquire an xid, so this * transaction's commit will trigger a WAL flush and wait for syncrep. -- 2.39.5