From: Michael Vrable Date: Fri, 7 Dec 2007 21:33:25 +0000 (-0800) Subject: Ensure that segments with reused metadata are listed in root descriptor. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=1b39ce3ff11a;p=cumulus.git Ensure that segments with reused metadata are listed in root descriptor. --- diff --git a/metadata.cc b/metadata.cc index f972b75..c27278b 100644 --- a/metadata.cc +++ b/metadata.cc @@ -269,6 +269,11 @@ void MetadataWriter::metadata_flush() ObjectReference indirect; for (list::iterator i = items.begin(); i != items.end(); ++i) { + // If indirectly referencing any other metadata logs, be sure those + // segments are properly referenced. + if (i->reused) + add_segment(i->ref.get_segment()); + // Write out an indirect reference to any previous objects which could // be reused if (!i->reused || !indirect.merge(i->ref)) { diff --git a/scandir.cc b/scandir.cc index 654f9fb..cf66ea6 100644 --- a/scandir.cc +++ b/scandir.cc @@ -138,7 +138,7 @@ int64_t dumpfile(int fd, dictionary &file_info, const string &path, const ObjectReference &ref = *i; object_list.push_back(ref.to_string()); if (ref.is_normal()) - segment_list.insert(ref.get_segment()); + add_segment(ref.get_segment()); db->UseObject(ref); } size = stat_buf.st_size; @@ -228,7 +228,7 @@ int64_t dumpfile(int fd, dictionary &file_info, const string &path, object_list.push_back(ref.to_string()); if (ref.is_normal()) - segment_list.insert(ref.get_segment()); + add_segment(ref.get_segment()); db->UseObject(ref); size += bytes;