diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index cf3e964..d3d1c6d 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -33,6 +33,8 @@ /* pointer to "variable cache" in shared memory (set up by shmem.c) */ VariableCache ShmemVariableCache = NULL; +int JJ_xid = 0; + /* * Allocate the next XID for a new transaction or subtransaction. @@ -168,17 +170,24 @@ GetNewTransactionId(bool isSubXact) * * Extend pg_subtrans and pg_commit_ts too. */ - ExtendCLOG(xid); - ExtendCommitTs(xid); - ExtendSUBTRANS(xid); - - /* - * Now advance the nextXid counter. This must not happen until after we - * have successfully completed ExtendCLOG() --- if that routine fails, we - * want the next incoming transaction to try it again. We cannot assign - * more XIDs until there is CLOG space for them. - */ - TransactionIdAdvance(ShmemVariableCache->nextXid); + { + int incr; + for (incr=0; incr <=JJ_xid; incr++) + { + xid = ShmemVariableCache->nextXid; + ExtendCLOG(xid); + ExtendCommitTs(xid); + ExtendSUBTRANS(xid); + + /* + * Now advance the nextXid counter. This must not happen until after we + * have successfully completed ExtendCLOG() --- if that routine fails, we + * want the next incoming transaction to try it again. We cannot assign + * more XIDs until there is CLOG space for them. + */ + TransactionIdAdvance(ShmemVariableCache->nextXid); + } + } /* * We must store the new XID into the shared ProcArray before releasing diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index a185749..5b59e8c 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -111,6 +111,7 @@ extern char *default_tablespace; extern char *temp_tablespaces; extern bool ignore_checksum_failure; extern bool synchronize_seqscans; +extern int JJ_xid; #ifdef TRACE_SYNCSCAN extern bool trace_syncscan; @@ -2276,6 +2277,15 @@ static struct config_int ConfigureNamesInt[] = }, { + {"JJ_xid", PGC_USERSET, WAL_SETTINGS, + gettext_noop("Skip this many xid every time we acquire one"), + NULL + }, + &JJ_xid, + 0, 0, 1000000, NULL, NULL + }, + + { {"commit_siblings", PGC_USERSET, WAL_SETTINGS, gettext_noop("Sets the minimum concurrent open transactions before performing " "commit_delay."),