Ensure that segments with reused metadata are listed in root descriptor.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Fri, 7 Dec 2007 21:33:25 +0000 (13:33 -0800)
committerMichael Vrable <mvrable@turin.ucsd.edu>
Fri, 7 Dec 2007 21:33:25 +0000 (13:33 -0800)
metadata.cc
scandir.cc

index f972b75..c27278b 100644 (file)
@@ -269,6 +269,11 @@ void MetadataWriter::metadata_flush()
     ObjectReference indirect;
     for (list<MetadataItem>::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)) {
index 654f9fb..cf66ea6 100644 (file)
@@ -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;