Summary:
Import the following files as of the latest commit (12398eddbd531080239c350528da38268ac0fa0e - Merge tag 'REL_15_12' into yb-pg15) in the yb-pg15 branch:
- src/postgres/doc/src/sgml/ref/pgbench.sgml
- src/postgres/src/bin/pgbench/t/001_pgbench_with_server.pl
- src/postgres/src/bin/pgbench/t/002_pgbench_no_server.pl
- src/postgres/src/bin/pgbench/pgbench.c
cherry-pick the following YB commits that make changes to pgbench.c:
- 864c201d2139745ae879b92b2c194d95e5347e17 : [#2078] Rename pgbench to ysql_bench
- 6a009b1221f15960de010fcf4243b6f62b4c6051 : [#19667] YSQL: Add webserver with prometheus endpoint to ysql_bench
- f0a71413f18e19a6c2c3dc86f23dbb64ce1e85d8 : [#19741] Enhance ysql_bench to run a connection init sql statement
the following YB commits are skipped because they are no longer needed:
- 35b79bc35eede9907d917d72e516350a4f6bd281 : [#1774] pgbench primary key option compatible with YugaByte
- YB now supports ALTER TABLE ... ADD PRIMARY KEY
- af25ba570e11c59e41a1243126ff9f9edae9d422 : [#2058] Add retry logic to pgbench
- Upstream PG commit 4a39f87acd6e681e5ded1239391d8a92645b43d6 adds retry logic
- 62fd877b2c52acde992a5127f3e5e62a0ec64e81 : #3229: Adding batching support for insertions into the table in ysql_bench
- YB now supports batched COPY
after cherry-picking:
- use ybc prefix for ysql_bench metric entity and `ybc_ysql_bench_metrics_handler.h` as per YB commit d20a6b3ce4d3840e93b5ecc336080d61b906b790
- move the position of the YB includes as per 6234353ccd1f5d9f07bd7057bc34ede39e016d34
- re-run yb_pgindent
- change `ysql_bench_log` back to `pgbench_log` in `usage()` as YB pg15.2 initial merge 55782d561e55ef972f2470a4ae887dd791bb4a97 (incorrectly) does this.
other changes:
- since we no longer need YB commit af25ba570e11c59e41a1243126ff9f9edae9d422, revert the changes made to src/postgres/src/interfaces/libpq/exports.txt, src/postgres/src/interfaces/libpq/pqexpbuffer.h and src/postgres/src/interfaces/libpq/pqexpbuffer.c. Also, remove the file src/postgres/src/bin/pgbench/t/003_serialization_and_deadlock_fails.pl.
- change an instance of `YugaByte` to `Yugabyte`.
- rename all instances of pgbench_<table_name> to ysql_bench_<table_name> (required due to 864c201d2139745ae879b92b2c194d95e5347e17, missed by YB pg15.2 initial merge)
- add `yb_switch_fallthrough()` in some switch statements
- in the logic to update ysql_bench_metric_entry, use `failures` instead of `errors` to match the logic in upstream PG.
- replace `ereport(ELEVEL_FATAL` with `pg_fatal` for invalid `yb_metrics_bind_port_arg`. Also, change the error message.
- upstream PG commit 547f04e7348b6ed992bd4a197d39661fe7c25097 moves the logic for running the main thread. The metric webserver should be initialized before the main thread (missed by YB pg15.2 initial merge). Invoke `YbInitMetricsWebserver` before the client threads are started.
Jira: DB-13926
Test Plan: Jenkins
Reviewers: jason
Reviewed By: jason
Subscribers: jason, yql
Differential Revision: https://phorge.dev.yugabyte.com/D43315