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

OstreeMutableTree: Add parent pointer and fix bug #1655

Closed
wants to merge 4 commits into from

Conversation

wmanley
Copy link
Member

@wmanley wmanley commented Jun 27, 2018

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 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've fixed a bug here too. We now invalidate parent's contents
checksum when our metadata checksum changes, whereas we didn't before.

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.
@@ -146,7 +149,7 @@ invalidate_contents_checksum (OstreeMutableTree *self)
break;

g_free (self->contents_checksum);
Copy link
Member

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 :)

Copy link
Member Author

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));
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@cgwalters
Copy link
Member

Awesome, thanks a lot for this!

@rh-atomic-bot r+ a0d0fee

@rh-atomic-bot
Copy link

⌛ Testing commit a0d0fee with merge ab01aad...

rh-atomic-bot pushed a commit that referenced this pull request Jun 28, 2018
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
rh-atomic-bot pushed a commit that referenced this pull request Jun 28, 2018
…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
@rh-atomic-bot
Copy link

💥 Test timed out

@jlebon
Copy link
Member

jlebon commented Jun 29, 2018

@rh-atomic-bot retry

@rh-atomic-bot
Copy link

⌛ Testing commit a0d0fee with merge 7453b30...

rh-atomic-bot pushed a commit that referenced this pull request Jun 29, 2018
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
rh-atomic-bot pushed a commit that referenced this pull request Jun 29, 2018
…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
@rh-atomic-bot
Copy link

💔 Test failed - status-atomicjenkins

cgwalters added a commit to cgwalters/ostree that referenced this pull request Jun 29, 2018
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.
rh-atomic-bot pushed a commit that referenced this pull request Jun 29, 2018
Noticed as part of a random failure in this PR:
#1655
that we weren't actually testing the version of ostree
we built in git.  Probably we should be generating RPMs but...later.

Closes: #1662
Approved by: jlebon
@jlebon
Copy link
Member

jlebon commented Jun 29, 2018

OK right, this is failing because of #1662 and... not sure what happened with the FAH28-insttests, looks like kernel issues? We'll just try again once that PR is merged.

rh-atomic-bot pushed a commit that referenced this pull request Jun 29, 2018
Noticed as part of a random failure in this PR:
#1655
that we weren't actually testing the version of ostree
we built in git.  Probably we should be generating RPMs but...later.

Closes: #1662
Approved by: jlebon
rh-atomic-bot pushed a commit that referenced this pull request Jun 29, 2018
Noticed as part of a random failure in this PR:
#1655
that we weren't actually testing the version of ostree
we built in git.  Probably we should be generating RPMs but...later.

Closes: #1662
Approved by: jlebon
@cgwalters
Copy link
Member

We can re-queue this one now assuming the other one lands.

@rh-atomic-bot retry

@rh-atomic-bot
Copy link

⌛ Testing commit a0d0fee with merge 488365f...

rh-atomic-bot pushed a commit that referenced this pull request Jun 29, 2018
…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
@rh-atomic-bot
Copy link

☀️ Test successful - status-atomicjenkins
Approved by: cgwalters
Pushing 488365f to master...

@wmanley wmanley deleted the mutable-parents branch July 2, 2018 22:02
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.

None yet

4 participants