Fix segment offset sorting.

Get rid of incorrect duplicate checks in index.
This commit is contained in:
Moinak Ghosh 2013-05-05 18:50:52 +05:30
parent c6da2325e3
commit 6ecc400571
2 changed files with 6 additions and 7 deletions

View file

@ -485,10 +485,11 @@ db_lookup_insert_s(archive_config_t *cfg, uchar_t *sim_cksum, int interval,
pent = &(htab[htab_entry]); pent = &(htab[htab_entry]);
ent = htab[htab_entry]; ent = htab[htab_entry];
if (cfg->pct_interval == 0) { // Global dedupe with simple index if (cfg->pct_interval == 0) { // Global dedupe with simple index.
assert(cfg->similarity_cksum_sz == cfg->chunk_cksum_sz);
while (ent) { while (ent) {
if (mycmp(sim_cksum, ent->cksum, cfg->similarity_cksum_sz) == 0 && if (mycmp(sim_cksum, ent->cksum, cfg->similarity_cksum_sz) == 0 &&
ent->item_size == item_size && ent->item_offset != item_offset) { ent->item_size == item_size) {
return (ent); return (ent);
} }
pent = &(ent->next); pent = &(ent->next);
@ -496,8 +497,7 @@ db_lookup_insert_s(archive_config_t *cfg, uchar_t *sim_cksum, int interval,
} }
} else if (cfg->similarity_cksum_sz == 8) {// Fast path for 64-bit keys } else if (cfg->similarity_cksum_sz == 8) {// Fast path for 64-bit keys
while (ent) { while (ent) {
if (*((uint64_t *)sim_cksum) == *((uint64_t *)ent->cksum) && if (*((uint64_t *)sim_cksum) == *((uint64_t *)ent->cksum)) {
ent->item_offset != item_offset) {
return (ent); return (ent);
} }
pent = &(ent->next); pent = &(ent->next);
@ -505,8 +505,7 @@ db_lookup_insert_s(archive_config_t *cfg, uchar_t *sim_cksum, int interval,
} }
} else { } else {
while (ent) { while (ent) {
if (mycmp(sim_cksum, ent->cksum, cfg->similarity_cksum_sz) == 0 && if (mycmp(sim_cksum, ent->cksum, cfg->similarity_cksum_sz) == 0) {
ent->item_offset != item_offset) {
return (ent); return (ent);
} }
pent = &(ent->next); pent = &(ent->next);

View file

@ -989,7 +989,7 @@ process_blocks:
* file. Sort the offsets to avoid subsequent random access. * file. Sort the offsets to avoid subsequent random access.
*/ */
tgt = src + 1; tgt = src + 1;
isort_uint64((uint64_t *)tgt, k); isort_uint64((uint64_t *)tgt, sub_i);
/* /*
* Now eliminate duplicate offsets and UINT64_MAX offset entries which * Now eliminate duplicate offsets and UINT64_MAX offset entries which