GitLab maintenance scheduled for Today, 2019-12-05, from 17:00 to 18:00 CT - Services will be unavailable during this time.

Commit e2e4d311 authored by Shane Snyder's avatar Shane Snyder

add a sequence id to segment keys

parent 56a13b9a
......@@ -41,13 +41,14 @@ static void read_op_exec_end(void*);
extern uint64_t mobject_compute_object_size(
sdskv_provider_handle_t ph,
sdskv_database_id_t seg_db_id,
oid_t oid, double ts);
oid_t oid, time_t ts);
static oid_t get_oid_from_name(
sdskv_provider_handle_t ph,
sdskv_database_id_t name_db_id,
const char* name);
#if 0
struct read_request_t {
double timestamp; // timestamp at which the segment was created
uint64_t absolute_start_index; // start index within the object
......@@ -57,6 +58,7 @@ struct read_request_t {
uint64_t client_offset; // offset within the client's buffer
bake_region_id_t region; // region id
};
#endif
static struct read_op_visitor read_op_exec = {
.visit_begin = read_op_exec_begin,
......@@ -103,7 +105,7 @@ void read_op_exec_stat(void* u, uint64_t* psize, time_t* pmtime, int* prval)
return;
}
double ts = ABT_get_wtime();
time_t ts = time(NULL);
*psize = mobject_compute_object_size(sdskv_ph, seg_db_id, oid, ts);
LEAVING;
......@@ -139,7 +141,8 @@ void read_op_exec_read(void* u, uint64_t offset, size_t len, buffer_u buf, size_
segment_key_t lb;
lb.oid = oid;
lb.timestamp = ABT_get_wtime();
lb.timestamp = time(NULL);
lb.seq_id = MOBJECT_SEQ_ID_MAX;
covermap<uint64_t> coverage(offset, offset+len);
......@@ -264,6 +267,7 @@ void read_op_exec_read(void* u, uint64_t offset, size_t len, buffer_u buf, size_
} // end switch
// update the start key timestamp to that of the last processed segment
lb.timestamp = seg.timestamp;
lb.seq_id = seg.seq_id;
} // end for
seg_start_ndx = 1;
......
This diff is collapsed.
......@@ -35,8 +35,10 @@ typedef enum seg_type_t {
typedef struct segment_key_t {
oid_t oid;
time_t timestamp;
//double timestamp;
uint32_t seq_id;
uint32_t type; /* seg_type */
double timestamp;
uint64_t start_index; // first index, included
uint64_t end_index; // end index is not included
} segment_key_t;
......
......@@ -85,10 +85,8 @@ static int seg_map_compare(const void* k1, size_t sk1, const void* k2, size_t sk
if(seg1->oid > seg2->oid) return 1;
if(seg1->timestamp > seg2->timestamp) return -1;
if(seg1->timestamp < seg2->timestamp) return 1;
if(seg1->start_index < seg2->start_index) return -1;
if(seg1->start_index > seg2->start_index) return 1;
if(seg1->end_index < seg2->end_index) return -1;
if(seg1->end_index > seg2->end_index) return 1;
if(seg1->seq_id > seg2->seq_id) return -1;
if(seg1->seq_id < seg2->seq_id) return 1;
return 0;
}
......
......@@ -16,12 +16,15 @@
extern "C" {
#endif
#define MOBJECT_SEQ_ID_MAX UINT32_MAX
struct mobject_server_context
{
/* margo, bake, sds-keyval, ssg state */
/* margo/ABT state */
margo_instance_id mid;
uint16_t provider_id;
ABT_pool pool;
ABT_mutex mutex;
/* ssg-related data */
ssg_group_id_t gid;
/* bake-related data */
......@@ -34,6 +37,7 @@ struct mobject_server_context
sdskv_database_id_t segment_db_id;
sdskv_database_id_t omap_db_id;
/* other data */
uint32_t seq_id;
int ref_count;
};
......
......@@ -67,6 +67,7 @@ int mobject_provider_register(
srv_ctx->provider_id = provider_id;
srv_ctx->pool = pool;
srv_ctx->ref_count = 1;
ABT_mutex_create(&srv_ctx->mutex);
srv_ctx->gid = gid;
my_id = ssg_get_group_self_id(srv_ctx->gid);
......@@ -262,6 +263,7 @@ static void mobject_finalize_cb(void* data)
sdskv_provider_handle_release(srv_ctx->sdskv_ph);
bake_provider_handle_release(srv_ctx->bake_ph);
ABT_mutex_free(&srv_ctx->mutex);
free(srv_ctx);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment