BIND 10 master, updated. 18155a69d96d21d845f990010d4e6fdf9589fd6a [master] Add ChangeLog entry for #2947

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Jun 21 06:36:27 UTC 2013


The branch, master has been updated
       via  18155a69d96d21d845f990010d4e6fdf9589fd6a (commit)
       via  d1da93e647dfe42cebf516f34d1e5eb732f9cfc5 (commit)
       via  5f57054ae173dcbf802f1d7c03a485d7d72e1814 (commit)
       via  9a3ddf1e2bfa2546bfcc7df6d9b11bfbdb5cf35f (commit)
       via  348d7dcb7f31831e5db9c282c213aec0795d1ff2 (commit)
       via  19e016eb1b80db43645aca734b1f511ff2b142fb (commit)
       via  c730f9ab1b00b3611d82d0c00a2f0faf56b8162a (commit)
       via  253803efbad0e147f37f6ce7a07949bbb79909f5 (commit)
       via  9df9a672eb672bd201e3762f3f321082e7e1d17c (commit)
       via  ced15db4ec415ce080457136acebf66bebd7bf7d (commit)
       via  db2f7c545136ec475f2afda44ff182b195e2ed28 (commit)
       via  f57669ee937a15733a04e069aae01f3fff920f0d (commit)
       via  c7115f5b90dc167552fe2de1178def62a948afe6 (commit)
      from  968625c32a07347edd50550da5fcf13c17b61d87 (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 18155a69d96d21d845f990010d4e6fdf9589fd6a
Author: Mukund Sivaraman <muks at isc.org>
Date:   Fri Jun 21 12:03:08 2013 +0530

    [master] Add ChangeLog entry for #2947

commit d1da93e647dfe42cebf516f34d1e5eb732f9cfc5
Author: Mukund Sivaraman <muks at isc.org>
Date:   Fri Jun 21 12:00:51 2013 +0530

    [master] Delete trailing whitespace from ChangeLog

commit 5f57054ae173dcbf802f1d7c03a485d7d72e1814
Author: Mukund Sivaraman <muks at isc.org>
Date:   Fri Jun 21 12:00:20 2013 +0530

    [master] Comment lettuce feature about checking for DATASRC_LIBRARY_ERROR

commit 9a3ddf1e2bfa2546bfcc7df6d9b11bfbdb5cf35f
Merge: 968625c 348d7dc
Author: Mukund Sivaraman <muks at isc.org>
Date:   Fri Jun 21 11:56:47 2013 +0530

    Merge branch 'trac2947_2'

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

Summary of changes:
 ChangeLog                                          |    9 +++++-
 src/bin/cfgmgr/plugins/tests/datasrc_test.py       |    9 ------
 src/lib/datasrc/client_list.cc                     |   20 ++++++++----
 src/lib/datasrc/datasrc_messages.mes               |    5 +++
 src/lib/datasrc/factory.cc                         |    4 +--
 src/lib/datasrc/factory.h                          |   15 +++++++--
 src/lib/datasrc/tests/client_list_unittest.cc      |   34 ++++++++++++++++++++
 .../python/isc/datasrc/tests/clientlist_test.py    |    3 --
 .../configurations/example.org.inmem.config        |    6 ++++
 tests/lettuce/features/queries.feature             |    6 ++++
 10 files changed, 87 insertions(+), 24 deletions(-)

-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 12888a6..1db652f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+630.	[bug]		muks
+	If there is a problem loading the backend module for a type of
+	data source, b10-auth would not serve any zones. This behaviour
+	has been changed now so that it serves zones from all other usable
+	data sources that were configured.
+	(Trac #2947, git 9a3ddf1e2bfa2546bfcc7df6d9b11bfbdb5cf35f)
+
 629.	[func]		stephen
 	Added first part of the hooks framework.
 	(Trac #2794, git d2b107586db7c2deaecba212c891d231d7e54a07)
@@ -13,7 +20,7 @@
 	In addition, its log messages now use two suffixes, DCTL_ for logs the
 	emanate from the underlying base classes, and DHCP_DDNS_ for logs which
 	emanate from DHCP-DDNS specific code
-	(Trac #2978, git 5aec5fb20b0486574226f89bd877267cb9116921) 
+	(Trac #2978, git 5aec5fb20b0486574226f89bd877267cb9116921)
 
 626.	[func]		tmark
 	Created the initial implementation of DHCP-DDNS service
diff --git a/src/bin/cfgmgr/plugins/tests/datasrc_test.py b/src/bin/cfgmgr/plugins/tests/datasrc_test.py
index 3c714c6..546e534 100644
--- a/src/bin/cfgmgr/plugins/tests/datasrc_test.py
+++ b/src/bin/cfgmgr/plugins/tests/datasrc_test.py
@@ -96,15 +96,6 @@ class DatasrcTest(unittest.TestCase):
             "params": {}
         }]})
 
-    def test_dstype_bad(self):
-        """
-        The configuration is correct by the spec, but it would be rejected
-        by the client list. Check we reject it.
-        """
-        self.reject({"IN": [{
-            "type": "No such type"
-        }]})
-
     def test_invalid_mem_params(self):
         """
         The client list skips in-memory sources. So we check it locally that
diff --git a/src/lib/datasrc/client_list.cc b/src/lib/datasrc/client_list.cc
index 50d30e2..8a609af 100644
--- a/src/lib/datasrc/client_list.cc
+++ b/src/lib/datasrc/client_list.cc
@@ -110,12 +110,20 @@ ConfigurableClientList::configure(const ConstElementPtr& config,
                           << datasrc_name);
             }
 
-            // Create a client for the underling data source via factory.
-            // If it's our internal type of data source, this is essentially
-            // no-op.  In the latter case, it's of no use unless cache is
-            // allowed; we simply skip building it in that case.
-            const DataSourcePair dsrc_pair = getDataSourceClient(type,
-                                                                 param_conf);
+            DataSourcePair dsrc_pair;
+            try {
+                // Create a client for the underling data source via
+                // factory.  If it's our internal type of data source,
+                // this is essentially no-op.  In the latter case, it's
+                // of no use unless cache is allowed; we simply skip
+                // building it in that case.
+                dsrc_pair = getDataSourceClient(type, param_conf);
+            } catch (const DataSourceLibraryError& ex) {
+                LOG_ERROR(logger, DATASRC_LIBRARY_ERROR).
+                    arg(datasrc_name).arg(rrclass_).arg(ex.what());
+                continue;
+            }
+
             if (!allow_cache && !dsrc_pair.first) {
                 LOG_WARN(logger, DATASRC_LIST_NOT_CACHED).
                     arg(datasrc_name).arg(rrclass_);
diff --git a/src/lib/datasrc/datasrc_messages.mes b/src/lib/datasrc/datasrc_messages.mes
index 6667349..f9a76ed 100644
--- a/src/lib/datasrc/datasrc_messages.mes
+++ b/src/lib/datasrc/datasrc_messages.mes
@@ -370,6 +370,11 @@ Therefore, the entire data source will not be available for this process. If
 this is a problem, you should configure the zones of that data source to some
 database backend (sqlite3, for example) and use it from there.
 
+% DATASRC_LIBRARY_ERROR failure loading %1 datasource library for class %2: %3
+There was a problem loading the dynamic library for a data source. This
+backend is hence not available, and any data sources that use this
+backend will not be available.
+
 % DATASRC_LOAD_ZONE_ERROR Error loading zone %1/%2 on data source '%3': %4
 During data source configuration, an error was found in the zone data
 when it was being loaded in to memory on the shown data source.  This
diff --git a/src/lib/datasrc/factory.cc b/src/lib/datasrc/factory.cc
index 73f7e4a..26b31dd 100644
--- a/src/lib/datasrc/factory.cc
+++ b/src/lib/datasrc/factory.cc
@@ -83,8 +83,8 @@ LibraryContainer::LibraryContainer(const std::string& name) {
     if (ds_lib_ == NULL) {
         // This may cause the filename to appear twice in the actual
         // error, but the output of dlerror is implementation-dependent
-        isc_throw(DataSourceLibraryError, "dlopen failed for " << name << 
-                                          ": " << dlerror());
+        isc_throw(DataSourceLibraryOpenError,
+                  "dlopen failed for " << name << ": " << dlerror());
     }
 }
 
diff --git a/src/lib/datasrc/factory.h b/src/lib/datasrc/factory.h
index 4e669ec..b9b6578 100644
--- a/src/lib/datasrc/factory.h
+++ b/src/lib/datasrc/factory.h
@@ -27,7 +27,7 @@ namespace isc {
 namespace datasrc {
 
 
-/// \brief Raised if there is an error loading the datasource implementation
+/// \brief Raised if there is an error in the datasource implementation
 ///        library
 class DataSourceLibraryError : public DataSourceError {
 public:
@@ -35,13 +35,22 @@ public:
         DataSourceError(file, line, what) {}
 };
 
+/// \brief Raised if there is an error opening the the datasource
+///        implementation library
+class DataSourceLibraryOpenError : public DataSourceLibraryError {
+public:
+    DataSourceLibraryOpenError(const char* file, size_t line,
+                               const char* what) :
+        DataSourceLibraryError(file, line, what) {}
+};
+
 /// \brief Raised if there is an error reading a symbol from the datasource
 ///        implementation library
-class DataSourceLibrarySymbolError : public DataSourceError {
+class DataSourceLibrarySymbolError : public DataSourceLibraryError {
 public:
     DataSourceLibrarySymbolError(const char* file, size_t line,
                                  const char* what) :
-        DataSourceError(file, line, what) {}
+        DataSourceLibraryError(file, line, what) {}
 };
 
 typedef DataSourceClient* ds_creator(isc::data::ConstElementPtr config,
diff --git a/src/lib/datasrc/tests/client_list_unittest.cc b/src/lib/datasrc/tests/client_list_unittest.cc
index 5b173a9..36c5005 100644
--- a/src/lib/datasrc/tests/client_list_unittest.cc
+++ b/src/lib/datasrc/tests/client_list_unittest.cc
@@ -16,6 +16,7 @@
 
 #include <datasrc/client_list.h>
 #include <datasrc/client.h>
+#include <datasrc/factory.h>
 #include <datasrc/cache_config.h>
 #include <datasrc/zone_iterator.h>
 #include <datasrc/exceptions.h>
@@ -71,6 +72,10 @@ public:
         if (type == "error") {
             isc_throw(DataSourceError, "The error data source type");
         }
+        if (type == "library_error") {
+            isc_throw(DataSourceLibraryError,
+                      "The library error data source type");
+        }
         if (type == "MasterFiles") {
             return (DataSourcePair(0, DataSourceClientContainerPtr()));
         }
@@ -705,6 +710,35 @@ TEST_P(ListTest, dataSrcError) {
     checkDS(0, "test_type", "{}", false);
 }
 
+// In case of library errors, the rest of the data sources should be
+// unaffected.
+TEST_P(ListTest, dataSrcLibraryError) {
+    EXPECT_EQ(0, list_->getDataSources().size());
+    const ConstElementPtr elem(Element::fromJSON("["
+        "{"
+        "   \"type\": \"type1\","
+        "   \"cache-enable\": false,"
+        "   \"params\": {}"
+        "},"
+        "{"
+        "   \"type\": \"library_error\","
+        "   \"cache-enable\": false,"
+        "   \"params\": {}"
+        "},"
+        "{"
+        "   \"type\": \"type2\","
+        "   \"cache-enable\": false,"
+        "   \"params\": {}"
+        "}]"
+    ));
+    list_->configure(elem, true);
+    EXPECT_EQ(2, list_->getDataSources().size());
+    checkDS(0, "type1", "{}", false);
+    checkDS(1, "type2", "{}", false);
+    // Check the exact configuration is preserved
+    EXPECT_EQ(elem, list_->getConfiguration());
+}
+
 // Check we can get the cache
 TEST_P(ListTest, configureCacheEmpty) {
     const ConstElementPtr elem(Element::fromJSON("["
diff --git a/src/lib/python/isc/datasrc/tests/clientlist_test.py b/src/lib/python/isc/datasrc/tests/clientlist_test.py
index e4232b3..774e592 100644
--- a/src/lib/python/isc/datasrc/tests/clientlist_test.py
+++ b/src/lib/python/isc/datasrc/tests/clientlist_test.py
@@ -102,9 +102,6 @@ class ClientListTest(unittest.TestCase):
         self.assertRaises(isc.datasrc.Error, self.clist.configure,
                           '"bad type"', True)
         self.assertRaises(isc.datasrc.Error, self.clist.configure, '''[{
-            "type": "bad type"
-        }]''', True)
-        self.assertRaises(isc.datasrc.Error, self.clist.configure, '''[{
             bad JSON,
         }]''', True)
         self.assertRaises(TypeError, self.clist.configure, [], True)
diff --git a/tests/lettuce/configurations/example.org.inmem.config b/tests/lettuce/configurations/example.org.inmem.config
index 2e9ca41..2eadedb 100644
--- a/tests/lettuce/configurations/example.org.inmem.config
+++ b/tests/lettuce/configurations/example.org.inmem.config
@@ -22,6 +22,12 @@
                     "params": {
                         "example.org": "data/example.org"
                     }
+                },
+                {
+                    "type": "broken_libraries_should_be_skipped",
+                    "cache-enable": false,
+                    "params": {
+                    }
                 }
             ]
         }
diff --git a/tests/lettuce/features/queries.feature b/tests/lettuce/features/queries.feature
index 5fd0d58..2db6c3e 100644
--- a/tests/lettuce/features/queries.feature
+++ b/tests/lettuce/features/queries.feature
@@ -53,6 +53,12 @@ Feature: Querying feature
         And wait for bind10 stderr message BIND10_STARTED_CC
         And wait for bind10 stderr message CMDCTL_STARTED
         And wait for bind10 stderr message AUTH_SERVER_STARTED
+
+        # DATASRC_LIBRARY_ERROR must be generated due to
+        # "broken_libraries_should_be_skipped" in
+        # example.org.inmem.config
+        And wait for bind10 stderr message DATASRC_LIBRARY_ERROR
+
         And wait for bind10 stderr message STATS_STARTING
 
         bind10 module Auth should be running



More information about the bind10-changes mailing list