Skip to content

Commit 160b606

Browse files
committed
Update dtmbench to support pathman
1 parent 090c832 commit 160b606

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

contrib/postgres_fdw/tests/dtmbench.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,19 @@ void* writer(void* arg)
156156
void initializeDatabase()
157157
{
158158
connection conn(cfg.connection);
159-
int accountsPerShard = (cfg.nAccounts + cfg.nShards - 1)/cfg.nShards;
160-
for (int i = 0; i < cfg.nShards; i++)
161-
{
159+
if (cfg.nShards == 0) {
162160
work txn(conn);
163-
exec(txn, "alter table t_fdw%i add check (u between %d and %d)", i+1, accountsPerShard*i, accountsPerShard*(i+1)-1);
164-
exec(txn, "insert into t_fdw%i (select generate_series(%d,%d), %d)", i+1, accountsPerShard*i, accountsPerShard*(i+1)-1, 0);
161+
exec(txn, "insert into t (select generate_series(1,%d), 0)", cfg.nAccounts);
165162
txn.commit();
163+
} else {
164+
int accountsPerShard = (cfg.nAccounts + cfg.nShards - 1)/cfg.nShards;
165+
for (int i = 0; i < cfg.nShards; i++)
166+
{
167+
work txn(conn);
168+
exec(txn, "alter table t_fdw%i add check (u between %d and %d)", i+1, accountsPerShard*i, accountsPerShard*(i+1)-1);
169+
exec(txn, "insert into t_fdw%i (select generate_series(%d,%d), %d)", i+1, accountsPerShard*i, accountsPerShard*(i+1)-1, 0);
170+
txn.commit();
171+
}
166172
}
167173
}
168174

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy