Add PostgreSQL CI/Pipeline automation (#871)#875
Conversation
Port the MariaDB CI/Pipeline automation (PR TPC-Council#860) to PostgreSQL so postgres/postgres branches, tags and commits can be clone/build/install/ benchmark-tested end-to-end via cipush. Changes - config/ci.xml: expand <PostgreSQL> block (build/install/test/pipeline) mirroring the MariaDB schema. Pipeline omits the pre-start run_sql:shutdown because initdb never leaves a server running. - src/generic/genci.tcl: extend cifix allowlist with postgresql.conf / postgresqlio.conf. - src/postgresql/pgci.tcl: full port of all dispatcher procs (postgresql_clone/build/package/commit_msg/install/init/start/ run_sql/ping/start_tests/profile/compare). PG-specific adjustments: * ./configure --prefix=<basedir> && make && make install (no tarball) * basedir is fixed at install_dir/ci_<id>_<ref>/pg (no glob) * psql client calls use TCP localhost:<port> * run_sql key=shutdown dispatches to pg_ctl stop -m fast * shared_buffers / max_wal_size tuning via pg_ctl -o passthrough - scripts/tcl/postgres/tprocc/pg_tprocc_single.sh, pg_tprocc_profile.sh, pg_tprocc_run_profile.tcl, scripts/tcl/postgres/tproch/pg_tproch_single.sh: shell/Tcl wrappers the CI pipeline shells out to (parity with maria_tprocc_*.sh). Follow-up: host postgresql.conf / postgresqlio.conf templates at https://www.hammerdb.com/ci-config/ for the cifix downloader.
Two bugs surfaced during WSL Ubuntu 24 E2E validation of the PG CI port: 1. calc_redo_mb was defined only in src/mariadb/mariaci.tcl, so loading src/postgresql/pgci.tcl without mariaci.tcl caused the start step to emit 'max_wal_size=MB' (empty value) and fail pg_ctl. Move calc_redo_mb to src/generic/genci.tcl next to calc_buffer_pool_mb so it is available to every RDBMS port. 2. In postgresql_start the pg_ctl command was passed to 'bash -c' without escaping the embedded double quotes (used by -D/-l/-o), producing a Tcl list-parse error. Apply the same string map escape pattern used by every other 'open |bash -c' invocation in pgci.tcl. Validated end-to-end on WSL Ubuntu 24.04 against postgres/postgres master: CLONE -> BUILD -> PACKAGE -> INSTALL -> INIT -> START -> PING -> CHANGE_PASSWORD -> TPROC-C OLTP -> SHUTDOWN all succeeded. Result: 71,999 NOPM / 165,731 PostgreSQL TPM (16 vusers).
e229ecc to
e00d5fd
Compare
sm-shaw
left a comment
There was a problem hiding this comment.
Overall this looks very good indeed and have tested, TPROC-C single, TPROC-H single, profile and compare with I/O on and off.
A couple of minor changes needed.
The web interface blocks any other database apart from mariadb. In the pipelines module the following change in 2 places was made to allow PostgreSQL to be selected. Note that the same change will also be needed for MySQL.
613c613
< if {$dbprefix ne "maria"} {
---
> if {$dbprefix ne "maria" && $dbprefix ne "pg"} {
874c874
< if {$dbprefix ne "maria"} {
---
> if {$dbprefix ne "maria" && $dbprefix ne "pg" } {
- localhost is hardcoded in pgci
lappend server_opts "-c listen_addresses=localhost"
For now this is fine as it will run on localhost but anticipating future development the host should be in the ci.xml file and then selected as user defined variable.
…arameterise listen_addresses * pipelines-1.0.tm: invert dbprefix gate (run-action and UI banner) from 'must be maria' to 'block ora/mssqls/db2'. MariaDB, MySQL and PostgreSQL all flow through the run form; Oracle, SQL Server and Db2 show a friendly 'pipelines are not yet enabled' banner explaining that support for already-running instances is planned for a future release. * pipelines-1.0.tm: extend the database dropdown to all six supported databases in GUI order (Oracle, SQL Server, Db2, MySQL, PostgreSQL, MariaDB) so the chooser matches the desktop Benchmark tree. * pipelines-1.0.tm: add Oracle/SQL Server/Db2 cases to __db_label so banner titles read 'Oracle pipelines are not yet enabled' instead of 'ora ...'. * pipelines-1.0.tm: generalise the Windows-host banner so it covers all DBs. * genci.tcl cifix: extend missing-file allowlist to also include my.cnf and myio.cnf (in addition to the existing maria/postgresql configs) so the fetch-from-hammerdb.com fallback covers MySQL configs too. * config/ci.xml: add <listen_addresses>localhost</listen_addresses> to the PostgreSQL <install> section as a user-defined variable. * src/postgresql/pgci.tcl: read listen_addresses from the install dict (default 'localhost' if missing) and pass it to pg_ctl -o '-c listen_addresses=...'. Removes the previously hardcoded value while preserving current behaviour.
|
Thanks @sm-shaw — both items addressed in 1. Pipelines gate (web UI) Inverted the -if {$dbprefix ne "maria"} {
+if {$dbprefix in {ora mssqls db2}} {-foreach {pfx label} [ list maria MariaDB mysql MySQL pg PostgreSQL ] {
+foreach {pfx label} [ list ora Oracle mssqls "SQL Server" db2 Db2 mysql MySQL pg PostgreSQL maria MariaDB ] {The same fix was applied on PR #876 so both PRs converge on the same gate logic. 2. Added a new <install>
...
<socket>/tmp</socket>
<listen_addresses>localhost</listen_addresses>
...
</install>set listen_addrs "localhost"
if {[dict exists $install listen_addresses]} {
set la [string trim [dict get $install listen_addresses]]
if {$la ne ""} { set listen_addrs $la }
}
...
lappend server_opts "-c listen_addresses=$listen_addrs"Bonus fix (carried from PR #876) Extended the Validation
Pushed as |
|
Many thanks for the update will retest. |
Add Python equivalents of the Tcl PG scripts under scripts/python/postgres/ mirroring the MariaDB layout. These are not driven by automation but provide parity with the Tcl scripts when running under the Python CLI: - scripts/python/postgres/tprocc/pg_tprocc_run_profile.py - scripts/python/postgres/tprocc/pg_tprocc_profile_py.sh - scripts/python/postgres/tprocc/pg_tprocc_single_py.sh - scripts/python/postgres/tproch/pg_tproch_single_py.sh Settings in pg_tprocc_run_profile.py mirror pg_tprocc_run_profile.tcl: dbset db pg, pg_host/port/sslmode connection, pg_superuser/pg_user credentials, timed driver, pg_timeprofile + pg_vacuum.
|
Following up on @sm-shaw's review on #876 (which also covered PostgreSQL parity), pushed
Verification
Ready for re-review. |
sm-shaw
left a comment
There was a problem hiding this comment.
Approved after testing and revisions.
sm-shaw
left a comment
There was a problem hiding this comment.
Approved after testing and revisions.
|
Merging after reviews and approval of the three members of the code maintenance team. |
Closes #871
Ports the MariaDB CI/Pipeline automation (PR #860) to PostgreSQL so that
postgres/postgresbranches, tags and commits can be clone → build → install → benchmark-tested end-to-end, with results captured in the HammerDB jobs framework and comparison charts generated via the existingcompareflow.Issue #871 checklist
ci.xmltemplate for PostgreSQL configuration and commandsconfig/ci.xml— new<PostgreSQL>block with<build>,<install>,<test>,<pipeline>sections (mirrors the MariaDB schema).genci.tcl::process_request(shared with MariaDB). The PG port provides thepostgresql_*dispatcher procs thatcistepsinvokes once a request is accepted — no change needed on the webhook path.process_requestentry point as the webhook (genci.tcl:961/978), so the PG port is wired in automatically oncedbset db pgis set.cipushcommandcipush refs/heads/master single C pg 0successfully dispatches through everypostgresql_*step.postgresql_clone(git clone https://github.com/postgres/postgres.git),postgresql_build(./configure --prefix=<basedir> --without-readline --without-zlib --without-icu && make),postgresql_install(make install),postgresql_init(initdb+ config copy),postgresql_start(pg_ctl startwith auto-tunedshared_buffers/max_wal_size).postgresql_start_testsruns single-run TPROC-C viascripts/tcl/postgres/tprocc/pg_tprocc_single.sh;postgresql_profileruns the multi-vuser profile sweep viapg_tprocc_profile.sh+pg_tprocc_run_profile.tcl(wrappers parity withmaria_tprocc_*.sh).runtimer/hdbjobsinstrumentation in the TPROC-C scripts.postgresql_start_testsalso stores the stdout log inTMP/hammerdbci.logand updatesJOBCI.status/timestampat each step. Verified NOPM=71,999 / TPM=165,731 captured on the E2E run.postgresql_comparedrives a two-run compare pipeline that writesJOBCHARTrows viahdbjobs— reuses the same chart generation the Web Service uses for existing RDBMS ports.postgresql_commit_msgcaptures the target commit's message intoJOBCI.commit_msgfor display alongside results.Changes
config/ci.xml— expand<PostgreSQL>block (build/install/test/pipeline) mirroring the MariaDB schema. Pipeline omits the pre-startrun_sql:shutdownbecauseinitdbnever leaves a server running.src/postgresql/pgci.tcl(new, +1514 lines) — full port of all CI dispatcher procs:postgresql_clone / build / package / commit_msg / install / init / start / run_sql / ping / start_tests / profile / compare, plus helpers (postgresql_ci_id,postgresql_ci_safe_ref,postgresql_basedir,postgresql_get_io_intensive,postgresql_set_uaw_env,postgresql_normpath). PG-specific adjustments documented at top of file:./configure --prefix=<basedir> && make && make install(no tarball —packageis a no-op).basediris fixed atinstall_root/ci_<id>_<safe_ref>/pg(no glob walk).psqlclient calls use TCP localhost:<port>to stay consistent with stockpg_tprocc_*.tcl.run_sql key=shutdowndispatches topg_ctl stop -m fast(PG has no SQL shutdown).shared_buffers/max_wal_sizetuning passed viapg_ctl -o.src/generic/genci.tcl— relocatecalc_redo_mbhere (frommariaci.tcl) so it is available to every RDBMS port, and extend thecifixallowlist withpostgresql.conf/postgresqlio.conf.src/mariadb/mariaci.tcl— remove the now-redundantcalc_redo_mbdefinition (pure relocation, no behavioral change for MariaDB).scripts/tcl/postgres/tprocc/—pg_tprocc_single.sh,pg_tprocc_profile.sh,pg_tprocc_run_profile.tcl(parity withmaria_tprocc_*).scripts/tcl/postgres/tproch/pg_tproch_single.sh— TPROC-H wrapper for future analytic CI runs.Follow-up (not in this PR): host
postgresql.conf/postgresqlio.conftemplates at https://www.hammerdb.com/ci-config/ socifixcan download them on first run.E2E Validation — WSL Ubuntu 24.04
Ran the full
cipushpipeline againstpostgres/postgresmaster to exercise every step the PG CI port dispatches.Environment: WSL Ubuntu 24.04, 8 vCPU, ~31 GB RAM, HammerDB v5.0 Linux binary with this fork's
src/,config/ci.xmlandscripts/overlaid at runtime.All 10 pipeline steps succeeded:
postgres/postgresmaster)./configure --without-readline --without-zlib --without-icu && make)make install)initdb+ config copy)pg_ctl start, auto-tunedshared_buffers=16035MB,max_wal_size=4008MB)SELECT version()returned PostgreSQL 19devel)pg_ctl stop -m fast)Benchmark result captured:
Result row was written to
JOBCI(status=COMPLETED, timestamps populated) and TPROC-C timings were logged toTMP/hammerdb.logvia the standard jobs instrumentation.Bugs found during E2E and fixed (second commit)
calc_redo_mbdependency. The proc was defined only insrc/mariadb/mariaci.tcl, so whenpgci.tclis loaded without MariaDB thestartstep built-c max_wal_size=MB(empty value) andpg_ctlfailed. Relocatedcalc_redo_mbintosrc/generic/genci.tclnext tocalc_buffer_pool_mb, where it belongs on separation-of-concerns grounds.postgresql_startshell spawn.open "|bash -c \"$full_cmd\"" "r"passed$full_cmdunescaped even though it contains-D "..." -l "..." -o "...", causing a Tcl list-parse error (list element in quotes followed by ...). Applied the samestring map {\" \\\"}escape pattern used by every otheropen |bash -cinvocation inpgci.tcl.Both fixes are included in this PR and the full E2E run above was executed against the fixed tree.
Scope notes for reviewers
single C(TPROC-C single-run) was executed end-to-end;profileandcomparepipelines are implemented but not exercised in this validation. All three share the same dispatcher contract, andprofile/comparereuse identical build/install/init/start paths that are covered.process_requestentry point ascipush, which is covered. Happy to run a web-service trigger test if reviewers want that belt-and-braces.calc_redo_mbrelocation (pure move; MariaDB still calls it with the same signature).