Browse Source

[2836] Retry addition to zone table

Currently untested, as there's no reasonable way to create a zone table
with mapped segment :-(.
Michal 'vorner' Vaner 12 years ago
parent
commit
54b12f14d0
1 changed files with 17 additions and 9 deletions
  1. 17 9
      src/lib/datasrc/memory/zone_writer_local.cc

+ 17 - 9
src/lib/datasrc/memory/zone_writer_local.cc

@@ -64,17 +64,25 @@ ZoneWriterLocal::install() {
         isc_throw(isc::InvalidOperation, "No data to install");
     }
 
-
-    ZoneTable* table(segment_->getHeader().getTable());
-    if (table == NULL) {
-        isc_throw(isc::Unexpected, "No zone table present");
+    // FIXME: This retry is currently untested, as there seems to be no
+    // reasonable way to create a zone table segment with non-local memory
+    // segment. Once there is, we should provide the test.
+    while (state_ != ZW_INSTALLED) {
+        try {
+            ZoneTable* table(segment_->getHeader().getTable());
+            if (table == NULL) {
+                isc_throw(isc::Unexpected, "No zone table present");
+            }
+            const ZoneTable::AddResult result(table->addZone(
+                                                  segment_->getMemorySegment(),
+                                                  rrclass_, origin_,
+                                                  zone_data_));
+            state_ = ZW_INSTALLED;
+            zone_data_ = result.zone_data;
+        } catch (const isc::util::MemorySegmentGrown&) {
+        }
     }
-    const ZoneTable::AddResult result(table->addZone(
-                                          segment_->getMemorySegment(),
-                                          rrclass_, origin_, zone_data_));
 
-    state_ = ZW_INSTALLED;
-    zone_data_ = result.zone_data;
 }
 
 void