Browse Source

[2108] Increment zone counter only when zone doesn't already exist

Mukund Sivaraman 12 years ago
parent
commit
1fe06c9434
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/lib/datasrc/memory/memory_client.cc

+ 6 - 2
src/lib/datasrc/memory/memory_client.cc

@@ -575,8 +575,6 @@ InMemoryClient::InMemoryClientImpl::load(
     LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_ADD_ZONE).
         arg(zone_name).arg(rrclass_.toText());
 
-    ++zone_count_;
-
     // Set the filename in file_name_tree_ now, so that getFileName()
     // can use it (during zone reloading).
     FileNameNode* node(NULL);
@@ -598,6 +596,12 @@ InMemoryClient::InMemoryClientImpl::load(
 
     ZoneTable::AddResult result(zone_table_->addZone(local_mem_sgmt_,
                                                      rrclass_, zone_name));
+    if (result.code == result::SUCCESS) {
+        // Only increment the zone count if the zone doesn't already
+        // exist.
+        ++zone_count_;
+    }
+
     ZoneData *data = zone_table_->setZoneData(zone_name, holder.release());
     if (data != NULL) {
         ZoneData::destroy(local_mem_sgmt_, data, rrclass_);