From: Pavan Deolasee Date: Fri, 4 Aug 2017 07:33:49 +0000 (+0530) Subject: Correct a mistake occurred during merging sequence.c code X-Git-Tag: XL_10_R1BETA1~181 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=bedf71afd281a380cae25ed2728310ca625dbbd8;p=postgres-xl.git 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. --- 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.