Skip to content

Conversation

MozirDmitriy
Copy link
Contributor

The db diff implementation used zip over walkers, which stops at the end of the shorter iterator. As a result, any remaining keys present only in the longer table were never visited and thus not recorded as extra elements. This caused incomplete diff reports whenever table lengths differed.
This change replaces the zipped walk with a two-cursor merge over sorted keys:

  • Compare current keys from both cursors; advance the side with the smaller key and record it as an extra element.
  • When keys are equal, compare values and record discrepancies if needed, advancing both.
  • After one side ends, consume the remaining side as tail extras.

Rationale:

  • Ensures all keys are examined, including tails, matching the intended semantics of extra elements.
  • Linear complexity in the total number of entries.
  • No additional dependencies; preserves existing output format.
  • Adds an Ord bound on T::Key for key ordering during the merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

1 participant