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)