-
Notifications
You must be signed in to change notification settings - Fork 287
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
OstreeMutableTree: Add parent pointer and fix bug #1655
Conversation
This implements a TODO item from `ostree_mutable_tree_get_contents_checksum`. We now no-longer invalidate the dirtree contents checksum at `get_contents_checksum` time - we invalidate it when the mtree is modified. This is implemented by keeping a pointer to the parent directory in each `OstreeMutableTree`. This gives us stronger invariants on `contents_checksum`. For even stronger guarantees about invariants we could make `ostree_repo_write_mtree` or similar a member of `OstreeMutableTree` and remove `ostree_mutable_tree_set_metadata_checksum`. I think I've fixed a bug here too. We now invalidate parent's contents checksum when our metadata checksum changes, whereas we didn't before.
…changes This bug has existed before the previous commit, but thanks to the previous commit it is now easy to fix.
src/libostree/ostree-mutable-tree.c
Outdated
@@ -146,7 +149,7 @@ invalidate_contents_checksum (OstreeMutableTree *self) | |||
break; | |||
|
|||
g_free (self->contents_checksum); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can drop this line too, that's the beauty of g_clear_pointer
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
/* If a child tree's metadata changes the parent tree's contents needs to be | ||
* recalculated */ | ||
glnx_unref_object OstreeMutableTree *subdir = NULL; | ||
g_assert (ostree_mutable_tree_ensure_dir (tree, "subdir", &subdir, &error)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're doing a g_assert
and we're not gonna check that error
is still NULL
, we might as well pass NULL
here and drop the local variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Awesome, thanks a lot for this! |
This implements a TODO item from `ostree_mutable_tree_get_contents_checksum`. We now no-longer invalidate the dirtree contents checksum at `get_contents_checksum` time - we invalidate it when the mtree is modified. This is implemented by keeping a pointer to the parent directory in each `OstreeMutableTree`. This gives us stronger invariants on `contents_checksum`. For even stronger guarantees about invariants we could make `ostree_repo_write_mtree` or similar a member of `OstreeMutableTree` and remove `ostree_mutable_tree_set_metadata_checksum`. I think I've fixed a bug here too. We now invalidate parent's contents checksum when our metadata checksum changes, whereas we didn't before. Closes: #1655 Approved by: cgwalters
…changes This bug has existed before the previous commit, but thanks to the previous commit it is now easy to fix. Closes: #1655 Approved by: cgwalters
💥 Test timed out |
@rh-atomic-bot retry |
This implements a TODO item from `ostree_mutable_tree_get_contents_checksum`. We now no-longer invalidate the dirtree contents checksum at `get_contents_checksum` time - we invalidate it when the mtree is modified. This is implemented by keeping a pointer to the parent directory in each `OstreeMutableTree`. This gives us stronger invariants on `contents_checksum`. For even stronger guarantees about invariants we could make `ostree_repo_write_mtree` or similar a member of `OstreeMutableTree` and remove `ostree_mutable_tree_set_metadata_checksum`. I think I've fixed a bug here too. We now invalidate parent's contents checksum when our metadata checksum changes, whereas we didn't before. Closes: #1655 Approved by: cgwalters
…changes This bug has existed before the previous commit, but thanks to the previous commit it is now easy to fix. Closes: #1655 Approved by: cgwalters
💔 Test failed - status-atomicjenkins |
Noticed as part of a random failure in this PR: ostreedev#1655 that we weren't actually testing the version of ostree we built in git. Probably we should be generating RPMs but...later.
OK right, this is failing because of #1662 and... not sure what happened with the |
We can re-queue this one now assuming the other one lands. @rh-atomic-bot retry |
…changes This bug has existed before the previous commit, but thanks to the previous commit it is now easy to fix. Closes: #1655 Approved by: cgwalters
☀️ Test successful - status-atomicjenkins |
This is preparatory work for #1643. The commits were originally on #1643 and I've added a fixup to address some of the comments from there. I split this out as it's own PR as requested by @jlebon.
This implements a TODO item from
ostree_mutable_tree_get_contents_checksum
. We now no-longer invalidatethe dirtree contents checksum at
get_contents_checksum
time - weinvalidate it when the mtree is modified. This is implemented by keeping
a pointer to the parent directory in each
OstreeMutableTree
. This givesus stronger invariants on
contents_checksum
.For even stronger guarantees about invariants we could make
ostree_repo_write_mtree
or similar a member ofOstreeMutableTree
andremove
ostree_mutable_tree_set_metadata_checksum
.I've fixed a bug here too. We now invalidate parent's contents
checksum when our metadata checksum changes, whereas we didn't before.