From c2b1e01aed3fe5c03e18641e42562744f2ae26d9 Mon Sep 17 00:00:00 2001 From: Tomas Vondra Date: Sat, 3 Jun 2017 16:17:00 +0200 Subject: [PATCH] Make pgbench script names (name prefixes) unique PostgreSQL 9.6 picks the built-in scripts by prefix, as long as a single script is matched. This is done even when not using the '-b' option as in that case pgbench simply uses 'tpcb-like' (and 'pgbench -N' defaults to 'simple-update'). XL adds two custom scripts that also use the 'bid' column in WHERE conditions, not just the 'aid' one. Those scripts were however named 'tpcb-like-bid' and 'simple-update-bid' which makes the upstream names non-unique (when used as prefixes). This fixes it by simply not keeping the upstream scripts, and replacing them with the XL version. It might have been possible to massage the builtin_script[] array to keep both, but it doesn't seem worth it. --- src/bin/pgbench/pgbench.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index ab72c7be63..364b91ce31 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -347,22 +347,6 @@ static const BuiltinScript builtin_script[] = "\\set aid random(1, " CppAsString2(naccounts) " * :scale)\n" "\\set bid random(1, " CppAsString2(nbranches) " * :scale)\n" "\\set tid random(1, " CppAsString2(ntellers) " * :scale)\n" - "\\set delta random(-5000, 5000)\n" - "BEGIN;\n" - "UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n" - "SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n" - "UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;\n" - "UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;\n" - "INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n" - "END;\n" - }, -#ifdef PGXC - { - "tpcb-like-bid", - "", - "\\set aid random(1, " CppAsString2(naccounts) " * :scale)\n" - "\\set bid random(1, " CppAsString2(nbranches) " * :scale)\n" - "\\set tid random(1, " CppAsString2(ntellers) " * :scale)\n" "\\setrandom delta -5000 5000\n" "BEGIN;\n" "UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid AND bid = :bid;\n" @@ -372,23 +356,8 @@ static const BuiltinScript builtin_script[] = "INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n" "END;\n" }, -#endif { "simple-update", - "", - "\\set aid random(1, " CppAsString2(naccounts) " * :scale)\n" - "\\set bid random(1, " CppAsString2(nbranches) " * :scale)\n" - "\\set tid random(1, " CppAsString2(ntellers) " * :scale)\n" - "\\set delta random(-5000, 5000)\n" - "BEGIN;\n" - "UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;\n" - "SELECT abalance FROM pgbench_accounts WHERE aid = :aid;\n" - "INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n" - "END;\n" - }, -#ifdef PGXC - { - "simple-update-bid", "", "\\set aid random(1, " CppAsString2(naccounts) " * :scale)\n" "\\set bid random(1, " CppAsString2(nbranches) " * :scale)\n" @@ -400,7 +369,6 @@ static const BuiltinScript builtin_script[] = "INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);\n" "END;\n" }, -#endif { "select-only", "", -- 2.39.5