Merge task table and task log into a single table (#30)

* Merge task table and task log

* Fix test in db tests

* Address Robert's comments and some better error checking

* Add a LOG_FATAL that exits the program
This commit is contained in:
Stephanie Wang
2016-11-10 18:13:26 -08:00
committed by Philipp Moritz
parent 194bdb1d96
commit 9d1e750e8f
30 changed files with 1578 additions and 842 deletions
+2 -4
View File
@@ -127,8 +127,7 @@ uint8_t *lookup_or_mmap(plasma_connection *conn,
uint8_t *result =
mmap(NULL, map_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (result == MAP_FAILED) {
LOG_ERR("mmap failed");
exit(-1);
LOG_FATAL("mmap failed");
}
close(fd);
entry = malloc(sizeof(client_mmap_table_entry));
@@ -369,8 +368,7 @@ int socket_connect_retry(const char *socket_name,
}
/* If we could not connect to the socket, exit. */
if (fd == -1) {
LOG_ERR("could not connect to socket %s", socket_name);
exit(-1);
LOG_FATAL("could not connect to socket %s", socket_name);
}
return fd;
}
+10 -15
View File
@@ -328,8 +328,9 @@ void write_object_chunk(client_connection *conn, plasma_request_buffer *buf) {
if (r > 0) {
LOG_ERR("partial write on fd %d", conn->fd);
} else {
LOG_ERR("write error");
exit(-1);
/* TODO(swang): This should not be a fatal error, since connections can
* close at any time. */
LOG_FATAL("write error");
}
} else {
conn->cursor += r;
@@ -381,7 +382,7 @@ void send_queued_request(event_loop *loop,
write_object_chunk(conn, buf);
break;
default:
LOG_ERR("Buffered request has unknown type.");
LOG_FATAL("Buffered request has unknown type.");
}
/* We are done sending this request. */
@@ -859,8 +860,7 @@ void process_message(event_loop *loop,
free(conn);
} break;
default:
LOG_ERR("invalid request %" PRId64, type);
exit(-1);
LOG_FATAL("invalid request %" PRId64, type);
}
free(req);
@@ -975,33 +975,28 @@ int main(int argc, char *argv[]) {
db_host = optarg;
break;
default:
LOG_ERR("unknown option %c", c);
exit(-1);
LOG_FATAL("unknown option %c", c);
}
}
if (!store_socket_name) {
LOG_ERR(
LOG_FATAL(
"please specify socket for connecting to the plasma store with -s "
"switch");
exit(-1);
}
if (!manager_socket_name) {
LOG_ERR(
LOG_FATAL(
"please specify socket name of the manager's local socket with -m "
"switch");
exit(-1);
}
if (!master_addr) {
LOG_ERR(
LOG_FATAL(
"please specify ip address of the current host in the format "
"123.456.789.10 with -h switch");
exit(-1);
}
if (port == -1) {
LOG_ERR(
LOG_FATAL(
"please specify port the plasma manager shall listen to in the"
"format 12345 with -p switch");
exit(-1);
}
char db_addr[16];
int db_port;
+3 -6
View File
@@ -42,8 +42,7 @@ void dlfree(void *);
void plasma_send_reply(int fd, plasma_reply *reply) {
int reply_count = sizeof(plasma_reply);
if (write(fd, reply, reply_count) != reply_count) {
LOG_ERR("write error, fd = %d", fd);
exit(-1);
LOG_FATAL("write error, fd = %d", fd);
}
}
@@ -557,12 +556,10 @@ int main(int argc, char *argv[]) {
}
}
if (!socket_name) {
LOG_ERR("please specify socket for incoming connections with -s switch");
exit(-1);
LOG_FATAL("please specify socket for incoming connections with -s switch");
}
if (system_memory == -1) {
LOG_ERR("please specify the amount of system memory with -m switch");
exit(-1);
LOG_FATAL("please specify the amount of system memory with -m switch");
}
LOG_DEBUG("starting server listening on %s", socket_name);
start_server(socket_name, system_memory);