diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-01-03 12:44:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-03 12:44:44 +0100 |
commit | 6af0d79479da66c18089ad0ae07c6dea44f88ee8 (patch) | |
tree | 357ed44df353b71ff6a647119240be1ca0bbfa85 | |
parent | 861e00243a743827ec706f3f9aacf52291420960 (diff) | |
parent | 794f54183e8ce2dc3b45cc0a92c00fa08ebfae10 (diff) |
Merge pull request #7920 from vespa-engine/balder/enable-assert-once-per-release-for-entryref
This will enable the first assert to be trigger a core dump.
-rw-r--r-- | searchlib/src/vespa/searchlib/datastore/entryref.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/datastore/entryref.h b/searchlib/src/vespa/searchlib/datastore/entryref.h index 433c260de32..f4dec5dbef3 100644 --- a/searchlib/src/vespa/searchlib/datastore/entryref.h +++ b/searchlib/src/vespa/searchlib/datastore/entryref.h @@ -3,6 +3,7 @@ #pragma once #include <cstdint> +#include <vespa/vespalib/util/assert.h> namespace search::datastore { @@ -28,7 +29,11 @@ class EntryRefT : public EntryRef { public: EntryRefT() : EntryRef() {} EntryRefT(uint64_t offset_, uint32_t bufferId_) : - EntryRef((offset_ << BufferBits) + bufferId_) {} + EntryRef((offset_ << BufferBits) + bufferId_) + { + ASSERT_ONCE_OR_LOG(offset_ < offsetSize(), "EntryRefT.offset_overflow", 10000); + ASSERT_ONCE_OR_LOG(bufferId_ < numBuffers(), "EntryRefT.bufferId_overflow", 10000); + } EntryRefT(const EntryRef & ref_) : EntryRef(ref_.ref()) {} uint32_t hash() const { return offset() + (bufferId() << OffsetBits); } uint64_t offset() const { return _ref >> BufferBits; } |