File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,10 @@ void* writer(void* arg)
166
166
// work
167
167
// transaction<repeatable_read> txn(*conns[random() % conns.size()]);
168
168
transaction<read_committed> txn (*conns[random () % conns.size ()]);
169
- int acc = random () % cfg.nAccounts ;
169
+ int acc = cfg.scatter
170
+ ? random () % (cfg.nAccounts /cfg.nWriters ) * cfg.nWriters + t.id
171
+ : random () % cfg.nAccounts ;
172
+
170
173
try {
171
174
exec (txn, " update t set v = v + 1 where u=%d" , acc);
172
175
txn.commit ();
@@ -247,6 +250,7 @@ int main (int argc, char* argv[])
247
250
" \t -n N\t number of iterations (1000)\n "
248
251
" \t -p N\t update percent (100)\n "
249
252
" \t -c STR\t database connection string\n "
253
+ " \t -s\t avoid conflicts\n "
250
254
" \t -i\t initialize database\n " );
251
255
return 1 ;
252
256
}
You can’t perform that action at this time.
0 commit comments