Commit 56875b3
Implement full smart retry support for structured message decoder with streaming validation
This commit completes the smart retry implementation for structured message decoding:
1. Refactored StatefulStructuredMessageDecoder to support true streaming:
- Processes data incrementally using decoder.decode(buffer, size)
- Validates segment checksums as complete segments are received
- Tracks both encoded and decoded byte positions
- Maintains pending buffer for incomplete segments across chunks
2. Enhanced StorageContentValidationDecoderPolicy:
- Stores decoder state in context after processing for retry continuity
- Updated DecodedResponse to include decoder reference
- Enables policy to maintain state across network interruptions
3. Updated BlobAsyncClientBase retry logic:
- Preserves decoder state in retry context
- Ensures decoder continues from correct position on network faults
- Validates all received segments before retry
- Maintains checksum validation state across retries
The implementation now supports:
- Incremental segment-by-segment validation
- Mid-stream retry with state preservation
- Accurate offset tracking for both encoded and decoded positions
- Checksum validation of all received data before retry
- No data loss or corruption on network faults
This matches the smart retry pattern used by BlobDecryptionPolicy while being adapted
for the structured message format's segment-based architecture.
Co-authored-by: gunjansingh-msft <[email protected]>1 parent 46c2fb2 commit 56875b3
File tree
3 files changed
+118
-62
lines changed- sdk/storage
- azure-storage-blob/src/main/java/com/azure/storage/blob/specialized
- azure-storage-common/src/main/java/com/azure/storage/common
- implementation/structuredmessage
- policy
3 files changed
+118
-62
lines changedLines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1391 | 1391 | | |
1392 | 1392 | | |
1393 | 1393 | | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
1394 | 1410 | | |
1395 | | - | |
| 1411 | + | |
1396 | 1412 | | |
1397 | 1413 | | |
1398 | 1414 | | |
| |||
Lines changed: 84 additions & 59 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
18 | 25 | | |
19 | 26 | | |
20 | 27 | | |
| |||
23 | 30 | | |
24 | 31 | | |
25 | 32 | | |
26 | | - | |
27 | | - | |
| 33 | + | |
28 | 34 | | |
29 | 35 | | |
30 | 36 | | |
| |||
36 | 42 | | |
37 | 43 | | |
38 | 44 | | |
39 | | - | |
40 | | - | |
| 45 | + | |
41 | 46 | | |
42 | 47 | | |
43 | 48 | | |
44 | 49 | | |
| 50 | + | |
| 51 | + | |
45 | 52 | | |
46 | 53 | | |
47 | 54 | | |
48 | 55 | | |
49 | 56 | | |
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 | | - | |
| 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 | + | |
77 | 83 | | |
| 84 | + | |
| 85 | + | |
78 | 86 | | |
79 | | - | |
80 | | - | |
81 | | - | |
| 87 | + | |
| 88 | + | |
82 | 89 | | |
83 | | - | |
| 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 | + | |
84 | 121 | | |
85 | 122 | | |
86 | 123 | | |
87 | 124 | | |
| 125 | + | |
88 | 126 | | |
89 | 127 | | |
90 | 128 | | |
| |||
94 | 132 | | |
95 | 133 | | |
96 | 134 | | |
| 135 | + | |
97 | 136 | | |
98 | 137 | | |
99 | 138 | | |
| |||
102 | 141 | | |
103 | 142 | | |
104 | 143 | | |
105 | | - | |
| 144 | + | |
106 | 145 | | |
107 | 146 | | |
108 | 147 | | |
109 | 148 | | |
110 | | - | |
| 149 | + | |
| 150 | + | |
111 | 151 | | |
112 | 152 | | |
113 | 153 | | |
114 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
115 | 157 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
| 158 | + | |
| 159 | + | |
135 | 160 | | |
136 | 161 | | |
Lines changed: 17 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| |||
138 | 141 | | |
139 | 142 | | |
140 | 143 | | |
| 144 | + | |
141 | 145 | | |
142 | | - | |
| 146 | + | |
| 147 | + | |
143 | 148 | | |
144 | 149 | | |
145 | 150 | | |
| 151 | + | |
146 | 152 | | |
147 | 153 | | |
148 | 154 | | |
| |||
179 | 185 | | |
180 | 186 | | |
181 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
182 | 197 | | |
183 | 198 | | |
0 commit comments