diff options
27 files changed, 102 insertions, 78 deletions
diff --git a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/rpc/SlobrokClient.java b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/rpc/SlobrokClient.java index 8649e7cc11a..e180016f286 100644 --- a/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/rpc/SlobrokClient.java +++ b/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/rpc/SlobrokClient.java @@ -53,6 +53,7 @@ public class SlobrokClient implements NodeLookup { this.connectionSpecs = slobrokConnectionSpecs; shutdown(); supervisor = new Supervisor(new Transport("slobrok-client")); + supervisor.useSmallBuffers(); SlobrokList slist = new SlobrokList(); slist.setup(slobrokConnectionSpecs); mirror = new Mirror(supervisor, slist); diff --git a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/ExternPolicy.java b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/ExternPolicy.java index 030a0d2588c..94dfabb2c4f 100755 --- a/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/ExternPolicy.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/ExternPolicy.java @@ -59,6 +59,7 @@ public class ExternPolicy implements DocumentProtocolRoutingPolicy { pattern = args[1]; session = pattern.substring(pos); orb = new Supervisor(new Transport("externpolicy")); + orb.useSmallBuffers(); mirror = new Mirror(orb, slobroks); error = null; } diff --git a/eval/src/apps/tensor_conformance/generate.cpp b/eval/src/apps/tensor_conformance/generate.cpp index 3c2a9b12272..9ae33c1234f 100644 --- a/eval/src/apps/tensor_conformance/generate.cpp +++ b/eval/src/apps/tensor_conformance/generate.cpp @@ -436,9 +436,9 @@ void generate_converting_lambda(TestBuilder &dst) { auto sparse = GenSpec::from_desc("y5_2"); auto mixed = GenSpec::from_desc("x3y5_2"); // change cell type and dimension types - dst.add_ignore_java("tensor<bfloat16>(x[5])(a{x:(x)})", {{"a", dense}}); - dst.add_ignore_java("tensor<bfloat16>(y[10])(a{y:(y)})", {{"a", sparse}}); - dst.add_ignore_java("tensor<bfloat16>(x[5],y[10])(a{x:(x),y:(y)})", {{"a", mixed}}); + dst.add("tensor<bfloat16>(x[5])(a{x:(x)})", {{"a", dense}}); + dst.add("tensor<bfloat16>(y[10])(a{y:(y)})", {{"a", sparse}}); + dst.add("tensor<bfloat16>(x[5],y[10])(a{x:(x),y:(y)})", {{"a", mixed}}); } //----------------------------------------------------------------------------- @@ -492,12 +492,12 @@ void generate_nan_existence(TestBuilder &dst) { const vespalib::string inner_expr = "f(x,y)(if(isNan(x),11,x)+if(isNan(y),22,y))"; vespalib::string merge_expr = fmt("merge(a,b,%s)", inner_expr.c_str()); vespalib::string join_expr = fmt("join(a,b,%s)", inner_expr.c_str()); - dst.add_ignore_java(merge_expr, {{"a", sparse1}, {"b", sparse2}}); - dst.add_ignore_java(merge_expr, {{"a", mixed1}, {"b", mixed2}}); - dst.add_ignore_java(join_expr, {{"a", sparse1}, {"b", sparse2}}); - dst.add_ignore_java(join_expr, {{"a", mixed1}, {"b", mixed2}}); - dst.add_ignore_java(join_expr, {{"a", sparse1}, {"b", mixed2}}); - dst.add_ignore_java(join_expr, {{"a", mixed1}, {"b", sparse2}}); + dst.add(merge_expr, {{"a", sparse1}, {"b", sparse2}}); + dst.add(merge_expr, {{"a", mixed1}, {"b", mixed2}}); + dst.add(join_expr, {{"a", sparse1}, {"b", sparse2}}); + dst.add(join_expr, {{"a", mixed1}, {"b", mixed2}}); + dst.add(join_expr, {{"a", sparse1}, {"b", mixed2}}); + dst.add(join_expr, {{"a", mixed1}, {"b", sparse2}}); } //----------------------------------------------------------------------------- diff --git a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java index 24da45a231b..a88d6515fcc 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java @@ -138,8 +138,8 @@ public class Flags { ZONE_ID, APPLICATION_ID); public static final UnboundIntFlag MAX_PENDING_MOVE_OPS = defineIntFlag( - "max-pending-move-ops", 10, - List.of("baldersheim"), "2021-02-15", "2021-05-01", + "max-pending-move-ops", 100, + List.of("baldersheim"), "2021-02-15", "2021-06-01", "Max number of move operations inflight", "Takes effect at redeployment", ZONE_ID, APPLICATION_ID); @@ -152,15 +152,15 @@ public class Flags { ZONE_ID, APPLICATION_ID); public static final UnboundBooleanFlag USE_BUCKET_EXECUTOR_FOR_LID_SPACE_COMPACT = defineFeatureFlag( - "use-bucket-executor-for-lid-space-compact", false, - List.of("baldersheim"), "2021-01-24", "2021-05-01", + "use-bucket-executor-for-lid-space-compact", true, + List.of("baldersheim"), "2021-01-24", "2021-06-01", "Wheter to use content-level bucket executor or legacy frozen buckets", "Takes effect on next internal redeployment", APPLICATION_ID); public static final UnboundBooleanFlag USE_BUCKET_EXECUTOR_FOR_BUCKET_MOVE = defineFeatureFlag( - "use-bucket-executor-for-bucket-move", false, - List.of("baldersheim"), "2021-02-15", "2021-05-01", + "use-bucket-executor-for-bucket-move", true, + List.of("baldersheim"), "2021-02-15", "2021-06-01", "Wheter to use content-level bucket executor or legacy frozen buckets", "Takes effect on next internal redeployment", APPLICATION_ID); @@ -180,8 +180,8 @@ public class Flags { ZONE_ID, APPLICATION_ID); public static final UnboundDoubleFlag MAX_DEAD_BYTES_RATIO = defineDoubleFlag( - "max-dead-bytes-ratio", 0.15, - List.of("baldersheim", "geirst","toregge"), "2021-02-03", "2021-05-01", + "max-dead-bytes-ratio", 0.05, + List.of("baldersheim", "geirst","toregge"), "2021-02-03", "2021-06-01", "max ratio of dead to used memory bytes in large data structures before compaction is attempted", "Takes effect at redeployment", ZONE_ID, APPLICATION_ID); diff --git a/jrt/src/com/yahoo/jrt/slobrok/api/Mirror.java b/jrt/src/com/yahoo/jrt/slobrok/api/Mirror.java index 6e39e2a3dbd..996459dc5db 100644 --- a/jrt/src/com/yahoo/jrt/slobrok/api/Mirror.java +++ b/jrt/src/com/yahoo/jrt/slobrok/api/Mirror.java @@ -58,7 +58,6 @@ public class Mirror implements IMirror { **/ public Mirror(Supervisor orb, SlobrokList slobroks, BackOffPolicy bop) { this.orb = orb; - orb.useSmallBuffers(); this.slobroks = slobroks; this.backOff = bop; transportThread = orb.transport().selectThread(); diff --git a/searchcommon/src/vespa/searchcommon/common/compaction_strategy.h b/searchcommon/src/vespa/searchcommon/common/compaction_strategy.h index 1c680d91da7..1d52e4bf659 100644 --- a/searchcommon/src/vespa/searchcommon/common/compaction_strategy.h +++ b/searchcommon/src/vespa/searchcommon/common/compaction_strategy.h @@ -16,7 +16,7 @@ private: double _maxDeadAddressSpaceRatio; // Max ratio of dead address space before compaction public: CompactionStrategy() noexcept - : _maxDeadBytesRatio(0.15), + : _maxDeadBytesRatio(0.05), _maxDeadAddressSpaceRatio(0.2) { } diff --git a/searchcore/src/vespa/searchcore/config/proton.def b/searchcore/src/vespa/searchcore/config/proton.def index ec7752368e9..050930352b7 100644 --- a/searchcore/src/vespa/searchcore/config/proton.def +++ b/searchcore/src/vespa/searchcore/config/proton.def @@ -319,7 +319,7 @@ documentdb[].allocation.amortizecount int default=10000 documentdb[].allocation.multivaluegrowfactor double default=0.2 ## The ratio of used bytes that can be dead before attempting to perform compaction. -documentdb[].allocation.max_dead_bytes_ratio double default=0.15 +documentdb[].allocation.max_dead_bytes_ratio double default=0.05 ## The ratio of used address space that can be dead before attempting to perform compaction. documentdb[].allocation.max_dead_address_space_ratio double default=0.2 @@ -413,13 +413,13 @@ lidspacecompaction.removebatchblockrate double default=0.5 lidspacecompaction.removeblockrate double default=100.0 ## Set to true to enable bucket locking via content layer -lidspacecompaction.usebucketexecutor bool default=false +lidspacecompaction.usebucketexecutor bool default=true ## Maximum docs to move in single operation per bucket bucketmove.maxdocstomoveperbucket int default=1 ## Set to true to enable bucket locking via content layer -bucketmove.usebucketexecutor bool default=false +bucketmove.usebucketexecutor bool default=true ## This is the maximum value visibilitydelay you can have. ## A to higher value here will cost more memory while not improving too much. @@ -515,7 +515,7 @@ maintenancejobs.resourcelimitfactor double default = 1.05 ## ## The job is unblocked (and executed again) when this goes under the limit again. ## Currently used by 'lid_space_compaction' job. -maintenancejobs.maxoutstandingmoveops int default=10 +maintenancejobs.maxoutstandingmoveops int default=100 ## Controls the type of bucket checksum used. Do not change unless ## in depth understanding is present. diff --git a/service-monitor/src/main/java/com/yahoo/vespa/service/slobrok/SlobrokMonitor.java b/service-monitor/src/main/java/com/yahoo/vespa/service/slobrok/SlobrokMonitor.java index 62f39084272..3ba505d0ab4 100644 --- a/service-monitor/src/main/java/com/yahoo/vespa/service/slobrok/SlobrokMonitor.java +++ b/service-monitor/src/main/java/com/yahoo/vespa/service/slobrok/SlobrokMonitor.java @@ -12,7 +12,6 @@ import com.yahoo.jrt.slobrok.api.Mirror; import com.yahoo.jrt.slobrok.api.SlobrokList; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -26,8 +25,12 @@ public class SlobrokMonitor implements AutoCloseable { private final SlobrokList slobrokList; private final Mirror mirror; - SlobrokMonitor() { - this(new SlobrokList()); + SlobrokMonitor(Supervisor supervisor) { + this(new SlobrokList(), supervisor); + } + + private SlobrokMonitor(SlobrokList slobrokList, Supervisor supervisor) { + this(slobrokList, new Mirror(supervisor, slobrokList)); } // Package-private for testing. @@ -36,10 +39,6 @@ public class SlobrokMonitor implements AutoCloseable { this.mirror = mirror; } - private SlobrokMonitor(SlobrokList slobrokList) { - this(slobrokList, new Mirror(new Supervisor(new Transport("slobrok-monitor")), slobrokList)); - } - void updateSlobrokList(ApplicationInfo application) { List<String> slobrokSpecs = getSlobrokSpecs(application); slobrokList.setup(slobrokSpecs.toArray(new String[0])); diff --git a/service-monitor/src/main/java/com/yahoo/vespa/service/slobrok/SlobrokMonitorManagerImpl.java b/service-monitor/src/main/java/com/yahoo/vespa/service/slobrok/SlobrokMonitorManagerImpl.java index 2cc3359d449..0c9148ad834 100644 --- a/service-monitor/src/main/java/com/yahoo/vespa/service/slobrok/SlobrokMonitorManagerImpl.java +++ b/service-monitor/src/main/java/com/yahoo/vespa/service/slobrok/SlobrokMonitorManagerImpl.java @@ -2,8 +2,11 @@ package com.yahoo.vespa.service.slobrok; import com.google.inject.Inject; +import com.yahoo.component.AbstractComponent; import com.yahoo.config.model.api.ApplicationInfo; import com.yahoo.config.provision.ApplicationId; +import com.yahoo.jrt.Supervisor; +import com.yahoo.jrt.Transport; import com.yahoo.jrt.slobrok.api.Mirror; import java.util.logging.Level; import com.yahoo.vespa.applicationmodel.ClusterId; @@ -21,7 +24,7 @@ import java.util.Optional; import java.util.function.Supplier; import java.util.logging.Logger; -public class SlobrokMonitorManagerImpl implements SlobrokApi, MonitorManager { +public class SlobrokMonitorManagerImpl extends AbstractComponent implements SlobrokApi, MonitorManager { private static final Logger logger = Logger.getLogger(SlobrokMonitorManagerImpl.class.getName()); @@ -30,14 +33,29 @@ public class SlobrokMonitorManagerImpl implements SlobrokApi, MonitorManager { private final Object monitor = new Object(); private final HashMap<ApplicationId, SlobrokMonitor> slobrokMonitors = new HashMap<>(); private final DuperModelManager duperModel; + private final Transport transport; + + private static int getTransportThreadCount() { + return Math.max(4, Runtime.getRuntime().availableProcessors()); + } @Inject public SlobrokMonitorManagerImpl(DuperModelManager duperModel) { - this(SlobrokMonitor::new, duperModel); + this(new Transport("slobrok-monitor", getTransportThreadCount() / 4), duperModel); } - SlobrokMonitorManagerImpl(Supplier<SlobrokMonitor> slobrokMonitorFactory, DuperModelManager duperModel) { + private SlobrokMonitorManagerImpl(Transport transport, DuperModelManager duperModel) { + this(transport, new Supervisor(transport), duperModel); + } + + private SlobrokMonitorManagerImpl(Transport transport, Supervisor orb, DuperModelManager duperModel) { + this(() -> new SlobrokMonitor(orb), transport, duperModel); + orb.useSmallBuffers(); + } + + SlobrokMonitorManagerImpl(Supplier<SlobrokMonitor> slobrokMonitorFactory, Transport transport, DuperModelManager duperModel) { this.slobrokMonitorFactory = slobrokMonitorFactory; + this.transport = transport; this.duperModel = duperModel; } @@ -77,6 +95,11 @@ public class SlobrokMonitorManagerImpl implements SlobrokApi, MonitorManager { } @Override + public void deconstruct() { + transport.shutdown().join(); + } + + @Override public List<Mirror.Entry> lookup(ApplicationId id, String pattern) { synchronized (monitor) { SlobrokMonitor slobrokMonitor = slobrokMonitors.get(id); diff --git a/service-monitor/src/test/java/com/yahoo/vespa/service/slobrok/SlobrokMonitorManagerImplTest.java b/service-monitor/src/test/java/com/yahoo/vespa/service/slobrok/SlobrokMonitorManagerImplTest.java index eca7d695be6..8fabb385bb2 100644 --- a/service-monitor/src/test/java/com/yahoo/vespa/service/slobrok/SlobrokMonitorManagerImplTest.java +++ b/service-monitor/src/test/java/com/yahoo/vespa/service/slobrok/SlobrokMonitorManagerImplTest.java @@ -3,6 +3,7 @@ package com.yahoo.vespa.service.slobrok; import com.yahoo.config.model.api.ApplicationInfo; import com.yahoo.config.provision.ApplicationId; +import com.yahoo.jrt.Transport; import com.yahoo.vespa.applicationmodel.ClusterId; import com.yahoo.vespa.applicationmodel.ConfigId; import com.yahoo.vespa.applicationmodel.ServiceStatus; @@ -28,7 +29,7 @@ public class SlobrokMonitorManagerImplTest { private final DuperModelManager duperModelManager = mock(DuperModelManager.class); private final SlobrokMonitorManagerImpl slobrokMonitorManager = - new SlobrokMonitorManagerImpl(slobrokMonitorFactory, duperModelManager); + new SlobrokMonitorManagerImpl(slobrokMonitorFactory, mock(Transport.class), duperModelManager); private final SlobrokMonitor slobrokMonitor = mock(SlobrokMonitor.class); private final ApplicationId applicationId = ApplicationId.from("tenant", "app", "instance"); private final ApplicationInfo application = mock(ApplicationInfo.class); diff --git a/service-monitor/src/test/java/com/yahoo/vespa/service/slobrok/SlobrokMonitorTest.java b/service-monitor/src/test/java/com/yahoo/vespa/service/slobrok/SlobrokMonitorTest.java index 8bec3bf6cd8..7757aed8ac7 100644 --- a/service-monitor/src/test/java/com/yahoo/vespa/service/slobrok/SlobrokMonitorTest.java +++ b/service-monitor/src/test/java/com/yahoo/vespa/service/slobrok/SlobrokMonitorTest.java @@ -14,7 +14,7 @@ import static org.mockito.Mockito.verify; public class SlobrokMonitorTest { private final SlobrokList slobrokList = mock(SlobrokList.class); private final Mirror mirror = mock(Mirror.class); - private SlobrokMonitor slobrokMonitor = new SlobrokMonitor(slobrokList, mirror); + private final SlobrokMonitor slobrokMonitor = new SlobrokMonitor(slobrokList, mirror); @Test public void testUpdateSlobrokList() { diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp index 3af39bd6797..ee36259bdd3 100644 --- a/storage/src/vespa/storage/distributor/bucketdbupdater.cpp +++ b/storage/src/vespa/storage/distributor/bucketdbupdater.cpp @@ -108,7 +108,7 @@ BucketDBUpdater::remove_superfluous_buckets( const lib::ClusterStateBundle& new_state, bool is_distribution_config_change) { - const char* up_states = _op_ctx.storage_node_up_states(); + const char* up_states = storage_node_up_states(); // TODO STRIPE explicit space -> config mapping, don't get via repo // ... but we need to get the current cluster state per space..! for (auto& elem : _op_ctx.bucket_space_repo()) { @@ -189,7 +189,7 @@ BucketDBUpdater::storage_distribution_changed(const BucketSpaceDistributionConfi auto clusterInfo = std::make_shared<const SimpleClusterInformation>( _node_ctx.node_index(), _active_state_bundle, - _op_ctx.storage_node_up_states()); + storage_node_up_states()); _pending_cluster_state = PendingClusterState::createForDistributionChange( _node_ctx.clock(), std::move(clusterInfo), @@ -246,7 +246,7 @@ BucketDBUpdater::onSetSystemState( auto clusterInfo = std::make_shared<const SimpleClusterInformation>( _node_ctx.node_index(), _active_state_bundle, - _op_ctx.storage_node_up_states()); + storage_node_up_states()); _pending_cluster_state = PendingClusterState::createForClusterStateChange( _node_ctx.clock(), std::move(clusterInfo), diff --git a/storage/src/vespa/storage/distributor/distributor_bucket_space.cpp b/storage/src/vespa/storage/distributor/distributor_bucket_space.cpp index 9ec4d31eb32..37e7dc86e43 100644 --- a/storage/src/vespa/storage/distributor/distributor_bucket_space.cpp +++ b/storage/src/vespa/storage/distributor/distributor_bucket_space.cpp @@ -22,8 +22,8 @@ DistributorBucketSpace::DistributorBucketSpace() { } -DistributorBucketSpace::DistributorBucketSpace(uint16_t node_index) - : _bucketDatabase(std::make_unique<BTreeBucketDatabase>()), +DistributorBucketSpace::DistributorBucketSpace(uint16_t node_index, bool use_bucket_db) + : _bucketDatabase(use_bucket_db ? std::make_unique<BTreeBucketDatabase>() : std::unique_ptr<BTreeBucketDatabase>()), _clusterState(), _distribution(), _node_index(node_index), diff --git a/storage/src/vespa/storage/distributor/distributor_bucket_space.h b/storage/src/vespa/storage/distributor/distributor_bucket_space.h index 558cbada31f..8898039eb02 100644 --- a/storage/src/vespa/storage/distributor/distributor_bucket_space.h +++ b/storage/src/vespa/storage/distributor/distributor_bucket_space.h @@ -47,7 +47,8 @@ class DistributorBucketSpace { bool owns_bucket_in_state(const lib::Distribution& distribution, const lib::ClusterState& cluster_state, document::BucketId bucket) const; public: explicit DistributorBucketSpace(); - explicit DistributorBucketSpace(uint16_t node_index); + // TODO STRIPE: Remove the use_bucket_db parameter when legacy mode is gone. + explicit DistributorBucketSpace(uint16_t node_index, bool use_bucket_db = true); ~DistributorBucketSpace(); DistributorBucketSpace(const DistributorBucketSpace&) = delete; @@ -56,9 +57,11 @@ public: DistributorBucketSpace& operator=(DistributorBucketSpace&&) = delete; BucketDatabase& getBucketDatabase() noexcept { + assert(_bucketDatabase); return *_bucketDatabase; } const BucketDatabase& getBucketDatabase() const noexcept { + assert(_bucketDatabase); return *_bucketDatabase; } diff --git a/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.cpp b/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.cpp index 4f64dab9a68..368483d3f2d 100644 --- a/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.cpp +++ b/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.cpp @@ -13,11 +13,11 @@ using document::BucketSpace; namespace storage::distributor { -DistributorBucketSpaceRepo::DistributorBucketSpaceRepo(uint16_t node_index) +DistributorBucketSpaceRepo::DistributorBucketSpaceRepo(uint16_t node_index, bool use_bucket_db) : _map() { - add(document::FixedBucketSpaces::default_space(), std::make_unique<DistributorBucketSpace>(node_index)); - add(document::FixedBucketSpaces::global_space(), std::make_unique<DistributorBucketSpace>(node_index)); + add(document::FixedBucketSpaces::default_space(), std::make_unique<DistributorBucketSpace>(node_index, use_bucket_db)); + add(document::FixedBucketSpaces::global_space(), std::make_unique<DistributorBucketSpace>(node_index, use_bucket_db)); } DistributorBucketSpaceRepo::~DistributorBucketSpaceRepo() = default; diff --git a/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.h b/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.h index f012b25e351..e7552f058d8 100644 --- a/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.h +++ b/storage/src/vespa/storage/distributor/distributor_bucket_space_repo.h @@ -19,7 +19,8 @@ private: BucketSpaceMap _map; public: - explicit DistributorBucketSpaceRepo(uint16_t node_index); + // TODO STRIPE: Remove the use_bucket_db parameter when legacy mode is gone. + explicit DistributorBucketSpaceRepo(uint16_t node_index, bool use_bucket_db = true); ~DistributorBucketSpaceRepo(); DistributorBucketSpaceRepo(const DistributorBucketSpaceRepo&&) = delete; diff --git a/storage/src/vespa/storage/distributor/distributor_component.cpp b/storage/src/vespa/storage/distributor/distributor_component.cpp index 05a605fbcae..e01d7e7cb6d 100644 --- a/storage/src/vespa/storage/distributor/distributor_component.cpp +++ b/storage/src/vespa/storage/distributor/distributor_component.cpp @@ -11,8 +11,8 @@ DistributorComponent::DistributorComponent(DistributorInterface& distributor, const std::string& name) : storage::DistributorComponent(comp_reg, name), _distributor(distributor), - _bucket_space_repo(std::make_unique<DistributorBucketSpaceRepo>(node_index())), - _read_only_bucket_space_repo(std::make_unique<DistributorBucketSpaceRepo>(node_index())) + _bucket_space_repo(std::make_unique<DistributorBucketSpaceRepo>(node_index(), false)), + _read_only_bucket_space_repo(std::make_unique<DistributorBucketSpaceRepo>(node_index(), false)) { } diff --git a/storage/src/vespa/storage/distributor/distributor_component.h b/storage/src/vespa/storage/distributor/distributor_component.h index 8db70f490ba..e01efeddf3f 100644 --- a/storage/src/vespa/storage/distributor/distributor_component.h +++ b/storage/src/vespa/storage/distributor/distributor_component.h @@ -22,8 +22,8 @@ class DistributorComponent : public storage::DistributorComponent, public DistributorOperationContext { private: DistributorInterface& _distributor; - // TODO STRIPE: These bucket space repos are only temporary until we get an interface - // to look at state per bucket space. + // TODO STRIPE: When legacy mode is removed, replace this with mapping from BucketSpace to struct with + // lib::ClusterState and lib::Distribution (need by BucketDBUpdater). std::unique_ptr<DistributorBucketSpaceRepo> _bucket_space_repo; std::unique_ptr<DistributorBucketSpaceRepo> _read_only_bucket_space_repo; @@ -61,10 +61,7 @@ public: const storage::DistributorConfiguration& distributor_config() const noexcept override { return _distributor.config(); } - const char* storage_node_up_states() const override { - // TODO STRIPE: Move to a common place. - return "uri"; - } + }; diff --git a/storage/src/vespa/storage/distributor/distributor_operation_context.h b/storage/src/vespa/storage/distributor/distributor_operation_context.h index 470a2f0f788..aa598835cdb 100644 --- a/storage/src/vespa/storage/distributor/distributor_operation_context.h +++ b/storage/src/vespa/storage/distributor/distributor_operation_context.h @@ -2,6 +2,7 @@ #pragma once +#include "storage_node_up_states.h" #include <vespa/storageapi/defs.h> namespace storage { class DistributorConfiguration; } @@ -24,9 +25,6 @@ public: virtual const DistributorBucketSpaceRepo& read_only_bucket_space_repo() const noexcept = 0; virtual DistributorBucketSpaceRepo& read_only_bucket_space_repo() noexcept = 0; virtual const DistributorConfiguration& distributor_config() const noexcept = 0; - - // TODO STRIPE: Move to a common place. - virtual const char* storage_node_up_states() const = 0; }; } diff --git a/storage/src/vespa/storage/distributor/distributor_stripe.cpp b/storage/src/vespa/storage/distributor/distributor_stripe.cpp index 03f3a181a48..1f6a5b318fd 100644 --- a/storage/src/vespa/storage/distributor/distributor_stripe.cpp +++ b/storage/src/vespa/storage/distributor/distributor_stripe.cpp @@ -295,7 +295,7 @@ DistributorStripe::enableClusterStateBundle(const lib::ClusterStateBundle& state const uint16_t new_node_count = baseline_state.getNodeCount(lib::NodeType::STORAGE); for (uint16_t i = 0; i < std::max(old_node_count, new_node_count); ++i) { const auto& node_state = baseline_state.getNodeState(lib::Node(lib::NodeType::STORAGE, i)).getState(); - if (!node_state.oneOf(getStorageNodeUpStates())) { + if (!node_state.oneOf(storage_node_up_states())) { std::vector<uint64_t> msgIds = _pendingMessageTracker.clearMessagesForNode(i); LOG(debug, "Node %u is down, clearing %zu pending maintenance operations", i, msgIds.size()); diff --git a/storage/src/vespa/storage/distributor/distributor_stripe.h b/storage/src/vespa/storage/distributor/distributor_stripe.h index 1885fa79341..7b34367cecb 100644 --- a/storage/src/vespa/storage/distributor/distributor_stripe.h +++ b/storage/src/vespa/storage/distributor/distributor_stripe.h @@ -133,14 +133,6 @@ public: const lib::ClusterStateBundle& getClusterStateBundle() const override; /** - * @return Returns the states in which the distributors consider - * storage nodes to be up. - */ - const char* getStorageNodeUpStates() const override { - return "uri"; - } - - /** * Called by bucket db updater after a merge has finished, and all the * request bucket info operations have been performed as well. Passes the * merge back to the operation that created it. diff --git a/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp b/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp index 8302e0d9684..59029dec66a 100644 --- a/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp +++ b/storage/src/vespa/storage/distributor/distributor_stripe_component.cpp @@ -49,7 +49,7 @@ DistributorStripeComponent::enumerateUnavailableNodes( const document::Bucket& bucket, const std::vector<BucketCopy>& candidates) const { - const auto* up_states = _distributor.getStorageNodeUpStates(); + const auto* up_states = storage_node_up_states(); for (uint32_t i = 0; i < candidates.size(); ++i) { const BucketCopy& copy(candidates[i]); const lib::NodeState& ns( @@ -273,7 +273,7 @@ DistributorStripeComponent::storage_node_is_up(document::BucketSpace bucket_spac const lib::NodeState& ns = cluster_state_bundle().getDerivedClusterState(bucket_space)->getNodeState( lib::Node(lib::NodeType::STORAGE, node_index)); - return ns.getState().oneOf(_distributor.getStorageNodeUpStates()); + return ns.getState().oneOf(storage_node_up_states()); } std::unique_ptr<document::select::Node> diff --git a/storage/src/vespa/storage/distributor/distributor_stripe_component.h b/storage/src/vespa/storage/distributor/distributor_stripe_component.h index 38fcb4ffef3..48aef90be8a 100644 --- a/storage/src/vespa/storage/distributor/distributor_stripe_component.h +++ b/storage/src/vespa/storage/distributor/distributor_stripe_component.h @@ -158,10 +158,6 @@ public: */ bool storage_node_is_up(document::BucketSpace bucket_space, uint32_t node_index) const override; - const char* storage_node_up_states() const override { - return getDistributor().getStorageNodeUpStates(); - } - // Implements DocumentSelectionParser std::unique_ptr<document::select::Node> parse_selection(const vespalib::string& selection) const override; diff --git a/storage/src/vespa/storage/distributor/distributor_stripe_interface.h b/storage/src/vespa/storage/distributor/distributor_stripe_interface.h index 2f0b74c8a30..bd9a4e1de57 100644 --- a/storage/src/vespa/storage/distributor/distributor_stripe_interface.h +++ b/storage/src/vespa/storage/distributor/distributor_stripe_interface.h @@ -59,7 +59,6 @@ public: */ virtual bool initializing() const = 0; virtual void handleCompletedMerge(const std::shared_ptr<api::MergeBucketReply>&) = 0; - virtual const char* getStorageNodeUpStates() const = 0; virtual const DistributorConfiguration& getConfig() const = 0; virtual ChainedMessageSender& getMessageSender() = 0; virtual const BucketGcTimeCalculator::BucketIdHasher& getBucketIdHasher() const = 0; diff --git a/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp index 1bf81278918..111400f176a 100644 --- a/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/putoperation.cpp @@ -156,7 +156,7 @@ bool PutOperation::has_unavailable_targets_in_pending_state(const OperationTarge if (!pending_state) { return false; } - const char* up_states = _op_ctx.storage_node_up_states(); + const char* up_states = storage_node_up_states(); return std::any_of(targets.begin(), targets.end(), [pending_state, up_states](const auto& target){ return !pending_state->getNodeState(target.getNode()).getState().oneOf(up_states); }); @@ -176,7 +176,7 @@ PutOperation::onStart(DistributorStripeMessageSender& sender) bool up = false; for (uint16_t i = 0; i < systemState.getNodeCount(lib::NodeType::STORAGE); i++) { if (systemState.getNodeState(lib::Node(lib::NodeType::STORAGE, i)) - .getState().oneOf(_op_ctx.storage_node_up_states())) + .getState().oneOf(storage_node_up_states())) { up = true; } diff --git a/storage/src/vespa/storage/distributor/storage_node_up_states.h b/storage/src/vespa/storage/distributor/storage_node_up_states.h new file mode 100644 index 00000000000..a68b275e31d --- /dev/null +++ b/storage/src/vespa/storage/distributor/storage_node_up_states.h @@ -0,0 +1,14 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +namespace storage::distributor { + +/** + * Returns the states in which the distributors consider storage nodes to be up. + */ +constexpr const char* storage_node_up_states() noexcept { + return "uri"; +} + +} diff --git a/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp b/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp index 61ff11d5ac3..8c24effa616 100644 --- a/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp +++ b/storage/src/vespa/storage/distributor/stripe_bucket_db_updater.cpp @@ -225,7 +225,7 @@ StripeBucketDBUpdater::removeSuperfluousBuckets( { assert(_use_legacy_mode); const bool move_to_read_only_db = shouldDeferStateEnabling(); - const char* up_states = _op_ctx.storage_node_up_states(); + const char* up_states = storage_node_up_states(); for (auto& elem : _op_ctx.bucket_space_repo()) { const auto& newDistribution(elem.second->getDistribution()); const auto& oldClusterState(elem.second->getClusterState()); @@ -273,7 +273,7 @@ StripeBucketDBUpdater::remove_superfluous_buckets( assert(!_use_legacy_mode); (void)is_distribution_change; // TODO remove if not needed const bool move_to_read_only_db = shouldDeferStateEnabling(); - const char* up_states = _op_ctx.storage_node_up_states(); + const char* up_states = storage_node_up_states(); auto& s = _op_ctx.bucket_space_repo().get(bucket_space); const auto& new_distribution = s.getDistribution(); @@ -377,7 +377,7 @@ StripeBucketDBUpdater::storageDistributionChanged() auto clusterInfo = std::make_shared<const SimpleClusterInformation>( _node_ctx.node_index(), _op_ctx.cluster_state_bundle(), - _op_ctx.storage_node_up_states()); + storage_node_up_states()); _pendingClusterState = PendingClusterState::createForDistributionChange( _node_ctx.clock(), std::move(clusterInfo), @@ -489,7 +489,7 @@ StripeBucketDBUpdater::onSetSystemState( auto clusterInfo = std::make_shared<const SimpleClusterInformation>( _node_ctx.node_index(), _op_ctx.cluster_state_bundle(), - _op_ctx.storage_node_up_states()); + storage_node_up_states()); _pendingClusterState = PendingClusterState::createForClusterStateChange( _node_ctx.clock(), std::move(clusterInfo), |