Skip to content

Commit

Permalink
go: store/types: Fix dolt_gc on databases that use vector indexes.
Browse files Browse the repository at this point in the history
  • Loading branch information
reltuk committed Jan 30, 2025
1 parent caaa4bd commit 8356ba7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions go/store/types/serial_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,10 +769,10 @@ func (sm SerialMessage) WalkAddrs(nbf *NomsBinFormat, cb func(addr hash.Hash) er
return err
}
}
case serial.TableSchemaFileID, serial.ForeignKeyCollectionFileID:
case serial.TableSchemaFileID, serial.ForeignKeyCollectionFileID, serial.TupleFileID:
// no further references from these file types
return nil
case serial.ProllyTreeNodeFileID, serial.AddressMapFileID, serial.MergeArtifactsFileID, serial.BlobFileID, serial.CommitClosureFileID:
case serial.ProllyTreeNodeFileID, serial.AddressMapFileID, serial.MergeArtifactsFileID, serial.BlobFileID, serial.CommitClosureFileID, serial.VectorIndexNodeFileID:
return message.WalkAddresses(context.TODO(), serial.Message(sm), func(ctx context.Context, addr hash.Hash) error {
return cb(addr)
})
Expand Down
11 changes: 11 additions & 0 deletions integration-tests/bats/vector-index.bats
Original file line number Diff line number Diff line change
Expand Up @@ -430,3 +430,14 @@ SQL
[[ "$output" =~ "pk1" ]] || false
[[ "${#lines[@]}" = "1" ]] || false
}

@test "vector-index: can GC" {
dolt sql <<SQL
CREATE VECTOR INDEX idx_v1 ON onepk(v1);
INSERT INTO onepk VALUES (1, '[99, 51]'), (2, '[11, 55]'), (3, '[88, 52]'), (4, '[22, 54]'), (5, '[77, 53]');
SQL
dolt gc
dolt sql <<SQL
INSERT INTO onepk VALUES (6, '[99, 51]'), (7, '[11, 55]'), (8, '[88, 52]'), (9, '[22, 54]'), (10, '[77, 53]');
SQL
}

0 comments on commit 8356ba7

Please sign in to comment.