Bug Report
- Import path:
github.com/Azure/azure-sdk-for-go/sdk/data/azcosmos
- SDK version:
v1.5.0
- Go version:
go1.26.3
What happened?
A new Cosmos client can intermittently fail its first ReadFeedRanges or ReadChangeFeed call against a container undergoing physical partition splits.
The partition-range change feed can return multiple revisions of the same range ID with different boundaries. The SDK then rejects the routing map because the range appears to overlap itself:
partition key range cache refresh failed: service returned an incomplete set
of ranges (... issue: overlap between range id=X (...) and range id=X (...))
The affected path is:
getPartitionKeyRanges
-> partitionKeyRangeCache.getRoutingMap
-> refreshEntryDetached
-> fetchAllChangeFeedPages
-> newCollectionRoutingMap
-> isCompleteSetOfRanges
newCollectionRoutingMap appends every surviving record to orderedRanges. It separately creates rangeByID, which deduplicates by ID, but does not rebuild orderedRanges from that map. Validation therefore runs against the non-deduplicated slice.
What did you expect or want to happen?
The full-refresh path should produce one current entry per physical range ID before validating continuity, matching the incremental merge behavior.
Alternatively, this condition should be retried internally or returned as a typed retryable error.
How can we reproduce it?
- Create a new
azcosmos.Client against a partitioned container undergoing physical partition splits.
- Call
ReadFeedRanges, or start concurrent ReadChangeFeed calls, while the client’s partition-range cache is empty.
- Have the full partition-range change feed return multiple revisions of one range ID.
- Observe
newCollectionRoutingMap retain both revisions in orderedRanges.
- Observe
isCompleteSetOfRanges report that the range overlaps itself.
Concurrent callers receive the same error because they share the in-flight cache refresh. A later refresh can succeed and populate the cache.
Anything we should know about your environment?
The issue occurs during cold cache initialization. Long-lived clients can recover when a later operation successfully refreshes the cache, while short-lived jobs can fail on each new client initialization.
Bug Report
github.com/Azure/azure-sdk-for-go/sdk/data/azcosmosv1.5.0go1.26.3What happened?
A new Cosmos client can intermittently fail its first
ReadFeedRangesorReadChangeFeedcall against a container undergoing physical partition splits.The partition-range change feed can return multiple revisions of the same range ID with different boundaries. The SDK then rejects the routing map because the range appears to overlap itself:
The affected path is:
newCollectionRoutingMapappends every surviving record toorderedRanges. It separately createsrangeByID, which deduplicates by ID, but does not rebuildorderedRangesfrom that map. Validation therefore runs against the non-deduplicated slice.What did you expect or want to happen?
The full-refresh path should produce one current entry per physical range ID before validating continuity, matching the incremental merge behavior.
Alternatively, this condition should be retried internally or returned as a typed retryable error.
How can we reproduce it?
azcosmos.Clientagainst a partitioned container undergoing physical partition splits.ReadFeedRanges, or start concurrentReadChangeFeedcalls, while the client’s partition-range cache is empty.newCollectionRoutingMapretain both revisions inorderedRanges.isCompleteSetOfRangesreport that the range overlaps itself.Concurrent callers receive the same error because they share the in-flight cache refresh. A later refresh can succeed and populate the cache.
Anything we should know about your environment?
The issue occurs during cold cache initialization. Long-lived clients can recover when a later operation successfully refreshes the cache, while short-lived jobs can fail on each new client initialization.