This is an automated email from the ASF dual-hosted git repository. reshke pushed a commit to branch use_uni_key in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 61cff7b1be3ae89623c51f711ec618978cf4df98 Author: reshke <[email protected]> AuthorDate: Wed Dec 24 21:36:38 2025 +0000 Fix and rename --use-unique-keys option and add TAP test Cloudberry has --use-unique-keys options since cc797b9. However, it does not work, at least at current HEAD. Fix that, and also rename option, to better indicate its use case. If user does NOT use this option, pgbenc will create unique index. If use does use this option, pgbench will not. So, rename to --use-non-unique-keys. Found during PG16 kernel rebase. --- src/bin/pgbench/pgbench.c | 14 +++++++++++--- src/bin/pgbench/t/001_pgbench_with_server.pl | 13 +++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index cf8dec81eec..e0dfadcf414 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -716,7 +716,7 @@ usage(void) " -q, --quiet quiet logging (one message each 5 seconds)\n" " -s, --scale=NUM scaling factor\n" " --foreign-keys create foreign key constraints between tables\n" - " --use-unique-keys make the indexes that are created non-unique indexes\n" + " --use-non-unique-keys make the indexes that are created non-unique indexes\n" " (default: unique)\n" " --index-tablespace=TABLESPACE\n" " create indexes in the specified tablespace\n" @@ -4382,7 +4382,11 @@ initCreatePKeys(PGconn *con) int i; PQExpBufferData query; - fprintf(stderr, "creating primary keys...\n"); + if (use_unique_key) + fprintf(stderr, "creating primary keys...\n"); + else + fprintf(stderr, "creating non-unique keys...\n"); + initPQExpBuffer(&query); for (i = 0; i < lengthof(DDLINDEXes); i++) @@ -5837,7 +5841,8 @@ main(int argc, char **argv) {"show-script", required_argument, NULL, 10}, {"partitions", required_argument, NULL, 11}, {"partition-method", required_argument, NULL, 12}, - {"use-unique-keys", no_argument, &use_unique_key, 1}, + /* Cloudberry-specific */ + {"use-non-unique-keys", no_argument, NULL, 13}, {NULL, 0, NULL, 0} }; @@ -6217,6 +6222,9 @@ main(int argc, char **argv) exit(1); } break; + case 13: + use_unique_key = 0; + break; default: fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); exit(1); diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl index 796eb57208d..4fe586bffa9 100644 --- a/src/bin/pgbench/t/001_pgbench_with_server.pl +++ b/src/bin/pgbench/t/001_pgbench_with_server.pl @@ -100,6 +100,19 @@ $node->pgbench( ], 'pgbench --init-steps'); + +# Test interaction of --init-steps with legacy step-selection options +$node->pgbench( + '--initialize --use-non-unique-keys', + 0, + [qr{^$}], + [ + qr{creating tables}, + qr{reating non-unique keys}, + qr{done in \d+\.\d\d s } + ], + 'pgbench --use-non-unique-keys'); + # Run all builtin scripts, for a few transactions each $node->pgbench( '--transactions=5 -Dfoo=bla --client=2 --protocol=simple --builtin=t' --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
