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

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. 

The result count of the above query:

 

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

 

 

The result is:

 

 

 

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

Components

Affects versions

Fix versions

Labels

Environment

None

Link to Log File, atop/blg, CBCollectInfo, Core dump

None

Release Notes Description

None

Activity

Show:

Dhanya Gowrish June 7, 2024 at 3:19 PM

Release Note:

When CountScan is used to service a COUNT() operation against the system:indexes system catalog, the results could be incorrect if the cluster had indexes on the bucket’s _default._default collection.

This has been fixed.

Beth Favini June 3, 2024 at 5:46 PM

We are preparing the 7.2.5 release notes. If this fix is customer-facing, please add the releasenote label to the issue so it will be picked up by our filter.

Pierre Regazzoni January 10, 2024 at 5:52 PM

Verified on 7.2.5-7514

Dhanya Gowrish January 10, 2024 at 4:39 AM

Verification Steps

 

Repro steps:

1. Load travel-sample dataset

2. Run the following queries:

a. 

 

b.

 

The result count i.e number of documents returned by query a. must be the same as the Count returned by query b.

CB robot January 9, 2024 at 1:12 PM

Build couchbase-server-7.2.5-7514 contains query commit 1fca75a with commit message:
: [7.2.5] Fix incorrect COUNT returned on system:indexes

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Assignee

Reporter

Is this a Regression?

Unknown

Triage

Untriaged

Story Points

Priority

Instabug

Open Instabug

PagerDuty

Sentry

Zendesk Support

Created January 8, 2024 at 4:02 AM
Updated July 10, 2024 at 8:28 AM
Resolved January 10, 2024 at 4:39 AM
Instabug