Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-51157

Index mutations per Collection

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • Morpheus
    • 7.0.2
    • secondary-index
    • None
    • Untriaged
    • 1
    • No

    Description

      We have a single bucket (profiles) with the following scopes/collections/indexes:

      {{}}

      CREATE SCOPE `profiles`.core CREATE SCOPE `profiles`.configuration 
      CREATE COLLECTION `profiles`.core.user_profile; 
      CREATE COLLECTION `profiles`.configuration.attribute;
      CREATE PRIMARY INDEX `#primary` ON `profiles`.`configuration`.`attribute`;

      {{}}

      In our tests, we are mutating on profiles.core.user_profile (insert, replace). However, as shown in the picture, we observe that Couchabse sent these mutations to the profiles.configuration.attribute primary index.

       
      We are using Java SDK(reactive API):

      @Autowired 
      private com.couchbase.client.java.Cluster cluster;
      private static final String SCOPE = "core";
      private static final String BUCKET = "profiles";
       
      cluster.reactive().bucket(BUCKET).scope(SCOPE).collection("user_profile")
          .insert(documentId, content, InsertOptions.insertOptions().durability(durability).retryStrategy(retryStrategy))
          
      cluster.reactive().bucket(BUCKET).scope(SCOPE).collection("user_profile").mutateIn(documentId, mutateInSpec,
          MutateInOptions.mutateInOptions().durability(durability).storeSemantics(StoreSemantics.REPLACE).cas(cas)
              .retryStrategy(retryStrategy)) 

      And Spring repositories for the configuration collections:

      @Document
      @Collection("attribute")
      @Scope("configuration")
      @Data
      @EqualsAndHashCode(callSuper = true)
      @NoArgsConstructor
      public class Attribute {
       
          private static final long serialVersionUID = 4195336417156562036L;
          @Id
          private String externalId;
          @Field("name")
          private String name; ...
      } 

      Version

      spring-boot-starter-data-couchbase-reactive:2.6.1

      Please also note that the same happens if we use the “_default” scope for all collections:

      CREATE COLLECTION `profiles`.`_default`.user_profile;
      CREATE COLLECTION `profiles`.`_default`.attribute;
      CREATE PRIMARY INDEX `#primary`ON `profiles`.`_default`.`attribute`;

      @Autowired private ReactiveCouchbaseTemplate template; 
       
      template.getCollection("user_profile").reactive().insert(documentId, content, InsertOptions.insertOptions().durability(durability).retryStrategy(retryStrategy))  

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              amit.kulkarni Amit Kulkarni
              lefteris Lefteris Katiforis
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty