Skip to content

Commit

Permalink
fix W14 & W6 conflicts, use odd and even num to avoid W14 insert depe…
Browse files Browse the repository at this point in the history
…nds on the row that W6 has deleted
  • Loading branch information
cococo2000 committed Feb 20, 2024
1 parent f3527f3 commit 9c0295e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ public long run(Connection conn, Random gen, WEB3Worker w, int startNumber, int
String to_address = WEB3Util
.convertToAddressString(WEB3Util.randomNumber(1, WEB3Config.configAccountsCount, gen));
double value = (double) WEB3Util.randomNumber(0, 1000000, gen);
String transaction_hash = WEB3Util.convertToTxnHashString(
WEB3Util.randomNumber(1, numScale * WEB3Config.configTransactionsCount, gen));
int transaction_hash_number = WEB3Util.randomNumber(1, numScale * WEB3Config.configTransactionsCount,
gen);
// make sure the startNumber is even, to avoid foreign key conflicts with W6
transaction_hash_number = transaction_hash_number - (transaction_hash_number % 2);
String transaction_hash = WEB3Util.convertToTxnHashString(transaction_hash_number);
long block_number = WEB3Util.randomNumber(1, numScale * WEB3Config.configBlocksCount, gen);
long next_block_number = block_number + 1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ public long run(Connection conn, Random gen, WEB3Worker w, int startNumber, int
// initializing all prepared statements
query_stmt = this.getPreparedStatement(conn, query_stmtSQL);

// make sure the startNumber is odd, to avoid foreign key conflicts with W14
startNumber = startNumber - (startNumber % 2) + 1;
String hash = WEB3Util.convertToTxnHashString(startNumber % (WEB3Config.configTransactionsCount * numScale));

// Setting the parameters for the query
query_stmt.setString(1, hash);
if (LOG.isDebugEnabled()) {
LOG.debug(queryToString(query_stmt));
Expand Down

0 comments on commit 9c0295e

Please sign in to comment.