We are in the process of converting our Couchbase deployment from map-reduce views to 100% N1QL. One of the things that was nice about views were that they were concretely named and referenced in code. Specifically, if you versioned a view and deployed it to couchbase you effectively had my_view_v1
and my_view_v2
. As clients in a rolling upgrade transitioned from one code version to another, you saw references in couchbase tomy_view_v1
slowly trail off and drop to zero. After a while of observing no use, we would delete the old view knowing with 100% certainty that the new code and new view were working, and the old had been fully dropped from service.
Is something roughly equivalent possible with N1QL?
Our experience with USE INDEX
is that the query planner may not honor it; it is a hint. That means that a second version of the index may still “mix it up” with the original. We also need to do testing to make sure that a USE INDEX
in the face of replicas may cause confusion (i.e. if a node goes down and you gotta run on the replica index does the USE INDEX clause need to change - gotta test that).
Bottom line is I’m curious what others are doing, or what the recommended practice is, to get a smooth controlled production transition from a V1 to a V2 cut of an index.