diff options
author | vvvv <vvvv@yandex-team.ru> | 2022-02-17 20:34:34 +0300 |
---|---|---|
committer | vvvv <vvvv@yandex-team.ru> | 2022-02-17 20:34:34 +0300 |
commit | 5c27e9c77778493fe201ac061f31fc2a6ea366c2 (patch) | |
tree | f9485113b52f859b102d79a6c8cc3598bddd81bd | |
parent | b8fe475c8af5a2702b52b60bf2896ad12ce4c0d3 (diff) | |
download | ydb-5c27e9c77778493fe201ac061f31fc2a6ea366c2.tar.gz |
YQL-13710 initial patches & derived files
ref:5b7dae0d5874ffdadad124c75e9cef8bcac38c3a
269 files changed, 3683 insertions, 5310 deletions
diff --git a/ydb/library/yql/parser/pg_query_wrapper/pg_sources.inc b/ydb/library/yql/parser/pg_query_wrapper/pg_sources.inc new file mode 100644 index 0000000000..23af8b7566 --- /dev/null +++ b/ydb/library/yql/parser/pg_query_wrapper/pg_sources.inc @@ -0,0 +1,737 @@ +SRCS( + postgresql/src/backend/access/brin/brin.c + postgresql/src/backend/access/brin/brin_inclusion.c + postgresql/src/backend/access/brin/brin_minmax.c + postgresql/src/backend/access/brin/brin_pageops.c + postgresql/src/backend/access/brin/brin_revmap.c + postgresql/src/backend/access/brin/brin_tuple.c + postgresql/src/backend/access/brin/brin_validate.c + postgresql/src/backend/access/brin/brin_xlog.c + postgresql/src/backend/access/common/attmap.c + postgresql/src/backend/access/common/bufmask.c + postgresql/src/backend/access/common/detoast.c + postgresql/src/backend/access/common/heaptuple.c + postgresql/src/backend/access/common/indextuple.c + postgresql/src/backend/access/common/printsimple.c + postgresql/src/backend/access/common/printtup.c + postgresql/src/backend/access/common/relation.c + postgresql/src/backend/access/common/reloptions.c + postgresql/src/backend/access/common/scankey.c + postgresql/src/backend/access/common/session.c + postgresql/src/backend/access/common/toast_internals.c + postgresql/src/backend/access/common/tupconvert.c + postgresql/src/backend/access/common/tupdesc.c + postgresql/src/backend/access/gin/ginarrayproc.c + postgresql/src/backend/access/gin/ginbtree.c + postgresql/src/backend/access/gin/ginbulk.c + postgresql/src/backend/access/gin/gindatapage.c + postgresql/src/backend/access/gin/ginentrypage.c + postgresql/src/backend/access/gin/ginfast.c + postgresql/src/backend/access/gin/ginget.c + postgresql/src/backend/access/gin/gininsert.c + postgresql/src/backend/access/gin/ginlogic.c + postgresql/src/backend/access/gin/ginpostinglist.c + postgresql/src/backend/access/gin/ginscan.c + postgresql/src/backend/access/gin/ginutil.c + postgresql/src/backend/access/gin/ginvacuum.c + postgresql/src/backend/access/gin/ginvalidate.c + postgresql/src/backend/access/gin/ginxlog.c + postgresql/src/backend/access/gist/gist.c + postgresql/src/backend/access/gist/gistbuild.c + postgresql/src/backend/access/gist/gistbuildbuffers.c + postgresql/src/backend/access/gist/gistget.c + postgresql/src/backend/access/gist/gistproc.c + postgresql/src/backend/access/gist/gistscan.c + postgresql/src/backend/access/gist/gistsplit.c + postgresql/src/backend/access/gist/gistutil.c + postgresql/src/backend/access/gist/gistvacuum.c + postgresql/src/backend/access/gist/gistvalidate.c + postgresql/src/backend/access/gist/gistxlog.c + postgresql/src/backend/access/hash/hash.c + postgresql/src/backend/access/hash/hash_xlog.c + postgresql/src/backend/access/hash/hashfunc.c + postgresql/src/backend/access/hash/hashinsert.c + postgresql/src/backend/access/hash/hashovfl.c + postgresql/src/backend/access/hash/hashpage.c + postgresql/src/backend/access/hash/hashsearch.c + postgresql/src/backend/access/hash/hashsort.c + postgresql/src/backend/access/hash/hashutil.c + postgresql/src/backend/access/hash/hashvalidate.c + postgresql/src/backend/access/heap/heapam.c + postgresql/src/backend/access/heap/heapam_handler.c + postgresql/src/backend/access/heap/heapam_visibility.c + postgresql/src/backend/access/heap/heaptoast.c + postgresql/src/backend/access/heap/hio.c + postgresql/src/backend/access/heap/pruneheap.c + postgresql/src/backend/access/heap/rewriteheap.c + postgresql/src/backend/access/heap/syncscan.c + postgresql/src/backend/access/heap/vacuumlazy.c + postgresql/src/backend/access/heap/visibilitymap.c + postgresql/src/backend/access/index/amapi.c + postgresql/src/backend/access/index/amvalidate.c + postgresql/src/backend/access/index/genam.c + postgresql/src/backend/access/index/indexam.c + postgresql/src/backend/access/nbtree/nbtcompare.c + postgresql/src/backend/access/nbtree/nbtdedup.c + postgresql/src/backend/access/nbtree/nbtinsert.c + postgresql/src/backend/access/nbtree/nbtpage.c + postgresql/src/backend/access/nbtree/nbtree.c + postgresql/src/backend/access/nbtree/nbtsearch.c + postgresql/src/backend/access/nbtree/nbtsort.c + postgresql/src/backend/access/nbtree/nbtsplitloc.c + postgresql/src/backend/access/nbtree/nbtutils.c + postgresql/src/backend/access/nbtree/nbtvalidate.c + postgresql/src/backend/access/nbtree/nbtxlog.c + postgresql/src/backend/access/rmgrdesc/brindesc.c + postgresql/src/backend/access/rmgrdesc/clogdesc.c + postgresql/src/backend/access/rmgrdesc/committsdesc.c + postgresql/src/backend/access/rmgrdesc/dbasedesc.c + postgresql/src/backend/access/rmgrdesc/genericdesc.c + postgresql/src/backend/access/rmgrdesc/gindesc.c + postgresql/src/backend/access/rmgrdesc/gistdesc.c + postgresql/src/backend/access/rmgrdesc/hashdesc.c + postgresql/src/backend/access/rmgrdesc/heapdesc.c + postgresql/src/backend/access/rmgrdesc/logicalmsgdesc.c + postgresql/src/backend/access/rmgrdesc/mxactdesc.c + postgresql/src/backend/access/rmgrdesc/nbtdesc.c + postgresql/src/backend/access/rmgrdesc/relmapdesc.c + postgresql/src/backend/access/rmgrdesc/replorigindesc.c + postgresql/src/backend/access/rmgrdesc/seqdesc.c + postgresql/src/backend/access/rmgrdesc/smgrdesc.c + postgresql/src/backend/access/rmgrdesc/spgdesc.c + postgresql/src/backend/access/rmgrdesc/standbydesc.c + postgresql/src/backend/access/rmgrdesc/tblspcdesc.c + postgresql/src/backend/access/rmgrdesc/xactdesc.c + postgresql/src/backend/access/rmgrdesc/xlogdesc.c + postgresql/src/backend/access/spgist/spgdoinsert.c + postgresql/src/backend/access/spgist/spginsert.c + postgresql/src/backend/access/spgist/spgkdtreeproc.c + postgresql/src/backend/access/spgist/spgproc.c + postgresql/src/backend/access/spgist/spgquadtreeproc.c + postgresql/src/backend/access/spgist/spgscan.c + postgresql/src/backend/access/spgist/spgtextproc.c + postgresql/src/backend/access/spgist/spgutils.c + postgresql/src/backend/access/spgist/spgvacuum.c + postgresql/src/backend/access/spgist/spgvalidate.c + postgresql/src/backend/access/spgist/spgxlog.c + postgresql/src/backend/access/table/table.c + postgresql/src/backend/access/table/tableam.c + postgresql/src/backend/access/table/tableamapi.c + postgresql/src/backend/access/table/toast_helper.c + postgresql/src/backend/access/tablesample/bernoulli.c + postgresql/src/backend/access/tablesample/system.c + postgresql/src/backend/access/tablesample/tablesample.c + postgresql/src/backend/access/transam/clog.c + postgresql/src/backend/access/transam/commit_ts.c + postgresql/src/backend/access/transam/generic_xlog.c + postgresql/src/backend/access/transam/multixact.c + postgresql/src/backend/access/transam/parallel.c + postgresql/src/backend/access/transam/rmgr.c + postgresql/src/backend/access/transam/slru.c + postgresql/src/backend/access/transam/subtrans.c + postgresql/src/backend/access/transam/timeline.c + postgresql/src/backend/access/transam/transam.c + postgresql/src/backend/access/transam/twophase.c + postgresql/src/backend/access/transam/twophase_rmgr.c + postgresql/src/backend/access/transam/varsup.c + postgresql/src/backend/access/transam/xact.c + postgresql/src/backend/access/transam/xlog.c + postgresql/src/backend/access/transam/xlogarchive.c + postgresql/src/backend/access/transam/xlogfuncs.c + postgresql/src/backend/access/transam/xloginsert.c + postgresql/src/backend/access/transam/xlogreader.c + postgresql/src/backend/access/transam/xlogutils.c + postgresql/src/backend/bootstrap/bootparse.c + postgresql/src/backend/bootstrap/bootstrap.c + postgresql/src/backend/catalog/aclchk.c + postgresql/src/backend/catalog/catalog.c + postgresql/src/backend/catalog/dependency.c + postgresql/src/backend/catalog/heap.c + postgresql/src/backend/catalog/index.c + postgresql/src/backend/catalog/indexing.c + postgresql/src/backend/catalog/namespace.c + postgresql/src/backend/catalog/objectaccess.c + postgresql/src/backend/catalog/objectaddress.c + postgresql/src/backend/catalog/partition.c + postgresql/src/backend/catalog/pg_aggregate.c + postgresql/src/backend/catalog/pg_cast.c + postgresql/src/backend/catalog/pg_collation.c + postgresql/src/backend/catalog/pg_constraint.c + postgresql/src/backend/catalog/pg_conversion.c + postgresql/src/backend/catalog/pg_db_role_setting.c + postgresql/src/backend/catalog/pg_depend.c + postgresql/src/backend/catalog/pg_enum.c + postgresql/src/backend/catalog/pg_inherits.c + postgresql/src/backend/catalog/pg_largeobject.c + postgresql/src/backend/catalog/pg_namespace.c + postgresql/src/backend/catalog/pg_operator.c + postgresql/src/backend/catalog/pg_proc.c + postgresql/src/backend/catalog/pg_publication.c + postgresql/src/backend/catalog/pg_range.c + postgresql/src/backend/catalog/pg_shdepend.c + postgresql/src/backend/catalog/pg_subscription.c + postgresql/src/backend/catalog/pg_type.c + postgresql/src/backend/catalog/storage.c + postgresql/src/backend/catalog/toasting.c + postgresql/src/backend/commands/aggregatecmds.c + postgresql/src/backend/commands/alter.c + postgresql/src/backend/commands/amcmds.c + postgresql/src/backend/commands/analyze.c + postgresql/src/backend/commands/async.c + postgresql/src/backend/commands/cluster.c + postgresql/src/backend/commands/collationcmds.c + postgresql/src/backend/commands/comment.c + postgresql/src/backend/commands/constraint.c + postgresql/src/backend/commands/conversioncmds.c + postgresql/src/backend/commands/copy.c + postgresql/src/backend/commands/createas.c + postgresql/src/backend/commands/dbcommands.c + postgresql/src/backend/commands/define.c + postgresql/src/backend/commands/discard.c + postgresql/src/backend/commands/dropcmds.c + postgresql/src/backend/commands/event_trigger.c + postgresql/src/backend/commands/explain.c + postgresql/src/backend/commands/extension.c + postgresql/src/backend/commands/foreigncmds.c + postgresql/src/backend/commands/functioncmds.c + postgresql/src/backend/commands/indexcmds.c + postgresql/src/backend/commands/lockcmds.c + postgresql/src/backend/commands/matview.c + postgresql/src/backend/commands/opclasscmds.c + postgresql/src/backend/commands/operatorcmds.c + postgresql/src/backend/commands/policy.c + postgresql/src/backend/commands/portalcmds.c + postgresql/src/backend/commands/prepare.c + postgresql/src/backend/commands/proclang.c + postgresql/src/backend/commands/publicationcmds.c + postgresql/src/backend/commands/schemacmds.c + postgresql/src/backend/commands/seclabel.c + postgresql/src/backend/commands/sequence.c + postgresql/src/backend/commands/statscmds.c + postgresql/src/backend/commands/subscriptioncmds.c + postgresql/src/backend/commands/tablecmds.c + postgresql/src/backend/commands/tablespace.c + postgresql/src/backend/commands/trigger.c + postgresql/src/backend/commands/tsearchcmds.c + postgresql/src/backend/commands/typecmds.c + postgresql/src/backend/commands/user.c + postgresql/src/backend/commands/vacuum.c + postgresql/src/backend/commands/variable.c + postgresql/src/backend/commands/view.c + postgresql/src/backend/executor/execAmi.c + postgresql/src/backend/executor/execCurrent.c + postgresql/src/backend/executor/execExpr.c + postgresql/src/backend/executor/execExprInterp.c + postgresql/src/backend/executor/execGrouping.c + postgresql/src/backend/executor/execIndexing.c + postgresql/src/backend/executor/execJunk.c + postgresql/src/backend/executor/execMain.c + postgresql/src/backend/executor/execParallel.c + postgresql/src/backend/executor/execPartition.c + postgresql/src/backend/executor/execProcnode.c + postgresql/src/backend/executor/execReplication.c + postgresql/src/backend/executor/execSRF.c + postgresql/src/backend/executor/execScan.c + postgresql/src/backend/executor/execTuples.c + postgresql/src/backend/executor/execUtils.c + postgresql/src/backend/executor/functions.c + postgresql/src/backend/executor/instrument.c + postgresql/src/backend/executor/nodeAgg.c + postgresql/src/backend/executor/nodeAppend.c + postgresql/src/backend/executor/nodeBitmapAnd.c + postgresql/src/backend/executor/nodeBitmapHeapscan.c + postgresql/src/backend/executor/nodeBitmapIndexscan.c + postgresql/src/backend/executor/nodeBitmapOr.c + postgresql/src/backend/executor/nodeCtescan.c + postgresql/src/backend/executor/nodeCustom.c + postgresql/src/backend/executor/nodeForeignscan.c + postgresql/src/backend/executor/nodeFunctionscan.c + postgresql/src/backend/executor/nodeGather.c + postgresql/src/backend/executor/nodeGatherMerge.c + postgresql/src/backend/executor/nodeGroup.c + postgresql/src/backend/executor/nodeHash.c + postgresql/src/backend/executor/nodeHashjoin.c + postgresql/src/backend/executor/nodeIncrementalSort.c + postgresql/src/backend/executor/nodeIndexonlyscan.c + postgresql/src/backend/executor/nodeIndexscan.c + postgresql/src/backend/executor/nodeLimit.c + postgresql/src/backend/executor/nodeLockRows.c + postgresql/src/backend/executor/nodeMaterial.c + postgresql/src/backend/executor/nodeMergeAppend.c + postgresql/src/backend/executor/nodeMergejoin.c + postgresql/src/backend/executor/nodeModifyTable.c + postgresql/src/backend/executor/nodeNamedtuplestorescan.c + postgresql/src/backend/executor/nodeNestloop.c + postgresql/src/backend/executor/nodeProjectSet.c + postgresql/src/backend/executor/nodeRecursiveunion.c + postgresql/src/backend/executor/nodeResult.c + postgresql/src/backend/executor/nodeSamplescan.c + postgresql/src/backend/executor/nodeSeqscan.c + postgresql/src/backend/executor/nodeSetOp.c + postgresql/src/backend/executor/nodeSort.c + postgresql/src/backend/executor/nodeSubplan.c + postgresql/src/backend/executor/nodeSubqueryscan.c + postgresql/src/backend/executor/nodeTableFuncscan.c + postgresql/src/backend/executor/nodeTidscan.c + postgresql/src/backend/executor/nodeUnique.c + postgresql/src/backend/executor/nodeValuesscan.c + postgresql/src/backend/executor/nodeWindowAgg.c + postgresql/src/backend/executor/nodeWorktablescan.c + postgresql/src/backend/executor/spi.c + postgresql/src/backend/executor/tqueue.c + postgresql/src/backend/executor/tstoreReceiver.c + postgresql/src/backend/foreign/foreign.c + postgresql/src/backend/jit/jit.c + postgresql/src/backend/lib/binaryheap.c + postgresql/src/backend/lib/bipartite_match.c + postgresql/src/backend/lib/bloomfilter.c + postgresql/src/backend/lib/dshash.c + postgresql/src/backend/lib/hyperloglog.c + postgresql/src/backend/lib/ilist.c + postgresql/src/backend/lib/integerset.c + postgresql/src/backend/lib/knapsack.c + postgresql/src/backend/lib/pairingheap.c + postgresql/src/backend/lib/rbtree.c + postgresql/src/backend/libpq/auth-scram.c + postgresql/src/backend/libpq/auth.c + postgresql/src/backend/libpq/be-fsstubs.c + postgresql/src/backend/libpq/be-secure-common.c + postgresql/src/backend/libpq/be-secure-openssl.c + postgresql/src/backend/libpq/be-secure.c + postgresql/src/backend/libpq/crypt.c + postgresql/src/backend/libpq/hba.c + postgresql/src/backend/libpq/ifaddr.c + postgresql/src/backend/libpq/pqcomm.c + postgresql/src/backend/libpq/pqformat.c + postgresql/src/backend/libpq/pqmq.c + postgresql/src/backend/libpq/pqsignal.c + postgresql/src/backend/nodes/bitmapset.c + postgresql/src/backend/nodes/copyfuncs.c + postgresql/src/backend/nodes/equalfuncs.c + postgresql/src/backend/nodes/extensible.c + postgresql/src/backend/nodes/list.c + postgresql/src/backend/nodes/makefuncs.c + postgresql/src/backend/nodes/nodeFuncs.c + postgresql/src/backend/nodes/nodes.c + postgresql/src/backend/nodes/outfuncs.c + postgresql/src/backend/nodes/params.c + postgresql/src/backend/nodes/print.c + postgresql/src/backend/nodes/read.c + postgresql/src/backend/nodes/readfuncs.c + postgresql/src/backend/nodes/tidbitmap.c + postgresql/src/backend/nodes/value.c + postgresql/src/backend/optimizer/geqo/geqo_copy.c + postgresql/src/backend/optimizer/geqo/geqo_cx.c + postgresql/src/backend/optimizer/geqo/geqo_erx.c + postgresql/src/backend/optimizer/geqo/geqo_eval.c + postgresql/src/backend/optimizer/geqo/geqo_main.c + postgresql/src/backend/optimizer/geqo/geqo_misc.c + postgresql/src/backend/optimizer/geqo/geqo_mutation.c + postgresql/src/backend/optimizer/geqo/geqo_ox1.c + postgresql/src/backend/optimizer/geqo/geqo_ox2.c + postgresql/src/backend/optimizer/geqo/geqo_pmx.c + postgresql/src/backend/optimizer/geqo/geqo_pool.c + postgresql/src/backend/optimizer/geqo/geqo_px.c + postgresql/src/backend/optimizer/geqo/geqo_random.c + postgresql/src/backend/optimizer/geqo/geqo_recombination.c + postgresql/src/backend/optimizer/geqo/geqo_selection.c + postgresql/src/backend/optimizer/path/allpaths.c + postgresql/src/backend/optimizer/path/clausesel.c + postgresql/src/backend/optimizer/path/costsize.c + postgresql/src/backend/optimizer/path/equivclass.c + postgresql/src/backend/optimizer/path/indxpath.c + postgresql/src/backend/optimizer/path/joinpath.c + postgresql/src/backend/optimizer/path/joinrels.c + postgresql/src/backend/optimizer/path/pathkeys.c + postgresql/src/backend/optimizer/path/tidpath.c + postgresql/src/backend/optimizer/plan/analyzejoins.c + postgresql/src/backend/optimizer/plan/createplan.c + postgresql/src/backend/optimizer/plan/initsplan.c + postgresql/src/backend/optimizer/plan/planagg.c + postgresql/src/backend/optimizer/plan/planmain.c + postgresql/src/backend/optimizer/plan/planner.c + postgresql/src/backend/optimizer/plan/setrefs.c + postgresql/src/backend/optimizer/plan/subselect.c + postgresql/src/backend/optimizer/prep/prepjointree.c + postgresql/src/backend/optimizer/prep/prepqual.c + postgresql/src/backend/optimizer/prep/preptlist.c + postgresql/src/backend/optimizer/prep/prepunion.c + postgresql/src/backend/optimizer/util/appendinfo.c + postgresql/src/backend/optimizer/util/clauses.c + postgresql/src/backend/optimizer/util/inherit.c + postgresql/src/backend/optimizer/util/joininfo.c + postgresql/src/backend/optimizer/util/orclauses.c + postgresql/src/backend/optimizer/util/paramassign.c + postgresql/src/backend/optimizer/util/pathnode.c + postgresql/src/backend/optimizer/util/placeholder.c + postgresql/src/backend/optimizer/util/plancat.c + postgresql/src/backend/optimizer/util/predtest.c + postgresql/src/backend/optimizer/util/relnode.c + postgresql/src/backend/optimizer/util/restrictinfo.c + postgresql/src/backend/optimizer/util/tlist.c + postgresql/src/backend/optimizer/util/var.c + postgresql/src/backend/parser/analyze.c + postgresql/src/backend/parser/gram.c + postgresql/src/backend/parser/parse_agg.c + postgresql/src/backend/parser/parse_clause.c + postgresql/src/backend/parser/parse_coerce.c + postgresql/src/backend/parser/parse_collate.c + postgresql/src/backend/parser/parse_cte.c + postgresql/src/backend/parser/parse_enr.c + postgresql/src/backend/parser/parse_expr.c + postgresql/src/backend/parser/parse_func.c + postgresql/src/backend/parser/parse_node.c + postgresql/src/backend/parser/parse_oper.c + postgresql/src/backend/parser/parse_param.c + postgresql/src/backend/parser/parse_relation.c + postgresql/src/backend/parser/parse_target.c + postgresql/src/backend/parser/parse_type.c + postgresql/src/backend/parser/parse_utilcmd.c + postgresql/src/backend/parser/parser.c + postgresql/src/backend/parser/scan.c + postgresql/src/backend/parser/scansup.c + postgresql/src/backend/partitioning/partbounds.c + postgresql/src/backend/partitioning/partdesc.c + postgresql/src/backend/partitioning/partprune.c + postgresql/src/backend/port/atomics.c + postgresql/src/backend/port/posix_sema.c + postgresql/src/backend/port/sysv_shmem.c + postgresql/src/backend/postmaster/autovacuum.c + postgresql/src/backend/postmaster/bgworker.c + postgresql/src/backend/postmaster/bgwriter.c + postgresql/src/backend/postmaster/checkpointer.c + postgresql/src/backend/postmaster/fork_process.c + postgresql/src/backend/postmaster/interrupt.c + postgresql/src/backend/postmaster/pgarch.c + postgresql/src/backend/postmaster/pgstat.c + postgresql/src/backend/postmaster/postmaster.c + postgresql/src/backend/postmaster/startup.c + postgresql/src/backend/postmaster/syslogger.c + postgresql/src/backend/postmaster/walwriter.c + postgresql/src/backend/regex/regcomp.c + postgresql/src/backend/regex/regerror.c + postgresql/src/backend/regex/regexec.c + postgresql/src/backend/regex/regexport.c + postgresql/src/backend/regex/regfree.c + postgresql/src/backend/regex/regprefix.c + postgresql/src/backend/replication/backup_manifest.c + postgresql/src/backend/replication/basebackup.c + postgresql/src/backend/replication/logical/decode.c + postgresql/src/backend/replication/logical/launcher.c + postgresql/src/backend/replication/logical/logical.c + postgresql/src/backend/replication/logical/logicalfuncs.c + postgresql/src/backend/replication/logical/message.c + postgresql/src/backend/replication/logical/origin.c + postgresql/src/backend/replication/logical/proto.c + postgresql/src/backend/replication/logical/relation.c + postgresql/src/backend/replication/logical/reorderbuffer.c + postgresql/src/backend/replication/logical/snapbuild.c + postgresql/src/backend/replication/logical/tablesync.c + postgresql/src/backend/replication/logical/worker.c + postgresql/src/backend/replication/repl_gram.c + postgresql/src/backend/replication/slot.c + postgresql/src/backend/replication/slotfuncs.c + postgresql/src/backend/replication/syncrep.c + postgresql/src/backend/replication/syncrep_gram.c + postgresql/src/backend/replication/walreceiver.c + postgresql/src/backend/replication/walreceiverfuncs.c + postgresql/src/backend/replication/walsender.c + postgresql/src/backend/rewrite/rewriteDefine.c + postgresql/src/backend/rewrite/rewriteHandler.c + postgresql/src/backend/rewrite/rewriteManip.c + postgresql/src/backend/rewrite/rewriteRemove.c + postgresql/src/backend/rewrite/rewriteSupport.c + postgresql/src/backend/rewrite/rowsecurity.c + postgresql/src/backend/statistics/dependencies.c + postgresql/src/backend/statistics/extended_stats.c + postgresql/src/backend/statistics/mcv.c + postgresql/src/backend/statistics/mvdistinct.c + postgresql/src/backend/storage/buffer/buf_init.c + postgresql/src/backend/storage/buffer/buf_table.c + postgresql/src/backend/storage/buffer/bufmgr.c + postgresql/src/backend/storage/buffer/freelist.c + postgresql/src/backend/storage/buffer/localbuf.c + postgresql/src/backend/storage/file/buffile.c + postgresql/src/backend/storage/file/copydir.c + postgresql/src/backend/storage/file/fd.c + postgresql/src/backend/storage/file/reinit.c + postgresql/src/backend/storage/file/sharedfileset.c + postgresql/src/backend/storage/freespace/freespace.c + postgresql/src/backend/storage/freespace/fsmpage.c + postgresql/src/backend/storage/freespace/indexfsm.c + postgresql/src/backend/storage/ipc/barrier.c + postgresql/src/backend/storage/ipc/dsm.c + postgresql/src/backend/storage/ipc/dsm_impl.c + postgresql/src/backend/storage/ipc/ipc.c + postgresql/src/backend/storage/ipc/ipci.c + postgresql/src/backend/storage/ipc/latch.c + postgresql/src/backend/storage/ipc/pmsignal.c + postgresql/src/backend/storage/ipc/procarray.c + postgresql/src/backend/storage/ipc/procsignal.c + postgresql/src/backend/storage/ipc/shm_mq.c + postgresql/src/backend/storage/ipc/shm_toc.c + postgresql/src/backend/storage/ipc/shmem.c + postgresql/src/backend/storage/ipc/shmqueue.c + postgresql/src/backend/storage/ipc/signalfuncs.c + postgresql/src/backend/storage/ipc/sinval.c + postgresql/src/backend/storage/ipc/sinvaladt.c + postgresql/src/backend/storage/ipc/standby.c + postgresql/src/backend/storage/large_object/inv_api.c + postgresql/src/backend/storage/lmgr/condition_variable.c + postgresql/src/backend/storage/lmgr/deadlock.c + postgresql/src/backend/storage/lmgr/lmgr.c + postgresql/src/backend/storage/lmgr/lock.c + postgresql/src/backend/storage/lmgr/lwlock.c + postgresql/src/backend/storage/lmgr/lwlocknames.c + postgresql/src/backend/storage/lmgr/predicate.c + postgresql/src/backend/storage/lmgr/proc.c + postgresql/src/backend/storage/lmgr/s_lock.c + postgresql/src/backend/storage/lmgr/spin.c + postgresql/src/backend/storage/page/bufpage.c + postgresql/src/backend/storage/page/checksum.c + postgresql/src/backend/storage/page/itemptr.c + postgresql/src/backend/storage/smgr/md.c + postgresql/src/backend/storage/smgr/smgr.c + postgresql/src/backend/storage/sync/sync.c + postgresql/src/backend/tcop/cmdtag.c + postgresql/src/backend/tcop/dest.c + postgresql/src/backend/tcop/fastpath.c + postgresql/src/backend/tcop/postgres.c + postgresql/src/backend/tcop/pquery.c + postgresql/src/backend/tcop/utility.c + postgresql/src/backend/tsearch/dict.c + postgresql/src/backend/tsearch/dict_ispell.c + postgresql/src/backend/tsearch/dict_simple.c + postgresql/src/backend/tsearch/dict_synonym.c + postgresql/src/backend/tsearch/dict_thesaurus.c + postgresql/src/backend/tsearch/regis.c + postgresql/src/backend/tsearch/spell.c + postgresql/src/backend/tsearch/to_tsany.c + postgresql/src/backend/tsearch/ts_locale.c + postgresql/src/backend/tsearch/ts_parse.c + postgresql/src/backend/tsearch/ts_selfuncs.c + postgresql/src/backend/tsearch/ts_typanalyze.c + postgresql/src/backend/tsearch/ts_utils.c + postgresql/src/backend/tsearch/wparser.c + postgresql/src/backend/tsearch/wparser_def.c + postgresql/src/backend/utils/adt/acl.c + postgresql/src/backend/utils/adt/amutils.c + postgresql/src/backend/utils/adt/array_expanded.c + postgresql/src/backend/utils/adt/array_selfuncs.c + postgresql/src/backend/utils/adt/array_typanalyze.c + postgresql/src/backend/utils/adt/array_userfuncs.c + postgresql/src/backend/utils/adt/arrayfuncs.c + postgresql/src/backend/utils/adt/arrayutils.c + postgresql/src/backend/utils/adt/ascii.c + postgresql/src/backend/utils/adt/bool.c + postgresql/src/backend/utils/adt/cash.c + postgresql/src/backend/utils/adt/char.c + postgresql/src/backend/utils/adt/cryptohashes.c + postgresql/src/backend/utils/adt/date.c + postgresql/src/backend/utils/adt/datetime.c + postgresql/src/backend/utils/adt/datum.c + postgresql/src/backend/utils/adt/dbsize.c + postgresql/src/backend/utils/adt/domains.c + postgresql/src/backend/utils/adt/encode.c + postgresql/src/backend/utils/adt/enum.c + postgresql/src/backend/utils/adt/expandeddatum.c + postgresql/src/backend/utils/adt/expandedrecord.c + postgresql/src/backend/utils/adt/float.c + postgresql/src/backend/utils/adt/format_type.c + postgresql/src/backend/utils/adt/formatting.c + postgresql/src/backend/utils/adt/genfile.c + postgresql/src/backend/utils/adt/geo_ops.c + postgresql/src/backend/utils/adt/geo_selfuncs.c + postgresql/src/backend/utils/adt/geo_spgist.c + postgresql/src/backend/utils/adt/inet_cidr_ntop.c + postgresql/src/backend/utils/adt/inet_net_pton.c + postgresql/src/backend/utils/adt/int.c + postgresql/src/backend/utils/adt/int8.c + postgresql/src/backend/utils/adt/json.c + postgresql/src/backend/utils/adt/jsonb.c + postgresql/src/backend/utils/adt/jsonb_gin.c + postgresql/src/backend/utils/adt/jsonb_op.c + postgresql/src/backend/utils/adt/jsonb_util.c + postgresql/src/backend/utils/adt/jsonfuncs.c + postgresql/src/backend/utils/adt/jsonpath.c + postgresql/src/backend/utils/adt/jsonpath_exec.c + postgresql/src/backend/utils/adt/jsonpath_gram.c + postgresql/src/backend/utils/adt/like.c + postgresql/src/backend/utils/adt/like_support.c + postgresql/src/backend/utils/adt/lockfuncs.c + postgresql/src/backend/utils/adt/mac.c + postgresql/src/backend/utils/adt/mac8.c + postgresql/src/backend/utils/adt/misc.c + postgresql/src/backend/utils/adt/name.c + postgresql/src/backend/utils/adt/network.c + postgresql/src/backend/utils/adt/network_gist.c + postgresql/src/backend/utils/adt/network_selfuncs.c + postgresql/src/backend/utils/adt/network_spgist.c + postgresql/src/backend/utils/adt/numeric.c + postgresql/src/backend/utils/adt/numutils.c + postgresql/src/backend/utils/adt/oid.c + postgresql/src/backend/utils/adt/oracle_compat.c + postgresql/src/backend/utils/adt/orderedsetaggs.c + postgresql/src/backend/utils/adt/partitionfuncs.c + postgresql/src/backend/utils/adt/pg_locale.c + postgresql/src/backend/utils/adt/pg_lsn.c + postgresql/src/backend/utils/adt/pg_upgrade_support.c + postgresql/src/backend/utils/adt/pgstatfuncs.c + postgresql/src/backend/utils/adt/pseudotypes.c + postgresql/src/backend/utils/adt/quote.c + postgresql/src/backend/utils/adt/rangetypes.c + postgresql/src/backend/utils/adt/rangetypes_gist.c + postgresql/src/backend/utils/adt/rangetypes_selfuncs.c + postgresql/src/backend/utils/adt/rangetypes_spgist.c + postgresql/src/backend/utils/adt/rangetypes_typanalyze.c + postgresql/src/backend/utils/adt/regexp.c + postgresql/src/backend/utils/adt/regproc.c + postgresql/src/backend/utils/adt/ri_triggers.c + postgresql/src/backend/utils/adt/rowtypes.c + postgresql/src/backend/utils/adt/ruleutils.c + postgresql/src/backend/utils/adt/selfuncs.c + postgresql/src/backend/utils/adt/tid.c + postgresql/src/backend/utils/adt/timestamp.c + postgresql/src/backend/utils/adt/trigfuncs.c + postgresql/src/backend/utils/adt/tsginidx.c + postgresql/src/backend/utils/adt/tsgistidx.c + postgresql/src/backend/utils/adt/tsquery.c + postgresql/src/backend/utils/adt/tsquery_cleanup.c + postgresql/src/backend/utils/adt/tsquery_gist.c + postgresql/src/backend/utils/adt/tsquery_op.c + postgresql/src/backend/utils/adt/tsquery_rewrite.c + postgresql/src/backend/utils/adt/tsquery_util.c + postgresql/src/backend/utils/adt/tsrank.c + postgresql/src/backend/utils/adt/tsvector.c + postgresql/src/backend/utils/adt/tsvector_op.c + postgresql/src/backend/utils/adt/tsvector_parser.c + postgresql/src/backend/utils/adt/uuid.c + postgresql/src/backend/utils/adt/varbit.c + postgresql/src/backend/utils/adt/varchar.c + postgresql/src/backend/utils/adt/varlena.c + postgresql/src/backend/utils/adt/version.c + postgresql/src/backend/utils/adt/windowfuncs.c + postgresql/src/backend/utils/adt/xid.c + postgresql/src/backend/utils/adt/xid8funcs.c + postgresql/src/backend/utils/adt/xml.c + postgresql/src/backend/utils/cache/attoptcache.c + postgresql/src/backend/utils/cache/catcache.c + postgresql/src/backend/utils/cache/evtcache.c + postgresql/src/backend/utils/cache/inval.c + postgresql/src/backend/utils/cache/lsyscache.c + postgresql/src/backend/utils/cache/partcache.c + postgresql/src/backend/utils/cache/plancache.c + postgresql/src/backend/utils/cache/relcache.c + postgresql/src/backend/utils/cache/relfilenodemap.c + postgresql/src/backend/utils/cache/relmapper.c + postgresql/src/backend/utils/cache/spccache.c + postgresql/src/backend/utils/cache/syscache.c + postgresql/src/backend/utils/cache/ts_cache.c + postgresql/src/backend/utils/cache/typcache.c + postgresql/src/backend/utils/error/assert.c + postgresql/src/backend/utils/error/elog.c + postgresql/src/backend/utils/fmgr/dfmgr.c + postgresql/src/backend/utils/fmgr/fmgr.c + postgresql/src/backend/utils/fmgr/funcapi.c + postgresql/src/backend/utils/fmgrtab.c + postgresql/src/backend/utils/hash/dynahash.c + postgresql/src/backend/utils/hash/pg_crc.c + postgresql/src/backend/utils/init/globals.c + postgresql/src/backend/utils/init/miscinit.c + postgresql/src/backend/utils/init/postinit.c + postgresql/src/backend/utils/mb/conv.c + postgresql/src/backend/utils/mb/mbutils.c + postgresql/src/backend/utils/mb/stringinfo_mb.c + postgresql/src/backend/utils/mb/wstrcmp.c + postgresql/src/backend/utils/mb/wstrncmp.c + postgresql/src/backend/utils/misc/guc.c + postgresql/src/backend/utils/misc/pg_config.c + postgresql/src/backend/utils/misc/pg_controldata.c + postgresql/src/backend/utils/misc/pg_rusage.c + postgresql/src/backend/utils/misc/ps_status.c + postgresql/src/backend/utils/misc/queryenvironment.c + postgresql/src/backend/utils/misc/rls.c + postgresql/src/backend/utils/misc/sampling.c + postgresql/src/backend/utils/misc/superuser.c + postgresql/src/backend/utils/misc/timeout.c + postgresql/src/backend/utils/misc/tzparser.c + postgresql/src/backend/utils/mmgr/aset.c + postgresql/src/backend/utils/mmgr/dsa.c + postgresql/src/backend/utils/mmgr/freepage.c + postgresql/src/backend/utils/mmgr/generation.c + postgresql/src/backend/utils/mmgr/mcxt.c + postgresql/src/backend/utils/mmgr/memdebug.c + postgresql/src/backend/utils/mmgr/portalmem.c + postgresql/src/backend/utils/mmgr/slab.c + postgresql/src/backend/utils/resowner/resowner.c + postgresql/src/backend/utils/sort/logtape.c + postgresql/src/backend/utils/sort/sharedtuplestore.c + postgresql/src/backend/utils/sort/sortsupport.c + postgresql/src/backend/utils/sort/tuplesort.c + postgresql/src/backend/utils/sort/tuplestore.c + postgresql/src/backend/utils/time/combocid.c + postgresql/src/backend/utils/time/snapmgr.c + postgresql/src/common/archive.c + postgresql/src/common/base64.c + postgresql/src/common/checksum_helper.c + postgresql/src/common/config_info.c + postgresql/src/common/controldata_utils.c + postgresql/src/common/d2s.c + postgresql/src/common/encnames.c + postgresql/src/common/exec.c + postgresql/src/common/f2s.c + postgresql/src/common/file_perm.c + postgresql/src/common/hashfn.c + postgresql/src/common/ip.c + postgresql/src/common/jsonapi.c + postgresql/src/common/keywords.c + postgresql/src/common/kwlookup.c + postgresql/src/common/link-canary.c + postgresql/src/common/md5.c + postgresql/src/common/pg_lzcompress.c + postgresql/src/common/pgfnames.c + postgresql/src/common/protocol_openssl.c + postgresql/src/common/psprintf.c + postgresql/src/common/relpath.c + postgresql/src/common/rmtree.c + postgresql/src/common/saslprep.c + postgresql/src/common/scram-common.c + postgresql/src/common/sha2_openssl.c + postgresql/src/common/string.c + postgresql/src/common/stringinfo.c + postgresql/src/common/unicode_norm.c + postgresql/src/common/username.c + postgresql/src/common/wait_error.c + postgresql/src/common/wchar.c + postgresql/src/port/chklocale.c + postgresql/src/port/erand48.c + postgresql/src/port/fls.c + postgresql/src/port/getpeereid.c + postgresql/src/port/inet_net_ntop.c + postgresql/src/port/noblock.c + postgresql/src/port/path.c + postgresql/src/port/pg_bitutils.c + postgresql/src/port/pg_crc32c_sb8.c + postgresql/src/port/pg_crc32c_sse42.c + postgresql/src/port/pg_crc32c_sse42_choose.c + postgresql/src/port/pg_strong_random.c + postgresql/src/port/pgcheckdir.c + postgresql/src/port/pgmkdirp.c + postgresql/src/port/pgsleep.c + postgresql/src/port/pgstrcasecmp.c + postgresql/src/port/pgstrsignal.c + postgresql/src/port/pqsignal.c + postgresql/src/port/qsort.c + postgresql/src/port/qsort_arg.c + postgresql/src/port/quotes.c + postgresql/src/port/snprintf.c + postgresql/src/port/sprompt.c + postgresql/src/port/strerror.c + postgresql/src/port/strlcat.c + postgresql/src/port/strlcpy.c + postgresql/src/port/tar.c + postgresql/src/port/thread.c + postgresql/src/timezone/localtime.c + postgresql/src/timezone/pgtz.c + postgresql/src/timezone/strftime.c +) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/common/reloptions.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/common/reloptions.c index 8ccc228a8c..61b03deea1 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/common/reloptions.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/common/reloptions.c @@ -527,11 +527,11 @@ static relopt_string stringRelOpts[] = }; static relopt_gen **relOpts = NULL; -static bits32 last_assigned_kind = RELOPT_KIND_LAST_DEFAULT; +static __thread bits32 last_assigned_kind = RELOPT_KIND_LAST_DEFAULT; -static int num_custom_options = 0; +static __thread int num_custom_options = 0; static relopt_gen **custom_options = NULL; -static bool need_initialization = true; +static __thread bool need_initialization = true; static void initialize_reloptions(void); static void parse_one_reloption(relopt_value *option, char *text_str, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gin/ginfast.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gin/ginfast.c index 2e41b34d8d..83e3e6de3d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gin/ginfast.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gin/ginfast.c @@ -36,7 +36,7 @@ #include "utils/rel.h" /* GUC parameter */ -int gin_pending_list_limit = 0; +__thread int gin_pending_list_limit = 0; #define GIN_PAGE_FREESIZE \ ( BLCKSZ - MAXALIGN(SizeOfPageHeaderData) - MAXALIGN(sizeof(GinPageOpaqueData)) ) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gin/ginget.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gin/ginget.c index 2cfccdedcf..fac11081a6 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gin/ginget.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gin/ginget.c @@ -23,7 +23,7 @@ #include "utils/rel.h" /* GUC parameter */ -int GinFuzzySearchLimit = 0; +__thread int GinFuzzySearchLimit = 0; typedef struct pendingPosition { diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gin/ginxlog.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gin/ginxlog.c index 9f8640565b..c5b4a21fc3 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gin/ginxlog.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gin/ginxlog.c @@ -19,7 +19,7 @@ #include "access/xlogutils.h" #include "utils/memutils.h" -static MemoryContext opCtx; /* working memory for operations */ +static __thread MemoryContext opCtx; /* working memory for operations */ static void ginRedoClearIncompleteSplit(XLogReaderState *record, uint8 block_id) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gist/gistxlog.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gist/gistxlog.c index b60dba052f..ce43ad0242 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gist/gistxlog.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/gist/gistxlog.c @@ -25,7 +25,7 @@ #include "utils/memutils.h" #include "utils/rel.h" -static MemoryContext opCtx; /* working memory for operations */ +static __thread MemoryContext opCtx; /* working memory for operations */ /* * Replay the clearing of F_FOLLOW_RIGHT flag on a child page. diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/heap/vacuumlazy.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/heap/vacuumlazy.c index fe2a6062b9..9223273500 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/heap/vacuumlazy.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/heap/vacuumlazy.c @@ -327,13 +327,13 @@ typedef struct LVSavedErrInfo } LVSavedErrInfo; /* A few variables that don't seem worth passing around as parameters */ -static int elevel = -1; +static __thread int elevel = -1; -static TransactionId OldestXmin; -static TransactionId FreezeLimit; -static MultiXactId MultiXactCutoff; +static __thread TransactionId OldestXmin; +static __thread TransactionId FreezeLimit; +static __thread MultiXactId MultiXactCutoff; -static BufferAccessStrategy vac_strategy; +static __thread BufferAccessStrategy vac_strategy; /* non-export function prototypes */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/nbtree/nbtxlog.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/nbtree/nbtxlog.c index ddb4bf7b3c..18df80b676 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/nbtree/nbtxlog.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/nbtree/nbtxlog.c @@ -24,7 +24,7 @@ #include "storage/procarray.h" #include "utils/memutils.h" -static MemoryContext opCtx; /* working memory for operations */ +static __thread MemoryContext opCtx; /* working memory for operations */ /* * _bt_restore_page -- re-enter all the index tuples on a page diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/spgist/spgxlog.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/spgist/spgxlog.c index 999d0ca15d..7515b0c846 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/spgist/spgxlog.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/spgist/spgxlog.c @@ -24,7 +24,7 @@ #include "utils/memutils.h" -static MemoryContext opCtx; /* working memory for operations */ +static __thread MemoryContext opCtx; /* working memory for operations */ /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/table/tableam.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/table/tableam.c index 4b2bb29559..1a63e83ea2 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/table/tableam.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/table/tableam.c @@ -32,7 +32,7 @@ /* GUC variables */ char *default_table_access_method = DEFAULT_TABLE_ACCESS_METHOD; -bool synchronize_seqscans = true; +__thread bool synchronize_seqscans = true; /* ---------------------------------------------------------------------------- diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/clog.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/clog.c index 40170b868b..8501cbbc83 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/clog.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/clog.c @@ -83,7 +83,7 @@ /* * Link to shared-memory data structures for CLOG control */ -static SlruCtlData XactCtlData; +static __thread SlruCtlData XactCtlData; #define XactCtl (&XactCtlData) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/commit_ts.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/commit_ts.c index baa0513947..490afdc9da 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/commit_ts.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/commit_ts.c @@ -74,7 +74,7 @@ typedef struct CommitTimestampEntry /* * Link to shared-memory data structures for CommitTs control */ -static SlruCtlData CommitTsCtlData; +static __thread SlruCtlData CommitTsCtlData; #define CommitTsCtl (&CommitTsCtlData) @@ -100,7 +100,7 @@ CommitTimestampShared *commitTsShared; /* GUC variable */ -bool track_commit_timestamp; +__thread bool track_commit_timestamp; static void SetXidCommitTsInPage(TransactionId xid, int nsubxids, TransactionId *subxids, TimestampTz ts, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/multixact.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/multixact.c index 7990b5e5dd..cb9350d3ba 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/multixact.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/multixact.c @@ -184,8 +184,8 @@ /* * Links to shared-memory data structures for MultiXact control */ -static SlruCtlData MultiXactOffsetCtlData; -static SlruCtlData MultiXactMemberCtlData; +static __thread SlruCtlData MultiXactOffsetCtlData; +static __thread SlruCtlData MultiXactMemberCtlData; #define MultiXactOffsetCtl (&MultiXactOffsetCtlData) #define MultiXactMemberCtl (&MultiXactMemberCtlData) @@ -319,9 +319,9 @@ typedef struct mXactCacheEnt } mXactCacheEnt; #define MAX_CACHE_ENTRIES 256 -static dlist_head MXactCache = DLIST_STATIC_INIT(MXactCache); -static int MXactCacheMembers = 0; -static MemoryContext MXactContext = NULL; +static __thread dlist_head MXactCache ;void MXactCache_init(void) { dlist_init(&MXactCache); } +static __thread int MXactCacheMembers = 0; +static __thread MemoryContext MXactContext = NULL; #ifdef MULTIXACT_DEBUG #define debug_elog2(a,b) elog(a,b) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/parallel.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/parallel.c index 95ab3722d3..a4364a74b4 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/parallel.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/parallel.c @@ -109,22 +109,22 @@ typedef struct FixedParallelState * and < the number of workers before any user code is invoked; each parallel * worker will get a different parallel worker number. */ -int ParallelWorkerNumber = -1; +__thread int ParallelWorkerNumber = -1; /* Is there a parallel message pending which we need to receive? */ -volatile bool ParallelMessagePending = false; +__thread volatile bool ParallelMessagePending = false; /* Are we initializing a parallel worker? */ -bool InitializingParallelWorker = false; +__thread bool InitializingParallelWorker = false; /* Pointer to our fixed parallel state. */ static FixedParallelState *MyFixedParallelState; /* List of active parallel contexts. */ -static dlist_head pcxt_list = DLIST_STATIC_INIT(pcxt_list); +static __thread dlist_head pcxt_list ;void pcxt_list_init(void) { dlist_init(&pcxt_list); } /* Backend-local copy of data from FixedParallelState. */ -static pid_t ParallelMasterPid; +static __thread pid_t ParallelMasterPid; /* * List of internal parallel worker entry points. We need this for diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/slru.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/slru.c index c19a1a6808..d2120c067f 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/slru.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/slru.c @@ -119,8 +119,8 @@ typedef enum SLRU_CLOSE_FAILED } SlruErrorCause; -static SlruErrorCause slru_errcause; -static int slru_errno; +static __thread SlruErrorCause slru_errcause; +static __thread int slru_errno; static void SimpleLruZeroLSNs(SlruCtl ctl, int slotno); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/subtrans.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/subtrans.c index 2eb1a26114..5369df15f4 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/subtrans.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/subtrans.c @@ -58,7 +58,7 @@ /* * Link to shared-memory data structures for SUBTRANS control */ -static SlruCtlData SubTransCtlData; +static __thread SlruCtlData SubTransCtlData; #define SubTransCtl (&SubTransCtlData) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/transam.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/transam.c index a28918657c..ebef8e4a90 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/transam.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/transam.c @@ -30,9 +30,9 @@ * same XID, for example when scanning a table just after a bulk insert, * update, or delete. */ -static TransactionId cachedFetchXid = InvalidTransactionId; -static XidStatus cachedFetchXidStatus; -static XLogRecPtr cachedCommitLSN; +static __thread TransactionId cachedFetchXid = InvalidTransactionId; +static __thread XidStatus cachedFetchXidStatus; +static __thread XLogRecPtr cachedCommitLSN; /* Local functions */ static XidStatus TransactionLogFetch(TransactionId transactionId); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/twophase.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/twophase.c index b42a45b408..4222405627 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/twophase.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/twophase.c @@ -114,7 +114,7 @@ #define TWOPHASE_DIR "pg_twophase" /* GUC variable, can't be changed after startup */ -int max_prepared_xacts = 0; +__thread int max_prepared_xacts = 0; /* * This struct describes one global transaction that is in prepared state @@ -196,9 +196,9 @@ static TwoPhaseStateData *TwoPhaseState; * TwoPhaseStateLock, though obviously the pointer itself doesn't need to be * (since it's just local memory). */ -static GlobalTransaction MyLockedGxact = NULL; +static __thread GlobalTransaction MyLockedGxact = NULL; -static bool twophaseExitRegistered = false; +static __thread bool twophaseExitRegistered = false; static void RecordTransactionCommitPrepared(TransactionId xid, int nchildren, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/varsup.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/varsup.c index e14b53bf9e..30b01e7f3e 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/varsup.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/varsup.c @@ -31,7 +31,7 @@ #define VAR_OID_PREFETCH 8192 /* pointer to "variable cache" in shared memory (set up by shmem.c) */ -VariableCache ShmemVariableCache = NULL; +__thread VariableCache ShmemVariableCache = NULL; /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xact.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xact.c index 8f198c2538..d2550a765d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xact.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xact.c @@ -72,16 +72,16 @@ /* * User-tweakable parameters */ -int DefaultXactIsoLevel = XACT_READ_COMMITTED; -int XactIsoLevel; +__thread int DefaultXactIsoLevel = XACT_READ_COMMITTED; +__thread int XactIsoLevel; -bool DefaultXactReadOnly = false; -bool XactReadOnly; +__thread bool DefaultXactReadOnly = false; +__thread bool XactReadOnly; -bool DefaultXactDeferrable = false; -bool XactDeferrable; +__thread bool DefaultXactDeferrable = false; +__thread bool XactDeferrable; -int synchronous_commit = SYNCHRONOUS_COMMIT_ON; +__thread int synchronous_commit = SYNCHRONOUS_COMMIT_ON; /* * When running as a parallel worker, we place only a single @@ -106,8 +106,8 @@ int synchronous_commit = SYNCHRONOUS_COMMIT_ON; * The XIDs are stored sorted in numerical order (not logical order) to make * lookups as fast as possible. */ -FullTransactionId XactTopFullTransactionId = {InvalidTransactionId}; -int nParallelCurrentXids = 0; +__thread FullTransactionId XactTopFullTransactionId = {InvalidTransactionId}; +__thread int nParallelCurrentXids = 0; TransactionId *ParallelCurrentXids; /* @@ -117,7 +117,7 @@ TransactionId *ParallelCurrentXids; * globally accessible, so can be set from anywhere in the code that requires * recording flags. */ -int MyXactFlags; +__thread int MyXactFlags; /* * transaction states - transaction state from server perspective @@ -221,7 +221,7 @@ typedef struct SerializedTransactionState * block. It will point to TopTransactionStateData when not in a * transaction at all, or when in a top-level transaction. */ -static TransactionStateData TopTransactionStateData = { +static __thread TransactionStateData TopTransactionStateData = { .state = TRANS_DEFAULT, .blockState = TBLOCK_DEFAULT, }; @@ -230,18 +230,19 @@ static TransactionStateData TopTransactionStateData = { * unreportedXids holds XIDs of all subtransactions that have not yet been * reported in an XLOG_XACT_ASSIGNMENT record. */ -static int nUnreportedXids; +static __thread int nUnreportedXids; static TransactionId unreportedXids[PGPROC_MAX_CACHED_SUBXIDS]; -static TransactionState CurrentTransactionState = &TopTransactionStateData; +static __thread TransactionState CurrentTransactionState ;void CurrentTransactionState_init(void) { CurrentTransactionState= &TopTransactionStateData; + }; /* * The subtransaction ID and command ID assignment counters are global * to a whole transaction, so we do not keep them in the state stack. */ -static SubTransactionId currentSubTransactionId; -static CommandId currentCommandId; -static bool currentCommandIdUsed; +static __thread SubTransactionId currentSubTransactionId; +static __thread CommandId currentCommandId; +static __thread bool currentCommandIdUsed; /* * xactStartTimestamp is the value of transaction_timestamp(). @@ -250,9 +251,9 @@ static bool currentCommandIdUsed; * These do not change as we enter and exit subtransactions, so we don't * keep them inside the TransactionState stack. */ -static TimestampTz xactStartTimestamp; -static TimestampTz stmtStartTimestamp; -static TimestampTz xactStopTimestamp; +static __thread TimestampTz xactStartTimestamp; +static __thread TimestampTz stmtStartTimestamp; +static __thread TimestampTz xactStopTimestamp; /* * GID to be used for preparing the current transaction. This is also @@ -263,17 +264,17 @@ static char *prepareGID; /* * Some commands want to force synchronous commit. */ -static bool forceSyncCommit = false; +static __thread bool forceSyncCommit = false; /* Flag for logging statements in a transaction. */ -bool xact_is_sampled = false; +__thread bool xact_is_sampled = false; /* * Private context for transaction-abort work --- we reserve space for this * at startup to ensure that AbortTransaction and AbortSubTransaction can work * when we've run out of memory. */ -static MemoryContext TransactionAbortContext = NULL; +static __thread MemoryContext TransactionAbortContext = NULL; /* * List of add-on start- and end-of-xact callbacks @@ -2910,9 +2911,9 @@ StartTransactionCommand(void) * GUC system resets the characteristics at transaction end, so for example * just skipping the reset in StartTransaction() won't work.) */ -static int save_XactIsoLevel; -static bool save_XactReadOnly; -static bool save_XactDeferrable; +static __thread int save_XactIsoLevel; +static __thread bool save_XactReadOnly; +static __thread bool save_XactDeferrable; void SaveTransactionCharacteristics(void) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xlog.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xlog.c index 3d76fad128..c361c65afd 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xlog.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xlog.c @@ -79,41 +79,41 @@ #include "utils/snapmgr.h" #include "utils/timestamp.h" -extern uint32 bootstrap_data_checksum_version; +extern __thread uint32 bootstrap_data_checksum_version; /* Unsupported old recovery command file names (relative to $PGDATA) */ #define RECOVERY_COMMAND_FILE "recovery.conf" #define RECOVERY_COMMAND_DONE "recovery.done" /* User-settable parameters */ -int max_wal_size_mb = 1024; /* 1 GB */ -int min_wal_size_mb = 80; /* 80 MB */ -int wal_keep_size_mb = 0; -int XLOGbuffers = -1; -int XLogArchiveTimeout = 0; -int XLogArchiveMode = ARCHIVE_MODE_OFF; +__thread int max_wal_size_mb = 1024; /* 1 GB */ +__thread int min_wal_size_mb = 80; /* 80 MB */ +__thread int wal_keep_size_mb = 0; +__thread int XLOGbuffers = -1; +__thread int XLogArchiveTimeout = 0; +__thread int XLogArchiveMode = ARCHIVE_MODE_OFF; char *XLogArchiveCommand = NULL; -bool EnableHotStandby = false; -bool fullPageWrites = true; -bool wal_log_hints = false; -bool wal_compression = false; +__thread bool EnableHotStandby = false; +__thread bool fullPageWrites = true; +__thread bool wal_log_hints = false; +__thread bool wal_compression = false; char *wal_consistency_checking_string = NULL; bool *wal_consistency_checking = NULL; -bool wal_init_zero = true; -bool wal_recycle = true; -bool log_checkpoints = false; -int sync_method = DEFAULT_SYNC_METHOD; -int wal_level = WAL_LEVEL_MINIMAL; -int CommitDelay = 0; /* precommit delay in microseconds */ -int CommitSiblings = 5; /* # concurrent xacts needed to sleep */ -int wal_retrieve_retry_interval = 5000; -int max_slot_wal_keep_size_mb = -1; +__thread bool wal_init_zero = true; +__thread bool wal_recycle = true; +__thread bool log_checkpoints = false; +__thread int sync_method = DEFAULT_SYNC_METHOD; +__thread int wal_level = WAL_LEVEL_MINIMAL; +__thread int CommitDelay = 0; /* precommit delay in microseconds */ +__thread int CommitSiblings = 5; /* # concurrent xacts needed to sleep */ +__thread int wal_retrieve_retry_interval = 5000; +__thread int max_slot_wal_keep_size_mb = -1; #ifdef WAL_DEBUG bool XLOG_DEBUG = false; #endif -int wal_segment_size = DEFAULT_XLOG_SEG_SIZE; +__thread int wal_segment_size = DEFAULT_XLOG_SEG_SIZE; /* * Number of WAL insertion locks to use. A higher value allows more insertions @@ -126,11 +126,11 @@ int wal_segment_size = DEFAULT_XLOG_SEG_SIZE; * Max distance from last checkpoint, before triggering a new xlog-based * checkpoint. */ -int CheckPointSegments; +__thread int CheckPointSegments; /* Estimated distance between checkpoints, in bytes */ -static double CheckPointDistanceEstimate = 0; -static double PrevCheckPointDistance = 0; +static __thread double CheckPointDistanceEstimate = 0; +static __thread double PrevCheckPointDistance = 0; /* * GUC support @@ -182,13 +182,13 @@ const struct config_enum_entry recovery_target_action_options[] = { * Because only the checkpointer or a stand-alone backend can perform * checkpoints, this will be unused in normal backends. */ -CheckpointStatsData CheckpointStats; +__thread CheckpointStatsData CheckpointStats; /* * ThisTimeLineID will be same in all backends --- it identifies current * WAL timeline for the database system. */ -TimeLineID ThisTimeLineID = 0; +__thread TimeLineID ThisTimeLineID = 0; /* * Are we doing recovery from XLOG? @@ -201,16 +201,16 @@ TimeLineID ThisTimeLineID = 0; * process you're running in, use RecoveryInProgress() but only after shared * memory startup and lock initialization. */ -bool InRecovery = false; +__thread bool InRecovery = false; /* Are we in Hot Standby mode? Only valid in startup process, see xlog.h */ -HotStandbyState standbyState = STANDBY_DISABLED; +__thread HotStandbyState standbyState = STANDBY_DISABLED; -static XLogRecPtr LastRec; +static __thread XLogRecPtr LastRec; /* Local copy of WalRcv->flushedUpto */ -static XLogRecPtr flushedUpto = 0; -static TimeLineID receiveTLI = 0; +static __thread XLogRecPtr flushedUpto = 0; +static __thread TimeLineID receiveTLI = 0; /* * abortedRecPtr is the start pointer of a broken record at end of WAL when @@ -218,8 +218,8 @@ static TimeLineID receiveTLI = 0; * contrecord that went missing. See CreateOverwriteContrecordRecord for * details. */ -static XLogRecPtr abortedRecPtr; -static XLogRecPtr missingContrecPtr; +static __thread XLogRecPtr abortedRecPtr; +static __thread XLogRecPtr missingContrecPtr; /* * During recovery, lastFullPageWrites keeps track of full_page_writes that @@ -227,26 +227,26 @@ static XLogRecPtr missingContrecPtr; * that the recovery starting checkpoint record indicates, and then updated * each time XLOG_FPW_CHANGE record is replayed. */ -static bool lastFullPageWrites; +static __thread bool lastFullPageWrites; /* * Local copy of the state tracked by SharedRecoveryState in shared memory, * It is false if SharedRecoveryState is RECOVERY_STATE_DONE. True actually * means "not known, need to check the shared state". */ -static bool LocalRecoveryInProgress = true; +static __thread bool LocalRecoveryInProgress = true; /* * Local copy of SharedHotStandbyActive variable. False actually means "not * known, need to check the shared state". */ -static bool LocalHotStandbyActive = false; +static __thread bool LocalHotStandbyActive = false; /* * Local copy of SharedPromoteIsTriggered variable. False actually means "not * known, need to check the shared state". */ -static bool LocalPromoteIsTriggered = false; +static __thread bool LocalPromoteIsTriggered = false; /* * Local state for XLogInsertAllowed(): @@ -258,7 +258,7 @@ static bool LocalPromoteIsTriggered = false; * The coding in XLogInsertAllowed() depends on the first two of these states * being numerically the same as bool true and false. */ -static int LocalXLogInsertAllowed = -1; +static __thread int LocalXLogInsertAllowed = -1; /* * When ArchiveRecoveryRequested is set, archive recovery was requested, @@ -271,14 +271,14 @@ static int LocalXLogInsertAllowed = -1; * will switch to using offline XLOG archives as soon as we reach the end of * WAL in pg_wal. */ -bool ArchiveRecoveryRequested = false; -bool InArchiveRecovery = false; +__thread bool ArchiveRecoveryRequested = false; +__thread bool InArchiveRecovery = false; -static bool standby_signal_file_found = false; -static bool recovery_signal_file_found = false; +static __thread bool standby_signal_file_found = false; +static __thread bool recovery_signal_file_found = false; /* Was the last xlog file restored from archive, or local? */ -static bool restoredFromArchive = false; +static __thread bool restoredFromArchive = false; /* Buffers dedicated to consistency checks of size BLCKSZ */ static char *replay_image_masked = NULL; @@ -288,38 +288,38 @@ static char *master_image_masked = NULL; char *recoveryRestoreCommand = NULL; char *recoveryEndCommand = NULL; char *archiveCleanupCommand = NULL; -RecoveryTargetType recoveryTarget = RECOVERY_TARGET_UNSET; -bool recoveryTargetInclusive = true; -int recoveryTargetAction = RECOVERY_TARGET_ACTION_PAUSE; -TransactionId recoveryTargetXid; +__thread RecoveryTargetType recoveryTarget = RECOVERY_TARGET_UNSET; +__thread bool recoveryTargetInclusive = true; +__thread int recoveryTargetAction = RECOVERY_TARGET_ACTION_PAUSE; +__thread TransactionId recoveryTargetXid; char *recovery_target_time_string; -static TimestampTz recoveryTargetTime; +static __thread TimestampTz recoveryTargetTime; const char *recoveryTargetName; -XLogRecPtr recoveryTargetLSN; -int recovery_min_apply_delay = 0; +__thread XLogRecPtr recoveryTargetLSN; +__thread int recovery_min_apply_delay = 0; /* options formerly taken from recovery.conf for XLOG streaming */ -bool StandbyModeRequested = false; +__thread bool StandbyModeRequested = false; char *PrimaryConnInfo = NULL; char *PrimarySlotName = NULL; char *PromoteTriggerFile = NULL; -bool wal_receiver_create_temp_slot = false; +__thread bool wal_receiver_create_temp_slot = false; /* are we currently in standby mode? */ -bool StandbyMode = false; +__thread bool StandbyMode = false; /* whether request for fast promotion has been made yet */ -static bool fast_promote = false; +static __thread bool fast_promote = false; /* * if recoveryStopsBefore/After returns true, it saves information of the stop * point here */ -static TransactionId recoveryStopXid; -static TimestampTz recoveryStopTime; -static XLogRecPtr recoveryStopLSN; +static __thread TransactionId recoveryStopXid; +static __thread TimestampTz recoveryStopTime; +static __thread XLogRecPtr recoveryStopLSN; static char recoveryStopName[MAXFNAMELEN]; -static bool recoveryStopAfter; +static __thread bool recoveryStopAfter; /* * During normal operation, the only timeline we care about is ThisTimeLineID. @@ -347,11 +347,11 @@ static bool recoveryStopAfter; * file was created.) During a sequential scan we do not allow this value * to decrease. */ -RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal = RECOVERY_TARGET_TIMELINE_LATEST; -TimeLineID recoveryTargetTLIRequested = 0; -TimeLineID recoveryTargetTLI = 0; +__thread RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal = RECOVERY_TARGET_TIMELINE_LATEST; +__thread TimeLineID recoveryTargetTLIRequested = 0; +__thread TimeLineID recoveryTargetTLI = 0; static List *expectedTLEs; -static TimeLineID curFileTLI; +static __thread TimeLineID curFileTLI; /* * ProcLastRecPtr points to the start of the last XLOG record inserted by the @@ -368,9 +368,9 @@ static TimeLineID curFileTLI; * stored here. The parallel leader advances its own copy, when necessary, * in WaitForParallelWorkersToFinish. */ -XLogRecPtr ProcLastRecPtr = InvalidXLogRecPtr; -XLogRecPtr XactLastRecEnd = InvalidXLogRecPtr; -XLogRecPtr XactLastCommitEnd = InvalidXLogRecPtr; +__thread XLogRecPtr ProcLastRecPtr = InvalidXLogRecPtr; +__thread XLogRecPtr XactLastRecEnd = InvalidXLogRecPtr; +__thread XLogRecPtr XactLastCommitEnd = InvalidXLogRecPtr; /* * RedoRecPtr is this backend's local copy of the REDO record pointer @@ -382,17 +382,17 @@ XLogRecPtr XactLastCommitEnd = InvalidXLogRecPtr; * see GetRedoRecPtr. A freshly spawned backend obtains the value during * InitXLOGAccess. */ -static XLogRecPtr RedoRecPtr; +static __thread XLogRecPtr RedoRecPtr; /* * doPageWrites is this backend's local copy of (forcePageWrites || * fullPageWrites). It is used together with RedoRecPtr to decide whether * a full-page image of a page need to be taken. */ -static bool doPageWrites; +static __thread bool doPageWrites; /* Has the recovery code requested a walreceiver wakeup? */ -static bool doRequestWalReceiverReply; +static __thread bool doRequestWalReceiverReply; /* * RedoStartLSN points to the checkpoint's REDO location which is specified @@ -404,7 +404,7 @@ static bool doRequestWalReceiverReply; * backwards to the REDO location after reading the checkpoint record, * because the REDO record can precede the checkpoint record. */ -static XLogRecPtr RedoStartLSN = InvalidXLogRecPtr; +static __thread XLogRecPtr RedoStartLSN = InvalidXLogRecPtr; /*---------- * Shared-memory data structures for XLOG control @@ -542,7 +542,7 @@ typedef enum ExclusiveBackupState * Session status of running backup, used for sanity checks in SQL-callable * functions to start and stop backups. */ -static SessionBackupState sessionBackupState = SESSION_BACKUP_NONE; +static __thread SessionBackupState sessionBackupState = SESSION_BACKUP_NONE; /* * Shared state data for WAL insertion. @@ -776,13 +776,13 @@ static ControlFileData *ControlFile = NULL; #define ConvertToXSegs(x, segsize) XLogMBVarToSegs((x), (segsize)) /* The number of bytes in a WAL segment usable for WAL data. */ -static int UsableBytesInSegment; +static __thread int UsableBytesInSegment; /* * Private, possibly out-of-date copy of shared LogwrtResult. * See discussion above. */ -static XLogwrtResult LogwrtResult = {0, 0}; +static __thread XLogwrtResult LogwrtResult = {0, 0}; /* * Codes indicating where we got a WAL file from during recovery, or where @@ -805,8 +805,8 @@ static const char *const xlogSourceNames[] = {"any", "archive", "pg_wal", "strea * write the XLOG, and so will normally refer to the active segment. * Note: call Reserve/ReleaseExternalFD to track consumption of this FD. */ -static int openLogFile = -1; -static XLogSegNo openLogSegNo = 0; +static __thread int openLogFile = -1; +static __thread XLogSegNo openLogSegNo = 0; /* * These variables are used similarly to the ones above, but for reading @@ -817,11 +817,11 @@ static XLogSegNo openLogSegNo = 0; * this FD too; but it doesn't currently seem worthwhile, since the XLOG is * not read by general-purpose sessions. */ -static int readFile = -1; -static XLogSegNo readSegNo = 0; -static uint32 readOff = 0; -static uint32 readLen = 0; -static XLogSource readSource = XLOG_FROM_ANY; +static __thread int readFile = -1; +static __thread XLogSegNo readSegNo = 0; +static __thread uint32 readOff = 0; +static __thread uint32 readLen = 0; +static __thread XLogSource readSource = XLOG_FROM_ANY; /* * Keeps track of which source we're currently reading from. This is @@ -833,9 +833,9 @@ static XLogSource readSource = XLOG_FROM_ANY; * pendingWalRcvRestart is set when a config change occurs that requires a * walreceiver restart. This is only valid in XLOG_FROM_STREAM state. */ -static XLogSource currentSource = XLOG_FROM_ANY; -static bool lastSourceFailed = false; -static bool pendingWalRcvRestart = false; +static __thread XLogSource currentSource = XLOG_FROM_ANY; +static __thread bool lastSourceFailed = false; +static __thread bool pendingWalRcvRestart = false; typedef struct XLogPageReadPrivate { @@ -852,12 +852,12 @@ typedef struct XLogPageReadPrivate * also changes when we try to read from a source and fail, while * XLogReceiptSource tracks where we last successfully read some WAL.) */ -static TimestampTz XLogReceiptTime = 0; -static XLogSource XLogReceiptSource = XLOG_FROM_ANY; +static __thread TimestampTz XLogReceiptTime = 0; +static __thread XLogSource XLogReceiptSource = XLOG_FROM_ANY; /* State information for XLOG reading */ -static XLogRecPtr ReadRecPtr; /* start of last record read */ -static XLogRecPtr EndRecPtr; /* end+1 of last record read */ +static __thread XLogRecPtr ReadRecPtr; /* start of last record read */ +static __thread XLogRecPtr EndRecPtr; /* end+1 of last record read */ /* * Local copies of equivalent fields in the control file. When running @@ -866,25 +866,25 @@ static XLogRecPtr EndRecPtr; /* end+1 of last record read */ * switched to false to prevent any updates while replaying records. * Those values are kept consistent as long as crash recovery runs. */ -static XLogRecPtr minRecoveryPoint; -static TimeLineID minRecoveryPointTLI; -static bool updateMinRecoveryPoint = true; +static __thread XLogRecPtr minRecoveryPoint; +static __thread TimeLineID minRecoveryPointTLI; +static __thread bool updateMinRecoveryPoint = true; /* * Have we reached a consistent database state? In crash recovery, we have * to replay all the WAL, so reachedConsistency is never set. During archive * recovery, the database is consistent once minRecoveryPoint is reached. */ -bool reachedConsistency = false; +__thread bool reachedConsistency = false; -static bool InRedo = false; +static __thread bool InRedo = false; /* Have we launched bgwriter during recovery? */ -static bool bgwriterLaunched = false; +static __thread bool bgwriterLaunched = false; /* For WALInsertLockAcquire/Release functions */ -static int MyLockNo = 0; -static bool holdingAllLocks = false; +static __thread int MyLockNo = 0; +static __thread bool holdingAllLocks = false; #ifdef WAL_DEBUG static MemoryContext walDebugCxt = NULL; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xlogfuncs.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xlogfuncs.c index 00e1b33ed5..3c5e918b80 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xlogfuncs.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xlogfuncs.c @@ -41,8 +41,8 @@ /* * Store label file and tablespace map during non-exclusive backups. */ -static StringInfo label_file; -static StringInfo tblspc_map_file; +static __thread StringInfo label_file; +static __thread StringInfo tblspc_map_file; /* * pg_start_backup: set up for taking an on-line backup dump diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xloginsert.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xloginsert.c index b21679f09e..5d8ff10ccd 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xloginsert.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xloginsert.c @@ -62,8 +62,8 @@ typedef struct } registered_buffer; static registered_buffer *registered_buffers; -static int max_registered_buffers; /* allocated size */ -static int max_registered_block_id = 0; /* highest block_id + 1 currently +static __thread int max_registered_buffers; /* allocated size */ +static __thread int max_registered_block_id = 0; /* highest block_id + 1 currently * registered */ /* @@ -72,10 +72,10 @@ static int max_registered_block_id = 0; /* highest block_id + 1 currently */ static XLogRecData *mainrdata_head; static XLogRecData *mainrdata_last = (XLogRecData *) &mainrdata_head; -static uint32 mainrdata_len; /* total # of bytes in chain */ +static __thread uint32 mainrdata_len; /* total # of bytes in chain */ /* flags for the in-progress insertion */ -static uint8 curinsert_flags = 0; +static __thread uint8 curinsert_flags = 0; /* * These are used to hold the record header while constructing a record. @@ -85,7 +85,7 @@ static uint8 curinsert_flags = 0; * For simplicity, it's allocated large enough to hold the headers for any * WAL record. */ -static XLogRecData hdr_rdt; +static __thread XLogRecData hdr_rdt; static char *hdr_scratch = NULL; #define SizeOfXlogOrigin (sizeof(RepOriginId) + sizeof(char)) @@ -99,13 +99,13 @@ static char *hdr_scratch = NULL; * An array of XLogRecData structs, to hold registered data. */ static XLogRecData *rdatas; -static int num_rdatas; /* entries currently used */ -static int max_rdatas; /* allocated size */ +static __thread int num_rdatas; /* entries currently used */ +static __thread int max_rdatas; /* allocated size */ -static bool begininsert_called = false; +static __thread bool begininsert_called = false; /* Memory context to hold the registered buffer and data references. */ -static MemoryContext xloginsert_cxt; +static __thread MemoryContext xloginsert_cxt; static XLogRecData *XLogRecordAssemble(RmgrId rmid, uint8 info, XLogRecPtr RedoRecPtr, bool doPageWrites, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xlogutils.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xlogutils.c index 322b0e8ff5..c0251e6e69 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xlogutils.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/access/transam/xlogutils.c @@ -32,7 +32,7 @@ /* GUC variable */ -bool ignore_invalid_pages = false; +__thread bool ignore_invalid_pages = false; /* * During XLOG replay, we may see XLOG records for incremental updates of diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/bootstrap/bootparse.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/bootstrap/bootparse.c index 32fc3d7c0b..4ff53215c2 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/bootstrap/bootparse.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/bootstrap/bootparse.c @@ -140,7 +140,7 @@ #define YYMALLOC palloc #define YYFREE pfree -static MemoryContext per_line_ctx = NULL; +static __thread MemoryContext per_line_ctx = NULL; static void do_start(void) @@ -170,7 +170,7 @@ do_end(void) } -static int num_columns_read = 0; +static __thread int num_columns_read = 0; #line 177 "bootparse.c" /* yacc.c:337 */ @@ -259,7 +259,7 @@ typedef union YYSTYPE YYSTYPE; #endif -extern YYSTYPE boot_yylval; +extern __thread YYSTYPE boot_yylval; int boot_yyparse (void); @@ -1178,7 +1178,7 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) int yychar; /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; +__thread YYSTYPE boot_yylval; /* Number of syntax errors so far. */ int yynerrs; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/bootstrap/bootscanner.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/bootstrap/bootscanner.c index 94b25456ca..886411fe51 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/bootstrap/bootscanner.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/bootstrap/bootscanner.c @@ -506,9 +506,9 @@ struct yy_buffer_state #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ +static __thread size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static __thread size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static __thread YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -525,19 +525,19 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static __thread char yy_hold_char; +static __thread int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = NULL; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static __thread int yy_init = 0; /* whether we need to initialize */ +static __thread int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ -static int yy_did_buffer_switch_on_eof; +static __thread int yy_did_buffer_switch_on_eof; void yyrestart ( FILE *input_file ); void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); @@ -770,7 +770,7 @@ static const flex_int16_t yy_chk[192] = } ; -static yy_state_type yy_last_accepting_state; +static __thread yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; @@ -838,7 +838,7 @@ fprintf_to_ereport(const char *fmt, const char *msg) } -static int yyline = 1; /* line number for error reporting */ +static __thread int yyline = 1; /* line number for error reporting */ #line 844 "bootscanner.c" #define YY_NO_INPUT 1 diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/bootstrap/bootstrap.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/bootstrap/bootstrap.c index 5480a024e0..9878552475 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/bootstrap/bootstrap.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/bootstrap/bootstrap.c @@ -50,7 +50,7 @@ #include "utils/rel.h" #include "utils/relmapper.h" -uint32 bootstrap_data_checksum_version = 0; /* No checksum */ +__thread uint32 bootstrap_data_checksum_version = 0; /* No checksum */ #define ALLOC(t, c) \ @@ -69,12 +69,12 @@ static void cleanup(void); * ---------------- */ -AuxProcType MyAuxProcType = NotAnAuxProcess; /* declared in miscadmin.h */ +__thread AuxProcType MyAuxProcType = NotAnAuxProcess; /* declared in miscadmin.h */ -Relation boot_reldesc; /* current relation descriptor */ +__thread Relation boot_reldesc; /* current relation descriptor */ Form_pg_attribute attrtypes[MAXATTR]; /* points to attribute info */ -int numattr; /* number of attributes for cur. rel */ +__thread int numattr; /* number of attributes for cur. rel */ /* @@ -164,10 +164,10 @@ struct typmap static struct typmap **Typ = NULL; static struct typmap *Ap = NULL; -static Datum values[MAXATTR]; /* current row's attribute values */ +static __thread Datum values[MAXATTR]; /* current row's attribute values */ static bool Nulls[MAXATTR]; -static MemoryContext nogc = NULL; /* special no-gc mem context */ +static __thread MemoryContext nogc = NULL; /* special no-gc mem context */ /* * At bootstrap time, we first declare all the indices to be built, and diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/aclchk.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/aclchk.c index 4f1e8a46e0..b4b49fb4e5 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/aclchk.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/aclchk.c @@ -98,7 +98,7 @@ typedef struct * this variable to let us know that we need to populate the pg_init_privs * table for the GRANT/REVOKE commands while this variable is set to true. */ -bool binary_upgrade_record_init_privs = false; +__thread bool binary_upgrade_record_init_privs = false; static void ExecGrantStmt_oids(InternalGrant *istmt); static void ExecGrant_Relation(InternalGrant *grantStmt); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/heap.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/heap.c index a42070fd92..622d8ec791 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/heap.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/heap.c @@ -89,8 +89,8 @@ /* Potentially set by pg_upgrade_support functions */ -Oid binary_upgrade_next_heap_pg_class_oid = InvalidOid; -Oid binary_upgrade_next_toast_pg_class_oid = InvalidOid; +__thread Oid binary_upgrade_next_heap_pg_class_oid = InvalidOid; +__thread Oid binary_upgrade_next_toast_pg_class_oid = InvalidOid; static void AddNewRelationTuple(Relation pg_class_desc, Relation new_rel_desc, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/index.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/index.c index 54f807af57..77db2d43b8 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/index.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/index.c @@ -83,7 +83,7 @@ #include "utils/tuplesort.h" /* Potentially set by pg_upgrade_support functions */ -Oid binary_upgrade_next_index_pg_class_oid = InvalidOid; +__thread Oid binary_upgrade_next_index_pg_class_oid = InvalidOid; /* * Pointer-free representation of variables used when reindexing system @@ -3860,10 +3860,10 @@ reindex_relation(Oid relid, int flags, int options) * ---------------------------------------------------------------- */ -static Oid currentlyReindexedHeap = InvalidOid; -static Oid currentlyReindexedIndex = InvalidOid; +static __thread Oid currentlyReindexedHeap = InvalidOid; +static __thread Oid currentlyReindexedIndex = InvalidOid; static List *pendingReindexedIndexes = NIL; -static int reindexingNestLevel = 0; +static __thread int reindexingNestLevel = 0; /* * ReindexIsProcessingHeap diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/namespace.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/namespace.c index 2ec23016fe..33c3c1ca84 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/namespace.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/namespace.c @@ -138,26 +138,26 @@ static List *activeSearchPath = NIL; /* default place to create stuff; if InvalidOid, no default */ -static Oid activeCreationNamespace = InvalidOid; +static __thread Oid activeCreationNamespace = InvalidOid; /* if true, activeCreationNamespace is wrong, it should be temp namespace */ -static bool activeTempCreationPending = false; +static __thread bool activeTempCreationPending = false; /* current generation counter; make sure this is never zero */ -static uint64 activePathGeneration = 1; +static __thread uint64 activePathGeneration = 1; /* These variables are the values last derived from namespace_search_path: */ static List *baseSearchPath = NIL; -static Oid baseCreationNamespace = InvalidOid; +static __thread Oid baseCreationNamespace = InvalidOid; -static bool baseTempCreationPending = false; +static __thread bool baseTempCreationPending = false; -static Oid namespaceUser = InvalidOid; +static __thread Oid namespaceUser = InvalidOid; /* The above four values are valid only if baseSearchPathValid */ -static bool baseSearchPathValid = true; +static __thread bool baseSearchPathValid = true; /* Override requests are remembered in a stack of OverrideStackEntry structs */ @@ -185,11 +185,11 @@ static List *overrideStack = NIL; * we either haven't made the TEMP namespace yet, or have successfully * committed its creation, depending on whether myTempNamespace is valid. */ -static Oid myTempNamespace = InvalidOid; +static __thread Oid myTempNamespace = InvalidOid; -static Oid myTempToastNamespace = InvalidOid; +static __thread Oid myTempToastNamespace = InvalidOid; -static SubTransactionId myTempNamespaceSubID = InvalidSubTransactionId; +static __thread SubTransactionId myTempNamespaceSubID = InvalidSubTransactionId; /* * This is the user's textual search path specification --- it's the value diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/objectaccess.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/objectaccess.c index 17d7c56198..12cc53daad 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/objectaccess.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/objectaccess.c @@ -19,7 +19,7 @@ * Hook on object accesses. This is intended as infrastructure for security * and logging plugins. */ -object_access_hook_type object_access_hook = NULL; +__thread object_access_hook_type object_access_hook = NULL; /* * RunObjectPostCreateHook diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/pg_enum.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/pg_enum.c index 27e4100a6f..9b31f3ebab 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/pg_enum.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/pg_enum.c @@ -33,7 +33,7 @@ #include "utils/syscache.h" /* Potentially set by pg_upgrade_support functions */ -Oid binary_upgrade_next_pg_enum_oid = InvalidOid; +__thread Oid binary_upgrade_next_pg_enum_oid = InvalidOid; /* * Hash table of enum value OIDs created during the current transaction by diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/pg_type.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/pg_type.c index 932e110938..feb0bc0097 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/pg_type.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/pg_type.c @@ -37,7 +37,7 @@ #include "utils/syscache.h" /* Potentially set by pg_upgrade_support functions */ -Oid binary_upgrade_next_pg_type_oid = InvalidOid; +__thread Oid binary_upgrade_next_pg_type_oid = InvalidOid; /* ---------------------------------------------------------------- * TypeShellMake diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/storage.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/storage.c index 74216785b7..724d388185 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/storage.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/storage.c @@ -35,7 +35,7 @@ #include "utils/rel.h" /* GUC variables */ -int wal_skip_threshold = 2048; /* in kilobytes */ +__thread int wal_skip_threshold = 2048; /* in kilobytes */ /* * We keep a list of all relations (represented as RelFileNode values) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/toasting.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/toasting.c index 2d4a7e1b68..db9fdcba1c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/toasting.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/catalog/toasting.c @@ -35,7 +35,7 @@ #include "utils/syscache.h" /* Potentially set by pg_upgrade_support functions */ -Oid binary_upgrade_next_toast_pg_type_oid = InvalidOid; +__thread Oid binary_upgrade_next_toast_pg_type_oid = InvalidOid; static void CheckAndCreateToastTable(Oid relOid, Datum reloptions, LOCKMODE lockmode, bool check, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/analyze.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/analyze.c index 0137c43693..f1a4c0208b 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/analyze.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/analyze.c @@ -78,11 +78,11 @@ typedef struct AnlIndexData /* Default statistics target (GUC parameter) */ -int default_statistics_target = 100; +__thread int default_statistics_target = 100; /* A few variables that don't seem worth passing around as parameters */ -static MemoryContext anl_context = NULL; -static BufferAccessStrategy vac_strategy; +static __thread MemoryContext anl_context = NULL; +static __thread BufferAccessStrategy vac_strategy; static void do_analyze_rel(Relation onerel, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/async.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/async.c index 912d810477..18872ce7cc 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/async.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/async.c @@ -308,7 +308,7 @@ static AsyncQueueControl *asyncQueueControl; /* * The SLRU buffer area through which we access the notification queue */ -static SlruCtlData NotifyCtlData; +static __thread SlruCtlData NotifyCtlData; #define NotifyCtl (&NotifyCtlData) #define QUEUE_PAGESIZE BLCKSZ @@ -431,19 +431,19 @@ static NotificationList *pendingNotifies = NULL; * latch. ProcessNotifyInterrupt() will then be called whenever it's safe to * actually deal with the interrupt. */ -volatile sig_atomic_t notifyInterruptPending = false; +__thread volatile sig_atomic_t notifyInterruptPending = false; /* True if we've registered an on_shmem_exit cleanup */ -static bool unlistenExitRegistered = false; +static __thread bool unlistenExitRegistered = false; /* True if we're currently registered as a listener in asyncQueueControl */ -static bool amRegisteredListener = false; +static __thread bool amRegisteredListener = false; /* have we advanced to a page that's a multiple of QUEUE_CLEANUP_DELAY? */ -static bool tryAdvanceTail = false; +static __thread bool tryAdvanceTail = false; /* GUC parameter */ -bool Trace_notify = false; +__thread bool Trace_notify = false; /* local function prototypes */ static int asyncQueuePageDiff(int p, int q); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/explain.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/explain.c index 20708db9f1..36a6bc9eca 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/explain.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/explain.c @@ -41,10 +41,10 @@ /* Hook for plugins to get control in ExplainOneQuery() */ -ExplainOneQuery_hook_type ExplainOneQuery_hook = NULL; +__thread ExplainOneQuery_hook_type ExplainOneQuery_hook = NULL; /* Hook for plugins to get control in explain_get_index_name() */ -explain_get_index_name_hook_type explain_get_index_name_hook = NULL; +__thread explain_get_index_name_hook_type explain_get_index_name_hook = NULL; /* OR-able flags for ExplainXMLTag() */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/extension.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/extension.c index ed0691592e..e774c90f88 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/extension.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/extension.c @@ -68,8 +68,8 @@ /* Globally visible state variables */ -bool creating_extension = false; -Oid CurrentExtensionObject = InvalidOid; +__thread bool creating_extension = false; +__thread Oid CurrentExtensionObject = InvalidOid; /* * Internal data structure to hold the results of parsing a control file diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/matview.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/matview.c index 2ba5172f7c..33e91ac679 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/matview.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/matview.c @@ -58,7 +58,7 @@ typedef struct BulkInsertState bistate; /* bulk insert state */ } DR_transientrel; -static int matview_maintenance_depth = 0; +static __thread int matview_maintenance_depth = 0; static void transientrel_startup(DestReceiver *self, int operation, TupleDesc typeinfo); static bool transientrel_receive(TupleTableSlot *slot, DestReceiver *self); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/trigger.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/trigger.c index 788b92c7b8..32080e118f 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/trigger.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/trigger.c @@ -64,10 +64,10 @@ /* GUC variables */ -int SessionReplicationRole = SESSION_REPLICATION_ROLE_ORIGIN; +__thread int SessionReplicationRole = SESSION_REPLICATION_ROLE_ORIGIN; /* How many levels deep into trigger execution are we? */ -static int MyTriggerDepth = 0; +static __thread int MyTriggerDepth = 0; /* Local function prototypes */ static void SetTriggerFlags(TriggerDesc *trigdesc, Trigger *trigger); @@ -3466,7 +3466,7 @@ struct AfterTriggersTableData TupleTableSlot *storeslot; /* for converting to tuplestore's format */ }; -static AfterTriggersData afterTriggers; +static __thread AfterTriggersData afterTriggers; static void AfterTriggerExecute(EState *estate, AfterTriggerEvent event, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/typecmds.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/typecmds.c index 11a46ab7bb..49d4b7b55d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/typecmds.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/typecmds.c @@ -104,7 +104,7 @@ typedef struct } AlterTypeRecurseParams; /* Potentially set by pg_upgrade_support functions */ -Oid binary_upgrade_next_array_pg_type_oid = InvalidOid; +__thread Oid binary_upgrade_next_array_pg_type_oid = InvalidOid; static void makeRangeConstructors(const char *name, Oid namespace, Oid rangeOid, Oid subtype); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/user.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/user.c index a7d13d7eb9..a15518338b 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/user.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/user.c @@ -39,14 +39,14 @@ #include "utils/timestamp.h" /* Potentially set by pg_upgrade_support functions */ -Oid binary_upgrade_next_pg_authid_oid = InvalidOid; +__thread Oid binary_upgrade_next_pg_authid_oid = InvalidOid; /* GUC parameter */ -int Password_encryption = PASSWORD_TYPE_MD5; +__thread int Password_encryption = PASSWORD_TYPE_MD5; /* Hook to check passwords in CreateRole() and AlterRole() */ -check_password_hook_type check_password_hook = NULL; +__thread check_password_hook_type check_password_hook = NULL; static void AddRoleMems(const char *rolename, Oid roleid, List *memberSpecs, List *memberIds, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/vacuum.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/vacuum.c index 5ef6698790..daa6797798 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/vacuum.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/commands/vacuum.c @@ -58,15 +58,15 @@ /* * GUC parameters */ -int vacuum_freeze_min_age; -int vacuum_freeze_table_age; -int vacuum_multixact_freeze_min_age; -int vacuum_multixact_freeze_table_age; +__thread int vacuum_freeze_min_age; +__thread int vacuum_freeze_table_age; +__thread int vacuum_multixact_freeze_min_age; +__thread int vacuum_multixact_freeze_table_age; /* A few variables that don't seem worth passing around as parameters */ -static MemoryContext vac_context = NULL; -static BufferAccessStrategy vac_strategy; +static __thread MemoryContext vac_context = NULL; +static __thread BufferAccessStrategy vac_strategy; /* @@ -75,7 +75,7 @@ static BufferAccessStrategy vac_strategy; */ pg_atomic_uint32 *VacuumSharedCostBalance = NULL; pg_atomic_uint32 *VacuumActiveNWorkers = NULL; -int VacuumCostBalanceLocal = 0; +__thread int VacuumCostBalanceLocal = 0; /* non-export function prototypes */ static List *expand_vacuum_rel(VacuumRelation *vrel, int options); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/executor/execMain.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/executor/execMain.c index 565262dd27..e461414695 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/executor/execMain.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/executor/execMain.c @@ -67,13 +67,13 @@ /* Hooks for plugins to get control in ExecutorStart/Run/Finish/End */ -ExecutorStart_hook_type ExecutorStart_hook = NULL; -ExecutorRun_hook_type ExecutorRun_hook = NULL; -ExecutorFinish_hook_type ExecutorFinish_hook = NULL; -ExecutorEnd_hook_type ExecutorEnd_hook = NULL; +__thread ExecutorStart_hook_type ExecutorStart_hook = NULL; +__thread ExecutorRun_hook_type ExecutorRun_hook = NULL; +__thread ExecutorFinish_hook_type ExecutorFinish_hook = NULL; +__thread ExecutorEnd_hook_type ExecutorEnd_hook = NULL; /* Hook for plugin to get control in ExecCheckRTPerms() */ -ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook = NULL; +__thread ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook = NULL; /* decls for local routines only used within this module */ static void InitPlan(QueryDesc *queryDesc, int eflags); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/executor/instrument.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/executor/instrument.c index fbedb5aaf6..e60255206c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/executor/instrument.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/executor/instrument.c @@ -17,10 +17,10 @@ #include "executor/instrument.h" -BufferUsage pgBufferUsage; -static BufferUsage save_pgBufferUsage; -WalUsage pgWalUsage; -static WalUsage save_pgWalUsage; +__thread BufferUsage pgBufferUsage; +static __thread BufferUsage save_pgBufferUsage; +__thread WalUsage pgWalUsage; +static __thread WalUsage save_pgWalUsage; static void BufferUsageAdd(BufferUsage *dst, const BufferUsage *add); static void WalUsageAdd(WalUsage *dst, WalUsage *add); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/executor/spi.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/executor/spi.c index 97b1a63527..6adb64b9ad 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/executor/spi.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/executor/spi.c @@ -42,14 +42,14 @@ * interference between different SPI callers, we save and restore them * when entering/exiting a SPI nesting level. */ -uint64 SPI_processed = 0; +__thread uint64 SPI_processed = 0; SPITupleTable *SPI_tuptable = NULL; -int SPI_result = 0; +__thread int SPI_result = 0; static _SPI_connection *_SPI_stack = NULL; static _SPI_connection *_SPI_current = NULL; -static int _SPI_stack_depth = 0; /* allocated size of _SPI_stack */ -static int _SPI_connected = -1; /* current stack index */ +static __thread int _SPI_stack_depth = 0; /* allocated size of _SPI_stack */ +static __thread int _SPI_connected = -1; /* current stack index */ static Portal SPI_cursor_open_internal(const char *name, SPIPlanPtr plan, ParamListInfo paramLI, bool read_only); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/jit/jit.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/jit/jit.c index 5ca3f922fe..c9d172610d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/jit/jit.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/jit/jit.c @@ -29,20 +29,20 @@ #include "utils/resowner_private.h" /* GUCs */ -bool jit_enabled = true; +__thread bool jit_enabled = true; char *jit_provider = NULL; -bool jit_debugging_support = false; -bool jit_dump_bitcode = false; -bool jit_expressions = true; -bool jit_profiling_support = false; -bool jit_tuple_deforming = true; -double jit_above_cost = 100000; -double jit_inline_above_cost = 500000; -double jit_optimize_above_cost = 500000; - -static JitProviderCallbacks provider; -static bool provider_successfully_loaded = false; -static bool provider_failed_loading = false; +__thread bool jit_debugging_support = false; +__thread bool jit_dump_bitcode = false; +__thread bool jit_expressions = true; +__thread bool jit_profiling_support = false; +__thread bool jit_tuple_deforming = true; +__thread double jit_above_cost = 100000; +__thread double jit_inline_above_cost = 500000; +__thread double jit_optimize_above_cost = 500000; + +static __thread JitProviderCallbacks provider; +static __thread bool provider_successfully_loaded = false; +static __thread bool provider_failed_loading = false; static bool provider_init(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/auth.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/auth.c index 8c0e4d4213..e1d9f92ea5 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/auth.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/auth.c @@ -167,7 +167,7 @@ static int CheckCertAuth(Port *port); *---------------------------------------------------------------- */ char *pg_krb_server_keyfile; -bool pg_krb_caseins_users; +__thread bool pg_krb_caseins_users; /*---------------------------------------------------------------- @@ -238,7 +238,7 @@ static int PerformRadiusTransaction(const char *server, const char *secret, cons * but before the user has been informed about the results. It could be used * to record login events, insert a delay after failed authentication, etc. */ -ClientAuthentication_hook_type ClientAuthentication_hook = NULL; +__thread ClientAuthentication_hook_type ClientAuthentication_hook = NULL; /* * Tell the user the authentication failed, but not (much about) why. diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/be-fsstubs.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/be-fsstubs.c index 39e59f1c79..e14f5ca465 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/be-fsstubs.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/be-fsstubs.c @@ -67,10 +67,10 @@ * cookies_size entries, of which any unused entries will be NULL. */ static LargeObjectDesc **cookies = NULL; -static int cookies_size = 0; +static __thread int cookies_size = 0; -static bool lo_cleanup_needed = false; -static MemoryContext fscxt = NULL; +static __thread bool lo_cleanup_needed = false; +static __thread MemoryContext fscxt = NULL; static int newLOfd(void); static void closeLOfd(int fd); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/be-secure-openssl.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/be-secure-openssl.c index 3b1a5b1b9b..a04f404782 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/be-secure-openssl.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/be-secure-openssl.c @@ -47,7 +47,7 @@ /* default init hook can be overridden by a shared library */ static void default_openssl_tls_init(SSL_CTX *context, bool isServerStart); -openssl_tls_init_hook_typ openssl_tls_init_hook = default_openssl_tls_init; +__thread openssl_tls_init_hook_typ openssl_tls_init_hook = default_openssl_tls_init; static int my_sock_read(BIO *h, char *buf, int size); static int my_sock_write(BIO *h, const char *buf, int size); @@ -67,9 +67,9 @@ static const char *SSLerrmessage(unsigned long ecode); static char *X509_NAME_to_cstring(X509_NAME *name); static SSL_CTX *SSL_context = NULL; -static bool SSL_initialized = false; -static bool dummy_ssl_passwd_cb_called = false; -static bool ssl_is_server_start; +static __thread bool SSL_initialized = false; +static __thread bool dummy_ssl_passwd_cb_called = false; +static __thread bool ssl_is_server_start; static int ssl_protocol_version_to_openssl(int v); static const char *ssl_protocol_version_to_string(int v); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/be-secure.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/be-secure.c index 59bc02e79c..2c9702bf4d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/be-secure.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/be-secure.c @@ -44,10 +44,10 @@ char *ssl_ca_file; char *ssl_crl_file; char *ssl_dh_params_file; char *ssl_passphrase_command; -bool ssl_passphrase_command_supports_reload; +__thread bool ssl_passphrase_command_supports_reload; #ifdef USE_SSL -bool ssl_loaded_verify_locations = false; +__thread bool ssl_loaded_verify_locations = false; #endif /* GUC variable controlling SSL cipher list */ @@ -57,10 +57,10 @@ char *SSLCipherSuites = NULL; char *SSLECDHCurve; /* GUC variable: if false, prefer client ciphers */ -bool SSLPreferServerCiphers; +__thread bool SSLPreferServerCiphers; -int ssl_min_protocol_version; -int ssl_max_protocol_version; +__thread int ssl_min_protocol_version; +__thread int ssl_max_protocol_version; /* ------------------------------------------------------------ */ /* Procedures common to all secure sessions */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/hba.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/hba.c index 4e54f625d2..25f81f190b 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/hba.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/hba.c @@ -99,7 +99,7 @@ typedef struct TokenizedLine * parsed_hba_context is the memory context where it lives. */ static List *parsed_hba_lines = NIL; -static MemoryContext parsed_hba_context = NULL; +static __thread MemoryContext parsed_hba_context = NULL; /* * pre-parsed content of ident mapping file: list of IdentLine structs. @@ -110,7 +110,7 @@ static MemoryContext parsed_hba_context = NULL; * memory context, they need to be explicitly free'd. */ static List *parsed_ident_lines = NIL; -static MemoryContext parsed_ident_context = NULL; +static __thread MemoryContext parsed_ident_context = NULL; /* * The following character array represents the names of the authentication diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/pqcomm.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/pqcomm.c index 93f2e0b81d..c1ff0cdaba 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/pqcomm.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/pqcomm.c @@ -116,7 +116,7 @@ /* * Configuration options */ -int Unix_socket_permissions; +__thread int Unix_socket_permissions; char *Unix_socket_group; /* Where the Unix socket files are (list of palloc'd strings) */ @@ -133,20 +133,20 @@ static List *sock_paths = NIL; #define PQ_RECV_BUFFER_SIZE 8192 static char *PqSendBuffer; -static int PqSendBufferSize; /* Size send buffer */ -static int PqSendPointer; /* Next index to store a byte in PqSendBuffer */ -static int PqSendStart; /* Next index to send a byte in PqSendBuffer */ +static __thread int PqSendBufferSize; /* Size send buffer */ +static __thread int PqSendPointer; /* Next index to store a byte in PqSendBuffer */ +static __thread int PqSendStart; /* Next index to send a byte in PqSendBuffer */ static char PqRecvBuffer[PQ_RECV_BUFFER_SIZE]; -static int PqRecvPointer; /* Next index to read a byte from PqRecvBuffer */ -static int PqRecvLength; /* End of data available in PqRecvBuffer */ +static __thread int PqRecvPointer; /* Next index to read a byte from PqRecvBuffer */ +static __thread int PqRecvLength; /* End of data available in PqRecvBuffer */ /* * Message status */ -static bool PqCommBusy; /* busy sending data to the client */ -static bool PqCommReadingMsg; /* in the middle of reading a message */ -static bool DoingCopyOut; /* in old-protocol COPY OUT processing */ +static __thread bool PqCommBusy; /* busy sending data to the client */ +static __thread bool PqCommReadingMsg; /* in the middle of reading a message */ +static __thread bool DoingCopyOut; /* in old-protocol COPY OUT processing */ /* Internal functions */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/pqmq.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/pqmq.c index 743d24cee5..628f2bde59 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/pqmq.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/libpq/pqmq.c @@ -22,9 +22,9 @@ #include "utils/builtins.h" static shm_mq_handle *pq_mq_handle; -static bool pq_mq_busy = false; -static pid_t pq_mq_parallel_master_pid = 0; -static pid_t pq_mq_parallel_master_backend_id = InvalidBackendId; +static __thread bool pq_mq_busy = false; +static __thread pid_t pq_mq_parallel_master_pid = 0; +static __thread pid_t pq_mq_parallel_master_backend_id = InvalidBackendId; static void pq_cleanup_redirect_to_shm_mq(dsm_segment *seg, Datum arg); static void mq_comm_reset(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/geqo/geqo_main.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/geqo/geqo_main.c index 2db490de59..d0e44f6a38 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/geqo/geqo_main.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/geqo/geqo_main.c @@ -36,11 +36,11 @@ /* * Configuration options */ -int Geqo_effort; -int Geqo_pool_size; -int Geqo_generations; -double Geqo_selection_bias; -double Geqo_seed; +__thread int Geqo_effort; +__thread int Geqo_pool_size; +__thread int Geqo_generations; +__thread double Geqo_selection_bias; +__thread double Geqo_seed; static int gimme_pool_size(int nr_rel); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/path/allpaths.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/path/allpaths.c index e7a3e92bc2..872b1a7551 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/path/allpaths.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/path/allpaths.c @@ -59,16 +59,16 @@ typedef struct pushdown_safety_info } pushdown_safety_info; /* These parameters are set by GUC */ -bool enable_geqo = false; /* just in case GUC doesn't set it */ -int geqo_threshold; -int min_parallel_table_scan_size; -int min_parallel_index_scan_size; +__thread bool enable_geqo = false; /* just in case GUC doesn't set it */ +__thread int geqo_threshold; +__thread int min_parallel_table_scan_size; +__thread int min_parallel_index_scan_size; /* Hook for plugins to get control in set_rel_pathlist() */ -set_rel_pathlist_hook_type set_rel_pathlist_hook = NULL; +__thread set_rel_pathlist_hook_type set_rel_pathlist_hook = NULL; /* Hook for plugins to replace standard_join_search() */ -join_search_hook_type join_search_hook = NULL; +__thread join_search_hook_type join_search_hook = NULL; static void set_base_rel_consider_startup(PlannerInfo *root); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/path/costsize.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/path/costsize.c index 92b5223fee..ac8d47580f 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/path/costsize.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/path/costsize.c @@ -111,38 +111,38 @@ #define APPEND_CPU_COST_MULTIPLIER 0.5 -double seq_page_cost = DEFAULT_SEQ_PAGE_COST; -double random_page_cost = DEFAULT_RANDOM_PAGE_COST; -double cpu_tuple_cost = DEFAULT_CPU_TUPLE_COST; -double cpu_index_tuple_cost = DEFAULT_CPU_INDEX_TUPLE_COST; -double cpu_operator_cost = DEFAULT_CPU_OPERATOR_COST; -double parallel_tuple_cost = DEFAULT_PARALLEL_TUPLE_COST; -double parallel_setup_cost = DEFAULT_PARALLEL_SETUP_COST; - -int effective_cache_size = DEFAULT_EFFECTIVE_CACHE_SIZE; - -Cost disable_cost = 1.0e10; - -int max_parallel_workers_per_gather = 2; - -bool enable_seqscan = true; -bool enable_indexscan = true; -bool enable_indexonlyscan = true; -bool enable_bitmapscan = true; -bool enable_tidscan = true; -bool enable_sort = true; -bool enable_incremental_sort = true; -bool enable_hashagg = true; -bool enable_nestloop = true; -bool enable_material = true; -bool enable_mergejoin = true; -bool enable_hashjoin = true; -bool enable_gathermerge = true; -bool enable_partitionwise_join = false; -bool enable_partitionwise_aggregate = false; -bool enable_parallel_append = true; -bool enable_parallel_hash = true; -bool enable_partition_pruning = true; +__thread double seq_page_cost = DEFAULT_SEQ_PAGE_COST; +__thread double random_page_cost = DEFAULT_RANDOM_PAGE_COST; +__thread double cpu_tuple_cost = DEFAULT_CPU_TUPLE_COST; +__thread double cpu_index_tuple_cost = DEFAULT_CPU_INDEX_TUPLE_COST; +__thread double cpu_operator_cost = DEFAULT_CPU_OPERATOR_COST; +__thread double parallel_tuple_cost = DEFAULT_PARALLEL_TUPLE_COST; +__thread double parallel_setup_cost = DEFAULT_PARALLEL_SETUP_COST; + +__thread int effective_cache_size = DEFAULT_EFFECTIVE_CACHE_SIZE; + +__thread Cost disable_cost = 1.0e10; + +__thread int max_parallel_workers_per_gather = 2; + +__thread bool enable_seqscan = true; +__thread bool enable_indexscan = true; +__thread bool enable_indexonlyscan = true; +__thread bool enable_bitmapscan = true; +__thread bool enable_tidscan = true; +__thread bool enable_sort = true; +__thread bool enable_incremental_sort = true; +__thread bool enable_hashagg = true; +__thread bool enable_nestloop = true; +__thread bool enable_material = true; +__thread bool enable_mergejoin = true; +__thread bool enable_hashjoin = true; +__thread bool enable_gathermerge = true; +__thread bool enable_partitionwise_join = false; +__thread bool enable_partitionwise_aggregate = false; +__thread bool enable_parallel_append = true; +__thread bool enable_parallel_hash = true; +__thread bool enable_partition_pruning = true; typedef struct { diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/path/joinpath.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/path/joinpath.c index db54a6ba2e..965e05cfc1 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/path/joinpath.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/path/joinpath.c @@ -24,7 +24,7 @@ #include "optimizer/planmain.h" /* Hook for plugins to get control in add_paths_to_joinrel() */ -set_join_pathlist_hook_type set_join_pathlist_hook = NULL; +__thread set_join_pathlist_hook_type set_join_pathlist_hook = NULL; /* * Paths parameterized by the parent can be considered to be parameterized by diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/plan/initsplan.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/plan/initsplan.c index 6868c67d7a..228a1d372b 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/plan/initsplan.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/plan/initsplan.c @@ -39,8 +39,8 @@ #define make_restrictinfo(a,b,c,d,e,f,g,h,i) make_restrictinfo_new(a,b,c,d,e,f,g,h,i) /* These parameters are set by GUC */ -int from_collapse_limit; -int join_collapse_limit; +__thread int from_collapse_limit; +__thread int join_collapse_limit; /* Elements of the postponed_qual_list used during deconstruct_recurse */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/plan/planner.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/plan/planner.c index 60e7fda6a9..c53299a9b7 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/plan/planner.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/plan/planner.c @@ -66,15 +66,15 @@ #include "utils/syscache.h" /* GUC parameters */ -double cursor_tuple_fraction = DEFAULT_CURSOR_TUPLE_FRACTION; -int force_parallel_mode = FORCE_PARALLEL_OFF; -bool parallel_leader_participation = true; +__thread double cursor_tuple_fraction = DEFAULT_CURSOR_TUPLE_FRACTION; +__thread int force_parallel_mode = FORCE_PARALLEL_OFF; +__thread bool parallel_leader_participation = true; /* Hook for plugins to get control in planner() */ -planner_hook_type planner_hook = NULL; +__thread planner_hook_type planner_hook = NULL; /* Hook for plugins to get control when grouping_planner() plans upper rels */ -create_upper_paths_hook_type create_upper_paths_hook = NULL; +__thread create_upper_paths_hook_type create_upper_paths_hook = NULL; /* Expression kind codes for preprocess_expression */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/util/plancat.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/util/plancat.c index 8a0fed8ab6..94565b66de 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/util/plancat.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/optimizer/util/plancat.c @@ -54,10 +54,10 @@ #include "utils/syscache.h" /* GUC parameter */ -int constraint_exclusion = CONSTRAINT_EXCLUSION_PARTITION; +__thread int constraint_exclusion = CONSTRAINT_EXCLUSION_PARTITION; /* Hook for plugins to get control in get_relation_info() */ -get_relation_info_hook_type get_relation_info_hook = NULL; +__thread get_relation_info_hook_type get_relation_info_hook = NULL; static void get_relation_foreign_keys(PlannerInfo *root, RelOptInfo *rel, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/parser/analyze.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/parser/analyze.c index 8a47b854d4..3c16e50352 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/parser/analyze.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/parser/analyze.c @@ -48,7 +48,7 @@ /* Hook for plugins to get control at end of parse analysis */ -post_parse_analyze_hook_type post_parse_analyze_hook = NULL; +__thread post_parse_analyze_hook_type post_parse_analyze_hook = NULL; static Query *transformOptionalSelectInto(ParseState *pstate, Node *parseTree); static Query *transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/parser/parse_expr.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/parser/parse_expr.c index f69976cc8c..57674075ee 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/parser/parse_expr.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/parser/parse_expr.c @@ -39,8 +39,8 @@ #include "utils/xml.h" /* GUC parameters */ -bool operator_precedence_warning = false; -bool Transform_null_equals = false; +__thread bool operator_precedence_warning = false; +__thread bool Transform_null_equals = false; /* * Node-type groups for operator precedence warnings diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/parser/scan.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/parser/scan.c index 17bf4ca6c3..af10ba4c83 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/parser/scan.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/parser/scan.c @@ -5137,8 +5137,8 @@ fprintf_to_ereport(const char *fmt, const char *msg) * But we shall have to live with it until we can remove these variables. */ int backslash_quote = BACKSLASH_QUOTE_SAFE_ENCODING; -bool escape_string_warning = true; -bool standard_conforming_strings = true; +__thread bool escape_string_warning = true; +__thread bool standard_conforming_strings = true; /* * Constant data exported from this file. This array maps from the diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/port/posix_sema.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/port/posix_sema.c index 277b82ca80..1206bf900f 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/port/posix_sema.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/port/posix_sema.c @@ -61,11 +61,11 @@ typedef struct PGSemaphoreData #ifdef USE_NAMED_POSIX_SEMAPHORES static sem_t **mySemPointers; /* keep track of created semaphores */ #else -static PGSemaphore sharedSemas; /* array of PGSemaphoreData in shared memory */ +static __thread PGSemaphore sharedSemas; /* array of PGSemaphoreData in shared memory */ #endif -static int numSems; /* number of semas acquired so far */ -static int maxSems; /* allocated size of above arrays */ -static int nextSemKey; /* next name to try */ +static __thread int numSems; /* number of semas acquired so far */ +static __thread int maxSems; /* allocated size of above arrays */ +static __thread int nextSemKey; /* next name to try */ static void ReleaseSemaphores(int status, Datum arg); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/port/sysv_shmem.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/port/sysv_shmem.c index 4b0b0b226c..cafcfcb4a6 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/port/sysv_shmem.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/port/sysv_shmem.c @@ -93,10 +93,10 @@ typedef enum } IpcMemoryState; -unsigned long UsedShmemSegID = 0; +__thread unsigned long UsedShmemSegID = 0; void *UsedShmemSegAddr = NULL; -static Size AnonymousShmemSize; +static __thread Size AnonymousShmemSize; static void *AnonymousShmem = NULL; static void *InternalIpcMemoryCreate(IpcMemoryKey memKey, Size size); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/autovacuum.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/autovacuum.c index 9c7d4b0c60..b36db2dd3f 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/autovacuum.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/autovacuum.c @@ -111,23 +111,23 @@ /* * GUC parameters */ -bool autovacuum_start_daemon = false; -int autovacuum_max_workers; -int autovacuum_work_mem = -1; -int autovacuum_naptime; -int autovacuum_vac_thresh; -double autovacuum_vac_scale; -int autovacuum_vac_ins_thresh; -double autovacuum_vac_ins_scale; -int autovacuum_anl_thresh; -double autovacuum_anl_scale; -int autovacuum_freeze_max_age; -int autovacuum_multixact_freeze_max_age; - -double autovacuum_vac_cost_delay; -int autovacuum_vac_cost_limit; - -int Log_autovacuum_min_duration = -1; +__thread bool autovacuum_start_daemon = false; +__thread int autovacuum_max_workers; +__thread int autovacuum_work_mem = -1; +__thread int autovacuum_naptime; +__thread int autovacuum_vac_thresh; +__thread double autovacuum_vac_scale; +__thread int autovacuum_vac_ins_thresh; +__thread double autovacuum_vac_ins_scale; +__thread int autovacuum_anl_thresh; +__thread double autovacuum_anl_scale; +__thread int autovacuum_freeze_max_age; +__thread int autovacuum_multixact_freeze_max_age; + +__thread double autovacuum_vac_cost_delay; +__thread int autovacuum_vac_cost_limit; + +__thread int Log_autovacuum_min_duration = -1; /* how long to keep pgstat data in the launcher, in milliseconds */ #define STATS_READ_DELAY 1000 @@ -137,24 +137,24 @@ int Log_autovacuum_min_duration = -1; #define MAX_AUTOVAC_SLEEPTIME 300 /* seconds */ /* Flags to tell if we are in an autovacuum process */ -static bool am_autovacuum_launcher = false; -static bool am_autovacuum_worker = false; +static __thread bool am_autovacuum_launcher = false; +static __thread bool am_autovacuum_worker = false; /* Flags set by signal handlers */ -static volatile sig_atomic_t got_SIGUSR2 = false; +static __thread volatile sig_atomic_t got_SIGUSR2 = false; /* Comparison points for determining whether freeze_max_age is exceeded */ -static TransactionId recentXid; -static MultiXactId recentMulti; +static __thread TransactionId recentXid; +static __thread MultiXactId recentMulti; /* Default freeze ages to use for autovacuum (varies by database) */ -static int default_freeze_min_age; -static int default_freeze_table_age; -static int default_multixact_freeze_min_age; -static int default_multixact_freeze_table_age; +static __thread int default_freeze_min_age; +static __thread int default_freeze_table_age; +static __thread int default_multixact_freeze_min_age; +static __thread int default_multixact_freeze_table_age; /* Memory context for long-lived data */ -static MemoryContext AutovacMemCxt; +static __thread MemoryContext AutovacMemCxt; /* struct to keep track of databases in launcher */ typedef struct avl_dbase @@ -295,14 +295,14 @@ static AutoVacuumShmemStruct *AutoVacuumShmem; * the database list (of avl_dbase elements) in the launcher, and the context * that contains it */ -static dlist_head DatabaseList = DLIST_STATIC_INIT(DatabaseList); -static MemoryContext DatabaseListCxt = NULL; +static __thread dlist_head DatabaseList ;void DatabaseList_init(void) { dlist_init(&DatabaseList); } +static __thread MemoryContext DatabaseListCxt = NULL; /* Pointer to my own WorkerInfo, valid on each worker */ -static WorkerInfo MyWorkerInfo = NULL; +static __thread WorkerInfo MyWorkerInfo = NULL; /* PID of launcher, valid only in worker while shutting down */ -int AutovacuumLauncherPid = 0; +__thread int AutovacuumLauncherPid = 0; #ifdef EXEC_BACKEND static pid_t avlauncher_forkexec(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/bgworker.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/bgworker.c index 9bf3ead8d2..a23ad4b166 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/bgworker.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/bgworker.c @@ -39,7 +39,7 @@ /* * The postmaster's list of registered background workers, in private memory. */ -slist_head BackgroundWorkerList = SLIST_STATIC_INIT(BackgroundWorkerList); +__thread slist_head BackgroundWorkerList = SLIST_STATIC_INIT(BackgroundWorkerList); /* * BackgroundWorkerSlots exist in shared memory and can be accessed (via diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/bgwriter.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/bgwriter.c index 069e27e427..8a75343c57 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/bgwriter.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/bgwriter.c @@ -61,7 +61,7 @@ /* * GUC parameters */ -int BgWriterDelay = 200; +__thread int BgWriterDelay = 200; /* * Multiplier to apply to BgWriterDelay when we decide to hibernate. @@ -80,8 +80,8 @@ int BgWriterDelay = 200; * doing so too often or repeatedly if there has been no other write activity * in the system. */ -static TimestampTz last_snapshot_ts; -static XLogRecPtr last_snapshot_lsn = InvalidXLogRecPtr; +static __thread TimestampTz last_snapshot_ts; +static __thread XLogRecPtr last_snapshot_lsn = InvalidXLogRecPtr; /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/checkpointer.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/checkpointer.c index 624a3238b8..4588449ccc 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/checkpointer.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/checkpointer.c @@ -143,22 +143,22 @@ static CheckpointerShmemStruct *CheckpointerShmem; /* * GUC parameters */ -int CheckPointTimeout = 300; -int CheckPointWarning = 30; -double CheckPointCompletionTarget = 0.5; +__thread int CheckPointTimeout = 300; +__thread int CheckPointWarning = 30; +__thread double CheckPointCompletionTarget = 0.5; /* * Private state */ -static bool ckpt_active = false; +static __thread bool ckpt_active = false; /* these values are valid when ckpt_active is true: */ -static pg_time_t ckpt_start_time; -static XLogRecPtr ckpt_start_recptr; -static double ckpt_cached_elapsed; +static __thread pg_time_t ckpt_start_time; +static __thread XLogRecPtr ckpt_start_recptr; +static __thread double ckpt_cached_elapsed; -static pg_time_t last_checkpoint_time; -static pg_time_t last_xlog_switch_time; +static __thread pg_time_t last_checkpoint_time; +static __thread pg_time_t last_xlog_switch_time; /* Prototypes for private functions */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/interrupt.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/interrupt.c index 3d02439b79..7722f7d22b 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/interrupt.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/interrupt.c @@ -23,8 +23,8 @@ #include "storage/procsignal.h" #include "utils/guc.h" -volatile sig_atomic_t ConfigReloadPending = false; -volatile sig_atomic_t ShutdownRequestPending = false; +__thread volatile sig_atomic_t ConfigReloadPending = false; +__thread volatile sig_atomic_t ShutdownRequestPending = false; /* * Simple interrupt handler for main loops of background processes. diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/pgarch.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/pgarch.c index 37be0e2bbb..3e79c72a2b 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/pgarch.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/pgarch.c @@ -78,14 +78,14 @@ * Local data * ---------- */ -static time_t last_pgarch_start_time; -static time_t last_sigterm_time = 0; +static __thread time_t last_pgarch_start_time; +static __thread time_t last_sigterm_time = 0; /* * Flags set by interrupt handlers for later service in the main loop. */ -static volatile sig_atomic_t wakened = false; -static volatile sig_atomic_t ready_to_stop = false; +static __thread volatile sig_atomic_t wakened = false; +static __thread volatile sig_atomic_t ready_to_stop = false; /* ---------- * Local function forward declarations diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/pgstat.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/pgstat.c index 24e54d6766..f6fa4e73be 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/pgstat.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/pgstat.c @@ -121,10 +121,10 @@ * GUC parameters * ---------- */ -bool pgstat_track_activities = false; -bool pgstat_track_counts = false; -int pgstat_track_functions = TRACK_FUNC_OFF; -int pgstat_track_activity_query_size = 1024; +__thread bool pgstat_track_activities = false; +__thread bool pgstat_track_counts = false; +__thread int pgstat_track_functions = TRACK_FUNC_OFF; +__thread int pgstat_track_activity_query_size = 1024; /* ---------- * Built from GUC parameter @@ -139,7 +139,7 @@ char *pgstat_stat_tmpname = NULL; * Stored directly in a stats message structure so it can be sent * without needing to copy things around. We assume this inits to zeroes. */ -PgStat_MsgBgWriter BgWriterStats; +__thread PgStat_MsgBgWriter BgWriterStats; /* * List of SLRU names that we keep stats for. There is no central registry of @@ -171,13 +171,13 @@ static PgStat_MsgSLRU SLRUStats[SLRU_NUM_ELEMENTS]; * Local data * ---------- */ -NON_EXEC_STATIC pgsocket pgStatSock = PGINVALID_SOCKET; +__thread NON_EXEC_STATIC pgsocket pgStatSock = PGINVALID_SOCKET; -static struct sockaddr_storage pgStatAddr; +static __thread struct sockaddr_storage pgStatAddr; -static time_t last_pgstat_start_time; +static __thread time_t last_pgstat_start_time; -static bool pgStatRunningInCollector = false; +static __thread bool pgStatRunningInCollector = false; /* * Structures in which backends store per-table info that's waiting to be @@ -225,7 +225,7 @@ static HTAB *pgStatFunctions = NULL; * Indicates if backend has some function stats that it hasn't yet * sent to the collector. */ -static bool have_function_stats = false; +static __thread bool have_function_stats = false; /* * Tuple insertion/deletion counts for an open transaction can't be propagated @@ -243,10 +243,10 @@ typedef struct PgStat_SubXactStatus static PgStat_SubXactStatus *pgStatXactStack = NULL; -static int pgStatXactCommit = 0; -static int pgStatXactRollback = 0; -PgStat_Counter pgStatBlockReadTime = 0; -PgStat_Counter pgStatBlockWriteTime = 0; +static __thread int pgStatXactCommit = 0; +static __thread int pgStatXactRollback = 0; +__thread PgStat_Counter pgStatBlockReadTime = 0; +__thread PgStat_Counter pgStatBlockWriteTime = 0; /* Record that's written to 2PC state file when pgstat state is persisted */ typedef struct TwoPhasePgStatRecord @@ -265,22 +265,22 @@ typedef struct TwoPhasePgStatRecord /* * Info about current "snapshot" of stats file */ -static MemoryContext pgStatLocalContext = NULL; +static __thread MemoryContext pgStatLocalContext = NULL; static HTAB *pgStatDBHash = NULL; /* Status for backends including auxiliary */ static LocalPgBackendStatus *localBackendStatusTable = NULL; /* Total number of backends including auxiliary */ -static int localNumBackends = 0; +static __thread int localNumBackends = 0; /* * Cluster wide statistics, kept in the stats collector. * Contains statistics that are not collected per database * or per table. */ -static PgStat_ArchiverStats archiverStats; -static PgStat_GlobalStats globalStats; +static __thread PgStat_ArchiverStats archiverStats; +static __thread PgStat_GlobalStats globalStats; static PgStat_SLRUStats slruStats[SLRU_NUM_ELEMENTS]; /* @@ -295,7 +295,7 @@ static List *pending_write_requests = NIL; * We use this to help separate "self" and "other" time charges. * (We assume this initializes to zero.) */ -static instr_time total_func_time; +static __thread instr_time total_func_time; /* ---------- @@ -2706,7 +2706,7 @@ static PgBackendStatus *MyBEEntry = NULL; static char *BackendAppnameBuffer = NULL; static char *BackendClientHostnameBuffer = NULL; static char *BackendActivityBuffer = NULL; -static Size BackendActivityBufferSize = 0; +static __thread Size BackendActivityBufferSize = 0; #ifdef USE_SSL static PgBackendSSLStatus *BackendSslStatusBuffer = NULL; #endif diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/postmaster.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/postmaster.c index 337234a5d9..d1068230a4 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/postmaster.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/postmaster.c @@ -182,7 +182,7 @@ typedef struct bkend dlist_node elem; /* list link in BackendList */ } Backend; -static dlist_head BackendList = DLIST_STATIC_INIT(BackendList); +static __thread dlist_head BackendList ;void BackendList_init(void) { dlist_init(&BackendList); } #ifdef EXEC_BACKEND static Backend *ShmemBackendArray; @@ -193,7 +193,7 @@ BackgroundWorker *MyBgworkerEntry = NULL; /* The socket number we are listening for connections on */ -int PostPortNumber; +__thread int PostPortNumber; /* The directory names for Unix socket(s) */ char *Unix_socket_directories; @@ -210,7 +210,7 @@ char *ListenAddresses; * can make new connections" --- pre-existing superuser connections don't * count against the limit. */ -int ReservedBackends; +__thread int ReservedBackends; /* The socket(s) we're listening to. */ #define MAXLISTEN 64 @@ -228,25 +228,25 @@ static char ExtraOptions[MAXPGPATH]; * the postmaster stop (rather than kill) peers and not reinitialize * shared data structures. (Reinit is currently dead code, though.) */ -static bool Reinit = true; -static int SendStop = false; +static __thread bool Reinit = true; +static __thread int SendStop = false; /* still more option variables */ -bool EnableSSL = false; +__thread bool EnableSSL = false; -int PreAuthDelay = 0; -int AuthenticationTimeout = 60; +__thread int PreAuthDelay = 0; +__thread int AuthenticationTimeout = 60; -bool log_hostname; /* for ps display and logging */ -bool Log_connections = false; -bool Db_user_namespace = false; +__thread bool log_hostname; /* for ps display and logging */ +__thread bool Log_connections = false; +__thread bool Db_user_namespace = false; -bool enable_bonjour = false; +__thread bool enable_bonjour = false; char *bonjour_name; -bool restart_after_crash = true; +__thread bool restart_after_crash = true; /* PIDs of special child processes; 0 when not running */ -static pid_t StartupPID = 0, +static __thread pid_t StartupPID = 0, BgWriterPID = 0, CheckpointerPID = 0, WalWriterPID = 0, @@ -265,7 +265,7 @@ typedef enum STARTUP_CRASHED } StartupStatusEnum; -static StartupStatusEnum StartupStatus = STARTUP_NOT_RUNNING; +static __thread StartupStatusEnum StartupStatus = STARTUP_NOT_RUNNING; /* Startup/shutdown state */ #define NoShutdown 0 @@ -273,9 +273,9 @@ static StartupStatusEnum StartupStatus = STARTUP_NOT_RUNNING; #define FastShutdown 2 #define ImmediateShutdown 3 -static int Shutdown = NoShutdown; +static __thread int Shutdown = NoShutdown; -static bool FatalError = false; /* T if recovering from backend crash */ +static __thread bool FatalError = false; /* T if recovering from backend crash */ /* * We use a simple state machine to control startup, shutdown, and @@ -335,7 +335,7 @@ typedef enum PM_NO_CHILDREN /* all important children have exited */ } PMState; -static PMState pmState = PM_INIT; +static __thread PMState pmState = PM_INIT; /* * While performing a "smart shutdown", we restrict new connections but stay @@ -350,38 +350,38 @@ typedef enum ALLOW_NO_CONNS /* no new connections allowed, period */ } ConnsAllowedState; -static ConnsAllowedState connsAllowed = ALLOW_ALL_CONNS; +static __thread ConnsAllowedState connsAllowed = ALLOW_ALL_CONNS; /* Start time of SIGKILL timeout during immediate shutdown or child crash */ /* Zero means timeout is not running */ -static time_t AbortStartTime = 0; +static __thread time_t AbortStartTime = 0; /* Length of said timeout */ #define SIGKILL_CHILDREN_AFTER_SECS 5 -static bool ReachedNormalRunning = false; /* T if we've reached PM_RUN */ +static __thread bool ReachedNormalRunning = false; /* T if we've reached PM_RUN */ -bool ClientAuthInProgress = false; /* T during new-client +__thread bool ClientAuthInProgress = false; /* T during new-client * authentication */ -bool redirection_done = false; /* stderr redirected for syslogger? */ +__thread bool redirection_done = false; /* stderr redirected for syslogger? */ /* received START_AUTOVAC_LAUNCHER signal */ -static volatile sig_atomic_t start_autovac_launcher = false; +static __thread volatile sig_atomic_t start_autovac_launcher = false; /* the launcher needs to be signaled to communicate some condition */ -static volatile bool avlauncher_needs_signal = false; +static __thread volatile bool avlauncher_needs_signal = false; /* received START_WALRECEIVER signal */ -static volatile sig_atomic_t WalReceiverRequested = false; +static __thread volatile sig_atomic_t WalReceiverRequested = false; /* set when there's a worker that needs to be started up */ -static volatile bool StartWorkerNeeded = true; -static volatile bool HaveCrashedWorker = false; +static __thread volatile bool StartWorkerNeeded = true; +static __thread volatile bool HaveCrashedWorker = false; #ifdef USE_SSL /* Set when and if SSL has been initialized properly */ -static bool LoadedSSL = false; +static __thread bool LoadedSSL = false; #endif #ifdef USE_BONJOUR @@ -6170,8 +6170,8 @@ extern slock_t *ShmemLock; extern slock_t *ProcStructLock; extern PGPROC *AuxiliaryProcs; extern PMSignalData *PMSignalState; -extern pgsocket pgStatSock; -extern pg_time_t first_syslogger_file_time; +extern __thread pgsocket pgStatSock; +extern __thread pg_time_t first_syslogger_file_time; #ifndef WIN32 #define write_inheritable_socket(dest, src, childpid) ((*(dest) = (src)), true) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/startup.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/startup.c index 1adfd78c6f..5ac9b2d2c1 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/startup.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/startup.c @@ -37,15 +37,15 @@ /* * Flags set by interrupt handlers for later service in the redo loop. */ -static volatile sig_atomic_t got_SIGHUP = false; -static volatile sig_atomic_t shutdown_requested = false; -static volatile sig_atomic_t promote_signaled = false; +static __thread volatile sig_atomic_t got_SIGHUP = false; +static __thread volatile sig_atomic_t shutdown_requested = false; +static __thread volatile sig_atomic_t promote_signaled = false; /* * Flag set when executing a restore command, to tell SIGTERM signal handler * that it's safe to just proc_exit. */ -static volatile sig_atomic_t in_restore_command = false; +static __thread volatile sig_atomic_t in_restore_command = false; /* Signal handlers */ static void StartupProcTriggerHandler(SIGNAL_ARGS); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/syslogger.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/syslogger.c index ffcb54968f..7eff0cf40a 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/syslogger.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/syslogger.c @@ -66,25 +66,25 @@ * GUC parameters. Logging_collector cannot be changed after postmaster * start, but the rest can change at SIGHUP. */ -bool Logging_collector = false; -int Log_RotationAge = HOURS_PER_DAY * MINS_PER_HOUR; -int Log_RotationSize = 10 * 1024; +__thread bool Logging_collector = false; +__thread int Log_RotationAge = HOURS_PER_DAY * MINS_PER_HOUR; +__thread int Log_RotationSize = 10 * 1024; char *Log_directory = NULL; char *Log_filename = NULL; -bool Log_truncate_on_rotation = false; -int Log_file_mode = S_IRUSR | S_IWUSR; +__thread bool Log_truncate_on_rotation = false; +__thread int Log_file_mode = S_IRUSR | S_IWUSR; -extern bool redirection_done; +extern __thread bool redirection_done; /* * Private state */ -static pg_time_t next_rotation_time; -static bool pipe_eof_seen = false; -static bool rotation_disabled = false; +static __thread pg_time_t next_rotation_time; +static __thread bool pipe_eof_seen = false; +static __thread bool rotation_disabled = false; static FILE *syslogFile = NULL; static FILE *csvlogFile = NULL; -NON_EXEC_STATIC pg_time_t first_syslogger_file_time = 0; +__thread NON_EXEC_STATIC pg_time_t first_syslogger_file_time = 0; static char *last_file_name = NULL; static char *last_csv_file_name = NULL; @@ -123,8 +123,8 @@ static CRITICAL_SECTION sysloggerSection; /* * Flags set by interrupt handlers for later service in the main loop. */ -static volatile sig_atomic_t got_SIGHUP = false; -static volatile sig_atomic_t rotation_requested = false; +static __thread volatile sig_atomic_t got_SIGHUP = false; +static __thread volatile sig_atomic_t rotation_requested = false; /* Local subroutines */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/walwriter.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/walwriter.c index 45a2757969..3255caa9d8 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/walwriter.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/postmaster/walwriter.c @@ -67,8 +67,8 @@ /* * GUC parameters */ -int WalWriterDelay = 200; -int WalWriterFlushAfter = 128; +__thread int WalWriterDelay = 200; +__thread int WalWriterFlushAfter = 128; /* * Number of do-nothing loops before lengthening the delay time, and the diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/regex/regc_pg_locale.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/regex/regc_pg_locale.c index 3cc2d4d362..189fa537e2 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/regex/regc_pg_locale.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/regex/regc_pg_locale.c @@ -72,9 +72,9 @@ typedef enum PG_REGEX_LOCALE_ICU /* Use ICU uchar.h functions */ } PG_Locale_Strategy; -static PG_Locale_Strategy pg_regex_strategy; -static pg_locale_t pg_regex_locale; -static Oid pg_regex_collation; +static __thread PG_Locale_Strategy pg_regex_strategy; +static __thread pg_locale_t pg_regex_locale; +static __thread Oid pg_regex_collation; /* * Hard-wired character properties for C locale diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/basebackup.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/basebackup.c index 50ae1f16d0..3a1eb4870f 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/basebackup.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/basebackup.c @@ -81,7 +81,7 @@ static void update_basebackup_progress(int64 delta); static bool is_checksummed_file(const char *fullpath, const char *filename); /* Was the backup currently in-progress initiated in recovery mode? */ -static bool backup_started_in_recovery = false; +static __thread bool backup_started_in_recovery = false; /* Relative path of temporary statistics directory */ static char *statrelpath = NULL; @@ -109,34 +109,34 @@ do { \ } while (0) /* The actual number of bytes, transfer of which may cause sleep. */ -static uint64 throttling_sample; +static __thread uint64 throttling_sample; /* Amount of data already transferred but not yet throttled. */ -static int64 throttling_counter; +static __thread int64 throttling_counter; /* The minimum time required to transfer throttling_sample bytes. */ -static TimeOffset elapsed_min_unit; +static __thread TimeOffset elapsed_min_unit; /* The last check of the transfer rate. */ -static TimestampTz throttled_last; +static __thread TimestampTz throttled_last; /* The starting XLOG position of the base backup. */ -static XLogRecPtr startptr; +static __thread XLogRecPtr startptr; /* Total number of checksum failures during base backup. */ -static long long int total_checksum_failures; +static __thread long long int total_checksum_failures; /* Do not verify checksums. */ -static bool noverify_checksums = false; +static __thread bool noverify_checksums = false; /* * Total amount of backup data that will be streamed. * -1 means that the size is not estimated. */ -static int64 backup_total = 0; +static __thread int64 backup_total = 0; /* Amount of backup data already streamed */ -static int64 backup_streamed = 0; +static __thread int64 backup_streamed = 0; /* * Definition of one element part of an exclusion list, used for paths part diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/launcher.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/launcher.c index 0a34d26985..531e831e69 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/launcher.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/launcher.c @@ -51,8 +51,8 @@ /* max sleep time between cycles (3min) */ #define DEFAULT_NAPTIME_PER_CYCLE 180000L -int max_logical_replication_workers = 4; -int max_sync_workers_per_subscription = 2; +__thread int max_logical_replication_workers = 4; +__thread int max_sync_workers_per_subscription = 2; LogicalRepWorker *MyLogicalRepWorker = NULL; @@ -93,7 +93,7 @@ static void logicalrep_worker_onexit(int code, Datum arg); static void logicalrep_worker_detach(void); static void logicalrep_worker_cleanup(LogicalRepWorker *worker); -static bool on_commit_launcher_wakeup = false; +static __thread bool on_commit_launcher_wakeup = false; Datum pg_stat_get_subscription(PG_FUNCTION_ARGS); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/origin.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/origin.c index 997fde3e2f..2fea672320 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/origin.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/origin.c @@ -151,9 +151,9 @@ typedef struct ReplicationStateCtl } ReplicationStateCtl; /* external variables */ -RepOriginId replorigin_session_origin = InvalidRepOriginId; /* assumed identity */ -XLogRecPtr replorigin_session_origin_lsn = InvalidXLogRecPtr; -TimestampTz replorigin_session_origin_timestamp = 0; +__thread RepOriginId replorigin_session_origin = InvalidRepOriginId; /* assumed identity */ +__thread XLogRecPtr replorigin_session_origin_lsn = InvalidXLogRecPtr; +__thread TimestampTz replorigin_session_origin_timestamp = 0; /* * Base address into a shared memory array of replication states of size diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/relation.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/relation.c index 901bff9974..0843dc31d7 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/relation.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/relation.c @@ -27,7 +27,7 @@ #include "utils/inval.h" -static MemoryContext LogicalRepRelMapContext = NULL; +static __thread MemoryContext LogicalRepRelMapContext = NULL; static HTAB *LogicalRepRelMap = NULL; @@ -42,7 +42,7 @@ static HTAB *LogicalRepRelMap = NULL; * attribute mappings to remote relation's attributes must be maintained * separately for each partition. */ -static MemoryContext LogicalRepPartMapContext = NULL; +static __thread MemoryContext LogicalRepPartMapContext = NULL; static HTAB *LogicalRepPartMap = NULL; typedef struct LogicalRepPartMapEntry { diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/reorderbuffer.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/reorderbuffer.c index ef8c2ea6df..8ade3aba48 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/reorderbuffer.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/reorderbuffer.c @@ -190,7 +190,7 @@ typedef struct ReorderBufferDiskChange * resource management here, but it's not entirely clear what that would look * like. */ -int logical_decoding_work_mem; +__thread int logical_decoding_work_mem; static const Size max_changes_in_memory = 4096; /* XXX for restore only */ /* --------------------------------------- diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/snapbuild.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/snapbuild.c index be46bf0363..955602c862 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/snapbuild.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/snapbuild.c @@ -249,8 +249,8 @@ struct SnapBuild * Starting a transaction -- which we need to do while exporting a snapshot -- * removes knowledge about the previously used resowner, so we save it here. */ -static ResourceOwner SavedResourceOwnerDuringExport = NULL; -static bool ExportInProgress = false; +static __thread ResourceOwner SavedResourceOwnerDuringExport = NULL; +static __thread bool ExportInProgress = false; /* ->committed manipulation */ static void SnapBuildPurgeCommittedTxn(SnapBuild *builder); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/tablesync.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/tablesync.c index a3989d40dd..47156f65e4 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/tablesync.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/tablesync.c @@ -103,9 +103,9 @@ #include "utils/memutils.h" #include "utils/snapmgr.h" -static bool table_states_valid = false; +static __thread bool table_states_valid = false; -StringInfo copybuf = NULL; +__thread StringInfo copybuf = NULL; /* * Exit routine for synchronization worker. diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/worker.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/worker.c index f67d4ce232..7e48693213 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/worker.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/logical/worker.c @@ -88,7 +88,7 @@ typedef struct FlushPosition XLogRecPtr remote_end; } FlushPosition; -static dlist_head lsn_mapping = DLIST_STATIC_INIT(lsn_mapping); +static __thread dlist_head lsn_mapping ;void lsn_mapping_init(void) { dlist_init(&lsn_mapping); } typedef struct SlotErrCallbackArg { @@ -108,16 +108,16 @@ typedef struct ApplyExecutionData PartitionTupleRouting *proute; /* partition routing info */ } ApplyExecutionData; -static MemoryContext ApplyMessageContext = NULL; -MemoryContext ApplyContext = NULL; +static __thread MemoryContext ApplyMessageContext = NULL; +__thread MemoryContext ApplyContext = NULL; WalReceiverConn *LogRepWorkerWalRcvConn = NULL; Subscription *MySubscription = NULL; -bool MySubscriptionValid = false; +__thread bool MySubscriptionValid = false; -bool in_remote_transaction = false; -static XLogRecPtr remote_final_lsn = InvalidXLogRecPtr; +__thread bool in_remote_transaction = false; +static __thread XLogRecPtr remote_final_lsn = InvalidXLogRecPtr; static void send_feedback(XLogRecPtr recvpos, bool force, bool requestReply); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/repl_gram.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/repl_gram.c index 93f2f8a9a1..7c8c56dc76 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/repl_gram.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/repl_gram.c @@ -212,7 +212,7 @@ typedef union YYSTYPE YYSTYPE; #endif -extern YYSTYPE replication_yylval; +extern __thread YYSTYPE replication_yylval; int replication_yyparse (void); @@ -1102,7 +1102,7 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) int yychar; /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; +__thread YYSTYPE replication_yylval; /* Number of syntax errors so far. */ int yynerrs; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/repl_scanner.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/repl_scanner.c index 488bad42ab..6445659b2c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/repl_scanner.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/repl_scanner.c @@ -506,9 +506,9 @@ struct yy_buffer_state #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ +static __thread size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static __thread size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static __thread YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -525,19 +525,19 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static __thread char yy_hold_char; +static __thread int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = NULL; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static __thread int yy_init = 0; /* whether we need to initialize */ +static __thread int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ -static int yy_did_buffer_switch_on_eof; +static __thread int yy_did_buffer_switch_on_eof; void yyrestart ( FILE *input_file ); void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); @@ -926,7 +926,7 @@ static const flex_int16_t yy_chk[644] = 298, 298, 298 } ; -static yy_state_type yy_last_accepting_state; +static __thread yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; @@ -972,9 +972,9 @@ fprintf_to_ereport(const char *fmt, const char *msg) } /* Handle to the buffer that the lexer uses internally */ -static YY_BUFFER_STATE scanbufhandle; +static __thread YY_BUFFER_STATE scanbufhandle; -static StringInfoData litbuf; +static __thread StringInfoData litbuf; static void startlit(void); static char *litbufdup(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/slot.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/slot.c index 02047ea920..bd7a0c6e7c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/slot.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/slot.c @@ -96,7 +96,7 @@ ReplicationSlotCtlData *ReplicationSlotCtl = NULL; ReplicationSlot *MyReplicationSlot = NULL; /* GUCs */ -int max_replication_slots = 0; /* the maximum number of replication +__thread int max_replication_slots = 0; /* the maximum number of replication * slots */ static ReplicationSlot *SearchNamedReplicationSlot(const char *name); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/syncrep.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/syncrep.c index df1e341c76..032b94f088 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/syncrep.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/syncrep.c @@ -92,10 +92,10 @@ char *SyncRepStandbyNames; #define SyncStandbysDefined() \ (SyncRepStandbyNames != NULL && SyncRepStandbyNames[0] != '\0') -static bool announce_next_takeover = true; +static __thread bool announce_next_takeover = true; SyncRepConfigData *SyncRepConfig = NULL; -static int SyncRepWaitMode = SYNC_REP_NO_WAIT; +static __thread int SyncRepWaitMode = SYNC_REP_NO_WAIT; static void SyncRepQueueInsert(int mode); static void SyncRepCancelWait(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/syncrep_gram.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/syncrep_gram.c index 601bf51e9c..4fc2265168 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/syncrep_gram.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/syncrep_gram.c @@ -175,7 +175,7 @@ typedef union YYSTYPE YYSTYPE; #endif -extern YYSTYPE syncrep_yylval; +extern __thread YYSTYPE syncrep_yylval; int syncrep_yyparse (void); @@ -1011,7 +1011,7 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) int yychar; /* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; +__thread YYSTYPE syncrep_yylval; /* Number of syntax errors so far. */ int yynerrs; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/syncrep_scanner.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/syncrep_scanner.c index 42bed8c6bc..e7eecd49a3 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/syncrep_scanner.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/syncrep_scanner.c @@ -506,9 +506,9 @@ struct yy_buffer_state #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ +static __thread size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static __thread size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static __thread YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -525,19 +525,19 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static __thread char yy_hold_char; +static __thread int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = NULL; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static __thread int yy_init = 0; /* whether we need to initialize */ +static __thread int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ -static int yy_did_buffer_switch_on_eof; +static __thread int yy_did_buffer_switch_on_eof; void yyrestart ( FILE *input_file ); void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); @@ -707,7 +707,7 @@ static const flex_int16_t yy_chk[64] = 31, 31, 31 } ; -static yy_state_type yy_last_accepting_state; +static __thread yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; @@ -752,9 +752,9 @@ fprintf_to_ereport(const char *fmt, const char *msg) } /* Handles to the buffer that the lexer uses internally */ -static YY_BUFFER_STATE scanbufhandle; +static __thread YY_BUFFER_STATE scanbufhandle; -static StringInfoData xdbuf; +static __thread StringInfoData xdbuf; /* LCOV_EXCL_START */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/walreceiver.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/walreceiver.c index 479c6c441b..e2f7bdd5db 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/walreceiver.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/walreceiver.c @@ -85,9 +85,9 @@ * because they're passed down from the startup process, for better * synchronization.) */ -int wal_receiver_status_interval; -int wal_receiver_timeout; -bool hot_standby_feedback; +__thread int wal_receiver_status_interval; +__thread int wal_receiver_timeout; +__thread bool hot_standby_feedback; /* libpqwalreceiver connection */ static WalReceiverConn *wrconn = NULL; @@ -100,16 +100,16 @@ WalReceiverFunctionsType *WalReceiverFunctions = NULL; * but for walreceiver to write the XLOG. recvFileTLI is the TimeLineID * corresponding the filename of recvFile. */ -static int recvFile = -1; -static TimeLineID recvFileTLI = 0; -static XLogSegNo recvSegNo = 0; +static __thread int recvFile = -1; +static __thread TimeLineID recvFileTLI = 0; +static __thread XLogSegNo recvSegNo = 0; /* * Flags set by interrupt handlers of walreceiver for later service in the * main loop. */ -static volatile sig_atomic_t got_SIGHUP = false; -static volatile sig_atomic_t got_SIGTERM = false; +static __thread volatile sig_atomic_t got_SIGHUP = false; +static __thread volatile sig_atomic_t got_SIGTERM = false; /* * LogstreamResult indicates the byte positions that we have already @@ -121,8 +121,8 @@ static struct XLogRecPtr Flush; /* last byte + 1 flushed in the standby */ } LogstreamResult; -static StringInfoData reply_message; -static StringInfoData incoming_message; +static __thread StringInfoData reply_message; +static __thread StringInfoData incoming_message; /* Prototypes for private functions */ static void WalRcvFetchTimeLineHistoryFiles(TimeLineID first, TimeLineID last); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/walsender.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/walsender.c index 975139aff3..7f09b67332 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/walsender.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/replication/walsender.c @@ -112,22 +112,22 @@ WalSndCtlData *WalSndCtl = NULL; WalSnd *MyWalSnd = NULL; /* Global state */ -bool am_walsender = false; /* Am I a walsender process? */ -bool am_cascading_walsender = false; /* Am I cascading WAL to another +__thread bool am_walsender = false; /* Am I a walsender process? */ +__thread bool am_cascading_walsender = false; /* Am I cascading WAL to another * standby? */ -bool am_db_walsender = false; /* Connected to a database? */ +__thread bool am_db_walsender = false; /* Connected to a database? */ /* User-settable parameters for walsender */ -int max_wal_senders = 0; /* the maximum number of concurrent +__thread int max_wal_senders = 0; /* the maximum number of concurrent * walsenders */ -int wal_sender_timeout = 60 * 1000; /* maximum time to send one WAL +__thread int wal_sender_timeout = 60 * 1000; /* maximum time to send one WAL * data message */ -bool log_replication_commands = false; +__thread bool log_replication_commands = false; /* * State for WalSndWakeupRequest */ -bool wake_wal_senders = false; +__thread bool wake_wal_senders = false; /* * xlogreader used for replication. Note that a WAL sender doing physical @@ -142,33 +142,33 @@ static XLogReaderState *xlogreader = NULL; * the timeline is not the latest timeline on this server, and the server's * history forked off from that timeline at sendTimeLineValidUpto. */ -static TimeLineID sendTimeLine = 0; -static TimeLineID sendTimeLineNextTLI = 0; -static bool sendTimeLineIsHistoric = false; -static XLogRecPtr sendTimeLineValidUpto = InvalidXLogRecPtr; +static __thread TimeLineID sendTimeLine = 0; +static __thread TimeLineID sendTimeLineNextTLI = 0; +static __thread bool sendTimeLineIsHistoric = false; +static __thread XLogRecPtr sendTimeLineValidUpto = InvalidXLogRecPtr; /* * How far have we sent WAL already? This is also advertised in * MyWalSnd->sentPtr. (Actually, this is the next WAL location to send.) */ -static XLogRecPtr sentPtr = InvalidXLogRecPtr; +static __thread XLogRecPtr sentPtr = InvalidXLogRecPtr; /* Buffers for constructing outgoing messages and processing reply messages. */ -static StringInfoData output_message; -static StringInfoData reply_message; -static StringInfoData tmpbuf; +static __thread StringInfoData output_message; +static __thread StringInfoData reply_message; +static __thread StringInfoData tmpbuf; /* Timestamp of last ProcessRepliesIfAny(). */ -static TimestampTz last_processing = 0; +static __thread TimestampTz last_processing = 0; /* * Timestamp of last ProcessRepliesIfAny() that saw a reply from the * standby. Set to 0 if wal_sender_timeout doesn't need to be active. */ -static TimestampTz last_reply_timestamp = 0; +static __thread TimestampTz last_reply_timestamp = 0; /* Have we sent a heartbeat message asking for reply, since last reply? */ -static bool waiting_for_ping_response = false; +static __thread bool waiting_for_ping_response = false; /* * While streaming WAL in Copy mode, streamingDoneSending is set to true @@ -176,15 +176,15 @@ static bool waiting_for_ping_response = false; * after that. streamingDoneReceiving is set to true when we receive CopyDone * from the other end. When both become true, it's time to exit Copy mode. */ -static bool streamingDoneSending; -static bool streamingDoneReceiving; +static __thread bool streamingDoneSending; +static __thread bool streamingDoneReceiving; /* Are we there yet? */ -static bool WalSndCaughtUp = false; +static __thread bool WalSndCaughtUp = false; /* Flags set by signal handlers for later service in main loop */ -static volatile sig_atomic_t got_SIGUSR2 = false; -static volatile sig_atomic_t got_STOPPING = false; +static __thread volatile sig_atomic_t got_SIGUSR2 = false; +static __thread volatile sig_atomic_t got_STOPPING = false; /* * This is set while we are streaming. When not set @@ -192,7 +192,7 @@ static volatile sig_atomic_t got_STOPPING = false; * the main loop is responsible for checking got_STOPPING and terminating when * it's set (after streaming any remaining WAL). */ -static volatile sig_atomic_t replication_active = false; +static __thread volatile sig_atomic_t replication_active = false; static LogicalDecodingContext *logical_decoding_ctx = NULL; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/rewrite/rowsecurity.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/rewrite/rowsecurity.c index 0fe2f9ca83..289a7fc2dd 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/rewrite/rowsecurity.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/rewrite/rowsecurity.c @@ -93,8 +93,8 @@ static bool check_role_for_policy(ArrayType *policy_roles, Oid user_id); * row_security_policy_hook_restrictive can be used to add policies which * are enforced, regardless of other policies (they are combined using AND). */ -row_security_policy_hook_type row_security_policy_hook_permissive = NULL; -row_security_policy_hook_type row_security_policy_hook_restrictive = NULL; +__thread row_security_policy_hook_type row_security_policy_hook_permissive = NULL; +__thread row_security_policy_hook_type row_security_policy_hook_restrictive = NULL; /* * Get any row security quals and WithCheckOption checks that should be diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/buffer/buf_init.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/buffer/buf_init.c index a8ce6603ed..1754fd35fa 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/buffer/buf_init.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/buffer/buf_init.c @@ -20,7 +20,7 @@ BufferDescPadded *BufferDescriptors; char *BufferBlocks; LWLockMinimallyPadded *BufferIOLWLockArray = NULL; -WritebackContext BackendWritebackContext; +__thread WritebackContext BackendWritebackContext; CkptSortItem *CkptBufferIds; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/buffer/bufmgr.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/buffer/bufmgr.c index 597afedef7..720537f2d4 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/buffer/bufmgr.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/buffer/bufmgr.c @@ -120,10 +120,10 @@ typedef struct SMgrSortArray } SMgrSortArray; /* GUC variables */ -bool zero_damaged_pages = false; -int bgwriter_lru_maxpages = 100; -double bgwriter_lru_multiplier = 2.0; -bool track_io_timing = false; +__thread bool zero_damaged_pages = false; +__thread int bgwriter_lru_maxpages = 100; +__thread double bgwriter_lru_multiplier = 2.0; +__thread bool track_io_timing = false; /* * How many buffers PrefetchBuffer callers should try to stay ahead of their @@ -131,26 +131,26 @@ bool track_io_timing = false; * for buffers not belonging to tablespaces that have their * effective_io_concurrency parameter set. */ -int effective_io_concurrency = 0; +__thread int effective_io_concurrency = 0; /* * Like effective_io_concurrency, but used by maintenance code paths that might * benefit from a higher setting because they work on behalf of many sessions. * Overridden by the tablespace setting of the same name. */ -int maintenance_io_concurrency = 0; +__thread int maintenance_io_concurrency = 0; /* * GUC variables about triggering kernel writeback for buffers written; OS * dependent defaults are set via the GUC mechanism. */ -int checkpoint_flush_after = 0; -int bgwriter_flush_after = 0; -int backend_flush_after = 0; +__thread int checkpoint_flush_after = 0; +__thread int bgwriter_flush_after = 0; +__thread int backend_flush_after = 0; /* local state for StartBufferIO and related functions */ static BufferDesc *InProgressBuf = NULL; -static bool IsForInput; +static __thread bool IsForInput; /* local state for LockBufferForCleanup */ static BufferDesc *PinCountWaitBuf = NULL; @@ -187,8 +187,8 @@ static BufferDesc *PinCountWaitBuf = NULL; */ static struct PrivateRefCountEntry PrivateRefCountArray[REFCOUNT_ARRAY_ENTRIES]; static HTAB *PrivateRefCountHash = NULL; -static int32 PrivateRefCountOverflowed = 0; -static uint32 PrivateRefCountClock = 0; +static __thread int32 PrivateRefCountOverflowed = 0; +static __thread uint32 PrivateRefCountClock = 0; static PrivateRefCountEntry *ReservedRefCountEntry = NULL; static void ReservePrivateRefCountEntry(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/buffer/localbuf.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/buffer/localbuf.c index 6ffd7b3306..fc560489b8 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/buffer/localbuf.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/buffer/localbuf.c @@ -38,13 +38,13 @@ typedef struct #define LocalBufHdrGetBlock(bufHdr) \ LocalBufferBlockPointers[-((bufHdr)->buf_id + 2)] -int NLocBuffer = 0; /* until buffers are initialized */ +__thread int NLocBuffer = 0; /* until buffers are initialized */ BufferDesc *LocalBufferDescriptors = NULL; Block *LocalBufferBlockPointers = NULL; int32 *LocalRefCount = NULL; -static int nextFreeLocalBuf = 0; +static __thread int nextFreeLocalBuf = 0; static HTAB *LocalBufHash = NULL; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/file/fd.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/file/fd.c index 7aa50a5d2e..e159f9e69b 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/file/fd.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/file/fd.c @@ -138,7 +138,7 @@ * This GUC parameter lets the DBA limit max_safe_fds to something less than * what the postmaster's initial probe suggests will work. */ -int max_files_per_process = 1000; +__thread int max_files_per_process = 1000; /* * Maximum number of file descriptors to open for operations that fd.c knows @@ -151,10 +151,10 @@ int max_files_per_process = 1000; * Note: the value of max_files_per_process is taken into account while * setting this variable, and so need not be tested separately. */ -int max_safe_fds = FD_MINFREE; /* default if not changed */ +__thread int max_safe_fds = FD_MINFREE; /* default if not changed */ /* Whether it is safe to continue running after fsync() fails. */ -bool data_sync_retry = false; +__thread bool data_sync_retry = false; /* Debugging.... */ @@ -203,18 +203,18 @@ typedef struct vfd * Note that VfdCache[0] is not a usable VFD, just a list header. */ static Vfd *VfdCache; -static Size SizeVfdCache = 0; +static __thread Size SizeVfdCache = 0; /* * Number of file descriptors known to be in use by VFD entries. */ -static int nfile = 0; +static __thread int nfile = 0; /* * Flag to tell whether it's worth scanning VfdCache looking for temp files * to close */ -static bool have_xact_temporary_files = false; +static __thread bool have_xact_temporary_files = false; /* * Tracks the total size of all temporary files. Note: when temp_file_limit @@ -222,7 +222,7 @@ static bool have_xact_temporary_files = false; * than INT_MAX kilobytes. When not enforcing, it could theoretically * overflow, but we don't care. */ -static uint64 temporary_files_size = 0; +static __thread uint64 temporary_files_size = 0; /* * List of OS handles opened with AllocateFile, AllocateDir and @@ -248,20 +248,20 @@ typedef struct } desc; } AllocateDesc; -static int numAllocatedDescs = 0; -static int maxAllocatedDescs = 0; +static __thread int numAllocatedDescs = 0; +static __thread int maxAllocatedDescs = 0; static AllocateDesc *allocatedDescs = NULL; /* * Number of open "external" FDs reported to Reserve/ReleaseExternalFD. */ -static int numExternalFDs = 0; +static __thread int numExternalFDs = 0; /* * Number of temporary files opened during the current session; * this is used in generation of tempfile names. */ -static long tempFileCounter = 0; +static __thread long tempFileCounter = 0; /* * Array of OIDs of temp tablespaces. (Some entries may be InvalidOid, @@ -270,8 +270,8 @@ static long tempFileCounter = 0; * transaction. */ static Oid *tempTableSpaces = NULL; -static int numTempTableSpaces = -1; -static int nextTempTableSpace = 0; +static __thread int numTempTableSpaces = -1; +static __thread int nextTempTableSpace = 0; /*-------------------- diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/dsm.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/dsm.c index 34df90a0f7..f59871e5ee 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/dsm.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/dsm.c @@ -97,7 +97,7 @@ static bool dsm_control_segment_sane(dsm_control_header *control, static uint64 dsm_control_bytes_needed(uint32 nitems); /* Has this backend initialized the dynamic shared memory system yet? */ -static bool dsm_init_done = false; +static __thread bool dsm_init_done = false; /* * List of dynamic shared memory segments used by this backend. @@ -116,7 +116,7 @@ static bool dsm_init_done = false; * each new mapping would require an update to the control segment, * which requires locking, in which the postmaster must not be involved. */ -static dlist_head dsm_segment_list = DLIST_STATIC_INIT(dsm_segment_list); +static __thread dlist_head dsm_segment_list ;void dsm_segment_list_init(void) { dlist_init(&dsm_segment_list); } /* * Control segment information. @@ -125,9 +125,9 @@ static dlist_head dsm_segment_list = DLIST_STATIC_INIT(dsm_segment_list); * reference counted; instead, it lasts for the postmaster's entire * life cycle. For simplicity, it doesn't have a dsm_segment object either. */ -static dsm_handle dsm_control_handle; +static __thread dsm_handle dsm_control_handle; static dsm_control_header *dsm_control; -static Size dsm_control_mapped_size = 0; +static __thread Size dsm_control_mapped_size = 0; static void *dsm_control_impl_private = NULL; /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/dsm_impl.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/dsm_impl.c index 1972aecbed..ff21a0baaf 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/dsm_impl.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/dsm_impl.c @@ -111,7 +111,7 @@ const struct config_enum_entry dynamic_shared_memory_options[] = { }; /* Implementation selector. */ -int dynamic_shared_memory_type; +__thread int dynamic_shared_memory_type; /* Size of buffer to be used for zero-filling. */ #define ZBUFFER_SIZE 8192 diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/ipc.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/ipc.c index bdbc2c3ac4..e2fd3b4616 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/ipc.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/ipc.c @@ -37,18 +37,18 @@ * so that an ereport() from an on_proc_exit routine cannot get us out * of the exit procedure. We do NOT want to go back to the idle loop... */ -bool proc_exit_inprogress = false; +__thread bool proc_exit_inprogress = false; /* * Set when shmem_exit() is in progress. */ -bool shmem_exit_inprogress = false; +__thread bool shmem_exit_inprogress = false; /* * This flag tracks whether we've called atexit() in the current process * (or in the parent postmaster). */ -static bool atexit_callback_setup = false; +static __thread bool atexit_callback_setup = false; /* local functions */ static void proc_exit_prepare(int code); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/ipci.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/ipci.c index 427b0d59cd..f9e5266e04 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/ipci.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/ipci.c @@ -47,12 +47,12 @@ #include "utils/snapmgr.h" /* GUCs */ -int shared_memory_type = DEFAULT_SHARED_MEMORY_TYPE; +__thread int shared_memory_type = DEFAULT_SHARED_MEMORY_TYPE; -shmem_startup_hook_type shmem_startup_hook = NULL; +__thread shmem_startup_hook_type shmem_startup_hook = NULL; -static Size total_addin_request = 0; -static bool addin_request_allowed = true; +static __thread Size total_addin_request = 0; +static __thread bool addin_request_allowed = true; /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/latch.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/latch.c index dcf85c9063..1b3cb37195 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/latch.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/latch.c @@ -131,14 +131,14 @@ struct WaitEventSet #ifndef WIN32 /* Are we currently in WaitLatch? The signal handler would like to know. */ -static volatile sig_atomic_t waiting = false; +static __thread volatile sig_atomic_t waiting = false; /* Read and write ends of the self-pipe */ -static int selfpipe_readfd = -1; -static int selfpipe_writefd = -1; +static __thread int selfpipe_readfd = -1; +static __thread int selfpipe_writefd = -1; /* Process owning the self-pipe --- needed for checking purposes */ -static int selfpipe_owner_pid = 0; +static __thread int selfpipe_owner_pid = 0; /* Private function prototypes */ static void sendSelfPipeByte(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/pmsignal.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/pmsignal.c index 94c65877c1..c53b1730ff 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/pmsignal.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/pmsignal.c @@ -79,7 +79,7 @@ NON_EXEC_STATIC volatile PMSignalData *PMSignalState = NULL; * Signal handler to be notified if postmaster dies. */ #ifdef USE_POSTMASTER_DEATH_SIGNAL -volatile sig_atomic_t postmaster_possibly_dead = false; +__thread volatile sig_atomic_t postmaster_possibly_dead = false; static void postmaster_death_handler(int signo) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/procarray.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/procarray.c index 828ed2a38a..0c7a946e9b 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/procarray.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/procarray.c @@ -109,14 +109,14 @@ static PGXACT *allPgXact; */ static TransactionId *KnownAssignedXids; static bool *KnownAssignedXidsValid; -static TransactionId latestObservedXid = InvalidTransactionId; +static __thread TransactionId latestObservedXid = InvalidTransactionId; /* * If we're in STANDBY_SNAPSHOT_PENDING state, standbySnapshotPendingXmin is * the highest xid that might still be running that we don't have in * KnownAssignedXids. */ -static TransactionId standbySnapshotPendingXmin; +static __thread TransactionId standbySnapshotPendingXmin; #ifdef XIDCACHE_DEBUG diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/sinval.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/sinval.c index b5640e46be..f060efdc3f 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/sinval.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/sinval.c @@ -23,7 +23,7 @@ #include "utils/inval.h" -uint64 SharedInvalidMessageCounter; +__thread uint64 SharedInvalidMessageCounter; /* @@ -38,7 +38,7 @@ uint64 SharedInvalidMessageCounter; * interrupted while doing so, ProcessClientReadInterrupt() will call * ProcessCatchupEvent(). */ -volatile sig_atomic_t catchupInterruptPending = false; +__thread volatile sig_atomic_t catchupInterruptPending = false; /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/sinvaladt.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/sinvaladt.c index e5c115b92f..701270c503 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/sinvaladt.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/sinvaladt.c @@ -191,7 +191,7 @@ typedef struct SISeg static SISeg *shmInvalBuffer; /* pointer to the shared inval buffer */ -static LocalTransactionId nextLocalTransactionId; +static __thread LocalTransactionId nextLocalTransactionId; static void CleanupInvalidationState(int status, Datum arg); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/standby.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/standby.c index fdc4d4e61a..5a40aceece 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/standby.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/ipc/standby.c @@ -36,15 +36,15 @@ #include "utils/timestamp.h" /* User-settable GUC parameters */ -int vacuum_defer_cleanup_age; -int max_standby_archive_delay = 30 * 1000; -int max_standby_streaming_delay = 30 * 1000; +__thread int vacuum_defer_cleanup_age; +__thread int max_standby_archive_delay = 30 * 1000; +__thread int max_standby_streaming_delay = 30 * 1000; static HTAB *RecoveryLockLists; /* Flags set by timeout handlers */ -static volatile sig_atomic_t got_standby_deadlock_timeout = false; -static volatile sig_atomic_t got_standby_lock_timeout = false; +static __thread volatile sig_atomic_t got_standby_deadlock_timeout = false; +static __thread volatile sig_atomic_t got_standby_lock_timeout = false; static void ResolveRecoveryConflictWithVirtualXIDs(VirtualTransactionId *waitlist, ProcSignalReason reason, @@ -197,7 +197,7 @@ GetStandbyLimitTime(void) } #define STANDBY_INITIAL_WAIT_US 1000 -static int standbyWait_us = STANDBY_INITIAL_WAIT_US; +static __thread int standbyWait_us = STANDBY_INITIAL_WAIT_US; /* * Standby wait logic for ResolveRecoveryConflictWithVirtualXIDs. diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/large_object/inv_api.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/large_object/inv_api.c index 7917977ac7..a420f4c15c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/large_object/inv_api.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/large_object/inv_api.c @@ -55,7 +55,7 @@ /* * GUC: backwards-compatibility flag to suppress LO permission checks */ -bool lo_compat_privileges; +__thread bool lo_compat_privileges; /* * All accesses to pg_largeobject and its index make use of a single Relation @@ -64,8 +64,8 @@ bool lo_compat_privileges; * subtransaction, we execute a slightly klugy maneuver to assign ownership of * the Relation reference to TopTransactionResourceOwner. */ -static Relation lo_heap_r = NULL; -static Relation lo_index_r = NULL; +static __thread Relation lo_heap_r = NULL; +static __thread Relation lo_index_r = NULL; /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/deadlock.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/deadlock.c index beedc7947d..92ba8faba7 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/deadlock.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/deadlock.c @@ -100,7 +100,7 @@ static void PrintLockQueue(LOCK *lock, const char *info); /* Workspace for FindLockCycle */ static PGPROC **visitedProcs; /* Array of visited procs */ -static int nVisitedProcs; +static __thread int nVisitedProcs; /* Workspace for TopoSort */ static PGPROC **topoProcs; /* Array of not-yet-output procs */ @@ -109,20 +109,20 @@ static int *afterConstraints; /* List head for after-constraints */ /* Output area for ExpandConstraints */ static WAIT_ORDER *waitOrders; /* Array of proposed queue rearrangements */ -static int nWaitOrders; -static PGPROC **waitOrderProcs; /* Space for waitOrders queue contents */ +static __thread int nWaitOrders; +static __thread PGPROC **waitOrderProcs; /* Space for waitOrders queue contents */ /* Current list of constraints being considered */ static EDGE *curConstraints; -static int nCurConstraints; -static int maxCurConstraints; +static __thread int nCurConstraints; +static __thread int maxCurConstraints; /* Storage space for results from FindLockCycle */ static EDGE *possibleConstraints; -static int nPossibleConstraints; -static int maxPossibleConstraints; +static __thread int nPossibleConstraints; +static __thread int maxPossibleConstraints; static DEADLOCK_INFO *deadlockDetails; -static int nDeadlockDetails; +static __thread int nDeadlockDetails; /* PGPROC pointer of any blocking autovacuum worker found */ static PGPROC *blocking_autovacuum_proc = NULL; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/lmgr.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/lmgr.c index 14be354f29..487e0e0096 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/lmgr.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/lmgr.c @@ -43,7 +43,7 @@ * particularly bad happens: in the worst case they deadlock, causing one of * the transactions to abort. */ -static uint32 speculativeInsertionToken = 0; +static __thread uint32 speculativeInsertionToken = 0; /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/lock.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/lock.c index 9741914ec7..95324fd990 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/lock.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/lock.c @@ -51,7 +51,7 @@ /* This configuration variable is used to set the lock table size */ -int max_locks_per_xact; /* set by guc.c */ +__thread int max_locks_per_xact; /* set by guc.c */ #define NLOCKENTS() \ mul_size(max_locks_per_xact, add_size(MaxBackends, max_prepared_xacts)) @@ -168,7 +168,7 @@ typedef struct TwoPhaseLockRecord * our locks to the primary lock table, but it can never be lower than the * real value, since only we can acquire locks on our own behalf. */ -static int FastPathLocalUseCount = 0; +static __thread int FastPathLocalUseCount = 0; /* * Flag to indicate if the relation extension lock is held by this backend. @@ -285,7 +285,7 @@ static HTAB *LockMethodLocalHash; /* private state for error cleanup */ static LOCALLOCK *StrongLockInProgress; static LOCALLOCK *awaitedLock; -static ResourceOwner awaitedOwner; +static __thread ResourceOwner awaitedOwner; #ifdef LOCK_DEBUG diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/lwlock.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/lwlock.c index cf255abbb7..78b9d3ee2f 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/lwlock.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/lwlock.c @@ -190,7 +190,7 @@ StaticAssertDecl(lengthof(BuiltinTrancheNames) == * process. Any unused entries in the array will contain NULL. */ static const char **LWLockTrancheNames = NULL; -static int LWLockTrancheNamesAllocated = 0; +static __thread int LWLockTrancheNamesAllocated = 0; /* * This points to the main array of LWLocks in shared memory. Backends inherit @@ -214,7 +214,7 @@ typedef struct LWLockHandle LWLockMode mode; } LWLockHandle; -static int num_held_lwlocks = 0; +static __thread int num_held_lwlocks = 0; static LWLockHandle held_lwlocks[MAX_SIMUL_LWLOCKS]; /* struct representing the LWLock tranche request for named tranche */ @@ -225,7 +225,7 @@ typedef struct NamedLWLockTrancheRequest } NamedLWLockTrancheRequest; static NamedLWLockTrancheRequest *NamedLWLockTrancheRequestArray = NULL; -static int NamedLWLockTrancheRequestsAllocated = 0; +static __thread int NamedLWLockTrancheRequestsAllocated = 0; /* * NamedLWLockTrancheRequests is both the valid length of the request array, @@ -233,12 +233,12 @@ static int NamedLWLockTrancheRequestsAllocated = 0; * This variable and NamedLWLockTrancheArray are non-static so that * postmaster.c can copy them to child processes in EXEC_BACKEND builds. */ -int NamedLWLockTrancheRequests = 0; +__thread int NamedLWLockTrancheRequests = 0; /* points to data in shared memory: */ NamedLWLockTranche *NamedLWLockTrancheArray = NULL; -static bool lock_named_request_allowed = true; +static __thread bool lock_named_request_allowed = true; static void InitializeLWLocks(void); static inline void LWLockReportWaitStart(LWLock *lock); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/predicate.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/predicate.c index 2d7ed83ea9..5abc8f62ef 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/predicate.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/predicate.c @@ -316,7 +316,7 @@ /* * The SLRU buffer area through which we access the old xids. */ -static SlruCtlData SerialSlruCtlData; +static __thread SlruCtlData SerialSlruCtlData; #define SerialSlruCtl (&SerialSlruCtlData) @@ -346,7 +346,7 @@ typedef struct SerialControlData typedef struct SerialControlData *SerialControl; -static SerialControl serialControl; +static __thread SerialControl serialControl; /* * When the oldest committed transaction on the "finished" list is moved to @@ -363,9 +363,9 @@ static SERIALIZABLEXACT *OldCommittedSxact; * attempt to degrade performance (mostly as false positive serialization * failure) gracefully in the face of memory pressure. */ -int max_predicate_locks_per_xact; /* set by guc.c */ -int max_predicate_locks_per_relation; /* set by guc.c */ -int max_predicate_locks_per_page; /* set by guc.c */ +__thread int max_predicate_locks_per_xact; /* set by guc.c */ +__thread int max_predicate_locks_per_relation; /* set by guc.c */ +__thread int max_predicate_locks_per_page; /* set by guc.c */ /* * This provides a list of objects in order to track transactions @@ -376,13 +376,13 @@ int max_predicate_locks_per_page; /* set by guc.c */ * number of entries in the list, and the size allowed for each entry is * fixed upon creation. */ -static PredXactList PredXact; +static __thread PredXactList PredXact; /* * This provides a pool of RWConflict data elements to use in conflict lists * between transactions. */ -static RWConflictPoolHeader RWConflictPool; +static __thread RWConflictPoolHeader RWConflictPool; /* * The predicate locking hash tables are in shared memory. @@ -399,7 +399,7 @@ static SHM_QUEUE *FinishedSerializableTransactions; * inserting one entry in the hash table. This is an otherwise-invalid tag. */ static const PREDICATELOCKTARGETTAG ScratchTargetTag = {0, 0, 0, 0}; -static uint32 ScratchTargetTagHash; +static __thread uint32 ScratchTargetTagHash; static LWLock *ScratchPartitionLock; /* @@ -414,7 +414,7 @@ static HTAB *LocalPredicateLockHash = NULL; * cause a rw-conflict. */ static SERIALIZABLEXACT *MySerializableXact = InvalidSerializableXact; -static bool MyXactDidWrite = false; +static __thread bool MyXactDidWrite = false; /* * The SXACT_FLAG_RO_UNSAFE optimization might lead us to release diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/proc.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/proc.c index 0d70b03eeb..c23fc21e8b 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/proc.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/proc.c @@ -57,11 +57,11 @@ #include "utils/timestamp.h" /* GUC variables */ -int DeadlockTimeout = 1000; -int StatementTimeout = 0; -int LockTimeout = 0; -int IdleInTransactionSessionTimeout = 0; -bool log_lock_waits = false; +__thread int DeadlockTimeout = 1000; +__thread int StatementTimeout = 0; +__thread int LockTimeout = 0; +__thread int IdleInTransactionSessionTimeout = 0; +__thread bool log_lock_waits = false; /* Pointer to this process's PGPROC and PGXACT structs, if any */ PGPROC *MyProc = NULL; @@ -84,10 +84,10 @@ PGPROC *PreparedXactProcs = NULL; /* If we are waiting for a lock, this points to the associated LOCALLOCK */ static LOCALLOCK *lockAwaited = NULL; -static DeadLockState deadlock_state = DS_NOT_YET_CHECKED; +static __thread DeadLockState deadlock_state = DS_NOT_YET_CHECKED; /* Is a deadlock check pending? */ -static volatile sig_atomic_t got_deadlock_timeout; +static __thread volatile sig_atomic_t got_deadlock_timeout; static void RemoveProcFromArray(int code, Datum arg); static void ProcKill(int code, Datum arg); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/s_lock.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/s_lock.c index 7fac070341..cc4e60c85c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/s_lock.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/lmgr/s_lock.c @@ -60,9 +60,9 @@ #define MAX_DELAY_USEC 1000000L -slock_t dummy_spinlock; +__thread slock_t dummy_spinlock; -static int spins_per_delay = DEFAULT_SPINS_PER_DELAY; +static __thread int spins_per_delay = DEFAULT_SPINS_PER_DELAY; /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/page/bufpage.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/page/bufpage.c index 8dc67c97cb..c33df1ee6c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/page/bufpage.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/page/bufpage.c @@ -24,7 +24,7 @@ /* GUC variable */ -bool ignore_checksum_failure = false; +__thread bool ignore_checksum_failure = false; /* ---------------------------------------------------------------- diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/smgr/md.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/smgr/md.c index 51617e17c1..5fd54f7c0a 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/smgr/md.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/smgr/md.c @@ -85,7 +85,7 @@ typedef struct _MdfdVec BlockNumber mdfd_segno; /* segment number, from 0 */ } MdfdVec; -static MemoryContext MdCxt; /* context for all MdfdVec objects */ +static __thread MemoryContext MdCxt; /* context for all MdfdVec objects */ /* Populate a file tag describing an md.c segment file. */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/smgr/smgr.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/smgr/smgr.c index 7d667c6586..5328dfdec9 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/smgr/smgr.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/smgr/smgr.c @@ -92,7 +92,7 @@ static const int NSmgr = lengthof(smgrsw); */ static HTAB *SMgrRelationHash = NULL; -static dlist_head unowned_relns; +static __thread dlist_head unowned_relns; /* local function prototypes */ static void smgrshutdown(int code, Datum arg); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/sync/sync.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/sync/sync.c index 4ce2e687d3..70516ec0ba 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/sync/sync.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/storage/sync/sync.c @@ -32,7 +32,7 @@ #include "utils/inval.h" #include "utils/memutils.h" -static MemoryContext pendingOpsCxt; /* context for the pending ops state */ +static __thread MemoryContext pendingOpsCxt; /* context for the pending ops state */ /* * In some contexts (currently, standalone backends and the checkpointer) @@ -71,10 +71,10 @@ typedef struct static HTAB *pendingOps = NULL; static List *pendingUnlinks = NIL; -static MemoryContext pendingOpsCxt; /* context for the above */ +static __thread MemoryContext pendingOpsCxt; /* context for the above */ -static CycleCtr sync_cycle_ctr = 0; -static CycleCtr checkpoint_cycle_ctr = 0; +static __thread CycleCtr sync_cycle_ctr = 0; +static __thread CycleCtr checkpoint_cycle_ctr = 0; /* Intervals for calling AbsorbSyncRequests */ #define FSYNCS_PER_ABSORB 10 diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/tcop/postgres.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/tcop/postgres.c index d87258ab9a..648b0ab2a1 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/tcop/postgres.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/tcop/postgres.c @@ -88,18 +88,18 @@ const char *debug_query_string; /* client-supplied query string */ /* Note: whereToSendOutput is initialized for the bootstrap/standalone case */ -CommandDest whereToSendOutput = DestDebug; +__thread CommandDest whereToSendOutput = DestDebug; /* flag for logging end of session */ -bool Log_disconnections = false; +__thread bool Log_disconnections = false; -int log_statement = LOGSTMT_NONE; +__thread int log_statement = LOGSTMT_NONE; /* GUC variable for maximum stack depth (measured in kilobytes) */ -int max_stack_depth = 100; +__thread int max_stack_depth = 100; /* wait N seconds to allow attach from a debugger */ -int PostAuthDelay = 0; +__thread int PostAuthDelay = 0; @@ -109,7 +109,7 @@ int PostAuthDelay = 0; */ /* max_stack_depth converted to bytes for speed of checking */ -static long max_stack_depth_bytes = 100 * 1024L; +static __thread long max_stack_depth_bytes = 100 * 1024L; /* * Stack base pointer -- initialized by PostmasterMain and inherited by @@ -130,21 +130,21 @@ char *register_stack_base_ptr = NULL; * Flag to keep track of whether we have started a transaction. * For extended query protocol this has to be remembered across messages. */ -static bool xact_started = false; +static __thread bool xact_started = false; /* * Flag to indicate that we are doing the outer loop's read-from-client, * as opposed to any random read from client that might happen within * commands like COPY FROM STDIN. */ -static bool DoingCommandRead = false; +static __thread bool DoingCommandRead = false; /* * Flags to implement skip-till-Sync-after-error behavior for messages of * the extended query protocol. */ -static bool doing_extended_query_message = false; -static bool ignore_till_sync = false; +static __thread bool doing_extended_query_message = false; +static __thread bool ignore_till_sync = false; /* * If an unnamed prepared statement exists, it's stored here. @@ -155,17 +155,17 @@ static CachedPlanSource *unnamed_stmt_psrc = NULL; /* assorted command-line switches */ static const char *userDoption = NULL; /* -D switch */ -static bool EchoQuery = false; /* -E switch */ -static bool UseSemiNewlineNewline = false; /* -j switch */ +static __thread bool EchoQuery = false; /* -E switch */ +static __thread bool UseSemiNewlineNewline = false; /* -j switch */ /* whether or not, and why, we were canceled by conflict with recovery */ -static bool RecoveryConflictPending = false; -static bool RecoveryConflictRetryable = true; -static ProcSignalReason RecoveryConflictReason; +static __thread bool RecoveryConflictPending = false; +static __thread bool RecoveryConflictRetryable = true; +static __thread ProcSignalReason RecoveryConflictReason; /* reused buffer to pass to SendRowDescriptionMessage() */ -static MemoryContext row_description_context = NULL; -static StringInfoData row_description_buf; +static __thread MemoryContext row_description_context = NULL; +static __thread StringInfoData row_description_buf; /* ---------------------------------------------------------------- * decls for routines only used in this file @@ -4626,8 +4626,8 @@ get_stack_depth_rlimit(void) } -static struct rusage Save_r; -static struct timeval Save_t; +static __thread struct rusage Save_r; +static __thread struct timeval Save_t; void ResetUsage(void) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/tcop/pquery.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/tcop/pquery.c index a8f65ca165..0bf981d73a 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/tcop/pquery.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/tcop/pquery.c @@ -32,7 +32,7 @@ * ActivePortal is the currently executing Portal (the most closely nested, * if there are several). */ -Portal ActivePortal = NULL; +__thread Portal ActivePortal = NULL; static void ProcessQuery(PlannedStmt *plan, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/tcop/utility.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/tcop/utility.c index 7341ef8513..eec6af4263 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/tcop/utility.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/tcop/utility.c @@ -72,7 +72,7 @@ #include "utils/syscache.h" /* Hook for plugins to get control in ProcessUtility() */ -ProcessUtility_hook_type ProcessUtility_hook = NULL; +__thread ProcessUtility_hook_type ProcessUtility_hook = NULL; /* local function declarations */ static int ClassifyUtilityCommandAsReadOnly(Node *parsetree); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/acl.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/acl.c index 05471746fd..95ed6da990 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/acl.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/acl.c @@ -72,9 +72,9 @@ typedef struct * is a member of (always including itself). * The cache is valid if cached_member_role is not InvalidOid. */ -static Oid cached_privs_role = InvalidOid; +static __thread Oid cached_privs_role = InvalidOid; static List *cached_privs_roles = NIL; -static Oid cached_member_role = InvalidOid; +static __thread Oid cached_member_role = InvalidOid; static List *cached_membership_roles = NIL; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/arrayfuncs.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/arrayfuncs.c index 9b95207d1e..2fca9eb763 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/arrayfuncs.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/arrayfuncs.c @@ -38,7 +38,7 @@ /* * GUC parameter */ -bool Array_nulls = true; +__thread bool Array_nulls = true; /* * Local definitions diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/float.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/float.c index 6a717f19bb..3b9d88a18e 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/float.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/float.c @@ -39,17 +39,17 @@ * get round-trip-accurate results. If 0 or less, then use the old, slow, * decimal rounding method. */ -int extra_float_digits = 1; +__thread int extra_float_digits = 1; /* Cached constants for degree-based trig functions */ -static bool degree_consts_set = false; -static float8 sin_30 = 0; -static float8 one_minus_cos_60 = 0; -static float8 asin_0_5 = 0; -static float8 acos_0_5 = 0; -static float8 atan_1_0 = 0; -static float8 tan_45 = 0; -static float8 cot_45 = 0; +static __thread bool degree_consts_set = false; +static __thread float8 sin_30 = 0; +static __thread float8 one_minus_cos_60 = 0; +static __thread float8 asin_0_5 = 0; +static __thread float8 acos_0_5 = 0; +static __thread float8 atan_1_0 = 0; +static __thread float8 tan_45 = 0; +static __thread float8 cot_45 = 0; /* * These are intentionally not static; don't "fix" them. They will never @@ -57,14 +57,14 @@ static float8 cot_45 = 0; * compiler to know that, else it might try to precompute expressions * involving them. See comments for init_degree_constants(). */ -float8 degree_c_thirty = 30.0; -float8 degree_c_forty_five = 45.0; -float8 degree_c_sixty = 60.0; -float8 degree_c_one_half = 0.5; -float8 degree_c_one = 1.0; +__thread float8 degree_c_thirty = 30.0; +__thread float8 degree_c_forty_five = 45.0; +__thread float8 degree_c_sixty = 60.0; +__thread float8 degree_c_one_half = 0.5; +__thread float8 degree_c_one = 1.0; /* State for drandom() and setseed() */ -static bool drandom_seed_set = false; +static __thread bool drandom_seed_set = false; static unsigned short drandom_seed[3] = {0, 0, 0}; /* Local function prototypes */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/formatting.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/formatting.c index f1a753fc91..bc307bfd38 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/formatting.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/formatting.c @@ -427,13 +427,13 @@ typedef struct /* global cache for date/time format pictures */ static DCHCacheEntry *DCHCache[DCH_CACHE_ENTRIES]; -static int n_DCHCache = 0; /* current number of entries */ -static int DCHCounter = 0; /* aging-event counter */ +static __thread int n_DCHCache = 0; /* current number of entries */ +static __thread int DCHCounter = 0; /* aging-event counter */ /* global cache for number format pictures */ static NUMCacheEntry *NUMCache[NUM_CACHE_ENTRIES]; -static int n_NUMCache = 0; /* current number of entries */ -static int NUMCounter = 0; /* aging-event counter */ +static __thread int n_NUMCache = 0; /* current number of entries */ +static __thread int NUMCounter = 0; /* aging-event counter */ /* ---------- * For char->date/time conversion diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/jsonpath_scan.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/jsonpath_scan.c index a09619bbaf..c436994b24 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/jsonpath_scan.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/jsonpath_scan.c @@ -518,9 +518,9 @@ struct yy_buffer_state #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ +static __thread size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static __thread size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static __thread YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -537,19 +537,19 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static __thread char yy_hold_char; +static __thread int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = NULL; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static __thread int yy_init = 0; /* whether we need to initialize */ +static __thread int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ -static int yy_did_buffer_switch_on_eof; +static __thread int yy_did_buffer_switch_on_eof; void yyrestart ( FILE *input_file ); void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); @@ -2420,12 +2420,12 @@ char *yytext; #include "mb/pg_wchar.h" #include "nodes/pg_list.h" -static JsonPathString scanstring; +static __thread JsonPathString scanstring; /* Handles to the buffer that the lexer uses internally */ -static YY_BUFFER_STATE scanbufhandle; +static __thread YY_BUFFER_STATE scanbufhandle; static char *scanbuf; -static int scanbuflen; +static __thread int scanbuflen; static void addstring(bool init, char *s, int l); static void addchar(bool init, char s); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/pg_locale.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/pg_locale.c index 94acf82118..dffa7666f2 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/pg_locale.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/pg_locale.c @@ -109,8 +109,8 @@ char *localized_abbrev_months[12 + 1]; char *localized_full_months[12 + 1]; /* indicates whether locale information cache is valid */ -static bool CurrentLocaleConvValid = false; -static bool CurrentLCTimeValid = false; +static __thread bool CurrentLocaleConvValid = false; +static __thread bool CurrentLCTimeValid = false; /* Environment variable storage area */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/regexp.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/regexp.c index 06f808652a..1e117c357a 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/regexp.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/regexp.c @@ -106,7 +106,7 @@ typedef struct cached_re_str regex_t cre_re; /* the compiled regular expression */ } cached_re_str; -static int num_res = 0; /* # of cached re's */ +static __thread int num_res = 0; /* # of cached re's */ static cached_re_str re_array[MAX_CACHED_RES]; /* cached re's */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/ri_triggers.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/ri_triggers.c index 47d4965215..a006eef8b4 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/ri_triggers.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/ri_triggers.c @@ -166,8 +166,8 @@ typedef struct RI_CompareHashEntry static HTAB *ri_constraint_cache = NULL; static HTAB *ri_query_cache = NULL; static HTAB *ri_compare_cache = NULL; -static dlist_head ri_constraint_cache_valid_list; -static int ri_constraint_cache_valid_count = 0; +static __thread dlist_head ri_constraint_cache_valid_list; +static __thread int ri_constraint_cache_valid_count = 0; /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/ruleutils.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/ruleutils.c index 5564725196..62eaf40c1c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/ruleutils.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/ruleutils.c @@ -307,13 +307,13 @@ typedef void (*rsv_callback) (Node *node, deparse_context *context, * Global data * ---------- */ -static SPIPlanPtr plan_getrulebyoid = NULL; +static __thread SPIPlanPtr plan_getrulebyoid = NULL; static const char *query_getrulebyoid = "SELECT * FROM pg_catalog.pg_rewrite WHERE oid = $1"; -static SPIPlanPtr plan_getviewrule = NULL; +static __thread SPIPlanPtr plan_getviewrule = NULL; static const char *query_getviewrule = "SELECT * FROM pg_catalog.pg_rewrite WHERE ev_class = $1 AND rulename = $2"; /* GUC parameters */ -bool quote_all_identifiers = false; +__thread bool quote_all_identifiers = false; /* ---------- diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/selfuncs.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/selfuncs.c index 81602674fd..229d20a25c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/selfuncs.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/selfuncs.c @@ -145,8 +145,8 @@ #define NumRelids(a,b) NumRelids_new(a,b) /* Hooks for plugins to get control when we ask for stats */ -get_relation_stats_hook_type get_relation_stats_hook = NULL; -get_index_stats_hook_type get_index_stats_hook = NULL; +__thread get_relation_stats_hook_type get_relation_stats_hook = NULL; +__thread get_index_stats_hook_type get_index_stats_hook = NULL; static double eqsel_internal(PG_FUNCTION_ARGS, bool negate); static double eqjoinsel_inner(Oid opfuncoid, Oid collation, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/tid.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/tid.c index 509a0fdffc..46d10b0c06 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/tid.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/tid.c @@ -275,7 +275,7 @@ hashtidextended(PG_FUNCTION_ARGS) * Maybe these implementations should be moved to another place */ -static ItemPointerData Current_last_tid = {{0, 0}, 0}; +static __thread ItemPointerData Current_last_tid = {{0, 0}, 0}; void setLastTid(const ItemPointer tid) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/timestamp.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/timestamp.c index aaab84aedd..2f80a9e091 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/timestamp.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/timestamp.c @@ -47,10 +47,10 @@ #define SAMESIGN(a,b) (((a) < 0) == ((b) < 0)) /* Set at postmaster start */ -TimestampTz PgStartTime; +__thread TimestampTz PgStartTime; /* Set at configuration reload */ -TimestampTz PgReloadTime; +__thread TimestampTz PgReloadTime; typedef struct { diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/tsgistidx.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/tsgistidx.c index a601965bd8..32a0736feb 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/tsgistidx.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/tsgistidx.c @@ -97,7 +97,7 @@ gtsvectorin(PG_FUNCTION_ARGS) #define ARROUTSTR "%d unique words" #define EXTRALEN ( 2*13 ) -static int outbuf_maxlen = 0; +static __thread int outbuf_maxlen = 0; Datum gtsvectorout(PG_FUNCTION_ARGS) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/varlena.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/varlena.c index 390da8e820..4e9423f440 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/varlena.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/varlena.c @@ -39,7 +39,7 @@ /* GUC variable */ -int bytea_output = BYTEA_OUTPUT_HEX; +__thread int bytea_output = BYTEA_OUTPUT_HEX; typedef struct varlena unknown; typedef struct varlena VarString; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/xml.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/xml.c index 4c299057a6..680e914f8f 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/xml.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/adt/xml.c @@ -94,8 +94,8 @@ /* GUC variables */ -int xmlbinary; -int xmloption; +__thread int xmlbinary; +__thread int xmloption; #ifdef USE_LIBXML diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/evtcache.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/evtcache.c index 73d091d1f6..1aef8d957b 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/evtcache.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/evtcache.c @@ -46,8 +46,8 @@ typedef struct } EventTriggerCacheEntry; static HTAB *EventTriggerCache; -static MemoryContext EventTriggerCacheContext; -static EventTriggerCacheStateType EventTriggerCacheState = ETCS_NEEDS_REBUILD; +static __thread MemoryContext EventTriggerCacheContext; +static __thread EventTriggerCacheStateType EventTriggerCacheState = ETCS_NEEDS_REBUILD; static void BuildEventTriggerCache(void); static void InvalidateEventCacheCallback(Datum arg, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/inval.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/inval.c index 8b0503f41c..4b7e6f13c2 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/inval.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/inval.c @@ -187,8 +187,8 @@ typedef struct TransInvalidationInfo static TransInvalidationInfo *transInvalInfo = NULL; static SharedInvalidationMessage *SharedInvalidMessagesArray; -static int numSharedInvalidMessagesArray; -static int maxSharedInvalidMessagesArray; +static __thread int numSharedInvalidMessagesArray; +static __thread int maxSharedInvalidMessagesArray; /* @@ -214,7 +214,7 @@ static struct SYSCACHECALLBACK static int16 syscache_callback_links[SysCacheSize]; -static int syscache_callback_count = 0; +static __thread int syscache_callback_count = 0; static struct RELCACHECALLBACK { @@ -222,7 +222,7 @@ static struct RELCACHECALLBACK Datum arg; } relcache_callback_list[MAX_RELCACHE_CALLBACKS]; -static int relcache_callback_count = 0; +static __thread int relcache_callback_count = 0; /* ---------------------------------------------------------------- * Invalidation list support functions diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/lsyscache.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/lsyscache.c index 3303c31e57..4666d10c3a 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/lsyscache.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/lsyscache.c @@ -48,7 +48,7 @@ #include "utils/typcache.h" /* Hook for plugins to get control in get_attavgwidth() */ -get_attavgwidth_hook_type get_attavgwidth_hook = NULL; +__thread get_attavgwidth_hook_type get_attavgwidth_hook = NULL; /* ---------- AMOP CACHES ---------- */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/plancache.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/plancache.c index 75b475c179..95154cff1a 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/plancache.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/plancache.c @@ -89,12 +89,12 @@ * We use a dlist instead of separate List cells so that we can guarantee * to save a CachedPlanSource without error. */ -static dlist_head saved_plan_list = DLIST_STATIC_INIT(saved_plan_list); +static __thread dlist_head saved_plan_list ;void saved_plan_list_init(void) { dlist_init(&saved_plan_list); } /* * This is the head of the backend's list of CachedExpressions. */ -static dlist_head cached_expression_list = DLIST_STATIC_INIT(cached_expression_list); +static __thread dlist_head cached_expression_list ;void cached_expression_list_init(void) { dlist_init(&cached_expression_list); } static void ReleaseGenericPlan(CachedPlanSource *plansource); static List *RevalidateCachedQuery(CachedPlanSource *plansource, @@ -116,7 +116,7 @@ static void PlanCacheObjectCallback(Datum arg, int cacheid, uint32 hashvalue); static void PlanCacheSysCallback(Datum arg, int cacheid, uint32 hashvalue); /* GUC parameter */ -int plan_cache_mode; +__thread int plan_cache_mode; /* * InitPlanCache: initialize module during InitPostgres. diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/relcache.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/relcache.c index 7976a0d66d..6554cfab83 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/relcache.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/relcache.c @@ -134,13 +134,13 @@ static HTAB *RelationIdCache; * This flag is false until we have prepared the critical relcache entries * that are needed to do indexscans on the tables read by relcache building. */ -bool criticalRelcachesBuilt = false; +__thread bool criticalRelcachesBuilt = false; /* * This flag is false until we have prepared the critical relcache entries * for shared catalogs (which are the tables needed for login). */ -bool criticalSharedRelcachesBuilt = false; +__thread bool criticalSharedRelcachesBuilt = false; /* * This counter counts relcache inval events received since backend startup @@ -148,7 +148,7 @@ bool criticalSharedRelcachesBuilt = false; * to detect whether data about to be written by write_relcache_init_file() * might already be obsolete. */ -static long relcacheInvalsReceived = 0L; +static __thread long relcacheInvalsReceived = 0L; /* * in_progress_list is a stack of ongoing RelationBuildDesc() calls. CREATE @@ -165,8 +165,8 @@ typedef struct inprogressent } InProgressEnt; static InProgressEnt *in_progress_list; -static int in_progress_list_len; -static int in_progress_list_maxlen; +static __thread int in_progress_list_len; +static __thread int in_progress_list_maxlen; /* * eoxact_list[] stores the OIDs of relations that (might) need AtEOXact @@ -180,8 +180,8 @@ static int in_progress_list_maxlen; */ #define MAX_EOXACT_LIST 32 static Oid eoxact_list[MAX_EOXACT_LIST]; -static int eoxact_list_len = 0; -static bool eoxact_list_overflowed = false; +static __thread int eoxact_list_len = 0; +static __thread bool eoxact_list_overflowed = false; #define EOXactListAdd(rel) \ do { \ @@ -197,8 +197,8 @@ static bool eoxact_list_overflowed = false; * we don't need to access individual items except at EOXact. */ static TupleDesc *EOXactTupleDescArray; -static int NextEOXactTupleDescNum = 0; -static int EOXactTupleDescArrayLen = 0; +static __thread int NextEOXactTupleDescNum = 0; +static __thread int EOXactTupleDescArrayLen = 0; /* * macros to manipulate the lookup hashtable diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/relmapper.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/relmapper.c index 7bf74a9365..68bcdcba5d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/relmapper.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/relmapper.c @@ -106,8 +106,8 @@ typedef struct SerializedActiveRelMaps * local map file are stored here. These can be reloaded from disk * immediately whenever we receive an update sinval message. */ -static RelMapFile shared_map; -static RelMapFile local_map; +static __thread RelMapFile shared_map; +static __thread RelMapFile local_map; /* * We use the same RelMapFile data structure to track uncommitted local @@ -125,10 +125,10 @@ static RelMapFile local_map; * Active shared and active local updates are serialized by the parallel * infrastructure, and deserialized within parallel workers. */ -static RelMapFile active_shared_updates; -static RelMapFile active_local_updates; -static RelMapFile pending_shared_updates; -static RelMapFile pending_local_updates; +static __thread RelMapFile active_shared_updates; +static __thread RelMapFile active_local_updates; +static __thread RelMapFile pending_shared_updates; +static __thread RelMapFile pending_local_updates; /* non-export function prototypes */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/syscache.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/syscache.c index 53d9ddf159..ca6984edda 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/syscache.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/syscache.c @@ -985,15 +985,15 @@ static const struct cachedesc cacheinfo[] = { static CatCache *SysCache[SysCacheSize]; -static bool CacheInitialized = false; +static __thread bool CacheInitialized = false; /* Sorted array of OIDs of tables that have caches on them */ static Oid SysCacheRelationOid[SysCacheSize]; -static int SysCacheRelationOidSize; +static __thread int SysCacheRelationOidSize; /* Sorted array of OIDs of tables and indexes used by caches */ static Oid SysCacheSupportingRelOid[SysCacheSize * 2]; -static int SysCacheSupportingRelOidSize; +static __thread int SysCacheSupportingRelOidSize; static int oid_compare(const void *a, const void *b); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/ts_cache.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/ts_cache.c index 1641271cfe..ce5b694d86 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/ts_cache.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/ts_cache.c @@ -74,7 +74,7 @@ static TSConfigCacheEntry *lastUsedConfig = NULL; */ char *TSCurrentConfig = NULL; -static Oid TSCurrentConfigCache = InvalidOid; +static __thread Oid TSCurrentConfigCache = InvalidOid; /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/typcache.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/typcache.c index 5d4d5660d9..4744edfe4b 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/typcache.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/cache/typcache.c @@ -274,15 +274,15 @@ static HTAB *RecordCacheHash = NULL; /* arrays of info about registered record types, indexed by assigned typmod */ static TupleDesc *RecordCacheArray = NULL; static uint64 *RecordIdentifierArray = NULL; -static int32 RecordCacheArrayLen = 0; /* allocated length of above arrays */ -static int32 NextRecordTypmod = 0; /* number of entries used */ +static __thread int32 RecordCacheArrayLen = 0; /* allocated length of above arrays */ +static __thread int32 NextRecordTypmod = 0; /* number of entries used */ /* * Process-wide counter for generating unique tupledesc identifiers. * Zero and one (INVALID_TUPLEDESC_IDENTIFIER) aren't allowed to be chosen * as identifiers, so we start the counter at INVALID_TUPLEDESC_IDENTIFIER. */ -static uint64 tupledesc_id_counter = INVALID_TUPLEDESC_IDENTIFIER; +static __thread uint64 tupledesc_id_counter = INVALID_TUPLEDESC_IDENTIFIER; static void load_typcache_tupdesc(TypeCacheEntry *typentry); static void load_rangetype_info(TypeCacheEntry *typentry); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/error/elog.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/error/elog.c index e4b717c79a..f5520f6558 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/error/elog.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/error/elog.c @@ -93,7 +93,7 @@ ErrorContextCallback *error_context_stack = NULL; sigjmp_buf *PG_exception_stack = NULL; -extern bool redirection_done; +extern __thread bool redirection_done; /* * Hook for intercepting messages before they are sent to the server log. @@ -102,15 +102,15 @@ extern bool redirection_done; * libraries will miss any log messages that are generated before the * library is loaded. */ -emit_log_hook_type emit_log_hook = NULL; +__thread emit_log_hook_type emit_log_hook = NULL; /* GUC parameters */ -int Log_error_verbosity = PGERROR_VERBOSE; +__thread int Log_error_verbosity = PGERROR_VERBOSE; char *Log_line_prefix = NULL; /* format for extra log line info */ -int Log_destination = LOG_DESTINATION_STDERR; +__thread int Log_destination = LOG_DESTINATION_STDERR; char *Log_destination_string = NULL; -bool syslog_sequence_numbers = true; -bool syslog_split_messages = true; +__thread bool syslog_sequence_numbers = true; +__thread bool syslog_split_messages = true; #ifdef HAVE_SYSLOG @@ -125,9 +125,9 @@ bool syslog_split_messages = true; #define PG_SYSLOG_LIMIT 900 #endif -static bool openlog_done = false; +static __thread bool openlog_done = false; static char *syslog_ident = NULL; -static int syslog_facility = LOG_LOCAL0; +static __thread int syslog_facility = LOG_LOCAL0; static void write_syslog(int level, const char *line); #endif @@ -143,16 +143,16 @@ static void write_eventlog(int level, const char *line, int len); static ErrorData errordata[ERRORDATA_STACK_SIZE]; -static int errordata_stack_depth = -1; /* index of topmost active frame */ +static __thread int errordata_stack_depth = -1; /* index of topmost active frame */ -static int recursion_depth = 0; /* to detect actual recursion */ +static __thread int recursion_depth = 0; /* to detect actual recursion */ /* * Saved timeval and buffers for formatted timestamps that might be used by * both log_line_prefix and csv logs. */ -static struct timeval saved_timeval; -static bool saved_timeval_set = false; +static __thread struct timeval saved_timeval; +static __thread bool saved_timeval_set = false; #define FORMATTED_TS_LEN 128 static char formatted_start_time[FORMATTED_TS_LEN]; @@ -1374,7 +1374,7 @@ getinternalerrposition(void) * The result of format_elog_string() is stored in ErrorContext, and will * therefore survive until FlushErrorState() is called. */ -static int save_format_errnumber; +static __thread int save_format_errnumber; static const char *save_format_domain; void diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/fmgr/fmgr.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/fmgr/fmgr.c index 2681b7fbc6..7c1ced7473 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/fmgr/fmgr.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/fmgr/fmgr.c @@ -35,8 +35,8 @@ /* * Hooks for function calls */ -PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook = NULL; -PGDLLIMPORT fmgr_hook_type fmgr_hook = NULL; +__thread PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook = NULL; +__thread PGDLLIMPORT fmgr_hook_type fmgr_hook = NULL; /* * Hashtable for fast lookup of external C functions diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/hash/dynahash.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/hash/dynahash.c index 2688e27726..9e7e156142 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/hash/dynahash.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/hash/dynahash.c @@ -274,7 +274,7 @@ static bool has_seq_scans(HTAB *hashp); /* * memory allocation support */ -static MemoryContext CurrentDynaHashCxt = NULL; +static __thread MemoryContext CurrentDynaHashCxt = NULL; static void * DynaHashAlloc(Size size) @@ -1783,7 +1783,7 @@ next_pow2_int(long num) static HTAB *seq_scan_tables[MAX_SEQ_SCANS]; /* tables being scanned */ static int seq_scan_level[MAX_SEQ_SCANS]; /* subtransaction nest level */ -static int num_seq_scans = 0; +static __thread int num_seq_scans = 0; /* Register a table as having an active hash_seq_search scan */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/init/globals.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/init/globals.c index 9793354a02..fcc4448473 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/init/globals.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/init/globals.c @@ -25,24 +25,24 @@ #include "storage/backendid.h" -ProtocolVersion FrontendProtocol; - -volatile sig_atomic_t InterruptPending = false; -volatile sig_atomic_t QueryCancelPending = false; -volatile sig_atomic_t ProcDiePending = false; -volatile sig_atomic_t ClientConnectionLost = false; -volatile sig_atomic_t IdleInTransactionSessionTimeoutPending = false; -volatile sig_atomic_t ProcSignalBarrierPending = false; -volatile uint32 InterruptHoldoffCount = 0; -volatile uint32 QueryCancelHoldoffCount = 0; -volatile uint32 CritSectionCount = 0; - -int MyProcPid; -pg_time_t MyStartTime; -TimestampTz MyStartTimestamp; +__thread ProtocolVersion FrontendProtocol; + +__thread volatile sig_atomic_t InterruptPending = false; +__thread volatile sig_atomic_t QueryCancelPending = false; +__thread volatile sig_atomic_t ProcDiePending = false; +__thread volatile sig_atomic_t ClientConnectionLost = false; +__thread volatile sig_atomic_t IdleInTransactionSessionTimeoutPending = false; +__thread volatile sig_atomic_t ProcSignalBarrierPending = false; +__thread volatile uint32 InterruptHoldoffCount = 0; +__thread volatile uint32 QueryCancelHoldoffCount = 0; +__thread volatile uint32 CritSectionCount = 0; + +__thread int MyProcPid; +__thread pg_time_t MyStartTime; +__thread TimestampTz MyStartTimestamp; struct Port *MyProcPort; -int32 MyCancelKey; -int MyPMChildSlot; +__thread int32 MyCancelKey; +__thread int MyPMChildSlot; /* * MyLatch points to the latch that should be used for signal handling by the @@ -65,7 +65,7 @@ char *DataDir = NULL; * Mode of the data directory. The default is 0700 but it may be changed in * checkDataDir() to 0750 if the data directory actually has that mode. */ -int data_directory_mode = PG_DIR_MODE_OWNER; +__thread int data_directory_mode = PG_DIR_MODE_OWNER; char OutputFileName[MAXPGPATH]; /* debugging output file */ @@ -78,13 +78,13 @@ char postgres_exec_path[MAXPGPATH]; /* full path to backend */ /* note: currently this is not valid in backend processes */ #endif -BackendId MyBackendId = InvalidBackendId; +__thread BackendId MyBackendId = InvalidBackendId; -BackendId ParallelMasterBackendId = InvalidBackendId; +__thread BackendId ParallelMasterBackendId = InvalidBackendId; -Oid MyDatabaseId = InvalidOid; +__thread Oid MyDatabaseId = InvalidOid; -Oid MyDatabaseTableSpace = InvalidOid; +__thread Oid MyDatabaseTableSpace = InvalidOid; /* * DatabasePath is the path (relative to DataDir) of my database's @@ -92,7 +92,7 @@ Oid MyDatabaseTableSpace = InvalidOid; */ char *DatabasePath = NULL; -pid_t PostmasterPid = 0; +__thread pid_t PostmasterPid = 0; /* * IsPostmasterEnvironment is true in a postmaster process and any postmaster @@ -105,23 +105,23 @@ pid_t PostmasterPid = 0; * * These are initialized for the bootstrap/standalone case. */ -bool IsPostmasterEnvironment = false; -bool IsUnderPostmaster = false; -bool IsBinaryUpgrade = false; -bool IsBackgroundWorker = false; +__thread bool IsPostmasterEnvironment = false; +__thread bool IsUnderPostmaster = false; +__thread bool IsBinaryUpgrade = false; +__thread bool IsBackgroundWorker = false; -bool ExitOnAnyError = false; +__thread bool ExitOnAnyError = false; -int DateStyle = USE_ISO_DATES; -int DateOrder = DATEORDER_MDY; -int IntervalStyle = INTSTYLE_POSTGRES; +__thread int DateStyle = USE_ISO_DATES; +__thread int DateOrder = DATEORDER_MDY; +__thread int IntervalStyle = INTSTYLE_POSTGRES; -bool enableFsync = true; -bool allowSystemTableMods = false; -int work_mem = 1024; -double hash_mem_multiplier = 1.0; -int maintenance_work_mem = 16384; -int max_parallel_maintenance_workers = 2; +__thread bool enableFsync = true; +__thread bool allowSystemTableMods = false; +__thread int work_mem = 1024; +__thread double hash_mem_multiplier = 1.0; +__thread int maintenance_work_mem = 16384; +__thread int max_parallel_maintenance_workers = 2; /* * Primary determinants of sizes of shared-memory structures. @@ -129,23 +129,23 @@ int max_parallel_maintenance_workers = 2; * MaxBackends is computed by PostmasterMain after modules have had a chance to * register background workers. */ -int NBuffers = 1000; -int MaxConnections = 90; -int max_worker_processes = 8; -int max_parallel_workers = 8; -int MaxBackends = 0; - -int VacuumCostPageHit = 1; /* GUC parameters for vacuum */ -int VacuumCostPageMiss = 10; -int VacuumCostPageDirty = 20; -int VacuumCostLimit = 200; -double VacuumCostDelay = 0; - -int64 VacuumPageHit = 0; -int64 VacuumPageMiss = 0; -int64 VacuumPageDirty = 0; - -int VacuumCostBalance = 0; /* working state for vacuum */ -bool VacuumCostActive = false; - -double vacuum_cleanup_index_scale_factor; +__thread int NBuffers = 1000; +__thread int MaxConnections = 90; +__thread int max_worker_processes = 8; +__thread int max_parallel_workers = 8; +__thread int MaxBackends = 0; + +__thread int VacuumCostPageHit = 1; /* GUC parameters for vacuum */ +__thread int VacuumCostPageMiss = 10; +__thread int VacuumCostPageDirty = 20; +__thread int VacuumCostLimit = 200; +__thread double VacuumCostDelay = 0; + +__thread int64 VacuumPageHit = 0; +__thread int64 VacuumPageMiss = 0; +__thread int64 VacuumPageDirty = 0; + +__thread int VacuumCostBalance = 0; /* working state for vacuum */ +__thread bool VacuumCostActive = false; + +__thread double vacuum_cleanup_index_scale_factor; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/init/miscinit.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/init/miscinit.c index cca9704d2d..d3d6f923d7 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/init/miscinit.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/init/miscinit.c @@ -55,14 +55,14 @@ #define DIRECTORY_LOCK_FILE "postmaster.pid" -ProcessingMode Mode = InitProcessing; +__thread ProcessingMode Mode = InitProcessing; -BackendType MyBackendType; +__thread BackendType MyBackendType; /* List of lock files to be removed at proc exit */ static List *lock_files = NIL; -static Latch LocalLatchData; +static __thread Latch LocalLatchData; /* ---------------------------------------------------------------- * ignoring system indexes support stuff @@ -74,7 +74,7 @@ static Latch LocalLatchData; * ---------------------------------------------------------------- */ -bool IgnoreSystemIndexes = false; +__thread bool IgnoreSystemIndexes = false; /* ---------------------------------------------------------------- @@ -425,19 +425,19 @@ ChangeToDataDir(void) * convenient way to do it. * ---------------------------------------------------------------- */ -static Oid AuthenticatedUserId = InvalidOid; -static Oid SessionUserId = InvalidOid; -static Oid OuterUserId = InvalidOid; -static Oid CurrentUserId = InvalidOid; +static __thread Oid AuthenticatedUserId = InvalidOid; +static __thread Oid SessionUserId = InvalidOid; +static __thread Oid OuterUserId = InvalidOid; +static __thread Oid CurrentUserId = InvalidOid; /* We also have to remember the superuser state of some of these levels */ -static bool AuthenticatedUserIsSuperuser = false; -static bool SessionUserIsSuperuser = false; +static __thread bool AuthenticatedUserIsSuperuser = false; +static __thread bool SessionUserIsSuperuser = false; -static int SecurityRestrictionContext = 0; +static __thread int SecurityRestrictionContext = 0; /* We also remember if a SET ROLE is currently active */ -static bool SetRoleIsActive = false; +static __thread bool SetRoleIsActive = false; /* * GetUserId - get the current effective user ID. @@ -1565,7 +1565,7 @@ char *shared_preload_libraries_string = NULL; char *local_preload_libraries_string = NULL; /* Flag telling that we are loading shared_preload_libraries */ -bool process_shared_preload_libraries_in_progress = false; +__thread bool process_shared_preload_libraries_in_progress = false; /* * load the shared libraries listed in 'libraries' diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/mb/mbutils.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/mb/mbutils.c index a8e13cacfd..b367f4540d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/mb/mbutils.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/mb/mbutils.c @@ -87,8 +87,8 @@ static const pg_enc2name *MessageEncoding = &pg_enc2name_tbl[PG_SQL_ASCII]; * encoding yet either. So SetClientEncoding() just accepts anything and * remembers it for InitializeClientEncoding() to apply later. */ -static bool backend_startup_complete = false; -static int pending_client_encoding = PG_SQL_ASCII; +static __thread bool backend_startup_complete = false; +static __thread int pending_client_encoding = PG_SQL_ASCII; /* Internal functions */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/guc-file.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/guc-file.c index 0cea86f7cb..efcf38da2d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/guc-file.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/guc-file.c @@ -506,9 +506,9 @@ struct yy_buffer_state #endif /* !YY_STRUCT_YY_BUFFER_STATE */ /* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ +static __thread size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static __thread size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static __thread YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -525,19 +525,19 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static __thread char yy_hold_char; +static __thread int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = NULL; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static __thread int yy_init = 0; /* whether we need to initialize */ +static __thread int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ -static int yy_did_buffer_switch_on_eof; +static __thread int yy_did_buffer_switch_on_eof; void yyrestart ( FILE *input_file ); void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); @@ -731,7 +731,7 @@ static const flex_int16_t yy_chk[168] = 40, 40, 40, 40, 40, 40, 40 } ; -static yy_state_type yy_last_accepting_state; +static __thread yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; extern int yy_flex_debug; @@ -789,7 +789,7 @@ enum GUC_ERROR = 100 }; -static unsigned int ConfigFileLineno; +static __thread unsigned int ConfigFileLineno; static const char *GUC_flex_fatal_errmsg; static sigjmp_buf *GUC_flex_fatal_jmp; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/guc.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/guc.c index f7a3297161..067da2c7ff 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/guc.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/guc.c @@ -119,14 +119,14 @@ #define REALTYPE_PRECISION 17 /* XXX these should appear in other modules' header files */ -extern bool Log_disconnections; -extern int CommitDelay; -extern int CommitSiblings; +extern __thread bool Log_disconnections; +extern __thread int CommitDelay; +extern __thread int CommitSiblings; extern char *default_tablespace; extern char *temp_tablespaces; -extern bool ignore_checksum_failure; -extern bool ignore_invalid_pages; -extern bool synchronize_seqscans; +extern __thread bool ignore_checksum_failure; +extern __thread bool ignore_invalid_pages; +extern __thread bool synchronize_seqscans; #ifdef TRACE_SYNCSCAN extern bool trace_syncscan; @@ -135,7 +135,7 @@ extern bool trace_syncscan; extern bool optimize_bounded_sort; #endif -static int GUC_check_errcode_value; +static __thread int GUC_check_errcode_value; /* global variables for check hook support */ char *GUC_check_errmsg_string; @@ -165,9 +165,9 @@ static bool check_wal_consistency_checking(char **newval, void **extra, static void assign_wal_consistency_checking(const char *newval, void *extra); #ifdef HAVE_SYSLOG -static int syslog_facility = LOG_LOCAL0; +static __thread int syslog_facility = LOG_LOCAL0; #else -static int syslog_facility = 0; +static __thread int syslog_facility = 0; #endif static void assign_syslog_facility(int newval, void *extra); @@ -515,47 +515,47 @@ extern const struct config_enum_entry dynamic_shared_memory_options[]; /* * GUC option variables that are exported from this module */ -bool log_duration = false; -bool Debug_print_plan = false; -bool Debug_print_parse = false; -bool Debug_print_rewritten = false; -bool Debug_pretty_print = true; - -bool log_parser_stats = false; -bool log_planner_stats = false; -bool log_executor_stats = false; -bool log_statement_stats = false; /* this is sort of all three above +__thread bool log_duration = false; +__thread bool Debug_print_plan = false; +__thread bool Debug_print_parse = false; +__thread bool Debug_print_rewritten = false; +__thread bool Debug_pretty_print = true; + +__thread bool log_parser_stats = false; +__thread bool log_planner_stats = false; +__thread bool log_executor_stats = false; +__thread bool log_statement_stats = false; /* this is sort of all three above * together */ -bool log_btree_build_stats = false; +__thread bool log_btree_build_stats = false; char *event_source; -bool row_security; -bool check_function_bodies = true; +__thread bool row_security; +__thread bool check_function_bodies = true; /* * This GUC exists solely for backward compatibility, check its definition for * details. */ -bool default_with_oids = false; -bool session_auth_is_superuser; - -int log_min_error_statement = ERROR; -int log_min_messages = WARNING; -int client_min_messages = NOTICE; -int log_min_duration_sample = -1; -int log_min_duration_statement = -1; -int log_parameter_max_length = -1; -int log_parameter_max_length_on_error = 0; -int log_temp_files = -1; -double log_statement_sample_rate = 1.0; -double log_xact_sample_rate = 0; -int trace_recovery_messages = LOG; +__thread bool default_with_oids = false; +__thread bool session_auth_is_superuser; + +__thread int log_min_error_statement = ERROR; +__thread int log_min_messages = WARNING; +__thread int client_min_messages = NOTICE; +__thread int log_min_duration_sample = -1; +__thread int log_min_duration_statement = -1; +__thread int log_parameter_max_length = -1; +__thread int log_parameter_max_length_on_error = 0; +__thread int log_temp_files = -1; +__thread double log_statement_sample_rate = 1.0; +__thread double log_xact_sample_rate = 0; +__thread int trace_recovery_messages = LOG; char *backtrace_functions; char *backtrace_symbol_list; -int temp_file_limit = -1; +__thread int temp_file_limit = -1; -int num_temp_buffers = 1024; +__thread int num_temp_buffers = 1024; char *cluster_name = ""; char *ConfigFileName; @@ -567,10 +567,10 @@ char *pgstat_temp_directory; char *application_name; -int tcp_keepalives_idle; -int tcp_keepalives_interval; -int tcp_keepalives_count; -int tcp_user_timeout; +__thread int tcp_keepalives_idle; +__thread int tcp_keepalives_interval; +__thread int tcp_keepalives_count; +__thread int tcp_user_timeout; /* * SSL renegotiation was been removed in PostgreSQL 9.5, but we tolerate it @@ -578,13 +578,13 @@ int tcp_user_timeout; * This avoids breaking compatibility with clients that have never supported * renegotiation and therefore always try to zero it. */ -int ssl_renegotiation_limit; +__thread int ssl_renegotiation_limit; /* * This really belongs in pg_shmem.c, but is defined here so that it doesn't * need to be duplicated in all the different implementations of pg_shmem.c. */ -int huge_pages; +__thread int huge_pages; /* * These variables are all dummies that don't do anything, except in some @@ -592,28 +592,28 @@ int huge_pages; * and is kept in sync by assign_hooks. */ static char *syslog_ident_str; -static double phony_random_seed; +static __thread double phony_random_seed; static char *client_encoding_string; static char *datestyle_string; static char *locale_collate; static char *locale_ctype; static char *server_encoding_string; static char *server_version_string; -static int server_version_num; +static __thread int server_version_num; static char *timezone_string; static char *log_timezone_string; static char *timezone_abbreviations_string; static char *data_directory; static char *session_authorization_string; -static int max_function_args; -static int max_index_keys; -static int max_identifier_length; -static int block_size; -static int segment_size; -static int wal_block_size; -static bool data_checksums; -static bool integer_datetimes; -static bool assert_enabled; +static __thread int max_function_args; +static __thread int max_index_keys; +static __thread int max_identifier_length; +static __thread int block_size; +static __thread int segment_size; +static __thread int wal_block_size; +static __thread bool data_checksums; +static __thread bool integer_datetimes; +static __thread bool assert_enabled; static char *recovery_target_timeline_string; static char *recovery_target_string; static char *recovery_target_xid_string; @@ -931,3845 +931,26 @@ static const unit_conversion time_unit_conversion_table[] = static struct config_bool ConfigureNamesBool[] = { - { - {"enable_seqscan", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables the planner's use of sequential-scan plans."), - NULL, - GUC_EXPLAIN - }, - &enable_seqscan, - true, - NULL, NULL, NULL - }, - { - {"enable_indexscan", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables the planner's use of index-scan plans."), - NULL, - GUC_EXPLAIN - }, - &enable_indexscan, - true, - NULL, NULL, NULL - }, - { - {"enable_indexonlyscan", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables the planner's use of index-only-scan plans."), - NULL, - GUC_EXPLAIN - }, - &enable_indexonlyscan, - true, - NULL, NULL, NULL - }, - { - {"enable_bitmapscan", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables the planner's use of bitmap-scan plans."), - NULL, - GUC_EXPLAIN - }, - &enable_bitmapscan, - true, - NULL, NULL, NULL - }, - { - {"enable_tidscan", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables the planner's use of TID scan plans."), - NULL, - GUC_EXPLAIN - }, - &enable_tidscan, - true, - NULL, NULL, NULL - }, - { - {"enable_sort", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables the planner's use of explicit sort steps."), - NULL, - GUC_EXPLAIN - }, - &enable_sort, - true, - NULL, NULL, NULL - }, - { - {"enable_incremental_sort", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables the planner's use of incremental sort steps."), - NULL - }, - &enable_incremental_sort, - true, - NULL, NULL, NULL - }, - { - {"enable_hashagg", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables the planner's use of hashed aggregation plans."), - NULL, - GUC_EXPLAIN - }, - &enable_hashagg, - true, - NULL, NULL, NULL - }, - { - {"enable_material", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables the planner's use of materialization."), - NULL, - GUC_EXPLAIN - }, - &enable_material, - true, - NULL, NULL, NULL - }, - { - {"enable_nestloop", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables the planner's use of nested-loop join plans."), - NULL, - GUC_EXPLAIN - }, - &enable_nestloop, - true, - NULL, NULL, NULL - }, - { - {"enable_mergejoin", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables the planner's use of merge join plans."), - NULL, - GUC_EXPLAIN - }, - &enable_mergejoin, - true, - NULL, NULL, NULL - }, - { - {"enable_hashjoin", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables the planner's use of hash join plans."), - NULL, - GUC_EXPLAIN - }, - &enable_hashjoin, - true, - NULL, NULL, NULL - }, - { - {"enable_gathermerge", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables the planner's use of gather merge plans."), - NULL, - GUC_EXPLAIN - }, - &enable_gathermerge, - true, - NULL, NULL, NULL - }, - { - {"enable_partitionwise_join", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables partitionwise join."), - NULL, - GUC_EXPLAIN - }, - &enable_partitionwise_join, - false, - NULL, NULL, NULL - }, - { - {"enable_partitionwise_aggregate", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables partitionwise aggregation and grouping."), - NULL, - GUC_EXPLAIN - }, - &enable_partitionwise_aggregate, - false, - NULL, NULL, NULL - }, - { - {"enable_parallel_append", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables the planner's use of parallel append plans."), - NULL, - GUC_EXPLAIN - }, - &enable_parallel_append, - true, - NULL, NULL, NULL - }, - { - {"enable_parallel_hash", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables the planner's use of parallel hash plans."), - NULL, - GUC_EXPLAIN - }, - &enable_parallel_hash, - true, - NULL, NULL, NULL - }, - { - {"enable_partition_pruning", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enables plan-time and run-time partition pruning."), - gettext_noop("Allows the query planner and executor to compare partition " - "bounds to conditions in the query to determine which " - "partitions must be scanned."), - GUC_EXPLAIN - }, - &enable_partition_pruning, - true, - NULL, NULL, NULL - }, - { - {"geqo", PGC_USERSET, QUERY_TUNING_GEQO, - gettext_noop("Enables genetic query optimization."), - gettext_noop("This algorithm attempts to do planning without " - "exhaustive searching."), - GUC_EXPLAIN - }, - &enable_geqo, - true, - NULL, NULL, NULL - }, - { - /* Not for general use --- used by SET SESSION AUTHORIZATION */ - {"is_superuser", PGC_INTERNAL, UNGROUPED, - gettext_noop("Shows whether the current user is a superuser."), - NULL, - GUC_REPORT | GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &session_auth_is_superuser, - false, - NULL, NULL, NULL - }, - { - {"bonjour", PGC_POSTMASTER, CONN_AUTH_SETTINGS, - gettext_noop("Enables advertising the server via Bonjour."), - NULL - }, - &enable_bonjour, - false, - check_bonjour, NULL, NULL - }, - { - {"track_commit_timestamp", PGC_POSTMASTER, REPLICATION, - gettext_noop("Collects transaction commit time."), - NULL - }, - &track_commit_timestamp, - false, - NULL, NULL, NULL - }, - { - {"ssl", PGC_SIGHUP, CONN_AUTH_SSL, - gettext_noop("Enables SSL connections."), - NULL - }, - &EnableSSL, - false, - check_ssl, NULL, NULL - }, - { - {"ssl_passphrase_command_supports_reload", PGC_SIGHUP, CONN_AUTH_SSL, - gettext_noop("Also use ssl_passphrase_command during server reload."), - NULL - }, - &ssl_passphrase_command_supports_reload, - false, - NULL, NULL, NULL - }, - { - {"ssl_prefer_server_ciphers", PGC_SIGHUP, CONN_AUTH_SSL, - gettext_noop("Give priority to server ciphersuite order."), - NULL - }, - &SSLPreferServerCiphers, - true, - NULL, NULL, NULL - }, - { - {"fsync", PGC_SIGHUP, WAL_SETTINGS, - gettext_noop("Forces synchronization of updates to disk."), - gettext_noop("The server will use the fsync() system call in several places to make " - "sure that updates are physically written to disk. This insures " - "that a database cluster will recover to a consistent state after " - "an operating system or hardware crash.") - }, - &enableFsync, - true, - NULL, NULL, NULL - }, - { - {"ignore_checksum_failure", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("Continues processing after a checksum failure."), - gettext_noop("Detection of a checksum failure normally causes PostgreSQL to " - "report an error, aborting the current transaction. Setting " - "ignore_checksum_failure to true causes the system to ignore the failure " - "(but still report a warning), and continue processing. This " - "behavior could cause crashes or other serious problems. Only " - "has an effect if checksums are enabled."), - GUC_NOT_IN_SAMPLE - }, - &ignore_checksum_failure, - false, - NULL, NULL, NULL - }, - { - {"zero_damaged_pages", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("Continues processing past damaged page headers."), - gettext_noop("Detection of a damaged page header normally causes PostgreSQL to " - "report an error, aborting the current transaction. Setting " - "zero_damaged_pages to true causes the system to instead report a " - "warning, zero out the damaged page, and continue processing. This " - "behavior will destroy data, namely all the rows on the damaged page."), - GUC_NOT_IN_SAMPLE - }, - &zero_damaged_pages, - false, - NULL, NULL, NULL - }, - { - {"ignore_invalid_pages", PGC_POSTMASTER, DEVELOPER_OPTIONS, - gettext_noop("Continues recovery after an invalid pages failure."), - gettext_noop("Detection of WAL records having references to " - "invalid pages during recovery causes PostgreSQL to " - "raise a PANIC-level error, aborting the recovery. " - "Setting ignore_invalid_pages to true causes " - "the system to ignore invalid page references " - "in WAL records (but still report a warning), " - "and continue recovery. This behavior may cause " - "crashes, data loss, propagate or hide corruption, " - "or other serious problems. Only has an effect " - "during recovery or in standby mode."), - GUC_NOT_IN_SAMPLE - }, - &ignore_invalid_pages, - false, - NULL, NULL, NULL - }, - { - {"full_page_writes", PGC_SIGHUP, WAL_SETTINGS, - gettext_noop("Writes full pages to WAL when first modified after a checkpoint."), - gettext_noop("A page write in process during an operating system crash might be " - "only partially written to disk. During recovery, the row changes " - "stored in WAL are not enough to recover. This option writes " - "pages when first modified after a checkpoint to WAL so full recovery " - "is possible.") - }, - &fullPageWrites, - true, - NULL, NULL, NULL - }, - - { - {"wal_log_hints", PGC_POSTMASTER, WAL_SETTINGS, - gettext_noop("Writes full pages to WAL when first modified after a checkpoint, even for a non-critical modification."), - NULL - }, - &wal_log_hints, - false, - NULL, NULL, NULL - }, - - { - {"wal_compression", PGC_SUSET, WAL_SETTINGS, - gettext_noop("Compresses full-page writes written in WAL file."), - NULL - }, - &wal_compression, - false, - NULL, NULL, NULL - }, - - { - {"wal_init_zero", PGC_SUSET, WAL_SETTINGS, - gettext_noop("Writes zeroes to new WAL files before first use."), - NULL - }, - &wal_init_zero, - true, - NULL, NULL, NULL - }, - - { - {"wal_recycle", PGC_SUSET, WAL_SETTINGS, - gettext_noop("Recycles WAL files by renaming them."), - NULL - }, - &wal_recycle, - true, - NULL, NULL, NULL - }, - - { - {"log_checkpoints", PGC_SIGHUP, LOGGING_WHAT, - gettext_noop("Logs each checkpoint."), - NULL - }, - &log_checkpoints, - false, - NULL, NULL, NULL - }, - { - {"log_connections", PGC_SU_BACKEND, LOGGING_WHAT, - gettext_noop("Logs each successful connection."), - NULL - }, - &Log_connections, - false, - NULL, NULL, NULL - }, - { - {"log_disconnections", PGC_SU_BACKEND, LOGGING_WHAT, - gettext_noop("Logs end of a session, including duration."), - NULL - }, - &Log_disconnections, - false, - NULL, NULL, NULL - }, - { - {"log_replication_commands", PGC_SUSET, LOGGING_WHAT, - gettext_noop("Logs each replication command."), - NULL - }, - &log_replication_commands, - false, - NULL, NULL, NULL - }, - { - {"debug_assertions", PGC_INTERNAL, PRESET_OPTIONS, - gettext_noop("Shows whether the running server has assertion checks enabled."), - NULL, - GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &assert_enabled, -#ifdef USE_ASSERT_CHECKING - true, -#else - false, -#endif - NULL, NULL, NULL - }, - - { - {"exit_on_error", PGC_USERSET, ERROR_HANDLING_OPTIONS, - gettext_noop("Terminate session on any error."), - NULL - }, - &ExitOnAnyError, - false, - NULL, NULL, NULL - }, - { - {"restart_after_crash", PGC_SIGHUP, ERROR_HANDLING_OPTIONS, - gettext_noop("Reinitialize server after backend crash."), - NULL - }, - &restart_after_crash, - true, - NULL, NULL, NULL - }, - - { - {"log_duration", PGC_SUSET, LOGGING_WHAT, - gettext_noop("Logs the duration of each completed SQL statement."), - NULL - }, - &log_duration, - false, - NULL, NULL, NULL - }, - { - {"debug_print_parse", PGC_USERSET, LOGGING_WHAT, - gettext_noop("Logs each query's parse tree."), - NULL - }, - &Debug_print_parse, - false, - NULL, NULL, NULL - }, - { - {"debug_print_rewritten", PGC_USERSET, LOGGING_WHAT, - gettext_noop("Logs each query's rewritten parse tree."), - NULL - }, - &Debug_print_rewritten, - false, - NULL, NULL, NULL - }, - { - {"debug_print_plan", PGC_USERSET, LOGGING_WHAT, - gettext_noop("Logs each query's execution plan."), - NULL - }, - &Debug_print_plan, - false, - NULL, NULL, NULL - }, - { - {"debug_pretty_print", PGC_USERSET, LOGGING_WHAT, - gettext_noop("Indents parse and plan tree displays."), - NULL - }, - &Debug_pretty_print, - true, - NULL, NULL, NULL - }, - { - {"log_parser_stats", PGC_SUSET, STATS_MONITORING, - gettext_noop("Writes parser performance statistics to the server log."), - NULL - }, - &log_parser_stats, - false, - check_stage_log_stats, NULL, NULL - }, - { - {"log_planner_stats", PGC_SUSET, STATS_MONITORING, - gettext_noop("Writes planner performance statistics to the server log."), - NULL - }, - &log_planner_stats, - false, - check_stage_log_stats, NULL, NULL - }, - { - {"log_executor_stats", PGC_SUSET, STATS_MONITORING, - gettext_noop("Writes executor performance statistics to the server log."), - NULL - }, - &log_executor_stats, - false, - check_stage_log_stats, NULL, NULL - }, - { - {"log_statement_stats", PGC_SUSET, STATS_MONITORING, - gettext_noop("Writes cumulative performance statistics to the server log."), - NULL - }, - &log_statement_stats, - false, - check_log_stats, NULL, NULL - }, -#ifdef BTREE_BUILD_STATS - { - {"log_btree_build_stats", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("Logs system resource usage statistics (memory and CPU) on various B-tree operations."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &log_btree_build_stats, - false, - NULL, NULL, NULL - }, -#endif - - { - {"track_activities", PGC_SUSET, STATS_COLLECTOR, - gettext_noop("Collects information about executing commands."), - gettext_noop("Enables the collection of information on the currently " - "executing command of each session, along with " - "the time at which that command began execution.") - }, - &pgstat_track_activities, - true, - NULL, NULL, NULL - }, - { - {"track_counts", PGC_SUSET, STATS_COLLECTOR, - gettext_noop("Collects statistics on database activity."), - NULL - }, - &pgstat_track_counts, - true, - NULL, NULL, NULL - }, - { - {"track_io_timing", PGC_SUSET, STATS_COLLECTOR, - gettext_noop("Collects timing statistics for database I/O activity."), - NULL - }, - &track_io_timing, - false, - NULL, NULL, NULL - }, - - { - {"update_process_title", PGC_SUSET, PROCESS_TITLE, - gettext_noop("Updates the process title to show the active SQL command."), - gettext_noop("Enables updating of the process title every time a new SQL command is received by the server.") - }, - &update_process_title, -#ifdef WIN32 - false, -#else - true, -#endif - NULL, NULL, NULL - }, - - { - {"autovacuum", PGC_SIGHUP, AUTOVACUUM, - gettext_noop("Starts the autovacuum subprocess."), - NULL - }, - &autovacuum_start_daemon, - true, - NULL, NULL, NULL - }, - - { - {"trace_notify", PGC_USERSET, DEVELOPER_OPTIONS, - gettext_noop("Generates debugging output for LISTEN and NOTIFY."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &Trace_notify, - false, - NULL, NULL, NULL - }, - -#ifdef LOCK_DEBUG - { - {"trace_locks", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("Emits information about lock usage."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &Trace_locks, - false, - NULL, NULL, NULL - }, - { - {"trace_userlocks", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("Emits information about user lock usage."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &Trace_userlocks, - false, - NULL, NULL, NULL - }, - { - {"trace_lwlocks", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("Emits information about lightweight lock usage."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &Trace_lwlocks, - false, - NULL, NULL, NULL - }, - { - {"debug_deadlocks", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("Dumps information about all current locks when a deadlock timeout occurs."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &Debug_deadlocks, - false, - NULL, NULL, NULL - }, -#endif - - { - {"log_lock_waits", PGC_SUSET, LOGGING_WHAT, - gettext_noop("Logs long lock waits."), - NULL - }, - &log_lock_waits, - false, - NULL, NULL, NULL - }, - - { - {"log_hostname", PGC_SIGHUP, LOGGING_WHAT, - gettext_noop("Logs the host name in the connection logs."), - gettext_noop("By default, connection logs only show the IP address " - "of the connecting host. If you want them to show the host name you " - "can turn this on, but depending on your host name resolution " - "setup it might impose a non-negligible performance penalty.") - }, - &log_hostname, - false, - NULL, NULL, NULL - }, - { - {"transform_null_equals", PGC_USERSET, COMPAT_OPTIONS_CLIENT, - gettext_noop("Treats \"expr=NULL\" as \"expr IS NULL\"."), - gettext_noop("When turned on, expressions of the form expr = NULL " - "(or NULL = expr) are treated as expr IS NULL, that is, they " - "return true if expr evaluates to the null value, and false " - "otherwise. The correct behavior of expr = NULL is to always " - "return null (unknown).") - }, - &Transform_null_equals, - false, - NULL, NULL, NULL - }, - { - {"db_user_namespace", PGC_SIGHUP, CONN_AUTH_AUTH, - gettext_noop("Enables per-database user names."), - NULL - }, - &Db_user_namespace, - false, - NULL, NULL, NULL - }, - { - {"default_transaction_read_only", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the default read-only status of new transactions."), - NULL - }, - &DefaultXactReadOnly, - false, - NULL, NULL, NULL - }, - { - {"transaction_read_only", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the current transaction's read-only status."), - NULL, - GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &XactReadOnly, - false, - check_transaction_read_only, NULL, NULL - }, - { - {"default_transaction_deferrable", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the default deferrable status of new transactions."), - NULL - }, - &DefaultXactDeferrable, - false, - NULL, NULL, NULL - }, - { - {"transaction_deferrable", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Whether to defer a read-only serializable transaction until it can be executed with no possible serialization failures."), - NULL, - GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &XactDeferrable, - false, - check_transaction_deferrable, NULL, NULL - }, - { - {"row_security", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Enable row security."), - gettext_noop("When enabled, row security will be applied to all users.") - }, - &row_security, - true, - NULL, NULL, NULL - }, - { - {"check_function_bodies", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Check function bodies during CREATE FUNCTION."), - NULL - }, - &check_function_bodies, - true, - NULL, NULL, NULL - }, - { - {"array_nulls", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS, - gettext_noop("Enable input of NULL elements in arrays."), - gettext_noop("When turned on, unquoted NULL in an array input " - "value means a null value; " - "otherwise it is taken literally.") - }, - &Array_nulls, - true, - NULL, NULL, NULL - }, - - /* - * WITH OIDS support, and consequently default_with_oids, was removed in - * PostgreSQL 12, but we tolerate the parameter being set to false to - * avoid unnecessarily breaking older dump files. - */ - { - {"default_with_oids", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS, - gettext_noop("WITH OIDS is no longer supported; this can only be false."), - NULL, - GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE - }, - &default_with_oids, - false, - check_default_with_oids, NULL, NULL - }, - { - {"logging_collector", PGC_POSTMASTER, LOGGING_WHERE, - gettext_noop("Start a subprocess to capture stderr output and/or csvlogs into log files."), - NULL - }, - &Logging_collector, - false, - NULL, NULL, NULL - }, - { - {"log_truncate_on_rotation", PGC_SIGHUP, LOGGING_WHERE, - gettext_noop("Truncate existing log files of same name during log rotation."), - NULL - }, - &Log_truncate_on_rotation, - false, - NULL, NULL, NULL - }, - -#ifdef TRACE_SORT - { - {"trace_sort", PGC_USERSET, DEVELOPER_OPTIONS, - gettext_noop("Emit information about resource usage in sorting."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &trace_sort, - false, - NULL, NULL, NULL - }, -#endif - -#ifdef TRACE_SYNCSCAN - /* this is undocumented because not exposed in a standard build */ - { - {"trace_syncscan", PGC_USERSET, DEVELOPER_OPTIONS, - gettext_noop("Generate debugging output for synchronized scanning."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &trace_syncscan, - false, - NULL, NULL, NULL - }, -#endif - -#ifdef DEBUG_BOUNDED_SORT - /* this is undocumented because not exposed in a standard build */ - { - { - "optimize_bounded_sort", PGC_USERSET, QUERY_TUNING_METHOD, - gettext_noop("Enable bounded sorting using heap sort."), - NULL, - GUC_NOT_IN_SAMPLE | GUC_EXPLAIN - }, - &optimize_bounded_sort, - true, - NULL, NULL, NULL - }, -#endif - -#ifdef WAL_DEBUG - { - {"wal_debug", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("Emit WAL-related debugging output."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &XLOG_DEBUG, - false, - NULL, NULL, NULL - }, -#endif - - { - {"integer_datetimes", PGC_INTERNAL, PRESET_OPTIONS, - gettext_noop("Datetimes are integer based."), - NULL, - GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &integer_datetimes, - true, - NULL, NULL, NULL - }, - - { - {"krb_caseins_users", PGC_SIGHUP, CONN_AUTH_AUTH, - gettext_noop("Sets whether Kerberos and GSSAPI user names should be treated as case-insensitive."), - NULL - }, - &pg_krb_caseins_users, - false, - NULL, NULL, NULL - }, - - { - {"escape_string_warning", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS, - gettext_noop("Warn about backslash escapes in ordinary string literals."), - NULL - }, - &escape_string_warning, - true, - NULL, NULL, NULL - }, - - { - {"standard_conforming_strings", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS, - gettext_noop("Causes '...' strings to treat backslashes literally."), - NULL, - GUC_REPORT - }, - &standard_conforming_strings, - true, - NULL, NULL, NULL - }, - - { - {"synchronize_seqscans", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS, - gettext_noop("Enable synchronized sequential scans."), - NULL - }, - &synchronize_seqscans, - true, - NULL, NULL, NULL - }, - - { - {"recovery_target_inclusive", PGC_POSTMASTER, WAL_RECOVERY_TARGET, - gettext_noop("Sets whether to include or exclude transaction with recovery target."), - NULL - }, - &recoveryTargetInclusive, - true, - NULL, NULL, NULL - }, - - { - {"hot_standby", PGC_POSTMASTER, REPLICATION_STANDBY, - gettext_noop("Allows connections and queries during recovery."), - NULL - }, - &EnableHotStandby, - true, - NULL, NULL, NULL - }, - - { - {"hot_standby_feedback", PGC_SIGHUP, REPLICATION_STANDBY, - gettext_noop("Allows feedback from a hot standby to the primary that will avoid query conflicts."), - NULL - }, - &hot_standby_feedback, - false, - NULL, NULL, NULL - }, - - { - {"allow_system_table_mods", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("Allows modifications of the structure of system tables."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &allowSystemTableMods, - false, - NULL, NULL, NULL - }, - - { - {"ignore_system_indexes", PGC_BACKEND, DEVELOPER_OPTIONS, - gettext_noop("Disables reading from system indexes."), - gettext_noop("It does not prevent updating the indexes, so it is safe " - "to use. The worst consequence is slowness."), - GUC_NOT_IN_SAMPLE - }, - &IgnoreSystemIndexes, - false, - NULL, NULL, NULL - }, - - { - {"lo_compat_privileges", PGC_SUSET, COMPAT_OPTIONS_PREVIOUS, - gettext_noop("Enables backward compatibility mode for privilege checks on large objects."), - gettext_noop("Skips privilege checks when reading or modifying large objects, " - "for compatibility with PostgreSQL releases prior to 9.0.") - }, - &lo_compat_privileges, - false, - NULL, NULL, NULL - }, - - { - {"operator_precedence_warning", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS, - gettext_noop("Emit a warning for constructs that changed meaning since PostgreSQL 9.4."), - NULL, - }, - &operator_precedence_warning, - false, - NULL, NULL, NULL - }, - - { - {"quote_all_identifiers", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS, - gettext_noop("When generating SQL fragments, quote all identifiers."), - NULL, - }, - "e_all_identifiers, - false, - NULL, NULL, NULL - }, - - { - {"data_checksums", PGC_INTERNAL, PRESET_OPTIONS, - gettext_noop("Shows whether data checksums are turned on for this cluster."), - NULL, - GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &data_checksums, - false, - NULL, NULL, NULL - }, - - { - {"syslog_sequence_numbers", PGC_SIGHUP, LOGGING_WHERE, - gettext_noop("Add sequence number to syslog messages to avoid duplicate suppression."), - NULL - }, - &syslog_sequence_numbers, - true, - NULL, NULL, NULL - }, - - { - {"syslog_split_messages", PGC_SIGHUP, LOGGING_WHERE, - gettext_noop("Split messages sent to syslog by lines and to fit into 1024 bytes."), - NULL - }, - &syslog_split_messages, - true, - NULL, NULL, NULL - }, - - { - {"parallel_leader_participation", PGC_USERSET, RESOURCES_ASYNCHRONOUS, - gettext_noop("Controls whether Gather and Gather Merge also run subplans."), - gettext_noop("Should gather nodes also run subplans, or just gather tuples?"), - GUC_EXPLAIN - }, - ¶llel_leader_participation, - true, - NULL, NULL, NULL - }, - - { - {"jit", PGC_USERSET, QUERY_TUNING_OTHER, - gettext_noop("Allow JIT compilation."), - NULL, - GUC_EXPLAIN - }, - &jit_enabled, - true, - NULL, NULL, NULL - }, - - { - {"jit_debugging_support", PGC_SU_BACKEND, DEVELOPER_OPTIONS, - gettext_noop("Register JIT compiled function with debugger."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &jit_debugging_support, - false, - - /* - * This is not guaranteed to be available, but given it's a developer - * oriented option, it doesn't seem worth adding code checking - * availability. - */ - NULL, NULL, NULL - }, - - { - {"jit_dump_bitcode", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("Write out LLVM bitcode to facilitate JIT debugging."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &jit_dump_bitcode, - false, - NULL, NULL, NULL - }, - - { - {"jit_expressions", PGC_USERSET, DEVELOPER_OPTIONS, - gettext_noop("Allow JIT compilation of expressions."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &jit_expressions, - true, - NULL, NULL, NULL - }, - - { - {"jit_profiling_support", PGC_SU_BACKEND, DEVELOPER_OPTIONS, - gettext_noop("Register JIT compiled function with perf profiler."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &jit_profiling_support, - false, - - /* - * This is not guaranteed to be available, but given it's a developer - * oriented option, it doesn't seem worth adding code checking - * availability. - */ - NULL, NULL, NULL - }, - - { - {"jit_tuple_deforming", PGC_USERSET, DEVELOPER_OPTIONS, - gettext_noop("Allow JIT compilation of tuple deforming."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &jit_tuple_deforming, - true, - NULL, NULL, NULL - }, - - { - {"data_sync_retry", PGC_POSTMASTER, ERROR_HANDLING_OPTIONS, - gettext_noop("Whether to continue running after a failure to sync data files."), - }, - &data_sync_retry, - false, - NULL, NULL, NULL - }, - - { - {"wal_receiver_create_temp_slot", PGC_SIGHUP, REPLICATION_STANDBY, - gettext_noop("Sets whether a WAL receiver should create a temporary replication slot if no permanent slot is configured."), - }, - &wal_receiver_create_temp_slot, - false, - NULL, NULL, NULL - }, - - /* End-of-list marker */ - { - {NULL, 0, 0, NULL, NULL}, NULL, false, NULL, NULL, NULL - } }; static struct config_int ConfigureNamesInt[] = { - { - {"archive_timeout", PGC_SIGHUP, WAL_ARCHIVING, - gettext_noop("Forces a switch to the next WAL file if a " - "new file has not been started within N seconds."), - NULL, - GUC_UNIT_S - }, - &XLogArchiveTimeout, - 0, 0, INT_MAX / 2, - NULL, NULL, NULL - }, - { - {"post_auth_delay", PGC_BACKEND, DEVELOPER_OPTIONS, - gettext_noop("Waits N seconds on connection startup after authentication."), - gettext_noop("This allows attaching a debugger to the process."), - GUC_NOT_IN_SAMPLE | GUC_UNIT_S - }, - &PostAuthDelay, - 0, 0, INT_MAX / 1000000, - NULL, NULL, NULL - }, - { - {"default_statistics_target", PGC_USERSET, QUERY_TUNING_OTHER, - gettext_noop("Sets the default statistics target."), - gettext_noop("This applies to table columns that have not had a " - "column-specific target set via ALTER TABLE SET STATISTICS.") - }, - &default_statistics_target, - 100, 1, 10000, - NULL, NULL, NULL - }, - { - {"from_collapse_limit", PGC_USERSET, QUERY_TUNING_OTHER, - gettext_noop("Sets the FROM-list size beyond which subqueries " - "are not collapsed."), - gettext_noop("The planner will merge subqueries into upper " - "queries if the resulting FROM list would have no more than " - "this many items."), - GUC_EXPLAIN - }, - &from_collapse_limit, - 8, 1, INT_MAX, - NULL, NULL, NULL - }, - { - {"join_collapse_limit", PGC_USERSET, QUERY_TUNING_OTHER, - gettext_noop("Sets the FROM-list size beyond which JOIN " - "constructs are not flattened."), - gettext_noop("The planner will flatten explicit JOIN " - "constructs into lists of FROM items whenever a " - "list of no more than this many items would result."), - GUC_EXPLAIN - }, - &join_collapse_limit, - 8, 1, INT_MAX, - NULL, NULL, NULL - }, - { - {"geqo_threshold", PGC_USERSET, QUERY_TUNING_GEQO, - gettext_noop("Sets the threshold of FROM items beyond which GEQO is used."), - NULL, - GUC_EXPLAIN - }, - &geqo_threshold, - 12, 2, INT_MAX, - NULL, NULL, NULL - }, - { - {"geqo_effort", PGC_USERSET, QUERY_TUNING_GEQO, - gettext_noop("GEQO: effort is used to set the default for other GEQO parameters."), - NULL, - GUC_EXPLAIN - }, - &Geqo_effort, - DEFAULT_GEQO_EFFORT, MIN_GEQO_EFFORT, MAX_GEQO_EFFORT, - NULL, NULL, NULL - }, - { - {"geqo_pool_size", PGC_USERSET, QUERY_TUNING_GEQO, - gettext_noop("GEQO: number of individuals in the population."), - gettext_noop("Zero selects a suitable default value."), - GUC_EXPLAIN - }, - &Geqo_pool_size, - 0, 0, INT_MAX, - NULL, NULL, NULL - }, - { - {"geqo_generations", PGC_USERSET, QUERY_TUNING_GEQO, - gettext_noop("GEQO: number of iterations of the algorithm."), - gettext_noop("Zero selects a suitable default value."), - GUC_EXPLAIN - }, - &Geqo_generations, - 0, 0, INT_MAX, - NULL, NULL, NULL - }, - - { - /* This is PGC_SUSET to prevent hiding from log_lock_waits. */ - {"deadlock_timeout", PGC_SUSET, LOCK_MANAGEMENT, - gettext_noop("Sets the time to wait on a lock before checking for deadlock."), - NULL, - GUC_UNIT_MS - }, - &DeadlockTimeout, - 1000, 1, INT_MAX, - NULL, NULL, NULL - }, - - { - {"max_standby_archive_delay", PGC_SIGHUP, REPLICATION_STANDBY, - gettext_noop("Sets the maximum delay before canceling queries when a hot standby server is processing archived WAL data."), - NULL, - GUC_UNIT_MS - }, - &max_standby_archive_delay, - 30 * 1000, -1, INT_MAX, - NULL, NULL, NULL - }, - - { - {"max_standby_streaming_delay", PGC_SIGHUP, REPLICATION_STANDBY, - gettext_noop("Sets the maximum delay before canceling queries when a hot standby server is processing streamed WAL data."), - NULL, - GUC_UNIT_MS - }, - &max_standby_streaming_delay, - 30 * 1000, -1, INT_MAX, - NULL, NULL, NULL - }, - - { - {"recovery_min_apply_delay", PGC_SIGHUP, REPLICATION_STANDBY, - gettext_noop("Sets the minimum delay for applying changes during recovery."), - NULL, - GUC_UNIT_MS - }, - &recovery_min_apply_delay, - 0, 0, INT_MAX, - NULL, NULL, NULL - }, - - { - {"wal_receiver_status_interval", PGC_SIGHUP, REPLICATION_STANDBY, - gettext_noop("Sets the maximum interval between WAL receiver status reports to the sending server."), - NULL, - GUC_UNIT_S - }, - &wal_receiver_status_interval, - 10, 0, INT_MAX / 1000, - NULL, NULL, NULL - }, - - { - {"wal_receiver_timeout", PGC_SIGHUP, REPLICATION_STANDBY, - gettext_noop("Sets the maximum wait time to receive data from the sending server."), - NULL, - GUC_UNIT_MS - }, - &wal_receiver_timeout, - 60 * 1000, 0, INT_MAX, - NULL, NULL, NULL - }, - - { - {"max_connections", PGC_POSTMASTER, CONN_AUTH_SETTINGS, - gettext_noop("Sets the maximum number of concurrent connections."), - NULL - }, - &MaxConnections, - 100, 1, MAX_BACKENDS, - check_maxconnections, NULL, NULL - }, - - { - /* see max_connections */ - {"superuser_reserved_connections", PGC_POSTMASTER, CONN_AUTH_SETTINGS, - gettext_noop("Sets the number of connection slots reserved for superusers."), - NULL - }, - &ReservedBackends, - 3, 0, MAX_BACKENDS, - NULL, NULL, NULL - }, - - /* - * We sometimes multiply the number of shared buffers by two without - * checking for overflow, so we mustn't allow more than INT_MAX / 2. - */ - { - {"shared_buffers", PGC_POSTMASTER, RESOURCES_MEM, - gettext_noop("Sets the number of shared memory buffers used by the server."), - NULL, - GUC_UNIT_BLOCKS - }, - &NBuffers, - 1024, 16, INT_MAX / 2, - NULL, NULL, NULL - }, - - { - {"temp_buffers", PGC_USERSET, RESOURCES_MEM, - gettext_noop("Sets the maximum number of temporary buffers used by each session."), - NULL, - GUC_UNIT_BLOCKS | GUC_EXPLAIN - }, - &num_temp_buffers, - 1024, 100, INT_MAX / 2, - check_temp_buffers, NULL, NULL - }, - - { - {"port", PGC_POSTMASTER, CONN_AUTH_SETTINGS, - gettext_noop("Sets the TCP port the server listens on."), - NULL - }, - &PostPortNumber, - DEF_PGPORT, 1, 65535, - NULL, NULL, NULL - }, - - { - {"unix_socket_permissions", PGC_POSTMASTER, CONN_AUTH_SETTINGS, - gettext_noop("Sets the access permissions of the Unix-domain socket."), - gettext_noop("Unix-domain sockets use the usual Unix file system " - "permission set. The parameter value is expected " - "to be a numeric mode specification in the form " - "accepted by the chmod and umask system calls. " - "(To use the customary octal format the number must " - "start with a 0 (zero).)") - }, - &Unix_socket_permissions, - 0777, 0000, 0777, - NULL, NULL, show_unix_socket_permissions - }, - - { - {"log_file_mode", PGC_SIGHUP, LOGGING_WHERE, - gettext_noop("Sets the file permissions for log files."), - gettext_noop("The parameter value is expected " - "to be a numeric mode specification in the form " - "accepted by the chmod and umask system calls. " - "(To use the customary octal format the number must " - "start with a 0 (zero).)") - }, - &Log_file_mode, - 0600, 0000, 0777, - NULL, NULL, show_log_file_mode - }, - - - { - {"data_directory_mode", PGC_INTERNAL, PRESET_OPTIONS, - gettext_noop("Mode of the data directory."), - gettext_noop("The parameter value is a numeric mode specification " - "in the form accepted by the chmod and umask system " - "calls. (To use the customary octal format the number " - "must start with a 0 (zero).)"), - GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &data_directory_mode, - 0700, 0000, 0777, - NULL, NULL, show_data_directory_mode - }, - - { - {"work_mem", PGC_USERSET, RESOURCES_MEM, - gettext_noop("Sets the maximum memory to be used for query workspaces."), - gettext_noop("This much memory can be used by each internal " - "sort operation and hash table before switching to " - "temporary disk files."), - GUC_UNIT_KB | GUC_EXPLAIN - }, - &work_mem, - 4096, 64, MAX_KILOBYTES, - NULL, NULL, NULL - }, - - { - {"maintenance_work_mem", PGC_USERSET, RESOURCES_MEM, - gettext_noop("Sets the maximum memory to be used for maintenance operations."), - gettext_noop("This includes operations such as VACUUM and CREATE INDEX."), - GUC_UNIT_KB - }, - &maintenance_work_mem, - 65536, 1024, MAX_KILOBYTES, - NULL, NULL, NULL - }, - - { - {"logical_decoding_work_mem", PGC_USERSET, RESOURCES_MEM, - gettext_noop("Sets the maximum memory to be used for logical decoding."), - gettext_noop("This much memory can be used by each internal " - "reorder buffer before spilling to disk."), - GUC_UNIT_KB - }, - &logical_decoding_work_mem, - 65536, 64, MAX_KILOBYTES, - NULL, NULL, NULL - }, - - /* - * We use the hopefully-safely-small value of 100kB as the compiled-in - * default for max_stack_depth. InitializeGUCOptions will increase it if - * possible, depending on the actual platform-specific stack limit. - */ - { - {"max_stack_depth", PGC_SUSET, RESOURCES_MEM, - gettext_noop("Sets the maximum stack depth, in kilobytes."), - NULL, - GUC_UNIT_KB - }, - &max_stack_depth, - 100, 100, MAX_KILOBYTES, - check_max_stack_depth, assign_max_stack_depth, NULL - }, - - { - {"temp_file_limit", PGC_SUSET, RESOURCES_DISK, - gettext_noop("Limits the total size of all temporary files used by each process."), - gettext_noop("-1 means no limit."), - GUC_UNIT_KB - }, - &temp_file_limit, - -1, -1, INT_MAX, - NULL, NULL, NULL - }, - - { - {"vacuum_cost_page_hit", PGC_USERSET, RESOURCES_VACUUM_DELAY, - gettext_noop("Vacuum cost for a page found in the buffer cache."), - NULL - }, - &VacuumCostPageHit, - 1, 0, 10000, - NULL, NULL, NULL - }, - - { - {"vacuum_cost_page_miss", PGC_USERSET, RESOURCES_VACUUM_DELAY, - gettext_noop("Vacuum cost for a page not found in the buffer cache."), - NULL - }, - &VacuumCostPageMiss, - 10, 0, 10000, - NULL, NULL, NULL - }, - - { - {"vacuum_cost_page_dirty", PGC_USERSET, RESOURCES_VACUUM_DELAY, - gettext_noop("Vacuum cost for a page dirtied by vacuum."), - NULL - }, - &VacuumCostPageDirty, - 20, 0, 10000, - NULL, NULL, NULL - }, - - { - {"vacuum_cost_limit", PGC_USERSET, RESOURCES_VACUUM_DELAY, - gettext_noop("Vacuum cost amount available before napping."), - NULL - }, - &VacuumCostLimit, - 200, 1, 10000, - NULL, NULL, NULL - }, - - { - {"autovacuum_vacuum_cost_limit", PGC_SIGHUP, AUTOVACUUM, - gettext_noop("Vacuum cost amount available before napping, for autovacuum."), - NULL - }, - &autovacuum_vac_cost_limit, - -1, -1, 10000, - NULL, NULL, NULL - }, - - { - {"max_files_per_process", PGC_POSTMASTER, RESOURCES_KERNEL, - gettext_noop("Sets the maximum number of simultaneously open files for each server process."), - NULL - }, - &max_files_per_process, - 1000, 64, INT_MAX, - NULL, NULL, NULL - }, - - /* - * See also CheckRequiredParameterValues() if this parameter changes - */ - { - {"max_prepared_transactions", PGC_POSTMASTER, RESOURCES_MEM, - gettext_noop("Sets the maximum number of simultaneously prepared transactions."), - NULL - }, - &max_prepared_xacts, - 0, 0, MAX_BACKENDS, - NULL, NULL, NULL - }, - -#ifdef LOCK_DEBUG - { - {"trace_lock_oidmin", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("Sets the minimum OID of tables for tracking locks."), - gettext_noop("Is used to avoid output on system tables."), - GUC_NOT_IN_SAMPLE - }, - &Trace_lock_oidmin, - FirstNormalObjectId, 0, INT_MAX, - NULL, NULL, NULL - }, - { - {"trace_lock_table", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("Sets the OID of the table with unconditionally lock tracing."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &Trace_lock_table, - 0, 0, INT_MAX, - NULL, NULL, NULL - }, -#endif - - { - {"statement_timeout", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the maximum allowed duration of any statement."), - gettext_noop("A value of 0 turns off the timeout."), - GUC_UNIT_MS - }, - &StatementTimeout, - 0, 0, INT_MAX, - NULL, NULL, NULL - }, - - { - {"lock_timeout", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the maximum allowed duration of any wait for a lock."), - gettext_noop("A value of 0 turns off the timeout."), - GUC_UNIT_MS - }, - &LockTimeout, - 0, 0, INT_MAX, - NULL, NULL, NULL - }, - - { - {"idle_in_transaction_session_timeout", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the maximum allowed duration of any idling transaction."), - gettext_noop("A value of 0 turns off the timeout."), - GUC_UNIT_MS - }, - &IdleInTransactionSessionTimeout, - 0, 0, INT_MAX, - NULL, NULL, NULL - }, - - { - {"vacuum_freeze_min_age", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Minimum age at which VACUUM should freeze a table row."), - NULL - }, - &vacuum_freeze_min_age, - 50000000, 0, 1000000000, - NULL, NULL, NULL - }, - - { - {"vacuum_freeze_table_age", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Age at which VACUUM should scan whole table to freeze tuples."), - NULL - }, - &vacuum_freeze_table_age, - 150000000, 0, 2000000000, - NULL, NULL, NULL - }, - - { - {"vacuum_multixact_freeze_min_age", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Minimum age at which VACUUM should freeze a MultiXactId in a table row."), - NULL - }, - &vacuum_multixact_freeze_min_age, - 5000000, 0, 1000000000, - NULL, NULL, NULL - }, - - { - {"vacuum_multixact_freeze_table_age", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Multixact age at which VACUUM should scan whole table to freeze tuples."), - NULL - }, - &vacuum_multixact_freeze_table_age, - 150000000, 0, 2000000000, - NULL, NULL, NULL - }, - - { - {"vacuum_defer_cleanup_age", PGC_SIGHUP, REPLICATION_MASTER, - gettext_noop("Number of transactions by which VACUUM and HOT cleanup should be deferred, if any."), - NULL - }, - &vacuum_defer_cleanup_age, - 0, 0, 1000000, - NULL, NULL, NULL - }, - - /* - * See also CheckRequiredParameterValues() if this parameter changes - */ - { - {"max_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT, - gettext_noop("Sets the maximum number of locks per transaction."), - gettext_noop("The shared lock table is sized on the assumption that " - "at most max_locks_per_transaction * max_connections distinct " - "objects will need to be locked at any one time.") - }, - &max_locks_per_xact, - 64, 10, INT_MAX, - NULL, NULL, NULL - }, - - { - {"max_pred_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT, - gettext_noop("Sets the maximum number of predicate locks per transaction."), - gettext_noop("The shared predicate lock table is sized on the assumption that " - "at most max_pred_locks_per_transaction * max_connections distinct " - "objects will need to be locked at any one time.") - }, - &max_predicate_locks_per_xact, - 64, 10, INT_MAX, - NULL, NULL, NULL - }, - - { - {"max_pred_locks_per_relation", PGC_SIGHUP, LOCK_MANAGEMENT, - gettext_noop("Sets the maximum number of predicate-locked pages and tuples per relation."), - gettext_noop("If more than this total of pages and tuples in the same relation are locked " - "by a connection, those locks are replaced by a relation-level lock.") - }, - &max_predicate_locks_per_relation, - -2, INT_MIN, INT_MAX, - NULL, NULL, NULL - }, - - { - {"max_pred_locks_per_page", PGC_SIGHUP, LOCK_MANAGEMENT, - gettext_noop("Sets the maximum number of predicate-locked tuples per page."), - gettext_noop("If more than this number of tuples on the same page are locked " - "by a connection, those locks are replaced by a page-level lock.") - }, - &max_predicate_locks_per_page, - 2, 0, INT_MAX, - NULL, NULL, NULL - }, - - { - {"authentication_timeout", PGC_SIGHUP, CONN_AUTH_AUTH, - gettext_noop("Sets the maximum allowed time to complete client authentication."), - NULL, - GUC_UNIT_S - }, - &AuthenticationTimeout, - 60, 1, 600, - NULL, NULL, NULL - }, - - { - /* Not for general use */ - {"pre_auth_delay", PGC_SIGHUP, DEVELOPER_OPTIONS, - gettext_noop("Waits N seconds on connection startup before authentication."), - gettext_noop("This allows attaching a debugger to the process."), - GUC_NOT_IN_SAMPLE | GUC_UNIT_S - }, - &PreAuthDelay, - 0, 0, 60, - NULL, NULL, NULL - }, - - { - {"wal_keep_size", PGC_SIGHUP, REPLICATION_SENDING, - gettext_noop("Sets the size of WAL files held for standby servers."), - NULL, - GUC_UNIT_MB - }, - &wal_keep_size_mb, - 0, 0, MAX_KILOBYTES, - NULL, NULL, NULL - }, - - { - {"min_wal_size", PGC_SIGHUP, WAL_CHECKPOINTS, - gettext_noop("Sets the minimum size to shrink the WAL to."), - NULL, - GUC_UNIT_MB - }, - &min_wal_size_mb, - DEFAULT_MIN_WAL_SEGS * (DEFAULT_XLOG_SEG_SIZE / (1024 * 1024)), - 2, MAX_KILOBYTES, - NULL, NULL, NULL - }, - - { - {"max_wal_size", PGC_SIGHUP, WAL_CHECKPOINTS, - gettext_noop("Sets the WAL size that triggers a checkpoint."), - NULL, - GUC_UNIT_MB - }, - &max_wal_size_mb, - DEFAULT_MAX_WAL_SEGS * (DEFAULT_XLOG_SEG_SIZE / (1024 * 1024)), - 2, MAX_KILOBYTES, - NULL, assign_max_wal_size, NULL - }, - - { - {"checkpoint_timeout", PGC_SIGHUP, WAL_CHECKPOINTS, - gettext_noop("Sets the maximum time between automatic WAL checkpoints."), - NULL, - GUC_UNIT_S - }, - &CheckPointTimeout, - 300, 30, 86400, - NULL, NULL, NULL - }, - - { - {"checkpoint_warning", PGC_SIGHUP, WAL_CHECKPOINTS, - gettext_noop("Enables warnings if checkpoint segments are filled more " - "frequently than this."), - gettext_noop("Write a message to the server log if checkpoints " - "caused by the filling of checkpoint segment files happens more " - "frequently than this number of seconds. Zero turns off the warning."), - GUC_UNIT_S - }, - &CheckPointWarning, - 30, 0, INT_MAX, - NULL, NULL, NULL - }, - - { - {"checkpoint_flush_after", PGC_SIGHUP, WAL_CHECKPOINTS, - gettext_noop("Number of pages after which previously performed writes are flushed to disk."), - NULL, - GUC_UNIT_BLOCKS - }, - &checkpoint_flush_after, - DEFAULT_CHECKPOINT_FLUSH_AFTER, 0, WRITEBACK_MAX_PENDING_FLUSHES, - NULL, NULL, NULL - }, - - { - {"wal_buffers", PGC_POSTMASTER, WAL_SETTINGS, - gettext_noop("Sets the number of disk-page buffers in shared memory for WAL."), - NULL, - GUC_UNIT_XBLOCKS - }, - &XLOGbuffers, - -1, -1, (INT_MAX / XLOG_BLCKSZ), - check_wal_buffers, NULL, NULL - }, - - { - {"wal_writer_delay", PGC_SIGHUP, WAL_SETTINGS, - gettext_noop("Time between WAL flushes performed in the WAL writer."), - NULL, - GUC_UNIT_MS - }, - &WalWriterDelay, - 200, 1, 10000, - NULL, NULL, NULL - }, - - { - {"wal_writer_flush_after", PGC_SIGHUP, WAL_SETTINGS, - gettext_noop("Amount of WAL written out by WAL writer that triggers a flush."), - NULL, - GUC_UNIT_XBLOCKS - }, - &WalWriterFlushAfter, - (1024 * 1024) / XLOG_BLCKSZ, 0, INT_MAX, - NULL, NULL, NULL - }, - - { - {"wal_skip_threshold", PGC_USERSET, WAL_SETTINGS, - gettext_noop("Size of new file to fsync instead of writing WAL."), - NULL, - GUC_UNIT_KB - }, - &wal_skip_threshold, - 2048, 0, MAX_KILOBYTES, - NULL, NULL, NULL - }, - - { - {"max_wal_senders", PGC_POSTMASTER, REPLICATION_SENDING, - gettext_noop("Sets the maximum number of simultaneously running WAL sender processes."), - NULL - }, - &max_wal_senders, - 10, 0, MAX_BACKENDS, - check_max_wal_senders, NULL, NULL - }, - - { - /* see max_wal_senders */ - {"max_replication_slots", PGC_POSTMASTER, REPLICATION_SENDING, - gettext_noop("Sets the maximum number of simultaneously defined replication slots."), - NULL - }, - &max_replication_slots, - 10, 0, MAX_BACKENDS /* XXX? */ , - NULL, NULL, NULL - }, - - { - {"max_slot_wal_keep_size", PGC_SIGHUP, REPLICATION_SENDING, - gettext_noop("Sets the maximum WAL size that can be reserved by replication slots."), - gettext_noop("Replication slots will be marked as failed, and segments released " - "for deletion or recycling, if this much space is occupied by WAL " - "on disk."), - GUC_UNIT_MB - }, - &max_slot_wal_keep_size_mb, - -1, -1, MAX_KILOBYTES, - NULL, NULL, NULL - }, - - { - {"wal_sender_timeout", PGC_USERSET, REPLICATION_SENDING, - gettext_noop("Sets the maximum time to wait for WAL replication."), - NULL, - GUC_UNIT_MS - }, - &wal_sender_timeout, - 60 * 1000, 0, INT_MAX, - NULL, NULL, NULL - }, - - { - {"commit_delay", PGC_SUSET, WAL_SETTINGS, - gettext_noop("Sets the delay in microseconds between transaction commit and " - "flushing WAL to disk."), - NULL - /* we have no microseconds designation, so can't supply units here */ - }, - &CommitDelay, - 0, 0, 100000, - NULL, NULL, NULL - }, - - { - {"commit_siblings", PGC_USERSET, WAL_SETTINGS, - gettext_noop("Sets the minimum concurrent open transactions before performing " - "commit_delay."), - NULL - }, - &CommitSiblings, - 5, 0, 1000, - NULL, NULL, NULL - }, - - { - {"extra_float_digits", PGC_USERSET, CLIENT_CONN_LOCALE, - gettext_noop("Sets the number of digits displayed for floating-point values."), - gettext_noop("This affects real, double precision, and geometric data types. " - "A zero or negative parameter value is added to the standard " - "number of digits (FLT_DIG or DBL_DIG as appropriate). " - "Any value greater than zero selects precise output mode.") - }, - &extra_float_digits, - 1, -15, 3, - NULL, NULL, NULL - }, - - { - {"log_min_duration_sample", PGC_SUSET, LOGGING_WHEN, - gettext_noop("Sets the minimum execution time above which " - "a sample of statements will be logged." - " Sampling is determined by log_statement_sample_rate."), - gettext_noop("Zero logs a sample of all queries. -1 turns this feature off."), - GUC_UNIT_MS - }, - &log_min_duration_sample, - -1, -1, INT_MAX, - NULL, NULL, NULL - }, - - { - {"log_min_duration_statement", PGC_SUSET, LOGGING_WHEN, - gettext_noop("Sets the minimum execution time above which " - "all statements will be logged."), - gettext_noop("Zero prints all queries. -1 turns this feature off."), - GUC_UNIT_MS - }, - &log_min_duration_statement, - -1, -1, INT_MAX, - NULL, NULL, NULL - }, - - { - {"log_autovacuum_min_duration", PGC_SIGHUP, LOGGING_WHAT, - gettext_noop("Sets the minimum execution time above which " - "autovacuum actions will be logged."), - gettext_noop("Zero prints all actions. -1 turns autovacuum logging off."), - GUC_UNIT_MS - }, - &Log_autovacuum_min_duration, - -1, -1, INT_MAX, - NULL, NULL, NULL - }, - - { - {"log_parameter_max_length", PGC_SUSET, LOGGING_WHAT, - gettext_noop("When logging statements, limit logged parameter values to first N bytes."), - gettext_noop("-1 to print values in full."), - GUC_UNIT_BYTE - }, - &log_parameter_max_length, - -1, -1, INT_MAX / 2, - NULL, NULL, NULL - }, - - { - {"log_parameter_max_length_on_error", PGC_USERSET, LOGGING_WHAT, - gettext_noop("When reporting an error, limit logged parameter values to first N bytes."), - gettext_noop("-1 to print values in full."), - GUC_UNIT_BYTE - }, - &log_parameter_max_length_on_error, - 0, -1, INT_MAX / 2, - NULL, NULL, NULL - }, - - { - {"bgwriter_delay", PGC_SIGHUP, RESOURCES_BGWRITER, - gettext_noop("Background writer sleep time between rounds."), - NULL, - GUC_UNIT_MS - }, - &BgWriterDelay, - 200, 10, 10000, - NULL, NULL, NULL - }, - - { - {"bgwriter_lru_maxpages", PGC_SIGHUP, RESOURCES_BGWRITER, - gettext_noop("Background writer maximum number of LRU pages to flush per round."), - NULL - }, - &bgwriter_lru_maxpages, - 100, 0, INT_MAX / 2, /* Same upper limit as shared_buffers */ - NULL, NULL, NULL - }, - - { - {"bgwriter_flush_after", PGC_SIGHUP, RESOURCES_BGWRITER, - gettext_noop("Number of pages after which previously performed writes are flushed to disk."), - NULL, - GUC_UNIT_BLOCKS - }, - &bgwriter_flush_after, - DEFAULT_BGWRITER_FLUSH_AFTER, 0, WRITEBACK_MAX_PENDING_FLUSHES, - NULL, NULL, NULL - }, - - { - {"effective_io_concurrency", - PGC_USERSET, - RESOURCES_ASYNCHRONOUS, - gettext_noop("Number of simultaneous requests that can be handled efficiently by the disk subsystem."), - NULL, - GUC_EXPLAIN - }, - &effective_io_concurrency, -#ifdef USE_PREFETCH - 1, -#else - 0, -#endif - 0, MAX_IO_CONCURRENCY, - check_effective_io_concurrency, NULL, NULL - }, - - { - {"maintenance_io_concurrency", - PGC_USERSET, - RESOURCES_ASYNCHRONOUS, - gettext_noop("A variant of effective_io_concurrency that is used for maintenance work."), - NULL, - GUC_EXPLAIN - }, - &maintenance_io_concurrency, -#ifdef USE_PREFETCH - 10, -#else - 0, -#endif - 0, MAX_IO_CONCURRENCY, - check_maintenance_io_concurrency, NULL, NULL - }, - - { - {"backend_flush_after", PGC_USERSET, RESOURCES_ASYNCHRONOUS, - gettext_noop("Number of pages after which previously performed writes are flushed to disk."), - NULL, - GUC_UNIT_BLOCKS - }, - &backend_flush_after, - DEFAULT_BACKEND_FLUSH_AFTER, 0, WRITEBACK_MAX_PENDING_FLUSHES, - NULL, NULL, NULL - }, - - { - {"max_worker_processes", - PGC_POSTMASTER, - RESOURCES_ASYNCHRONOUS, - gettext_noop("Maximum number of concurrent worker processes."), - NULL, - }, - &max_worker_processes, - 8, 0, MAX_BACKENDS, - check_max_worker_processes, NULL, NULL - }, - - { - {"max_logical_replication_workers", - PGC_POSTMASTER, - REPLICATION_SUBSCRIBERS, - gettext_noop("Maximum number of logical replication worker processes."), - NULL, - }, - &max_logical_replication_workers, - 4, 0, MAX_BACKENDS, - NULL, NULL, NULL - }, - - { - {"max_sync_workers_per_subscription", - PGC_SIGHUP, - REPLICATION_SUBSCRIBERS, - gettext_noop("Maximum number of table synchronization workers per subscription."), - NULL, - }, - &max_sync_workers_per_subscription, - 2, 0, MAX_BACKENDS, - NULL, NULL, NULL - }, - - { - {"log_rotation_age", PGC_SIGHUP, LOGGING_WHERE, - gettext_noop("Automatic log file rotation will occur after N minutes."), - NULL, - GUC_UNIT_MIN - }, - &Log_RotationAge, - HOURS_PER_DAY * MINS_PER_HOUR, 0, INT_MAX / SECS_PER_MINUTE, - NULL, NULL, NULL - }, - - { - {"log_rotation_size", PGC_SIGHUP, LOGGING_WHERE, - gettext_noop("Automatic log file rotation will occur after N kilobytes."), - NULL, - GUC_UNIT_KB - }, - &Log_RotationSize, - 10 * 1024, 0, INT_MAX / 1024, - NULL, NULL, NULL - }, - - { - {"max_function_args", PGC_INTERNAL, PRESET_OPTIONS, - gettext_noop("Shows the maximum number of function arguments."), - NULL, - GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &max_function_args, - FUNC_MAX_ARGS, FUNC_MAX_ARGS, FUNC_MAX_ARGS, - NULL, NULL, NULL - }, - - { - {"max_index_keys", PGC_INTERNAL, PRESET_OPTIONS, - gettext_noop("Shows the maximum number of index keys."), - NULL, - GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &max_index_keys, - INDEX_MAX_KEYS, INDEX_MAX_KEYS, INDEX_MAX_KEYS, - NULL, NULL, NULL - }, - - { - {"max_identifier_length", PGC_INTERNAL, PRESET_OPTIONS, - gettext_noop("Shows the maximum identifier length."), - NULL, - GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &max_identifier_length, - NAMEDATALEN - 1, NAMEDATALEN - 1, NAMEDATALEN - 1, - NULL, NULL, NULL - }, - - { - {"block_size", PGC_INTERNAL, PRESET_OPTIONS, - gettext_noop("Shows the size of a disk block."), - NULL, - GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &block_size, - BLCKSZ, BLCKSZ, BLCKSZ, - NULL, NULL, NULL - }, - - { - {"segment_size", PGC_INTERNAL, PRESET_OPTIONS, - gettext_noop("Shows the number of pages per disk file."), - NULL, - GUC_UNIT_BLOCKS | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &segment_size, - RELSEG_SIZE, RELSEG_SIZE, RELSEG_SIZE, - NULL, NULL, NULL - }, - - { - {"wal_block_size", PGC_INTERNAL, PRESET_OPTIONS, - gettext_noop("Shows the block size in the write ahead log."), - NULL, - GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &wal_block_size, - XLOG_BLCKSZ, XLOG_BLCKSZ, XLOG_BLCKSZ, - NULL, NULL, NULL - }, - - { - {"wal_retrieve_retry_interval", PGC_SIGHUP, REPLICATION_STANDBY, - gettext_noop("Sets the time to wait before retrying to retrieve WAL " - "after a failed attempt."), - NULL, - GUC_UNIT_MS - }, - &wal_retrieve_retry_interval, - 5000, 1, INT_MAX, - NULL, NULL, NULL - }, - - { - {"wal_segment_size", PGC_INTERNAL, PRESET_OPTIONS, - gettext_noop("Shows the size of write ahead log segments."), - NULL, - GUC_UNIT_BYTE | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &wal_segment_size, - DEFAULT_XLOG_SEG_SIZE, - WalSegMinSize, - WalSegMaxSize, - NULL, NULL, NULL - }, - - { - {"autovacuum_naptime", PGC_SIGHUP, AUTOVACUUM, - gettext_noop("Time to sleep between autovacuum runs."), - NULL, - GUC_UNIT_S - }, - &autovacuum_naptime, - 60, 1, INT_MAX / 1000, - NULL, NULL, NULL - }, - { - {"autovacuum_vacuum_threshold", PGC_SIGHUP, AUTOVACUUM, - gettext_noop("Minimum number of tuple updates or deletes prior to vacuum."), - NULL - }, - &autovacuum_vac_thresh, - 50, 0, INT_MAX, - NULL, NULL, NULL - }, - { - {"autovacuum_vacuum_insert_threshold", PGC_SIGHUP, AUTOVACUUM, - gettext_noop("Minimum number of tuple inserts prior to vacuum, or -1 to disable insert vacuums."), - NULL - }, - &autovacuum_vac_ins_thresh, - 1000, -1, INT_MAX, - NULL, NULL, NULL - }, - { - {"autovacuum_analyze_threshold", PGC_SIGHUP, AUTOVACUUM, - gettext_noop("Minimum number of tuple inserts, updates, or deletes prior to analyze."), - NULL - }, - &autovacuum_anl_thresh, - 50, 0, INT_MAX, - NULL, NULL, NULL - }, - { - /* see varsup.c for why this is PGC_POSTMASTER not PGC_SIGHUP */ - {"autovacuum_freeze_max_age", PGC_POSTMASTER, AUTOVACUUM, - gettext_noop("Age at which to autovacuum a table to prevent transaction ID wraparound."), - NULL - }, - &autovacuum_freeze_max_age, - /* see pg_resetwal if you change the upper-limit value */ - 200000000, 100000, 2000000000, - NULL, NULL, NULL - }, - { - /* see multixact.c for why this is PGC_POSTMASTER not PGC_SIGHUP */ - {"autovacuum_multixact_freeze_max_age", PGC_POSTMASTER, AUTOVACUUM, - gettext_noop("Multixact age at which to autovacuum a table to prevent multixact wraparound."), - NULL - }, - &autovacuum_multixact_freeze_max_age, - 400000000, 10000, 2000000000, - NULL, NULL, NULL - }, - { - /* see max_connections */ - {"autovacuum_max_workers", PGC_POSTMASTER, AUTOVACUUM, - gettext_noop("Sets the maximum number of simultaneously running autovacuum worker processes."), - NULL - }, - &autovacuum_max_workers, - 3, 1, MAX_BACKENDS, - check_autovacuum_max_workers, NULL, NULL - }, - - { - {"max_parallel_maintenance_workers", PGC_USERSET, RESOURCES_ASYNCHRONOUS, - gettext_noop("Sets the maximum number of parallel processes per maintenance operation."), - NULL - }, - &max_parallel_maintenance_workers, - 2, 0, 1024, - NULL, NULL, NULL - }, - - { - {"max_parallel_workers_per_gather", PGC_USERSET, RESOURCES_ASYNCHRONOUS, - gettext_noop("Sets the maximum number of parallel processes per executor node."), - NULL, - GUC_EXPLAIN - }, - &max_parallel_workers_per_gather, - 2, 0, MAX_PARALLEL_WORKER_LIMIT, - NULL, NULL, NULL - }, - - { - {"max_parallel_workers", PGC_USERSET, RESOURCES_ASYNCHRONOUS, - gettext_noop("Sets the maximum number of parallel workers that can be active at one time."), - NULL, - GUC_EXPLAIN - }, - &max_parallel_workers, - 8, 0, MAX_PARALLEL_WORKER_LIMIT, - NULL, NULL, NULL - }, - - { - {"autovacuum_work_mem", PGC_SIGHUP, RESOURCES_MEM, - gettext_noop("Sets the maximum memory to be used by each autovacuum worker process."), - NULL, - GUC_UNIT_KB - }, - &autovacuum_work_mem, - -1, -1, MAX_KILOBYTES, - check_autovacuum_work_mem, NULL, NULL - }, - - { - {"old_snapshot_threshold", PGC_POSTMASTER, RESOURCES_ASYNCHRONOUS, - gettext_noop("Time before a snapshot is too old to read pages changed after the snapshot was taken."), - gettext_noop("A value of -1 disables this feature."), - GUC_UNIT_MIN - }, - &old_snapshot_threshold, - -1, -1, MINS_PER_HOUR * HOURS_PER_DAY * 60, - NULL, NULL, NULL - }, - - { - {"tcp_keepalives_idle", PGC_USERSET, CLIENT_CONN_OTHER, - gettext_noop("Time between issuing TCP keepalives."), - gettext_noop("A value of 0 uses the system default."), - GUC_UNIT_S - }, - &tcp_keepalives_idle, - 0, 0, INT_MAX, - NULL, assign_tcp_keepalives_idle, show_tcp_keepalives_idle - }, - - { - {"tcp_keepalives_interval", PGC_USERSET, CLIENT_CONN_OTHER, - gettext_noop("Time between TCP keepalive retransmits."), - gettext_noop("A value of 0 uses the system default."), - GUC_UNIT_S - }, - &tcp_keepalives_interval, - 0, 0, INT_MAX, - NULL, assign_tcp_keepalives_interval, show_tcp_keepalives_interval - }, - - { - {"ssl_renegotiation_limit", PGC_USERSET, CONN_AUTH_SSL, - gettext_noop("SSL renegotiation is no longer supported; this can only be 0."), - NULL, - GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE, - }, - &ssl_renegotiation_limit, - 0, 0, 0, - NULL, NULL, NULL - }, - - { - {"tcp_keepalives_count", PGC_USERSET, CLIENT_CONN_OTHER, - gettext_noop("Maximum number of TCP keepalive retransmits."), - gettext_noop("This controls the number of consecutive keepalive retransmits that can be " - "lost before a connection is considered dead. A value of 0 uses the " - "system default."), - }, - &tcp_keepalives_count, - 0, 0, INT_MAX, - NULL, assign_tcp_keepalives_count, show_tcp_keepalives_count - }, - - { - {"gin_fuzzy_search_limit", PGC_USERSET, CLIENT_CONN_OTHER, - gettext_noop("Sets the maximum allowed result for exact search by GIN."), - NULL, - 0 - }, - &GinFuzzySearchLimit, - 0, 0, INT_MAX, - NULL, NULL, NULL - }, - - { - {"effective_cache_size", PGC_USERSET, QUERY_TUNING_COST, - gettext_noop("Sets the planner's assumption about the total size of the data caches."), - gettext_noop("That is, the total size of the caches (kernel cache and shared buffers) used for PostgreSQL data files. " - "This is measured in disk pages, which are normally 8 kB each."), - GUC_UNIT_BLOCKS | GUC_EXPLAIN, - }, - &effective_cache_size, - DEFAULT_EFFECTIVE_CACHE_SIZE, 1, INT_MAX, - NULL, NULL, NULL - }, - - { - {"min_parallel_table_scan_size", PGC_USERSET, QUERY_TUNING_COST, - gettext_noop("Sets the minimum amount of table data for a parallel scan."), - gettext_noop("If the planner estimates that it will read a number of table pages too small to reach this limit, a parallel scan will not be considered."), - GUC_UNIT_BLOCKS | GUC_EXPLAIN, - }, - &min_parallel_table_scan_size, - (8 * 1024 * 1024) / BLCKSZ, 0, INT_MAX / 3, - NULL, NULL, NULL - }, - - { - {"min_parallel_index_scan_size", PGC_USERSET, QUERY_TUNING_COST, - gettext_noop("Sets the minimum amount of index data for a parallel scan."), - gettext_noop("If the planner estimates that it will read a number of index pages too small to reach this limit, a parallel scan will not be considered."), - GUC_UNIT_BLOCKS | GUC_EXPLAIN, - }, - &min_parallel_index_scan_size, - (512 * 1024) / BLCKSZ, 0, INT_MAX / 3, - NULL, NULL, NULL - }, - - { - /* Can't be set in postgresql.conf */ - {"server_version_num", PGC_INTERNAL, PRESET_OPTIONS, - gettext_noop("Shows the server version as an integer."), - NULL, - GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &server_version_num, - PG_VERSION_NUM, PG_VERSION_NUM, PG_VERSION_NUM, - NULL, NULL, NULL - }, - - { - {"log_temp_files", PGC_SUSET, LOGGING_WHAT, - gettext_noop("Log the use of temporary files larger than this number of kilobytes."), - gettext_noop("Zero logs all files. The default is -1 (turning this feature off)."), - GUC_UNIT_KB - }, - &log_temp_files, - -1, -1, INT_MAX, - NULL, NULL, NULL - }, - - { - {"track_activity_query_size", PGC_POSTMASTER, RESOURCES_MEM, - gettext_noop("Sets the size reserved for pg_stat_activity.query, in bytes."), - NULL, - GUC_UNIT_BYTE - }, - &pgstat_track_activity_query_size, - 1024, 100, 1048576, - NULL, NULL, NULL - }, - - { - {"gin_pending_list_limit", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the maximum size of the pending list for GIN index."), - NULL, - GUC_UNIT_KB - }, - &gin_pending_list_limit, - 4096, 64, MAX_KILOBYTES, - NULL, NULL, NULL - }, - - { - {"tcp_user_timeout", PGC_USERSET, CLIENT_CONN_OTHER, - gettext_noop("TCP user timeout."), - gettext_noop("A value of 0 uses the system default."), - GUC_UNIT_MS - }, - &tcp_user_timeout, - 0, 0, INT_MAX, - NULL, assign_tcp_user_timeout, show_tcp_user_timeout - }, - - /* End-of-list marker */ - { - {NULL, 0, 0, NULL, NULL}, NULL, 0, 0, 0, NULL, NULL, NULL - } }; static struct config_real ConfigureNamesReal[] = { - { - {"seq_page_cost", PGC_USERSET, QUERY_TUNING_COST, - gettext_noop("Sets the planner's estimate of the cost of a " - "sequentially fetched disk page."), - NULL, - GUC_EXPLAIN - }, - &seq_page_cost, - DEFAULT_SEQ_PAGE_COST, 0, DBL_MAX, - NULL, NULL, NULL - }, - { - {"random_page_cost", PGC_USERSET, QUERY_TUNING_COST, - gettext_noop("Sets the planner's estimate of the cost of a " - "nonsequentially fetched disk page."), - NULL, - GUC_EXPLAIN - }, - &random_page_cost, - DEFAULT_RANDOM_PAGE_COST, 0, DBL_MAX, - NULL, NULL, NULL - }, - { - {"cpu_tuple_cost", PGC_USERSET, QUERY_TUNING_COST, - gettext_noop("Sets the planner's estimate of the cost of " - "processing each tuple (row)."), - NULL, - GUC_EXPLAIN - }, - &cpu_tuple_cost, - DEFAULT_CPU_TUPLE_COST, 0, DBL_MAX, - NULL, NULL, NULL - }, - { - {"cpu_index_tuple_cost", PGC_USERSET, QUERY_TUNING_COST, - gettext_noop("Sets the planner's estimate of the cost of " - "processing each index entry during an index scan."), - NULL, - GUC_EXPLAIN - }, - &cpu_index_tuple_cost, - DEFAULT_CPU_INDEX_TUPLE_COST, 0, DBL_MAX, - NULL, NULL, NULL - }, - { - {"cpu_operator_cost", PGC_USERSET, QUERY_TUNING_COST, - gettext_noop("Sets the planner's estimate of the cost of " - "processing each operator or function call."), - NULL, - GUC_EXPLAIN - }, - &cpu_operator_cost, - DEFAULT_CPU_OPERATOR_COST, 0, DBL_MAX, - NULL, NULL, NULL - }, - { - {"parallel_tuple_cost", PGC_USERSET, QUERY_TUNING_COST, - gettext_noop("Sets the planner's estimate of the cost of " - "passing each tuple (row) from worker to master backend."), - NULL, - GUC_EXPLAIN - }, - ¶llel_tuple_cost, - DEFAULT_PARALLEL_TUPLE_COST, 0, DBL_MAX, - NULL, NULL, NULL - }, - { - {"parallel_setup_cost", PGC_USERSET, QUERY_TUNING_COST, - gettext_noop("Sets the planner's estimate of the cost of " - "starting up worker processes for parallel query."), - NULL, - GUC_EXPLAIN - }, - ¶llel_setup_cost, - DEFAULT_PARALLEL_SETUP_COST, 0, DBL_MAX, - NULL, NULL, NULL - }, - - { - {"jit_above_cost", PGC_USERSET, QUERY_TUNING_COST, - gettext_noop("Perform JIT compilation if query is more expensive."), - gettext_noop("-1 disables JIT compilation."), - GUC_EXPLAIN - }, - &jit_above_cost, - 100000, -1, DBL_MAX, - NULL, NULL, NULL - }, - - { - {"jit_optimize_above_cost", PGC_USERSET, QUERY_TUNING_COST, - gettext_noop("Optimize JITed functions if query is more expensive."), - gettext_noop("-1 disables optimization."), - GUC_EXPLAIN - }, - &jit_optimize_above_cost, - 500000, -1, DBL_MAX, - NULL, NULL, NULL - }, - - { - {"jit_inline_above_cost", PGC_USERSET, QUERY_TUNING_COST, - gettext_noop("Perform JIT inlining if query is more expensive."), - gettext_noop("-1 disables inlining."), - GUC_EXPLAIN - }, - &jit_inline_above_cost, - 500000, -1, DBL_MAX, - NULL, NULL, NULL - }, - - { - {"cursor_tuple_fraction", PGC_USERSET, QUERY_TUNING_OTHER, - gettext_noop("Sets the planner's estimate of the fraction of " - "a cursor's rows that will be retrieved."), - NULL, - GUC_EXPLAIN - }, - &cursor_tuple_fraction, - DEFAULT_CURSOR_TUPLE_FRACTION, 0.0, 1.0, - NULL, NULL, NULL - }, - - { - {"geqo_selection_bias", PGC_USERSET, QUERY_TUNING_GEQO, - gettext_noop("GEQO: selective pressure within the population."), - NULL, - GUC_EXPLAIN - }, - &Geqo_selection_bias, - DEFAULT_GEQO_SELECTION_BIAS, - MIN_GEQO_SELECTION_BIAS, MAX_GEQO_SELECTION_BIAS, - NULL, NULL, NULL - }, - { - {"geqo_seed", PGC_USERSET, QUERY_TUNING_GEQO, - gettext_noop("GEQO: seed for random path selection."), - NULL, - GUC_EXPLAIN - }, - &Geqo_seed, - 0.0, 0.0, 1.0, - NULL, NULL, NULL - }, - - { - {"hash_mem_multiplier", PGC_USERSET, RESOURCES_MEM, - gettext_noop("Multiple of work_mem to use for hash tables."), - NULL, - GUC_EXPLAIN - }, - &hash_mem_multiplier, - 1.0, 1.0, 1000.0, - NULL, NULL, NULL - }, - - { - {"bgwriter_lru_multiplier", PGC_SIGHUP, RESOURCES_BGWRITER, - gettext_noop("Multiple of the average buffer usage to free per round."), - NULL - }, - &bgwriter_lru_multiplier, - 2.0, 0.0, 10.0, - NULL, NULL, NULL - }, - - { - {"seed", PGC_USERSET, UNGROUPED, - gettext_noop("Sets the seed for random-number generation."), - NULL, - GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &phony_random_seed, - 0.0, -1.0, 1.0, - check_random_seed, assign_random_seed, show_random_seed - }, - - { - {"vacuum_cost_delay", PGC_USERSET, RESOURCES_VACUUM_DELAY, - gettext_noop("Vacuum cost delay in milliseconds."), - NULL, - GUC_UNIT_MS - }, - &VacuumCostDelay, - 0, 0, 100, - NULL, NULL, NULL - }, - - { - {"autovacuum_vacuum_cost_delay", PGC_SIGHUP, AUTOVACUUM, - gettext_noop("Vacuum cost delay in milliseconds, for autovacuum."), - NULL, - GUC_UNIT_MS - }, - &autovacuum_vac_cost_delay, - 2, -1, 100, - NULL, NULL, NULL - }, - - { - {"autovacuum_vacuum_scale_factor", PGC_SIGHUP, AUTOVACUUM, - gettext_noop("Number of tuple updates or deletes prior to vacuum as a fraction of reltuples."), - NULL - }, - &autovacuum_vac_scale, - 0.2, 0.0, 100.0, - NULL, NULL, NULL - }, - - { - {"autovacuum_vacuum_insert_scale_factor", PGC_SIGHUP, AUTOVACUUM, - gettext_noop("Number of tuple inserts prior to vacuum as a fraction of reltuples."), - NULL - }, - &autovacuum_vac_ins_scale, - 0.2, 0.0, 100.0, - NULL, NULL, NULL - }, - - { - {"autovacuum_analyze_scale_factor", PGC_SIGHUP, AUTOVACUUM, - gettext_noop("Number of tuple inserts, updates, or deletes prior to analyze as a fraction of reltuples."), - NULL - }, - &autovacuum_anl_scale, - 0.1, 0.0, 100.0, - NULL, NULL, NULL - }, - - { - {"checkpoint_completion_target", PGC_SIGHUP, WAL_CHECKPOINTS, - gettext_noop("Time spent flushing dirty buffers during checkpoint, as fraction of checkpoint interval."), - NULL - }, - &CheckPointCompletionTarget, - 0.5, 0.0, 1.0, - NULL, NULL, NULL - }, - - { - {"vacuum_cleanup_index_scale_factor", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Number of tuple inserts prior to index cleanup as a fraction of reltuples."), - NULL - }, - &vacuum_cleanup_index_scale_factor, - 0.1, 0.0, 1e10, - NULL, NULL, NULL - }, - - { - {"log_statement_sample_rate", PGC_SUSET, LOGGING_WHEN, - gettext_noop("Fraction of statements exceeding log_min_duration_sample to be logged."), - gettext_noop("Use a value between 0.0 (never log) and 1.0 (always log).") - }, - &log_statement_sample_rate, - 1.0, 0.0, 1.0, - NULL, NULL, NULL - }, - - { - {"log_transaction_sample_rate", PGC_SUSET, LOGGING_WHEN, - gettext_noop("Set the fraction of transactions to log for new transactions."), - gettext_noop("Logs all statements from a fraction of transactions. " - "Use a value between 0.0 (never log) and 1.0 (log all " - "statements for all transactions).") - }, - &log_xact_sample_rate, - 0.0, 0.0, 1.0, - NULL, NULL, NULL - }, - - /* End-of-list marker */ - { - {NULL, 0, 0, NULL, NULL}, NULL, 0.0, 0.0, 0.0, NULL, NULL, NULL - } }; static struct config_string ConfigureNamesString[] = { - { - {"archive_command", PGC_SIGHUP, WAL_ARCHIVING, - gettext_noop("Sets the shell command that will be called to archive a WAL file."), - NULL - }, - &XLogArchiveCommand, - "", - NULL, NULL, show_archive_command - }, - - { - {"restore_command", PGC_POSTMASTER, WAL_ARCHIVE_RECOVERY, - gettext_noop("Sets the shell command that will be called to retrieve an archived WAL file."), - NULL - }, - &recoveryRestoreCommand, - "", - NULL, NULL, NULL - }, - - { - {"archive_cleanup_command", PGC_SIGHUP, WAL_ARCHIVE_RECOVERY, - gettext_noop("Sets the shell command that will be executed at every restart point."), - NULL - }, - &archiveCleanupCommand, - "", - NULL, NULL, NULL - }, - - { - {"recovery_end_command", PGC_SIGHUP, WAL_ARCHIVE_RECOVERY, - gettext_noop("Sets the shell command that will be executed once at the end of recovery."), - NULL - }, - &recoveryEndCommand, - "", - NULL, NULL, NULL - }, - - { - {"recovery_target_timeline", PGC_POSTMASTER, WAL_RECOVERY_TARGET, - gettext_noop("Specifies the timeline to recover into."), - NULL - }, - &recovery_target_timeline_string, - "latest", - check_recovery_target_timeline, assign_recovery_target_timeline, NULL - }, - - { - {"recovery_target", PGC_POSTMASTER, WAL_RECOVERY_TARGET, - gettext_noop("Set to \"immediate\" to end recovery as soon as a consistent state is reached."), - NULL - }, - &recovery_target_string, - "", - check_recovery_target, assign_recovery_target, NULL - }, - { - {"recovery_target_xid", PGC_POSTMASTER, WAL_RECOVERY_TARGET, - gettext_noop("Sets the transaction ID up to which recovery will proceed."), - NULL - }, - &recovery_target_xid_string, - "", - check_recovery_target_xid, assign_recovery_target_xid, NULL - }, - { - {"recovery_target_time", PGC_POSTMASTER, WAL_RECOVERY_TARGET, - gettext_noop("Sets the time stamp up to which recovery will proceed."), - NULL - }, - &recovery_target_time_string, - "", - check_recovery_target_time, assign_recovery_target_time, NULL - }, - { - {"recovery_target_name", PGC_POSTMASTER, WAL_RECOVERY_TARGET, - gettext_noop("Sets the named restore point up to which recovery will proceed."), - NULL - }, - &recovery_target_name_string, - "", - check_recovery_target_name, assign_recovery_target_name, NULL - }, - { - {"recovery_target_lsn", PGC_POSTMASTER, WAL_RECOVERY_TARGET, - gettext_noop("Sets the LSN of the write-ahead log location up to which recovery will proceed."), - NULL - }, - &recovery_target_lsn_string, - "", - check_recovery_target_lsn, assign_recovery_target_lsn, NULL - }, - - { - {"promote_trigger_file", PGC_SIGHUP, REPLICATION_STANDBY, - gettext_noop("Specifies a file name whose presence ends recovery in the standby."), - NULL - }, - &PromoteTriggerFile, - "", - NULL, NULL, NULL - }, - - { - {"primary_conninfo", PGC_SIGHUP, REPLICATION_STANDBY, - gettext_noop("Sets the connection string to be used to connect to the sending server."), - NULL, - GUC_SUPERUSER_ONLY - }, - &PrimaryConnInfo, - "", - NULL, NULL, NULL - }, - - { - {"primary_slot_name", PGC_SIGHUP, REPLICATION_STANDBY, - gettext_noop("Sets the name of the replication slot to use on the sending server."), - NULL - }, - &PrimarySlotName, - "", - check_primary_slot_name, NULL, NULL - }, - - { - {"client_encoding", PGC_USERSET, CLIENT_CONN_LOCALE, - gettext_noop("Sets the client's character set encoding."), - NULL, - GUC_IS_NAME | GUC_REPORT - }, - &client_encoding_string, - "SQL_ASCII", - check_client_encoding, assign_client_encoding, NULL - }, - - { - {"log_line_prefix", PGC_SIGHUP, LOGGING_WHAT, - gettext_noop("Controls information prefixed to each log line."), - gettext_noop("If blank, no prefix is used.") - }, - &Log_line_prefix, - "%m [%p] ", - NULL, NULL, NULL - }, - - { - {"log_timezone", PGC_SIGHUP, LOGGING_WHAT, - gettext_noop("Sets the time zone to use in log messages."), - NULL - }, - &log_timezone_string, - "GMT", - check_log_timezone, assign_log_timezone, show_log_timezone - }, - - { - {"DateStyle", PGC_USERSET, CLIENT_CONN_LOCALE, - gettext_noop("Sets the display format for date and time values."), - gettext_noop("Also controls interpretation of ambiguous " - "date inputs."), - GUC_LIST_INPUT | GUC_REPORT - }, - &datestyle_string, - "ISO, MDY", - check_datestyle, assign_datestyle, NULL - }, - - { - {"default_table_access_method", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the default table access method for new tables."), - NULL, - GUC_IS_NAME - }, - &default_table_access_method, - DEFAULT_TABLE_ACCESS_METHOD, - check_default_table_access_method, NULL, NULL - }, - - { - {"default_tablespace", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the default tablespace to create tables and indexes in."), - gettext_noop("An empty string selects the database's default tablespace."), - GUC_IS_NAME - }, - &default_tablespace, - "", - check_default_tablespace, NULL, NULL - }, - - { - {"temp_tablespaces", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the tablespace(s) to use for temporary tables and sort files."), - NULL, - GUC_LIST_INPUT | GUC_LIST_QUOTE - }, - &temp_tablespaces, - "", - check_temp_tablespaces, assign_temp_tablespaces, NULL - }, - - { - {"dynamic_library_path", PGC_SUSET, CLIENT_CONN_OTHER, - gettext_noop("Sets the path for dynamically loadable modules."), - gettext_noop("If a dynamically loadable module needs to be opened and " - "the specified name does not have a directory component (i.e., the " - "name does not contain a slash), the system will search this path for " - "the specified file."), - GUC_SUPERUSER_ONLY - }, - &Dynamic_library_path, - "$libdir", - NULL, NULL, NULL - }, - - { - {"krb_server_keyfile", PGC_SIGHUP, CONN_AUTH_AUTH, - gettext_noop("Sets the location of the Kerberos server key file."), - NULL, - GUC_SUPERUSER_ONLY - }, - &pg_krb_server_keyfile, - PG_KRB_SRVTAB, - NULL, NULL, NULL - }, - - { - {"bonjour_name", PGC_POSTMASTER, CONN_AUTH_SETTINGS, - gettext_noop("Sets the Bonjour service name."), - NULL - }, - &bonjour_name, - "", - NULL, NULL, NULL - }, - - /* See main.c about why defaults for LC_foo are not all alike */ - - { - {"lc_collate", PGC_INTERNAL, CLIENT_CONN_LOCALE, - gettext_noop("Shows the collation order locale."), - NULL, - GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &locale_collate, - "C", - NULL, NULL, NULL - }, - - { - {"lc_ctype", PGC_INTERNAL, CLIENT_CONN_LOCALE, - gettext_noop("Shows the character classification and case conversion locale."), - NULL, - GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &locale_ctype, - "C", - NULL, NULL, NULL - }, - - { - {"lc_messages", PGC_SUSET, CLIENT_CONN_LOCALE, - gettext_noop("Sets the language in which messages are displayed."), - NULL - }, - &locale_messages, - "", - check_locale_messages, assign_locale_messages, NULL - }, - - { - {"lc_monetary", PGC_USERSET, CLIENT_CONN_LOCALE, - gettext_noop("Sets the locale for formatting monetary amounts."), - NULL - }, - &locale_monetary, - "C", - check_locale_monetary, assign_locale_monetary, NULL - }, - - { - {"lc_numeric", PGC_USERSET, CLIENT_CONN_LOCALE, - gettext_noop("Sets the locale for formatting numbers."), - NULL - }, - &locale_numeric, - "C", - check_locale_numeric, assign_locale_numeric, NULL - }, - - { - {"lc_time", PGC_USERSET, CLIENT_CONN_LOCALE, - gettext_noop("Sets the locale for formatting date and time values."), - NULL - }, - &locale_time, - "C", - check_locale_time, assign_locale_time, NULL - }, - - { - {"session_preload_libraries", PGC_SUSET, CLIENT_CONN_PRELOAD, - gettext_noop("Lists shared libraries to preload into each backend."), - NULL, - GUC_LIST_INPUT | GUC_LIST_QUOTE | GUC_SUPERUSER_ONLY - }, - &session_preload_libraries_string, - "", - NULL, NULL, NULL - }, - - { - {"shared_preload_libraries", PGC_POSTMASTER, CLIENT_CONN_PRELOAD, - gettext_noop("Lists shared libraries to preload into server."), - NULL, - GUC_LIST_INPUT | GUC_LIST_QUOTE | GUC_SUPERUSER_ONLY - }, - &shared_preload_libraries_string, - "", - NULL, NULL, NULL - }, - - { - {"local_preload_libraries", PGC_USERSET, CLIENT_CONN_PRELOAD, - gettext_noop("Lists unprivileged shared libraries to preload into each backend."), - NULL, - GUC_LIST_INPUT | GUC_LIST_QUOTE - }, - &local_preload_libraries_string, - "", - NULL, NULL, NULL - }, - - { - {"search_path", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the schema search order for names that are not schema-qualified."), - NULL, - GUC_LIST_INPUT | GUC_LIST_QUOTE | GUC_EXPLAIN - }, - &namespace_search_path, - "\"$user\", public", - check_search_path, assign_search_path, NULL - }, - - { - /* Can't be set in postgresql.conf */ - {"server_encoding", PGC_INTERNAL, CLIENT_CONN_LOCALE, - gettext_noop("Sets the server (database) character set encoding."), - NULL, - GUC_IS_NAME | GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &server_encoding_string, - "SQL_ASCII", - NULL, NULL, NULL - }, - - { - /* Can't be set in postgresql.conf */ - {"server_version", PGC_INTERNAL, PRESET_OPTIONS, - gettext_noop("Shows the server version."), - NULL, - GUC_REPORT | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &server_version_string, - PG_VERSION, - NULL, NULL, NULL - }, - - { - /* Not for general use --- used by SET ROLE */ - {"role", PGC_USERSET, UNGROUPED, - gettext_noop("Sets the current role."), - NULL, - GUC_IS_NAME | GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_NOT_WHILE_SEC_REST - }, - &role_string, - "none", - check_role, assign_role, show_role - }, - - { - /* Not for general use --- used by SET SESSION AUTHORIZATION */ - {"session_authorization", PGC_USERSET, UNGROUPED, - gettext_noop("Sets the session user name."), - NULL, - GUC_IS_NAME | GUC_REPORT | GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE | GUC_NOT_WHILE_SEC_REST - }, - &session_authorization_string, - NULL, - check_session_authorization, assign_session_authorization, NULL - }, - - { - {"log_destination", PGC_SIGHUP, LOGGING_WHERE, - gettext_noop("Sets the destination for server log output."), - gettext_noop("Valid values are combinations of \"stderr\", " - "\"syslog\", \"csvlog\", and \"eventlog\", " - "depending on the platform."), - GUC_LIST_INPUT - }, - &Log_destination_string, - "stderr", - check_log_destination, assign_log_destination, NULL - }, - { - {"log_directory", PGC_SIGHUP, LOGGING_WHERE, - gettext_noop("Sets the destination directory for log files."), - gettext_noop("Can be specified as relative to the data directory " - "or as absolute path."), - GUC_SUPERUSER_ONLY - }, - &Log_directory, - "log", - check_canonical_path, NULL, NULL - }, - { - {"log_filename", PGC_SIGHUP, LOGGING_WHERE, - gettext_noop("Sets the file name pattern for log files."), - NULL, - GUC_SUPERUSER_ONLY - }, - &Log_filename, - "postgresql-%Y-%m-%d_%H%M%S.log", - NULL, NULL, NULL - }, - - { - {"syslog_ident", PGC_SIGHUP, LOGGING_WHERE, - gettext_noop("Sets the program name used to identify PostgreSQL " - "messages in syslog."), - NULL - }, - &syslog_ident_str, - "postgres", - NULL, assign_syslog_ident, NULL - }, - - { - {"event_source", PGC_POSTMASTER, LOGGING_WHERE, - gettext_noop("Sets the application name used to identify " - "PostgreSQL messages in the event log."), - NULL - }, - &event_source, - DEFAULT_EVENT_SOURCE, - NULL, NULL, NULL - }, - - { - {"TimeZone", PGC_USERSET, CLIENT_CONN_LOCALE, - gettext_noop("Sets the time zone for displaying and interpreting time stamps."), - NULL, - GUC_REPORT - }, - &timezone_string, - "GMT", - check_timezone, assign_timezone, show_timezone - }, - { - {"timezone_abbreviations", PGC_USERSET, CLIENT_CONN_LOCALE, - gettext_noop("Selects a file of time zone abbreviations."), - NULL - }, - &timezone_abbreviations_string, - NULL, - check_timezone_abbreviations, assign_timezone_abbreviations, NULL - }, - - { - {"unix_socket_group", PGC_POSTMASTER, CONN_AUTH_SETTINGS, - gettext_noop("Sets the owning group of the Unix-domain socket."), - gettext_noop("The owning user of the socket is always the user " - "that starts the server.") - }, - &Unix_socket_group, - "", - NULL, NULL, NULL - }, - - { - {"unix_socket_directories", PGC_POSTMASTER, CONN_AUTH_SETTINGS, - gettext_noop("Sets the directories where Unix-domain sockets will be created."), - NULL, - GUC_SUPERUSER_ONLY - }, - &Unix_socket_directories, -#ifdef HAVE_UNIX_SOCKETS - DEFAULT_PGSOCKET_DIR, -#else - "", -#endif - NULL, NULL, NULL - }, - - { - {"listen_addresses", PGC_POSTMASTER, CONN_AUTH_SETTINGS, - gettext_noop("Sets the host name or IP address(es) to listen to."), - NULL, - GUC_LIST_INPUT - }, - &ListenAddresses, - "localhost", - NULL, NULL, NULL - }, - - { - /* - * Can't be set by ALTER SYSTEM as it can lead to recursive definition - * of data_directory. - */ - {"data_directory", PGC_POSTMASTER, FILE_LOCATIONS, - gettext_noop("Sets the server's data directory."), - NULL, - GUC_SUPERUSER_ONLY | GUC_DISALLOW_IN_AUTO_FILE - }, - &data_directory, - NULL, - NULL, NULL, NULL - }, - - { - {"config_file", PGC_POSTMASTER, FILE_LOCATIONS, - gettext_noop("Sets the server's main configuration file."), - NULL, - GUC_DISALLOW_IN_FILE | GUC_SUPERUSER_ONLY - }, - &ConfigFileName, - NULL, - NULL, NULL, NULL - }, - - { - {"hba_file", PGC_POSTMASTER, FILE_LOCATIONS, - gettext_noop("Sets the server's \"hba\" configuration file."), - NULL, - GUC_SUPERUSER_ONLY - }, - &HbaFileName, - NULL, - NULL, NULL, NULL - }, - - { - {"ident_file", PGC_POSTMASTER, FILE_LOCATIONS, - gettext_noop("Sets the server's \"ident\" configuration file."), - NULL, - GUC_SUPERUSER_ONLY - }, - &IdentFileName, - NULL, - NULL, NULL, NULL - }, - - { - {"external_pid_file", PGC_POSTMASTER, FILE_LOCATIONS, - gettext_noop("Writes the postmaster PID to the specified file."), - NULL, - GUC_SUPERUSER_ONLY - }, - &external_pid_file, - NULL, - check_canonical_path, NULL, NULL - }, - - { - {"ssl_library", PGC_INTERNAL, PRESET_OPTIONS, - gettext_noop("Name of the SSL library."), - NULL, - GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &ssl_library, -#ifdef USE_SSL - "OpenSSL", -#else - "", -#endif - NULL, NULL, NULL - }, - - { - {"ssl_cert_file", PGC_SIGHUP, CONN_AUTH_SSL, - gettext_noop("Location of the SSL server certificate file."), - NULL - }, - &ssl_cert_file, - "server.crt", - NULL, NULL, NULL - }, - - { - {"ssl_key_file", PGC_SIGHUP, CONN_AUTH_SSL, - gettext_noop("Location of the SSL server private key file."), - NULL - }, - &ssl_key_file, - "server.key", - NULL, NULL, NULL - }, - - { - {"ssl_ca_file", PGC_SIGHUP, CONN_AUTH_SSL, - gettext_noop("Location of the SSL certificate authority file."), - NULL - }, - &ssl_ca_file, - "", - NULL, NULL, NULL - }, - - { - {"ssl_crl_file", PGC_SIGHUP, CONN_AUTH_SSL, - gettext_noop("Location of the SSL certificate revocation list file."), - NULL - }, - &ssl_crl_file, - "", - NULL, NULL, NULL - }, - - { - {"stats_temp_directory", PGC_SIGHUP, STATS_COLLECTOR, - gettext_noop("Writes temporary statistics files to the specified directory."), - NULL, - GUC_SUPERUSER_ONLY - }, - &pgstat_temp_directory, - PG_STAT_TMP_DIR, - check_canonical_path, assign_pgstat_temp_directory, NULL - }, - - { - {"synchronous_standby_names", PGC_SIGHUP, REPLICATION_MASTER, - gettext_noop("Number of synchronous standbys and list of names of potential synchronous ones."), - NULL, - GUC_LIST_INPUT - }, - &SyncRepStandbyNames, - "", - check_synchronous_standby_names, assign_synchronous_standby_names, NULL - }, - - { - {"default_text_search_config", PGC_USERSET, CLIENT_CONN_LOCALE, - gettext_noop("Sets default text search configuration."), - NULL - }, - &TSCurrentConfig, - "pg_catalog.simple", - check_TSCurrentConfig, assign_TSCurrentConfig, NULL - }, - - { - {"ssl_ciphers", PGC_SIGHUP, CONN_AUTH_SSL, - gettext_noop("Sets the list of allowed SSL ciphers."), - NULL, - GUC_SUPERUSER_ONLY - }, - &SSLCipherSuites, -#ifdef USE_OPENSSL - "HIGH:MEDIUM:+3DES:!aNULL", -#else - "none", -#endif - NULL, NULL, NULL - }, - - { - {"ssl_ecdh_curve", PGC_SIGHUP, CONN_AUTH_SSL, - gettext_noop("Sets the curve to use for ECDH."), - NULL, - GUC_SUPERUSER_ONLY - }, - &SSLECDHCurve, -#ifdef USE_SSL - "prime256v1", -#else - "none", -#endif - NULL, NULL, NULL - }, - - { - {"ssl_dh_params_file", PGC_SIGHUP, CONN_AUTH_SSL, - gettext_noop("Location of the SSL DH parameters file."), - NULL, - GUC_SUPERUSER_ONLY - }, - &ssl_dh_params_file, - "", - NULL, NULL, NULL - }, - - { - {"ssl_passphrase_command", PGC_SIGHUP, CONN_AUTH_SSL, - gettext_noop("Command to obtain passphrases for SSL."), - NULL, - GUC_SUPERUSER_ONLY - }, - &ssl_passphrase_command, - "", - NULL, NULL, NULL - }, - - { - {"application_name", PGC_USERSET, LOGGING_WHAT, - gettext_noop("Sets the application name to be reported in statistics and logs."), - NULL, - GUC_IS_NAME | GUC_REPORT | GUC_NOT_IN_SAMPLE - }, - &application_name, - "", - check_application_name, assign_application_name, NULL - }, - - { - {"cluster_name", PGC_POSTMASTER, PROCESS_TITLE, - gettext_noop("Sets the name of the cluster, which is included in the process title."), - NULL, - GUC_IS_NAME - }, - &cluster_name, - "", - check_cluster_name, NULL, NULL - }, - - { - {"wal_consistency_checking", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("Sets the WAL resource managers for which WAL consistency checks are done."), - gettext_noop("Full-page images will be logged for all data blocks and cross-checked against the results of WAL replay."), - GUC_LIST_INPUT | GUC_NOT_IN_SAMPLE - }, - &wal_consistency_checking_string, - "", - check_wal_consistency_checking, assign_wal_consistency_checking, NULL - }, - - { - {"jit_provider", PGC_POSTMASTER, CLIENT_CONN_PRELOAD, - gettext_noop("JIT provider to use."), - NULL, - GUC_SUPERUSER_ONLY - }, - &jit_provider, - "llvmjit", - NULL, NULL, NULL - }, - - { - {"backtrace_functions", PGC_SUSET, DEVELOPER_OPTIONS, - gettext_noop("Log backtrace for errors in these functions."), - NULL, - GUC_NOT_IN_SAMPLE - }, - &backtrace_functions, - "", - check_backtrace_functions, assign_backtrace_functions, NULL - }, - - /* End-of-list marker */ - { - {NULL, 0, 0, NULL, NULL}, NULL, NULL, NULL, NULL, NULL - } }; static struct config_enum ConfigureNamesEnum[] = { - { - {"backslash_quote", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS, - gettext_noop("Sets whether \"\\'\" is allowed in string literals."), - NULL - }, - &backslash_quote, - BACKSLASH_QUOTE_SAFE_ENCODING, backslash_quote_options, - NULL, NULL, NULL - }, - - { - {"bytea_output", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the output format for bytea."), - NULL - }, - &bytea_output, - BYTEA_OUTPUT_HEX, bytea_output_options, - NULL, NULL, NULL - }, - - { - {"client_min_messages", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the message levels that are sent to the client."), - gettext_noop("Each level includes all the levels that follow it. The later" - " the level, the fewer messages are sent.") - }, - &client_min_messages, - NOTICE, client_message_level_options, - NULL, NULL, NULL - }, - - { - {"constraint_exclusion", PGC_USERSET, QUERY_TUNING_OTHER, - gettext_noop("Enables the planner to use constraints to optimize queries."), - gettext_noop("Table scans will be skipped if their constraints" - " guarantee that no rows match the query."), - GUC_EXPLAIN - }, - &constraint_exclusion, - CONSTRAINT_EXCLUSION_PARTITION, constraint_exclusion_options, - NULL, NULL, NULL - }, - - { - {"default_transaction_isolation", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the transaction isolation level of each new transaction."), - NULL - }, - &DefaultXactIsoLevel, - XACT_READ_COMMITTED, isolation_level_options, - NULL, NULL, NULL - }, - - { - {"transaction_isolation", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the current transaction's isolation level."), - NULL, - GUC_NO_RESET_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE - }, - &XactIsoLevel, - XACT_READ_COMMITTED, isolation_level_options, - check_XactIsoLevel, NULL, NULL - }, - - { - {"IntervalStyle", PGC_USERSET, CLIENT_CONN_LOCALE, - gettext_noop("Sets the display format for interval values."), - NULL, - GUC_REPORT - }, - &IntervalStyle, - INTSTYLE_POSTGRES, intervalstyle_options, - NULL, NULL, NULL - }, - - { - {"log_error_verbosity", PGC_SUSET, LOGGING_WHAT, - gettext_noop("Sets the verbosity of logged messages."), - NULL - }, - &Log_error_verbosity, - PGERROR_DEFAULT, log_error_verbosity_options, - NULL, NULL, NULL - }, - - { - {"log_min_messages", PGC_SUSET, LOGGING_WHEN, - gettext_noop("Sets the message levels that are logged."), - gettext_noop("Each level includes all the levels that follow it. The later" - " the level, the fewer messages are sent.") - }, - &log_min_messages, - WARNING, server_message_level_options, - NULL, NULL, NULL - }, - - { - {"log_min_error_statement", PGC_SUSET, LOGGING_WHEN, - gettext_noop("Causes all statements generating error at or above this level to be logged."), - gettext_noop("Each level includes all the levels that follow it. The later" - " the level, the fewer messages are sent.") - }, - &log_min_error_statement, - ERROR, server_message_level_options, - NULL, NULL, NULL - }, - - { - {"log_statement", PGC_SUSET, LOGGING_WHAT, - gettext_noop("Sets the type of statements logged."), - NULL - }, - &log_statement, - LOGSTMT_NONE, log_statement_options, - NULL, NULL, NULL - }, - - { - {"syslog_facility", PGC_SIGHUP, LOGGING_WHERE, - gettext_noop("Sets the syslog \"facility\" to be used when syslog enabled."), - NULL - }, - &syslog_facility, -#ifdef HAVE_SYSLOG - LOG_LOCAL0, -#else - 0, -#endif - syslog_facility_options, - NULL, assign_syslog_facility, NULL - }, - - { - {"session_replication_role", PGC_SUSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets the session's behavior for triggers and rewrite rules."), - NULL - }, - &SessionReplicationRole, - SESSION_REPLICATION_ROLE_ORIGIN, session_replication_role_options, - NULL, assign_session_replication_role, NULL - }, - - { - {"synchronous_commit", PGC_USERSET, WAL_SETTINGS, - gettext_noop("Sets the current transaction's synchronization level."), - NULL - }, - &synchronous_commit, - SYNCHRONOUS_COMMIT_ON, synchronous_commit_options, - NULL, assign_synchronous_commit, NULL - }, - - { - {"archive_mode", PGC_POSTMASTER, WAL_ARCHIVING, - gettext_noop("Allows archiving of WAL files using archive_command."), - NULL - }, - &XLogArchiveMode, - ARCHIVE_MODE_OFF, archive_mode_options, - NULL, NULL, NULL - }, - - { - {"recovery_target_action", PGC_POSTMASTER, WAL_RECOVERY_TARGET, - gettext_noop("Sets the action to perform upon reaching the recovery target."), - NULL - }, - &recoveryTargetAction, - RECOVERY_TARGET_ACTION_PAUSE, recovery_target_action_options, - NULL, NULL, NULL - }, - - { - {"trace_recovery_messages", PGC_SIGHUP, DEVELOPER_OPTIONS, - gettext_noop("Enables logging of recovery-related debugging information."), - gettext_noop("Each level includes all the levels that follow it. The later" - " the level, the fewer messages are sent.") - }, - &trace_recovery_messages, - - /* - * client_message_level_options allows too many values, really, but - * it's not worth having a separate options array for this. - */ - LOG, client_message_level_options, - NULL, NULL, NULL - }, - - { - {"track_functions", PGC_SUSET, STATS_COLLECTOR, - gettext_noop("Collects function-level statistics on database activity."), - NULL - }, - &pgstat_track_functions, - TRACK_FUNC_OFF, track_function_options, - NULL, NULL, NULL - }, - - { - {"wal_level", PGC_POSTMASTER, WAL_SETTINGS, - gettext_noop("Set the level of information written to the WAL."), - NULL - }, - &wal_level, - WAL_LEVEL_REPLICA, wal_level_options, - NULL, NULL, NULL - }, - - { - {"dynamic_shared_memory_type", PGC_POSTMASTER, RESOURCES_MEM, - gettext_noop("Selects the dynamic shared memory implementation used."), - NULL - }, - &dynamic_shared_memory_type, - DEFAULT_DYNAMIC_SHARED_MEMORY_TYPE, dynamic_shared_memory_options, - NULL, NULL, NULL - }, - - { - {"shared_memory_type", PGC_POSTMASTER, RESOURCES_MEM, - gettext_noop("Selects the shared memory implementation used for the main shared memory region."), - NULL - }, - &shared_memory_type, - DEFAULT_SHARED_MEMORY_TYPE, shared_memory_options, - NULL, NULL, NULL - }, - - { - {"wal_sync_method", PGC_SIGHUP, WAL_SETTINGS, - gettext_noop("Selects the method used for forcing WAL updates to disk."), - NULL - }, - &sync_method, - DEFAULT_SYNC_METHOD, sync_method_options, - NULL, assign_xlog_sync_method, NULL - }, - - { - {"xmlbinary", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets how binary values are to be encoded in XML."), - NULL - }, - &xmlbinary, - XMLBINARY_BASE64, xmlbinary_options, - NULL, NULL, NULL - }, - - { - {"xmloption", PGC_USERSET, CLIENT_CONN_STATEMENT, - gettext_noop("Sets whether XML data in implicit parsing and serialization " - "operations is to be considered as documents or content fragments."), - NULL - }, - &xmloption, - XMLOPTION_CONTENT, xmloption_options, - NULL, NULL, NULL - }, - - { - {"huge_pages", PGC_POSTMASTER, RESOURCES_MEM, - gettext_noop("Use of huge pages on Linux or Windows."), - NULL - }, - &huge_pages, - HUGE_PAGES_TRY, huge_pages_options, - NULL, NULL, NULL - }, - - { - {"force_parallel_mode", PGC_USERSET, QUERY_TUNING_OTHER, - gettext_noop("Forces use of parallel query facilities."), - gettext_noop("If possible, run query using a parallel worker and with parallel restrictions."), - GUC_EXPLAIN - }, - &force_parallel_mode, - FORCE_PARALLEL_OFF, force_parallel_mode_options, - NULL, NULL, NULL - }, - - { - {"password_encryption", PGC_USERSET, CONN_AUTH_AUTH, - gettext_noop("Chooses the algorithm for encrypting passwords."), - NULL - }, - &Password_encryption, - PASSWORD_TYPE_MD5, password_encryption_options, - NULL, NULL, NULL - }, - - { - {"plan_cache_mode", PGC_USERSET, QUERY_TUNING_OTHER, - gettext_noop("Controls the planner's selection of custom or generic plan."), - gettext_noop("Prepared statements can have custom and generic plans, and the planner " - "will attempt to choose which is better. This can be set to override " - "the default behavior."), - GUC_EXPLAIN - }, - &plan_cache_mode, - PLAN_CACHE_MODE_AUTO, plan_cache_mode_options, - NULL, NULL, NULL - }, - - { - {"ssl_min_protocol_version", PGC_SIGHUP, CONN_AUTH_SSL, - gettext_noop("Sets the minimum SSL/TLS protocol version to use."), - NULL, - GUC_SUPERUSER_ONLY - }, - &ssl_min_protocol_version, - PG_TLS1_2_VERSION, - ssl_protocol_versions_info + 1, /* don't allow PG_TLS_ANY */ - NULL, NULL, NULL - }, - - { - {"ssl_max_protocol_version", PGC_SIGHUP, CONN_AUTH_SSL, - gettext_noop("Sets the maximum SSL/TLS protocol version to use."), - NULL, - GUC_SUPERUSER_ONLY - }, - &ssl_max_protocol_version, - PG_TLS_ANY, - ssl_protocol_versions_info, - NULL, NULL, NULL - }, - - /* End-of-list marker */ - { - {NULL, 0, 0, NULL, NULL}, NULL, 0, NULL, NULL, NULL, NULL - } }; /******** end of options list ********/ @@ -4794,17 +975,17 @@ static const char *const map_old_guc_names[] = { static struct config_generic **guc_variables; /* Current number of variables contained in the vector */ -static int num_guc_variables; +static __thread int num_guc_variables; /* Vector capacity */ -static int size_guc_variables; +static __thread int size_guc_variables; -static bool guc_dirty; /* true if need to do commit/abort work */ +static __thread bool guc_dirty; /* true if need to do commit/abort work */ -static bool reporting_enabled; /* true to enable GUC_REPORT */ +static __thread bool reporting_enabled; /* true to enable GUC_REPORT */ -static int GUCNestLevel = 0; /* 1 when in main transaction */ +static __thread int GUCNestLevel = 0; /* 1 when in main transaction */ static int guc_var_compare(const void *a, const void *b); @@ -5057,84 +1238,6 @@ get_guc_variables(void) void build_guc_variables(void) { - int size_vars; - int num_vars = 0; - struct config_generic **guc_vars; - int i; - - for (i = 0; ConfigureNamesBool[i].gen.name; i++) - { - struct config_bool *conf = &ConfigureNamesBool[i]; - - /* Rather than requiring vartype to be filled in by hand, do this: */ - conf->gen.vartype = PGC_BOOL; - num_vars++; - } - - for (i = 0; ConfigureNamesInt[i].gen.name; i++) - { - struct config_int *conf = &ConfigureNamesInt[i]; - - conf->gen.vartype = PGC_INT; - num_vars++; - } - - for (i = 0; ConfigureNamesReal[i].gen.name; i++) - { - struct config_real *conf = &ConfigureNamesReal[i]; - - conf->gen.vartype = PGC_REAL; - num_vars++; - } - - for (i = 0; ConfigureNamesString[i].gen.name; i++) - { - struct config_string *conf = &ConfigureNamesString[i]; - - conf->gen.vartype = PGC_STRING; - num_vars++; - } - - for (i = 0; ConfigureNamesEnum[i].gen.name; i++) - { - struct config_enum *conf = &ConfigureNamesEnum[i]; - - conf->gen.vartype = PGC_ENUM; - num_vars++; - } - - /* - * Create table with 20% slack - */ - size_vars = num_vars + num_vars / 4; - - guc_vars = (struct config_generic **) - guc_malloc(FATAL, size_vars * sizeof(struct config_generic *)); - - num_vars = 0; - - for (i = 0; ConfigureNamesBool[i].gen.name; i++) - guc_vars[num_vars++] = &ConfigureNamesBool[i].gen; - - for (i = 0; ConfigureNamesInt[i].gen.name; i++) - guc_vars[num_vars++] = &ConfigureNamesInt[i].gen; - - for (i = 0; ConfigureNamesReal[i].gen.name; i++) - guc_vars[num_vars++] = &ConfigureNamesReal[i].gen; - - for (i = 0; ConfigureNamesString[i].gen.name; i++) - guc_vars[num_vars++] = &ConfigureNamesString[i].gen; - - for (i = 0; ConfigureNamesEnum[i].gen.name; i++) - guc_vars[num_vars++] = &ConfigureNamesEnum[i].gen; - - if (guc_variables) - free(guc_variables); - guc_variables = guc_vars; - num_guc_variables = num_vars; - size_guc_variables = size_vars; - qsort((void *) guc_variables, num_guc_variables, - sizeof(struct config_generic *), guc_var_compare); } /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/ps_status.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/ps_status.c index 1e8596e664..885b94f171 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/ps_status.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/ps_status.c @@ -33,7 +33,7 @@ #include "utils/ps_status.h" extern char **environ; -bool update_process_title = true; +__thread bool update_process_title = true; /* @@ -96,21 +96,21 @@ bool update_process_title = true; /* all but one option need a buffer to write their ps line in */ #define PS_BUFFER_SIZE 256 static char ps_buffer[PS_BUFFER_SIZE]; -static const size_t ps_buffer_size = PS_BUFFER_SIZE; +static __thread const size_t ps_buffer_size = PS_BUFFER_SIZE; #else /* PS_USE_CLOBBER_ARGV */ static char *ps_buffer; /* will point to argv area */ -static size_t ps_buffer_size; /* space determined at run time */ -static size_t last_status_len; /* use to minimize length of clobber */ +static __thread size_t ps_buffer_size; /* space determined at run time */ +static __thread size_t last_status_len; /* use to minimize length of clobber */ #endif /* PS_USE_CLOBBER_ARGV */ static size_t ps_buffer_cur_len; /* nominal strlen(ps_buffer) */ -static size_t ps_buffer_fixed_size; /* size of the constant prefix */ +static __thread size_t ps_buffer_fixed_size; /* size of the constant prefix */ #endif /* not PS_USE_NONE */ /* save the original argv[] location here */ -static int save_argc; +static __thread int save_argc; static char **save_argv; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/sampling.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/sampling.c index 361c15614e..f8cb2079ee 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/sampling.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/sampling.c @@ -260,7 +260,7 @@ sampler_random_fract(SamplerRandomState randstate) * sampler_random_fract/reservoir_init_selection_state/reservoir_get_next_S, * except that a common random state is used across all callers. */ -static ReservoirStateData oldrs; +static __thread ReservoirStateData oldrs; double anl_random_fract(void) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/superuser.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/superuser.c index 203a146390..642220bf39 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/superuser.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/superuser.c @@ -32,9 +32,9 @@ * the status of the last requested roleid. The cache can be flushed * at need by watching for cache update events on pg_authid. */ -static Oid last_roleid = InvalidOid; /* InvalidOid == cache not valid */ -static bool last_roleid_is_super = false; -static bool roleid_callback_registered = false; +static __thread Oid last_roleid = InvalidOid; /* InvalidOid == cache not valid */ +static __thread bool last_roleid_is_super = false; +static __thread bool roleid_callback_registered = false; static void RoleidCallback(Datum arg, int cacheid, uint32 hashvalue); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/timeout.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/timeout.c index f1c9518b0c..5e38a3ef84 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/timeout.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/misc/timeout.c @@ -42,13 +42,13 @@ typedef struct timeout_params * List of possible timeout reasons in the order of enum TimeoutId. */ static timeout_params all_timeouts[MAX_TIMEOUTS]; -static bool all_timeouts_initialized = false; +static __thread bool all_timeouts_initialized = false; /* * List of active timeouts ordered by their fin_time and priority. * This list is subject to change by the interrupt handler, so it's volatile. */ -static volatile int num_active_timeouts = 0; +static __thread volatile int num_active_timeouts = 0; static timeout_params *volatile active_timeouts[MAX_TIMEOUTS]; /* @@ -60,7 +60,7 @@ static timeout_params *volatile active_timeouts[MAX_TIMEOUTS]; * since the probability of the interrupt actually occurring while we have * it disabled is low. See comments in schedule_alarm() about that. */ -static volatile sig_atomic_t alarm_enabled = false; +static __thread volatile sig_atomic_t alarm_enabled = false; #define disable_alarm() (alarm_enabled = false) #define enable_alarm() (alarm_enabled = true) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/mmgr/mcxt.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/mmgr/mcxt.c index abda22fa57..38bd0a2d4f 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/mmgr/mcxt.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/mmgr/mcxt.c @@ -35,22 +35,22 @@ * CurrentMemoryContext * Default memory context for allocations. */ -MemoryContext CurrentMemoryContext = NULL; +__thread MemoryContext CurrentMemoryContext = NULL; /* * Standard top-level contexts. For a description of the purpose of each * of these contexts, refer to src/backend/utils/mmgr/README */ -MemoryContext TopMemoryContext = NULL; -MemoryContext ErrorContext = NULL; -MemoryContext PostmasterContext = NULL; -MemoryContext CacheMemoryContext = NULL; -MemoryContext MessageContext = NULL; -MemoryContext TopTransactionContext = NULL; -MemoryContext CurTransactionContext = NULL; +__thread MemoryContext TopMemoryContext = NULL; +__thread MemoryContext ErrorContext = NULL; +__thread MemoryContext PostmasterContext = NULL; +__thread MemoryContext CacheMemoryContext = NULL; +__thread MemoryContext MessageContext = NULL; +__thread MemoryContext TopTransactionContext = NULL; +__thread MemoryContext CurTransactionContext = NULL; /* This is a transient link to the active portal's memory context: */ -MemoryContext PortalContext = NULL; +__thread MemoryContext PortalContext = NULL; static void MemoryContextCallResetCallbacks(MemoryContext context); static void MemoryContextStatsInternal(MemoryContext context, int level, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/mmgr/portalmem.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/mmgr/portalmem.c index 11ee752f84..f768790e61 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/mmgr/portalmem.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/mmgr/portalmem.c @@ -88,7 +88,7 @@ do { \ elog(WARNING, "trying to delete portal name that does not exist"); \ } while(0) -static MemoryContext TopPortalContext = NULL; +static __thread MemoryContext TopPortalContext = NULL; /* ---------------------------------------------------------------- diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/resowner/resowner.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/resowner/resowner.c index 8bc2c4e9ea..8a50fb3349 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/resowner/resowner.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/resowner/resowner.c @@ -139,10 +139,10 @@ typedef struct ResourceOwnerData * GLOBAL MEMORY * *****************************************************************************/ -ResourceOwner CurrentResourceOwner = NULL; -ResourceOwner CurTransactionResourceOwner = NULL; -ResourceOwner TopTransactionResourceOwner = NULL; -ResourceOwner AuxProcessResourceOwner = NULL; +__thread ResourceOwner CurrentResourceOwner = NULL; +__thread ResourceOwner CurTransactionResourceOwner = NULL; +__thread ResourceOwner TopTransactionResourceOwner = NULL; +__thread ResourceOwner AuxProcessResourceOwner = NULL; /* * List of add-on callbacks for resource releasing diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/sort/tuplesort.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/sort/tuplesort.c index 98d68a143d..87d4d349d4 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/sort/tuplesort.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/sort/tuplesort.c @@ -137,7 +137,7 @@ /* GUC variables */ #ifdef TRACE_SORT -bool trace_sort = false; +__thread bool trace_sort = false; #endif #ifdef DEBUG_BOUNDED_SORT diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/time/combocid.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/time/combocid.c index 4ee9ef0ffe..287dffde41 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/time/combocid.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/time/combocid.c @@ -77,9 +77,9 @@ typedef ComboCidEntryData *ComboCidEntry; * An array of cmin,cmax pairs, indexed by combo command id. * To convert a combo cid to cmin and cmax, you do a simple array lookup. */ -static ComboCidKey comboCids = NULL; -static int usedComboCids = 0; /* number of elements in comboCids */ -static int sizeComboCids = 0; /* allocated size of array */ +static __thread ComboCidKey comboCids = NULL; +static __thread int usedComboCids = 0; /* number of elements in comboCids */ +static __thread int sizeComboCids = 0; /* allocated size of array */ /* Initial size of the array */ #define CCID_ARRAY_SIZE 100 diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/time/snapmgr.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/time/snapmgr.c index 1c960300fd..215ce42a01 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/time/snapmgr.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/backend/utils/time/snapmgr.c @@ -72,7 +72,7 @@ /* * GUC parameters */ -int old_snapshot_threshold; /* number of minutes, -1 disables */ +__thread int old_snapshot_threshold; /* number of minutes, -1 disables */ /* * Structure for dealing with old_snapshot_threshold implementation. @@ -141,17 +141,17 @@ static volatile OldSnapshotControlData *oldSnapshotControl; * These SnapshotData structs are static to simplify memory allocation * (see the hack in GetSnapshotData to avoid repeated malloc/free). */ -static SnapshotData CurrentSnapshotData = {SNAPSHOT_MVCC}; -static SnapshotData SecondarySnapshotData = {SNAPSHOT_MVCC}; -SnapshotData CatalogSnapshotData = {SNAPSHOT_MVCC}; -SnapshotData SnapshotSelfData = {SNAPSHOT_SELF}; -SnapshotData SnapshotAnyData = {SNAPSHOT_ANY}; +static __thread SnapshotData CurrentSnapshotData = {SNAPSHOT_MVCC}; +static __thread SnapshotData SecondarySnapshotData = {SNAPSHOT_MVCC}; +__thread SnapshotData CatalogSnapshotData = {SNAPSHOT_MVCC}; +__thread SnapshotData SnapshotSelfData = {SNAPSHOT_SELF}; +__thread SnapshotData SnapshotAnyData = {SNAPSHOT_ANY}; /* Pointers to valid snapshots */ -static Snapshot CurrentSnapshot = NULL; -static Snapshot SecondarySnapshot = NULL; -static Snapshot CatalogSnapshot = NULL; -static Snapshot HistoricSnapshot = NULL; +static __thread Snapshot CurrentSnapshot = NULL; +static __thread Snapshot SecondarySnapshot = NULL; +static __thread Snapshot CatalogSnapshot = NULL; +static __thread Snapshot HistoricSnapshot = NULL; /* * These are updated by GetSnapshotData. We initialize them this way @@ -163,10 +163,10 @@ static Snapshot HistoricSnapshot = NULL; * value. Readers should ensure that it has been set to something else * before using it. */ -TransactionId TransactionXmin = FirstNormalTransactionId; -TransactionId RecentXmin = FirstNormalTransactionId; -TransactionId RecentGlobalXmin = InvalidTransactionId; -TransactionId RecentGlobalDataXmin = InvalidTransactionId; +__thread TransactionId TransactionXmin = FirstNormalTransactionId; +__thread TransactionId RecentXmin = FirstNormalTransactionId; +__thread TransactionId RecentGlobalXmin = InvalidTransactionId; +__thread TransactionId RecentGlobalDataXmin = InvalidTransactionId; /* (table, ctid) => (cmin, cmax) mapping during timetravel */ static HTAB *tuplecid_data = NULL; @@ -199,17 +199,17 @@ static ActiveSnapshotElt *OldestActiveSnapshot = NULL; static int xmin_cmp(const pairingheap_node *a, const pairingheap_node *b, void *arg); -static pairingheap RegisteredSnapshots = {&xmin_cmp, NULL, NULL}; +static __thread pairingheap RegisteredSnapshots = {&xmin_cmp, NULL, NULL}; /* first GetTransactionSnapshot call in a transaction? */ -bool FirstSnapshotSet = false; +__thread bool FirstSnapshotSet = false; /* * Remember the serializable transaction snapshot, if any. We cannot trust * FirstSnapshotSet in combination with IsolationUsesXactSnapshot(), because * GUC may be reset before us, changing the value of IsolationUsesXactSnapshot. */ -static Snapshot FirstXactSnapshot = NULL; +static __thread Snapshot FirstXactSnapshot = NULL; /* Define pathname of exported-snapshot files */ #define SNAPSHOT_EXPORT_DIR "pg_snapshots" diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/common/file_perm.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/common/file_perm.c index 96b44dcc4d..90ff2ac122 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/common/file_perm.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/common/file_perm.c @@ -15,14 +15,14 @@ #include "common/file_perm.h" /* Modes for creating directories and files in the data directory */ -int pg_dir_create_mode = PG_DIR_MODE_OWNER; -int pg_file_create_mode = PG_FILE_MODE_OWNER; +__thread int pg_dir_create_mode = PG_DIR_MODE_OWNER; +__thread int pg_file_create_mode = PG_FILE_MODE_OWNER; /* * Mode mask to pass to umask(). This is more of a preventative measure since * all file/directory creates should be performed using the create modes above. */ -int pg_mode_mask = PG_MODE_MASK_OWNER; +__thread int pg_mode_mask = PG_MODE_MASK_OWNER; /* * Set create modes and mask to use when writing to PGDATA based on the data diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/common/jsonapi.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/common/jsonapi.c index dfc14335f0..222196fb2d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/common/jsonapi.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/common/jsonapi.c @@ -64,7 +64,7 @@ static JsonParseErrorType report_parse_error(JsonParseContext ctx, JsonLexContex static char *extract_token(JsonLexContext *lex); /* the null action object used for pure validation */ -JsonSemAction nullSemAction = +__thread JsonSemAction nullSemAction = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/commit_ts.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/commit_ts.h index 2740c02a84..9348ff274f 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/commit_ts.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/commit_ts.h @@ -17,7 +17,7 @@ #include "utils/guc.h" -extern PGDLLIMPORT bool track_commit_timestamp; +extern __thread PGDLLIMPORT bool track_commit_timestamp; extern bool check_track_commit_timestamp(bool *newval, void **extra, GucSource source); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/gin.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/gin.h index 990e8b3e4f..3b7fb263b9 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/gin.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/gin.h @@ -67,8 +67,8 @@ typedef char GinTernaryValue; #define PG_RETURN_GIN_TERNARY_VALUE(x) return GinTernaryValueGetDatum(x) /* GUC parameters */ -extern PGDLLIMPORT int GinFuzzySearchLimit; -extern int gin_pending_list_limit; +extern __thread PGDLLIMPORT int GinFuzzySearchLimit; +extern __thread int gin_pending_list_limit; /* ginutil.c */ extern void ginGetStats(Relation index, GinStatsData *stats); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/parallel.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/parallel.h index fc6a5603bb..13d1df30dd 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/parallel.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/parallel.h @@ -54,9 +54,9 @@ typedef struct ParallelWorkerContext shm_toc *toc; } ParallelWorkerContext; -extern volatile bool ParallelMessagePending; -extern PGDLLIMPORT int ParallelWorkerNumber; -extern PGDLLIMPORT bool InitializingParallelWorker; +extern __thread volatile bool ParallelMessagePending; +extern __thread PGDLLIMPORT int ParallelWorkerNumber; +extern __thread PGDLLIMPORT bool InitializingParallelWorker; #define IsParallelWorker() (ParallelWorkerNumber >= 0) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/tableam.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/tableam.h index 0d28f01ca9..8aa239f341 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/tableam.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/tableam.h @@ -28,7 +28,7 @@ /* GUCs */ extern char *default_table_access_method; -extern bool synchronize_seqscans; +extern __thread bool synchronize_seqscans; struct BulkInsertStateData; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/transam.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/transam.h index a91a0c7487..0139dd6217 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/transam.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/transam.h @@ -215,7 +215,7 @@ typedef VariableCacheData *VariableCache; extern bool TransactionStartedDuringRecovery(void); /* in transam/varsup.c */ -extern PGDLLIMPORT VariableCache ShmemVariableCache; +extern __thread PGDLLIMPORT VariableCache ShmemVariableCache; /* * prototypes for functions in transam/transam.c diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/twophase.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/twophase.h index 9e2125f56f..dba28e5cc7 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/twophase.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/twophase.h @@ -26,7 +26,7 @@ typedef struct GlobalTransactionData *GlobalTransaction; /* GUC variable */ -extern PGDLLIMPORT int max_prepared_xacts; +extern __thread PGDLLIMPORT int max_prepared_xacts; extern Size TwoPhaseShmemSize(void); extern void TwoPhaseShmemInit(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/xact.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/xact.h index 3c66119d94..afb0a5ada4 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/xact.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/xact.h @@ -38,8 +38,8 @@ #define XACT_REPEATABLE_READ 2 #define XACT_SERIALIZABLE 3 -extern int DefaultXactIsoLevel; -extern PGDLLIMPORT int XactIsoLevel; +extern __thread int DefaultXactIsoLevel; +extern __thread PGDLLIMPORT int XactIsoLevel; /* * We implement three isolation levels internally. @@ -52,18 +52,18 @@ extern PGDLLIMPORT int XactIsoLevel; #define IsolationIsSerializable() (XactIsoLevel == XACT_SERIALIZABLE) /* Xact read-only state */ -extern bool DefaultXactReadOnly; -extern bool XactReadOnly; +extern __thread bool DefaultXactReadOnly; +extern __thread bool XactReadOnly; /* flag for logging statements in this transaction */ -extern bool xact_is_sampled; +extern __thread bool xact_is_sampled; /* * Xact is deferrable -- only meaningful (currently) for read only * SERIALIZABLE transactions */ -extern bool DefaultXactDeferrable; -extern bool XactDeferrable; +extern __thread bool DefaultXactDeferrable; +extern __thread bool XactDeferrable; typedef enum { @@ -80,7 +80,7 @@ typedef enum #define SYNCHRONOUS_COMMIT_ON SYNCHRONOUS_COMMIT_REMOTE_FLUSH /* Synchronous commit level */ -extern int synchronous_commit; +extern __thread int synchronous_commit; /* * Miscellaneous flag bits to record events which occur on the top level @@ -89,7 +89,7 @@ extern int synchronous_commit; * globally accessible, so can be set from anywhere in the code which requires * recording flags. */ -extern int MyXactFlags; +extern __thread int MyXactFlags; /* * XACT_FLAGS_ACCESSEDTEMPNAMESPACE - set when a temporary object is accessed. diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/xlog.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/xlog.h index 01b3b0a767..94ddf4bdf4 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/xlog.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/xlog.h @@ -27,9 +27,9 @@ #define SYNC_METHOD_OPEN 2 /* for O_SYNC */ #define SYNC_METHOD_FSYNC_WRITETHROUGH 3 #define SYNC_METHOD_OPEN_DSYNC 4 /* for O_DSYNC */ -extern int sync_method; +extern __thread int sync_method; -extern PGDLLIMPORT TimeLineID ThisTimeLineID; /* current TLI */ +extern __thread PGDLLIMPORT TimeLineID ThisTimeLineID; /* current TLI */ /* * Prior to 8.4, all activity during recovery was carried out by the startup @@ -38,7 +38,7 @@ extern PGDLLIMPORT TimeLineID ThisTimeLineID; /* current TLI */ * potentially perform work during recovery should check RecoveryInProgress(). * See XLogCtl notes in xlog.c. */ -extern bool InRecovery; +extern __thread bool InRecovery; /* * Like InRecovery, standbyState is only valid in the startup process. @@ -69,7 +69,7 @@ typedef enum STANDBY_SNAPSHOT_READY } HotStandbyState; -extern HotStandbyState standbyState; +extern __thread HotStandbyState standbyState; #define InHotStandby (standbyState >= STANDBY_SNAPSHOT_PENDING) @@ -97,57 +97,57 @@ typedef enum RECOVERY_TARGET_TIMELINE_NUMERIC } RecoveryTargetTimeLineGoal; -extern XLogRecPtr ProcLastRecPtr; -extern XLogRecPtr XactLastRecEnd; -extern PGDLLIMPORT XLogRecPtr XactLastCommitEnd; +extern __thread XLogRecPtr ProcLastRecPtr; +extern __thread XLogRecPtr XactLastRecEnd; +extern __thread PGDLLIMPORT XLogRecPtr XactLastCommitEnd; -extern bool reachedConsistency; +extern __thread bool reachedConsistency; /* these variables are GUC parameters related to XLOG */ -extern int wal_segment_size; -extern int min_wal_size_mb; -extern int max_wal_size_mb; -extern int wal_keep_size_mb; -extern int max_slot_wal_keep_size_mb; -extern int XLOGbuffers; -extern int XLogArchiveTimeout; -extern int wal_retrieve_retry_interval; +extern __thread int wal_segment_size; +extern __thread int min_wal_size_mb; +extern __thread int max_wal_size_mb; +extern __thread int wal_keep_size_mb; +extern __thread int max_slot_wal_keep_size_mb; +extern __thread int XLOGbuffers; +extern __thread int XLogArchiveTimeout; +extern __thread int wal_retrieve_retry_interval; extern char *XLogArchiveCommand; -extern bool EnableHotStandby; -extern bool fullPageWrites; -extern bool wal_log_hints; -extern bool wal_compression; -extern bool wal_init_zero; -extern bool wal_recycle; +extern __thread bool EnableHotStandby; +extern __thread bool fullPageWrites; +extern __thread bool wal_log_hints; +extern __thread bool wal_compression; +extern __thread bool wal_init_zero; +extern __thread bool wal_recycle; extern bool *wal_consistency_checking; extern char *wal_consistency_checking_string; -extern bool log_checkpoints; +extern __thread bool log_checkpoints; extern char *recoveryRestoreCommand; extern char *recoveryEndCommand; extern char *archiveCleanupCommand; -extern bool recoveryTargetInclusive; -extern int recoveryTargetAction; -extern int recovery_min_apply_delay; +extern __thread bool recoveryTargetInclusive; +extern __thread int recoveryTargetAction; +extern __thread int recovery_min_apply_delay; extern char *PrimaryConnInfo; extern char *PrimarySlotName; -extern bool wal_receiver_create_temp_slot; +extern __thread bool wal_receiver_create_temp_slot; /* indirectly set via GUC system */ -extern TransactionId recoveryTargetXid; +extern __thread TransactionId recoveryTargetXid; extern char *recovery_target_time_string; extern const char *recoveryTargetName; -extern XLogRecPtr recoveryTargetLSN; -extern RecoveryTargetType recoveryTarget; +extern __thread XLogRecPtr recoveryTargetLSN; +extern __thread RecoveryTargetType recoveryTarget; extern char *PromoteTriggerFile; -extern RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal; -extern TimeLineID recoveryTargetTLIRequested; -extern TimeLineID recoveryTargetTLI; +extern __thread RecoveryTargetTimeLineGoal recoveryTargetTimeLineGoal; +extern __thread TimeLineID recoveryTargetTLIRequested; +extern __thread TimeLineID recoveryTargetTLI; -extern int CheckPointSegments; +extern __thread int CheckPointSegments; /* option set locally in startup process only when signal files exist */ -extern bool StandbyModeRequested; -extern bool StandbyMode; +extern __thread bool StandbyModeRequested; +extern __thread bool StandbyMode; /* Archive modes */ typedef enum ArchiveMode @@ -156,7 +156,7 @@ typedef enum ArchiveMode ARCHIVE_MODE_ON, /* enabled while server is running normally */ ARCHIVE_MODE_ALWAYS /* enabled always (even during recovery) */ } ArchiveMode; -extern int XLogArchiveMode; +extern __thread int XLogArchiveMode; /* WAL levels */ typedef enum WalLevel @@ -174,7 +174,7 @@ typedef enum RecoveryState RECOVERY_STATE_DONE /* currently in production */ } RecoveryState; -extern PGDLLIMPORT int wal_level; +extern __thread PGDLLIMPORT int wal_level; /* Is WAL archiving enabled (always or only while server is running normally)? */ #define XLogArchivingActive() \ @@ -262,7 +262,7 @@ typedef struct CheckpointStatsData * entire sync phase. */ } CheckpointStatsData; -extern CheckpointStatsData CheckpointStats; +extern __thread CheckpointStatsData CheckpointStats; /* * GetWALAvailability return codes diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/xlog_internal.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/xlog_internal.h index 51def851f0..c4c0280d9b 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/xlog_internal.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/access/xlog_internal.h @@ -331,9 +331,9 @@ extern void GetOldestRestartPoint(XLogRecPtr *oldrecptr, TimeLineID *oldtli); * Exported for the functions in timeline.c and xlogarchive.c. Only valid * in the startup process. */ -extern bool ArchiveRecoveryRequested; -extern bool InArchiveRecovery; -extern bool StandbyMode; +extern __thread bool ArchiveRecoveryRequested; +extern __thread bool InArchiveRecovery; +extern __thread bool StandbyMode; extern char *recoveryRestoreCommand; #endif /* XLOG_INTERNAL_H */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/bootstrap/bootstrap.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/bootstrap/bootstrap.h index b67fa9acc1..d2f6cf325c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/bootstrap/bootstrap.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/bootstrap/bootstrap.h @@ -27,9 +27,9 @@ #define BOOTCOL_NULL_FORCE_NULL 2 #define BOOTCOL_NULL_FORCE_NOT_NULL 3 -extern Relation boot_reldesc; +extern __thread Relation boot_reldesc; extern Form_pg_attribute attrtypes[MAXATTR]; -extern int numattr; +extern __thread int numattr; extern void AuxiliaryProcessMain(int argc, char *argv[]) pg_attribute_noreturn(); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/catalog/binary_upgrade.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/catalog/binary_upgrade.h index 12d94fe1b3..a680c5efb0 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/catalog/binary_upgrade.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/catalog/binary_upgrade.h @@ -14,17 +14,17 @@ #ifndef BINARY_UPGRADE_H #define BINARY_UPGRADE_H -extern PGDLLIMPORT Oid binary_upgrade_next_pg_type_oid; -extern PGDLLIMPORT Oid binary_upgrade_next_array_pg_type_oid; -extern PGDLLIMPORT Oid binary_upgrade_next_toast_pg_type_oid; +extern __thread PGDLLIMPORT Oid binary_upgrade_next_pg_type_oid; +extern __thread PGDLLIMPORT Oid binary_upgrade_next_array_pg_type_oid; +extern __thread PGDLLIMPORT Oid binary_upgrade_next_toast_pg_type_oid; -extern PGDLLIMPORT Oid binary_upgrade_next_heap_pg_class_oid; -extern PGDLLIMPORT Oid binary_upgrade_next_index_pg_class_oid; -extern PGDLLIMPORT Oid binary_upgrade_next_toast_pg_class_oid; +extern __thread PGDLLIMPORT Oid binary_upgrade_next_heap_pg_class_oid; +extern __thread PGDLLIMPORT Oid binary_upgrade_next_index_pg_class_oid; +extern __thread PGDLLIMPORT Oid binary_upgrade_next_toast_pg_class_oid; -extern PGDLLIMPORT Oid binary_upgrade_next_pg_enum_oid; -extern PGDLLIMPORT Oid binary_upgrade_next_pg_authid_oid; +extern __thread PGDLLIMPORT Oid binary_upgrade_next_pg_enum_oid; +extern __thread PGDLLIMPORT Oid binary_upgrade_next_pg_authid_oid; -extern PGDLLIMPORT bool binary_upgrade_record_init_privs; +extern __thread PGDLLIMPORT bool binary_upgrade_record_init_privs; #endif /* BINARY_UPGRADE_H */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/catalog/objectaccess.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/catalog/objectaccess.h index fef383692f..d8b244a187 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/catalog/objectaccess.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/catalog/objectaccess.h @@ -129,7 +129,7 @@ typedef void (*object_access_hook_type) (ObjectAccessType access, void *arg); /* Plugin sets this variable to a suitable hook function. */ -extern PGDLLIMPORT object_access_hook_type object_access_hook; +extern __thread PGDLLIMPORT object_access_hook_type object_access_hook; /* Core code uses these functions to call the hook (see macros below). */ extern void RunObjectPostCreateHook(Oid classId, Oid objectId, int subId, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/catalog/storage.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/catalog/storage.h index 30c38e0ca6..de95150811 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/catalog/storage.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/catalog/storage.h @@ -20,7 +20,7 @@ #include "utils/relcache.h" /* GUC variables */ -extern int wal_skip_threshold; +extern __thread int wal_skip_threshold; extern SMgrRelation RelationCreateStorage(RelFileNode rnode, char relpersistence); extern void RelationDropStorage(Relation rel); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/async.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/async.h index a54bebf221..bacc5beccd 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/async.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/async.h @@ -20,8 +20,8 @@ */ #define NUM_NOTIFY_BUFFERS 8 -extern bool Trace_notify; -extern volatile sig_atomic_t notifyInterruptPending; +extern __thread bool Trace_notify; +extern __thread volatile sig_atomic_t notifyInterruptPending; extern Size AsyncShmemSize(void); extern void AsyncShmemInit(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/explain.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/explain.h index ba661d32a6..ab7e9f8d05 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/explain.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/explain.h @@ -69,11 +69,11 @@ typedef void (*ExplainOneQuery_hook_type) (Query *query, const char *queryString, ParamListInfo params, QueryEnvironment *queryEnv); -extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook; +extern __thread PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook; /* Hook for plugins to get control in explain_get_index_name() */ typedef const char *(*explain_get_index_name_hook_type) (Oid indexId); -extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook; +extern __thread PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook; extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/extension.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/extension.h index 8b06df02a7..4449751180 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/extension.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/extension.h @@ -27,8 +27,8 @@ * scripts can drop member objects without having to explicitly dissociate * them from the extension first. */ -extern PGDLLIMPORT bool creating_extension; -extern PGDLLIMPORT Oid CurrentExtensionObject; +extern __thread PGDLLIMPORT bool creating_extension; +extern __thread PGDLLIMPORT Oid CurrentExtensionObject; extern ObjectAddress CreateExtension(ParseState *pstate, CreateExtensionStmt *stmt); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/trigger.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/trigger.h index 40b8154876..8e32cbeede 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/trigger.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/trigger.h @@ -147,7 +147,7 @@ typedef struct TransitionCaptureState #define SESSION_REPLICATION_ROLE_ORIGIN 0 #define SESSION_REPLICATION_ROLE_REPLICA 1 #define SESSION_REPLICATION_ROLE_LOCAL 2 -extern PGDLLIMPORT int SessionReplicationRole; +extern __thread PGDLLIMPORT int SessionReplicationRole; /* * States at which a trigger can be fired. These are the diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/user.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/user.h index 028e0dde56..269a6d2e4a 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/user.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/user.h @@ -17,12 +17,12 @@ #include "parser/parse_node.h" /* GUC. Is actually of type PasswordType. */ -extern int Password_encryption; +extern __thread int Password_encryption; /* Hook to check passwords in CreateRole() and AlterRole() */ typedef void (*check_password_hook_type) (const char *username, const char *shadow_pass, PasswordType password_type, Datum validuntil_time, bool validuntil_null); -extern PGDLLIMPORT check_password_hook_type check_password_hook; +extern __thread PGDLLIMPORT check_password_hook_type check_password_hook; extern Oid CreateRole(ParseState *pstate, CreateRoleStmt *stmt); extern Oid AlterRole(AlterRoleStmt *stmt); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/vacuum.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/vacuum.h index a4cd721400..0170d36b5d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/vacuum.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/commands/vacuum.h @@ -232,16 +232,16 @@ typedef struct VacuumParams } VacuumParams; /* GUC parameters */ -extern PGDLLIMPORT int default_statistics_target; /* PGDLLIMPORT for PostGIS */ -extern int vacuum_freeze_min_age; -extern int vacuum_freeze_table_age; -extern int vacuum_multixact_freeze_min_age; -extern int vacuum_multixact_freeze_table_age; +extern __thread PGDLLIMPORT int default_statistics_target; /* PGDLLIMPORT for PostGIS */ +extern __thread int vacuum_freeze_min_age; +extern __thread int vacuum_freeze_table_age; +extern __thread int vacuum_multixact_freeze_min_age; +extern __thread int vacuum_multixact_freeze_table_age; /* Variables for cost-based parallel vacuum */ extern pg_atomic_uint32 *VacuumSharedCostBalance; extern pg_atomic_uint32 *VacuumActiveNWorkers; -extern int VacuumCostBalanceLocal; +extern __thread int VacuumCostBalanceLocal; /* in commands/vacuum.c */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/common/file_perm.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/common/file_perm.h index d87881693c..59fe29ba22 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/common/file_perm.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/common/file_perm.h @@ -41,11 +41,11 @@ #define PG_FILE_MODE_GROUP (S_IRUSR | S_IWUSR | S_IRGRP) /* Modes for creating directories and files in the data directory */ -extern int pg_dir_create_mode; -extern int pg_file_create_mode; +extern __thread int pg_dir_create_mode; +extern __thread int pg_file_create_mode; /* Mode mask to pass to umask() */ -extern int pg_mode_mask; +extern __thread int pg_mode_mask; /* Set permissions and mask based on the provided mode */ extern void SetDataDirectoryCreatePerm(int dataDirMode); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/common/jsonapi.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/common/jsonapi.h index bcfd57cc53..2333d3be37 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/common/jsonapi.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/common/jsonapi.h @@ -128,7 +128,7 @@ extern JsonParseErrorType pg_parse_json(JsonLexContext *lex, JsonSemAction *sem); /* the null action object used for pure validation */ -extern JsonSemAction nullSemAction; +extern __thread JsonSemAction nullSemAction; /* * json_count_array_elements performs a fast secondary parse to determine the diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/executor/executor.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/executor/executor.h index 18f834fddc..9c796a560c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/executor/executor.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/executor/executor.h @@ -63,26 +63,26 @@ /* Hook for plugins to get control in ExecutorStart() */ typedef void (*ExecutorStart_hook_type) (QueryDesc *queryDesc, int eflags); -extern PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook; +extern __thread PGDLLIMPORT ExecutorStart_hook_type ExecutorStart_hook; /* Hook for plugins to get control in ExecutorRun() */ typedef void (*ExecutorRun_hook_type) (QueryDesc *queryDesc, ScanDirection direction, uint64 count, bool execute_once); -extern PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook; +extern __thread PGDLLIMPORT ExecutorRun_hook_type ExecutorRun_hook; /* Hook for plugins to get control in ExecutorFinish() */ typedef void (*ExecutorFinish_hook_type) (QueryDesc *queryDesc); -extern PGDLLIMPORT ExecutorFinish_hook_type ExecutorFinish_hook; +extern __thread PGDLLIMPORT ExecutorFinish_hook_type ExecutorFinish_hook; /* Hook for plugins to get control in ExecutorEnd() */ typedef void (*ExecutorEnd_hook_type) (QueryDesc *queryDesc); -extern PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook; +extern __thread PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook; /* Hook for plugins to get control in ExecCheckRTPerms() */ typedef bool (*ExecutorCheckPerms_hook_type) (List *, bool); -extern PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook; +extern __thread PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook; /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/executor/instrument.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/executor/instrument.h index a97562e7a4..7f8980915c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/executor/instrument.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/executor/instrument.h @@ -81,8 +81,8 @@ typedef struct WorkerInstrumentation Instrumentation instrument[FLEXIBLE_ARRAY_MEMBER]; } WorkerInstrumentation; -extern PGDLLIMPORT BufferUsage pgBufferUsage; -extern PGDLLIMPORT WalUsage pgWalUsage; +extern __thread PGDLLIMPORT BufferUsage pgBufferUsage; +extern __thread PGDLLIMPORT WalUsage pgWalUsage; extern Instrumentation *InstrAlloc(int n, int instrument_options); extern void InstrInit(Instrumentation *instr, int instrument_options); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/executor/spi.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/executor/spi.h index 06de20ada5..a7d467134d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/executor/spi.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/executor/spi.h @@ -77,9 +77,9 @@ typedef struct _SPI_plan *SPIPlanPtr; #define SPI_pop_conditional(pushed) ((void) 0) #define SPI_restore_connection() ((void) 0) -extern PGDLLIMPORT uint64 SPI_processed; +extern __thread PGDLLIMPORT uint64 SPI_processed; extern PGDLLIMPORT SPITupleTable *SPI_tuptable; -extern PGDLLIMPORT int SPI_result; +extern __thread PGDLLIMPORT int SPI_result; extern int SPI_connect(void); extern int SPI_connect_ext(int options); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/fmgr.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/fmgr.h index d349510b7c..fd38c517ef 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/fmgr.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/fmgr.h @@ -766,8 +766,8 @@ typedef bool (*needs_fmgr_hook_type) (Oid fn_oid); typedef void (*fmgr_hook_type) (FmgrHookEventType event, FmgrInfo *flinfo, Datum *arg); -extern PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook; -extern PGDLLIMPORT fmgr_hook_type fmgr_hook; +extern __thread PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook; +extern __thread PGDLLIMPORT fmgr_hook_type fmgr_hook; #define FmgrHookIsNeeded(fn_oid) \ (!needs_fmgr_hook ? false : (*needs_fmgr_hook)(fn_oid)) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/jit/jit.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/jit/jit.h index 5a77f7d4a0..b6c2605d79 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/jit/jit.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/jit/jit.h @@ -79,16 +79,16 @@ struct JitProviderCallbacks /* GUCs */ -extern bool jit_enabled; +extern __thread bool jit_enabled; extern char *jit_provider; -extern bool jit_debugging_support; -extern bool jit_dump_bitcode; -extern bool jit_expressions; -extern bool jit_profiling_support; -extern bool jit_tuple_deforming; -extern double jit_above_cost; -extern double jit_inline_above_cost; -extern double jit_optimize_above_cost; +extern __thread bool jit_debugging_support; +extern __thread bool jit_dump_bitcode; +extern __thread bool jit_expressions; +extern __thread bool jit_profiling_support; +extern __thread bool jit_tuple_deforming; +extern __thread double jit_above_cost; +extern __thread double jit_inline_above_cost; +extern __thread double jit_optimize_above_cost; extern void jit_reset_after_error(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/auth.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/auth.h index 81202e6085..8c96879420 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/auth.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/auth.h @@ -17,13 +17,13 @@ #include "libpq/libpq-be.h" extern char *pg_krb_server_keyfile; -extern bool pg_krb_caseins_users; +extern __thread bool pg_krb_caseins_users; extern char *pg_krb_realm; extern void ClientAuthentication(Port *port); /* Hook for plugins to get control in ClientAuthentication() */ typedef void (*ClientAuthentication_hook_type) (Port *, int); -extern PGDLLIMPORT ClientAuthentication_hook_type ClientAuthentication_hook; +extern __thread PGDLLIMPORT ClientAuthentication_hook_type ClientAuthentication_hook; #endif /* AUTH_H */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/libpq-be.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/libpq-be.h index fa778e1192..1b45410f0d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/libpq-be.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/libpq-be.h @@ -291,7 +291,7 @@ extern char *be_tls_get_certificate_hash(Port *port, size_t *len); /* init hook for SSL, the default sets the password callback if appropriate */ #ifdef USE_OPENSSL typedef void (*openssl_tls_init_hook_typ) (SSL_CTX *context, bool isServerStart); -extern PGDLLIMPORT openssl_tls_init_hook_typ openssl_tls_init_hook; +extern __thread PGDLLIMPORT openssl_tls_init_hook_typ openssl_tls_init_hook; #endif #endif /* USE_SSL */ @@ -309,7 +309,7 @@ extern ssize_t be_gssapi_read(Port *port, void *ptr, size_t len); extern ssize_t be_gssapi_write(Port *port, void *ptr, size_t len); #endif /* ENABLE_GSS */ -extern ProtocolVersion FrontendProtocol; +extern __thread ProtocolVersion FrontendProtocol; /* TCP keepalives configuration. These are no-ops on an AF_UNIX socket. */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/libpq.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/libpq.h index 54c5fa7797..5a5e05996f 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/libpq.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/libpq.h @@ -85,9 +85,9 @@ extern char *ssl_ca_file; extern char *ssl_crl_file; extern char *ssl_dh_params_file; extern PGDLLIMPORT char *ssl_passphrase_command; -extern PGDLLIMPORT bool ssl_passphrase_command_supports_reload; +extern __thread PGDLLIMPORT bool ssl_passphrase_command_supports_reload; #ifdef USE_SSL -extern bool ssl_loaded_verify_locations; +extern __thread bool ssl_loaded_verify_locations; #endif extern int secure_initialize(bool isServerStart); @@ -110,9 +110,9 @@ extern ssize_t secure_open_gssapi(Port *port); /* GUCs */ extern char *SSLCipherSuites; extern char *SSLECDHCurve; -extern bool SSLPreferServerCiphers; -extern int ssl_min_protocol_version; -extern int ssl_max_protocol_version; +extern __thread bool SSLPreferServerCiphers; +extern __thread int ssl_min_protocol_version; +extern __thread int ssl_max_protocol_version; enum ssl_protocol_versions { diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/pqcomm.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/pqcomm.h index 781d86c8ef..e26b180aec 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/pqcomm.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/libpq/pqcomm.h @@ -149,7 +149,7 @@ typedef struct StartupPacket char tty[SM_TTY]; /* Tty for debug output */ } StartupPacket; -extern bool Db_user_namespace; +extern __thread bool Db_user_namespace; /* * In protocol 3.0 and later, the startup packet length is not fixed, but diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/miscadmin.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/miscadmin.h index 6b2b4343a0..beb1d46a45 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/miscadmin.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/miscadmin.h @@ -87,18 +87,18 @@ /* in globals.c */ /* these are marked volatile because they are set by signal handlers: */ -extern PGDLLIMPORT volatile sig_atomic_t InterruptPending; -extern PGDLLIMPORT volatile sig_atomic_t QueryCancelPending; -extern PGDLLIMPORT volatile sig_atomic_t ProcDiePending; -extern PGDLLIMPORT volatile sig_atomic_t IdleInTransactionSessionTimeoutPending; -extern PGDLLIMPORT volatile sig_atomic_t ProcSignalBarrierPending; +extern __thread PGDLLIMPORT volatile sig_atomic_t InterruptPending; +extern __thread PGDLLIMPORT volatile sig_atomic_t QueryCancelPending; +extern __thread PGDLLIMPORT volatile sig_atomic_t ProcDiePending; +extern __thread PGDLLIMPORT volatile sig_atomic_t IdleInTransactionSessionTimeoutPending; +extern __thread PGDLLIMPORT volatile sig_atomic_t ProcSignalBarrierPending; -extern PGDLLIMPORT volatile sig_atomic_t ClientConnectionLost; +extern __thread PGDLLIMPORT volatile sig_atomic_t ClientConnectionLost; /* these are marked volatile because they are examined by signal handlers: */ -extern PGDLLIMPORT volatile uint32 InterruptHoldoffCount; -extern PGDLLIMPORT volatile uint32 QueryCancelHoldoffCount; -extern PGDLLIMPORT volatile uint32 CritSectionCount; +extern __thread PGDLLIMPORT volatile uint32 InterruptHoldoffCount; +extern __thread PGDLLIMPORT volatile uint32 QueryCancelHoldoffCount; +extern __thread PGDLLIMPORT volatile uint32 CritSectionCount; /* in tcop/postgres.c */ extern void ProcessInterrupts(void); @@ -157,30 +157,30 @@ do { \ /* * from utils/init/globals.c */ -extern PGDLLIMPORT pid_t PostmasterPid; -extern PGDLLIMPORT bool IsPostmasterEnvironment; -extern PGDLLIMPORT bool IsUnderPostmaster; -extern PGDLLIMPORT bool IsBackgroundWorker; -extern PGDLLIMPORT bool IsBinaryUpgrade; +extern __thread PGDLLIMPORT pid_t PostmasterPid; +extern __thread PGDLLIMPORT bool IsPostmasterEnvironment; +extern __thread PGDLLIMPORT bool IsUnderPostmaster; +extern __thread PGDLLIMPORT bool IsBackgroundWorker; +extern __thread PGDLLIMPORT bool IsBinaryUpgrade; -extern PGDLLIMPORT bool ExitOnAnyError; +extern __thread PGDLLIMPORT bool ExitOnAnyError; extern PGDLLIMPORT char *DataDir; -extern PGDLLIMPORT int data_directory_mode; +extern __thread PGDLLIMPORT int data_directory_mode; -extern PGDLLIMPORT int NBuffers; -extern PGDLLIMPORT int MaxBackends; -extern PGDLLIMPORT int MaxConnections; -extern PGDLLIMPORT int max_worker_processes; -extern PGDLLIMPORT int max_parallel_workers; +extern __thread PGDLLIMPORT int NBuffers; +extern __thread PGDLLIMPORT int MaxBackends; +extern __thread PGDLLIMPORT int MaxConnections; +extern __thread PGDLLIMPORT int max_worker_processes; +extern __thread PGDLLIMPORT int max_parallel_workers; -extern PGDLLIMPORT int MyProcPid; -extern PGDLLIMPORT pg_time_t MyStartTime; -extern PGDLLIMPORT TimestampTz MyStartTimestamp; +extern __thread PGDLLIMPORT int MyProcPid; +extern __thread PGDLLIMPORT pg_time_t MyStartTime; +extern __thread PGDLLIMPORT TimestampTz MyStartTimestamp; extern PGDLLIMPORT struct Port *MyProcPort; extern PGDLLIMPORT struct Latch *MyLatch; -extern int32 MyCancelKey; -extern int MyPMChildSlot; +extern __thread int32 MyCancelKey; +extern __thread int MyPMChildSlot; extern char OutputFileName[]; extern PGDLLIMPORT char my_exec_path[]; @@ -195,9 +195,9 @@ extern char postgres_exec_path[]; * * extern BackendId MyBackendId; */ -extern PGDLLIMPORT Oid MyDatabaseId; +extern __thread PGDLLIMPORT Oid MyDatabaseId; -extern PGDLLIMPORT Oid MyDatabaseTableSpace; +extern __thread PGDLLIMPORT Oid MyDatabaseTableSpace; /* * Date/Time Configuration @@ -233,8 +233,8 @@ extern PGDLLIMPORT Oid MyDatabaseTableSpace; #define DATEORDER_DMY 1 #define DATEORDER_MDY 2 -extern PGDLLIMPORT int DateStyle; -extern PGDLLIMPORT int DateOrder; +extern __thread PGDLLIMPORT int DateStyle; +extern __thread PGDLLIMPORT int DateOrder; /* * IntervalStyles @@ -248,31 +248,31 @@ extern PGDLLIMPORT int DateOrder; #define INTSTYLE_SQL_STANDARD 2 #define INTSTYLE_ISO_8601 3 -extern PGDLLIMPORT int IntervalStyle; +extern __thread PGDLLIMPORT int IntervalStyle; #define MAXTZLEN 10 /* max TZ name len, not counting tr. null */ -extern bool enableFsync; -extern PGDLLIMPORT bool allowSystemTableMods; -extern PGDLLIMPORT int work_mem; -extern PGDLLIMPORT double hash_mem_multiplier; -extern PGDLLIMPORT int maintenance_work_mem; -extern PGDLLIMPORT int max_parallel_maintenance_workers; +extern __thread bool enableFsync; +extern __thread PGDLLIMPORT bool allowSystemTableMods; +extern __thread PGDLLIMPORT int work_mem; +extern __thread PGDLLIMPORT double hash_mem_multiplier; +extern __thread PGDLLIMPORT int maintenance_work_mem; +extern __thread PGDLLIMPORT int max_parallel_maintenance_workers; -extern int VacuumCostPageHit; -extern int VacuumCostPageMiss; -extern int VacuumCostPageDirty; -extern int VacuumCostLimit; -extern double VacuumCostDelay; +extern __thread int VacuumCostPageHit; +extern __thread int VacuumCostPageMiss; +extern __thread int VacuumCostPageDirty; +extern __thread int VacuumCostLimit; +extern __thread double VacuumCostDelay; -extern int64 VacuumPageHit; -extern int64 VacuumPageMiss; -extern int64 VacuumPageDirty; +extern __thread int64 VacuumPageHit; +extern __thread int64 VacuumPageMiss; +extern __thread int64 VacuumPageDirty; -extern int VacuumCostBalance; -extern bool VacuumCostActive; +extern __thread int VacuumCostBalance; +extern __thread bool VacuumCostActive; -extern double vacuum_cleanup_index_scale_factor; +extern __thread double vacuum_cleanup_index_scale_factor; /* in tcop/postgres.c */ @@ -298,7 +298,7 @@ extern void PreventCommandIfParallelMode(const char *cmdname); extern void PreventCommandDuringRecovery(const char *cmdname); /* in utils/misc/guc.c */ -extern int trace_recovery_messages; +extern __thread int trace_recovery_messages; extern int trace_recovery(int trace_level); /***************************************************************************** @@ -337,7 +337,7 @@ typedef enum BackendType B_LOGGER, } BackendType; -extern BackendType MyBackendType; +extern __thread BackendType MyBackendType; extern const char *GetBackendTypeDesc(BackendType backendType); @@ -400,7 +400,7 @@ typedef enum ProcessingMode NormalProcessing /* normal processing */ } ProcessingMode; -extern ProcessingMode Mode; +extern __thread ProcessingMode Mode; #define IsBootstrapProcessingMode() (Mode == BootstrapProcessing) #define IsInitProcessingMode() (Mode == InitProcessing) @@ -437,7 +437,7 @@ typedef enum NUM_AUXPROCTYPES /* Must be last! */ } AuxProcType; -extern AuxProcType MyAuxProcType; +extern __thread AuxProcType MyAuxProcType; #define AmBootstrapProcess() (MyAuxProcType == BootstrapProcess) #define AmStartupProcess() (MyAuxProcType == StartupProcess) @@ -460,8 +460,8 @@ extern void InitPostgres(const char *in_dbname, Oid dboid, const char *username, extern void BaseInit(void); /* in utils/init/miscinit.c */ -extern bool IgnoreSystemIndexes; -extern PGDLLIMPORT bool process_shared_preload_libraries_in_progress; +extern __thread bool IgnoreSystemIndexes; +extern __thread PGDLLIMPORT bool process_shared_preload_libraries_in_progress; extern char *session_preload_libraries_string; extern char *shared_preload_libraries_string; extern char *local_preload_libraries_string; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/cost.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/cost.h index 6141654e47..9023966ec7 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/cost.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/cost.h @@ -45,27 +45,27 @@ typedef enum */ /* parameter variables and flags (see also optimizer.h) */ -extern PGDLLIMPORT Cost disable_cost; -extern PGDLLIMPORT int max_parallel_workers_per_gather; -extern PGDLLIMPORT bool enable_seqscan; -extern PGDLLIMPORT bool enable_indexscan; -extern PGDLLIMPORT bool enable_indexonlyscan; -extern PGDLLIMPORT bool enable_bitmapscan; -extern PGDLLIMPORT bool enable_tidscan; -extern PGDLLIMPORT bool enable_sort; -extern PGDLLIMPORT bool enable_incremental_sort; -extern PGDLLIMPORT bool enable_hashagg; -extern PGDLLIMPORT bool enable_nestloop; -extern PGDLLIMPORT bool enable_material; -extern PGDLLIMPORT bool enable_mergejoin; -extern PGDLLIMPORT bool enable_hashjoin; -extern PGDLLIMPORT bool enable_gathermerge; -extern PGDLLIMPORT bool enable_partitionwise_join; -extern PGDLLIMPORT bool enable_partitionwise_aggregate; -extern PGDLLIMPORT bool enable_parallel_append; -extern PGDLLIMPORT bool enable_parallel_hash; -extern PGDLLIMPORT bool enable_partition_pruning; -extern PGDLLIMPORT int constraint_exclusion; +extern __thread PGDLLIMPORT Cost disable_cost; +extern __thread PGDLLIMPORT int max_parallel_workers_per_gather; +extern __thread PGDLLIMPORT bool enable_seqscan; +extern __thread PGDLLIMPORT bool enable_indexscan; +extern __thread PGDLLIMPORT bool enable_indexonlyscan; +extern __thread PGDLLIMPORT bool enable_bitmapscan; +extern __thread PGDLLIMPORT bool enable_tidscan; +extern __thread PGDLLIMPORT bool enable_sort; +extern __thread PGDLLIMPORT bool enable_incremental_sort; +extern __thread PGDLLIMPORT bool enable_hashagg; +extern __thread PGDLLIMPORT bool enable_nestloop; +extern __thread PGDLLIMPORT bool enable_material; +extern __thread PGDLLIMPORT bool enable_mergejoin; +extern __thread PGDLLIMPORT bool enable_hashjoin; +extern __thread PGDLLIMPORT bool enable_gathermerge; +extern __thread PGDLLIMPORT bool enable_partitionwise_join; +extern __thread PGDLLIMPORT bool enable_partitionwise_aggregate; +extern __thread PGDLLIMPORT bool enable_parallel_append; +extern __thread PGDLLIMPORT bool enable_parallel_hash; +extern __thread PGDLLIMPORT bool enable_partition_pruning; +extern __thread PGDLLIMPORT int constraint_exclusion; extern double index_pages_fetched(double tuples_fetched, BlockNumber pages, double index_pages, PlannerInfo *root); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/geqo.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/geqo.h index aba549f145..0b0050cc50 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/geqo.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/geqo.h @@ -48,23 +48,23 @@ * * If you change these, update backend/utils/misc/postgresql.conf.sample */ -extern int Geqo_effort; /* 1 .. 10, knob for adjustment of defaults */ +extern __thread int Geqo_effort; /* 1 .. 10, knob for adjustment of defaults */ #define DEFAULT_GEQO_EFFORT 5 #define MIN_GEQO_EFFORT 1 #define MAX_GEQO_EFFORT 10 -extern int Geqo_pool_size; /* 2 .. inf, or 0 to use default */ +extern __thread int Geqo_pool_size; /* 2 .. inf, or 0 to use default */ -extern int Geqo_generations; /* 1 .. inf, or 0 to use default */ +extern __thread int Geqo_generations; /* 1 .. inf, or 0 to use default */ -extern double Geqo_selection_bias; +extern __thread double Geqo_selection_bias; #define DEFAULT_GEQO_SELECTION_BIAS 2.0 #define MIN_GEQO_SELECTION_BIAS 1.5 #define MAX_GEQO_SELECTION_BIAS 2.0 -extern double Geqo_seed; /* 0 .. 1 */ +extern __thread double Geqo_seed; /* 0 .. 1 */ /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/optimizer.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/optimizer.h index 3c588def88..037226910e 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/optimizer.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/optimizer.h @@ -78,14 +78,14 @@ extern Selectivity clauselist_selectivity(PlannerInfo *root, /* in path/costsize.c: */ /* widely used cost parameters */ -extern PGDLLIMPORT double seq_page_cost; -extern PGDLLIMPORT double random_page_cost; -extern PGDLLIMPORT double cpu_tuple_cost; -extern PGDLLIMPORT double cpu_index_tuple_cost; -extern PGDLLIMPORT double cpu_operator_cost; -extern PGDLLIMPORT double parallel_tuple_cost; -extern PGDLLIMPORT double parallel_setup_cost; -extern PGDLLIMPORT int effective_cache_size; +extern __thread PGDLLIMPORT double seq_page_cost; +extern __thread PGDLLIMPORT double random_page_cost; +extern __thread PGDLLIMPORT double cpu_tuple_cost; +extern __thread PGDLLIMPORT double cpu_index_tuple_cost; +extern __thread PGDLLIMPORT double cpu_operator_cost; +extern __thread PGDLLIMPORT double parallel_tuple_cost; +extern __thread PGDLLIMPORT double parallel_setup_cost; +extern __thread PGDLLIMPORT int effective_cache_size; extern double clamp_row_est(double nrows); @@ -106,8 +106,8 @@ typedef enum } ForceParallelMode; /* GUC parameters */ -extern int force_parallel_mode; -extern bool parallel_leader_participation; +extern __thread int force_parallel_mode; +extern __thread bool parallel_leader_participation; extern struct PlannedStmt *planner(Query *parse, const char *query_string, int cursorOptions, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/paths.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/paths.h index 9254ee088b..0d1d75683c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/paths.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/paths.h @@ -20,17 +20,17 @@ /* * allpaths.c */ -extern PGDLLIMPORT bool enable_geqo; -extern PGDLLIMPORT int geqo_threshold; -extern PGDLLIMPORT int min_parallel_table_scan_size; -extern PGDLLIMPORT int min_parallel_index_scan_size; +extern __thread PGDLLIMPORT bool enable_geqo; +extern __thread PGDLLIMPORT int geqo_threshold; +extern __thread PGDLLIMPORT int min_parallel_table_scan_size; +extern __thread PGDLLIMPORT int min_parallel_index_scan_size; /* Hook for plugins to get control in set_rel_pathlist() */ typedef void (*set_rel_pathlist_hook_type) (PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTblEntry *rte); -extern PGDLLIMPORT set_rel_pathlist_hook_type set_rel_pathlist_hook; +extern __thread PGDLLIMPORT set_rel_pathlist_hook_type set_rel_pathlist_hook; /* Hook for plugins to get control in add_paths_to_joinrel() */ typedef void (*set_join_pathlist_hook_type) (PlannerInfo *root, @@ -39,13 +39,13 @@ typedef void (*set_join_pathlist_hook_type) (PlannerInfo *root, RelOptInfo *innerrel, JoinType jointype, JoinPathExtraData *extra); -extern PGDLLIMPORT set_join_pathlist_hook_type set_join_pathlist_hook; +extern __thread PGDLLIMPORT set_join_pathlist_hook_type set_join_pathlist_hook; /* Hook for plugins to replace standard_join_search() */ typedef RelOptInfo *(*join_search_hook_type) (PlannerInfo *root, int levels_needed, List *initial_rels); -extern PGDLLIMPORT join_search_hook_type join_search_hook; +extern __thread PGDLLIMPORT join_search_hook_type join_search_hook; extern RelOptInfo *make_one_rel(PlannerInfo *root, List *joinlist); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/plancat.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/plancat.h index c29a7091ec..532d2b7eda 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/plancat.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/plancat.h @@ -22,7 +22,7 @@ typedef void (*get_relation_info_hook_type) (PlannerInfo *root, Oid relationObjectId, bool inhparent, RelOptInfo *rel); -extern PGDLLIMPORT get_relation_info_hook_type get_relation_info_hook; +extern __thread PGDLLIMPORT get_relation_info_hook_type get_relation_info_hook; extern void get_relation_info(PlannerInfo *root, Oid relationObjectId, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/planmain.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/planmain.h index 8ce60e202e..11a401a34c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/planmain.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/planmain.h @@ -19,7 +19,7 @@ /* GUC parameters */ #define DEFAULT_CURSOR_TUPLE_FRACTION 0.1 -extern double cursor_tuple_fraction; +extern __thread double cursor_tuple_fraction; /* query_planner callback to compute query_pathkeys */ typedef void (*query_pathkeys_callback) (PlannerInfo *root, void *extra); @@ -64,8 +64,8 @@ extern Limit *make_limit(Plan *lefttree, Node *limitOffset, Node *limitCount, /* * prototypes for plan/initsplan.c */ -extern int from_collapse_limit; -extern int join_collapse_limit; +extern __thread int from_collapse_limit; +extern __thread int join_collapse_limit; extern void add_base_rels_to_query(PlannerInfo *root, Node *jtnode); extern void add_other_rels_to_query(PlannerInfo *root); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/planner.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/planner.h index beb7dbbcbe..ac78bb8b2d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/planner.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/optimizer/planner.h @@ -27,7 +27,7 @@ typedef PlannedStmt *(*planner_hook_type) (Query *parse, const char *query_string, int cursorOptions, ParamListInfo boundParams); -extern PGDLLIMPORT planner_hook_type planner_hook; +extern __thread PGDLLIMPORT planner_hook_type planner_hook; /* Hook for plugins to get control when grouping_planner() plans upper rels */ typedef void (*create_upper_paths_hook_type) (PlannerInfo *root, @@ -35,7 +35,7 @@ typedef void (*create_upper_paths_hook_type) (PlannerInfo *root, RelOptInfo *input_rel, RelOptInfo *output_rel, void *extra); -extern PGDLLIMPORT create_upper_paths_hook_type create_upper_paths_hook; +extern __thread PGDLLIMPORT create_upper_paths_hook_type create_upper_paths_hook; extern PlannedStmt *standard_planner(Query *parse, const char *query_string, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/parser/analyze.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/parser/analyze.h index d6a467a572..90ea41a295 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/parser/analyze.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/parser/analyze.h @@ -19,7 +19,7 @@ /* Hook for plugins to get control at end of parse analysis */ typedef void (*post_parse_analyze_hook_type) (ParseState *pstate, Query *query); -extern PGDLLIMPORT post_parse_analyze_hook_type post_parse_analyze_hook; +extern __thread PGDLLIMPORT post_parse_analyze_hook_type post_parse_analyze_hook; extern Query *parse_analyze(RawStmt *parseTree, const char *sourceText, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/parser/parse_expr.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/parser/parse_expr.h index b01d3b7dec..17b9c810fd 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/parser/parse_expr.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/parser/parse_expr.h @@ -16,8 +16,8 @@ #include "parser/parse_node.h" /* GUC parameters */ -extern bool operator_precedence_warning; -extern bool Transform_null_equals; +extern __thread bool operator_precedence_warning; +extern __thread bool Transform_null_equals; extern Node *transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/parser/parser.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/parser/parser.h index 3bdeeb8b0b..32a88aeb09 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/parser/parser.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/parser/parser.h @@ -27,8 +27,8 @@ typedef enum /* GUC variables in scan.l (every one of these is a bad idea :-() */ extern int backslash_quote; -extern bool escape_string_warning; -extern PGDLLIMPORT bool standard_conforming_strings; +extern __thread bool escape_string_warning; +extern __thread PGDLLIMPORT bool standard_conforming_strings; /* Primary entry point for the raw parsing functions */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/pgstat.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/pgstat.h index c55dc1481c..f444165a97 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/pgstat.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/pgstat.h @@ -1246,10 +1246,10 @@ typedef struct PgStat_FunctionCallUsage * GUC parameters * ---------- */ -extern PGDLLIMPORT bool pgstat_track_activities; -extern PGDLLIMPORT bool pgstat_track_counts; -extern PGDLLIMPORT int pgstat_track_functions; -extern PGDLLIMPORT int pgstat_track_activity_query_size; +extern __thread PGDLLIMPORT bool pgstat_track_activities; +extern __thread PGDLLIMPORT bool pgstat_track_counts; +extern __thread PGDLLIMPORT int pgstat_track_functions; +extern __thread PGDLLIMPORT int pgstat_track_activity_query_size; extern char *pgstat_stat_directory; extern char *pgstat_stat_tmpname; extern char *pgstat_stat_filename; @@ -1257,13 +1257,13 @@ extern char *pgstat_stat_filename; /* * BgWriter statistics counters are updated directly by bgwriter and bufmgr */ -extern PgStat_MsgBgWriter BgWriterStats; +extern __thread PgStat_MsgBgWriter BgWriterStats; /* * Updated by pgstat_count_buffer_*_time macros */ -extern PgStat_Counter pgStatBlockReadTime; -extern PgStat_Counter pgStatBlockWriteTime; +extern __thread PgStat_Counter pgStatBlockReadTime; +extern __thread PgStat_Counter pgStatBlockWriteTime; /* ---------- * Functions called from postmaster diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/autovacuum.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/autovacuum.h index 7277effe03..a9613b3c61 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/autovacuum.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/autovacuum.h @@ -27,25 +27,25 @@ typedef enum /* GUC variables */ -extern bool autovacuum_start_daemon; -extern int autovacuum_max_workers; -extern int autovacuum_work_mem; -extern int autovacuum_naptime; -extern int autovacuum_vac_thresh; -extern double autovacuum_vac_scale; -extern int autovacuum_vac_ins_thresh; -extern double autovacuum_vac_ins_scale; -extern int autovacuum_anl_thresh; -extern double autovacuum_anl_scale; -extern int autovacuum_freeze_max_age; -extern int autovacuum_multixact_freeze_max_age; -extern double autovacuum_vac_cost_delay; -extern int autovacuum_vac_cost_limit; +extern __thread bool autovacuum_start_daemon; +extern __thread int autovacuum_max_workers; +extern __thread int autovacuum_work_mem; +extern __thread int autovacuum_naptime; +extern __thread int autovacuum_vac_thresh; +extern __thread double autovacuum_vac_scale; +extern __thread int autovacuum_vac_ins_thresh; +extern __thread double autovacuum_vac_ins_scale; +extern __thread int autovacuum_anl_thresh; +extern __thread double autovacuum_anl_scale; +extern __thread int autovacuum_freeze_max_age; +extern __thread int autovacuum_multixact_freeze_max_age; +extern __thread double autovacuum_vac_cost_delay; +extern __thread int autovacuum_vac_cost_limit; /* autovacuum launcher PID, only valid when worker is shutting down */ -extern int AutovacuumLauncherPid; +extern __thread int AutovacuumLauncherPid; -extern int Log_autovacuum_min_duration; +extern __thread int Log_autovacuum_min_duration; /* Status inquiry functions */ extern bool AutoVacuumingActive(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/bgworker_internals.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/bgworker_internals.h index dd6cabc45b..bd0a684bbc 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/bgworker_internals.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/bgworker_internals.h @@ -42,7 +42,7 @@ typedef struct RegisteredBgWorker slist_node rw_lnode; /* list link */ } RegisteredBgWorker; -extern slist_head BackgroundWorkerList; +extern __thread slist_head BackgroundWorkerList; extern Size BackgroundWorkerShmemSize(void); extern void BackgroundWorkerShmemInit(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/bgwriter.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/bgwriter.h index 0a5708b32e..5e608fa5bb 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/bgwriter.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/bgwriter.h @@ -22,10 +22,10 @@ /* GUC options */ -extern int BgWriterDelay; -extern int CheckPointTimeout; -extern int CheckPointWarning; -extern double CheckPointCompletionTarget; +extern __thread int BgWriterDelay; +extern __thread int CheckPointTimeout; +extern __thread int CheckPointWarning; +extern __thread double CheckPointCompletionTarget; extern void BackgroundWriterMain(void) pg_attribute_noreturn(); extern void CheckpointerMain(void) pg_attribute_noreturn(); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/interrupt.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/interrupt.h index 4f567129e4..d62bfdfe54 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/interrupt.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/interrupt.h @@ -21,8 +21,8 @@ #include <signal.h> -extern PGDLLIMPORT volatile sig_atomic_t ConfigReloadPending; -extern PGDLLIMPORT volatile sig_atomic_t ShutdownRequestPending; +extern __thread PGDLLIMPORT volatile sig_atomic_t ConfigReloadPending; +extern __thread PGDLLIMPORT volatile sig_atomic_t ShutdownRequestPending; extern void HandleMainLoopInterrupts(void); extern void SignalHandlerForConfigReload(SIGNAL_ARGS); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/postmaster.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/postmaster.h index babc87dfc9..ef27fcccba 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/postmaster.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/postmaster.h @@ -14,21 +14,21 @@ #define _POSTMASTER_H /* GUC options */ -extern bool EnableSSL; -extern int ReservedBackends; -extern PGDLLIMPORT int PostPortNumber; -extern int Unix_socket_permissions; +extern __thread bool EnableSSL; +extern __thread int ReservedBackends; +extern __thread PGDLLIMPORT int PostPortNumber; +extern __thread int Unix_socket_permissions; extern char *Unix_socket_group; extern char *Unix_socket_directories; extern char *ListenAddresses; -extern bool ClientAuthInProgress; -extern int PreAuthDelay; -extern int AuthenticationTimeout; -extern bool Log_connections; -extern bool log_hostname; -extern bool enable_bonjour; +extern __thread bool ClientAuthInProgress; +extern __thread int PreAuthDelay; +extern __thread int AuthenticationTimeout; +extern __thread bool Log_connections; +extern __thread bool log_hostname; +extern __thread bool enable_bonjour; extern char *bonjour_name; -extern bool restart_after_crash; +extern __thread bool restart_after_crash; #ifdef WIN32 extern HANDLE PostmasterHandle; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/syslogger.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/syslogger.h index f611bd1411..3e47d7dfb0 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/syslogger.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/syslogger.h @@ -62,13 +62,13 @@ typedef union /* GUC options */ -extern bool Logging_collector; -extern int Log_RotationAge; -extern int Log_RotationSize; +extern __thread bool Logging_collector; +extern __thread int Log_RotationAge; +extern __thread int Log_RotationSize; extern PGDLLIMPORT char *Log_directory; extern PGDLLIMPORT char *Log_filename; -extern bool Log_truncate_on_rotation; -extern int Log_file_mode; +extern __thread bool Log_truncate_on_rotation; +extern __thread int Log_file_mode; #ifndef WIN32 extern int syslogPipe[2]; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/walwriter.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/walwriter.h index 011dc26a6e..5df5252f6c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/walwriter.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/postmaster/walwriter.h @@ -13,8 +13,8 @@ #define _WALWRITER_H /* GUC options */ -extern int WalWriterDelay; -extern int WalWriterFlushAfter; +extern __thread int WalWriterDelay; +extern __thread int WalWriterFlushAfter; extern void WalWriterMain(void) pg_attribute_noreturn(); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/logicallauncher.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/logicallauncher.h index b22e591baf..ebd295d58d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/logicallauncher.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/logicallauncher.h @@ -12,8 +12,8 @@ #ifndef LOGICALLAUNCHER_H #define LOGICALLAUNCHER_H -extern int max_logical_replication_workers; -extern int max_sync_workers_per_subscription; +extern __thread int max_logical_replication_workers; +extern __thread int max_sync_workers_per_subscription; extern void ApplyLauncherRegister(void); extern void ApplyLauncherMain(Datum main_arg); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/origin.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/origin.h index 7e063750d0..7b4bc2e678 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/origin.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/origin.h @@ -33,9 +33,9 @@ typedef struct xl_replorigin_drop #define InvalidRepOriginId 0 #define DoNotReplicateId PG_UINT16_MAX -extern PGDLLIMPORT RepOriginId replorigin_session_origin; -extern PGDLLIMPORT XLogRecPtr replorigin_session_origin_lsn; -extern PGDLLIMPORT TimestampTz replorigin_session_origin_timestamp; +extern __thread PGDLLIMPORT RepOriginId replorigin_session_origin; +extern __thread PGDLLIMPORT XLogRecPtr replorigin_session_origin_lsn; +extern __thread PGDLLIMPORT TimestampTz replorigin_session_origin_timestamp; /* API for querying & manipulating replication origins */ extern RepOriginId replorigin_by_name(char *name, bool missing_ok); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/reorderbuffer.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/reorderbuffer.h index 5347597e92..a21cfc366a 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/reorderbuffer.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/reorderbuffer.h @@ -17,7 +17,7 @@ #include "utils/snapshot.h" #include "utils/timestamp.h" -extern PGDLLIMPORT int logical_decoding_work_mem; +extern __thread PGDLLIMPORT int logical_decoding_work_mem; /* an individual tuple, stored in one chunk of memory */ typedef struct ReorderBufferTupleBuf diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/slot.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/slot.h index 12c68ddbd2..7201754b58 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/slot.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/slot.h @@ -183,7 +183,7 @@ extern PGDLLIMPORT ReplicationSlotCtlData *ReplicationSlotCtl; extern PGDLLIMPORT ReplicationSlot *MyReplicationSlot; /* GUCs */ -extern PGDLLIMPORT int max_replication_slots; +extern __thread PGDLLIMPORT int max_replication_slots; /* shmem initialization functions */ extern Size ReplicationSlotsShmemSize(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/walreceiver.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/walreceiver.h index ac1acbb27e..4dfa25795b 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/walreceiver.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/walreceiver.h @@ -24,9 +24,9 @@ #include "utils/tuplestore.h" /* user-settable parameters */ -extern int wal_receiver_status_interval; -extern int wal_receiver_timeout; -extern bool hot_standby_feedback; +extern __thread int wal_receiver_status_interval; +extern __thread int wal_receiver_timeout; +extern __thread bool hot_standby_feedback; /* * MAXCONNINFO: maximum size of a connection string. diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/walsender.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/walsender.h index 40d81b87f0..ed64028900 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/walsender.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/walsender.h @@ -25,15 +25,15 @@ typedef enum } CRSSnapshotAction; /* global state */ -extern bool am_walsender; -extern bool am_cascading_walsender; -extern bool am_db_walsender; -extern bool wake_wal_senders; +extern __thread bool am_walsender; +extern __thread bool am_cascading_walsender; +extern __thread bool am_db_walsender; +extern __thread bool wake_wal_senders; /* user-settable parameters */ -extern int max_wal_senders; -extern int wal_sender_timeout; -extern bool log_replication_commands; +extern __thread int max_wal_senders; +extern __thread int wal_sender_timeout; +extern __thread bool log_replication_commands; extern void InitWalSender(void); extern bool exec_replication_command(const char *query_string); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/worker_internal.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/worker_internal.h index 58abc3eadc..111d90ae83 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/worker_internal.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/replication/worker_internal.h @@ -57,7 +57,7 @@ typedef struct LogicalRepWorker } LogicalRepWorker; /* Main memory context for apply worker. Permanent during worker lifetime. */ -extern MemoryContext ApplyContext; +extern __thread MemoryContext ApplyContext; /* libpqreceiver connection */ extern struct WalReceiverConn *LogRepWorkerWalRcvConn; @@ -66,7 +66,7 @@ extern struct WalReceiverConn *LogRepWorkerWalRcvConn; extern Subscription *MySubscription; extern LogicalRepWorker *MyLogicalRepWorker; -extern bool in_remote_transaction; +extern __thread bool in_remote_transaction; extern void logicalrep_worker_attach(int slot); extern LogicalRepWorker *logicalrep_worker_find(Oid subid, Oid relid, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/rewrite/rowsecurity.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/rewrite/rowsecurity.h index 2e0bac5a98..f0fe00fc18 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/rewrite/rowsecurity.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/rewrite/rowsecurity.h @@ -37,9 +37,9 @@ typedef struct RowSecurityDesc typedef List *(*row_security_policy_hook_type) (CmdType cmdtype, Relation relation); -extern PGDLLIMPORT row_security_policy_hook_type row_security_policy_hook_permissive; +extern __thread PGDLLIMPORT row_security_policy_hook_type row_security_policy_hook_permissive; -extern PGDLLIMPORT row_security_policy_hook_type row_security_policy_hook_restrictive; +extern __thread PGDLLIMPORT row_security_policy_hook_type row_security_policy_hook_restrictive; extern void get_row_security_policies(Query *root, RangeTblEntry *rte, int rt_index, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/backendid.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/backendid.h index 0c776a3e6c..bd7f3c6718 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/backendid.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/backendid.h @@ -22,10 +22,10 @@ typedef int BackendId; /* unique currently active backend identifier */ #define InvalidBackendId (-1) -extern PGDLLIMPORT BackendId MyBackendId; /* backend id of this backend */ +extern __thread PGDLLIMPORT BackendId MyBackendId; /* backend id of this backend */ /* backend id of our parallel session leader, or InvalidBackendId if none */ -extern PGDLLIMPORT BackendId ParallelMasterBackendId; +extern __thread PGDLLIMPORT BackendId ParallelMasterBackendId; /* * The BackendId to use for our session's temp relations is normally our own, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/buf_internals.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/buf_internals.h index 3377fa5676..b2f8705958 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/buf_internals.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/buf_internals.h @@ -272,7 +272,7 @@ typedef struct WritebackContext /* in buf_init.c */ extern PGDLLIMPORT BufferDescPadded *BufferDescriptors; -extern PGDLLIMPORT WritebackContext BackendWritebackContext; +extern __thread PGDLLIMPORT WritebackContext BackendWritebackContext; /* in localbuf.c */ extern BufferDesc *LocalBufferDescriptors; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/bufmgr.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/bufmgr.h index ee91b8fa26..c7e9b702d8 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/bufmgr.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/bufmgr.h @@ -62,25 +62,25 @@ struct WritebackContext; struct SMgrRelationData; /* in globals.c ... this duplicates miscadmin.h */ -extern PGDLLIMPORT int NBuffers; +extern __thread PGDLLIMPORT int NBuffers; /* in bufmgr.c */ -extern bool zero_damaged_pages; -extern int bgwriter_lru_maxpages; -extern double bgwriter_lru_multiplier; -extern bool track_io_timing; -extern int effective_io_concurrency; -extern int maintenance_io_concurrency; +extern __thread bool zero_damaged_pages; +extern __thread int bgwriter_lru_maxpages; +extern __thread double bgwriter_lru_multiplier; +extern __thread bool track_io_timing; +extern __thread int effective_io_concurrency; +extern __thread int maintenance_io_concurrency; -extern int checkpoint_flush_after; -extern int backend_flush_after; -extern int bgwriter_flush_after; +extern __thread int checkpoint_flush_after; +extern __thread int backend_flush_after; +extern __thread int bgwriter_flush_after; /* in buf_init.c */ extern PGDLLIMPORT char *BufferBlocks; /* in localbuf.c */ -extern PGDLLIMPORT int NLocBuffer; +extern __thread PGDLLIMPORT int NLocBuffer; extern PGDLLIMPORT Block *LocalBufferBlockPointers; extern PGDLLIMPORT int32 *LocalRefCount; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/dsm_impl.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/dsm_impl.h index 562cb781a8..eff2003bd7 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/dsm_impl.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/dsm_impl.h @@ -39,7 +39,7 @@ #endif /* GUC. */ -extern int dynamic_shared_memory_type; +extern __thread int dynamic_shared_memory_type; /* * Directory for on-disk state. diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/fd.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/fd.h index 8cd125d7df..f3776febff 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/fd.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/fd.h @@ -50,13 +50,13 @@ typedef int File; /* GUC parameter */ -extern PGDLLIMPORT int max_files_per_process; -extern PGDLLIMPORT bool data_sync_retry; +extern __thread PGDLLIMPORT int max_files_per_process; +extern __thread PGDLLIMPORT bool data_sync_retry; /* * This is private to fd.c, but exported for save/restore_backend_variables() */ -extern int max_safe_fds; +extern __thread int max_safe_fds; /* * On Windows, we have to interpret EACCES as possibly meaning the same as diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/ipc.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/ipc.h index 462fe46341..7a6201d492 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/ipc.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/ipc.h @@ -62,8 +62,8 @@ typedef void (*shmem_startup_hook_type) (void); /* ipc.c */ -extern PGDLLIMPORT bool proc_exit_inprogress; -extern PGDLLIMPORT bool shmem_exit_inprogress; +extern __thread PGDLLIMPORT bool proc_exit_inprogress; +extern __thread PGDLLIMPORT bool shmem_exit_inprogress; extern void proc_exit(int code) pg_attribute_noreturn(); extern void shmem_exit(int code); @@ -74,7 +74,7 @@ extern void cancel_before_shmem_exit(pg_on_exit_callback function, Datum arg); extern void on_exit_reset(void); /* ipci.c */ -extern PGDLLIMPORT shmem_startup_hook_type shmem_startup_hook; +extern __thread PGDLLIMPORT shmem_startup_hook_type shmem_startup_hook; extern void CreateSharedMemoryAndSemaphores(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/large_object.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/large_object.h index 2623d1a1b0..748d448ee2 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/large_object.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/large_object.h @@ -79,7 +79,7 @@ typedef struct LargeObjectDesc /* * GUC: backwards-compatibility flag to suppress LO permission checks */ -extern bool lo_compat_privileges; +extern __thread bool lo_compat_privileges; /* * Function definitions... diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/lock.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/lock.h index ab42f6b080..e23d238868 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/lock.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/lock.h @@ -33,7 +33,7 @@ typedef struct PROC_QUEUE } PROC_QUEUE; /* GUC variables */ -extern int max_locks_per_xact; +extern __thread int max_locks_per_xact; #ifdef LOCK_DEBUG extern int Trace_lock_oidmin; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/lwlock.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/lwlock.h index c04ae97148..8f6b77dd0d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/lwlock.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/lwlock.h @@ -97,7 +97,7 @@ typedef struct NamedLWLockTranche } NamedLWLockTranche; extern PGDLLIMPORT NamedLWLockTranche *NamedLWLockTrancheArray; -extern PGDLLIMPORT int NamedLWLockTrancheRequests; +extern __thread PGDLLIMPORT int NamedLWLockTrancheRequests; /* Names for fixed lwlocks */ #include "storage/lwlocknames.h" diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/pg_shmem.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/pg_shmem.h index 0de26b3427..39e607b996 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/pg_shmem.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/pg_shmem.h @@ -42,8 +42,8 @@ typedef struct PGShmemHeader /* standard header for all Postgres shmem */ } PGShmemHeader; /* GUC variables */ -extern int shared_memory_type; -extern int huge_pages; +extern __thread int shared_memory_type; +extern __thread int huge_pages; /* Possible values for huge_pages */ typedef enum @@ -62,9 +62,9 @@ typedef enum } PGShmemType; #ifndef WIN32 -extern unsigned long UsedShmemSegID; +extern __thread unsigned long UsedShmemSegID; #else -extern HANDLE UsedShmemSegID; +extern __thread HANDLE UsedShmemSegID; extern void *ShmemProtectiveRegion; #endif extern void *UsedShmemSegAddr; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/pmsignal.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/pmsignal.h index 266813db6c..1820ecb73d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/pmsignal.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/pmsignal.h @@ -78,7 +78,7 @@ extern void PostmasterDeathSignalInit(void); #endif #ifdef USE_POSTMASTER_DEATH_SIGNAL -extern volatile sig_atomic_t postmaster_possibly_dead; +extern __thread volatile sig_atomic_t postmaster_possibly_dead; static inline bool PostmasterIsAlive(void) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/predicate.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/predicate.h index 86e756d5fb..2dbf4ad068 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/predicate.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/predicate.h @@ -22,9 +22,9 @@ /* * GUC variables */ -extern int max_predicate_locks_per_xact; -extern int max_predicate_locks_per_relation; -extern int max_predicate_locks_per_page; +extern __thread int max_predicate_locks_per_xact; +extern __thread int max_predicate_locks_per_relation; +extern __thread int max_predicate_locks_per_page; /* Number of SLRU buffers to use for Serial SLRU */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/proc.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/proc.h index 1ee9000b2b..7ed6431e1f 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/proc.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/proc.h @@ -290,11 +290,11 @@ extern PGPROC *PreparedXactProcs; #define NUM_AUXILIARY_PROCS 4 /* configurable options */ -extern PGDLLIMPORT int DeadlockTimeout; -extern PGDLLIMPORT int StatementTimeout; -extern PGDLLIMPORT int LockTimeout; -extern PGDLLIMPORT int IdleInTransactionSessionTimeout; -extern bool log_lock_waits; +extern __thread PGDLLIMPORT int DeadlockTimeout; +extern __thread PGDLLIMPORT int StatementTimeout; +extern __thread PGDLLIMPORT int LockTimeout; +extern __thread PGDLLIMPORT int IdleInTransactionSessionTimeout; +extern __thread bool log_lock_waits; /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/s_lock.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/s_lock.h index b1b182e220..3bbe63f579 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/s_lock.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/s_lock.h @@ -1025,7 +1025,7 @@ extern int tas(volatile slock_t *lock); /* in port/.../tas.s, or #define TAS_SPIN(lock) TAS(lock) #endif /* TAS_SPIN */ -extern slock_t dummy_spinlock; +extern __thread slock_t dummy_spinlock; /* * Platform-independent out-of-line support routines diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/sinval.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/sinval.h index 903818bea3..60eed23010 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/sinval.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/sinval.h @@ -123,9 +123,9 @@ typedef union /* Counter of messages processed; don't worry about overflow. */ -extern uint64 SharedInvalidMessageCounter; +extern __thread uint64 SharedInvalidMessageCounter; -extern volatile sig_atomic_t catchupInterruptPending; +extern __thread volatile sig_atomic_t catchupInterruptPending; extern void SendSharedInvalidMessages(const SharedInvalidationMessage *msgs, int n); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/standby.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/standby.h index cfbe426e5a..39cfec059d 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/standby.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/storage/standby.h @@ -20,9 +20,9 @@ #include "storage/standbydefs.h" /* User-settable GUC parameters */ -extern int vacuum_defer_cleanup_age; -extern int max_standby_archive_delay; -extern int max_standby_streaming_delay; +extern __thread int vacuum_defer_cleanup_age; +extern __thread int max_standby_archive_delay; +extern __thread int max_standby_streaming_delay; extern void InitRecoveryTransactionEnvironment(void); extern void ShutdownRecoveryTransactionEnvironment(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/tcop/pquery.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/tcop/pquery.h index 1385a007ab..e1ee318df1 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/tcop/pquery.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/tcop/pquery.h @@ -20,7 +20,7 @@ struct PlannedStmt; /* avoid including plannodes.h here */ -extern PGDLLIMPORT Portal ActivePortal; +extern __thread PGDLLIMPORT Portal ActivePortal; extern PortalStrategy ChoosePortalStrategy(List *stmts); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/tcop/tcopprot.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/tcop/tcopprot.h index bd30607b07..7459dbb9da 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/tcop/tcopprot.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/tcop/tcopprot.h @@ -25,10 +25,10 @@ /* Required daylight between max_stack_depth and the kernel limit, in bytes */ #define STACK_DEPTH_SLOP (512 * 1024L) -extern CommandDest whereToSendOutput; +extern __thread CommandDest whereToSendOutput; extern PGDLLIMPORT const char *debug_query_string; -extern int max_stack_depth; -extern int PostAuthDelay; +extern __thread int max_stack_depth; +extern __thread int PostAuthDelay; /* GUC-configurable parameters */ @@ -40,7 +40,7 @@ typedef enum LOGSTMT_ALL /* log all statements */ } LogStmtLevel; -extern PGDLLIMPORT int log_statement; +extern __thread PGDLLIMPORT int log_statement; extern List *pg_parse_query(const char *query_string); extern List *pg_analyze_and_rewrite(RawStmt *parsetree, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/tcop/utility.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/tcop/utility.h index 4aec19a008..55ae1f5fe4 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/tcop/utility.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/tcop/utility.h @@ -73,7 +73,7 @@ typedef void (*ProcessUtility_hook_type) (PlannedStmt *pstmt, ParamListInfo params, QueryEnvironment *queryEnv, DestReceiver *dest, QueryCompletion *qc); -extern PGDLLIMPORT ProcessUtility_hook_type ProcessUtility_hook; +extern __thread PGDLLIMPORT ProcessUtility_hook_type ProcessUtility_hook; extern void ProcessUtility(PlannedStmt *pstmt, const char *queryString, ProcessUtilityContext context, ParamListInfo params, diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/array.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/array.h index 0dcc8851cc..ccebdb9708 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/array.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/array.h @@ -334,7 +334,7 @@ typedef struct ArrayIteratorData *ArrayIterator; /* * GUC parameter */ -extern bool Array_nulls; +extern __thread bool Array_nulls; /* * prototypes for functions defined in arrayfuncs.c diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/builtins.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/builtins.h index a5c8772e95..145b6576d2 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/builtins.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/builtins.h @@ -66,7 +66,7 @@ extern char *regexp_fixed_prefix(text *text_re, bool case_insensitive, Oid collation, bool *exact); /* ruleutils.c */ -extern bool quote_all_identifiers; +extern __thread bool quote_all_identifiers; extern const char *quote_identifier(const char *ident); extern char *quote_qualified_identifier(const char *qualifier, const char *ident); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/bytea.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/bytea.h index d89ba2ba5e..d23f8666dc 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/bytea.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/bytea.h @@ -22,6 +22,6 @@ typedef enum BYTEA_OUTPUT_HEX } ByteaOutputType; -extern int bytea_output; /* ByteaOutputType, but int for GUC enum */ +extern __thread int bytea_output; /* ByteaOutputType, but int for GUC enum */ #endif /* BYTEA_H */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/catcache.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/catcache.h index f4aa316604..389a2fe23b 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/catcache.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/catcache.h @@ -187,7 +187,7 @@ typedef struct catcacheheader /* this extern duplicates utils/memutils.h... */ -extern PGDLLIMPORT MemoryContext CacheMemoryContext; +extern __thread PGDLLIMPORT MemoryContext CacheMemoryContext; extern void CreateCacheMemoryContext(void); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/elog.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/elog.h index 1e09ee0541..4ebba7fb34 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/elog.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/elog.h @@ -395,7 +395,7 @@ extern char *GetErrorContextStack(void); /* Hook for intercepting messages before they are sent to the server log */ typedef void (*emit_log_hook_type) (ErrorData *edata); -extern PGDLLIMPORT emit_log_hook_type emit_log_hook; +extern __thread PGDLLIMPORT emit_log_hook_type emit_log_hook; /* GUC-configurable parameters */ @@ -407,12 +407,12 @@ typedef enum PGERROR_VERBOSE /* all the facts, ma'am */ } PGErrorVerbosity; -extern int Log_error_verbosity; +extern __thread int Log_error_verbosity; extern char *Log_line_prefix; -extern int Log_destination; +extern __thread int Log_destination; extern char *Log_destination_string; -extern bool syslog_sequence_numbers; -extern bool syslog_split_messages; +extern __thread bool syslog_sequence_numbers; +extern __thread bool syslog_split_messages; /* Log destination bitmap */ #define LOG_DESTINATION_STDERR 1 diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/float.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/float.h index 8d4bbc51a6..b85734da77 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/float.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/float.h @@ -32,7 +32,7 @@ static const uint32 nan[2] = {0xffffffff, 0x7fffffff}; #define NAN (*(const float8 *) nan) #endif -extern PGDLLIMPORT int extra_float_digits; +extern __thread PGDLLIMPORT int extra_float_digits; /* * Utility functions in float.c diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/guc.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/guc.h index 2819282181..7365a06cc3 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/guc.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/guc.h @@ -233,37 +233,37 @@ typedef enum /* GUC vars that are actually declared in guc.c, rather than elsewhere */ -extern bool Debug_print_plan; -extern bool Debug_print_parse; -extern bool Debug_print_rewritten; -extern bool Debug_pretty_print; - -extern bool log_parser_stats; -extern bool log_planner_stats; -extern bool log_executor_stats; -extern bool log_statement_stats; -extern bool log_btree_build_stats; - -extern PGDLLIMPORT bool check_function_bodies; -extern bool session_auth_is_superuser; - -extern bool log_duration; -extern int log_parameter_max_length; -extern int log_parameter_max_length_on_error; -extern int log_min_error_statement; -extern PGDLLIMPORT int log_min_messages; -extern PGDLLIMPORT int client_min_messages; -extern int log_min_duration_sample; -extern int log_min_duration_statement; -extern int log_temp_files; -extern double log_statement_sample_rate; -extern double log_xact_sample_rate; +extern __thread bool Debug_print_plan; +extern __thread bool Debug_print_parse; +extern __thread bool Debug_print_rewritten; +extern __thread bool Debug_pretty_print; + +extern __thread bool log_parser_stats; +extern __thread bool log_planner_stats; +extern __thread bool log_executor_stats; +extern __thread bool log_statement_stats; +extern __thread bool log_btree_build_stats; + +extern __thread PGDLLIMPORT bool check_function_bodies; +extern __thread bool session_auth_is_superuser; + +extern __thread bool log_duration; +extern __thread int log_parameter_max_length; +extern __thread int log_parameter_max_length_on_error; +extern __thread int log_min_error_statement; +extern __thread PGDLLIMPORT int log_min_messages; +extern __thread PGDLLIMPORT int client_min_messages; +extern __thread int log_min_duration_sample; +extern __thread int log_min_duration_statement; +extern __thread int log_temp_files; +extern __thread double log_statement_sample_rate; +extern __thread double log_xact_sample_rate; extern char *backtrace_functions; extern char *backtrace_symbol_list; -extern int temp_file_limit; +extern __thread int temp_file_limit; -extern int num_temp_buffers; +extern __thread int num_temp_buffers; extern char *cluster_name; extern PGDLLIMPORT char *ConfigFileName; @@ -273,13 +273,13 @@ extern char *external_pid_file; extern PGDLLIMPORT char *application_name; -extern int tcp_keepalives_idle; -extern int tcp_keepalives_interval; -extern int tcp_keepalives_count; -extern int tcp_user_timeout; +extern __thread int tcp_keepalives_idle; +extern __thread int tcp_keepalives_interval; +extern __thread int tcp_keepalives_count; +extern __thread int tcp_user_timeout; #ifdef TRACE_SORT -extern bool trace_sort; +extern __thread bool trace_sort; #endif /* diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/lsyscache.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/lsyscache.h index ee35686a66..2eecea51d8 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/lsyscache.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/lsyscache.h @@ -60,7 +60,7 @@ typedef struct AttStatsSlot /* Hook for plugins to get control in get_attavgwidth() */ typedef int32 (*get_attavgwidth_hook_type) (Oid relid, AttrNumber attnum); -extern PGDLLIMPORT get_attavgwidth_hook_type get_attavgwidth_hook; +extern __thread PGDLLIMPORT get_attavgwidth_hook_type get_attavgwidth_hook; extern bool op_in_opfamily(Oid opno, Oid opfamily); extern int get_op_opfamily_strategy(Oid opno, Oid opfamily); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/memutils.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/memutils.h index 909bc2e988..bb75d4f0ba 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/memutils.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/memutils.h @@ -52,16 +52,16 @@ * Only TopMemoryContext and ErrorContext are initialized by * MemoryContextInit() itself. */ -extern PGDLLIMPORT MemoryContext TopMemoryContext; -extern PGDLLIMPORT MemoryContext ErrorContext; -extern PGDLLIMPORT MemoryContext PostmasterContext; -extern PGDLLIMPORT MemoryContext CacheMemoryContext; -extern PGDLLIMPORT MemoryContext MessageContext; -extern PGDLLIMPORT MemoryContext TopTransactionContext; -extern PGDLLIMPORT MemoryContext CurTransactionContext; +extern __thread PGDLLIMPORT MemoryContext TopMemoryContext; +extern __thread PGDLLIMPORT MemoryContext ErrorContext; +extern __thread PGDLLIMPORT MemoryContext PostmasterContext; +extern __thread PGDLLIMPORT MemoryContext CacheMemoryContext; +extern __thread PGDLLIMPORT MemoryContext MessageContext; +extern __thread PGDLLIMPORT MemoryContext TopTransactionContext; +extern __thread PGDLLIMPORT MemoryContext CurTransactionContext; /* This is a transient link to the active portal's memory context: */ -extern PGDLLIMPORT MemoryContext PortalContext; +extern __thread PGDLLIMPORT MemoryContext PortalContext; /* Backwards compatibility macro */ #define MemoryContextResetAndDeleteChildren(ctx) MemoryContextReset(ctx) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/palloc.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/palloc.h index cc356a6372..52be01579b 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/palloc.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/palloc.h @@ -56,7 +56,7 @@ typedef struct MemoryContextCallback * Avoid accessing it directly! Instead, use MemoryContextSwitchTo() * to change the setting. */ -extern PGDLLIMPORT MemoryContext CurrentMemoryContext; +extern __thread PGDLLIMPORT MemoryContext CurrentMemoryContext; /* * Flags for MemoryContextAllocExtended. diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/plancache.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/plancache.h index 522020d763..23f42e91c4 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/plancache.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/plancache.h @@ -35,7 +35,7 @@ typedef enum } PlanCacheMode; /* GUC parameter */ -extern int plan_cache_mode; +extern __thread int plan_cache_mode; #define CACHEDPLANSOURCE_MAGIC 195726186 #define CACHEDPLAN_MAGIC 953717834 diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/ps_status.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/ps_status.h index 9f43e1fdf0..bcfdfdbfab 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/ps_status.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/ps_status.h @@ -12,7 +12,7 @@ #ifndef PS_STATUS_H #define PS_STATUS_H -extern bool update_process_title; +extern __thread bool update_process_title; extern char **save_ps_display_args(int argc, char **argv); diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/relcache.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/relcache.h index ff478c3ba7..4b2d6c8b61 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/relcache.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/relcache.h @@ -142,9 +142,9 @@ extern void RelationCacheInitFilePostInvalidate(void); extern void RelationCacheInitFileRemove(void); /* should be used only by relcache.c and catcache.c */ -extern bool criticalRelcachesBuilt; +extern __thread bool criticalRelcachesBuilt; /* should be used only by relcache.c and postinit.c */ -extern bool criticalSharedRelcachesBuilt; +extern __thread bool criticalSharedRelcachesBuilt; #endif /* RELCACHE_H */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/resowner.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/resowner.h index 878f39ccf1..096ebf123c 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/resowner.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/resowner.h @@ -30,10 +30,10 @@ typedef struct ResourceOwnerData *ResourceOwner; /* * Globally known ResourceOwners */ -extern PGDLLIMPORT ResourceOwner CurrentResourceOwner; -extern PGDLLIMPORT ResourceOwner CurTransactionResourceOwner; -extern PGDLLIMPORT ResourceOwner TopTransactionResourceOwner; -extern PGDLLIMPORT ResourceOwner AuxProcessResourceOwner; +extern __thread PGDLLIMPORT ResourceOwner CurrentResourceOwner; +extern __thread PGDLLIMPORT ResourceOwner CurTransactionResourceOwner; +extern __thread PGDLLIMPORT ResourceOwner TopTransactionResourceOwner; +extern __thread PGDLLIMPORT ResourceOwner AuxProcessResourceOwner; /* * Resource releasing is done in three phases: pre-locks, locks, and diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/rls.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/rls.h index 49542f3aa7..fed35c7e9e 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/rls.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/rls.h @@ -14,7 +14,7 @@ #define RLS_H /* GUC variable */ -extern bool row_security; +extern __thread bool row_security; /* * Used by callers of check_enable_rls. diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/selfuncs.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/selfuncs.h index 7ac4a06391..d79a248f11 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/selfuncs.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/selfuncs.h @@ -121,12 +121,12 @@ typedef bool (*get_relation_stats_hook_type) (PlannerInfo *root, RangeTblEntry *rte, AttrNumber attnum, VariableStatData *vardata); -extern PGDLLIMPORT get_relation_stats_hook_type get_relation_stats_hook; +extern __thread PGDLLIMPORT get_relation_stats_hook_type get_relation_stats_hook; typedef bool (*get_index_stats_hook_type) (PlannerInfo *root, Oid indexOid, AttrNumber indexattnum, VariableStatData *vardata); -extern PGDLLIMPORT get_index_stats_hook_type get_index_stats_hook; +extern __thread PGDLLIMPORT get_index_stats_hook_type get_index_stats_hook; /* Functions in selfuncs.c */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/snapmgr.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/snapmgr.h index 651ff60998..8dc228a285 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/snapmgr.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/snapmgr.h @@ -45,7 +45,7 @@ #define EarlyPruningEnabled(rel) (old_snapshot_threshold >= 0 && RelationAllowsEarlyPruning(rel)) /* GUC variables */ -extern PGDLLIMPORT int old_snapshot_threshold; +extern __thread PGDLLIMPORT int old_snapshot_threshold; extern Size SnapMgrShmemSize(void); @@ -53,17 +53,17 @@ extern void SnapMgrInit(void); extern TimestampTz GetSnapshotCurrentTimestamp(void); extern TimestampTz GetOldSnapshotThresholdTimestamp(void); -extern bool FirstSnapshotSet; +extern __thread bool FirstSnapshotSet; -extern PGDLLIMPORT TransactionId TransactionXmin; -extern PGDLLIMPORT TransactionId RecentXmin; -extern PGDLLIMPORT TransactionId RecentGlobalXmin; -extern PGDLLIMPORT TransactionId RecentGlobalDataXmin; +extern __thread PGDLLIMPORT TransactionId TransactionXmin; +extern __thread PGDLLIMPORT TransactionId RecentXmin; +extern __thread PGDLLIMPORT TransactionId RecentGlobalXmin; +extern __thread PGDLLIMPORT TransactionId RecentGlobalDataXmin; /* Variables representing various special snapshot semantics */ -extern PGDLLIMPORT SnapshotData SnapshotSelfData; -extern PGDLLIMPORT SnapshotData SnapshotAnyData; -extern PGDLLIMPORT SnapshotData CatalogSnapshotData; +extern __thread PGDLLIMPORT SnapshotData SnapshotSelfData; +extern __thread PGDLLIMPORT SnapshotData SnapshotAnyData; +extern __thread PGDLLIMPORT SnapshotData CatalogSnapshotData; #define SnapshotSelf (&SnapshotSelfData) #define SnapshotAny (&SnapshotAnyData) diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/timestamp.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/timestamp.h index d45bf2bb7b..6d48dca55f 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/timestamp.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/timestamp.h @@ -57,10 +57,10 @@ /* Set at postmaster start */ -extern TimestampTz PgStartTime; +extern __thread TimestampTz PgStartTime; /* Set at configuration reload */ -extern TimestampTz PgReloadTime; +extern __thread TimestampTz PgReloadTime; /* Internal routines (not fmgr-callable) */ diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/xml.h b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/xml.h index cf0e61fb9d..1dc954a118 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/xml.h +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/include/utils/xml.h @@ -75,9 +75,9 @@ extern char *map_sql_identifier_to_xml_name(const char *ident, bool fully_escape extern char *map_xml_name_to_sql_identifier(const char *name); extern char *map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings); -extern int xmlbinary; /* XmlBinaryType, but int for guc enum */ +extern __thread int xmlbinary; /* XmlBinaryType, but int for guc enum */ -extern int xmloption; /* XmlOptionType, but int for guc enum */ +extern __thread int xmloption; /* XmlOptionType, but int for guc enum */ extern const TableFuncRoutine XmlTableRoutine; diff --git a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/timezone/localtime.c b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/timezone/localtime.c index fa3c059038..964085840e 100644 --- a/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/timezone/localtime.c +++ b/ydb/library/yql/parser/pg_query_wrapper/postgresql/src/timezone/localtime.c @@ -99,7 +99,7 @@ static bool typesequiv(struct state const *, int, int); * Thanks to Paul Eggert for noting this. */ -static struct pg_tm tm; +static __thread struct pg_tm tm; /* Initialize *S to a value based on UTOFF, ISDST, and DESIGIDX. */ static void diff --git a/ydb/library/yql/parser/pg_query_wrapper/thread_inits.c b/ydb/library/yql/parser/pg_query_wrapper/thread_inits.c new file mode 100644 index 0000000000..11d395829f --- /dev/null +++ b/ydb/library/yql/parser/pg_query_wrapper/thread_inits.c @@ -0,0 +1,15 @@ +#include "thread_inits.h" +static __thread int pg_thread_init_flag; +void pg_thread_init(void) { + if (pg_thread_init_flag) return; + pg_thread_init_flag=1; + BackendList_init(); + CurrentTransactionState_init(); + DatabaseList_init(); + MXactCache_init(); + cached_expression_list_init(); + dsm_segment_list_init(); + lsn_mapping_init(); + pcxt_list_init(); + saved_plan_list_init(); +} diff --git a/ydb/library/yql/parser/pg_query_wrapper/thread_inits.h b/ydb/library/yql/parser/pg_query_wrapper/thread_inits.h new file mode 100644 index 0000000000..483d17db80 --- /dev/null +++ b/ydb/library/yql/parser/pg_query_wrapper/thread_inits.h @@ -0,0 +1,2 @@ +#pragma once +extern void pg_thread_init(); diff --git a/ydb/library/yql/parser/pg_query_wrapper/vars.txt b/ydb/library/yql/parser/pg_query_wrapper/vars.txt new file mode 100644 index 0000000000..43775271aa --- /dev/null +++ b/ydb/library/yql/parser/pg_query_wrapper/vars.txt @@ -0,0 +1,1515 @@ +ATExecSetRelOptions.validnsps +AbortStartTime +ActivePortal +ActiveSnapshot +AnonymousShmem +AnonymousShmemSize +Ap +ApplyContext +ApplyMessageContext +ArchiveRecoveryRequested +Array_nulls +AttoptCacheHash +AuthenticatedUserId +AuthenticatedUserIsSuperuser +AuthenticationTimeout +AutoVacPID +AutoVacuumShmem +AutovacMemCxt +AutovacuumLauncherPid +AuxProcessResourceOwner +AuxiliaryProcs +BackendActivityBuffer +BackendActivityBufferSize +BackendAppnameBuffer +BackendClientHostnameBuffer +BackendList +BackendSslStatusBuffer +BackendStatusArray +BackendWritebackContext +BackgroundWorkerData +BackgroundWorkerList +BgBufferSync.next_passes +BgBufferSync.next_to_clean +BgBufferSync.prev_strategy_buf_id +BgBufferSync.prev_strategy_passes +BgBufferSync.saved_info_valid +BgBufferSync.smoothed_alloc +BgBufferSync.smoothed_density +BgWriterDelay +BgWriterPID +BgWriterStats +BlockSig +BufferBlocks +BufferDescriptors +BufferIOLWLockArray +CFuncHash +CacheHdr +CacheInitialized +CacheMemoryContext +CatalogSnapshot +CatalogSnapshotData +CheckPointCompletionTarget +CheckPointDistanceEstimate +CheckPointSegments +CheckPointTimeout +CheckPointWarning +CheckpointStats +CheckpointWriteDelay.absorb_counter +CheckpointerPID +CheckpointerShmem +CkptBufferIds +ClientAuthInProgress +ClientAuthentication_hook +ClientConnectionLost +ClientEncoding +CommitDelay +CommitSiblings +CommitTsCtlData +ConfigFileLineno +ConfigFileName +ConfigReloadPending +ConfigureNamesBool +ConfigureNamesEnum +ConfigureNamesInt +ConfigureNamesReal +ConfigureNamesString +ControlFile +ConvProcList +CreateNewPortal.unnamed_portal_count +CritSectionCount +CurTransactionContext +CurTransactionResourceOwner +CurrentDynaHashCxt +CurrentExtensionObject +CurrentLCTimeValid +CurrentLocaleConvValid +CurrentMemoryContext +CurrentResourceOwner +CurrentSession +CurrentSnapshot +CurrentSnapshotData +CurrentTransactionState +CurrentUserId +Current_last_tid +DCHCache +DCHCounter +DataDir +DatabaseEncoding +DatabaseList +DatabaseListCxt +DatabasePath +DateOrder +DateStyle +Db_user_namespace +DeadlockTimeout +Debug_pretty_print +Debug_print_parse +Debug_print_plan +Debug_print_rewritten +DefaultXactDeferrable +DefaultXactIsoLevel +DefaultXactReadOnly +DefineRelation.validnsps +DoingCommandRead +DoingCopyOut +Dynamic_library_path +EOXactTupleDescArray +EOXactTupleDescArrayLen +EchoQuery +EnableHotStandby +EnableSSL +EndRecPtr +ErrorContext +EventTriggerCache +EventTriggerCacheContext +EventTriggerCacheState +ExecutorCheckPerms_hook +ExecutorEnd_hook +ExecutorFinish_hook +ExecutorRun_hook +ExecutorStart_hook +ExitOnAnyError +ExplainOneQuery_hook +ExportInProgress +ExtraOptions +FastPathLocalUseCount +FastPathStrongRelationLocks +FatalError +FeBeWaitSet +FinishedSerializableTransactions +FirstCallSinceLastCheckpoint.ckpt_done +FirstSnapshotSet +FirstXactSnapshot +FreezeLimit +FrontendProtocol +GUCNestLevel +GUC_check_errcode_value +GUC_check_errdetail_string +GUC_check_errhint_string +GUC_check_errmsg_string +GUC_flex_fatal_errmsg +GUC_flex_fatal_jmp +GUC_yy_flex_debug +GUC_yyin +GUC_yyleng +GUC_yylineno +GUC_yyout +GUC_yytext +Geqo_effort +Geqo_generations +Geqo_pool_size +Geqo_seed +Geqo_selection_bias +GetBackgroundWorkerTypeByPid.result +GetConfigOption.buffer +GetConfigOptionResetString.buffer +GetConflictingVirtualXIDs.vxids +GetLocalBufferStorage.LocalBufferContext +GetLocalBufferStorage.cur_block +GetLocalBufferStorage.next_buf_in_block +GetLocalBufferStorage.num_bufs_in_block +GetLocalBufferStorage.total_bufs_allocated +GetLockConflicts.vxids +GetPgClassDescriptor.pgclassdesc +GetPgIndexDescriptor.pgindexdesc +GetRunningTransactionData.CurrentRunningXactsData +GetStableLatestTransactionId.lxid +GetStableLatestTransactionId.stablexid +GetXLogBuffer.cachedPage +GetXLogBuffer.cachedPos +GinFuzzySearchLimit +HandleParallelMessages.hpm_context +HaveCrashedWorker +HbaFileName +HistoricSnapshot +ILHead +IdentFileName +IdleInTransactionSessionTimeout +IdleInTransactionSessionTimeoutPending +IgnoreSystemIndexes +InArchiveRecovery +InProgressBuf +InRecovery +InRedo +InitializingParallelWorker +InterruptHoldoffCount +InterruptPending +IntervalStyle +IsBackgroundWorker +IsBinaryUpgrade +IsForInput +IsPostmasterEnvironment +IsUnderPostmaster +KnownAssignedXids +KnownAssignedXidsValid +LWLockTrancheNames +LWLockTrancheNamesAllocated +LastRec +ListenAddresses +ListenSocket +LoadedSSL +LocalBufHash +LocalBufferBlockPointers +LocalBufferDescriptors +LocalHotStandbyActive +LocalLatchData +LocalPredicateLockHash +LocalPromoteIsTriggered +LocalRecoveryInProgress +LocalRefCount +LocalXLogInsertAllowed +LockMethodLocalHash +LockMethodLockHash +LockMethodProcLockHash +LockTimeout +LogRepWorkerWalRcvConn +Log_RotationAge +Log_RotationSize +Log_autovacuum_min_duration +Log_connections +Log_destination +Log_destination_string +Log_directory +Log_disconnections +Log_error_verbosity +Log_file_mode +Log_filename +Log_line_prefix +Log_truncate_on_rotation +Logging_collector +LogicalRepCtx +LogicalRepPartMap +LogicalRepPartMapContext +LogicalRepRelMap +LogicalRepRelMapContext +LogstreamResult +LogwrtResult +MXactCache +MXactCacheMembers +MXactContext +MainLWLockArray +MaxBackends +MaxConnections +MdCxt +MergeAttributes.bogus_marker +MessageContext +MessageEncoding +Mode +MultiXactCutoff +MultiXactMemberCtlData +MultiXactOffsetCtlData +MultiXactState +MyAuxProcType +MyBEEntry +MyBackendId +MyBackendType +MyBgworkerEntry +MyCancelKey +MyDatabaseId +MyDatabaseTableSpace +MyFixedParallelState +MyLatch +MyLockNo +MyLockedGxact +MyLogicalRepWorker +MyPMChildSlot +MyPgXact +MyProc +MyProcPid +MyProcPort +MyProcSignalSlot +MyReplicationSlot +MySerializableXact +MyStartTime +MyStartTimestamp +MySubscription +MySubscriptionValid +MyTriggerDepth +MyWalSnd +MyWorkerInfo +MyXactDidWrite +MyXactFlags +NBuffers +NLocBuffer +NUMCache +NUMCounter +NamedLWLockTrancheArray +NamedLWLockTrancheRequestArray +NamedLWLockTrancheRequests +NamedLWLockTrancheRequestsAllocated +NextEOXactTupleDescNum +NextRecordTypmod +None_Receiver +NotifyCtlData +Nulls +OldCommittedSxact +OldestActiveSnapshot +OldestMemberMXactId +OldestVisibleMXactId +OldestXmin +OpClassCache +OprCacheHash +OprProofCacheHash +OuterUserId +OutputFileName +PGLC_localeconv.CurrentLocaleConv +PGLC_localeconv.CurrentLocaleConvAllocated +PG_exception_stack +PMSignalState +PageSetChecksumCopy.pageCopy +ParallelCurrentXids +ParallelMasterBackendId +ParallelMasterPid +ParallelMessagePending +ParallelWorkerNumber +Password_encryption +PgArchPID +PgReloadTime +PgStartTime +PgStatPID +PinCountWaitBuf +PortalContext +PortalHashTable +PostAuthDelay +PostPortNumber +PostmasterContext +PostmasterPid +PqCommBusy +PqCommMethods +PqCommReadingMsg +PqRecvBuffer +PqRecvLength +PqRecvPointer +PqSendBuffer +PqSendBufferSize +PqSendPointer +PqSendStart +PreAuthDelay +PredXact +PredicateLockHash +PredicateLockTargetHash +PreparedXactProcs +PrevCheckPointDistance +PrimaryConnInfo +PrimarySlotName +PrivateRefCountArray +PrivateRefCountClock +PrivateRefCountHash +PrivateRefCountOverflowed +ProcDiePending +ProcGlobal +ProcLastRecPtr +ProcSignal +ProcSignalBarrierPending +ProcStructLock +ProcessStandbyReplyMessage.fullyAppliedLastTime +ProcessSyncRequests.sync_in_progress +ProcessUtilitySlow.validnsps +ProcessUtility_hook +PromoteTriggerFile +QueryCancelHoldoffCount +QueryCancelPending +RWConflictPool +ReachedNormalRunning +ReadControlFile.wal_segsz_str +ReadRecPtr +ReceiveSharedInvalidMessages.messages +ReceiveSharedInvalidMessages.nextmsg +ReceiveSharedInvalidMessages.nummsgs +RecentGlobalDataXmin +RecentGlobalXmin +RecentXmin +RecordCacheArray +RecordCacheArrayLen +RecordCacheHash +RecordIdentifierArray +RecoveryConflictPending +RecoveryConflictReason +RecoveryConflictRetryable +RecoveryLockLists +RedoRecPtr +RedoStartLSN +RegisterBackgroundWorker.numworkers +RegisteredSnapshots +Reinit +RelationIdCache +RelfilenodeMapHash +ReplicationSlotCtl +ReservedBackends +ReservedRefCountEntry +ResourceRelease_callbacks +SLRUStats +SMgrRelationHash +SPI_processed +SPI_result +SPI_result_code_string.buf +SPI_tuptable +SSLCipherSuites +SSLECDHCurve +SSLPreferServerCiphers +SSL_context +SSL_initialized +SSLerrmessage.errbuf +Save_r +Save_t +SavedResourceOwnerDuringExport +SavedSerializableXact +ScratchPartitionLock +ScratchTargetTagHash +SecondarySnapshot +SecondarySnapshotData +SecurityRestrictionContext +SendStop +SerialSlruCtlData +SerializableXidHash +SessionReplicationRole +SessionUserId +SessionUserIsSuperuser +SetRoleIsActive +SharedBufHash +SharedFileSetInit.counter +SharedInvalidMessageCounter +SharedInvalidMessagesArray +ShmemBase +ShmemEnd +ShmemIndex +ShmemLock +ShmemSegHdr +ShmemVariableCache +Shutdown +ShutdownRequestPending +SizeVfdCache +SnapshotAnyData +SnapshotSelfData +StandbyMode +StandbyModeRequested +StartWorkerNeeded +StartupBlockSig +StartupPID +StartupStatus +StatementTimeout +StoreAttrDefault.nulls +StrategyControl +StrongLockInProgress +SubTransCtlData +SubXact_callbacks +SyncRepConfig +SyncRepStandbyNames +SyncRepWaitMode +SysAtt +SysCache +SysCacheRelationOid +SysCacheRelationOidSize +SysCacheSupportingRelOid +SysCacheSupportingRelOidSize +SysLoggerPID +TSConfigCacheHash +TSCurrentConfig +TSCurrentConfigCache +TSDictionaryCacheHash +TSParserCacheHash +TableSpaceCacheHash +ThisTimeLineID +ToClientConvProc +ToServerConvProc +TopMemoryContext +TopPortalContext +TopTransactionContext +TopTransactionResourceOwner +TopTransactionStateData +Trace_notify +TransactionAbortContext +TransactionIdIsInProgress.xids +TransactionXmin +Transform_null_equals +TwoPhaseGetGXact.cached_gxact +TwoPhaseGetGXact.cached_xid +TwoPhaseState +Typ +TypeCacheHash +UnBlockSig +Unix_socket_directories +Unix_socket_group +Unix_socket_permissions +UsableBytesInSegment +UseSemiNewlineNewline +UsedShmemSegAddr +UsedShmemSegID +Utf8ToServerConvProc +VacuumActiveNWorkers +VacuumCostActive +VacuumCostBalance +VacuumCostBalanceLocal +VacuumCostDelay +VacuumCostLimit +VacuumCostPageDirty +VacuumCostPageHit +VacuumCostPageMiss +VacuumPageDirty +VacuumPageHit +VacuumPageMiss +VacuumSharedCostBalance +VfdCache +VoidString +WALInsertLockAcquire.lockToTry +WALInsertLocks +WaitForWALToBecomeAvailable.last_fail_time +WalRcv +WalReceiverFunctions +WalReceiverPID +WalReceiverRequested +WalSndCaughtUp +WalSndCtl +WalSndUpdateProgress.sendTime +WalSndWaitForWal.RecentFlushPtr +WalWriterDelay +WalWriterFlushAfter +WalWriterPID +XLOGbuffers +XLogArchiveCommand +XLogArchiveMode +XLogArchiveTimeout +XLogBackgroundFlush.lastflush +XLogCtl +XLogReceiptSource +XLogReceiptTime +XLogSendLogical.flushPtr +XLogWalRcvSendHSFeedback.master_has_standby_xmin +XLogWalRcvSendHSFeedback.sendTime +XLogWalRcvSendReply.flushPtr +XLogWalRcvSendReply.sendTime +XLogWalRcvSendReply.writePtr +XactCtlData +XactDeferrable +XactIsoLevel +XactLastCommitEnd +XactLastRecEnd +XactReadOnly +XactTopFullTransactionId +Xact_callbacks +_SPI_connected +_SPI_current +_SPI_stack +_SPI_stack_depth +_rand48_seed +abbrevcache +abortedRecPtr +acos_0_5 +activeCreationNamespace +activePathGeneration +activeSearchPath +activeTempCreationPending +active_local_updates +active_shared_updates +active_timeouts +addWrd.nres +addWrd.ntres +add_reloption.max_custom_options +addin_request_allowed +afterConstraints +afterTriggers +alarm_enabled +allPgXact +allProcs +all_timeouts +all_timeouts_initialized +allocatedDescs +allowSystemTableMods +amRegisteredListener +am_autovacuum_launcher +am_autovacuum_worker +am_cascading_walsender +am_db_walsender +am_walsender +anl_context +announce_next_takeover +application_name +archiveCleanupCommand +archiverStats +array_extra_data +asin_0_5 +assert_enabled +asyncQueueControl +atan_1_0 +atexit_callback_setup +attrtypes +autovac_refresh_stats.last_read +autovacuum_anl_scale +autovacuum_anl_thresh +autovacuum_freeze_max_age +autovacuum_max_workers +autovacuum_multixact_freeze_max_age +autovacuum_naptime +autovacuum_start_daemon +autovacuum_vac_cost_delay +autovacuum_vac_cost_limit +autovacuum_vac_ins_scale +autovacuum_vac_ins_thresh +autovacuum_vac_scale +autovacuum_vac_thresh +autovacuum_work_mem +avlauncher_needs_signal +awaitedLock +awaitedOwner +backend_flush_after +backend_startup_complete +backtrace_functions +backtrace_symbol_list +backup_started_in_recovery +backup_streamed +backup_total +baseCreationNamespace +baseSearchPath +baseSearchPathValid +baseTempCreationPending +base_yyparse.yyloc_default +base_yyparse.yyval_default +beforeConstraints +before_shmem_exit_index +before_shmem_exit_list +begininsert_called +bgwriterLaunched +bgwriter_flush_after +bgwriter_lru_maxpages +bgwriter_lru_multiplier +binary_upgrade_next_array_pg_type_oid +binary_upgrade_next_heap_pg_class_oid +binary_upgrade_next_index_pg_class_oid +binary_upgrade_next_pg_authid_oid +binary_upgrade_next_pg_enum_oid +binary_upgrade_next_pg_type_oid +binary_upgrade_next_toast_pg_class_oid +binary_upgrade_next_toast_pg_type_oid +binary_upgrade_record_init_privs +block_size +blocking_autovacuum_proc +bonjour_name +boolRelOpts +boot_reldesc +boot_yy_flex_debug +boot_yychar +boot_yyin +boot_yyleng +boot_yylineno +boot_yylval +boot_yynerrs +boot_yyout +boot_yytext +bootstrap_data_checksum_version +btvacinfo +buffer_lists +bytea_output +bytesToHex.hex +cachedCommitLSN +cachedFetchXid +cachedFetchXidStatus +cached_expression_list +cached_member_role +cached_membership_roles +cached_privs_role +cached_privs_roles +catchupInterruptPending +check_function_bodies +check_password_hook +checkpoint_cycle_ctr +checkpoint_flush_after +ckpt_active +ckpt_cached_elapsed +ckpt_start_recptr +ckpt_start_time +client_encoding_string +client_min_messages +cluster_name +collation_cache +comboCids +comboHash +commitTsShared +connsAllowed +constraint_exclusion +context_freelists +cookies +cookies_size +copybuf +cot_45 +cpu_index_tuple_cost +cpu_operator_cost +cpu_tuple_cost +create_ctas_internal.validnsps +create_upper_paths_hook +creating_extension +criticalRelcachesBuilt +criticalSharedRelcachesBuilt +csvlogFile +curConstraints +curFileTLI +curinsert_flags +currentCommandId +currentCommandIdUsed +currentEventTriggerState +currentSource +currentSubTransactionId +currentlyReindexedHeap +currentlyReindexedIndex +cursor_tuple_fraction +custom_options +custom_scan_methods +cv_sleep_target +cv_wait_event_set +dataExecPlaceToPageInternal.data +data_checksums +data_directory +data_directory_mode +data_sync_retry +datecache +datestyle_string +deadlockDetails +deadlock_state +debug_query_string +default_freeze_min_age +default_freeze_table_age +default_multixact_freeze_min_age +default_multixact_freeze_table_age +default_statistics_target +default_table_access_method +default_tablespace +default_with_oids +degree_c_forty_five +degree_c_one +degree_c_one_half +degree_c_sixty +degree_c_thirty +degree_consts_set +deltacache +disable_cost +dispatch_table +doPageWrites +doRequestWalReceiverReply +doing_extended_query_message +drandom_seed +drandom_seed_set +dsm_control +dsm_control_handle +dsm_control_impl_private +dsm_control_mapped_size +dsm_init_done +dsm_segment_list +dummy_spinlock +dummy_ssl_passwd_cb_called +dynamic_shared_memory_type +effective_cache_size +effective_io_concurrency +elapsed_min_unit +elevel +emit_log_hook +emode_for_corrupt_record.lastComplaint +enableFsync +enable_bitmapscan +enable_bonjour +enable_gathermerge +enable_geqo +enable_hashagg +enable_hashjoin +enable_incremental_sort +enable_indexonlyscan +enable_indexscan +enable_material +enable_mergejoin +enable_nestloop +enable_parallel_append +enable_parallel_hash +enable_partition_pruning +enable_partitionwise_aggregate +enable_partitionwise_join +enable_seqscan +enable_sort +enable_tidscan +entryExecPlaceToPage.data +enumRelOpts +enum_blacklist +eoxact_list +eoxact_list_len +eoxact_list_overflowed +error_context_stack +errordata +errordata_stack_depth +escape_string_warning +event_source +executeDateTimeMethod.fmt_str +executeDateTimeMethod.fmt_txt +expectedTLEs +explain_get_index_name_hook +exportedSnapshots +extensible_node_methods +external_pid_file +extra_float_digits +fast_promote +file_list +file_tail +find_rendezvous_variable.rendezvousHash +firstDomainTypeEntry +first_syslogger_file_time +flushedUpto +fmgr_hook +forceSyncCommit +force_parallel_mode +formatted_log_time +formatted_start_time +from_collapse_limit +fscxt +fullPageWrites +geqo_threshold +getWeights.ws +get_attavgwidth_hook +get_code_decomposition.x +get_config_unit_name.bbuf +get_config_unit_name.xbuf +get_index_stats_hook +get_object_property_data.prop_last +get_relation_info_hook +get_relation_stats_hook +get_stack_depth_rlimit.val +gin_pending_list_limit +gistBufferingOptValues +gistGetFakeLSN.counter +gistGetFakeLSN.lastlsn +globalStats +gmtsub.gmtptr +got_SIGHUP +got_SIGTERM +got_SIGUSR2 +got_STOPPING +got_deadlock_timeout +got_standby_deadlock_timeout +got_standby_lock_timeout +guc_dirty +guc_variables +hash_mem_multiplier +have_function_stats +have_xact_temporary_files +hdr_rdt +hdr_scratch +held_lwlocks +hist_entries +hist_start +holdingAllLocks +hot_standby_feedback +huge_pages +icu_converter +ignore_checksum_failure +ignore_invalid_pages +ignore_till_sync +in_progress_list +in_progress_list_len +in_progress_list_maxlen +in_remote_transaction +in_restore_command +incoming_message +intRelOpts +integer_datetimes +internal_flush.last_reported_send_errno +invalid_page_tab +jit_above_cost +jit_debugging_support +jit_dump_bitcode +jit_enabled +jit_expressions +jit_inline_above_cost +jit_optimize_above_cost +jit_profiling_support +jit_provider +jit_tuple_deforming +join_collapse_limit +join_search_hook +jsonpath_yy_flex_debug +jsonpath_yyin +jsonpath_yyleng +jsonpath_yylineno +jsonpath_yyout +jsonpath_yyparse.yyval_default +jsonpath_yytext +label_file +label_provider_list +lag_tracker +lastFullPageWrites +lastSourceFailed +lastUsedConfig +lastUsedDictionary +lastUsedParser +last_assigned_kind +last_checkpoint_time +last_csv_file_name +last_file_name +last_pgarch_start_time +last_pgstat_start_time +last_processing +last_reply_timestamp +last_roleid +last_roleid_is_super +last_sigterm_time +last_snapshot_lsn +last_snapshot_ts +last_status_len +last_used_seq +last_xlog_switch_time +latestObservedXid +lc_collate_envbuf +lc_collate_is_c.result +lc_ctype_envbuf +lc_ctype_is_c.result +lc_messages_envbuf +lc_monetary_envbuf +lc_numeric_envbuf +lc_time_envbuf +listenChannels +litbuf +lo_cleanup_needed +lo_compat_privileges +lo_heap_r +lo_index_r +localBackendStatusTable +localNumBackends +local_map +local_preload_libraries_string +locale_collate +locale_ctype +locale_messages +locale_monetary +locale_numeric +locale_time +localized_abbrev_days +localized_abbrev_months +localized_full_days +localized_full_months +lockAwaited +lock_files +lock_named_request_allowed +log_btree_build_stats +log_checkpoints +log_duration +log_executor_stats +log_hostname +log_line_prefix.log_line_number +log_line_prefix.log_my_pid +log_lock_waits +log_min_duration_sample +log_min_duration_statement +log_min_error_statement +log_min_messages +log_parameter_max_length +log_parameter_max_length_on_error +log_parser_stats +log_planner_stats +log_replication_commands +log_statement +log_statement_sample_rate +log_statement_stats +log_temp_files +log_timezone +log_timezone_string +log_xact_sample_rate +logical_decoding_ctx +logical_decoding_work_mem +lsn_mapping +mainrdata_head +mainrdata_last +mainrdata_len +maintenance_io_concurrency +maintenance_work_mem +make_greater_string.suffixchar +make_greater_string.suffixcollation +master_image_masked +matview_maintenance_depth +maxAllocatedDescs +maxCurConstraints +maxPossibleConstraints +maxSems +maxSharedInvalidMessagesArray +max_files_per_process +max_function_args +max_identifier_length +max_index_keys +max_locks_per_xact +max_logical_replication_workers +max_parallel_maintenance_workers +max_parallel_workers +max_parallel_workers_per_gather +max_predicate_locks_per_page +max_predicate_locks_per_relation +max_predicate_locks_per_xact +max_prepared_xacts +max_rdatas +max_registered_block_id +max_registered_buffers +max_replication_slots +max_safe_fds +max_slot_wal_keep_size_mb +max_stack_depth +max_stack_depth_bytes +max_standby_archive_delay +max_standby_streaming_delay +max_sync_workers_per_subscription +max_wal_senders +max_wal_size_mb +max_worker_processes +memory_units_hint +minRecoveryPoint +minRecoveryPointTLI +min_parallel_index_scan_size +min_parallel_table_scan_size +min_wal_size_mb +missingContrecPtr +mxid_to_string.str +myTempNamespace +myTempNamespaceSubID +myTempToastNamespace +my_bio_methods +my_exec_path +nCurConstraints +nDeadlockDetails +nParallelCurrentXids +nPossibleConstraints +nUnreportedXids +nVisitedProcs +nWaitOrders +n_DCHCache +n_NUMCache +namespaceUser +namespace_search_path +need_initialization +needs_fmgr_hook +newNodeMacroHolder +nextFreeLocalBuf +nextLocalTransactionId +nextSemKey +nextTempTableSpace +next_rotation_time +nfile +nogc +notifyInterruptPending +noverify_checksums +nullSemAction +numAllocatedDescs +numExternalFDs +numSems +numSharedInvalidMessagesArray +numTempTableSpaces +num_active_timeouts +num_columns_read +num_custom_options +num_guc_variables +num_held_lwlocks +num_rdatas +num_res +num_seq_scans +num_temp_buffers +num_word.buf +numattr +object_access_hook +oldSnapshotControl +old_snapshot_threshold +oldrs +on_commit_launcher_wakeup +on_commit_stop_workers +on_commits +on_proc_exit_index +on_proc_exit_list +on_shmem_exit_index +on_shmem_exit_list +one_minus_cos_60 +opCtx +openLogFile +openLogSegNo +openlog_done +openssl_tls_init_hook +operator_precedence_warning +outbuf_maxlen +output_message +overrideStack +parallel_leader_participation +parallel_setup_cost +parallel_tuple_cost +parsed_hba_context +parsed_hba_lines +parsed_ident_context +parsed_ident_lines +pcxt_list +pendingActions +pendingDeletes +pendingNotifies +pendingOps +pendingOpsCxt +pendingReindexedIndexes +pendingSyncHash +pendingUnlinks +pendingWalRcvRestart +pending_client_encoding +pending_local_updates +pending_shared_updates +pending_write_requests +per_line_ctx +pgBufferUsage +pgStatAddr +pgStatBlockReadTime +pgStatBlockWriteTime +pgStatDBHash +pgStatFunctions +pgStatLocalContext +pgStatRunningInCollector +pgStatSock +pgStatTabHash +pgStatTabList +pgStatXactCommit +pgStatXactRollback +pgStatXactStack +pgWalUsage +pg_TZDIR.done_tzdir +pg_TZDIR.tzdir +pg_comp_crc32c +pg_ctype_cache_list +pg_dir_create_mode +pg_file_create_mode +pg_flush_data.not_implemented_by_kernel +pg_flush_data.pagesize +pg_krb_caseins_users +pg_krb_server_keyfile +pg_mode_mask +pg_perm_setlocale.save_lc_ctype +pg_popcount32 +pg_popcount64 +pg_regex_collation +pg_regex_locale +pg_regex_strategy +pg_rusage_show.result +pg_strerror.errorstr_buf +pg_strtok_ptr +pg_xml_init_library.first_time +pgstat_report_stat.last_report +pgstat_stat_directory +pgstat_stat_filename +pgstat_stat_tmpname +pgstat_temp_directory +pgstat_track_activities +pgstat_track_activity_query_size +pgstat_track_counts +pgstat_track_functions +phony_random_seed +pipe_eof_seen +pkglib_path +plan_cache_mode +plan_getrulebyoid +plan_getviewrule +planner_hook +pmState +possibleConstraints +post_parse_analyze_hook +postmaster_alive_fds +postmaster_possibly_dead +pq_mq_busy +pq_mq_handle +pq_mq_parallel_master_backend_id +pq_mq_parallel_master_pid +prepareGID +prepared_queries +procArray +proc_exit_inprogress +process_shared_preload_libraries_in_progress +process_syncing_tables_for_apply.last_start_times +process_syncing_tables_for_apply.table_states +promote_signaled +provider +provider_failed_loading +provider_successfully_loaded +ps_buffer +ps_buffer_cur_len +ps_buffer_fixed_size +ps_buffer_size +query_getrulebyoid +query_getviewrule +quote_all_identifiers +random_page_cost +rdatas +re_array +reachedConsistency +readFile +readLen +readOff +readSegNo +readSource +ready_to_stop +realRelOpts +receiveTLI +recentMulti +recentXid +records +recoveryEndCommand +recoveryRestoreCommand +recoveryStopAfter +recoveryStopLSN +recoveryStopName +recoveryStopTime +recoveryStopXid +recoveryTarget +recoveryTargetAction +recoveryTargetInclusive +recoveryTargetLSN +recoveryTargetName +recoveryTargetTLI +recoveryTargetTLIRequested +recoveryTargetTime +recoveryTargetTimeLineGoal +recoveryTargetXid +recovery_min_apply_delay +recovery_signal_file_found +recovery_target_lsn_string +recovery_target_name_string +recovery_target_string +recovery_target_time_string +recovery_target_timeline_string +recovery_target_xid_string +recursion_depth +recvFile +recvFileTLI +recvSegNo +redirection_done +register_persistent_abort_backup_handler.already_done +registered_buffers +reindexingNestLevel +relOpts +relcacheInvalsReceived +relcache_callback_count +relcache_callback_list +relfilenode_skey +remote_final_lsn +replay_image_masked +replication_active +replication_parse_result +replication_states +replication_states_ctl +replication_yy_flex_debug +replication_yychar +replication_yyin +replication_yyleng +replication_yylineno +replication_yylval +replication_yynerrs +replication_yyout +replication_yytext +replorigin_session_origin +replorigin_session_origin_lsn +replorigin_session_origin_timestamp +replorigin_session_setup.registered_cleanup +reply_message +reporting_enabled +restart_after_crash +restoredFromArchive +reverse_dispatch_table +ri_compare_cache +ri_constraint_cache +ri_constraint_cache_valid_count +ri_constraint_cache_valid_list +ri_query_cache +role_string +roleid_callback_registered +rotation_disabled +rotation_requested +row_description_buf +row_description_context +row_security +row_security_policy_hook_permissive +row_security_policy_hook_restrictive +sanitize_char.buf +sanitize_str.buf +save_XactDeferrable +save_XactIsoLevel +save_XactReadOnly +save_argc +save_argv +save_format_domain +save_format_errnumber +save_pgBufferUsage +save_pgWalUsage +saved_plan_list +saved_timeval +saved_timeval_set +scan_locations +scanbuf +scanbufhandle +scanbuflen +scanstring +scram_mock_salt.sha_digest +segment_size +selfpipe_owner_pid +selfpipe_readfd +selfpipe_writefd +sendTimeLine +sendTimeLineIsHistoric +sendTimeLineNextTLI +sendTimeLineValidUpto +send_feedback.last_flushpos +send_feedback.last_recvpos +send_feedback.last_writepos +send_feedback.reply_message +send_feedback.send_time +sentPtr +seq_page_cost +seq_scan_level +seq_scan_tables +seqhashtab +serialControl +server_encoding_string +server_version_num +server_version_string +sessionBackupState +session_auth_is_superuser +session_authorization_string +session_preload_libraries_string +session_replication_state +session_timezone +set_join_pathlist_hook +set_rel_pathlist_hook +sharedSemas +shared_map +shared_memory_options +shared_memory_type +shared_preload_libraries_string +shmInvalBuffer +shmem_exit_inprogress +shmem_startup_hook +show_data_directory_mode.buf +show_log_file_mode.buf +show_tcp_keepalives_count.nbuf +show_tcp_keepalives_idle.nbuf +show_tcp_keepalives_interval.nbuf +show_tcp_user_timeout.nbuf +show_unix_socket_permissions.buf +shutdown_requested +sin_30 +sizeComboCids +size_guc_variables +slruStats +slru_errcause +slru_errno +sock_paths +speculativeInsertionToken +spins_per_delay +ssl_ca_file +ssl_cert_file +ssl_crl_file +ssl_dh_params_file +ssl_is_server_start +ssl_key_file +ssl_library +ssl_loaded_verify_locations +ssl_max_protocol_version +ssl_min_protocol_version +ssl_passphrase_command +ssl_passphrase_command_supports_reload +ssl_renegotiation_limit +stack_base_ptr +standard_conforming_strings +standbySnapshotPendingXmin +standbyState +standbyWait_us +standby_signal_file_found +start_autovac_launcher +startptr +statrelpath +stmtStartTimestamp +str_time.buf +streamingDoneReceiving +streamingDoneSending +stringRelOpts +sync_cycle_ctr +sync_method +synchronize_seqscans +synchronous_commit +syncrep_parse_error_msg +syncrep_parse_result +syncrep_yy_flex_debug +syncrep_yychar +syncrep_yyin +syncrep_yyleng +syncrep_yylineno +syncrep_yylval +syncrep_yynerrs +syncrep_yyout +syncrep_yytext +syscache_callback_count +syscache_callback_links +syscache_callback_list +syslogFile +syslogPipe +syslog_facility +syslog_ident +syslog_ident_str +syslog_sequence_numbers +syslog_split_messages +table_states_valid +tan_45 +tblspc_map_file +tcp_keepalives_count +tcp_keepalives_idle +tcp_keepalives_interval +tcp_user_timeout +tempFileCounter +tempTableSpaces +temp_file_limit +temp_tablespaces +temporary_files_size +throttled_last +throttling_counter +throttling_sample +time_units_hint +timestamptz_to_str.buf +timezone_abbreviations_string +timezone_cache +timezone_string +tm +tmpbuf +topoProcs +total_addin_request +total_checksum_failures +total_func_time +trace_recovery_messages +trace_sort +track_commit_timestamp +track_io_timing +transInvalInfo +tryAdvanceTail +tuplecid_data +tupledesc_id_counter +twophaseExitRegistered +unlistenExitRegistered +unnamed_stmt_psrc +unowned_relns +unpack_sql_state.buf +unreportedXids +updateMinRecoveryPoint +update_process_title +usedComboCids +userDoption +vac_context +vac_strategy +vacuum.in_vacuum +vacuum_cleanup_index_scale_factor +vacuum_defer_cleanup_age +vacuum_freeze_min_age +vacuum_freeze_table_age +vacuum_multixact_freeze_min_age +vacuum_multixact_freeze_table_age +values +viewCheckOptValues +visitedProcs +waitOrderProcs +waitOrders +waiting +waiting_for_ping_response +wake_wal_senders +wakened +wal_block_size +wal_compression +wal_consistency_checking +wal_consistency_checking_string +wal_init_zero +wal_keep_size_mb +wal_level +wal_log_hints +wal_receiver_create_temp_slot +wal_receiver_status_interval +wal_receiver_timeout +wal_recycle +wal_retrieve_retry_interval +wal_segment_size +wal_sender_timeout +wal_skip_threshold +whereToSendOutput +work_mem +wrconn +write_csvlog.log_line_number +write_csvlog.log_my_pid +write_syslog.seq +xactStartTimestamp +xactStopTimestamp +xact_is_sampled +xact_started +xdbuf +xloginsert_cxt +xlogreader +xmlbinary +xmloption +yy_buffer_stack +yy_buffer_stack_max +yy_buffer_stack_top +yy_c_buf_p +yy_did_buffer_switch_on_eof +yy_hold_char +yy_init +yy_last_accepting_cpos +yy_last_accepting_state +yy_n_chars +yy_start +yy_start_state_list +yyline +zero_damaged_pages +zoneabbrevtbl |