BIND 10 trac2964, updated. b02f05774d65cac0b87452dfea6a65be73e08069 [2964] update a comment, hopefully making it clearer

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Jun 4 21:56:02 UTC 2013


The branch, trac2964 has been updated
       via  b02f05774d65cac0b87452dfea6a65be73e08069 (commit)
       via  1ce2bb2f000d2a11a2e1e299e62ee567d81c8684 (commit)
       via  3bd3919f267d320eec044a8fb8d2aed62f176e08 (commit)
       via  b33bcfe2c8c1b651f5da66e03ea7fdbf1f499c36 (commit)
       via  c269cdc11c02affd7b191a4aabcc56bf6894ef3a (commit)
       via  24d49c3c491cf82fb5e0134d28e8eecc2428851e (commit)
       via  547094b71f9306e1130926ccb76160141e2b080e (commit)
      from  9b95e643da6c3b1be36b0700e8198b9fec870515 (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 b02f05774d65cac0b87452dfea6a65be73e08069
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Tue Jun 4 14:44:33 2013 -0700

    [2964] update a comment, hopefully making it clearer

commit 1ce2bb2f000d2a11a2e1e299e62ee567d81c8684
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Tue Jun 4 14:41:28 2013 -0700

    [2964] updated log and error messages in case of unknown datasrc.

commit 3bd3919f267d320eec044a8fb8d2aed62f176e08
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Tue Jun 4 14:31:24 2013 -0700

    [2964] corrected a minor typo in docstring

commit b33bcfe2c8c1b651f5da66e03ea7fdbf1f499c36
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Tue Jun 4 14:29:29 2013 -0700

    [2964] added thread-related note to xfrin_start()

commit c269cdc11c02affd7b191a4aabcc56bf6894ef3a
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Tue Jun 4 14:21:59 2013 -0700

    [2964] updated comments on DataSrcClientsMgr.__map_lock

commit 24d49c3c491cf82fb5e0134d28e8eecc2428851e
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Tue Jun 4 14:15:41 2013 -0700

    [2964] updated doc for DataSrcClientsMgr, mainly about thread considerations.

commit 547094b71f9306e1130926ccb76160141e2b080e
Author: JINMEI Tatuya <jinmei at isc.org>
Date:   Tue Jun 4 13:51:08 2013 -0700

    [2964] updated doc for loadzone -e so it more focuses on creating empty zone.

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

Summary of changes:
 src/bin/loadzone/b10-loadzone.xml                  |   23 ++++++++++----------
 src/bin/xfrin/xfrin.py.in                          |   13 +++++++----
 src/bin/xfrin/xfrin_messages.mes                   |   22 +++++++++----------
 .../isc/server_common/datasrc_clients_mgr.py       |   18 ++++++++++-----
 4 files changed, 44 insertions(+), 32 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/loadzone/b10-loadzone.xml b/src/bin/loadzone/b10-loadzone.xml
index 10c74c8..b47421f 100644
--- a/src/bin/loadzone/b10-loadzone.xml
+++ b/src/bin/loadzone/b10-loadzone.xml
@@ -67,10 +67,9 @@
       in a BIND 10 ready data source format.
       Master files are text files that contain DNS Resource Records
       in text form.
-      This utility can also be used to empty current content, if any,
-      of the specified zone from the specified data source so the
-      existence of the zone is recognized in the data source without
-      any content (resource records).
+      This utility can also be used to create an empty zone on the
+      specified data source so the existence of the zone is recognized
+      in the data source without any content (resource records).
     </para>
     <note><simpara>Currently only the SQLITE3 data source is supported.
     </simpara></note>
@@ -118,13 +117,12 @@
       If the <command>-e</command> command line option is specified,
       <command>b10-loadzone</command> does not take the zone name
       argument.
-      In this case it empties any existing content of the specified
-      zone from the specified data source while the data source still
-      recognizes the existence of the zone.  If the zone originally
-      didn't exist in the zone, it effectively creates the zone without
-      any content.
-      This mode of operation can be used for setting up a secondary
-      zone before transferring zone content from a primary server.
+      In this case it creates an empty zone without any content
+      while the data source still recognizes the existence of the
+      zone.
+      If the specified zone already has some content, this mode of
+      operation will remove it (but the existence of the zone in the
+      data source will be still recognized).
     </para>
 
   </refsect1>
@@ -167,7 +165,8 @@
       <varlistentry>
         <term>-e</term>
         <listitem><para>
-	    Empty any existing zone content instead of loading new one.
+	    Create an empty zone, or empty existing zone content
+	    instead of loading new one.
 	    When this option is specified, the zone file command line
 	    argument must not be provided.
 	    The <command>-i</command> option has no effect, but it
diff --git a/src/bin/xfrin/xfrin.py.in b/src/bin/xfrin/xfrin.py.in
index 4c93ba6..bcf96af 100755
--- a/src/bin/xfrin/xfrin.py.in
+++ b/src/bin/xfrin/xfrin.py.in
@@ -1454,7 +1454,7 @@ class Xfrin:
         The actual handling is deletegated to the DataSrcClientsMgr class;
         this method is a simple wrapper.
 
-        This is essentially private, but implemented as 'private' so tests
+        This is essentially private, but implemented as 'protected' so tests
         can refer to it; other external use is prohibited.
 
         """
@@ -1712,6 +1712,9 @@ class Xfrin:
 
         # Identify the data source to which the zone content is transferred,
         # and get the current zone SOA from the data source (if available).
+        # Note that we do this before spawning the xfrin session thread.
+        # find() on the client list and use of ZoneFinder (in _get_zone_soa())
+        # should be completed within the same single thread.
         datasrc_client = None
         clist = self._datasrc_clients_mgr.get_client_list(rrclass)
         if clist is None:
@@ -1720,12 +1723,14 @@ class Xfrin:
         try:
             datasrc_client = clist.find(zone_name, True, False)[0]
             if datasrc_client is None: # can happen, so log it separately.
-                logger.error(XFRIN_NO_DATASRC,
+                logger.error(XFRIN_DATASRC_UNKNOWN,
                              format_zone_str(zone_name, rrclass))
-                return (1, 'no data source for transferring %s' %
+                return (1, 'data source to transfer %s to is unknown' %
                         format_zone_str(zone_name, rrclass))
             zone_soa = _get_zone_soa(datasrc_client, zone_name, rrclass)
-        except isc.datasrc.Error as ex: # rare case error, convert (so logged)
+        except isc.datasrc.Error as ex:
+            # rare case error. re-raise as XfrinException so it'll be logged
+            # in command_handler().
             raise XfrinException('unexpected failure in datasrc module: ' +
                                  str(ex))
 
diff --git a/src/bin/xfrin/xfrin_messages.mes b/src/bin/xfrin/xfrin_messages.mes
index e048f31..9e4281a 100644
--- a/src/bin/xfrin/xfrin_messages.mes
+++ b/src/bin/xfrin/xfrin_messages.mes
@@ -70,6 +70,17 @@ inconsistent state among different modules.  If other modules accept
 the update but xfrin produces this error, the xfrin module should
 probably be restarted.
 
+% XFRIN_DATASRC_UNKNOWN data source to transfer %1 to is unknown
+The xfrin daemon received a command that would trigger a transfer,
+but could not find a data source where the specified zone belongs.
+There can be several reasons for this error: it may be a simple
+misspelling in the xfrin or zonemgr configuration, or in the user
+supplied parameter if it is triggered by an external command (such as
+from bindctl).  Another possibility is that this is the initial transfer
+for a newly setup secondary zone.  In this case at least an initial empty zone
+must be created in one of configured data sources.  This can be done by
+the -e option of b10-loadzone.
+
 % XFRIN_EXITING exiting
 The xfrin daemon is exiting.
 
@@ -163,17 +174,6 @@ from does not match the master address in the Xfrin configuration. The notify
 is ignored. This may indicate that the configuration for the master is wrong,
 that a wrong machine is sending notifies, or that fake notifies are being sent.
 
-% XFRIN_NO_DATASRC no data source for transferring %1
-The xfrin daemon received a command that would trigger a transfer,
-but could not find a data source where the specified zone belong.
-There can be several reasons for this error: it may be a simple
-misspelling in the xfrin or zonemgr configuration, or in the user
-supplied parameter if it is triggered by an external command (such as
-from bindctl).  Another possibility is that this is the initial transfer
-for newly setup secondary zone.  In this case at least an initial empty zone
-must be created in one of configured data sources.  This can be done by
-the -e option of b10-loadzone.
-
 % XFRIN_RECEIVED_COMMAND received command: %1
 The xfrin daemon received a command on the command channel.
 
diff --git a/src/lib/python/isc/server_common/datasrc_clients_mgr.py b/src/lib/python/isc/server_common/datasrc_clients_mgr.py
index 7fce727..d5d595c 100644
--- a/src/lib/python/isc/server_common/datasrc_clients_mgr.py
+++ b/src/lib/python/isc/server_common/datasrc_clients_mgr.py
@@ -32,7 +32,7 @@ class DataSrcClientsMgr:
     It is intended to be used by applications that refer to the global
     'data_sources' module.  The reconfigure() method can be called from
     a configuration callback for the module of the application.  The
-    get_client_list() is a simple search method to get the configured
+    get_client_list() method is a simple search method to get the configured
     ConfigurableClientList object for a specified RR class (if any),
     while still allowing a separate thread to reconfigure the entire lists.
 
@@ -54,8 +54,10 @@ class DataSrcClientsMgr:
 
         # Map from RRClass to ConfigurableClientList.  Resetting this map
         # is protected by __map_lock.  Note that this lock doesn't protect
-        # "updates" of the map content.  __clients_map shouldn't be accessed
-        # by class users directly.
+        # "updates" of the map content (currently it's not a problem, but
+        # if and when we support more operations such as reloading
+        # particular zones in in-memory cache, remember that there will have
+        # to be an additional layer of protection).
         self.__clients_map = {}
         self.__map_lock = threading.Lock()
 
@@ -73,7 +75,7 @@ class DataSrcClientsMgr:
         to use the returned list even if reconfigure() is called while or
         after the call to this thread.
 
-        Note that this class does not protect furtther access to the returned
+        Note that this class does not protect further access to the returned
         list from multiple threads; it's the caller's responsbility to make
         such access thread safe.  In general, the find() method on the list
         and the use of ZoneFinder created by a DataSourceClient in the list
@@ -105,7 +107,13 @@ class DataSrcClientsMgr:
         strong exception safety: unless building a new set for the new
         configuration is fully completed, the old set is intact.
 
-        See the description of get_client_list() for thread considerations.
+        This method can be called from a thread while some other thread
+        is calling get_client_list() and using the result (see
+        the description of get_client_list()).  In general, however,
+        only one thread can call this method at one time; while data
+        integrity will still be preserved, the ordering of the change
+        will not be guaranteed if multiple threads call this method
+        at the same time.
 
         Parameter:
           config (dict): configuration data for the data_sources module.



More information about the bind10-changes mailing list