Skip to content

Instantly share code, notes, and snippets.

@slfritchie
Created February 20, 2014 07:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slfritchie/324d955b53b1a581352f to your computer and use it in GitHub Desktop.
Save slfritchie/324d955b53b1a581352f to your computer and use it in GitHub Desktop.
diff --git a/c_src/bitcask_nifs.c b/c_src/bitcask_nifs.c
index e7166c6..fff3b0c 100644
--- a/c_src/bitcask_nifs.c
+++ b/c_src/bitcask_nifs.c
@@ -155,7 +155,7 @@ typedef struct
uint32_t total_sz;
uint64_t offset;
uint32_t tstamp;
- uint32_t tstamp_epoch;
+ uint8_t tstamp_epoch;
uint16_t key_sz;
char * key;
} bitcask_keydir_entry_proxy;
@@ -722,6 +722,7 @@ static int proxy_kd_entry_at_time(bitcask_keydir_entry* old,
ret->total_sz = s->total_sz;
ret->offset = s->offset;
ret->tstamp = s->orig_tstamp;
+ if (s->orig_tstamp != head->sibs->tstamp) { fprintf(stderr, "\r\n Diff @ line %d\r\n", __LINE__); }
ret->tstamp_epoch = s->tstamp_epoch;
ret->key_sz = head->key_sz;
@@ -826,10 +827,12 @@ static void update_kd_entry_list(bitcask_keydir_entry *old,
// merge is replacing this item: use the keydir's tstamp & epoch,
// and save the entry's original tstamp
new_sib->orig_tstamp = xtra->orig_tstamp;
+ if (new_sib->orig_tstamp != h->sibs->tstamp) { fprintf(stderr, "\r\n Diff @ line %d\r\n", __LINE__); }
new_sib->tstamp = xtra->biggest_timestamp;
new_sib->tstamp_epoch = xtra->biggest_timestamp_epoch;
} else {
new_sib->orig_tstamp = new->tstamp;
+ if (new_sib->orig_tstamp != h->sibs->tstamp) { fprintf(stderr, "\r\n Diff @ line %d\r\n", __LINE__); }
new_sib->tstamp = new->tstamp;
new_sib->tstamp_epoch = new->tstamp_epoch;
}
@@ -871,6 +874,7 @@ static bitcask_keydir_entry* new_kd_entry_list(bitcask_keydir_entry *old,
new_sib->tstamp_epoch = new->tstamp_epoch;
}
new_sib->next = old_sib;
+ /* doesn't make sense to check here, because 'new' *is* the head of the siblings list. if (new_sib->orig_tstamp != h->sibs->tstamp) { fprintf(stderr, "\r\n Diff @ line %d\r\n", __LINE__); } */
//make old sib
old_sib->file_id = old->file_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment