Commit 680de74
committed
address #3232 review: narrow fix to Snapshot clone
The shared *Snapshot pointer is the real cause of #3231: the shallow
copy of the raft message meant re-slicing raftMsg.Snapshot.Data also
re-sliced m.Snapshot.Data, shrinking its capacity until a later
iteration panicked with "slice bounds out of range".
Cloning the Snapshot struct alone is sufficient. Drop the 64 KiB
payload-size clamp (which could not produce a sendable message when
struct overhead already exceeds GRPCMaxMsgSize) and the redundant
fullData capture. Replace the tests with a single regression test
that feeds a realistic MsgSnap of 3*GRPCMaxMsgSize and asserts the
input message's Snapshot.Data is untouched after splitting.
Signed-off-by: Sylvere Richard <sylvere.richard@gmail.com>1 parent 22ab07d commit 680de74
2 files changed
Lines changed: 42 additions & 76 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | 148 | | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
| 149 | + | |
157 | 150 | | |
158 | 151 | | |
159 | 152 | | |
| |||
171 | 164 | | |
172 | 165 | | |
173 | 166 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | 167 | | |
180 | 168 | | |
181 | 169 | | |
| |||
184 | 172 | | |
185 | 173 | | |
186 | 174 | | |
187 | | - | |
188 | | - | |
| 175 | + | |
| 176 | + | |
189 | 177 | | |
190 | 178 | | |
191 | 179 | | |
192 | 180 | | |
193 | | - | |
| 181 | + | |
194 | 182 | | |
195 | 183 | | |
196 | 184 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
109 | 114 | | |
110 | 115 | | |
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 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
167 | 127 | | |
168 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
169 | 132 | | |
170 | 133 | | |
171 | | - | |
172 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
173 | 151 | | |
174 | 152 | | |
175 | 153 | | |
| |||
0 commit comments