diff options
author | Harald Musum <musum@verizonmedia.com> | 2020-06-15 22:00:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-15 22:00:45 +0200 |
commit | 39d7728ad2efcf72bffa02b7e0d03bbe672ced1d (patch) | |
tree | d88684a09c7bb3155896aee3dfc595477b4ac6e9 /searchcommon | |
parent | ba5d6c161d9d4ff9bd3a3f8237102a688558febe (diff) |
Revert "Two phase put in attribute writer"
Diffstat (limited to 'searchcommon')
5 files changed, 14 insertions, 65 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/hnsw_index_params.h b/searchcommon/src/vespa/searchcommon/attribute/hnsw_index_params.h index c8b196023d6..3e3683ce60f 100644 --- a/searchcommon/src/vespa/searchcommon/attribute/hnsw_index_params.h +++ b/searchcommon/src/vespa/searchcommon/attribute/hnsw_index_params.h @@ -16,29 +16,24 @@ private: uint32_t _neighbors_to_explore_at_insert; // This is always the same as in the attribute config, and is duplicated here to simplify usage. DistanceMetric _distance_metric; - bool _allow_multi_threaded_indexing; public: HnswIndexParams(uint32_t max_links_per_node_in, uint32_t neighbors_to_explore_at_insert_in, - DistanceMetric distance_metric_in, - bool allow_multi_threaded_indexing_in = false) + DistanceMetric distance_metric_in) : _max_links_per_node(max_links_per_node_in), _neighbors_to_explore_at_insert(neighbors_to_explore_at_insert_in), - _distance_metric(distance_metric_in), - _allow_multi_threaded_indexing(allow_multi_threaded_indexing_in) + _distance_metric(distance_metric_in) {} uint32_t max_links_per_node() const { return _max_links_per_node; } uint32_t neighbors_to_explore_at_insert() const { return _neighbors_to_explore_at_insert; } DistanceMetric distance_metric() const { return _distance_metric; } - bool allow_multi_threaded_indexing() const { return _allow_multi_threaded_indexing; } bool operator==(const HnswIndexParams& rhs) const { return (_max_links_per_node == rhs._max_links_per_node && _neighbors_to_explore_at_insert == rhs._neighbors_to_explore_at_insert && - _distance_metric == rhs._distance_metric && - _allow_multi_threaded_indexing == rhs._allow_multi_threaded_indexing); + _distance_metric == rhs._distance_metric); } }; diff --git a/searchcommon/src/vespa/searchcommon/attribute/status.cpp b/searchcommon/src/vespa/searchcommon/attribute/status.cpp index f2bb49c348a..da13548ec2e 100644 --- a/searchcommon/src/vespa/searchcommon/attribute/status.cpp +++ b/searchcommon/src/vespa/searchcommon/attribute/status.cpp @@ -20,42 +20,6 @@ Status::Status() { } -Status::Status(const Status& rhs) - : _numDocs(rhs._numDocs), - _numValues(rhs._numValues), - _numUniqueValues(rhs._numUniqueValues), - _allocated(rhs._allocated), - _used(rhs._used), - _dead(rhs._dead), - _unused(rhs._unused), - _onHold(rhs._onHold), - _onHoldMax(rhs._onHoldMax), - _lastSyncToken(rhs.getLastSyncToken()), - _updates(rhs._updates), - _nonIdempotentUpdates(rhs._nonIdempotentUpdates), - _bitVectors(rhs._bitVectors) -{ -} - -Status& -Status::operator=(const Status& rhs) -{ - _numDocs = rhs._numDocs; - _numValues = rhs._numValues; - _numUniqueValues = rhs._numUniqueValues; - _allocated = rhs._allocated; - _used = rhs._used; - _dead = rhs._dead; - _unused = rhs._unused; - _onHold = rhs._onHold; - _onHoldMax = rhs._onHoldMax; - setLastSyncToken(rhs.getLastSyncToken()); - _updates = rhs._updates; - _nonIdempotentUpdates = rhs._nonIdempotentUpdates; - _bitVectors = rhs._bitVectors; - return *this; -} - vespalib::string Status::createName(vespalib::stringref index, vespalib::stringref attr) { diff --git a/searchcommon/src/vespa/searchcommon/attribute/status.h b/searchcommon/src/vespa/searchcommon/attribute/status.h index a624309da65..888355b3f58 100644 --- a/searchcommon/src/vespa/searchcommon/attribute/status.h +++ b/searchcommon/src/vespa/searchcommon/attribute/status.h @@ -3,7 +3,6 @@ #pragma once #include <vespa/vespalib/stllike/string.h> -#include <atomic> namespace search::attribute { @@ -11,8 +10,6 @@ class Status { public: Status(); - Status(const Status& rhs); - Status& operator=(const Status& rhs); void updateStatistics(uint64_t numValues, uint64_t numUniqueValue, uint64_t allocated, uint64_t used, uint64_t dead, uint64_t onHold); @@ -25,15 +22,14 @@ public: uint64_t getDead() const { return _dead; } uint64_t getOnHold() const { return _onHold; } uint64_t getOnHoldMax() const { return _onHoldMax; } - // This might be accessed from other threads than the writer thread. - uint64_t getLastSyncToken() const { return _lastSyncToken.load(std::memory_order_relaxed); } + uint64_t getLastSyncToken() const { return _lastSyncToken; } uint64_t getUpdateCount() const { return _updates; } uint64_t getNonIdempotentUpdateCount() const { return _nonIdempotentUpdates; } uint32_t getBitVectors() const { return _bitVectors; } void setNumDocs(uint64_t v) { _numDocs = v; } void incNumDocs() { ++_numDocs; } - void setLastSyncToken(uint64_t v) { _lastSyncToken.store(v, std::memory_order_relaxed); } + void setLastSyncToken(uint64_t v) { _lastSyncToken = v; } void incUpdates(uint64_t v=1) { _updates += v; } void incNonIdempotentUpdates(uint64_t v = 1) { _nonIdempotentUpdates += v; } void incBitVectors() { ++_bitVectors; } @@ -51,7 +47,7 @@ private: uint64_t _unused; uint64_t _onHold; uint64_t _onHoldMax; - std::atomic<uint64_t> _lastSyncToken; + uint64_t _lastSyncToken; uint64_t _updates; uint64_t _nonIdempotentUpdates; uint32_t _bitVectors; diff --git a/searchcommon/src/vespa/searchcommon/common/schema.cpp b/searchcommon/src/vespa/searchcommon/common/schema.cpp index c59edbef22f..a21cc43572e 100644 --- a/searchcommon/src/vespa/searchcommon/common/schema.cpp +++ b/searchcommon/src/vespa/searchcommon/common/schema.cpp @@ -70,20 +70,16 @@ namespace index { const uint32_t Schema::UNKNOWN_FIELD_ID(std::numeric_limits<uint32_t>::max()); Schema::Field::Field(vespalib::stringref n, DataType dt) - : Field(n, dt, schema::CollectionType::SINGLE, "") + : _name(n), + _dataType(dt), + _collectionType(schema::CollectionType::SINGLE) { } Schema::Field::Field(vespalib::stringref n, DataType dt, CollectionType ct) - : Field(n, dt, ct, "") -{ -} - -Schema::Field::Field(vespalib::stringref n, DataType dt, CollectionType ct, vespalib::stringref tensor_spec) : _name(n), _dataType(dt), - _collectionType(ct), - _tensor_spec(tensor_spec) + _collectionType(ct) { } @@ -115,14 +111,15 @@ Schema::Field::operator==(const Field &rhs) const { return _name == rhs._name && _dataType == rhs._dataType && - _collectionType == rhs._collectionType && - _tensor_spec == rhs._tensor_spec; + _collectionType == rhs._collectionType; } bool Schema::Field::operator!=(const Field &rhs) const { - return !((*this) == rhs); + return _name != rhs._name || + _dataType != rhs._dataType || + _collectionType != rhs._collectionType; } Schema::IndexField::IndexField(vespalib::stringref name, DataType dt) diff --git a/searchcommon/src/vespa/searchcommon/common/schema.h b/searchcommon/src/vespa/searchcommon/common/schema.h index 9003578adaf..e17d219d7e8 100644 --- a/searchcommon/src/vespa/searchcommon/common/schema.h +++ b/searchcommon/src/vespa/searchcommon/common/schema.h @@ -35,12 +35,10 @@ public: vespalib::string _name; DataType _dataType; CollectionType _collectionType; - vespalib::string _tensor_spec; public: Field(vespalib::stringref n, DataType dt); Field(vespalib::stringref n, DataType dt, CollectionType ct); - Field(vespalib::stringref n, DataType dt, CollectionType ct, vespalib::stringref tensor_spec); /** * Create this field based on the given config lines. @@ -60,7 +58,6 @@ public: const vespalib::string &getName() const { return _name; } DataType getDataType() const { return _dataType; } CollectionType getCollectionType() const { return _collectionType; } - const vespalib::string& get_tensor_spec() const { return _tensor_spec; } bool matchingTypes(const Field &rhs) const { return getDataType() == rhs.getDataType() && |