BIND 10 trac2108_3, updated. 18141332274dfbe3cdaa941d47b02bf0ca89fbb6 [2108] Add reload test
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Sep 7 02:32:08 UTC 2012
The branch, trac2108_3 has been updated
via 18141332274dfbe3cdaa941d47b02bf0ca89fbb6 (commit)
via 1fe06c9434a24cc93f6c9301c9c3f0a512c40ffc (commit)
from 330f8ec209cc50bd19da3f2548370f24e6a3641f (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 18141332274dfbe3cdaa941d47b02bf0ca89fbb6
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Sep 7 08:01:56 2012 +0530
[2108] Add reload test
commit 1fe06c9434a24cc93f6c9301c9c3f0a512c40ffc
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Sep 7 08:01:37 2012 +0530
[2108] Increment zone counter only when zone doesn't already exist
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/memory/memory_client.cc | 8 ++++++--
.../datasrc/memory/tests/memory_client_unittest.cc | 20 ++++++++++++++++++++
2 files changed, 26 insertions(+), 2 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/memory_client.cc b/src/lib/datasrc/memory/memory_client.cc
index 8f081dc..a737eff 100644
--- a/src/lib/datasrc/memory/memory_client.cc
+++ b/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_);
diff --git a/src/lib/datasrc/memory/tests/memory_client_unittest.cc b/src/lib/datasrc/memory/tests/memory_client_unittest.cc
index d27b3a9..da82a92 100644
--- a/src/lib/datasrc/memory/tests/memory_client_unittest.cc
+++ b/src/lib/datasrc/memory/tests/memory_client_unittest.cc
@@ -125,6 +125,26 @@ TEST_F(MemoryClientTest, load) {
client_->load(Name("example.org"), TEST_DATA_DIR "/example.org.zone");
}
+TEST_F(MemoryClientTest, loadReloadZone) {
+ // Because we reload the same zone, also check that the zone count
+ // doesn't increase.
+ EXPECT_EQ(0, client_->getZoneCount());
+
+ client_->load(Name("example.org"),
+ TEST_DATA_DIR "/example.org-empty.zone");
+ EXPECT_EQ(1, client_->getZoneCount());
+
+ client_->load(Name("example.org"),
+ client_->getFileName(Name("example.org")));
+ EXPECT_EQ(1, client_->getZoneCount());
+
+ client_->load(Name("example.org"),
+ TEST_DATA_DIR "/example.org-rrsigs.zone");
+ EXPECT_EQ(1, client_->getZoneCount());
+
+ // Teardown checks for memory segment leaks
+}
+
TEST_F(MemoryClientTest, loadRRSIGFollowsNothing) {
EXPECT_THROW(client_->load(Name("example.org"),
TEST_DATA_DIR
More information about the bind10-changes
mailing list