Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GAIAPLAT-425] Change locator size to 32 bits #1380

Merged
merged 2 commits into from
Feb 26, 2022
Merged

Conversation

senderista
Copy link
Contributor

This is a very old task that's been repeatedly deferred, but it's finally necessary for my current table scan index changes (I need to add a metadata word to the locator list node structure, which must be updated atomically with the locator-valued "next" pointer, so the whole thing must fit into 8 bytes). Because locators have always been de facto 32-bit-valued, there are no changes required other than updating type definitions.

@@ -119,6 +119,9 @@ struct hash_node_t
struct log_record_t
{
gaia_locator_t locator;
// Locators are now 4 bytes, so we need to add 4 bytes of padding to keep
// total size at 16 bytes.
uint32_t reserved;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we place this padding at the end?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, I'd shorten the comment to the essential: "We need 4 bytes of padding to maintain total size at 16 bytes".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why don't we place this padding at the end?

It's not essential, but I prefer to align the two offsets on an 8-byte boundary, in case I wanted to treat them atomically at some point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need 4 bytes of padding to maintain total size at 16 bytes

OK, I was referencing the locator size change itself, but I guess code comments shouldn't reference changes unless absolutely necessary. Updated comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer to align the two offsets on an 8-byte boundary, in case I wanted to treat them atomically at some point.

In that case, can you add a comment about this? Although frankly, why wouldn't you defer any fancy ordering until it's actually needed? If you'd even need something like this, you could always re-arrange the fields at that time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comment.

Copy link
Contributor

@LaurentiuCristofor LaurentiuCristofor 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. I left a couple of suggestions - I'd particularly want to have the assert added, to hard code the relationship between the gaia_handle_t and gaia_locator_t. I thought we already did this, but it looks like I was wrong.

@senderista senderista merged commit 1ac1ba7 into master Feb 26, 2022
@senderista senderista deleted the tobin/32_bit_locators branch February 26, 2022 00:43
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