Skip to main content

UnacknowledgedWriteClassifier

Namespace: Meshmakers.Octo.Runtime.Contracts

Recognises an exception after which a write may or may not have taken effect: the database did not acknowledge it, but did not refuse it either. The one classification of such writes for every host (rule R3 of the method consistency model): the CK method host of octo-common-services answers METHOD_OUTCOME_UNKNOWN on it, and the pipeline hosts (mesh adapter, SDK adapters) report it as the structured failure kind of the execution, so a pipeline method answers alike.

public static class UnacknowledgedWriteClassifier

Inheritance Object → UnacknowledgedWriteClassifier

Remarks:

Recognised, anywhere in the chain of inner exceptions (the persistence layer wraps driver exceptions, e.g. into OperationFailedException), and in every inner exception of an AggregateException:

a write-concern error of MongoDB: MongoWriteConcernException (commands, transaction commit) - except its subclass MongoDuplicateKeyException, a refused write -, MongoWriteException / MongoBulkWriteException that carry a WriteConcernError, and ClientBulkWriteException with a non-empty WriteConcernErrors list (IMongoClient.BulkWrite). The repositories write with w:majority and a wtimeout; a write-concern error (the timeout, code 64, or any other) does not undo the write on the primary, it is only not confirmed by a majority;

a MongoDB exception with the error label UnknownTransactionCommitResult (the driver sets it when a commit may have succeeded on the server: write-concern error, network error or timeout during the commit).

Everything else - including a write error without a write-concern error (the write was refused) - is not unknown: the caller reports an ordinary failure.

This assembly deliberately does not reference the MongoDB driver (neither do the SDKs and the CK method host that call it), so the driver types are recognised by their full names and the public members WriteConcernError and ErrorLabels. The tests build the real driver exceptions, so a rename in a driver update turns them red.

Fields​

UnknownTransactionCommitResultLabel​

The driver's label for a commit whose result is unknown.

public static string UnknownTransactionCommitResultLabel;

Methods​

IsOutcomeUnknown(Exception)​

true when exception (or an exception it wraps) says that a write may have taken effect without being acknowledged.

public static bool IsOutcomeUnknown(Exception exception)

Parameters​

exception Exception
The exception to classify; null is never unknown.

Returns​

Boolean