diff options
| author | Douglas Rumbaugh <dbr4@psu.edu> | 2023-06-13 15:04:14 -0400 |
|---|---|---|
| committer | Douglas Rumbaugh <dbr4@psu.edu> | 2023-06-13 15:04:14 -0400 |
| commit | 05642ae192f50e7a40dc198451545f03f6b4d79a (patch) | |
| tree | 22db33f15baa7651140324973f83bbab0953c406 /include/shard/TrieSpline.h | |
| parent | f3211dfa5fabf30ed31ca67c23e0abb13bf9f5c5 (diff) | |
| download | dynamic-extension-05642ae192f50e7a40dc198451545f03f6b4d79a.tar.gz | |
TrieSpline: fixed error in min/max key determination
An elif was used when the conditions were _not_ supposed to be mutually
exclusive, resulting in the wrong minimum key value being used in
some cases.
Diffstat (limited to 'include/shard/TrieSpline.h')
| -rw-r--r-- | include/shard/TrieSpline.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/include/shard/TrieSpline.h b/include/shard/TrieSpline.h index 432614c..0cb0180 100644 --- a/include/shard/TrieSpline.h +++ b/include/shard/TrieSpline.h @@ -134,6 +134,12 @@ public: size_t attemp_reccnt = 0; size_t tombstone_count = 0; + + // initialize m_max_key and m_min_key using the values from the + // first shard. These will later be updated when building + // the initial priority queue to their true values. + m_max_key = shards[0]->m_max_key; + m_min_key = shards[0]->m_min_key; for (size_t i = 0; i < len; ++i) { if (shards[i]) { @@ -143,12 +149,11 @@ public: tombstone_count += shards[i]->get_tombstone_count(); pq.push(cursors[i].ptr, i); - if (i == 0) { - m_max_key = shards[i]->m_max_key; - m_min_key = shards[i]->m_min_key; - } else if (shards[i]->m_max_key > m_max_key) { + if (shards[i]->m_max_key > m_max_key) { m_max_key = shards[i]->m_max_key; - } else if (shards[i]->m_min_key < m_min_key) { + } + + if (shards[i]->m_min_key < m_min_key) { m_min_key = shards[i]->m_min_key; } } else { |