Skip to content

Commit

Permalink
Fix version vector validation when running migration (#1057)
Browse files Browse the repository at this point in the history
This fixes a validation error that occurs during migration when version vectors
contain multiple actors. After the 0.5.3 update, version vectors were allowed
to have multiple actors, but the validation process incorrectly returned an
error when encountering more than one actor in a version vector.
  • Loading branch information
JOOHOJANG authored Nov 5, 2024
1 parent 5aaacfb commit 19c818e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions migrations/v0.5.3/add-version-vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,12 @@ func validateAddVersionVector(ctx context.Context, db *mongo.Client, databaseNam
}

versionVector := info.VersionVector
actors, err := versionVector.Keys()
actorID, err := info.ActorID.ToActorID()
if err != nil {
return err
}

if len(actors) > 1 {
return fmt.Errorf("found %d actor in version vector", len(actors))
}

if versionVector.VersionOf(actors[0]) != info.Lamport {
if versionVector.VersionOf(actorID) != info.Lamport {
return fmt.Errorf("wrong lamport in version vector")
}

Expand Down

0 comments on commit 19c818e

Please sign in to comment.