* Given a lazily initialized BatchDeletionSpec processes it into the * List of deleteSpecs needed for processing the deletes. */
| 434 | * List of deleteSpecs needed for processing the deletes. |
| 435 | */ |
| 436 | static void |
| 437 | PostProcessDeleteBatchSpec(BatchDeletionSpec *spec) |
| 438 | { |
| 439 | if (spec->deletionValue.value_type != BSON_TYPE_EOD) |
| 440 | { |
| 441 | bson_iter_t deletionIter; |
| 442 | BsonValueInitIterator(&spec->deletionValue, &deletionIter); |
| 443 | spec->deletionsProcessed = BuildDeletionSpecList(&deletionIter, |
| 444 | &spec->variableSpec); |
| 445 | } |
| 446 | else |
| 447 | { |
| 448 | spec->deletionsProcessed = BuildDeletionSpecListFromSequence( |
| 449 | spec->deletionSequence, &spec->variableSpec); |
| 450 | } |
| 451 | |
| 452 | int deletionCount = list_length(spec->deletionsProcessed); |
| 453 | if (deletionCount == 0 || deletionCount > MaxWriteBatchSize) |
| 454 | { |
| 455 | ereport(ERROR, (errcode(ERRCODE_DOCUMENTDB_INVALIDLENGTH), |
| 456 | errmsg( |
| 457 | "Write batch size must fall within the range of 1 to %d, but %d operations were provided.", |
| 458 | MaxWriteBatchSize, deletionCount))); |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | |
| 463 | /* |
no test coverage detected