Skip to content

[#107] CassandraKeyValue workload: add an option to generate rows with common hash component of primary key#108

Merged
qvad merged 8 commits into
masterfrom
add-common-pk-hash-component
Feb 25, 2026
Merged

[#107] CassandraKeyValue workload: add an option to generate rows with common hash component of primary key#108
qvad merged 8 commits into
masterfrom
add-common-pk-hash-component

Conversation

@ttyusupov

@ttyusupov ttyusupov commented Feb 19, 2026

Copy link
Copy Markdown
Contributor
  • Added --common_hash_key_size command line option to specify size of randomly generated common (per write thread) primary key hash component (ASCII)
  • Extracted reusable random-string generation into GenerateRandomString function and also fixed it to really generate only ASCII characters when restrictToAscii == true (this was broken)

@ttyusupov ttyusupov requested a review from qvad February 19, 2026 16:14
@ttyusupov ttyusupov self-assigned this Feb 19, 2026

@qvad qvad left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small styling fixes, overall LGFM

getRandomValue(keyValueBytes, valueSize, outBuffer);
}

static public void GenerateRandomString(Random random, int i, int size, byte[] outBuffer, boolean restrictToAscii) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method names should be started with lower letter

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for work order also it is more readable to keep existing style public static void

Comment on lines +49 to +50
int commonHashKeySize = AppBase.appConfig.commonHashKeySize;
if (commonHashKeySize > 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need to add new variable here IMO, it is not modified later, so we can just use AppBase.appConfig.commonHashKeySize everywhere.

Comment on lines +57 to +58
insertStatement = String.format("INSERT INTO %s " +
(commonHashKey.isEmpty() ? "(k, v) VALUES (?, ?);" : "(hash_k, k, v) VALUES (?, ?, ?);"), getTableName());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use one type of formatting here, it will be more readable, i.e.
String.format("INSERT INTO %s %s", getTableName(), commonHashKey.isEmpty() ? "(k, v) VALUES (?, ?);" : "(hash_k, k, v) VALUES (?, ?, ?);")

@ttyusupov ttyusupov requested a review from qvad February 20, 2026 13:16
@qvad qvad merged commit 29ecc46 into master Feb 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants