Update logging and check macros. (#1627)

* Update logging and check macros.

* Fix linting.

* Fix RAY_DCHECK and unused variable.

* Fix linting
This commit is contained in:
Robert Nishihara
2018-02-28 15:13:00 -08:00
committed by Philipp Moritz
parent e7df293946
commit 0fcceef772
29 changed files with 721 additions and 774 deletions
+80 -86
View File
@@ -74,8 +74,8 @@ int handle_sigpipe(plasma::Status s, int fd) {
} break;
default:
/* This code should be unreachable. */
CHECK(0);
LOG_FATAL("Failed to write message to client on fd %d", fd);
RAY_CHECK(0);
RAY_LOG(FATAL) << "Failed to write message to client on fd " << fd;
}
return err;
@@ -320,12 +320,12 @@ bool ClientConnection_request_finished(ClientConnection *client_conn) {
std::unordered_map<ObjectID, std::vector<WaitRequest *>, UniqueIDHasher> &
object_wait_requests_from_type(PlasmaManagerState *manager_state, int type) {
/* We use different types of hash tables for different requests. */
RAY_CHECK(type == plasma::PLASMA_QUERY_LOCAL ||
type == plasma::PLASMA_QUERY_ANYWHERE);
if (type == plasma::PLASMA_QUERY_LOCAL) {
return manager_state->object_wait_requests_local;
} else if (type == plasma::PLASMA_QUERY_ANYWHERE) {
return manager_state->object_wait_requests_remote;
} else {
LOG_FATAL("This code should be unreachable.");
return manager_state->object_wait_requests_remote;
}
}
@@ -367,8 +367,8 @@ void remove_wait_request_for_object(PlasmaManagerState *manager_state,
void remove_wait_request(PlasmaManagerState *manager_state,
WaitRequest *wait_req) {
if (wait_req->timer != -1) {
CHECK(event_loop_remove_timer(manager_state->loop, wait_req->timer) ==
AE_OK);
RAY_CHECK(event_loop_remove_timer(manager_state->loop, wait_req->timer) ==
AE_OK);
}
delete wait_req;
}
@@ -416,9 +416,9 @@ void update_object_wait_requests(PlasmaManagerState *manager_state,
auto object_request =
wait_req->object_requests.find(obj_id.to_plasma_id());
/* Check that we found the object. */
CHECK(object_request != wait_req->object_requests.end());
RAY_CHECK(object_request != wait_req->object_requests.end());
/* Check that the object found was not previously known to us. */
CHECK(object_request->second.status == ObjectStatus_Nonexistent);
RAY_CHECK(object_request->second.status == ObjectStatus_Nonexistent);
/* Update the found object's status to a known status. */
object_request->second.status = status;
@@ -431,7 +431,7 @@ void update_object_wait_requests(PlasmaManagerState *manager_state,
index += 1;
}
}
DCHECK(static_cast<size_t>(index) == wait_requests.size());
RAY_CHECK(static_cast<size_t>(index) == wait_requests.size());
/* Remove the array of wait requests for this object, since no one should be
* waiting for this object anymore. */
object_wait_requests.erase(object_wait_requests_it);
@@ -491,7 +491,7 @@ PlasmaManagerState *PlasmaManagerState_init(const char *store_socket_name,
RAY_CHECK_OK(state->gcs_client.context()->AttachToEventLoop(state->loop));
} else {
state->db = NULL;
LOG_DEBUG("No db connection specified");
RAY_LOG(DEBUG) << "No db connection specified";
}
state->addr = manager_addr;
state->port = manager_port;
@@ -572,14 +572,14 @@ int write_object_chunk(ClientConnection *conn, PlasmaRequestBuffer *buf) {
int err;
if (r <= 0) {
LOG_ERROR("Write error");
RAY_LOG(ERROR) << "Write error";
err = errno;
} else {
conn->cursor += r;
CHECK(conn->cursor <= buf->data_size + buf->metadata_size);
RAY_CHECK(conn->cursor <= buf->data_size + buf->metadata_size);
/* If we've finished writing this buffer, reset the cursor. */
if (conn->cursor == buf->data_size + buf->metadata_size) {
LOG_DEBUG("writing on channel %d finished", conn->fd);
RAY_LOG(DEBUG) << "writing on channel " << conn->fd << " finished";
ClientConnection_finish_request(conn);
}
err = 0;
@@ -612,7 +612,7 @@ void send_queued_request(event_loop *loop,
conn->fd);
break;
case MessageType_PlasmaDataReply:
LOG_DEBUG("Transferring object to manager");
RAY_LOG(DEBUG) << "Transferring object to manager";
if (ClientConnection_request_finished(conn)) {
/* If the cursor is not set, we haven't sent any requests for this object
* yet, so send the initial data request. */
@@ -627,7 +627,7 @@ void send_queued_request(event_loop *loop,
}
break;
default:
LOG_FATAL("Buffered request has unknown type.");
RAY_LOG(FATAL) << "Buffered request has unknown type.";
}
/* If the other side hung up, stop sending to this manager. */
@@ -658,7 +658,7 @@ void send_queued_request(event_loop *loop,
int read_object_chunk(ClientConnection *conn, PlasmaRequestBuffer *buf) {
ssize_t r, s;
CHECK(buf != NULL);
RAY_CHECK(buf != NULL);
/* Try to read one buf_size at a time. */
s = buf->data_size + buf->metadata_size - conn->cursor;
if (s > RayConfig::instance().buf_size()) {
@@ -668,11 +668,11 @@ int read_object_chunk(ClientConnection *conn, PlasmaRequestBuffer *buf) {
int err;
if (r <= 0) {
LOG_ERROR("Read error");
RAY_LOG(ERROR) << "Read error";
err = errno;
} else {
conn->cursor += r;
CHECK(conn->cursor <= buf->data_size + buf->metadata_size);
RAY_CHECK(conn->cursor <= buf->data_size + buf->metadata_size);
/* If the cursor is equal to the full object size, reset the cursor and
* we're done. */
if (conn->cursor == buf->data_size + buf->metadata_size) {
@@ -709,7 +709,7 @@ void process_data_chunk(event_loop *loop,
/* If we're done receiving the object, seal the object and release it. The
* release corresponds to the call to plasma_create that occurred in
* process_data_request. */
LOG_DEBUG("reading on channel %d finished", data_sock);
RAY_LOG(DEBUG) << "reading on channel " << data_sock << " finished";
/* The following seal also triggers notification of clients for fetch or
* wait requests, see process_object_notification. */
ARROW_CHECK_OK(plasma_conn->Seal(buf->object_id.to_plasma_id()));
@@ -805,9 +805,8 @@ void process_transfer_request(event_loop *loop,
/* If the object wasn't locally available, exit immediately. If the object
* later appears locally, the requesting plasma manager should request the
* transfer again. */
LOG_WARN(
"Unable to transfer object to requesting plasma manager, object not "
"local.");
RAY_LOG(WARNING) << "Unable to transfer object to requesting plasma "
<< "manager, object not local.";
return;
}
@@ -822,8 +821,8 @@ void process_transfer_request(event_loop *loop,
}
}
CHECK(object_buffer.metadata->data() ==
object_buffer.data->data() + object_buffer.data_size);
RAY_CHECK(object_buffer.metadata->data() ==
object_buffer.data->data() + object_buffer.data_size);
PlasmaRequestBuffer *buf = new PlasmaRequestBuffer();
buf->type = MessageType_PlasmaDataReply;
buf->object_id = obj_id;
@@ -875,7 +874,7 @@ void process_data_request(event_loop *loop,
* conn->transfer_queue. */
conn->transfer_queue.push_back(buf);
}
CHECK(ClientConnection_request_finished(conn));
RAY_CHECK(ClientConnection_request_finished(conn));
ClientConnection_start_request(conn);
/* Switch to reading the data from this socket, instead of listening for
@@ -912,10 +911,10 @@ void process_data_request(event_loop *loop,
void request_transfer_from(PlasmaManagerState *manager_state,
FetchRequest *fetch_req) {
CHECK(fetch_req->manager_vector.size() > 0);
CHECK(fetch_req->next_manager >= 0 &&
static_cast<size_t>(fetch_req->next_manager) <
fetch_req->manager_vector.size());
RAY_CHECK(fetch_req->manager_vector.size() > 0);
RAY_CHECK(fetch_req->next_manager >= 0 &&
static_cast<size_t>(fetch_req->next_manager) <
fetch_req->manager_vector.size());
char addr[16];
int port;
parse_ip_addr_port(fetch_req->manager_vector[fetch_req->next_manager].c_str(),
@@ -931,8 +930,8 @@ void request_transfer_from(PlasmaManagerState *manager_state,
&temp_addr[2], &temp_addr[3]);
if (memcmp(temp_addr, manager_state->addr, 4) == 0 &&
port == manager_state->port) {
LOG_FATAL(
"This manager is attempting to request a transfer from itself.");
RAY_LOG(FATAL) << "This manager is attempting to request a transfer from "
<< "itself.";
}
PlasmaRequestBuffer *transfer_request = new PlasmaRequestBuffer();
@@ -975,12 +974,12 @@ int fetch_timeout_handler(event_loop *loop, timer_id id, void *context) {
if (is_receiving_or_received(manager_state, fetch_req->object_id)) {
// Do nothing if the object transfer is in progress or if the object
// has already been received.
LOG_DEBUG("fetch_timeout_handler: Object in progress or received. %s",
fetch_req->object_id.hex().c_str());
RAY_LOG(DEBUG) << "fetch_timeout_handler: Object in progress or "
<< "received. " << fetch_req->object_id;
continue;
}
LOG_DEBUG("fetch_timeout_handler: Object missing. %s",
fetch_req->object_id.hex().c_str());
RAY_LOG(DEBUG) << "fetch_timeout_handler: Object missing. "
<< fetch_req->object_id;
request_transfer_from(manager_state, fetch_req);
/* If we've tried all of the managers that we know about for this object,
* add this object to the list to resend requests for. */
@@ -1018,13 +1017,13 @@ void request_transfer(ObjectID object_id,
PlasmaManagerState *manager_state = (PlasmaManagerState *) context;
/* This callback is called from object_table_subscribe, which guarantees that
* the manager vector contains at least one element. */
CHECK(manager_vector.size() >= 1);
RAY_CHECK(manager_vector.size() >= 1);
auto it = manager_state->fetch_requests.find(object_id);
if (is_object_local(manager_state, object_id)) {
/* If the object is already here, then the fetch request should have been
* removed. */
CHECK(it == manager_state->fetch_requests.end());
RAY_CHECK(it == manager_state->fetch_requests.end());
return;
}
FetchRequest *fetch_req = it->second;
@@ -1033,7 +1032,7 @@ void request_transfer(ObjectID object_id,
* TODO(rkn): We actually have to remove this check to handle the rare
* scenario where the object is transferred here and then evicted before this
* callback gets called. */
CHECK(fetch_req != NULL);
RAY_CHECK(fetch_req != NULL);
/* Update the manager vector. */
fetch_req->manager_vector = manager_vector;
@@ -1055,7 +1054,7 @@ void call_request_transfer(ObjectID object_id,
PlasmaManagerState *manager_state = (PlasmaManagerState *) context;
/* Check that there isn't already a fetch request for this object. */
auto it = manager_state->fetch_requests.find(object_id);
CHECK(it == manager_state->fetch_requests.end());
RAY_CHECK(it == manager_state->fetch_requests.end());
/* Create a fetch request. */
FetchRequest *fetch_req = create_fetch_request(manager_state, object_id);
manager_state->fetch_requests[object_id] = fetch_req;
@@ -1063,7 +1062,7 @@ void call_request_transfer(ObjectID object_id,
}
void fatal_table_callback(ObjectID id, void *user_context, void *user_data) {
CHECK(0);
RAY_CHECK(0);
}
/* This callback is used by both fetch and wait. Therefore, it may have to
@@ -1143,7 +1142,7 @@ void process_wait_request(ClientConnection *client_conn,
plasma::ObjectRequestMap &&object_requests,
uint64_t timeout_ms,
int num_ready_objects) {
CHECK(client_conn != NULL);
RAY_CHECK(client_conn != NULL);
PlasmaManagerState *manager_state = client_conn->manager_state;
int num_object_requests = object_requests.size();
@@ -1184,7 +1183,7 @@ void process_wait_request(ClientConnection *client_conn,
num_object_ids_to_request += 1;
} else {
/* This code should be unreachable. */
CHECK(0);
RAY_CHECK(0);
}
}
@@ -1255,7 +1254,7 @@ void object_table_lookup_fail_callback(ObjectID object_id,
void *user_data) {
/* Fail for now. Later, we may want to send a ObjectStatus_Nonexistent to the
* client. */
CHECK(0);
RAY_CHECK(0);
}
void process_status_request(ClientConnection *client_conn,
@@ -1299,7 +1298,7 @@ void process_delete_object_notification(PlasmaManagerState *state,
void log_object_hash_mismatch_error_task_callback(Task *task,
void *user_context) {
CHECK(task != NULL);
RAY_CHECK(task != NULL);
PlasmaManagerState *state = (PlasmaManagerState *) user_context;
TaskSpec *spec = Task_task_execution_spec(task)->Spec();
FunctionID function = TaskSpec_function(spec);
@@ -1314,7 +1313,7 @@ void log_object_hash_mismatch_error_result_callback(ObjectID object_id,
TaskID task_id,
bool is_put,
void *user_context) {
CHECK(!task_id.is_nil());
RAY_CHECK(!task_id.is_nil());
PlasmaManagerState *state = (PlasmaManagerState *) user_context;
/* Get the specification for the nondeterministic task. */
#if !RAY_USE_NEW_GCS
@@ -1391,8 +1390,8 @@ void process_object_notification(event_loop *loop,
uint8_t *notification = read_message_async(loop, client_sock);
if (notification == NULL) {
PlasmaManagerState_free(state);
LOG_FATAL(
"Lost connection to the plasma store, plasma manager is exiting!");
RAY_LOG(FATAL) << "Lost connection to the plasma store, plasma manager is "
<< "exiting!";
}
auto object_info = flatbuffers::GetRoot<ObjectInfo>(notification);
/* Add object to locally available object. */
@@ -1437,7 +1436,7 @@ ClientConnection *ClientConnection_listen(event_loop *loop,
ClientConnection *conn = ClientConnection_init(state, new_socket, client_key);
event_loop_add_file(loop, new_socket, EVENT_LOOP_READ, process_message, conn);
LOG_DEBUG("New client connection with fd %d", new_socket);
RAY_LOG(DEBUG) << "New client connection with fd " << new_socket;
return conn;
}
@@ -1483,7 +1482,7 @@ void process_message(event_loop *loop,
switch (type) {
case MessageType_PlasmaDataRequest: {
LOG_DEBUG("Processing data request");
RAY_LOG(DEBUG) << "Processing data request";
plasma::ObjectID object_id;
char *address;
int port;
@@ -1493,7 +1492,7 @@ void process_message(event_loop *loop,
free(address);
} break;
case MessageType_PlasmaDataReply: {
LOG_DEBUG("Processing data reply");
RAY_LOG(DEBUG) << "Processing data reply";
plasma::ObjectID object_id;
int64_t object_size;
int64_t metadata_size;
@@ -1503,7 +1502,7 @@ void process_message(event_loop *loop,
metadata_size, conn);
} break;
case MessageType_PlasmaFetchRequest: {
LOG_DEBUG("Processing fetch remote");
RAY_LOG(DEBUG) << "Processing fetch remote";
std::vector<plasma::ObjectID> object_ids_to_fetch;
/* TODO(pcm): process_fetch_requests allocates an array of num_objects
* object_ids too so these should be shared in the future. */
@@ -1512,7 +1511,7 @@ void process_message(event_loop *loop,
object_ids_to_fetch.data());
} break;
case MessageType_PlasmaWaitRequest: {
LOG_DEBUG("Processing wait");
RAY_LOG(DEBUG) << "Processing wait";
plasma::ObjectRequestMap object_requests;
int64_t timeout_ms;
int num_ready_objects;
@@ -1522,18 +1521,18 @@ void process_message(event_loop *loop,
num_ready_objects);
} break;
case MessageType_PlasmaStatusRequest: {
LOG_DEBUG("Processing status");
RAY_LOG(DEBUG) << "Processing status";
plasma::ObjectID object_id;
ARROW_CHECK_OK(plasma::ReadStatusRequest(data, length, &object_id, 1));
process_status_request(conn, object_id);
} break;
case DISCONNECT_CLIENT: {
LOG_DEBUG("Disconnecting client on fd %d", client_sock);
RAY_LOG(DEBUG) << "Disconnecting client on fd " << client_sock;
event_loop_remove_file(loop, client_sock);
ClientConnection_free(conn);
} break;
default:
LOG_FATAL("invalid request %" PRId64, type);
RAY_LOG(FATAL) << "invalid request " << type;
}
free(data);
@@ -1541,9 +1540,8 @@ void process_message(event_loop *loop,
int64_t end_time = current_time_ms();
if (end_time - start_time >
RayConfig::instance().max_time_for_handler_milliseconds()) {
LOG_WARN("process_message of type %" PRId64 " took %" PRId64
" milliseconds.",
type, end_time - start_time);
RAY_LOG(WARNING) << "process_message of type " << type << " took "
<< end_time - start_time << " milliseconds.";
}
}
@@ -1552,12 +1550,13 @@ int heartbeat_handler(event_loop *loop, timer_id id, void *context) {
/* Check that the last heartbeat was not sent too long ago. */
int64_t current_time = current_time_ms();
CHECK(current_time >= state->previous_heartbeat_time);
RAY_CHECK(current_time >= state->previous_heartbeat_time);
if (current_time - state->previous_heartbeat_time >
RayConfig::instance().num_heartbeats_timeout() *
RayConfig::instance().heartbeat_timeout_milliseconds()) {
LOG_FATAL("The last heartbeat was sent %" PRId64 " milliseconds ago.",
current_time - state->previous_heartbeat_time);
RAY_LOG(FATAL) << "The last heartbeat was sent "
<< current_time - state->previous_heartbeat_time
<< " milliseconds ago.";
}
state->previous_heartbeat_time = current_time;
@@ -1583,18 +1582,18 @@ void start_server(const char *store_socket_name,
}
int local_sock = bind_ipc_sock(manager_socket_name, false);
CHECKM(local_sock >= 0, "Unable to bind local manager socket");
RAY_CHECK(local_sock >= 0) << "Unable to bind local manager socket";
g_manager_state = PlasmaManagerState_init(
store_socket_name, manager_socket_name, master_addr, port,
redis_primary_addr, redis_primary_port);
CHECK(g_manager_state);
RAY_CHECK(g_manager_state);
CHECK(listen(remote_sock, 128) != -1);
CHECK(listen(local_sock, 128) != -1);
RAY_CHECK(listen(remote_sock, 128) != -1);
RAY_CHECK(listen(local_sock, 128) != -1);
LOG_DEBUG("Started server connected to store %s, listening on port %d",
store_socket_name, port);
RAY_LOG(DEBUG) << "Started server connected to store " << store_socket_name
<< ", listening on port " << port;
event_loop_add_file(g_manager_state->loop, local_sock, EVENT_LOOP_READ,
handle_new_client, g_manager_state);
event_loop_add_file(g_manager_state->loop, remote_sock, EVENT_LOOP_READ,
@@ -1619,7 +1618,7 @@ void start_server(const char *store_socket_name,
/* Report "success" to valgrind. */
void signal_handler(int signal) {
LOG_DEBUG("Signal was %d", signal);
RAY_LOG(DEBUG) << "Signal was " << signal;
if (signal == SIGTERM) {
if (g_manager_state) {
PlasmaManagerState_free(g_manager_state);
@@ -1662,37 +1661,32 @@ int main(int argc, char *argv[]) {
redis_primary_addr_port = optarg;
break;
default:
LOG_FATAL("unknown option %c", c);
RAY_LOG(FATAL) << "unknown option " << c;
}
}
if (!store_socket_name) {
LOG_FATAL(
"please specify socket for connecting to the plasma store with -s "
"switch");
RAY_LOG(FATAL) << "please specify socket for connecting to the plasma "
<< "store with -s switch";
}
if (!manager_socket_name) {
LOG_FATAL(
"please specify socket name of the manager's local socket with -m "
"switch");
RAY_LOG(FATAL) << "please specify socket name of the manager's local "
<< "socket with -m switch";
}
if (!master_addr) {
LOG_FATAL(
"please specify ip address of the current host in the format "
"123.456.789.10 with -h switch");
RAY_LOG(FATAL) << "please specify ip address of the current host in the "
<< "format 123.456.789.10 with -h switch";
}
if (port == -1) {
LOG_FATAL(
"please specify port the plasma manager shall listen to in the"
"format 12345 with -p switch");
RAY_LOG(FATAL) << "please specify port the plasma manager shall listen to "
<< "in the format 12345 with -p switch";
}
char redis_primary_addr[16];
int redis_primary_port;
int redis_primary_port = -1;
if (!redis_primary_addr_port ||
parse_ip_addr_port(redis_primary_addr_port, redis_primary_addr,
&redis_primary_port) == -1) {
LOG_FATAL(
"specify the primary redis address like 127.0.0.1:6379 with the -r "
"switch");
RAY_LOG(FATAL) << "specify the primary redis address like 127.0.0.1:6379 "
<< "with the -r switch";
}
start_server(store_socket_name, manager_socket_name, master_addr, port,
redis_primary_addr, redis_primary_port);
+27 -27
View File
@@ -22,8 +22,8 @@ Status PlasmaReceive(int sock,
std::vector<uint8_t> &buffer) {
int64_t type;
RETURN_NOT_OK(ReadMessage(sock, &type, buffer));
ARROW_CHECK(type == message_type) << "type = " << type
<< ", message_type = " << message_type;
RAY_CHECK(type == message_type) << "type = " << type
<< ", message_type = " << message_type;
return Status::OK();
}
@@ -45,7 +45,7 @@ Status ReadCreateRequest(uint8_t *data,
ObjectID *object_id,
int64_t *data_size,
int64_t *metadata_size) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaCreateRequest>(data);
*data_size = message->data_size();
*metadata_size = message->metadata_size();
@@ -72,7 +72,7 @@ Status SendCreateReply(int sock,
Status ReadCreateReply(uint8_t *data,
ObjectID *object_id,
PlasmaObject *object) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaCreateReply>(data);
*object_id = ObjectID::from_binary(message->object_id()->str());
object->handle.store_fd = message->plasma_object()->segment_index();
@@ -99,10 +99,10 @@ Status SendSealRequest(int sock, ObjectID object_id, unsigned char *digest) {
Status ReadSealRequest(uint8_t *data,
ObjectID *object_id,
unsigned char *digest) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaSealRequest>(data);
*object_id = ObjectID::from_binary(message->object_id()->str());
ARROW_CHECK(message->digest()->size() == kDigestSize);
RAY_CHECK(message->digest()->size() == kDigestSize);
memcpy(digest, message->digest()->data(), kDigestSize);
return Status::OK();
}
@@ -117,7 +117,7 @@ Status SendSealReply(int sock, ObjectID object_id, int error) {
}
Status ReadSealReply(uint8_t *data, ObjectID *object_id) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaSealReply>(data);
*object_id = ObjectID::from_binary(message->object_id()->str());
return plasma_error_status(message->error());
@@ -135,7 +135,7 @@ Status SendReleaseRequest(int sock, ObjectID object_id) {
}
Status ReadReleaseRequest(uint8_t *data, ObjectID *object_id) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaReleaseRequest>(data);
*object_id = ObjectID::from_binary(message->object_id()->str());
return Status::OK();
@@ -151,7 +151,7 @@ Status SendReleaseReply(int sock, ObjectID object_id, int error) {
}
Status ReadReleaseReply(uint8_t *data, ObjectID *object_id) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaReleaseReply>(data);
*object_id = ObjectID::from_binary(message->object_id()->str());
return plasma_error_status(message->error());
@@ -169,7 +169,7 @@ Status SendDeleteRequest(int sock, ObjectID object_id) {
}
Status ReadDeleteRequest(uint8_t *data, ObjectID *object_id) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaReleaseReply>(data);
*object_id = ObjectID::from_binary(message->object_id()->str());
return Status::OK();
@@ -185,7 +185,7 @@ Status SendDeleteReply(int sock, ObjectID object_id, int error) {
}
Status ReadDeleteReply(uint8_t *data, ObjectID *object_id) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaDeleteReply>(data);
*object_id = ObjectID::from_binary(message->object_id()->str());
return plasma_error_status(message->error());
@@ -205,7 +205,7 @@ Status SendStatusRequest(int sock, ObjectID object_ids[], int64_t num_objects) {
Status ReadStatusRequest(uint8_t *data,
ObjectID object_ids[],
int64_t num_objects) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaStatusRequest>(data);
for (int64_t i = 0; i < num_objects; ++i) {
object_ids[i] = ObjectID::from_binary(message->object_ids()->Get(i)->str());
@@ -227,7 +227,7 @@ Status SendStatusReply(int sock,
}
int64_t ReadStatusReply_num_objects(uint8_t *data) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaStatusReply>(data);
return message->object_ids()->size();
}
@@ -236,7 +236,7 @@ Status ReadStatusReply(uint8_t *data,
ObjectID object_ids[],
int object_status[],
int64_t num_objects) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaStatusReply>(data);
for (int64_t i = 0; i < num_objects; ++i) {
object_ids[i] = ObjectID::from_binary(message->object_ids()->Get(i)->str());
@@ -259,7 +259,7 @@ Status SendContainsRequest(int sock, ObjectID object_id) {
}
Status ReadContainsRequest(uint8_t *data, ObjectID *object_id) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaContainsRequest>(data);
*object_id = ObjectID::from_binary(message->object_id()->str());
return Status::OK();
@@ -275,7 +275,7 @@ Status SendContainsReply(int sock, ObjectID object_id, int has_object) {
}
Status ReadContainsReply(uint8_t *data, ObjectID *object_id, int *has_object) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaContainsReply>(data);
*object_id = ObjectID::from_binary(message->object_id()->str());
*has_object = message->has_object();
@@ -305,7 +305,7 @@ Status SendConnectReply(int sock, int64_t memory_capacity) {
}
Status ReadConnectReply(uint8_t *data, int64_t *memory_capacity) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaConnectReply>(data);
*memory_capacity = message->memory_capacity();
return Status::OK();
@@ -322,7 +322,7 @@ Status SendEvictRequest(int sock, int64_t num_bytes) {
}
Status ReadEvictRequest(uint8_t *data, int64_t *num_bytes) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaEvictRequest>(data);
*num_bytes = message->num_bytes();
return Status::OK();
@@ -337,7 +337,7 @@ Status SendEvictReply(int sock, int64_t num_bytes) {
}
Status ReadEvictReply(uint8_t *data, int64_t &num_bytes) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaEvictReply>(data);
num_bytes = message->num_bytes();
return Status::OK();
@@ -360,7 +360,7 @@ Status SendGetRequest(int sock,
Status ReadGetRequest(uint8_t *data,
std::vector<ObjectID> &object_ids,
int64_t *timeout_ms) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaGetRequest>(data);
for (int64_t i = 0; i < message->object_ids()->size(); ++i) {
auto object_id = message->object_ids()->Get(i)->str();
@@ -396,7 +396,7 @@ Status ReadGetReply(uint8_t *data,
ObjectID object_ids[],
PlasmaObject plasma_objects[],
int64_t num_objects) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaGetReply>(data);
for (int64_t i = 0; i < num_objects; ++i) {
object_ids[i] = ObjectID::from_binary(message->object_ids()->Get(i)->str());
@@ -425,7 +425,7 @@ Status SendFetchRequest(int sock, ObjectID object_ids[], int64_t num_objects) {
}
Status ReadFetchRequest(uint8_t *data, std::vector<ObjectID> &object_ids) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaFetchRequest>(data);
for (int64_t i = 0; i < message->object_ids()->size(); ++i) {
object_ids.push_back(
@@ -462,7 +462,7 @@ Status ReadWaitRequest(uint8_t *data,
ObjectRequestMap &object_requests,
int64_t *timeout_ms,
int *num_ready_objects) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaWaitRequest>(data);
*num_ready_objects = message->num_ready_objects();
*timeout_ms = message->timeout();
@@ -502,7 +502,7 @@ Status SendWaitReply(int sock,
Status ReadWaitReply(uint8_t *data,
ObjectRequest object_requests[],
int *num_ready_objects) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaWaitReply>(data);
*num_ready_objects = message->num_ready_objects();
@@ -543,9 +543,9 @@ Status ReadDataRequest(uint8_t *data,
ObjectID *object_id,
char **address,
int *port) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaDataRequest>(data);
DCHECK(message->object_id()->size() == sizeof(ObjectID));
RAY_DCHECK(message->object_id()->size() == sizeof(ObjectID));
*object_id = ObjectID::from_binary(message->object_id()->str());
*address = strdup(message->address()->c_str());
*port = message->port();
@@ -568,7 +568,7 @@ Status ReadDataReply(uint8_t *data,
ObjectID *object_id,
int64_t *object_size,
int64_t *metadata_size) {
DCHECK(data);
RAY_DCHECK(data);
auto message = flatbuffers::GetRoot<PlasmaDataReply>(data);
*object_id = ObjectID::from_binary(message->object_id()->str());
*object_size = (int64_t) message->object_size();
+3 -3
View File
@@ -31,7 +31,7 @@ void wait_for_pollin(int fd) {
poll_list[0].fd = fd;
poll_list[0].events = POLLIN;
int retval = poll(poll_list, (unsigned long) 1, -1);
CHECK(retval > 0);
RAY_CHECK(retval > 0);
}
int test_done_handler(event_loop *loop, timer_id id, void *context) {
@@ -66,7 +66,7 @@ plasma_mock *init_plasma_mock(plasma_mock *remote_mock) {
std::string manager_socket_name = bind_ipc_sock_retry(
plasma_manager_socket_name_format, &mock->manager_local_fd);
CHECK(mock->manager_local_fd >= 0 && mock->local_store >= 0);
RAY_CHECK(mock->manager_local_fd >= 0 && mock->local_store >= 0);
mock->state = PlasmaManagerState_init(plasma_store_socket_name,
manager_socket_name.c_str(),
@@ -252,7 +252,7 @@ TEST object_notifications_test(void) {
int fd[2];
socketpair(AF_UNIX, SOCK_STREAM, 0, fd);
int flags = fcntl(fd[1], F_GETFL, 0);
CHECK(fcntl(fd[1], F_SETFL, flags | O_NONBLOCK) == 0);
RAY_CHECK(fcntl(fd[1], F_SETFL, flags | O_NONBLOCK) == 0);
ObjectID object_id = ObjectID::from_random();
ObjectInfoT info;