Skip to content

Commit

Permalink
Fix ReverseLowerBound behavior in MemDB with unique index (#1074)
Browse files Browse the repository at this point in the history
This change resolves a test failure in the js-sdk caused by an unexpected
MemDB search behavior. The issue stems from the `ReverseLowerBound` method
behaving differently for unique and non-unique indexes.

Key changes:
- Set `doc_id_actor_id_server_seq` index as unique
- Ensures correct record retrieval in `FindMinSyncedSeqInfo`
- Resolves `ConnectError: [internal] change not found` during DetachDocument

Addressed a known MemDB limitation where index uniqueness affects search
behavior, referencing hashicorp/go-memdb#96.
  • Loading branch information
chacha912 authored Nov 21, 2024
1 parent 082224c commit bd886c5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/backend/database/memory/indexes.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ var schema = &memdb.DBSchema{
},
},
"doc_id_actor_id_server_seq": {
Name: "doc_id_actor_id_server_seq",
Name: "doc_id_actor_id_server_seq",
Unique: true,
Indexer: &memdb.CompoundIndex{
Indexes: []memdb.Indexer{
&memdb.StringFieldIndex{Field: "DocID"},
Expand Down

0 comments on commit bd886c5

Please sign in to comment.