Skip to content

fix item_count of ScrambledZipfianGenerator#4

Closed
junhanLee95 wants to merge 1 commit into
ls4154:masterfrom
junhanLee95:fix-item_count
Closed

fix item_count of ScrambledZipfianGenerator#4
junhanLee95 wants to merge 1 commit into
ls4154:masterfrom
junhanLee95:fix-item_count

Conversation

@junhanLee95
Copy link
Copy Markdown

Hello,
The generator_ of ScrambledZipfianGenerator is incorrectly initialized.
If $min and $max is declared in the constructor, the $item_count should be $max - $min + 1, not 10000000000LL.
You can check the original YCSB source code in the following link below.
(https://github.com/brianfrankcooper/YCSB/blob/master/core/src/main/java/site/ycsb/generator/ScrambledZipfianGenerator.java#L87)

@ls4154
Copy link
Copy Markdown
Owner

ls4154 commented Dec 8, 2022

Hi,
Original YCSB also seems to initialize the ZipfianGenerator with the constant ITEM_COUNT (= 10000000000L).
The variable itemcount (equivalent to num_items_ in YCSB-cpp) is only used for modular operation in nextValue.

please let me know if I'm missing something!

@junhanLee95
Copy link
Copy Markdown
Author

Thank you for the reply.

As you shown in the source code L87 what I attached, $itemcount is reset to $max - $min + 1, which is passed to ZipfianGenerator().

Moreover, you can check this in YCSB-C source code.
The zipfian generator within scrambled zipfian generator also passed the input arguments as generator_(min, max, zipfian_const), in L26, instead of 10000000000L.

Please check the file below.
(https://github.com/basicthinker/YCSB-C/blob/6475c7a5c3c7b229224ce5ca3332a58c994b8a09/core/scrambled_zipfian_generator.h#L26)

@ls4154
Copy link
Copy Markdown
Owner

ls4154 commented Dec 9, 2022

As you shown in the source code L87 what I attached, $itemcount is reset to $max - $min + 1, which is passed to ZipfianGenerator().

In YCSB, the ZipfianGenerator is initialized with ITEM_COUNT, which is different from the itemcount.
ITEM_COUNT is a static constant, while itemcount is a member variable.

// ScrambledZipfianGenerator.java Line 35
public static final long ITEM_COUNT = 10000000000L;

// ScrambledZipfianGenerator.java Line 38
private final long min, max, itemcount;

// ScrambledZipfianGenerator.java Line 87-92
itemcount = this.max - this.min + 1;
if (zipfianconstant == USED_ZIPFIAN_CONSTANT) {
  gen = new ZipfianGenerator(0, ITEM_COUNT, zipfianconstant, ZETAN);
} else {
  gen = new ZipfianGenerator(0, ITEM_COUNT, zipfianconstant);
}

Moreover, you can check this in YCSB-C source code.
The zipfian generator within scrambled zipfian generator also passed the input arguments as generator_(min, max, zipfian_const), in L26, instead of 10000000000L.

While I don't remember the details, I think I modified that part to make the ScrambledZipfianGenerator works the same as the one in the original YCSB code. Maybe, passing the itemcount to ZipfianGenerator could be right, there was a discussion about this issue. However, the goal of YCSB-cpp is to implement the YCSB as it is in C++, so it would be better to follow original code behavior.

@ls4154
Copy link
Copy Markdown
Owner

ls4154 commented Feb 16, 2023

Closed due to inactivity.

@ls4154 ls4154 closed this Feb 16, 2023
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