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

[BP to 7.2.5] - COUNT(*) on system:indexes can return incorrect results

    XMLWordPrintable

Details

    • Untriaged
    • 0
    • Unknown

    Description

      This is a server ticket for https://couchbasecloud.atlassian.net/browse/AV-69973

      Repro steps:

      1. Load travel-sample dataset

      2. Run the following queries:

      a. 

      select * from system:indexes
      

      The result count of the above query:

      "resultCount": 23

       

      b.  Run a COUNT() against system:indexes without a predicate.

       

      select count(*) from system:indexes;
      

       

      The result is:

       

      [
          {
              "$1": 33
          }
      ]
      

       

       

      This is because the Count() implementation of the system:indexes keyspace does the following:

      1. Counts the indexes created on the bucket i.e on the bucket’s default._default collection - _twice.

      Since the Object is a keyspace and a bucket.

      https://github.com/couchbase/query/blob/8de352393a1cb1a9c41d0bd1e6de9288dc9b663a/datastore/system/system_keyspace_indexes.go#L113

      https://github.com/couchbase/query/blob/8de352393a1cb1a9c41d0bd1e6de9288dc9b663a/datastore/system/system_keyspace_indexes.go#L141

      Attachments

        Issue Links

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

          Activity

            People

              pierre.regazzoni Pierre Regazzoni
              dhanya.gowrish Dhanya Gowrish
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty