MCPcopy Create free account
hub / github.com/documentdb/documentdb / PostProcessDeleteBatchSpec

Function PostProcessDeleteBatchSpec

pg_documentdb/src/commands/delete.c:436–460  ·  view source on GitHub ↗

* Given a lazily initialized BatchDeletionSpec processes it into the * List of deleteSpecs needed for processing the deletes. */

Source from the content-addressed store, hash-verified

434 * List of deleteSpecs needed for processing the deletes.
435 */
436static void
437PostProcessDeleteBatchSpec(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/*

Callers 2

command_deleteFunction · 0.85
ProcessBatchDeletionFunction · 0.85

Calls 3

BsonValueInitIteratorFunction · 0.85
BuildDeletionSpecListFunction · 0.85

Tested by

no test coverage detected