Skip to content

ING-1495: When creating/dropping a primary idx, call consistency helpers with '#primary'#365

Merged
DemetrisChr merged 1 commit into
couchbase:masterfrom
DemetrisChr:ING-1495-primary-index-ensure
Apr 27, 2026
Merged

ING-1495: When creating/dropping a primary idx, call consistency helpers with '#primary'#365
DemetrisChr merged 1 commit into
couchbase:masterfrom
DemetrisChr:ING-1495-primary-index-ensure

Conversation

@DemetrisChr
Copy link
Copy Markdown
Contributor

After creating a primary index with no custom name (i.e. the name is #primary), EnsureQueryIndexCreated is called with the empty string as the name, instead of setting it to #primary. This means that the EnsureQueryIndexCreated call, and the overall CreatePrimaryIndex RPC call, don't return, until timeout.

Copy link
Copy Markdown
Contributor

@Westwooo Westwooo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DemetrisChr nice catch, would you be able to add a test case to TestQueryManagement in gateway/test/query_mgmt_test.go that covers this case (where the primary index name is nil)?

@DemetrisChr DemetrisChr force-pushed the ING-1495-primary-index-ensure branch from f24f1d2 to 9069ba6 Compare April 24, 2026 16:33
@DemetrisChr
Copy link
Copy Markdown
Contributor Author

@DemetrisChr nice catch, would you be able to add a test case to TestQueryManagement in gateway/test/query_mgmt_test.go that covers this case (where the primary index name is nil)?

I've added a test. I wanted it to be as exhaustive as the ones for the named primary index, but it wasn't straightforward to make the individual tests isolated, because they all operate on the same index. So I've added a simpler test that verifies that the index can be dropped and created.

I've also spotted that DropPrimaryIndex had the same issue, although in that case it meant that EnsureQueryIndexDropped wasn't ensuring that the index was dropped, rather than getting stuck indefinitely. I've updated that as well.

@DemetrisChr DemetrisChr requested a review from Westwooo April 24, 2026 16:37
@DemetrisChr DemetrisChr changed the title ING-1495: When creating a primary idx, call EnsureQueryIndexCreated with '#primary' ING-1495: When creating/dropping a primary idx, call consistency helpers with '#primary' Apr 24, 2026
@DemetrisChr DemetrisChr force-pushed the ING-1495-primary-index-ensure branch from 9069ba6 to 7e16397 Compare April 27, 2026 09:42
@DemetrisChr DemetrisChr merged commit 03941d0 into couchbase:master Apr 27, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants