summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2019-08-20 16:23:46 +0200
committerGitHub <noreply@github.com>2019-08-20 16:23:46 +0200
commit2f80bbf78040338b4f81166b25e70d1f316a7d0d (patch)
tree1e7866bce8512f5ab2977adcd4f44dd2e478a164 /searchlib
parent1ee2c782265e84bca9e0064786bcde742b25abbc (diff)
parent73584390cdd1f564ceb14228e226dac9a75dc4d2 (diff)
Merge pull request #10343 from vespa-engine/geirst/attribute-enum-store-cleanup
Geirst/attribute enum store cleanup
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/tests/attribute/enumeratedsave/.gitignore9
-rw-r--r--searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp3
-rwxr-xr-xsearchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.sh1
-rwxr-xr-xsearchlib/src/tests/attribute/searchcontext/searchcontext_test.sh1
-rw-r--r--searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp8
-rwxr-xr-xsearchlib/src/tests/attribute/stringattribute/stringattribute_test.sh1
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumstore.cpp83
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumstore.h47
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumstore.hpp74
-rw-r--r--searchlib/src/vespa/searchlib/attribute/enumstorebase.h4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp23
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postinglistattribute.h1
12 files changed, 12 insertions, 243 deletions
diff --git a/searchlib/src/tests/attribute/enumeratedsave/.gitignore b/searchlib/src/tests/attribute/enumeratedsave/.gitignore
index a4680f95f72..22bf50938c1 100644
--- a/searchlib/src/tests/attribute/enumeratedsave/.gitignore
+++ b/searchlib/src/tests/attribute/enumeratedsave/.gitignore
@@ -106,22 +106,31 @@
/int8_ws1_ee.udat
/int8_ws2_e.udat
/int8_ws2_ee.udat
+/str_a0.udat
/str_a0_e.udat
/str_a0_ee.udat
+/str_a1.udat
/str_a1_e.udat
/str_a1_ee.udat
+/str_a2.udat
/str_a2_e.udat
/str_a2_ee.udat
+/str_sv0.udat
/str_sv0_e.udat
/str_sv0_ee.udat
+/str_sv1.udat
/str_sv1_e.udat
/str_sv1_ee.udat
+/str_sv2.udat
/str_sv2_e.udat
/str_sv2_ee.udat
+/str_ws0.udat
/str_ws0_e.udat
/str_ws0_ee.udat
+/str_ws1.udat
/str_ws1_e.udat
/str_ws1_ee.udat
+/str_ws2.udat
/str_ws2_e.udat
/str_ws2_ee.udat
searchlib_enumeratedsave_test_app
diff --git a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp
index bc72caf198b..620708f8c9b 100644
--- a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp
+++ b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp
@@ -759,9 +759,6 @@ PostingListAttributeTest::testArithmeticValueUpdate(const AttributePtr & ptr)
EXPECT_TRUE(vec.apply(3, Arith(Arith::Div, 10)));
ptr->commit();
- vespalib::asciistream ss;
- vec.printPostingListContent(ss);
- std::cout << ss.str();
{
uint32_t docs[] = {0};
checkPostingList<AttributeType, ValueType>(vec, 2020, DocSet(docs, docs + 1));
diff --git a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.sh b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.sh
index d9a59a98d13..e38f56cbc76 100755
--- a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.sh
+++ b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.sh
@@ -3,5 +3,6 @@
set -e
$VALGRIND ./searchlib_postinglistattribute_test_app
rm -rf *.dat
+rm -rf *.udat
rm -rf *.idx
rm -rf *.weight
diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.sh b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.sh
index 3c1d0bdcf5d..2d8352bd9e3 100755
--- a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.sh
+++ b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.sh
@@ -3,5 +3,6 @@
set -e
$VALGRIND ./searchlib_searchcontext_test_app
rm -rf *.dat
+rm -rf *.udat
rm -rf *.idx
rm -rf *.weight
diff --git a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp
index 5afa9f68acd..b7e036017ea 100644
--- a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp
+++ b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp
@@ -140,8 +140,6 @@ StringAttributeTest::testMultiValue(Attribute & attr, uint32_t numDocs)
attr.commit();
}
- //attr.getEnumStore().printCurrentContent();
-
// check values and enums
for (uint32_t doc = 0; doc < numDocs; ++doc) {
uint32_t valueCount = attr.getValueCount(doc);
@@ -194,8 +192,6 @@ StringAttributeTest::testMultiValue(Attribute & attr, uint32_t numDocs)
EXPECT_TRUE(attr.append(doc, newUniques[j], 1));
}
attr.commit();
-
- //attr.getEnumStore().printCurrentContent();
}
// check values and enums
@@ -389,8 +385,6 @@ StringAttributeTest::testSingleValue(Attribute & svsa, Config &cfg)
}
}
- //svsa.printBuffers();
-
// 1000 unique strings
for (uint32_t i = 0; i < numDocs; ++i) {
sprintf(tmp, "unique%u", i);
@@ -407,10 +401,8 @@ StringAttributeTest::testSingleValue(Attribute & svsa, Config &cfg)
EXPECT_TRUE( v.findEnum(t, e2) );
EXPECT_TRUE( e1 == e2 );
}
- //svsa.printBuffers();
}
}
- //svsa.printBuffers();
// check that enumX strings are removed (
for (uint32_t i = 0; i < 10; ++i) {
diff --git a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.sh b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.sh
index 7da009b9ab1..7a39c2cb864 100755
--- a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.sh
+++ b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.sh
@@ -3,3 +3,4 @@
set -e
$VALGRIND ./searchlib_stringattribute_test_app
rm -rf *.dat
+rm -rf *.udat
diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.cpp b/searchlib/src/vespa/searchlib/attribute/enumstore.cpp
index 6914376ae0a..859c2527bbc 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumstore.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/enumstore.cpp
@@ -18,74 +18,6 @@ insertEntryValue(char * dst, Type value)
template <>
void
-EnumStoreT<StringEntryType>::
-printEntry(vespalib::asciistream & os, const Entry & e) const
-{
- os << "Entry: {";
- os << "enum: " << e.getEnum();
- os << ", refcount: " << e.getRefCount();
- os << ", value: " << vespalib::string(e.getValue());
- os << "}";
-}
-
-
-template <>
-void
-EnumStoreT<NumericEntryType<float> >::
-printEntry(vespalib::asciistream & os, const Entry & e) const
-{
- os << "Entry: {";
- os << "enum: " << e.getEnum();
- os << ", refcount: " << e.getRefCount();
- os << ", value: " << e.getValue();
- union
- {
- unsigned int _asInt;
- float _asFloat;
- } u;
- u._asFloat = e.getValue();
- os << ", bvalue: 0x" << vespalib::hex << u._asInt;
- os << "}";
-}
-
-
-template <>
-void
-EnumStoreT<NumericEntryType<double> >::
-printEntry(vespalib::asciistream & os, const Entry & e) const
-{
- os << "Entry: {";
- os << "enum: " << e.getEnum();
- os << ", refcount: " << e.getRefCount();
- os << ", value: " << e.getValue();
- union
- {
- unsigned long _asLong;
- double _asDouble;
- } u;
- u._asDouble = e.getValue();
- os << ", bvalue: 0x" << vespalib::hex << u._asLong;
- os << "}";
-}
-
-
-template <>
-void
-EnumStoreT<StringEntryType>::printValue(vespalib::asciistream & os, Index idx) const
-{
- os << vespalib::string(getValue(idx));
-}
-
-template <>
-void
-EnumStoreT<StringEntryType>::printValue(vespalib::asciistream & os, Type value) const
-{
- os << vespalib::string(value);
-}
-
-
-template <>
-void
EnumStoreT<StringEntryType>::writeValues(BufferWriter &writer,
const Index *idxs,
size_t count) const
@@ -151,21 +83,6 @@ EnumStoreT<StringEntryType>::deserialize(const void *src,
return sz;
}
-
-#if 0
-template
-class btree::BTreeKeyData<EnumStoreBase::Index, btree::BTreeNoLeafData>;
-
-template
-class btree::BTreeKeyData<EnumStoreBase::Index, datastore::EntryRef>;
-
-template
-class btree::BTreeNodeT<EnumStoreBase::Index, EnumTreeTraits::LEAF_SLOTS>;
-
-template
-class btree::BTreeNodeTT<EnumStoreBase::Index, datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::LEAF_SLOTS>;
-#endif
-
template
class btree::BTreeBuilder<EnumStoreBase::Index, btree::BTreeNoLeafData, btree::NoAggregated,
EnumTreeTraits::INTERNAL_SLOTS, EnumTreeTraits::LEAF_SLOTS>;
diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.h b/searchlib/src/vespa/searchlib/attribute/enumstore.h
index 2af1fdc1b9d..8e38e12bfff 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumstore.h
+++ b/searchlib/src/vespa/searchlib/attribute/enumstore.h
@@ -108,7 +108,6 @@ protected:
Entry getEntry(Index idx) const {
return Entry(const_cast<DataStoreType &>(_store).getEntry<char>(idx));
}
- void printEntry(vespalib::asciistream & os, const Entry & e) const;
void freeUnusedEnum(Index idx, IndexSet & unused) override;
@@ -121,16 +120,12 @@ public:
bool getValue(Index idx, Type & value) const;
Type getValue(uint32_t idx) const { return getValue(Index(datastore::EntryRef(idx))); }
Type getValue(Index idx) const { return getEntry(idx).getValue(); }
- uint32_t getFixedSize() const override { return Entry::fixedSize(); }
static uint32_t
getEntrySize(Type value)
{
return alignEntrySize(EntryBase::size() + EntryType::size(value));
}
- void printBuffer(vespalib::asciistream & os, uint32_t bufferIdx) const;
- void printValue(vespalib::asciistream & os, Index idx) const;
- void printValue(vespalib::asciistream & os, Type value) const;
class Builder {
public:
@@ -173,7 +168,6 @@ public:
void freeUnusedEnums(const IndexVector &toRemove) override;
void reset(Builder &builder);
bool performCompaction(uint64_t bytesNeeded, EnumIndexMap & old2New) override;
- void printCurrentContent(vespalib::asciistream &os) const;
private:
template <typename Dictionary>
@@ -184,9 +178,6 @@ private:
template <typename Dictionary>
void performCompaction(Dictionary &dict, EnumIndexMap & old2New);
-
- template <typename Dictionary>
- void printCurrentContent(vespalib::asciistream &os, const Dictionary &dict) const;
};
template <typename EntryType>
@@ -235,44 +226,6 @@ void
EnumStoreT<StringEntryType>::
insertEntryValue(char * dst, Type value);
-template <>
-void
-EnumStoreT<StringEntryType>::
-printEntry(vespalib::asciistream & os, const Entry & e) const;
-
-template <>
-void
-EnumStoreT<NumericEntryType<float> >::
-printEntry(vespalib::asciistream & os, const Entry & e) const;
-
-template <>
-void
-EnumStoreT<NumericEntryType<double> >::
-printEntry(vespalib::asciistream & os, const Entry & e) const;
-
-template <>
-void
-EnumStoreT<StringEntryType>::printValue(vespalib::asciistream & os, Index idx) const;
-
-template <>
-void
-EnumStoreT<StringEntryType>::printValue(vespalib::asciistream & os, Type value) const;
-
-
-#if 0
-extern template
-class btree::BTreeKeyData<EnumStoreBase::Index, btree::BTreeNoLeafData>;
-
-extern template
-class btree::BTreeKeyData<EnumStoreBase::Index, datastore::EntryRef>;
-
-extern template
-class btree::BTreeNodeT<EnumStoreBase::Index, EnumTreeTraits::LEAF_SLOTS>;
-
-extern template
-class btree::BTreeNodeTT<EnumStoreBase::Index, datastore::EntryRef, btree::NoAggregated, EnumTreeTraits::LEAF_SLOTS>;
-#endif
-
extern template
class btree::BTreeBuilder<EnumStoreBase::Index, btree::BTreeNoLeafData, btree::NoAggregated,
diff --git a/searchlib/src/vespa/searchlib/attribute/enumstore.hpp b/searchlib/src/vespa/searchlib/attribute/enumstore.hpp
index c1b35b5a5fe..af164415ad3 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumstore.hpp
+++ b/searchlib/src/vespa/searchlib/attribute/enumstore.hpp
@@ -48,17 +48,6 @@ EnumStoreT<StringEntryType>::
insertEntryValue(char * dst, Type value);
template <typename EntryType>
-void
-EnumStoreT<EntryType>::printEntry(vespalib::asciistream & os, const Entry & e) const
-{
- os << "Entry: {";
- os << "enum: " << e.getEnum();
- os << ", refcount: " << e.getRefCount();
- os << ", value: " << e.getValue();
- os << "}";
-}
-
-template <typename EntryType>
bool
EnumStoreT<EntryType>::getValue(Index idx, Type & value) const
{
@@ -70,21 +59,6 @@ EnumStoreT<EntryType>::getValue(Index idx, Type & value) const
}
template <typename EntryType>
-void
-EnumStoreT<EntryType>::printBuffer(vespalib::asciistream & os, uint32_t bufferIdx) const
-{
- uint64_t i = 0;
- while (i < _store.getBufferState(bufferIdx).size()) {
- Index idx(i, bufferIdx);
-
- Entry e = this->getEntry(idx);
- this->printEntry(os, e);
- os << ", " << idx << '\n';
- i += this->getEntrySize(e.getValue());
- }
-}
-
-template <typename EntryType>
EnumStoreT<EntryType>::Builder::Builder()
: _uniques(),
_bufferSize(Index::align(1))
@@ -93,21 +67,6 @@ EnumStoreT<EntryType>::Builder::Builder()
template <typename EntryType>
EnumStoreT<EntryType>::Builder::~Builder() { }
-template <typename EntryType>
-void
-EnumStoreT<EntryType>::printValue(vespalib::asciistream & os, Index idx) const
-{
- os << getValue(idx);
-}
-
-template <typename EntryType>
-void
-EnumStoreT<EntryType>::printValue(vespalib::asciistream & os, Type value) const
-{
- os << value;
-}
-
-
template <class EntryType>
void
EnumStoreT<EntryType>::writeValues(BufferWriter &writer, const Index *idxs, size_t count) const
@@ -120,7 +79,6 @@ EnumStoreT<EntryType>::writeValues(BufferWriter &writer, const Index *idxs, size
}
}
-
template <class EntryType>
ssize_t
EnumStoreT<EntryType>::deserialize(const void *src, size_t available, size_t &initSpace)
@@ -461,36 +419,4 @@ EnumStoreT<EntryType>::performCompaction(uint64_t bytesNeeded, EnumIndexMap & ol
return true;
}
-
-template <typename EntryType>
-template <typename Dictionary>
-void
-EnumStoreT<EntryType>::printCurrentContent(vespalib::asciistream &os, const Dictionary &dict) const
-{
- typedef typename Dictionary::ConstIterator DictionaryConstIterator;
-
- for (DictionaryConstIterator iter = dict.begin(); iter.valid(); ++iter) {
- Index idx = iter.getKey();
- if (!this->validIndex(idx)) {
- os << "Bad entry: " << idx << '\n';
- } else {
- Entry e = this->getEntry(idx);
- this->printEntry(os, e);
- os << ", " << idx << '\n';
- }
- }
-}
-
-
-template <typename EntryType>
-void
-EnumStoreT<EntryType>::printCurrentContent(vespalib::asciistream &os) const
-{
- if (_enumDict->hasData()) {
- printCurrentContent(os, static_cast<EnumStoreDict<EnumPostingTree> *>(_enumDict)->getDictionary());
- } else {
- printCurrentContent(os, static_cast<EnumStoreDict<EnumTree> *>(_enumDict)->getDictionary());
- }
-}
-
} // namespace search
diff --git a/searchlib/src/vespa/searchlib/attribute/enumstorebase.h b/searchlib/src/vespa/searchlib/attribute/enumstorebase.h
index d8604a5a85e..1e3bfb2639d 100644
--- a/searchlib/src/vespa/searchlib/attribute/enumstorebase.h
+++ b/searchlib/src/vespa/searchlib/attribute/enumstorebase.h
@@ -271,10 +271,6 @@ protected:
public:
void reset(uint64_t initBufferSize);
- virtual uint32_t getFixedSize() const = 0;
- size_t getMaxEnumOffset() const {
- return _store.getBufferState(_store.getActiveBufferId(TYPE_ID)).size();
- }
uint32_t getRefCount(Index idx) const { return getEntryBase(idx).getRefCount(); }
uint32_t getEnum(Index idx) const { return getEntryBase(idx).getEnum(); }
void incRefCount(Index idx) { getEntryBase(idx).incRefCount(); }
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp
index 337ea2e0528..53fdf81f505 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.cpp
@@ -310,29 +310,6 @@ template <typename P, typename LoadedVector, typename LoadedValueType,
typename EnumStoreType>
void
PostingListAttributeSubBase<P, LoadedVector, LoadedValueType, EnumStoreType>::
-printPostingListContent(vespalib::asciistream & os) const
-{
- for (DictionaryIterator itr = _es.getPostingDictionary().begin();
- itr.valid(); ++itr) {
- EnumIndex enumIdx = itr.getKey();
- os << "PostingList[";
- _es.printValue(os, enumIdx);
- os << "]: {";
-
- EntryRef postIdx = itr.getData();
- PostingIterator postings = _postingList.begin(postIdx);
- for (; postings.valid(); ++postings) {
- os << postings.getKey() << ", ";
- }
- os << "}\n";
- }
-}
-
-
-template <typename P, typename LoadedVector, typename LoadedValueType,
- typename EnumStoreType>
-void
-PostingListAttributeSubBase<P, LoadedVector, LoadedValueType, EnumStoreType>::
clearPostings(attribute::IAttributeVector::EnumHandle eidx,
uint32_t fromLid,
uint32_t toLid)
diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h
index 829afeb9388..c35e02f7519 100644
--- a/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/postinglistattribute.h
@@ -106,7 +106,6 @@ public:
void handleFillPostings(LoadedVector &loaded);
void updatePostings(PostingMap &changePost) override;
- void printPostingListContent(vespalib::asciistream & os) const;
void clearPostings(attribute::IAttributeVector::EnumHandle eidx, uint32_t fromLid, uint32_t toLid) override;
};