diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2020-11-03 15:15:20 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2020-11-03 15:59:45 +0100 |
commit | 288daaf3cee2deac1a40fc996450856ac4322396 (patch) | |
tree | abc7d4de2f89cefd2ae143f25dd9003f1531f8b3 /storage | |
parent | b5cd73513c0a8c701829edc572de5095897c818b (diff) |
Remove diskstate from vdslib.
Diffstat (limited to 'storage')
9 files changed, 7 insertions, 196 deletions
diff --git a/storage/src/tests/common/teststorageapp.cpp b/storage/src/tests/common/teststorageapp.cpp index 14f1e78f5ca..1a6201d8aa3 100644 --- a/storage/src/tests/common/teststorageapp.cpp +++ b/storage/src/tests/common/teststorageapp.cpp @@ -143,7 +143,6 @@ TestServiceLayerApp::TestServiceLayerApp(vespalib::stringref configId) _executor(vespalib::SequencedTaskExecutor::create(1)) { lib::NodeState ns(*_nodeStateUpdater.getReportedNodeState()); - ns.setDiskCount(1); _nodeStateUpdater.setReportedNodeState(ns); } @@ -156,7 +155,6 @@ TestServiceLayerApp::TestServiceLayerApp(NodeIndex index, _executor(vespalib::SequencedTaskExecutor::create(1)) { lib::NodeState ns(*_nodeStateUpdater.getReportedNodeState()); - ns.setDiskCount(1); _nodeStateUpdater.setReportedNodeState(ns); } diff --git a/storage/src/tests/distributor/bucketdbupdatertest.cpp b/storage/src/tests/distributor/bucketdbupdatertest.cpp index 4b8ea56e5ca..bfee5815649 100644 --- a/storage/src/tests/distributor/bucketdbupdatertest.cpp +++ b/storage/src/tests/distributor/bucketdbupdatertest.cpp @@ -1475,10 +1475,6 @@ TEST_F(BucketDBUpdaterTest, pending_cluster_state_send_messages) { "distributor:10 .1.s:d storage:2")); EXPECT_EQ(getNodeList({1}), - getSentNodes("distributor:2 storage:2", - "distributor:2 storage:2 .1.d:3 .1.d.1.s:d")); - - EXPECT_EQ(getNodeList({1}), getSentNodes("distributor:2 storage:2 .1.s:d", "distributor:2 storage:2 .1.d:3 .1.d.1.s:d")); @@ -1723,16 +1719,6 @@ TEST_F(BucketDBUpdaterTest, pending_cluster_state_merge) { "", "0:1,2,4,5|1:2,3,4,6|2:1,3,5,6")); - // Node came up with fewer buckets (lost disk) - EXPECT_EQ( - std::string("4:1|2:0,1|6:1,2|1:2,0|5:2|3:2,1|"), - mergeBucketLists( - lib::ClusterState("distributor:1 storage:3"), - "0:1,2,4,5|1:2,3,4,6|2:1,3,5,6", - lib::ClusterState("distributor:1 storage:3 .0.d:3 .0.d.1.s:d"), - "0:1,2") - ); - // New node came up EXPECT_EQ( std::string("4:0,1|2:0,1|6:1,2,3|1:0,2,3|5:2,0,3|3:2,1,3|"), @@ -1749,27 +1735,6 @@ TEST_F(BucketDBUpdaterTest, pending_cluster_state_merge) { "0:1,2,4,5|1:2,3,4,6|2:1,3,5,6", "0:1,2,6,8")); - // Node came up with no buckets - EXPECT_EQ( - std::string("4:1|2:1|6:1,2|1:2|5:2|3:2,1|"), - mergeBucketLists( - lib::ClusterState("distributor:1 storage:3"), - "0:1,2,4,5|1:2,3,4,6|2:1,3,5,6", - lib::ClusterState("distributor:1 storage:3 .0.d:3 .0.d.1.s:d"), - "0:") - ); - - // One node lost a disk, another was just reasked (distributor - // change) - EXPECT_EQ( - std::string("2:0,1|6:1,2|1:2,0|5:2|3:2,1|"), - mergeBucketLists( - lib::ClusterState("distributor:1 storage:3"), - "0:1,2,4,5|1:2,3,6|2:1,3,5,6", - lib::ClusterState("distributor:1 storage:3 .0.d:3 .0.d.1.s:d"), - "0:1,2|1:2,3") - ); - // Bucket info format is "bucketid/checksum/count/size" // Node went from initializing to up and invalid bucket went to empty. EXPECT_EQ( @@ -2168,14 +2133,6 @@ TEST_F(BucketDBUpdaterTest, DISABLED_cluster_config_downsize_only_sends_to_avail EXPECT_EQ((nodeVec{0, 1, 2}), getSendSet()); } -TEST_F(BucketDBUpdaterTest, changed_disk_set_triggers_re_fetch) { - // Same number of online disks, but the set of disks has changed. - EXPECT_EQ( - getNodeList({1}), - getSentNodes("distributor:2 storage:2 .1.d:3 .1.d.2.s:d", - "distributor:2 storage:2 .1.d:3 .1.d.1.s:d")); -} - /** * Test scenario where a cluster is downsized by removing a subset of the nodes * from the distribution configuration. The system must be able to deal with diff --git a/storage/src/tests/distributor/statecheckerstest.cpp b/storage/src/tests/distributor/statecheckerstest.cpp index fa7afd39cf3..cbe1c93a4ba 100644 --- a/storage/src/tests/distributor/statecheckerstest.cpp +++ b/storage/src/tests/distributor/statecheckerstest.cpp @@ -503,80 +503,6 @@ StateCheckersTest::enableInconsistentJoinInConfig(bool enabled) getConfig().configure(config); } -TEST_F(StateCheckersTest, allow_inconsistent_join_in_differing_sibling_ideal_state) { - // Normally, bucket siblings have an ideal state on the same node in order - // to enable joining these back together. However, the ideal disks assigned - // may differ and it's sufficient for a sibling bucket's ideal disk to be - // down on the node of its other sibling for it to be assigned a different - // node. In this case, there's no other way to get buckets joined back - // together than if we allow bucket replicas to get temporarily out of sync - // by _forcing_ a join across all replicas no matter their placement. - // This will trigger a merge to reconcile and move the new bucket copies to - // their ideal location. - setupDistributor(2, 3, "distributor:1 storage:3 .0.d:20 .0.d.14.s:d .2.d:20"); - document::BucketId sibling1(33, 0x000000001); // ideal disk 14 on node 0 - document::BucketId sibling2(33, 0x100000001); // ideal disk 1 on node 0 - - // Full node sequence sorted by score for sibling(1|2) is [0, 2, 1]. - // Node 0 cannot be used, so use 1 instead. - assertCurrentIdealState(sibling1, {2, 1}); - assertCurrentIdealState(sibling2, {0, 2}); - - insertBucketInfo(sibling1, 2, 0x1, 2, 3); - insertBucketInfo(sibling1, 1, 0x1, 2, 3); - insertBucketInfo(sibling2, 0, 0x1, 2, 3); - insertBucketInfo(sibling2, 2, 0x1, 2, 3); - - enableInconsistentJoinInConfig(true); - - EXPECT_EQ("BucketId(0x8000000000000001): " - "[Joining buckets BucketId(0x8400000000000001) and " - "BucketId(0x8400000100000001) because their size " - "(6 bytes, 4 docs) is less than the configured limit " - "of (100, 10)", - testJoin(10, 100, 16, sibling1)); -} - -TEST_F(StateCheckersTest, do_not_allow_inconsistent_join_when_not_in_ideal_state) { - setupDistributor(2, 4, "distributor:1 storage:4 .0.d:20 .0.d.14.s:d .2.d:20 .3.d:20"); - document::BucketId sibling1(33, 0x000000001); - document::BucketId sibling2(33, 0x100000001); - - assertCurrentIdealState(sibling1, {3, 2}); - assertCurrentIdealState(sibling2, {3, 0}); - - insertBucketInfo(sibling1, 3, 0x1, 2, 3); - insertBucketInfo(sibling1, 2, 0x1, 2, 3); - insertBucketInfo(sibling2, 3, 0x1, 2, 3); - insertBucketInfo(sibling2, 1, 0x1, 2, 3); // not in ideal state - - enableInconsistentJoinInConfig(true); - - EXPECT_EQ("NO OPERATIONS GENERATED", - testJoin(10, 100, 16, sibling1)); -} - -TEST_F(StateCheckersTest, do_not_allow_inconsistent_join_when_config_disabled) { - setupDistributor(2, 3, "distributor:1 storage:3 .0.d:20 .0.d.14.s:d .2.d:20"); - document::BucketId sibling1(33, 0x000000001); // ideal disk 14 on node 0 - document::BucketId sibling2(33, 0x100000001); // ideal disk 1 on node 0 - - // Full node sequence sorted by score for sibling(1|2) is [0, 2, 1]. - // Node 0 cannot be used, so use 1 instead. - assertCurrentIdealState(sibling1, {2, 1}); - assertCurrentIdealState(sibling2, {0, 2}); - - insertBucketInfo(sibling1, 2, 0x1, 2, 3); - insertBucketInfo(sibling1, 1, 0x1, 2, 3); - insertBucketInfo(sibling2, 0, 0x1, 2, 3); - insertBucketInfo(sibling2, 2, 0x1, 2, 3); - - enableInconsistentJoinInConfig(false); - - EXPECT_EQ("NO OPERATIONS GENERATED", - testJoin(10, 100, 16, sibling1)); -} - TEST_F(StateCheckersTest, no_join_when_invalid_copy_exists) { setupDistributor(3, 10, "distributor:1 storage:3"); diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.cpp b/storage/src/vespa/storage/storageserver/communicationmanager.cpp index 6ad2c960896..a35b9d1d59a 100644 --- a/storage/src/vespa/storage/storageserver/communicationmanager.cpp +++ b/storage/src/vespa/storage/storageserver/communicationmanager.cpp @@ -618,15 +618,13 @@ CommunicationManager::sendCommand( } void -CommunicationManager::serializeNodeState(const api::GetNodeStateReply& gns, std::ostream& os, - bool includeDescription, bool includeDiskDescription, bool useOldFormat) const +CommunicationManager::serializeNodeState(const api::GetNodeStateReply& gns, std::ostream& os, bool includeDescription) const { vespalib::asciistream tmp; if (gns.hasNodeState()) { - gns.getNodeState().serialize(tmp, "", includeDescription, includeDiskDescription, useOldFormat); + gns.getNodeState().serialize(tmp, "", includeDescription); } else { - _component.getStateUpdater().getReportedNodeState()->serialize(tmp, "", includeDescription, - includeDiskDescription, useOldFormat); + _component.getStateUpdater().getReportedNodeState()->serialize(tmp, "", includeDescription); } os << tmp.str(); } @@ -643,14 +641,14 @@ CommunicationManager::sendDirectRPCReply( } else if (requestName == "getnodestate3") { auto& gns(dynamic_cast<api::GetNodeStateReply&>(*reply)); std::ostringstream ns; - serializeNodeState(gns, ns, true, true, false); + serializeNodeState(gns, ns, true); request.addReturnString(ns.str().c_str()); request.addReturnString(gns.getNodeInfo().c_str()); LOGBP(debug, "Sending getnodestate3 reply with host info '%s'.", gns.getNodeInfo().c_str()); } else if (requestName == "getnodestate2") { auto& gns(dynamic_cast<api::GetNodeStateReply&>(*reply)); std::ostringstream ns; - serializeNodeState(gns, ns, true, true, false); + serializeNodeState(gns, ns, true); request.addReturnString(ns.str().c_str()); LOGBP(debug, "Sending getnodestate2 reply with no host info."); } else if (requestName == "setsystemstate2" || requestName == "setdistributionstates") { @@ -667,7 +665,7 @@ CommunicationManager::sendDirectRPCReply( if (reply->getType() == api::MessageType::GETNODESTATE_REPLY) { api::GetNodeStateReply& gns(static_cast<api::GetNodeStateReply&>(*reply)); std::ostringstream ns; - serializeNodeState(gns, ns, false, false, true); + serializeNodeState(gns, ns, false); request.addReturnString(ns.str().c_str()); request.addReturnInt(static_cast<int>(gns.getNodeState().getInitProgress().getValue() * 100)); } diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.h b/storage/src/vespa/storage/storageserver/communicationmanager.h index b10b12f404e..7227f1d7e5b 100644 --- a/storage/src/vespa/storage/storageserver/communicationmanager.h +++ b/storage/src/vespa/storage/storageserver/communicationmanager.h @@ -103,8 +103,7 @@ private: void fail_with_unresolvable_bucket_space(std::unique_ptr<documentapi::DocumentMessage> msg, const vespalib::string& error_message); - void serializeNodeState(const api::GetNodeStateReply& gns, std::ostream& os, bool includeDescription, - bool includeDiskDescription, bool useOldFormat) const; + void serializeNodeState(const api::GetNodeStateReply& gns, std::ostream& os, bool includeDescription) const; static const uint64_t FORWARDED_MESSAGE = 0; diff --git a/storage/src/vespa/storage/storageserver/servicelayernode.cpp b/storage/src/vespa/storage/storageserver/servicelayernode.cpp index 1c8fdd4178d..72f2c4b3700 100644 --- a/storage/src/vespa/storage/storageserver/servicelayernode.cpp +++ b/storage/src/vespa/storage/storageserver/servicelayernode.cpp @@ -105,20 +105,9 @@ ServiceLayerNode::initializeNodeSpecific() // node state. NodeStateUpdater::Lock::SP lock(_component->getStateUpdater().grabStateChangeLock()); lib::NodeState ns(*_component->getStateUpdater().getReportedNodeState()); - ns.setDiskCount(1u); ns.setCapacity(_serverConfig->nodeCapacity); ns.setReliability(_serverConfig->nodeReliability); - for (uint16_t i=0; i<_serverConfig->diskCapacity.size(); ++i) { - if (i >= ns.getDiskCount()) { - LOG(warning, "Capacity configured for partition %zu but only %u partitions found.", - _serverConfig->diskCapacity.size(), ns.getDiskCount()); - continue; - } - lib::DiskState ds(ns.getDiskState(i)); - ds.setCapacity(_serverConfig->diskCapacity[i]); - ns.setDiskState(i, ds); - } LOG(debug, "Adjusting reported node state to include partition count and states, capacity and reliability: %s", ns.toString().c_str()); _component->getStateUpdater().setReportedNodeState(ns); @@ -147,18 +136,6 @@ ServiceLayerNode::handleLiveConfigUpdate(const InitialGuard & initGuard) ASSIGN(nodeCapacity); ns.setCapacity(newC.nodeCapacity); } - if (DIFFER(diskCapacity)) { - for (uint32_t i=0; i<newC.diskCapacity.size() && i<ns.getDiskCount(); ++i) { - if (newC.diskCapacity[i] != oldC.diskCapacity[i]) { - lib::DiskState ds(ns.getDiskState(i)); - ds.setCapacity(newC.diskCapacity[i]); - ns.setDiskState(i, ds); - LOG(info, "Live config update: Disk capacity of disk %u changed from %f to %f.", - i, oldC.diskCapacity[i], newC.diskCapacity[i]); - } - } - ASSIGN(diskCapacity); - } if (DIFFER(nodeReliability)) { LOG(info, "Live config update: Node reliability changed from %u to %u.", oldC.nodeReliability, newC.nodeReliability); diff --git a/storage/src/vespa/storage/storageserver/statemanager.cpp b/storage/src/vespa/storage/storageserver/statemanager.cpp index a041ab0cfff..653822626ed 100644 --- a/storage/src/vespa/storage/storageserver/statemanager.cpp +++ b/storage/src/vespa/storage/storageserver/statemanager.cpp @@ -253,15 +253,6 @@ StateManager::setReportedNodeState(const lib::NodeState& state) "grabbed external lock"); assert(false); } - if (_nodeState->getDiskCount() != 0 && - state.getDiskCount() != _nodeState->getDiskCount()) - { - std::ostringstream ost; - ost << "Illegal to alter disk count after initialization. Tried to " - << "alter disk count from " << _nodeState->getDiskCount() - << " to " << state.getDiskCount(); - throw vespalib::IllegalArgumentException(ost.str(), VESPA_STRLOC); - } LOG(debug, "Adjusting reported node state to %s -> %s", _nodeState->toString().c_str(), state.toString().c_str()); _nextNodeState = std::make_shared<lib::NodeState>(state); diff --git a/storage/src/vespa/storage/storageserver/storagenode.cpp b/storage/src/vespa/storage/storageserver/storagenode.cpp index cb9d5730fa8..afe21733a10 100644 --- a/storage/src/vespa/storage/storageserver/storagenode.cpp +++ b/storage/src/vespa/storage/storageserver/storagenode.cpp @@ -60,18 +60,6 @@ namespace { } } - -bool -allDisksDown(const lib::NodeState &nodeState) -{ - for (uint32_t i = 0; i < nodeState.getDiskCount(); ++i) { - if (nodeState.getDiskState(i).getState() != lib::State::DOWN) - return false; - } - return true; -} - - } // End of anonymous namespace StorageNode::StorageNode( @@ -599,28 +587,6 @@ StorageNode::requestShutdown(vespalib::stringref reason) _attemptedStopped = true; } -void -StorageNode::notifyPartitionDown(int partId, vespalib::stringref reason) -{ - if (!_component) - return; - NodeStateUpdater::Lock::SP lock(_component->getStateUpdater().grabStateChangeLock()); - lib::NodeState nodeState(*_component->getStateUpdater().getReportedNodeState()); - if (partId >= nodeState.getDiskCount()) - return; - lib::DiskState diskState(nodeState.getDiskState(partId)); - if (diskState.getState() == lib::State::DOWN) - return; - diskState.setState(lib::State::DOWN); - diskState.setDescription(reason); - nodeState.setDiskState(partId, diskState); - if (allDisksDown(nodeState)) { - nodeState.setState(lib::State::DOWN); - nodeState.setDescription("All partitions are down"); - } - _component->getStateUpdater().setReportedNodeState(nodeState); -} - std::unique_ptr<StateManager> StorageNode::releaseStateManager() { return std::move(_stateManager); diff --git a/storage/src/vespa/storage/storageserver/storagenode.h b/storage/src/vespa/storage/storageserver/storagenode.h index a0997c4bacd..9450cdce5ff 100644 --- a/storage/src/vespa/storage/storageserver/storagenode.h +++ b/storage/src/vespa/storage/storageserver/storagenode.h @@ -91,7 +91,6 @@ public: */ virtual ResumeGuard pause() = 0; void requestShutdown(vespalib::stringref reason) override; - void notifyPartitionDown(int partId, vespalib::stringref reason); DoneInitializeHandler& getDoneInitializeHandler() { return *this; } // For testing |