Skip to content

Conversation

@oridb
Copy link

@oridb oridb commented May 2, 2023

@oridb oridb marked this pull request as draft May 2, 2023 14:03
@oridb oridb requested review from Domiii, kannanvijayan and klochek May 2, 2023 14:03
Copy link

@Domiii Domiii left a comment

Choose a reason for hiding this comment

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

Leaving a few comments. Will leave approval to Brian and/or others.

Copy link

Choose a reason for hiding this comment

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

I think, it would be better to either use CHECK_NE or we could create a new set of REPLAY_CHECK defines which simply point to their CHECK counterparts to avoid unnecessary code changes.

Copy link

Choose a reason for hiding this comment

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

Ditto CHECK_NE

Copy link

Choose a reason for hiding this comment

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

Did you write this yourself?
Do you have a reference you can point to for this or can you explain it?

Choose a reason for hiding this comment

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

Looks legit to me. It's a template method specialization on a templated class.

Copy link

Choose a reason for hiding this comment

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

space before {

Copy link

Choose a reason for hiding this comment

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

missing space

@Domiii
Copy link

Domiii commented May 2, 2023

One more thing: Can you add linkage from https://linear.app/replay/issue/RUN-1730/make-all-chromium-hashset-and-hashmap-iteration-order-deterministic to here and vice versa?

  1. The branch name is missing a dash so Linear probably won't pick up the PR. Can fix by adding the correct id into the title.
  2. GitHub won't ever auto-link to Linear, so we always provide the link manually in the description.

Copy link

@kannanvijayan kannanvijayan left a comment

Choose a reason for hiding this comment

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

This looks reasonable overall, but I didn't rigorously check the logic or anything.

Only question I have is how this works during rehashing? Does it come automatically because the resized hashtable is inserted into using the existing routines, and those are already modified to build the ordering vectors?

Choose a reason for hiding this comment

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

DCHECK compiles to no-op in our builds, so you may want to use something better for this if you want it to be actually checked.

Copy link
Author

Choose a reason for hiding this comment

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

During rehashing, we build a new hash table, and then steal its guts, replacing the old table.

There's a comment in there that worries me, about how this works with the concurrent collector. I need to go find the code that scans the table, and make sure it only scans the table_ member before this can land.

Copy link

Choose a reason for hiding this comment

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

Please also see my other comment regarding DCHECK here

@oridb oridb force-pushed the run1730-stable-hash-order branch from 6755139 to e5de1a7 Compare May 4, 2023 17:05
@oridb oridb force-pushed the run1730-stable-hash-order branch from 182a3ce to 364ffb0 Compare May 10, 2023 03:15
@oridb oridb changed the title [DRAFT] hashtable: make it ordered [RUN-1730] hashtable: make it ordered May 10, 2023
Copy link

@kannanvijayan kannanvijayan left a comment

Choose a reason for hiding this comment

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

Looks good mostly. But see notes about using CHECK instead of DCHECK. It's probably good to fail fast more often just to be safe with this code at the start. I don't think the perf-impact of it would be huge.

Choose a reason for hiding this comment

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

Looks legit to me. It's a template method specialization on a templated class.

ValueType* old_table = table_;
unsigned old_table_size = table_size_;
auto old_table_size = table_size_;
//auto old_table_order = std::move(idxorder_);

Choose a reason for hiding this comment

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

Nit: stale comments to remove.

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.

4 participants