Commit d5dc241
PartitionKey: Fixes latent issues in ContainerPropertiesExtensions and hardens InitTaskThreadSafe
Addresses PR Deep Reviewer findings surfaced while addressing Fabian's feedback:
- GetItemIdFromStreamIfRequiredAsync: guards against ResolveByNameAsync returning a null ContainerProperties, matching the null guard already present in EnsureIdGetAppendedToPartitionKeyIfNeededAsync. Prevents an NRE on containerProperties.IsLastPartitionKeyPathId when the collection cache returns null.
- Both helpers now rethrow OperationCanceledException instead of swallowing it in the blanket catch, so caller-cancelled tokens propagate as expected.
- InitTaskThreadSafe: also resets metadataCallCount between iterations for hygiene (previously relied on VmMetadataApiHandler's static latch) and uses Interlocked.Exchange for counter resets to stay consistent with the increment side. Adds a comment explaining why the URI bag is drained in place rather than reassigned.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 5a9a929 commit d5dc241
2 files changed
Lines changed: 14 additions & 3 deletions
File tree
- Microsoft.Azure.Cosmos
- src/Resource/Settings
- tests/Microsoft.Azure.Cosmos.EmulatorTests
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
| |||
115 | 119 | | |
116 | 120 | | |
117 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
118 | 126 | | |
119 | 127 | | |
120 | 128 | | |
121 | 129 | | |
122 | 130 | | |
123 | 131 | | |
124 | 132 | | |
125 | | - | |
| 133 | + | |
126 | 134 | | |
127 | 135 | | |
128 | 136 | | |
| |||
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
165 | 168 | | |
166 | 169 | | |
167 | 170 | | |
| |||
0 commit comments