From 9dcc7aff17ad85e0417b30efd12de07d27502f26 Mon Sep 17 00:00:00 2001 From: Akrama Baig Mirza Date: Fri, 8 Nov 2024 11:05:27 -0800 Subject: [PATCH] Remove InternalPriorityRequestPile Summary: InternalPriorityRequestPile is no longer used, lets delete it. Reviewed By: robertroeser Differential Revision: D65558490 fbshipit-source-id: fd4ed8d9cd239e69f41ac5c368331ab02285134a --- .../thrift/src/thrift/lib/cpp2/CMakeLists.txt | 1 - .../server/InternalPriorityRequestPile.cpp | 81 ------------------- .../cpp2/server/InternalPriorityRequestPile.h | 47 ----------- .../thrift/lib/cpp2/server/ThriftServer.cpp | 1 - 4 files changed, 130 deletions(-) delete mode 100644 third-party/thrift/src/thrift/lib/cpp2/server/InternalPriorityRequestPile.cpp delete mode 100644 third-party/thrift/src/thrift/lib/cpp2/server/InternalPriorityRequestPile.h diff --git a/third-party/thrift/src/thrift/lib/cpp2/CMakeLists.txt b/third-party/thrift/src/thrift/lib/cpp2/CMakeLists.txt index 92c91c8bd9ccf7..f6d5959d75bfad 100644 --- a/third-party/thrift/src/thrift/lib/cpp2/CMakeLists.txt +++ b/third-party/thrift/src/thrift/lib/cpp2/CMakeLists.txt @@ -260,7 +260,6 @@ add_library( server/Cpp2Worker.cpp server/CPUConcurrencyController.cpp server/IOUringUtil.cpp - server/InternalPriorityRequestPile.cpp server/LegacyHeaderRoutingHandler.cpp server/LoggingEvent.cpp server/LoggingEventHelper.cpp diff --git a/third-party/thrift/src/thrift/lib/cpp2/server/InternalPriorityRequestPile.cpp b/third-party/thrift/src/thrift/lib/cpp2/server/InternalPriorityRequestPile.cpp deleted file mode 100644 index da4aa21a70d9ab..00000000000000 --- a/third-party/thrift/src/thrift/lib/cpp2/server/InternalPriorityRequestPile.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include - -namespace apache::thrift { - -InternalPriorityRequestPile::InternalPriorityRequestPile(Options opts) - : RequestPileBase(opts.name), loPriPile_{opts}, highPriPile_{opts} {} - -std::optional InternalPriorityRequestPile::enqueue( - ServerRequest&& request) { - if (detail::ServerRequestHelper::internalPriority(request) == - folly::Executor::LO_PRI) { - return loPriPile_.enqueue(std::move(request)); - } else { - return highPriPile_.enqueue(std::move(request)); - } -} - -std::optional InternalPriorityRequestPile::dequeue() { - if (auto req = highPriPile_.dequeue()) { - return req; - } - return loPriPile_.dequeue(); -} - -uint64_t InternalPriorityRequestPile::requestCount() const { - return loPriPile_.requestCount() + highPriPile_.requestCount(); -} - -std::string InternalPriorityRequestPile::describe() const { - std::string result = fmt::format( - "InternalPriorityRequestPile LO_PRI:{} HIGH_PRI:{}\n", - loPriPile_.describe(), - highPriPile_.describe()); - return result; -} - -serverdbginfo::RequestPileDbgInfo InternalPriorityRequestPile::getDbgInfo() - const { - serverdbginfo::RequestPileDbgInfo info; - info.name() = folly::demangle(typeid(*this)); - - auto loPriPileInfo = loPriPile_.getDbgInfo(); - auto hiPriPileInfo = loPriPile_.getDbgInfo(); - - info.prioritiesCount() = - *loPriPileInfo.prioritiesCount() + *hiPriPileInfo.prioritiesCount(); - - info.bucketsPerPriority()->insert( - info.bucketsPerPriority()->end(), - (*loPriPileInfo.bucketsPerPriority()).begin(), - (*loPriPileInfo.bucketsPerPriority()).end()); - - info.bucketsPerPriority()->insert( - info.bucketsPerPriority()->end(), - (*hiPriPileInfo.bucketsPerPriority()).begin(), - (*hiPriPileInfo.bucketsPerPriority()).end()); - - info.perBucketRequestLimit() = std::max( - *loPriPileInfo.perBucketRequestLimit(), - *hiPriPileInfo.perBucketRequestLimit()); - - return info; -} - -} // namespace apache::thrift diff --git a/third-party/thrift/src/thrift/lib/cpp2/server/InternalPriorityRequestPile.h b/third-party/thrift/src/thrift/lib/cpp2/server/InternalPriorityRequestPile.h deleted file mode 100644 index d18a313682f81a..00000000000000 --- a/third-party/thrift/src/thrift/lib/cpp2/server/InternalPriorityRequestPile.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include - -namespace apache::thrift { - -class InternalPriorityRequestPile : public RequestPileBase { - public: - using Options = RoundRobinRequestPile::Options; - explicit InternalPriorityRequestPile(Options opts); - - ~InternalPriorityRequestPile() override = default; - - std::optional enqueue( - ServerRequest&& request) override; - - std::optional dequeue() override; - - uint64_t requestCount() const override; - - void onRequestFinished(ServerRequestData&) override {} - - std::string describe() const override; - - serverdbginfo::RequestPileDbgInfo getDbgInfo() const override; - - private: - RoundRobinRequestPile loPriPile_, highPriPile_; -}; - -} // namespace apache::thrift diff --git a/third-party/thrift/src/thrift/lib/cpp2/server/ThriftServer.cpp b/third-party/thrift/src/thrift/lib/cpp2/server/ThriftServer.cpp index 548846a6f3e68f..1b08bb82626089 100644 --- a/third-party/thrift/src/thrift/lib/cpp2/server/ThriftServer.cpp +++ b/third-party/thrift/src/thrift/lib/cpp2/server/ThriftServer.cpp @@ -54,7 +54,6 @@ #include #include #include -#include #include #include #include