BIND 10 trac2108_3, updated. 896c0de84e16201a4c682bc9d895359f41813422 [2108] Update comment

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Sep 3 08:56:08 UTC 2012


The branch, trac2108_3 has been updated
       via  896c0de84e16201a4c682bc9d895359f41813422 (commit)
       via  f2623367b1289645a0440faf590ceb8a3e417f55 (commit)
      from  061fbc119bccfb8cf5afe7eb3e8a6228d8956168 (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 896c0de84e16201a4c682bc9d895359f41813422
Author: Mukund Sivaraman <muks at isc.org>
Date:   Mon Sep 3 14:25:40 2012 +0530

    [2108] Update comment

commit f2623367b1289645a0440faf590ceb8a3e417f55
Author: Mukund Sivaraman <muks at isc.org>
Date:   Mon Sep 3 14:25:16 2012 +0530

    [2108] Swap the new ZoneData in place when loading a zone

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

Summary of changes:
 src/lib/datasrc/memory/memory_client.cc |   28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/memory_client.cc b/src/lib/datasrc/memory/memory_client.cc
index d14826f..73475c3 100644
--- a/src/lib/datasrc/memory/memory_client.cc
+++ b/src/lib/datasrc/memory/memory_client.cc
@@ -19,6 +19,7 @@
 #include <datasrc/memory/rdata_serialization.h>
 #include <datasrc/memory/rdataset.h>
 #include <datasrc/memory/domaintree.h>
+#include <datasrc/memory/segment_object_holder.h>
 
 #include <util/memory_segment_local.h>
 
@@ -59,6 +60,8 @@ namespace isc {
 namespace datasrc {
 namespace memory {
 
+using detail::SegmentObjectHolder;
+
 namespace {
 // Some type aliases
 typedef DomainTree<std::string> FileNameTree;
@@ -424,7 +427,8 @@ public:
      * Implementation of longer methods. We put them here, because the
      * access is without the impl_-> and it will get inlined anyway.
      */
-    // Implementation of InMemoryZoneFinder::add
+
+    // Implementation of InMemoryClient::add()
     result::Result add(const ConstRRsetPtr& rawrrset,
                        const Name& zone_name, ZoneData& zone_data,
                        vector<RBNodeRRset*>* need_additionals)
@@ -562,18 +566,9 @@ InMemoryClient::InMemoryClientImpl::load(
 {
     vector<RBNodeRRset*> need_additionals;
 
-    ZoneTable::AddResult result = zone_table_->addZone(local_mem_sgmt,
-                                                       rrclass_,
-                                                       zone_name);
-    if (result.code != result::SUCCESS) {
-        // FIXME: This needs to be fixed for reloads to work. It would
-        // need changes in ZoneTable to allow resetting ZoneData for a
-        // table node, and we should swap the new ZoneData in only after
-        // it is ready.
-        isc_throw(DataSourceError, "Zone probably exists: " + zone_name.toText());
-    }
-
-    scoped_ptr<ZoneData> tmp(result.zone_data);
+    SegmentObjectHolder<ZoneData, RRClass> holder(
+        local_mem_sgmt, ZoneData::create(local_mem_sgmt, zone_name), rrclass_);
+    scoped_ptr<ZoneData> tmp(holder.get());
 
     rrset_installer(boost::bind(&InMemoryClientImpl::addFromLoad, this,
                                 _1, zone_name, tmp.get(), &need_additionals));
@@ -621,6 +616,13 @@ InMemoryClient::InMemoryClientImpl::load(
     std::string* tstr = node->setData(new std::string(filename));
     delete tstr;
 
+    ZoneTable::AddResult result(zone_table_->addZone(local_mem_sgmt,
+                                                     rrclass_, zone_name));
+    ZoneData *data = zone_table_->setZoneData(zone_name, holder.release());
+    if (data != NULL) {
+        ZoneData::destroy(local_mem_sgmt, data, rrclass_);
+    }
+
     return (result.code);
 }
 



More information about the bind10-changes mailing list