Skip to content

Commit

Permalink
Fixed bug in changesSinceV2 where to and from in CommitTransitions we…
Browse files Browse the repository at this point in the history
…re swapped

Summary:
# Context

We are introducing EdenFS notifications to support scalable and ergonomic file system notifications for EdenFS mounts.

# This Diff

* Because we process the journal from back to front there was confusion on which commit id is `from` and which is `to`. We got it backwards. This diff fixes that.
* Updated the integration tests (there are no .t tests here).
* We have put in a hack in the buck2 integration code that will need to be addressed when this change is rolled out fully.

# Next Steps

* Add suffix (extension) filters - inclusion and exclusion.
* Investigate best performance data structures for modeling inclusion and exclusion path filters (Watchman uses a radix tree search).
* Change the journal walking code to scan for position then walk forwards - current implemantion walks backward.
* .t tests, Python integration tests, C++ unit tests

# Discussion Points

None

Differential Revision: D67552308

fbshipit-source-id: 972e1581fd896acc57d9e77d198ccd5a4946ac33
  • Loading branch information
jdelliot authored and facebook-github-bot committed Dec 23, 2024
1 parent a4e00e0 commit dcd901d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions eden/fs/service/EdenServiceHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2425,9 +2425,9 @@ void EdenServiceHandler::sync_changesSinceV2(
},
[&](const RootUpdateJournalDelta& current) -> void {
CommitTransition commitTransition;
commitTransition.from_ref() = rootIdCodec.renderRootId(currentHash);
commitTransition.to_ref() =
commitTransition.from_ref() =
rootIdCodec.renderRootId(current.fromHash);
commitTransition.to_ref() = rootIdCodec.renderRootId(currentHash);
currentHash = current.fromHash;

LargeChangeNotification largeChange;
Expand Down
8 changes: 4 additions & 4 deletions eden/integration/changes_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ def test_commit_transition(self):
# For CommitTransition, from_bytes is the current hash and to_bytes is the previous hash
buildLargeChange(
LargeChangeNotification.COMMITTRANSITION,
from_bytes=bytes.fromhex(commit1),
to_bytes=bytes.fromhex(self.commit0),
from_bytes=bytes.fromhex(self.commit0),
to_bytes=bytes.fromhex(commit1),
),
]
self.assertTrue(self.check_changes(changes1.changes, expected_changes1))
Expand All @@ -193,8 +193,8 @@ def test_commit_transition(self):
expected_changes2 = [
buildLargeChange(
LargeChangeNotification.COMMITTRANSITION,
from_bytes=bytes.fromhex(self.commit0),
to_bytes=bytes.fromhex(commit1),
from_bytes=bytes.fromhex(commit1),
to_bytes=bytes.fromhex(self.commit0),
),
]
self.assertTrue(self.check_changes(changes2.changes, expected_changes2))
Expand Down

0 comments on commit dcd901d

Please sign in to comment.