[svn] commit: r3194 - in /branches/trac340/src/bin/zonemgr: tests/zonemgr_test.py zonemgr.py.in zonemgr.spec.pre.in

BIND 10 source code commits bind10-changes at lists.isc.org
Wed Oct 13 04:03:59 UTC 2010


Author: chenzhengzhang
Date: Wed Oct 13 04:03:59 2010
New Revision: 3194

Log:
add necessary comments for new feature

Modified:
    branches/trac340/src/bin/zonemgr/tests/zonemgr_test.py
    branches/trac340/src/bin/zonemgr/zonemgr.py.in
    branches/trac340/src/bin/zonemgr/zonemgr.spec.pre.in

Modified: branches/trac340/src/bin/zonemgr/tests/zonemgr_test.py
==============================================================================
--- branches/trac340/src/bin/zonemgr/tests/zonemgr_test.py (original)
+++ branches/trac340/src/bin/zonemgr/tests/zonemgr_test.py Wed Oct 13 04:03:59 2010
@@ -473,7 +473,7 @@
         # jitter should not be bigger than half of the original value
         config_data3 = {"jitter_scope" : "0.7"}
         self.zonemgr.config_handler(config_data3)
-        self.assertEqual(config_data1, self.zonemgr._config_data)
+        self.assertEqual("0.5", self.zonemgr._config_data.get("jitter_scope"))
 
     def test_get_db_file(self):
         self.assertEqual("initdb.file", self.zonemgr.get_db_file())

Modified: branches/trac340/src/bin/zonemgr/zonemgr.py.in
==============================================================================
--- branches/trac340/src/bin/zonemgr/zonemgr.py.in (original)
+++ branches/trac340/src/bin/zonemgr/zonemgr.py.in Wed Oct 13 04:03:59 2010
@@ -116,13 +116,14 @@
         return time.time()
 
     def _set_zone_timer(self, zone_name_class, max, jitter):
-        """Set zone next refresh time."""
+        """Set zone next refresh time. 
+        jitter should not be bigger than half the original value."""
         self._set_zone_next_refresh_time(zone_name_class, self._get_current_time() + \
                                             self._random_jitter(max, jitter))
 
     def _set_zone_refresh_timer(self, zone_name_class):
         """Set zone next refresh time after zone refresh success.
-           now + refresh*3/4 <= next_refresh_time <= now + refresh
+           now + refresh - jitter  <= next_refresh_time <= now + refresh
            """
         zone_refresh_time = float(self._get_zone_soa_rdata(zone_name_class).split(" ")[REFRESH_OFFSET])
         zone_refresh_time = max(self._lowerbound_refresh, zone_refresh_time)
@@ -130,7 +131,7 @@
 
     def _set_zone_retry_timer(self, zone_name_class):
         """Set zone next refresh time after zone refresh fail.
-           now + retry*3/4 <= next_refresh_time <= now + retry
+           now + retry - jitter <= next_refresh_time <= now + retry
            """
         zone_retry_time = float(self._get_zone_soa_rdata(zone_name_class).split(" ")[RETRY_OFFSET])
         zone_retry_time = max(self._lowerbound_retry, zone_retry_time)
@@ -390,6 +391,10 @@
                                                   self.command_handler)
         self._module_cc.add_remote_config(AUTH_SPECFILE_LOCATION)
         self._config_data = self._module_cc.get_full_config()
+        # jitter should not be bigger than half of the original value
+        if float(self._config_data.get('jitter_scope')) > 0.5:
+            self._config_data['jitter_scope'] = 0.5
+            log_msg("[b10-zonemgr] jitter_scope should not be bigger than 0.5.") 
         self._module_cc.start()
 
     def get_db_file(self):
@@ -424,9 +429,9 @@
                 continue
             # jitter should not be bigger than half of the original value
             if key == 'jitter_scope':
-                jitter_scope = new_config[key]
-                if float(jitter_scope) > 0.5:
-                    continue
+                if float(new_config.get(key)) > 0.5:
+                    new_config[key] = 0.5
+                    log_msg("[b10-zonemgr] jitter_scope should not be bigger than 0.5.") 
             self._config_data[key] = new_config[key]
 
         if (self._zone_refresh):

Modified: branches/trac340/src/bin/zonemgr/zonemgr.spec.pre.in
==============================================================================
--- branches/trac340/src/bin/zonemgr/zonemgr.spec.pre.in (original)
+++ branches/trac340/src/bin/zonemgr/zonemgr.spec.pre.in Wed Oct 13 04:03:59 2010
@@ -24,7 +24,7 @@
          "item_name": "jitter_scope",
          "item_type": "real",
          "item_optional": false,
-         "item_default": 0.25 
+         "item_default": 0.25
        }
       ],
       "commands": [




More information about the bind10-changes mailing list