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

Not able to use the XDCR migrate data to collections based on existence of an element in an array in a document

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Major
    • 7.1.0
    • Cheshire-Cat
    • XDCR
    • None

    Description

      While trying out the end to end testing for using the XDCR migration tool to migrate data from a bucket to collection, I was trying to filter out documents based on certain key words being present in an array inside a document. But the filtering expression is being rejected by the migration tool when using the standard N1QL ARRAY_CONTAINS function.

      Below is a sample document that I am trying to filter onto a collection 'weekly' based on 'weekly' being present in 'partOf' field in the document. I have tried the following filter expression but none seem to work.
      1. EXISTS(partOf) AND ARRAY_CONTAINS(partOf) : This gives error when trying to save the replication
      2. EXISTS(partOf) AND 'weekly' in partOf : This too gives error, but this might be expected since 'in' operator might not be supported by XDCR filtering.
      3. REGEXP_CONTAINS(REPLACE(TRIM(ENCODE_JSON(partOf), "[]\""), "\",\"", ","), 'weekly') : This too gives error when trying to save the replication. Here I was trying to convert the array into a string so that REGEXP_CONTAINS can be used to pattern match.
      4. REGEXP_CONTAINS(partOf[0], 'weekly') OR partOf[1] = 'weekly' OR partOf[2] = 'weekly' OR partOf[3] = 'weekly' OR partOf[4] = 'weekly' --> test_suite.weekly : A really crude way to try and check if filtering based on array is working and being supported. While this is allowed to be saved as mapping rule, the replication didn't happen on any of the documents, i.e. no documents were replicated as expected.

      {
        "component": "2i",
        "confFile": "gsi/alter_index.conf",
        "config": "b/resources/7-nodes-template-gsi.ini",
        "implementedIn": "5.5",
        "initNodes": "False",
        "mailing_list": "mihir.kamdar@couchbase.com, hemant.rajput@couchbase.com",
        "parameters": "gsi_type=plasma,reset_services=True,EXCLUDE_GROUP=MOI_ONLY",
        "partOf": [
          "weekly",
          "2i_12hr"
        ],
        "slave": "TEMPP0",
        "subcomponent": "alter-index-plasma",
        "timeOut": "1200"
      }
      

      Given that we provide easy way to find if nested json are being allowed in filtering expressions, , we need to provide with a good and easy way to filter based on arrays too.

      Attachments

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

        Activity

          People

            pavithra.mahamani Pavithra Mahamani (Inactive)
            bharath.gp Bharath G P
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty