2017-03-07 00:32:15 -08:00
|
|
|
#include "error_table.h"
|
|
|
|
#include "redis.h"
|
|
|
|
|
2017-10-12 21:00:23 -07:00
|
|
|
const char *error_types[] = {"object_hash_mismatch", "put_reconstruction",
|
2018-03-19 20:24:35 -07:00
|
|
|
"worker_died", "actor_not_created"};
|
2017-10-12 21:00:23 -07:00
|
|
|
|
2017-03-07 00:32:15 -08:00
|
|
|
void push_error(DBHandle *db_handle,
|
|
|
|
DBClientID driver_id,
|
2018-03-19 20:24:35 -07:00
|
|
|
int error_type,
|
|
|
|
const std::string &error_message) {
|
|
|
|
int64_t message_size = error_message.size();
|
|
|
|
|
2017-03-07 00:32:15 -08:00
|
|
|
/* Allocate a struct to hold the error information. */
|
2018-03-19 20:24:35 -07:00
|
|
|
ErrorInfo *info = (ErrorInfo *) malloc(sizeof(ErrorInfo) + message_size);
|
2017-03-07 00:32:15 -08:00
|
|
|
info->driver_id = driver_id;
|
2018-03-19 20:24:35 -07:00
|
|
|
info->error_type = error_type;
|
|
|
|
info->error_key = UniqueID::from_random();
|
|
|
|
info->size = message_size;
|
|
|
|
memcpy(info->error_message, error_message.data(), message_size);
|
2017-03-07 00:32:15 -08:00
|
|
|
|
2017-12-26 16:22:04 -08:00
|
|
|
init_table_callback(db_handle, UniqueID::nil(), __func__,
|
|
|
|
new CommonCallbackData(info), NULL, NULL,
|
|
|
|
redis_push_error, NULL);
|
2017-03-07 00:32:15 -08:00
|
|
|
}
|