Skip to content

Commit 148b2b0

Browse files
committed
Merge remote-tracking branch 'upstream/main' into useNanoTimeMore
# Conflicts: # core/src/main/java/org/apache/accumulo/core/util/OpTimer.java
2 parents d917013 + 3e6c5be commit 148b2b0

File tree

302 files changed

+10690
-2791
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+10690
-2791
lines changed

NOTICE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Apache Accumulo
2-
Copyright 2011-2023 The Apache Software Foundation
2+
Copyright 2011-2024 The Apache Software Foundation
33

44
This product includes software developed at
55
The Apache Software Foundation (https://www.apache.org/).

assemble/bin/accumulo-cluster

+185-24
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,20 @@ function print_usage {
2323
Usage: accumulo-cluster <command> (<argument> ...)
2424
2525
Commands:
26-
create-config Creates cluster config
27-
restart Restarts the Accumulo cluster
28-
start Starts Accumulo cluster
29-
stop Stops Accumulo cluster
30-
kill Kills Accumulo cluster
31-
start-non-tservers Starts all services except tservers
32-
start-tservers Starts all tservers on cluster
33-
stop-tservers Stops all tservers on cluster
34-
start-here Starts all services on this node
35-
stop-here Stops all services on this node
26+
create-config Creates cluster config
27+
restart Restarts the Accumulo cluster
28+
start Starts Accumulo cluster
29+
stop Stops Accumulo cluster
30+
kill Kills Accumulo cluster
31+
start-non-tservers Deprecated. Starts all services except tservers
32+
start-servers [--all|--tservers|--no-tservers|--sservers [group]|--compactors [queue]]
33+
Starts various server types, can optionally specify a queue or group
34+
stop-servers [--all|--tservers| --no-tservers|--sservers [group]|--compactors [queue]]
35+
Starts various server types, can optionally specify a queue or group
36+
start-tservers Deprecated. Starts all tservers on cluster
37+
stop-tservers Deprecated. Stops all tservers on cluster
38+
start-here Starts all services on this node
39+
stop-here Stops all services on this node
3640
EOF
3741
}
3842

@@ -107,15 +111,19 @@ function parse_config {
107111
echo "INFO: ${NUM_TSERVERS} tservers will be started per host"
108112
fi
109113

110-
# shellcheck disable=SC2153
111-
if [[ -z $NUM_SSERVERS ]]; then
112-
echo "INFO: ${NUM_SSERVERS} sservers will be started per host"
113-
fi
114-
115-
if [[ -z $NUM_COMPACTORS ]]; then
116-
echo "INFO: ${NUM_COMPACTORS} compactors will be started per host"
117-
fi
114+
for group in $SSERVER_GROUPS; do
115+
var_name="NUM_SSERVERS_${group}"
116+
if [[ -n ${!var_name} ]]; then
117+
echo "INFO: ${!var_name} scan servers will be started per host for group ${group}"
118+
fi
119+
done
118120

121+
for queue in $COMPACTION_QUEUES; do
122+
var_name="NUM_COMPACTORS_${queue}"
123+
if [[ -n ${!var_name} ]]; then
124+
echo "INFO: ${!var_name} compactors will be started per host for queue ${queue}"
125+
fi
126+
done
119127
}
120128

121129
function control_service() {
@@ -130,10 +138,10 @@ function control_service() {
130138
[[ $service == "compactor" ]] && last_instance_id=${NUM_COMPACTORS:-1}
131139

132140
for ((inst_id = 1; inst_id <= last_instance_id; inst_id++)); do
141+
# Only increment the service name when more than one service is desired.
133142
ACCUMULO_SERVICE_INSTANCE=""
134-
[[ $service == "tserver" && ${NUM_TSERVERS:-1} -gt 1 ]] && ACCUMULO_SERVICE_INSTANCE=${inst_id}
135-
[[ $service == "compactor" ]] && ACCUMULO_SERVICE_INSTANCE="${inst_id}_${5}"
136-
[[ $service == "sserver" ]] && ACCUMULO_SERVICE_INSTANCE="${inst_id}_${5}"
143+
[[ last_instance_id -gt 1 ]] && ACCUMULO_SERVICE_INSTANCE="${inst_id}"
144+
[[ $service =~ ^compactor|sserver$ ]] && ACCUMULO_SERVICE_INSTANCE="${ACCUMULO_SERVICE_INSTANCE}_${5}"
137145

138146
if [[ $host == localhost || $host == "$(hostname -s)" || $host == "$(hostname -f)" || "$(hostname -I)" =~ $host ]]; then
139147
#
@@ -160,6 +168,90 @@ function start_service() {
160168
control_service start "$@"
161169
}
162170

171+
function start_compactors() {
172+
echo -n "Starting compactor servers ..."
173+
queues=$COMPACTION_QUEUES
174+
if [[ -n $1 ]]; then
175+
queues="$1"
176+
echo "Only starting servers for group: ${queues}"
177+
fi
178+
for queue in $queues; do
179+
var_name="NUM_COMPACTORS_${queue}"
180+
[[ -n ${!var_name} ]] && NUM_COMPACTORS=${!var_name}
181+
Q="COMPACTOR_HOSTS_${queue}"
182+
if [[ -n ${!Q} ]]; then
183+
for compactor in ${!Q}; do
184+
start_service "$compactor" compactor "-o" "compactor.queue=$queue"
185+
done
186+
else
187+
echo "${queue} is not a valid queue ...exiting"
188+
fi
189+
done
190+
}
191+
192+
function stop_compactors() {
193+
echo "Stopping compactor servers ..."
194+
queues=$COMPACTION_QUEUES
195+
if [[ -n $1 ]]; then
196+
queues="$1"
197+
echo "Only stopping servers for group: ${queues}"
198+
fi
199+
for queue in $queues; do
200+
var_name="NUM_COMPACTORS_${queue}"
201+
[[ -n ${!var_name} ]] && NUM_COMPACTORS=${!var_name}
202+
Q="COMPACTOR_HOSTS_${queue}"
203+
if [[ -n ${!Q} ]]; then
204+
for compactor in ${!Q}; do
205+
stop_service "$compactor" compactor "-o" "compactor.queue=$queue"
206+
done
207+
else
208+
echo "${queue} is not a valid compaction queue ...exiting"
209+
fi
210+
done
211+
}
212+
213+
function start_sservers() {
214+
echo "Starting scan servers ..."
215+
groups=$SSERVER_GROUPS
216+
if [[ -n $1 ]]; then
217+
groups="$1"
218+
echo "Only starting servers for group: ${groups}"
219+
fi
220+
for group in $groups; do
221+
var_name="NUM_SSERVERS_${group}"
222+
[[ -n ${!var_name} ]] && NUM_SSERVERS=${!var_name}
223+
G="SSERVER_HOSTS_${group}"
224+
if [[ -n ${!G} ]]; then
225+
for sserver in ${!G}; do
226+
start_service "$sserver" sserver "-o" "sserver.group=$group"
227+
done
228+
else
229+
echo "${group} is not a valid resource group ...exiting"
230+
fi
231+
done
232+
}
233+
234+
function stop_sservers() {
235+
echo "Stopping scan servers ..."
236+
groups=$SSERVER_GROUPS
237+
if [[ -n $1 ]]; then
238+
groups="$1"
239+
echo "Only stopping servers for group: ${groups}"
240+
fi
241+
for group in $groups; do
242+
var_name="NUM_SSERVERS_${group}"
243+
[[ -n ${!var_name} ]] && NUM_SSERVERS=${!var_name}
244+
G="SSERVER_HOSTS_${group}"
245+
if [[ -n ${!G} ]]; then
246+
for sserver in ${!G}; do
247+
stop_service "$sserver" sserver "-o" "sserver.group=$group"
248+
done
249+
else
250+
echo "${group} is not a valid resource group ...exiting"
251+
fi
252+
done
253+
}
254+
163255
function start_tservers() {
164256
echo -n "Starting tablet servers ..."
165257
count=1
@@ -194,6 +286,8 @@ function start_all() {
194286
done
195287

196288
for group in $SSERVER_GROUPS; do
289+
var_name="NUM_SSERVERS_${group}"
290+
[[ -n ${!var_name} ]] && NUM_SSERVERS=${!var_name}
197291
G="SSERVER_HOSTS_${group}"
198292
for sserver in ${!G}; do
199293
start_service "$sserver" sserver "-o" "sserver.group=$group"
@@ -205,6 +299,8 @@ function start_all() {
205299
done
206300

207301
for queue in $COMPACTION_QUEUES; do
302+
var_name="NUM_COMPACTORS_${queue}"
303+
[[ -n ${!var_name} ]] && NUM_COMPACTORS=${!var_name}
208304
Q="COMPACTOR_HOSTS_${queue}"
209305
for compactor in ${!Q}; do
210306
start_service "$compactor" compactor "-o" "compactor.queue=$queue"
@@ -254,6 +350,8 @@ function start_here() {
254350
done
255351

256352
for group in $SSERVER_GROUPS; do
353+
var_name="NUM_SSERVERS_${group}"
354+
[[ -n ${!var_name} ]] && NUM_SSERVERS=${!var_name}
257355
for host in $local_hosts; do
258356
G="SSERVER_HOSTS_${group}"
259357
for sserver in ${!G}; do
@@ -274,6 +372,8 @@ function start_here() {
274372

275373
for queue in $COMPACTION_QUEUES; do
276374
for host in $local_hosts; do
375+
var_name="NUM_COMPACTORS_${queue}"
376+
[[ -n ${!var_name} ]] && NUM_COMPACTORS=${!var_name}
277377
Q="COMPACTOR_HOSTS_${queue}"
278378
for compactor in ${!Q}; do
279379
if echo "$compactor" | grep -q "^${host}\$"; then
@@ -331,6 +431,8 @@ function kill_all() {
331431
done
332432

333433
for group in $SSERVER_GROUPS; do
434+
var_name="NUM_SSERVERS_${group}"
435+
[[ -n ${!var_name} ]] && NUM_SSERVERS=${!var_name}
334436
G="SSERVER_HOSTS_${group}"
335437
for sserver in ${!G}; do
336438
kill_service "$sserver" sserver "-o" "sserver.group=$group"
@@ -346,6 +448,8 @@ function kill_all() {
346448
done
347449

348450
for queue in $COMPACTION_QUEUES; do
451+
var_name="NUM_COMPACTORS_${queue}"
452+
[[ -n ${!var_name} ]] && NUM_COMPACTORS=${!var_name}
349453
Q="COMPACTOR_HOSTS_${queue}"
350454
for compactor in ${!Q}; do
351455
kill_service "$compactor" compactor "-o" "compactor.queue=$queue"
@@ -387,6 +491,8 @@ function stop_all() {
387491
done
388492

389493
for group in $SSERVER_GROUPS; do
494+
var_name="NUM_SSERVERS_${group}"
495+
[[ -n ${!var_name} ]] && NUM_SSERVERS=${!var_name}
390496
G="SSERVER_HOSTS_${group}"
391497
for sserver in ${!G}; do
392498
end_service $end_cmd "$sserver" sserver "-o" "sserver.group=$group"
@@ -398,6 +504,8 @@ function stop_all() {
398504
done
399505

400506
for queue in $COMPACTION_QUEUES; do
507+
var_name="NUM_COMPACTORS_${queue}"
508+
[[ -n ${!var_name} ]] && NUM_COMPACTORS=${!var_name}
401509
Q="COMPACTOR_HOSTS_${queue}"
402510
for compactor in ${!Q}; do
403511
end_service $end_cmd "$compactor" compactor "-o" "compactor.queue=$queue"
@@ -435,12 +543,16 @@ function stop_here() {
435543
end_service $end_cmd "$host" $svc
436544
done
437545
for group in $SSERVER_GROUPS; do
546+
var_name="NUM_SSERVERS_${group}"
547+
[[ -n ${!var_name} ]] && NUM_SSERVERS=${!var_name}
438548
G="SSERVER_HOSTS_${group}"
439549
for sserver in ${!G}; do
440550
end_service $end_cmd "$sserver" sserver "-o" "sserver.group=$group"
441551
done
442552
done
443553
for queue in $COMPACTION_QUEUES; do
554+
var_name="NUM_COMPACTORS_${queue}"
555+
[[ -n ${!var_name} ]] && NUM_COMPACTORS=${!var_name}
444556
Q="COMPACTOR_HOSTS_${queue}"
445557
for compactor in ${!Q}; do
446558
end_service $end_cmd "$host" compactor "-o" "compactor.queue=$queue"
@@ -473,7 +585,7 @@ function main() {
473585
case "$1" in
474586
create-config)
475587
if [[ -f "$conf"/cluster.yaml ]]; then
476-
echo "ERROR : $conf/cluster.yaml already exists, not overwriting"
588+
echo "ERROR : ${conf}/cluster.yaml already exists, not overwriting"
477589
exit 1
478590
fi
479591
cat <<EOF >"$conf"/cluster.yaml
@@ -512,8 +624,11 @@ tserver:
512624
# compactors_per_host.
513625
#
514626
tservers_per_host: 1
515-
sservers_per_host: 1
516-
compactors_per_host: 1
627+
#sservers_per_host:
628+
# - default: 1
629+
#compactors_per_host:
630+
# - q1: 1
631+
# - q2: 1
517632
518633
EOF
519634
;;
@@ -537,10 +652,12 @@ EOF
537652
kill_all
538653
;;
539654
start-non-tservers)
655+
echo "$1 is deprecated. Please use \`start-servers --no-tservers\` instead"
540656
parse_config
541657
start_all --no-tservers
542658
;;
543659
start-tservers)
660+
echo "$1 is deprecated. Please use \`start-servers --tservers\` instead"
544661
parse_config
545662
start_tservers
546663
;;
@@ -549,13 +666,57 @@ EOF
549666
start_here
550667
;;
551668
stop-tservers)
669+
echo "$1 is deprecated. Please use \`stop-servers --tservers\` instead"
552670
parse_config
553671
stop_tservers
554672
;;
555673
stop-here)
556674
parse_config
557675
stop_here
558676
;;
677+
start-servers)
678+
parse_config
679+
case "$2" in
680+
"--all" | "")
681+
start_all
682+
;;
683+
"--tservers")
684+
start_tservers
685+
;;
686+
"--no-tservers")
687+
start_all --no-tservers
688+
;;
689+
"--sservers")
690+
start_sservers "${@:3}"
691+
;;
692+
"--compactors")
693+
start_compactors "${@:3}"
694+
;;
695+
*)
696+
invalid_args "'$2' is an invalid <command>"
697+
;;
698+
esac
699+
;;
700+
stop-servers)
701+
parse_config
702+
case "$2" in
703+
"--all" | "")
704+
stop_all
705+
;;
706+
"--tservers")
707+
stop_tservers
708+
;;
709+
"--sservers")
710+
stop_sservers "${@:3}"
711+
;;
712+
"--compactors")
713+
stop_compactors "${@:3}"
714+
;;
715+
*)
716+
invalid_args "'$2' is an invalid <command>"
717+
;;
718+
esac
719+
;;
559720
*)
560721
invalid_args "'$1' is an invalid <command>"
561722
;;

0 commit comments

Comments
 (0)