@@ -21,6 +21,7 @@ const (
2121 firstOptName = "first"
2222 afterOptName = "after"
2323 batchSizeOptName = "batch_size"
24+ fetchLatestMetadataOptName = "fetch_latest_metadata"
2425)
2526
2627// OptUint is an optional uint.
@@ -150,20 +151,26 @@ type SimpleOperationOpts struct {
150151 Fields OptTuple
151152 // BucketId is a bucket ID.
152153 BucketId OptUint
154+ // FetchLatestMetadata guarantees the up-to-date metadata (space format)
155+ // in first return value, otherwise it may not take into account
156+ // the latest migration of the data format. Performance overhead is up to 15%.
157+ // Disabled by default.
158+ FetchLatestMetadata OptBool
153159}
154160
155161// EncodeMsgpack provides custom msgpack encoder.
156162func (opts SimpleOperationOpts ) EncodeMsgpack (enc * msgpack.Encoder ) error {
157- const optsCnt = 4
163+ const optsCnt = 5
158164
159165 names := [optsCnt ]string {timeoutOptName , vshardRouterOptName ,
160- fieldsOptName , bucketIdOptName }
166+ fieldsOptName , bucketIdOptName , fetchLatestMetadataOptName }
161167 values := [optsCnt ]interface {}{}
162168 exists := [optsCnt ]bool {}
163169 values [0 ], exists [0 ] = opts .Timeout .Get ()
164170 values [1 ], exists [1 ] = opts .VshardRouter .Get ()
165171 values [2 ], exists [2 ] = opts .Fields .Get ()
166172 values [3 ], exists [3 ] = opts .BucketId .Get ()
173+ values [4 ], exists [4 ] = opts .FetchLatestMetadata .Get ()
167174
168175 return encodeOptions (enc , names [:], values [:], exists [:])
169176}
@@ -184,21 +191,28 @@ type SimpleOperationObjectOpts struct {
184191 // SkipNullabilityCheckOnFlatten is a parameter to allow
185192 // setting null values to non-nullable fields.
186193 SkipNullabilityCheckOnFlatten OptBool
194+ // FetchLatestMetadata guarantees the up-to-date metadata (space format)
195+ // in first return value, otherwise it may not take into account
196+ // the latest migration of the data format. Performance overhead is up to 15%.
197+ // Disabled by default.
198+ FetchLatestMetadata OptBool
187199}
188200
189201// EncodeMsgpack provides custom msgpack encoder.
190202func (opts SimpleOperationObjectOpts ) EncodeMsgpack (enc * msgpack.Encoder ) error {
191- const optsCnt = 5
203+ const optsCnt = 6
192204
193205 names := [optsCnt ]string {timeoutOptName , vshardRouterOptName ,
194- fieldsOptName , bucketIdOptName , skipNullabilityCheckOnFlattenOptName }
206+ fieldsOptName , bucketIdOptName , skipNullabilityCheckOnFlattenOptName ,
207+ fetchLatestMetadataOptName }
195208 values := [optsCnt ]interface {}{}
196209 exists := [optsCnt ]bool {}
197210 values [0 ], exists [0 ] = opts .Timeout .Get ()
198211 values [1 ], exists [1 ] = opts .VshardRouter .Get ()
199212 values [2 ], exists [2 ] = opts .Fields .Get ()
200213 values [3 ], exists [3 ] = opts .BucketId .Get ()
201214 values [4 ], exists [4 ] = opts .SkipNullabilityCheckOnFlatten .Get ()
215+ values [5 ], exists [5 ] = opts .FetchLatestMetadata .Get ()
202216
203217 return encodeOptions (enc , names [:], values [:], exists [:])
204218}
@@ -221,21 +235,28 @@ type OperationManyOpts struct {
221235 // RollbackOnError is a parameter because of what any failed operation
222236 // will lead to rollback on a storage, where the operation is failed.
223237 RollbackOnError OptBool
238+ // FetchLatestMetadata guarantees the up-to-date metadata (space format)
239+ // in first return value, otherwise it may not take into account
240+ // the latest migration of the data format. Performance overhead is up to 15%.
241+ // Disabled by default.
242+ FetchLatestMetadata OptBool
224243}
225244
226245// EncodeMsgpack provides custom msgpack encoder.
227246func (opts OperationManyOpts ) EncodeMsgpack (enc * msgpack.Encoder ) error {
228- const optsCnt = 5
247+ const optsCnt = 6
229248
230249 names := [optsCnt ]string {timeoutOptName , vshardRouterOptName ,
231- fieldsOptName , stopOnErrorOptName , rollbackOnErrorOptName }
250+ fieldsOptName , stopOnErrorOptName , rollbackOnErrorOptName ,
251+ fetchLatestMetadataOptName }
232252 values := [optsCnt ]interface {}{}
233253 exists := [optsCnt ]bool {}
234254 values [0 ], exists [0 ] = opts .Timeout .Get ()
235255 values [1 ], exists [1 ] = opts .VshardRouter .Get ()
236256 values [2 ], exists [2 ] = opts .Fields .Get ()
237257 values [3 ], exists [3 ] = opts .StopOnError .Get ()
238258 values [4 ], exists [4 ] = opts .RollbackOnError .Get ()
259+ values [5 ], exists [5 ] = opts .FetchLatestMetadata .Get ()
239260
240261 return encodeOptions (enc , names [:], values [:], exists [:])
241262}
@@ -261,15 +282,20 @@ type OperationObjectManyOpts struct {
261282 // SkipNullabilityCheckOnFlatten is a parameter to allow
262283 // setting null values to non-nullable fields.
263284 SkipNullabilityCheckOnFlatten OptBool
285+ // FetchLatestMetadata guarantees the up-to-date metadata (space format)
286+ // in first return value, otherwise it may not take into account
287+ // the latest migration of the data format. Performance overhead is up to 15%.
288+ // Disabled by default.
289+ FetchLatestMetadata OptBool
264290}
265291
266292// EncodeMsgpack provides custom msgpack encoder.
267293func (opts OperationObjectManyOpts ) EncodeMsgpack (enc * msgpack.Encoder ) error {
268- const optsCnt = 6
294+ const optsCnt = 7
269295
270296 names := [optsCnt ]string {timeoutOptName , vshardRouterOptName ,
271297 fieldsOptName , stopOnErrorOptName , rollbackOnErrorOptName ,
272- skipNullabilityCheckOnFlattenOptName }
298+ fetchLatestMetadataOptName }
273299 values := [optsCnt ]interface {}{}
274300 exists := [optsCnt ]bool {}
275301 values [0 ], exists [0 ] = opts .Timeout .Get ()
@@ -278,6 +304,7 @@ func (opts OperationObjectManyOpts) EncodeMsgpack(enc *msgpack.Encoder) error {
278304 values [3 ], exists [3 ] = opts .StopOnError .Get ()
279305 values [4 ], exists [4 ] = opts .RollbackOnError .Get ()
280306 values [5 ], exists [5 ] = opts .SkipNullabilityCheckOnFlatten .Get ()
307+ values [6 ], exists [6 ] = opts .FetchLatestMetadata .Get ()
281308
282309 return encodeOptions (enc , names [:], values [:], exists [:])
283310}
@@ -292,18 +319,25 @@ type BorderOpts struct {
292319 VshardRouter OptString
293320 // Fields is field names for getting only a subset of fields.
294321 Fields OptTuple
322+ // FetchLatestMetadata guarantees the up-to-date metadata (space format)
323+ // in first return value, otherwise it may not take into account
324+ // the latest migration of the data format. Performance overhead is up to 15%.
325+ // Disabled by default.
326+ FetchLatestMetadata OptBool
295327}
296328
297329// EncodeMsgpack provides custom msgpack encoder.
298330func (opts BorderOpts ) EncodeMsgpack (enc * msgpack.Encoder ) error {
299- const optsCnt = 3
331+ const optsCnt = 4
300332
301- names := [optsCnt ]string {timeoutOptName , vshardRouterOptName , fieldsOptName }
333+ names := [optsCnt ]string {timeoutOptName , vshardRouterOptName , fieldsOptName ,
334+ fetchLatestMetadataOptName }
302335 values := [optsCnt ]interface {}{}
303336 exists := [optsCnt ]bool {}
304337 values [0 ], exists [0 ] = opts .Timeout .Get ()
305338 values [1 ], exists [1 ] = opts .VshardRouter .Get ()
306339 values [2 ], exists [2 ] = opts .Fields .Get ()
340+ values [3 ], exists [3 ] = opts .FetchLatestMetadata .Get ()
307341
308342 return encodeOptions (enc , names [:], values [:], exists [:])
309343}
0 commit comments