You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea of this issue is to regroup all the work we done / we have to do, in order to handle correctly the indexes on Cozy-Client.
We have two issues with indexes in Cozy-Client:
The first one is related to the usage of logical mango operators ($or, $and, $in, etc.) at the top level.Cozy-Client doesn't handle them properly and creates indexes named $or/$and/$etc
(see #1270). This can lead to conflicts with the indexes.
Even worse, when we create a partialFilter without declaring a top-level $and, like [{foo: bar, truc:muche}], the index name on the Cozy-Client side is correct (foo_truc). However, when we inspect the design doc, CouchDB automatically adds the $and, and it becomes $and: [{foo: bar}, {truc: muche}]
The second issue is the automatic deletion of what Cozy-Client considers "inconsistent" indexes. When Cozy-Client receives an event of type index_not_found or not_usable_index, it performs some leanup by querying all the indexes on the relevant doctype and checks if the index name matches the indexed fields in the design doc. Due to CouchDB's automatic addition of a top-level logical operator with an implicit $and, Cozy-Client doesn't handle this well and considers the index as "inconsistent," leading to its deletion.
The real solution is to make Cozy-Client capable of handling logical operators at the top level of indexes / partialFilters. To achieve this, we need to rename all the indexes. However, doing so would result in the deletion of indexes judged inconsistent by the current Cozy-Client version. Newer versions of Cozy-Client will create new, correct indexes, but older apps will delete them as they won't correspond to the previous logic. This process of create / delete / create / delete will become a nightmare.
Convert implicit operator to explicit since CouchDB does that ([{foo: bar, truc:muche}] becomes $and: [{foo: bar}, {truc: muche}] in the design_doc). As a result, isMatchingIndex cannot function properly.
The text was updated successfully, but these errors were encountered:
The idea of this issue is to regroup all the work we done / we have to do, in order to handle correctly the indexes on Cozy-Client.
From #1373
Here is the actions we need to take:
The text was updated successfully, but these errors were encountered: