BIND 10 #3017: add isDirty() to ZoneTableSegment

BIND 10 Development do-not-reply at isc.org
Thu Jun 27 01:14:36 UTC 2013


#3017: add isDirty() to ZoneTableSegment
-------------------------------------+-------------------------------------
                   Reporter:         |                 Owner:
  jinmei                             |                Status:  new
                       Type:  task   |             Milestone:  New Tasks
                   Priority:         |              Keywords:
  medium                             |             Sensitive:  0
                  Component:  data   |           Sub-Project:  DNS
  source                             |  Estimated Difficulty:  0
               CVSS Scoring:         |           Total Hours:  0
            Defect Severity:  N/A    |
Feature Depending on Ticket:         |
  shared memory data source          |
        Add Hours to Ticket:  0      |
                  Internal?:  0      |
-------------------------------------+-------------------------------------
 This task implements the `ZoneTableHeader` extension as described in
 https://lists.isc.org/pipermail/bind10-dev/2013-June/004691.html

 Specifically, we add a new virtual method to `ZoneTableSegment`:
 {{{#!cpp
 class ZoneTableSegment {
 public:
     virtual bool isDirty() const = 0;
 ...
 };
 }}}

 and implement it for both `ZoneTableSegmentLocal` and
 `ZoneTableSegmentMapped`.  For the former, it's effectively unused for
 our shared memory support (and can return anything), but considering
 it's always writable, its `isDirty()` would always return true.

 For `ZoneTableSegmentMapped`, A possible implementation would be as
 follows:

 - introduce a new named address (tentatively named "zone_table_dirty"
   for a bool value) in the underlying (mapped) memory segment.  make
   sure it's always set for a valid `ZoneTableSegmentMapped` (so we'll
   first set it to true on creation and keep the address since then).
 - Extend the "not create" case of
   `ZoneTableSegmentMapped::processChecksum()` so that it first checks
   the existence of "zone_table_dirty", sets it to true and then
   check the checksum.
 - Extend `ZoneTableSegmentMapped::sync()` in case the segment is
   writable so that:
   - If it's called from methods other than the destructor, then after
     calculating and setting the checksum, set the value of
     "zone_table_dirty" to false.
   - If it's called from the destructor, leave the value of
     "zone_table_dirty".

 This trick is to ensure that if the zone table segment is unexpectedly
 closed in the middle of updates (probably due to an exception and
 automatic call to the destructor), we'll consider the segment still
 dirty.  The (builder thread of) memmgr will explicitly reset it after
 successfully making updates (see the end of bind10.isc.org/ticket/2856
 description), thereby clearing the "dirty" mark.

 The `isDirty()` method itself should be straightforward:

 {{{#!cpp
 bool
 ZoneTableSegmentMapped::isDirty() const {
     return (isWritable() ||
             (mem_sgmt_ &&
 *mem_sgmt_->getNamedAddress("zone_table_dirty")));
 }
 }}}

-- 
Ticket URL: <http://bind10.isc.org/ticket/3017>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list