BIND 10 trac2091a, updated. 6535fcf60c69445751261e593a1f740e77fbd0bb [2091a] some additional notes about the restriction of using the same memsgmt.
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Jul 23 19:30:18 UTC 2012
The branch, trac2091a has been updated
via 6535fcf60c69445751261e593a1f740e77fbd0bb (commit)
via 78fe82d12838c8daead5477e612de9b7470c13c5 (commit)
via b805d99d2c615dc4ef49f3c1c255c490cc0bd9a6 (commit)
via 49a336ef47649db5165f047e37825dbfb2ab9b61 (commit)
from ecd6c30cc2e568d499e8fc9d97926ecef38a924c (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 6535fcf60c69445751261e593a1f740e77fbd0bb
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Mon Jul 23 12:29:49 2012 -0700
[2091a] some additional notes about the restriction of using the same memsgmt.
commit 78fe82d12838c8daead5477e612de9b7470c13c5
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Mon Jul 23 12:01:28 2012 -0700
[2091a] added a comment about future plans of sharing memsgmt for multi zones.
commit b805d99d2c615dc4ef49f3c1c255c490cc0bd9a6
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Mon Jul 23 11:55:15 2012 -0700
[2091a] clarified in one point that non absolute means relative
commit 49a336ef47649db5165f047e37825dbfb2ab9b61
Author: JINMEI Tatuya <jinmei at isc.org>
Date: Mon Jul 23 11:50:10 2012 -0700
[2091a] removed redundant consts.
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/memory_datasrc.cc | 4 +++-
src/lib/datasrc/rbtree.h | 20 ++++++++++++++++++--
src/lib/dns/name.h | 6 +++---
src/lib/dns/tests/labelsequence_unittest.cc | 25 ++++++++++++-------------
4 files changed, 36 insertions(+), 19 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory_datasrc.cc b/src/lib/datasrc/memory_datasrc.cc
index 8a58afe..652b3b1 100644
--- a/src/lib/datasrc/memory_datasrc.cc
+++ b/src/lib/datasrc/memory_datasrc.cc
@@ -147,7 +147,9 @@ struct ZoneData {
// The assert may be too harsh, but we assume we'll discard (rewrite)
// this code soon enough. Until then this would be a good way to
- // detect any memory leak.
+ // detect any memory leak. Also, at that point we shouldn't use
+ // a single separate memory segment for each zone tree; normally
+ // zone data for multiple zones will be managed in a single segment.
assert(local_mem_sgmt_.allMemoryDeallocated());
}
diff --git a/src/lib/datasrc/rbtree.h b/src/lib/datasrc/rbtree.h
index f45972c..08a8aa8 100644
--- a/src/lib/datasrc/rbtree.h
+++ b/src/lib/datasrc/rbtree.h
@@ -754,11 +754,23 @@ public:
/// This method also destroys and deallocates all nodes inserted to the
/// tree.
///
+ /// \note The memory segment (\c mem_sgmt) must be the same one that
+ /// was originally used to allocate memory for the tree (and for all
+ /// nodes inserted to the tree, due to the requirement of \c insert()),
+ /// since the tree itself doesn't maintain a reference to the segment.
+ /// This is not a robust interface, but since we plan to share the tree
+ /// structure by multiple processes via shared memory or possibly allow
+ /// the memory image to be dumped to a file for later reload, there
+ /// doesn't seem to be an easy way to store such reference in the data
+ /// itself. We should probably consider a wrapper interface that
+ /// encapsulates the corresponding segment and always use it for any
+ /// allocation/deallocation of tree related data (the tree itself, their
+ /// nodes, and node data) to keep the usage as safe as possible.
+ ///
/// \throw none
///
/// \param mem_sgmt The \c MemorySegment that allocated memory for
- /// \c rbtree (and for all nodes inserted to the tree, due to the
- /// requirement of \c insert()).
+ /// \c rbtree and for all nodes inserted to the tree.
/// \param rbtree A non NULL pointer to a valid \c RBTree object
/// that was originally created by the \c create() method (the behavior
/// is undefined if this condition isn't met).
@@ -1090,6 +1102,10 @@ public:
/// \brief Swaps two tree's contents.
///
+ /// This and \c other trees must have been created with the same
+ /// memory segment (see the discussion in \c create()); otherwise the
+ /// behavior is undefined.
+ ///
/// This acts the same as many std::*.swap functions, exchanges the
/// contents. This doesn't throw anything.
void swap(RBTree<T>& other) {
diff --git a/src/lib/dns/name.h b/src/lib/dns/name.h
index 38fc566..261caee 100644
--- a/src/lib/dns/name.h
+++ b/src/lib/dns/name.h
@@ -117,9 +117,9 @@ public:
///
/// Note that the ordering is defined for two label sequences that have no
/// hierarchical relationship (in which case the relationship will be NONE).
-/// For example, two non absolute sequences "example.com" and "example.org"
-/// have no hierarchical relationship, and the former should be sorted before
-/// (i.e. "smaller") than the latter.
+/// For example, two non absolute (or "relative") sequences "example.com" and
+/// "example.org" have no hierarchical relationship, and the former should be
+/// sorted before (i.e. "smaller") than the latter.
class NameComparisonResult {
public:
/// The relation of two names under comparison.
diff --git a/src/lib/dns/tests/labelsequence_unittest.cc b/src/lib/dns/tests/labelsequence_unittest.cc
index 8fb3a9e..b999b9d 100644
--- a/src/lib/dns/tests/labelsequence_unittest.cc
+++ b/src/lib/dns/tests/labelsequence_unittest.cc
@@ -702,7 +702,7 @@ TEST_F(LabelSequenceTest, serialize) {
// An absolute sequence directly constructed from a valid name.
// labels = 3, offset sequence = 0, 8, 12, data = "example.com."
actual_labelseqs.push_back(ls1);
- const uint8_t const expected_data1[] = {
+ const uint8_t expected_data1[] = {
3, 0, 8, 12, 7, 'e', 'x', 'a', 'm', 'p', 'l', 'e',
3, 'o', 'r', 'g', 0 };
expected.push_back(DataPair(sizeof(expected_data1), expected_data1));
@@ -712,7 +712,7 @@ TEST_F(LabelSequenceTest, serialize) {
LabelSequence ls_rstripped = ls1;
ls_rstripped.stripRight(1);
actual_labelseqs.push_back(ls_rstripped);
- const uint8_t const expected_data2[] = {
+ const uint8_t expected_data2[] = {
2, 0, 8, 7, 'e', 'x', 'a', 'm', 'p', 'l', 'e',
3, 'o', 'r', 'g'};
expected.push_back(DataPair(sizeof(expected_data2), expected_data2));
@@ -723,21 +723,20 @@ TEST_F(LabelSequenceTest, serialize) {
LabelSequence ls_lstripped = ls1;
ls_lstripped.stripLeft(1);
actual_labelseqs.push_back(ls_lstripped);
- const uint8_t const expected_data3[] = {
- 2, 0, 4, 3, 'o', 'r', 'g', 0 };
+ const uint8_t expected_data3[] = { 2, 0, 4, 3, 'o', 'r', 'g', 0 };
expected.push_back(DataPair(sizeof(expected_data3), expected_data3));
// Root label.
LabelSequence ls_root(Name::ROOT_NAME());
actual_labelseqs.push_back(ls_root);
- const uint8_t const expected_data4[] = { 1, 0, 0 };
+ const uint8_t expected_data4[] = { 1, 0, 0 };
expected.push_back(DataPair(sizeof(expected_data4), expected_data4));
// Non absolute single-label.
LabelSequence ls_single = ls_rstripped;
ls_single.stripRight(1);
actual_labelseqs.push_back(ls_single);
- const uint8_t const expected_data5[] = {
+ const uint8_t expected_data5[] = {
1, 0, 7, 'e', 'x', 'a', 'm', 'p', 'l', 'e' };
expected.push_back(DataPair(sizeof(expected_data5), expected_data5));
@@ -765,23 +764,23 @@ TEST_F(LabelSequenceTest, serialize) {
TEST_F(LabelSequenceTest, badDeserialize) {
EXPECT_THROW(LabelSequence(NULL), isc::BadValue);
- const uint8_t const zero_offsets[] = { 0 };
+ const uint8_t zero_offsets[] = { 0 };
EXPECT_THROW(LabelSequence ls(zero_offsets), isc::BadValue);
- const uint8_t const toomany_offsets[] = { Name::MAX_LABELS + 1 };
+ const uint8_t toomany_offsets[] = { Name::MAX_LABELS + 1 };
EXPECT_THROW(LabelSequence ls(toomany_offsets), isc::BadValue);
// exceed MAX_LABEL_LEN
- const uint8_t const offsets_toolonglabel[] = { 2, 0, 64 };
+ const uint8_t offsets_toolonglabel[] = { 2, 0, 64 };
EXPECT_THROW(LabelSequence ls(offsets_toolonglabel), isc::BadValue);
// Inconsistent data: an offset is lower than the previous offset
- const uint8_t const offsets_lower[] = { 3, // # of offsets
- 0, 2, 1, // offsets
- 1, 'a', 1, 'b', 0};
+ const uint8_t offsets_lower[] = { 3, // # of offsets
+ 0, 2, 1, // offsets
+ 1, 'a', 1, 'b', 0};
EXPECT_THROW(LabelSequence ls(offsets_lower), isc::BadValue);
// Inconsistent data: an offset is equal to the previous offset
- const uint8_t const offsets_noincrease[] = { 2, 0, 0, 0, 0 };
+ const uint8_t offsets_noincrease[] = { 2, 0, 0, 0, 0 };
EXPECT_THROW(LabelSequence ls(offsets_noincrease), isc::BadValue);
}
More information about the bind10-changes
mailing list