Warn the user when a nondeterministic task is detected. (#339)

* WARN instead of FATAL for object hash mismatches, push error to driver

* Document the callback signature for object_table_add/remove

* Error table

* Wait for all errors in python test

* Fix doc

* Fix state test
This commit is contained in:
Stephanie Wang
2017-03-07 00:32:15 -08:00
committed by Robert Nishihara
parent 0b8d279ef2
commit da06b4db82
15 changed files with 303 additions and 78 deletions
+50
View File
@@ -0,0 +1,50 @@
#ifndef ERROR_TABLE_H
#define ERROR_TABLE_H
#include "db.h"
#include "table.h"
typedef struct {
DBClientID driver_id;
unsigned char error_key[20];
int error_index;
size_t data_length;
unsigned char data[0];
} ErrorInfo;
/** An error_index may be used as an index into error_types and
* error_messages. */
typedef enum {
/** An object was added with a different hash from the existing
* one. */
OBJECT_HASH_MISMATCH_ERROR_INDEX = 0,
/** The total number of error types. */
MAX_ERROR_INDEX
} error_index;
/** Information about the error to be displayed to the user. */
static const char *error_types[] = {"object_hash_mismatch"};
static const char *error_messages[] = {
"A nondeterministic task was reexecuted."};
/**
* Push an error to the given Python driver.
*
* @param db_handle Database handle.
* @param driver_id The ID of the Python driver to push the error
* to.
* @param error_index The error information at this index in
* error_types and error_messages will be included in the
* error pushed to the driver.
* @param data_length The length of the custom data to be included
* in the error.
* @param data The custom data to be included in the error.
* @return Void.
*/
void push_error(DBHandle *db_handle,
DBClientID driver_id,
int error_index,
size_t data_length,
unsigned char *data);
#endif