aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-12-10 17:21:34 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2018-12-10 17:21:34 +0000
commit794f54183e8ce2dc3b45cc0a92c00fa08ebfae10 (patch)
tree19b64609ad19dab68f8133a32ee0954a593a8958 /searchlib/src
parent631085769fab67aac9485415778f00776546cbcb (diff)
This will enable the first assert to be trigger a core dump.
The others will log a stacktrace per 1000 failed asserts.
Diffstat (limited to 'searchlib/src')
-rw-r--r--searchlib/src/vespa/searchlib/datastore/entryref.h7
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; }