Commit 25b5c8f
Container recreate retry policy Support for Cosmos DB Python SDK (#36043)
* Add client cache to hold container properties
This adds a client level cache for container properties.
* Added tests for container properties cache
* Update _cosmos_client_connection_async.py
* Update _cosmos_client_connection_async.py
* Fix typos
* Update container.py
* Update _container.py
* Update cache test
* Update test_container_properties_cache.py
* update tests
* Update test_container_properties_cache.py
* Update tests
updated tests that were compensating for extra container reads, the extra reads no longer happen with adding the container cache properties in the client.
* tests updates
* Mypy fixes
* mypy fix
* Update
* Cache update
Fixed some reccomnded changes, and added optimizations for the cache. Only including needed properties info that will be unlikely to change.
* test update
* Update CHANGELOG.md
* added set_properties_cache method
Added a method in base.py to set the properties cache so we only have to change one location in case in the future we want to cache additional properties
* Update _base.py
* Update _cosmos_client_connection.py
* MyPy fixes
* Fix mypy issue
* Update _cosmos_client_connection.py
* Update _cosmos_client_connection.py
* Update _cosmos_client_connection_async.py
* Update _cosmos_client_connection.py
* Update container cache
Changed container cache to be a private attribute.
Also added tests to verify the contents of the cache to be correct ones.
* Update sdk/cosmos/azure-cosmos/CHANGELOG.md
Co-authored-by: Kushagra Thapar <[email protected]>
* Additional pylint updates
* more pylint fixes
* pylint fix
* Update test_container_properties_cache.py
* Container Cache updates
Fixed broken tests that used old properties cache. Added samples to show how new properties cache works and best way to get the container properties
* Update CHANGELOG.md
* Added support to handle container recreates
This adds support to retry on a container recreate that will refresh the cache of container properties.
* spell check for string literal
* Pylint fixes
* Pylint fixes
* Update _container_recreate_retry_policy.py
* pylint updates
* Update _container_recreate_retry_policy.py
* pylint fixes
* Container Recreate Retry Policy Update
Moves container properties refresh out of ShouldRetry. Handles reextraction of partition keys fro document definition. Error for getting throughput now thrown in the retry utils.
* quick fixes
* Update _cosmos_client_connection_async.py
* Update _retry_utility_async.py
* update no offer throughput error
This updates the 404 from offerthroughput error to now have a client side substatus code instead of throwing a generic 404.
* Update _container_recreate_retry_policy.py
Pylint fixes
* pylint fixes
* Mypy fixes
* more mypy fixes
* Container Recreate Updates
Changes based on Feedback. Also adds query tests for container recreate.
* typehint and test updates
added test for batch operations in container recreate
* Update _container_recreate_retry_policy.py
* Update exceptions.py
* Add Changefeed Test Cases
Updated with changes based on feedback, also added test cases for changefeed retries in container recreate.
* docstring update
added docstrings
---------
Co-authored-by: Kushagra Thapar <[email protected]>1 parent e82aaea commit 25b5c8f
File tree
17 files changed
+1550
-95
lines changed- sdk/cosmos/azure-cosmos
- azure/cosmos
- aio
- test
17 files changed
+1550
-95
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
14 | 18 | | |
15 | 19 | | |
16 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
322 | 327 | | |
323 | 328 | | |
324 | 329 | | |
| |||
Lines changed: 168 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
Lines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1173 | 1173 | | |
1174 | 1174 | | |
1175 | 1175 | | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
1176 | 1180 | | |
1177 | 1181 | | |
1178 | 1182 | | |
| |||
3202 | 3206 | | |
3203 | 3207 | | |
3204 | 3208 | | |
3205 | | - | |
3206 | 3209 | | |
3207 | 3210 | | |
3208 | 3211 | | |
| |||
3218 | 3221 | | |
3219 | 3222 | | |
3220 | 3223 | | |
3221 | | - | |
| 3224 | + | |
3222 | 3225 | | |
3223 | | - | |
| 3226 | + | |
3224 | 3227 | | |
3225 | 3228 | | |
3226 | 3229 | | |
3227 | 3230 | | |
3228 | 3231 | | |
3229 | | - | |
3230 | 3232 | | |
3231 | | - | |
3232 | | - | |
3233 | | - | |
| 3233 | + | |
| 3234 | + | |
| 3235 | + | |
| 3236 | + | |
3234 | 3237 | | |
3235 | 3238 | | |
3236 | 3239 | | |
| |||
3272 | 3275 | | |
3273 | 3276 | | |
3274 | 3277 | | |
| 3278 | + | |
| 3279 | + | |
| 3280 | + | |
| 3281 | + | |
| 3282 | + | |
| 3283 | + | |
3275 | 3284 | | |
3276 | 3285 | | |
3277 | 3286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
42 | | - | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
79 | 91 | | |
80 | 92 | | |
81 | 93 | | |
| |||
95 | 107 | | |
96 | 108 | | |
97 | 109 | | |
98 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
99 | 123 | | |
100 | 124 | | |
101 | 125 | | |
| |||
112 | 136 | | |
113 | 137 | | |
114 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
115 | 164 | | |
116 | 165 | | |
117 | 166 | | |
| |||
0 commit comments