Table of Contents

Class BatchIncompleteException

Namespace
DynaSharp
Assembly
DynaSharp.dll

A batch write ended with writes left. A batch is not atomic, so the writes that were taken stay applied: Written says how many and UnprocessedItems holds the rest.

public sealed class BatchIncompleteException : DynamoDbException, ISerializable
Inheritance
BatchIncompleteException
Implements
Inherited Members

Remarks

This happens when a table stays throttled: requests in a row that get nothing done, or a request that fails with a throttling error on its last attempt. It also happens when any other failure ends the batch after a request went through, because the caller would otherwise lose what was done, and when the first request fails with a timeout, a lost connection or a server error after its last attempt. In those cases the failure, as it came, is the InnerException. DynamoDB may have applied part of a request that got no answer, so its writes count as unprocessed, and sending them again is safe. Any other failure of the first request, such as a ValidationException, applied nothing and surfaces as it is.

A caller who cancels gets an OperationCanceledException and no report of the progress, whatever was applied by then.

To go on, hand the rest to client.BatchWriteItemAsync of DynaSharp.Requests: new BatchWriteItemRequest { RequestItems = e.UnprocessedItems }. That API does not cut a batch into requests, so one that holds more than 25 writes must be split first. The writes hold the items, so do not log them.

Constructors

BatchIncompleteException(string, IReadOnlyDictionary<string, IReadOnlyList<WriteRequest>>, int, Exception?)

Initializes a new instance of the BatchIncompleteException class.

public BatchIncompleteException(string message, IReadOnlyDictionary<string, IReadOnlyList<WriteRequest>> unprocessedItems, int written, Exception? innerException = null)

Parameters

message string

The message.

unprocessedItems IReadOnlyDictionary<string, IReadOnlyList<WriteRequest>>

The writes that were not applied, by table.

written int

How many writes were applied.

innerException Exception

The failure that ended the batch, if any.

Exceptions

ArgumentNullException

unprocessedItems is null.

Fields

Code

The ErrorCode of the exception, which the client gives it: it is no code of the service. What the service said, if anything, is in the InnerException.

public const string Code = "BatchIncomplete"

Field Value

string

Properties

UnprocessedItems

Gets the writes that were not applied, by table, in the form client.BatchWriteItemAsync takes. It includes the requests the batch did not get to, and all of a request that got no answer: a timeout says nothing about what DynamoDB did, so some of those can be applied. Sending a put or a delete again is safe.

public IReadOnlyDictionary<string, IReadOnlyList<WriteRequest>> UnprocessedItems { get; }

Property Value

IReadOnlyDictionary<string, IReadOnlyList<WriteRequest>>

Written

Gets how many writes of the batch DynamoDB confirmed.

public int Written { get; }

Property Value

int