@@ -148,13 +148,6 @@ impl PartitionKeyRangeCache {
148148 )
149149 . await ;
150150
151- if let Err ( ref e) = routing_map {
152- tracing:: warn!(
153- collection_rid,
154- error = %e,
155- "Failed to fetch routing map for collection"
156- ) ;
157- }
158151 Ok ( routing_map. ok ( ) )
159152 }
160153
@@ -200,7 +193,7 @@ impl PartitionKeyRangeCache {
200193 let pk_range_link = self
201194 . database_link
202195 . feed ( ResourceType :: Containers )
203- . item_by_rid ( collection_rid)
196+ . item ( collection_rid)
204197 . feed ( ResourceType :: PartitionKeyRanges ) ;
205198 let response = self
206199 . execute_partition_key_range_read_change_feed (
@@ -684,61 +677,4 @@ mod tests {
684677 assert ! ( range. target_throughput. is_some( ) ) ;
685678 assert_eq ! ( range. target_throughput. unwrap( ) , 1000.0 ) ;
686679 }
687-
688- // Tests verifying that the pkranges resource link uses item_by_rid() so that
689- // collection RIDs (which are base64-encoded and can contain '=', '+', '/') are
690- // not URL-percent-encoded. Using item() would encode '=' to '%3D', causing 404s.
691-
692- #[ test]
693- fn pkranges_link_rid_with_equals_is_not_encoded ( ) {
694- // RIDs like "pLLZAIuPigw=" contain '=' which item() would encode to '%3D'.
695- // item_by_rid() must preserve it as-is.
696- let collection_rid = "pLLZAIuPigw=" ;
697- let database_link = ResourceLink :: root ( ResourceType :: Databases ) . item ( "perfdb" ) ;
698- let pk_range_link = database_link
699- . feed ( ResourceType :: Containers )
700- . item_by_rid ( collection_rid)
701- . feed ( ResourceType :: PartitionKeyRanges ) ;
702-
703- // Correct: '=' preserved, not encoded to '%3D'
704- assert_eq ! (
705- "dbs/perfdb/colls/pLLZAIuPigw=/pkranges" ,
706- pk_range_link. path( )
707- ) ;
708- }
709-
710- #[ test]
711- fn pkranges_link_item_encodes_equals_incorrectly ( ) {
712- // Demonstrates the bug: item() URL-encodes '=' to '%3D', producing a path
713- // that Cosmos DB cannot find (404).
714- let collection_rid = "pLLZAIuPigw=" ;
715- let database_link = ResourceLink :: root ( ResourceType :: Databases ) . item ( "perfdb" ) ;
716- let pk_range_link_wrong = database_link
717- . feed ( ResourceType :: Containers )
718- . item ( collection_rid)
719- . feed ( ResourceType :: PartitionKeyRanges ) ;
720-
721- // Wrong: '=' is encoded to '%3D', causing 404 from Cosmos DB
722- assert ! (
723- pk_range_link_wrong. path( ) . contains( "%3D" ) ,
724- "item() should URL-encode '=' to '%3D'"
725- ) ;
726- assert_eq ! (
727- "dbs/perfdb/colls/pLLZAIuPigw%3D/pkranges" ,
728- pk_range_link_wrong. path( )
729- ) ;
730- }
731-
732- #[ test]
733- fn pkranges_link_rid_with_plus_is_not_encoded ( ) {
734- // RIDs may also contain '+' (base64 char). item_by_rid() must preserve it.
735- let collection_rid = "AB+CD/EF==" ;
736- let database_link = ResourceLink :: root ( ResourceType :: Databases ) . item ( "mydb" ) ;
737- let pk_range_link = database_link
738- . feed ( ResourceType :: Containers )
739- . item_by_rid ( collection_rid)
740- . feed ( ResourceType :: PartitionKeyRanges ) ;
741-
742- assert_eq ! ( "dbs/mydb/colls/AB+CD/EF==/pkranges" , pk_range_link. path( ) ) ;
743- }
744680}
0 commit comments