BIND 10 trac2836, updated. f941f042dc2c953390354434e9a4563cb67b14e0 [2836] Clarify exception thrown from DomainTree::insert

BIND 10 source code commits bind10-changes at lists.isc.org
Mon May 13 11:07:15 UTC 2013


The branch, trac2836 has been updated
       via  f941f042dc2c953390354434e9a4563cb67b14e0 (commit)
       via  54b12f14d032796a8d6638cdbbf6ba5d63835478 (commit)
       via  689aa37ea4cc087ad0affeedb2b4f8de5b29919d (commit)
      from  f4ca083e427788a22a4979a104b517a5a4ef3df9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f941f042dc2c953390354434e9a4563cb67b14e0
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon May 13 13:05:19 2013 +0200

    [2836] Clarify exception thrown from DomainTree::insert

commit 54b12f14d032796a8d6638cdbbf6ba5d63835478
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon May 13 13:00:01 2013 +0200

    [2836] Retry addition to zone table
    
    Currently untested, as there's no reasonable way to create a zone table
    with mapped segment :-(.

commit 689aa37ea4cc087ad0affeedb2b4f8de5b29919d
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Mon May 13 12:56:31 2013 +0200

    [2836] Note that a method may throw

-----------------------------------------------------------------------

Summary of changes:
 src/lib/datasrc/memory/domaintree.h         |    6 ++++++
 src/lib/datasrc/memory/zone_table.h         |    2 ++
 src/lib/datasrc/memory/zone_writer_local.cc |   26 +++++++++++++++++---------
 3 files changed, 25 insertions(+), 9 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/domaintree.h b/src/lib/datasrc/memory/domaintree.h
index 6e8b062..7bd840b 100644
--- a/src/lib/datasrc/memory/domaintree.h
+++ b/src/lib/datasrc/memory/domaintree.h
@@ -1311,6 +1311,12 @@ public:
     /// the same.  This method provides the weak exception guarantee in its
     /// normal sense.
     ///
+    /// In particular, this method can propagate the \c MemorySegmentGrown
+    /// exception from the \c MemorySegment object. In such case, some of
+    /// the internal nodes may have been already allocated (but hold no data).
+    /// Retrying the insert (possibly multiple times) would lead to the same
+    /// structure eventually.
+    ///
     /// \param mem_sgmt A \c MemorySegment object for allocating memory of
     /// a new node to be inserted.  Must be the same segment as that used
     /// for creating the tree itself.
diff --git a/src/lib/datasrc/memory/zone_table.h b/src/lib/datasrc/memory/zone_table.h
index 1b369b9..b487855 100644
--- a/src/lib/datasrc/memory/zone_table.h
+++ b/src/lib/datasrc/memory/zone_table.h
@@ -144,6 +144,8 @@ public:
     /// This method adds a given zone data to the internal table.
     ///
     /// \throw std::bad_alloc Internal resource allocation fails.
+    /// \throw MemorySegmentGrown when the memory segment grown and
+    ///     possibly relocated.
     ///
     /// \param mem_sgmt The \c MemorySegment to allocate zone data to be
     ///     created.  It must be the same segment that was used to create
diff --git a/src/lib/datasrc/memory/zone_writer_local.cc b/src/lib/datasrc/memory/zone_writer_local.cc
index 0cd9587..01827a3 100644
--- a/src/lib/datasrc/memory/zone_writer_local.cc
+++ b/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



More information about the bind10-changes mailing list