8000 obsolete now-unused startup option (#20806) · arangodb/arangodb@781ed23 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 781ed23

Browse files
authored
obsolete now-unused startup option (#20806)
* obsolete now-unused startup option * fix compilation of test
1 parent b0b9f02 commit 781ed23

File tree

9 files changed

+11
-101
lines changed

9 files changed

+11
-101
lines changed

CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
devel
22
-----
33

4+
* Obsolete startup option `--server.max-number-detached-threads`.
5+
This option is now obsolete because coroutines are used instead of blocking
6+
function calls.
7+
48
* Log an info message if a request was queued in the scheduler queue for 30 s
59
or longer.
610

arangod/Scheduler/Scheduler.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ bool Scheduler::start() {
8585
return _cronThread->start();
8686
}
8787

88-
Result Scheduler::detachThread(uint64_t* detachedThreads,
89-
uint64_t* maximumDetachedThreads) {
90-
return {};
91-
}
92-
9388
void Scheduler::schedulerJobMemoryAccounting(std::int64_t x) noexcept {
9489
if (SchedulerFeature::SCHEDULER) {
9590
SchedulerFeature::SCHEDULER->trackQueueItemSize(x);

arangod/Scheduler/Scheduler.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ class Scheduler {
6363
// ---------------------------------------------------------------------------
6464
// Scheduling and Task Queuing - the relevant stuff
6565
// ---------------------------------------------------------------------------
66-
virtual Result detachThread(uint64_t* detachedThreads,
67-
uint64_t* maximumDetachedThreads);
68-
6966
class DelayedWorkItem;
7067
typedef std::chrono::steady_clock clock;
7168
typedef std::shared_ptr<DelayedWorkItem> WorkHandle;

arangod/Scheduler/SchedulerFeature.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -244,20 +244,13 @@ return HTTP 503 instead of HTTP 200 when their availability API is probed.)");
244244
new UInt64Parameter(&_fifo1Size),
245245
arangodb::options::makeDefaultFlags(arangodb::options::Flags::Uncommon));
246246

247-
options
248-
->addOption("--server.max-number-detached-threads",
249-
"The maximum number of detached scheduler threads.",
250-
new UInt64Parameter(&_nrMaximalDetachedThreads),
251-
arangodb::options::makeDefaultFlags(
252-
arangodb::options::Flags::Default,
253-
arangodb::options::Flags::Uncommon))
254-
.setIntroducedIn(31200)
255-
.setLongDescription(
256-
R"(If a scheduler thread performs a potentially long running operation like waiting for a lock, it can detach itself from the scheduler. This allows a new scheduler thread to be started and avoids blocking all threads with long-running operations, thereby avoiding deadlock situations. The default should normally be OK.)");
257-
258247
// obsolete options
259248
options->addObsoleteOption("--server.threads", "number of threads", true);
260249

250+
options->addObsoleteOption(
251+
"--server.max-number-detached-threads",
252+
"The maximum number of detached scheduler threads.", true);
253+
261254
// renamed options
262255
options->addOldOption("scheduler.threads", "server.maximal-threads");
263256
}
@@ -337,8 +330,7 @@ void SchedulerFeature::prepare() {
337330
auto sched = std::make_unique<SupervisedScheduler>(
338331
server(), _nrMinimalThreads, _nrMaximalThreads, _queueSize, _fifo1Size,
339332
_fifo2Size, _fifo3Size, ongoingLowPriorityLimit,
340-
_unavailabilityQueueFillGrade, _nrMaximalDetachedThreads,
341-
_metricsFeature);
333+
_unavailabilityQueueFillGrade, _metricsFeature);
342334

343335
SCHEDULER = sched.get();
344336

arangod/Scheduler/SchedulerFeature.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class SchedulerFeature final : public ArangodFeature {
6161

6262
uint64_t _nrMinimalThreads = 4;
6363
uint64_t _nrMaximalThreads = 0;
64-
uint64_t _nrMaximalDetachedThreads = 1000;
6564
uint64_t _queueSize = 4096;
6665
uint64_t _fifo1Size = 4096;
6766
uint64_t _fifo2Size = 4096;

arangod/Scheduler/SupervisedScheduler.cpp

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,7 @@ SupervisedScheduler::SupervisedScheduler(
205205
ArangodServer& server, uint64_t minThreads, uint64_t maxThreads,
206206
uint64_t maxQueueSize, uint64_t fifo1Size, uint64_t fifo2Size,
207207
uint64_t fifo3Size, uint64_t ongoingLowPriorityLimit,
208-
double unavailabilityQueueFillGrade, uint64_t maxNumberDetachedThreads,
209-
metrics::MetricsFeature& metrics)
208+
double unavailabilityQueueFillGrade, metrics::MetricsFeature& metrics)
210209
: Scheduler(server),
211210
_nf(server.getFeature<NetworkFeature>()),
212211
_sharedPRNG(server.getFeature<SharedPRNGFeature>()),
@@ -220,7 +219,6 @@ SupervisedScheduler::SupervisedScheduler(
220219
_maxNumWorkers(maxThreads),
221220
_maxFifoSizes{maxQueueSize, fifo1Size, fifo2Size, fifo3Size},
222221
_ongoingLowPriorityLimit(ongoingLowPriorityLimit),
223-
_maxNumberDetachedThreads(maxNumberDetachedThreads),
224222
_unavailabilityQueueFillGrade(unavailabilityQueueFillGrade),
225223
_numWorking(0),
226224
_numAwake(0),
@@ -493,52 +491,6 @@ void SupervisedScheduler::shutdown() {
493491
}
494492
}
495493

496-
Result SupervisedScheduler::detachThread(uint64_t* detachedThreads,
497-
uint64_t* maximumDetachedThreads) {
498-
std::lock_guard<std::mutex> guard(_mutex);
499-
if (detachedThreads != nullptr) {
500-
*detachedThreads = _numDetached;
501-
}
502-
if (maximumDetachedThreads != nullptr) {
503-
*maximumDetachedThreads = _maxNumberDetachedThreads;
504-
}
505-
// First see if we have already reached the limit:
506-
if (_numDetached >= _maxNumberDetachedThreads) {
507-
return Result(TRI_ERROR_TOO_MANY_DETACHED_THREADS);
508-
}
509-
510-
// Now we have access to the _workerStates and _detachedWorkerStates
511-
// Let's first find ourselves in the _workerStates:
512-
uint64_t myNumber = Thread::currentThreadNumber();
513-
auto it = std::find_if(
514-
_workerStates.begin(), _workerStates.end(),
515-
[&](auto const& v) { return v->_thread->threadNumber() == myNumber; });
516-
if (it == _workerStates.end()) {
517-
return Result(TRI_ERROR_INTERNAL,
518-
"scheduler thread for detaching not found");
519-
}
520-
std::shared_ptr<WorkerState> state = std::move(*it);
521-
_workerStates.erase(it);
522-
// Since the thread is effectively taken out of the pool, decrease the
523-
// number of workers.
524-
--_numWorkers;
525-
state->_stop = true; // We will be stopped after the current task is done
526-
// We know that we are working, so we do not
527-
// have to wake the thread.
528-
++_metricsThreadsStopped;
529-
try {
530-
_detachedWorkerStates.push_back(std::move(state));
531-
++_numDetached;
532-
} catch (std::exception const&) {
533-
// Ignore error here, the thread itself still holds a copy of the
534-
// shared_ptr, so cleanup is guaranteed.
535-
// But we do not want to throw here.
536-
// Note that we do not count the detached thread in `_numDetached` in
537-
// this case! This is intentional!
538-
}
539-
return {};
540-
}
541-
542494
constexpr uint64_t approxWorkerStackSize = 4'000'000; // 4 MB
543495

544496
void SupervisedScheduler::runWorker() {

arangod/Scheduler/SupervisedScheduler.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,12 @@ class SupervisedScheduler final : public Scheduler {
4848
uint64_t fifo1Size, uint64_t fifo2Size,
4949
uint64_t fifo3Size, uint64_t ongoingLowPriorityLimit,
5050
double unavailabilityQueueFillGrade,
51-
uint64_t maxNumberDetachedThreads,
5251
metrics::MetricsFeature& metrics);
5352
~SupervisedScheduler() final;
5453

5554
bool start() override;
5655
void shutdown() override;
5756

58-
/// @brief Take current thread out of the Scheduler (to finish some
59-
/// potentially long running task and allow a new thread to be started).
60-
/// This should be called from a scheduler thread. If an error is returned
61-
/// this operation has not worked. The thread can then consider to error
62-
/// out instead of starting its long running task. Note that his also
63-
/// happens if a configurable total number of detached threads has been
64-
/// reached.
65-
Result detachThread(uint64_t* detachedThreads,
66-
uint64_t* maximumDetachedThreads) override;
67-
6857
void toVelocyPack(velocypack::Builder&) const override;
6958
Scheduler::QueueStatistics queueStatistics() const override;
7059

@@ -198,7 +187,6 @@ class SupervisedScheduler final : public Scheduler {
198187
size_t const _maxNumWorkers;
199188
uint64_t const _maxFifoSizes[NumberOfQueues];
200189
uint64_t const _ongoingLowPriorityLimit;
201-
uint64_t const _maxNumberDetachedThreads;
202190

203191
/// @brief fill grade of the scheduler's queue (in %) from which onwards
204192
/// the server is considered unavailable (because of overload)

arangod/Transaction/Manager.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -894,13 +894,6 @@ futures::Future<std::shared_ptr<transaction::Context>> Manager::leaseManagedTrx(
894894
LOG_TOPIC("abd72", TRACE, Logger::TRANSACTIONS)
895895
<< "transaction " << tid << " is already in use (RO)";
896896

897-
// simon: Two allowed scenarios:
898-
// 1. User sends concurrent write (CRUD) requests, (which was never intended
899-
// to be possible)
900-
// but now we do have to kind of support it otherwise shitty apps break
901-
// 2. one does a bulk write within a el-cheapo / V8 transaction into
902-
// multiple shards
903-
// on the same DBServer (still bad design).
904897
TRI_ASSERT(endTime.time_since_epoch().count() == 0 ||
905898
!ServerState::instance()->isDBServer());
906899

tests/Cluster/RebootTrackerTest.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -136,23 +136,13 @@ class RebootTrackerTest
136136
: public ::testing::Test,
137137
public LogSuppressor<Logger::CLUSTER, LogLevel::WARN> {
138138
protected:
139-
// MSVC new/malloc only guarantees 8 byte alignment, but SupervisedScheduler
140-
// needs 64. Disable warning:
141-
#if (_MSC_VER >= 1)
142-
#pragma warning(push)
143-
#pragma warning(disable : 4316) // Object allocated on the heap may not be
144-
// aligned for this type
145-
#endif
146139
RebootTrackerTest()
147140
: mockApplicationServer(),
148141
scheduler(std::make_unique<SupervisedScheduler>(
149142
mockApplicationServer.server(), 2, 64, 128, 1024 * 1024, 4096, 4096,
150-
128, 0.0, 42,
143+
128, 0.0,
151144
mockApplicationServer.server()
152145
.template getFeature<arangodb::metrics::MetricsFeature>())) {}
153-
#if (_MSC_VER >= 1)
154-
#pragma warning(pop)
155-
#endif
156146

157147
MockRestServer mockApplicationServer;
158148
std::unique_ptr<SupervisedScheduler> scheduler;

0 commit comments

Comments
0