BIND 10 #1330: Extend DatabaseAccessor to support reading diffs

BIND 10 Development do-not-reply at isc.org
Thu Nov 10 18:54:45 UTC 2011


#1330: Extend DatabaseAccessor to support reading diffs
-------------------------------------+-------------------------------------
                   Reporter:         |                 Owner:  jelte
  jinmei                             |                Status:  reviewing
                       Type:  task   |             Milestone:
                   Priority:  major  |  Sprint-20111122
                  Component:  data   |            Resolution:
  source                             |             Sensitive:  0
                   Keywords:         |           Sub-Project:  DNS
            Defect Severity:  N/A    |  Estimated Difficulty:  5
Feature Depending on Ticket:         |           Total Hours:  0
        Add Hours to Ticket:         |
                  Internal?:  0      |
-------------------------------------+-------------------------------------
Changes (by stephen):

 * owner:  stephen => jelte


Comment:

 > side note2: Seeing this interface also reminded me that I wanted to
 propose defining a class for serial numbers (with overloaded comparison
 operators), instead of passing around plain utin32_t values. Added a
 comment to #1278.
 Good idea.

 > I'm not sure I'm comfortable with the exception approach we are taking
 here; (defining a number of them in sqlite3_accessor.h and simply saying
 on the database.h level it can throw 'any')
 I used the term "throwing any" in header documentation as it was used
 elsewhere in the code.  As to the exception approach:
 * In the short term, the exceptions are now subclasses of
 !DataSourceError, giving a common ancestor class that can be caught
 through a "catch" clause.
 * In the long-term, I think we want to decide how we deal with errors.  In
 some cases we are using exceptions (with free-form text in the source
 code), in other places we are using the message system (with defined text
 in external files and the text listed in a separate messages manual).  I
 think we need some guidelines as to where to use one rather than the
 other.

 > only one small code issue in sqlite3_accessor.cc; int rc is declared
 twice in getSingleValue(). Compiles fine, but not so nice :)
 Oversight - removed.

 > Is it guaranteed that this SQL statement provides what we want?
 Good catch - there was an "ORDER BY id ASC" missing from it which has now
 been added.

 > Another thing: exception should be caught by (const) reference:
 Done.


 > And yet another thing (this one is critical): aren't the OPERATION
 incorrect? 0 = DIFF_ADD and 1 = DIFF_DELETE, so it seems to retrieve the
 first added record of the given begin serial to the last deleted record of
 the end serial (which is different from the IXFR ordering).
 I used the values and the statements from the current version (v10) of the
 DifferenceDesign page which states that "operation" is either "0 (delete)
 or 1 (add)".

 As database.h defines the !DiffOperation enum, I've made the "operation"
 value in the SQL statements (the ones selecting the index limits) a
 statement parameter and bind to it at run-time with DIFF_DELETE or
 DIFF_ADD.  The overhead is negligible and it does mean that the SQL string
 does not contain as literal values numbers defined elsewhere.  I've also
 updated the data used for the unit tests with the changed values. I'll
 update the DifferenceDesign page when I merge the code.

 '''Other'''[[BR]]
 Finally, does this merit a !ChangeLog entry?  If so, then how about
 something along the lines of:
 {{{
 [func]     stephen
 Add C++ API for accessing zone difference information in database-based
 data sources.
 }}}

-- 
Ticket URL: <http://bind10.isc.org/ticket/1330#comment:16>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development


More information about the bind10-tickets mailing list