X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;ds=sidebyside;f=scandir.cc;h=71fba9dc22fcbc597303e44ceeac16a54048da4e;hb=248b2455853ed082bf3b032fea4cb6b557a145ae;hp=99498c4a753a434db415e87d5bf1ca9fc35ed4ad;hpb=e053c8481ac962711348e466496e8a0c5a53f100;p=cumulus.git diff --git a/scandir.cc b/scandir.cc index 99498c4..71fba9d 100644 --- a/scandir.cc +++ b/scandir.cc @@ -142,6 +142,7 @@ int64_t dumpfile(int fd, dictionary &file_info, const string &path) // Either find a copy of this block in an already-existing segment, or // index it so it can be re-used in the future + double block_age = 0.0; SHA1Checksum block_hash; block_hash.process(block_buf, bytes); string block_csum = block_hash.checksum_str(); @@ -158,8 +159,10 @@ int64_t dumpfile(int fd, dictionary &file_info, const string &path) * put it in a separate group, so that old objects get grouped * together. The hope is that these old objects will continue to * be used in the future, and we obtain segments which will - * continue to be well-utilized. */ - if (db->IsOldObject(block_csum, bytes)) + * continue to be well-utilized. Additionally, keep track of the + * age of the data by looking up the age of the block which was + * expired and using that instead of the current time. */ + if (db->IsOldObject(block_csum, bytes, &block_age)) o->set_group("compacted"); else o->set_group("data"); @@ -167,7 +170,7 @@ int64_t dumpfile(int fd, dictionary &file_info, const string &path) o->set_data(block_buf, bytes); o->write(tss); ref = o->get_ref(); - db->StoreObject(ref, block_csum, bytes); + db->StoreObject(ref, block_csum, bytes, block_age); delete o; }