Skip to content

Conversation

@RIT3shSapata
Copy link
Contributor

CBG-4892

Describe your PR here...

  • Add ECCV values for each bucket as a response for _cluster_info endpoint
  • This endpoint would be used by sgcollect_info to display this setting of a bucket

Pre-review checklist

  • Removed debug logging (fmt.Print, log.Print, ...)
  • Logging sensitive data? Make sure it's tagged (e.g. base.UD(docID), base.MD(dbName))
  • Updated relevant information in the API specifications (such as endpoint descriptions, schemas, ...) in docs/api

Dependencies (if applicable)

  • Link upstream PRs
  • Update Go module dependencies when merged

Integration Tests

@RIT3shSapata RIT3shSapata requested a review from gregns1 October 31, 2025 11:44
Copilot AI review requested due to automatic review settings October 31, 2025 11:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds Extended Cross-Cluster Versioning (ECCV) information to the _cluster_info endpoint. The endpoint now returns the ECCV setting for each bucket, which will be used by sgcollect_info to display bucket configurations.

Key changes:

  • Added EnableCrossClusterVersioning field to the BucketInfo response structure
  • Implemented getBucketCCVSettings() method to retrieve ECCV settings for a given bucket
  • Added test coverage for the new ECCV functionality in _cluster_info endpoint

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
rest/server_context.go Implements helper method to retrieve ECCV settings for a bucket by iterating through databases
rest/admin_api.go Updates BucketInfo struct and handleGetClusterInfo to include ECCV in the response
rest/api_test.go Adds test to validate ECCV values are returned in _cluster_info endpoint response

Copy link
Contributor

@gregns1 gregns1 left a comment

Choose a reason for hiding this comment

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

Generally looks good just a few suggestions and the need for the eccv value to be presented in legacy config mode.

rest/api_test.go Outdated
}
var clusterInfo ClusterInfoResponse
err := base.JSONUnmarshal(resp.Body.Bytes(), &clusterInfo)
assert.NoError(t, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
assert.NoError(t, err)
require.NoError(t, err)

continue
}

eccv := h.server.getBucketCCVSettings(bucketName)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would probably change this to avoid iterating multiple times through the map of database contexts. Maybe move this outside the bucket name iteration and have this function just iterate through database context map and return a map of bucket name to eccv value. Then you can use this map to lookup bucket name eccv value here.

This just avoids iterating through db context map for each bucket name here.

var clusterInfo ClusterInfoResponse
err := base.JSONUnmarshal(resp.Body.Bytes(), &clusterInfo)
assert.NoError(t, err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would also add assertion to this to assert that the eccv value is true (given we set it to true for our test suite)

@gregns1 gregns1 assigned RIT3shSapata and unassigned gregns1 Oct 31, 2025
@RIT3shSapata RIT3shSapata requested a review from gregns1 November 6, 2025 11:10
@RIT3shSapata RIT3shSapata assigned gregns1 and unassigned RIT3shSapata Nov 6, 2025
Copy link
Contributor

@gregns1 gregns1 left a comment

Choose a reason for hiding this comment

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

Generally looks good just couple of small tweaks and should be ready to go!

rest/api_test.go Outdated
err := base.JSONUnmarshal(resp.Body.Bytes(), &clusterInfo)
require.NoError(t, err)
assert.True(t, clusterInfo.Buckets[bucketName].EnableCrossClusterVersioning)
//RequireStatus(t, rt.SendAdminRequest(http.MethodDelete, fmt.Sprintf("/%s/", tests.dbName), ""), http.StatusOK)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this commented out line be removed?


type BucketInfo struct {
Registry GatewayRegistry `json:"registry"`
Registry GatewayRegistry `json:"registry,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

For omit empty to work correctly here I think you'll have to make this GatewayRegistry struct a pointer.

Running in legacy config mode as it stands prints empty registry for the bucket:

Image

@RIT3shSapata RIT3shSapata requested a review from gregns1 November 7, 2025 14:50
@RIT3shSapata RIT3shSapata merged commit bec8870 into main Nov 11, 2025
42 checks passed
@RIT3shSapata RIT3shSapata deleted the CBG-4892 branch November 11, 2025 14:31
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.

3 participants