Skip to content
Permalink
Browse files

Merge pull request #8826 from vespa-engine/toregge/followup-on-size-t…

…-in-datastore

Followup on using size_t in datastore and buffer code.
  • Loading branch information...
baldersheim committed Mar 18, 2019
2 parents 3c211fc + 5560ea6 commit 44b041614f934eb7e6bf33c90e5cfebd889cdf2a
@@ -102,7 +102,7 @@ Test::requireThatFeaturesCanBeAddedAndRetrieved()
FeatureStore::RefType(r1).offset());
EXPECT_EQUAL(0u, FeatureStore::RefType(r1).bufferId());
LOG(info,
"bits(%" PRIu64 "), ref.offset(%" PRIu64 "), ref.bufferId(%u)",
"bits(%" PRIu64 "), ref.offset(%zu), ref.bufferId(%u)",
r.second,
FeatureStore::RefType(r1).offset(),
FeatureStore::RefType(r1).bufferId());
@@ -119,7 +119,7 @@ Test::requireThatFeaturesCanBeAddedAndRetrieved()
FeatureStore::RefType(r1).offset());
EXPECT_EQUAL(0u, FeatureStore::RefType(r1).bufferId());
LOG(info,
"bits(%" PRIu64 "), ref.offset(%" PRIu64 "), ref.bufferId(%u)",
"bits(%" PRIu64 "), ref.offset(%zu), ref.bufferId(%u)",
r.second,
FeatureStore::RefType(r2).offset(),
FeatureStore::RefType(r2).bufferId());
@@ -146,7 +146,7 @@ Test::requireThatNextWordsAreWorking()
FeatureStore::RefType(r1).offset());
EXPECT_EQUAL(0u, FeatureStore::RefType(r1).bufferId());
LOG(info,
"bits(%" PRIu64 "), ref.offset(%" PRIu64 "), ref.bufferId(%u)",
"bits(%" PRIu64 "), ref.offset(%zu), ref.bufferId(%u)",
r.second,
FeatureStore::RefType(r1).offset(),
FeatureStore::RefType(r1).bufferId());
@@ -163,7 +163,7 @@ Test::requireThatNextWordsAreWorking()
FeatureStore::RefType(r1).offset());
EXPECT_EQUAL(0u, FeatureStore::RefType(r1).bufferId());
LOG(info,
"bits(%" PRIu64 "), ref.offset(%" PRIu64 "), ref.bufferId(%u)",
"bits(%" PRIu64 "), ref.offset(%zu), ref.bufferId(%u)",
r.second,
FeatureStore::RefType(r2).offset(),
FeatureStore::RefType(r2).bufferId());
@@ -1013,8 +1013,8 @@ TEST_F("requireThatInversionIsWorking", DictionaryFixture<Fixture>)
f._pushThreads.sync();
DataStoreBase::MemStats beforeStats = getFeatureStoreMemStats(f._d);
LOG(info,
"Before feature compaction: allocElems=%" PRIu64 ", usedElems=%" PRIu64
", deadElems=%" PRIu64 ", holdElems=%" PRIu64
"Before feature compaction: allocElems=%zu, usedElems=%zu"
", deadElems=%zu, holdElems=%zu"
", freeBuffers=%u, activeBuffers=%u"
", holdBuffers=%u",
beforeStats._allocElems,
@@ -1033,8 +1033,8 @@ TEST_F("requireThatInversionIsWorking", DictionaryFixture<Fixture>)
myCommit(f._d, f._pushThreads);
DataStoreBase::MemStats duringStats = getFeatureStoreMemStats(f._d);
LOG(info,
"During feature compaction: allocElems=%" PRIu64 ", usedElems=%" PRIu64
", deadElems=%" PRIu64 ", holdElems=%" PRIu64
"During feature compaction: allocElems=%zu, usedElems=%zu"
", deadElems=%zu, holdElems=%zu"
", freeBuffers=%u, activeBuffers=%u"
", holdBuffers=%u",
duringStats._allocElems,
@@ -1048,8 +1048,8 @@ TEST_F("requireThatInversionIsWorking", DictionaryFixture<Fixture>)
myCommit(f._d, f._pushThreads);
DataStoreBase::MemStats afterStats = getFeatureStoreMemStats(f._d);
LOG(info,
"After feature compaction: allocElems=%" PRIu64 ", usedElems=%" PRIu64
", deadElems=%" PRIu64 ", holdElems=%" PRIu64
"After feature compaction: allocElems=%zu, usedElems=%zu"
", deadElems=%zu, holdElems=%zu"
", freeBuffers=%u, activeBuffers=%u"
", holdBuffers=%u",
afterStats._allocElems,
@@ -33,7 +33,7 @@ class BTreeNodeBufferType : public datastore::BufferType<EntryType>

void initializeReservedElements(void *buffer, size_t reservedElements) override;

void cleanHold(void *buffer, uint64_t offset, uint64_t len, CleanContext cleanCtx) override;
void cleanHold(void *buffer, size_t offset, size_t numElems, CleanContext cleanCtx) override;
};


@@ -22,10 +22,10 @@ BTreeNodeBufferType<EntryType>::initializeReservedElements(void *buffer, size_t

template <typename EntryType>
void
BTreeNodeBufferType<EntryType>::cleanHold(void *buffer, uint64_t offset, uint64_t len, CleanContext)
BTreeNodeBufferType<EntryType>::cleanHold(void *buffer, size_t offset, size_t numElems, CleanContext)
{
EntryType *e = static_cast<EntryType *>(buffer) + offset;
for (size_t j = len; j != 0; --j) {
for (size_t j = numElems; j != 0; --j) {
e->cleanFrozen();
++e;
}
@@ -54,11 +54,11 @@ DenseTensorStore::BufferType::BufferType(const TensorSizeCalc &tensorSizeCalc)
DenseTensorStore::BufferType::~BufferType() = default;

void
DenseTensorStore::BufferType::cleanHold(void *buffer, uint64_t offset,
uint64_t len, CleanContext)
DenseTensorStore::BufferType::cleanHold(void *buffer, size_t offset,
size_t numElems, CleanContext)
{
// Clear both tensor dimension size information and cells.
memset(static_cast<char *>(buffer) + offset - _unboundDimSizesSize, 0, len);
memset(static_cast<char *>(buffer) + offset - _unboundDimSizesSize, 0, numElems);
}

size_t
@@ -47,7 +47,7 @@ class DenseTensorStore : public TensorStore
public:
BufferType(const TensorSizeCalc &tensorSizeCalc);
~BufferType() override;
void cleanHold(void *buffer, uint64_t offset, uint64_t len, CleanContext cleanCtx) override;
void cleanHold(void *buffer, size_t offset, size_t numElems, CleanContext cleanCtx) override;
uint32_t unboundDimSizesSize() const { return _unboundDimSizesSize; }
size_t getReservedElements(uint32_t bufferId) const override;
static size_t align(size_t size, size_t alignment) {

0 comments on commit 44b0416

Please sign in to comment.
You can’t perform that action at this time.