Non-blocking fetch implementation. (#83)

* Non-blocking fetch implementation.

* Make fetch tests more robust to timing issues.

* Bug fix when ignoring transferred objects.

* Fix.

* Documentation fixes.
This commit is contained in:
Robert Nishihara
2016-12-03 19:09:05 -08:00
committed by Philipp Moritz
parent 9a513363f9
commit 2a3e9267f8
11 changed files with 392 additions and 24 deletions
+8 -2
View File
@@ -364,7 +364,10 @@ void redis_object_table_get_entry(redisAsyncContext *c,
int64_t manager_count = reply->elements;
if (reply->type == REDIS_REPLY_ARRAY) {
const char **manager_vector = malloc(manager_count * sizeof(char *));
const char **manager_vector = NULL;
if (manager_count > 0) {
manager_vector = malloc(manager_count * sizeof(char *));
}
for (int j = 0; j < reply->elements; ++j) {
CHECK(reply->element[j]->type == REDIS_REPLY_STRING);
memcpy(managers[j].id, reply->element[j]->str, sizeof(managers[j].id));
@@ -377,10 +380,13 @@ void redis_object_table_get_entry(redisAsyncContext *c,
callback_data->user_context);
/* remove timer */
destroy_timer_callback(callback_data->db_handle->loop, callback_data);
free(managers);
if (manager_count > 0) {
free(manager_vector);
}
} else {
LOG_FATAL("expected integer or string, received type %d", reply->type);
}
free(managers);
}
void redis_object_table_subscribe_lookup(redisAsyncContext *c,
-1
View File
@@ -47,7 +47,6 @@ void lookup_done_callback(object_id object_id,
received_port2) != 2) {
CHECK(0);
}
free(manager_vector);
}
/* Entry added to database successfully. */
-1
View File
@@ -290,7 +290,6 @@ void lookup_retry_done_callback(object_id object_id,
void *context) {
CHECK(context == (void *) lookup_retry_context);
lookup_retry_succeeded = 1;
free(manager_vector);
}
void lookup_retry_fail_callback(unique_id id,