summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2018-06-18 11:37:55 +0200
committerHenning Baldersheim <balder@oath.com>2018-08-17 15:45:33 +0200
commit0abd5d6485862da0e787a14a308b7ddb31d9a4d1 (patch)
treee80461405ec0834896b8af182bbae7a0a563ec03
parent8b37789be022664d56246b4f2ffded69d2c404ae (diff)
Remove snapshot concept access
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/status.cpp21
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/status.h2
-rw-r--r--searchlib/src/tests/attribute/attribute_test.cpp7
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attribute_header.cpp20
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attribute_header.h3
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributefilesavetarget.cpp15
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributemanager.cpp30
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributemanager.h3
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.cpp30
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.h6
10 files changed, 28 insertions, 109 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/status.cpp b/searchcommon/src/vespa/searchcommon/attribute/status.cpp
index d6d684a9f56..da13548ec2e 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/status.cpp
+++ b/searchcommon/src/vespa/searchcommon/attribute/status.cpp
@@ -1,27 +1,8 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "status.h"
-
namespace search::attribute {
-Status::Status(const vespalib::string &)
- : _numDocs (0),
- _numValues (0),
- _numUniqueValues (0),
- _allocated (0),
- _used (0),
- _dead (0),
- _unused (0),
- _onHold (0),
- _onHoldMax (0),
- _lastSyncToken (0),
- _updates (0),
- _nonIdempotentUpdates (0),
- _bitVectors(0)
-{
-}
-
-
Status::Status()
: _numDocs (0),
_numValues (0),
@@ -39,7 +20,6 @@ Status::Status()
{
}
-
vespalib::string
Status::createName(vespalib::stringref index, vespalib::stringref attr)
{
@@ -49,7 +29,6 @@ Status::createName(vespalib::stringref index, vespalib::stringref attr)
return name;
}
-
void
Status::updateStatistics(uint64_t numValues, uint64_t numUniqueValue, uint64_t allocated,
uint64_t used, uint64_t dead, uint64_t onHold)
diff --git a/searchcommon/src/vespa/searchcommon/attribute/status.h b/searchcommon/src/vespa/searchcommon/attribute/status.h
index dc1ccc4d5d3..888355b3f58 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/status.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/status.h
@@ -9,8 +9,6 @@ namespace search::attribute {
class Status
{
public:
- // TODO: name isn't stored anywhere or used for anything
- Status(const vespalib::string &name);
Status();
void updateStatistics(uint64_t numValues, uint64_t numUniqueValue, uint64_t allocated,
diff --git a/searchlib/src/tests/attribute/attribute_test.cpp b/searchlib/src/tests/attribute/attribute_test.cpp
index 5d0c4336a34..efa6488739c 100644
--- a/searchlib/src/tests/attribute/attribute_test.cpp
+++ b/searchlib/src/tests/attribute/attribute_test.cpp
@@ -254,42 +254,35 @@ void AttributeTest::testBaseName()
{
AttributeVector::BaseName v("attr1");
EXPECT_EQUAL(v.getAttributeName(), "attr1");
- EXPECT_TRUE(v.getSnapshotName().empty());
// EXPECT_TRUE(v.getIndexName().empty());
EXPECT_EQUAL("", v.getIndexName());
EXPECT_TRUE(v.getDirName().empty());
v = "attribute/attr1/attr1";
EXPECT_EQUAL(v.getAttributeName(), "attr1");
- EXPECT_TRUE(v.getSnapshotName().empty());
// EXPECT_TRUE(v.getIndexName().empty());
EXPECT_EQUAL("", v.getIndexName());
EXPECT_EQUAL(v.getDirName(), "attribute/attr1");
v = "attribute/attr1/snapshot-X/attr1";
EXPECT_EQUAL(v.getAttributeName(), "attr1");
- EXPECT_EQUAL(v.getSnapshotName(), "snapshot-X");
// EXPECT_TRUE(v.getIndexName().empty());
EXPECT_EQUAL("", v.getIndexName());
EXPECT_EQUAL(v.getDirName(), "attribute/attr1/snapshot-X");
v = "/attribute/attr1/snapshot-X/attr1";
EXPECT_EQUAL(v.getAttributeName(), "attr1");
- EXPECT_EQUAL(v.getSnapshotName(), "snapshot-X");
// EXPECT_TRUE(v.getIndexName().empty());
EXPECT_EQUAL("", v.getIndexName());
EXPECT_EQUAL(v.getDirName(), "/attribute/attr1/snapshot-X");
v = "index.1/1.ready/attribute/attr1/snapshot-X/attr1";
EXPECT_EQUAL(v.getAttributeName(), "attr1");
- EXPECT_EQUAL(v.getSnapshotName(), "snapshot-X");
EXPECT_EQUAL(v.getIndexName(), "index.1");
EXPECT_EQUAL(v.getDirName(), "index.1/1.ready/attribute/attr1/snapshot-X");
v = "/index.1/1.ready/attribute/attr1/snapshot-X/attr1";
EXPECT_EQUAL(v.getAttributeName(), "attr1");
- EXPECT_EQUAL(v.getSnapshotName(), "snapshot-X");
EXPECT_EQUAL(v.getIndexName(), "index.1");
EXPECT_EQUAL(v.getDirName(),
"/index.1/1.ready/attribute/attr1/snapshot-X");
v = "xxxyyyy/zzz/index.1/1.ready/attribute/attr1/snapshot-X/attr1";
EXPECT_EQUAL(v.getAttributeName(), "attr1");
- EXPECT_EQUAL(v.getSnapshotName(), "snapshot-X");
EXPECT_EQUAL(v.getIndexName(), "index.1");
EXPECT_EQUAL(v.getDirName(),
"xxxyyyy/zzz/index.1/1.ready/attribute/attr1/snapshot-X");
diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_header.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_header.cpp
index 828c7c19962..b47090bfc97 100644
--- a/searchlib/src/vespa/searchlib/attribute/attribute_header.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attribute_header.cpp
@@ -39,18 +39,11 @@ AttributeHeader::AttributeHeader()
{
}
-AttributeHeader::AttributeHeader(const vespalib::string &fileName,
- attribute::BasicType basicType,
- attribute::CollectionType collectionType,
- const vespalib::eval::ValueType &tensorType,
- bool enumerated,
- const attribute::PersistentPredicateParams &predicateParams,
- uint32_t numDocs,
- uint32_t fixedWidth,
- uint64_t uniqueValueCount,
- uint64_t totalValueCount,
- uint64_t createSerialNum,
- uint32_t version)
+AttributeHeader::AttributeHeader(const vespalib::string &fileName, attribute::BasicType basicType,
+ attribute::CollectionType collectionType, const vespalib::eval::ValueType &tensorType,
+ bool enumerated, const attribute::PersistentPredicateParams &predicateParams,
+ uint32_t numDocs, uint32_t fixedWidth, uint64_t uniqueValueCount,
+ uint64_t totalValueCount, uint64_t createSerialNum, uint32_t version)
: _fileName(fileName),
_basicType(basicType),
_collectionType(collectionType),
@@ -102,7 +95,8 @@ AttributeHeader::internalExtractTags(const vespalib::GenericHeader &header)
assert(header.hasTag(predicateUpperBoundTag));
_predicateParamsSet = true;
_predicateParams.setArity(header.getTag(predicateArityTag).asInteger());
- _predicateParams.setBounds(header.getTag(predicateLowerBoundTag).asInteger(), header.getTag(predicateUpperBoundTag).asInteger());
+ _predicateParams.setBounds(header.getTag(predicateLowerBoundTag).asInteger(),
+ header.getTag(predicateUpperBoundTag).asInteger());
} else {
assert(!header.hasTag(predicateLowerBoundTag));
assert(!header.hasTag(predicateUpperBoundTag));
diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_header.h b/searchlib/src/vespa/searchlib/attribute/attribute_header.h
index 4a0b1e0bee0..a364b512d25 100644
--- a/searchlib/src/vespa/searchlib/attribute/attribute_header.h
+++ b/searchlib/src/vespa/searchlib/attribute/attribute_header.h
@@ -57,9 +57,6 @@ public:
bool hasMultiValue() const;
bool hasWeightedSetType() const;
uint32_t getNumDocs() const { return _numDocs; }
- size_t getFixedWidth() const { return _fixedWidth; }
- uint64_t getUniqueValueCount() const { return _uniqueValueCount; }
- uint64_t getTotalValueCount() const { return _totalValueCount; }
bool getEnumerated() const { return _enumerated; }
uint64_t getCreateSerialNum() const { return _createSerialNum; }
uint32_t getVersion() const { return _version; }
diff --git a/searchlib/src/vespa/searchlib/attribute/attributefilesavetarget.cpp b/searchlib/src/vespa/searchlib/attribute/attributefilesavetarget.cpp
index cd9e7547388..f57094ae592 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributefilesavetarget.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attributefilesavetarget.cpp
@@ -21,19 +21,14 @@ AttributeFileSaveTarget::
AttributeFileSaveTarget(const TuneFileAttributes &tuneFileAttributes,
const FileHeaderContext &fileHeaderContext)
: IAttributeSaveTarget(),
- _datWriter(tuneFileAttributes, fileHeaderContext, _header,
- "Attribute vector data file"),
- _idxWriter(tuneFileAttributes, fileHeaderContext, _header,
- "Attribute vector idx file"),
- _weightWriter(tuneFileAttributes, fileHeaderContext, _header,
- "Attribute vector weight file"),
- _udatWriter(tuneFileAttributes, fileHeaderContext, _header,
- "Attribute vector unique data file")
+ _datWriter(tuneFileAttributes, fileHeaderContext, _header, "Attribute vector data file"),
+ _idxWriter(tuneFileAttributes, fileHeaderContext, _header, "Attribute vector idx file"),
+ _weightWriter(tuneFileAttributes, fileHeaderContext, _header, "Attribute vector weight file"),
+ _udatWriter(tuneFileAttributes, fileHeaderContext, _header, "Attribute vector unique data file")
{
}
-AttributeFileSaveTarget::~AttributeFileSaveTarget() {
-}
+AttributeFileSaveTarget::~AttributeFileSaveTarget() = default;
bool
AttributeFileSaveTarget::setup()
diff --git a/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp b/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp
index 402824327ff..c129d23fcc5 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp
@@ -75,9 +75,7 @@ AttributeManager::AttributeManager()
_snapShot(),
_interlock(std::make_shared<attribute::Interlock>())
{
- LOG(debug,
- "New attributeManager %p",
- static_cast<const void *>(this));
+ LOG(debug, "New attributeManager %p", static_cast<const void *>(this));
}
@@ -88,10 +86,7 @@ AttributeManager::AttributeManager(const string & baseDir)
_snapShot(),
_interlock(std::make_shared<attribute::Interlock>())
{
- LOG(debug,
- "New attributeManager %p, baseDir %s",
- static_cast<const void *>(this),
- baseDir.c_str());
+ LOG(debug, "New attributeManager %p, baseDir %s", static_cast<const void *>(this), baseDir.c_str());
waitBaseDir(baseDir);
}
@@ -101,10 +96,7 @@ AttributeManager::setBaseDir(const string & base)
{
dropBaseDir(_baseDir);
_baseDir = base;
- LOG(debug,
- "attributeManager %p new baseDir %s",
- static_cast<const void *>(this),
- _baseDir.c_str());
+ LOG(debug, "attributeManager %p new baseDir %s", static_cast<const void *>(this), _baseDir.c_str());
waitBaseDir(base);
}
@@ -112,10 +104,7 @@ AttributeManager::setBaseDir(const string & base)
AttributeManager::~AttributeManager()
{
_attributes.clear();
- LOG(debug,
- "delete attributeManager %p baseDir %s",
- static_cast<const void *>(this),
- _baseDir.c_str());
+ LOG(debug, "delete attributeManager %p baseDir %s", static_cast<const void *>(this), _baseDir.c_str());
dropBaseDir(_baseDir);
}
@@ -218,9 +207,14 @@ AttributeManager::createContext() const
}
string
-AttributeManager::createBaseFileName(const string & name, bool useSnapshot) const
+AttributeManager::createBaseFileName(const string & name) const
{
- return AttributeVector::BaseName(getBaseDir(), useSnapshot ? getSnapshot().dirName : "", name);
+ vespalib::string dir = getBaseDir();
+ if ( ! getSnapshot().dirName.empty()) {
+ dir += "/";
+ dir += getSnapshot().dirName;
+ }
+ return AttributeVector::BaseName(dir, name);
}
bool
@@ -250,7 +244,7 @@ AttributeManager::addVector(const string & name, const Config & config)
}
}
if (! retval ) {
- string baseFileName = createBaseFileName(name, true);
+ string baseFileName = createBaseFileName(name);
VectorHolder vh(AttributeFactory::createAttribute(baseFileName, config));
assert(vh.get());
if (vh->load()) {
diff --git a/searchlib/src/vespa/searchlib/attribute/attributemanager.h b/searchlib/src/vespa/searchlib/attribute/attributemanager.h
index 7f3937a7721..03c72dcb5da 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributemanager.h
+++ b/searchlib/src/vespa/searchlib/attribute/attributemanager.h
@@ -49,7 +49,6 @@ public:
const Snapshot & getSnapshot() const { return _snapShot; }
const string & getBaseDir() const { return _baseDir; }
- void setSnapshot(const Snapshot &snap) { _snapShot = snap; }
void setBaseDir(const string & base);
bool hasReaders() const;
uint64_t getMemoryFootprint() const;
@@ -59,7 +58,7 @@ protected:
mutable std::mutex _loadLock;
private:
const VectorHolder * findAndLoadAttribute(const string & name) const;
- string createBaseFileName(const string & name, bool useSnapshot) const;
+ string createBaseFileName(const string & name) const;
string _baseDir;
Snapshot _snapShot;
std::shared_ptr<attribute::Interlock> _interlock;
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
index f447a3b6bf9..41e53bac5f3 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
@@ -58,19 +58,13 @@ namespace search {
IMPLEMENT_IDENTIFIABLE_ABSTRACT(AttributeVector, vespalib::Identifiable);
-AttributeVector::BaseName::BaseName(vespalib::stringref base,
- vespalib::stringref snap,
- vespalib::stringref name)
+AttributeVector::BaseName::BaseName(vespalib::stringref base, vespalib::stringref name)
: string(base),
_name(name)
{
if (!empty()) {
push_back('/');
}
- if ( ! snap.empty() ) {
- append(snap);
- push_back('/');
- }
append(name);
}
@@ -100,23 +94,6 @@ AttributeVector::BaseName::getIndexName() const
return substr(indexNamePos + 1, subDBPos - indexNamePos - 1);
}
-
-AttributeVector::BaseName::string
-AttributeVector::BaseName::getSnapshotName() const
-{
- string snapShot;
- size_t p(rfind("snapshot-"));
- if (p != string::npos) {
- string fullSnapshot(substr(p));
- p = fullSnapshot.find('/');
- if (p != string::npos) {
- snapShot = fullSnapshot.substr(0, p);
- }
- }
- return snapShot;
-}
-
-
AttributeVector::BaseName::string
AttributeVector::BaseName::createAttributeName(vespalib::stringref s)
{
@@ -165,10 +142,7 @@ AttributeVector::AttributeVector(vespalib::stringref baseFileName, const Config
_enumLock(),
_genHandler(),
_genHolder(),
- _status(Status::createName((_baseFileName.getIndexName() +
- (_baseFileName.getSnapshotName().empty() ? "" : ".") +
- _baseFileName.getSnapshotName()),
- _baseFileName.getAttributeName())),
+ _status(),
_highestValueCount(1),
_enumMax(0),
_committedDocIdLimit(0u),
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h
index a9964f209f8..57498edfde3 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.h
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h
@@ -137,13 +137,10 @@ public:
return *this;
}
- BaseName(vespalib::stringref base,
- vespalib::stringref snap,
- vespalib::stringref name);
+ BaseName(vespalib::stringref base, vespalib::stringref name);
~BaseName();
string getIndexName() const;
- string getSnapshotName() const;
const string & getAttributeName() const { return _name; }
string getDirName() const;
private:
@@ -405,7 +402,6 @@ public:
const BaseName & getBaseFileName() const { return _baseFileName; }
void setBaseFileName(vespalib::stringref name) { _baseFileName = name; }
- // Implements IAttributeVector
const vespalib::string & getName() const override final { return _baseFileName.getAttributeName(); }
bool hasArrayType() const { return _config.collectionType().isArray(); }