Skip to content

Commit f1e773f

Browse files
committed
Merge remote-tracking branch 'upstream/main' into improveBulkIT
2 parents 6c960ec + cb1158e commit f1e773f

File tree

281 files changed

+6522
-5968
lines changed

Some content is hidden

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

281 files changed

+6522
-5968
lines changed

assemble/bin/accumulo-cluster

+193-138
Large diffs are not rendered by default.

assemble/bin/accumulo-service

+6-6
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ function rotate_log() {
6060

6161
function get_group() {
6262
# Find the group parameter if any
63-
GROUP_PATTERN="^(compactor.group|sserver.group|tserver.group)=(.*)$"
64-
group="default"
63+
local group="default"
64+
local param
6565
for param in "$@"; do
66-
if [[ $param =~ $GROUP_PATTERN ]]; then
67-
group="${BASH_REMATCH[2]}"
66+
if [[ $param =~ ^[a-z]*[.]group=(.*)$ ]]; then
67+
group="${BASH_REMATCH[1]}"
6868
fi
6969
done
70-
echo "${group}"
70+
echo "$group"
7171
}
7272

7373
function start_service() {
@@ -111,7 +111,7 @@ function start_service() {
111111
rotate_log "$outfile"
112112
rotate_log "$errfile"
113113

114-
nohup "${bin}/accumulo" "$service_type" "$@" "${PROPERTY_OVERRIDES[@]}" >"$outfile" 2>"$errfile" </dev/null &
114+
nohup "${bin}/accumulo" "$service_type" "$@" >"$outfile" 2>"$errfile" </dev/null &
115115
echo "$!" >"${pid_file}"
116116

117117
done

assemble/conf/accumulo-env.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ case "${ACCUMULO_RESOURCE_GROUP:-default}" in
104104
esac
105105
;;
106106
*)
107-
echo "ACCUMULO_RESOURCE_GROUP named $ACCUMULO_RESOURCE_GROUP is not configured"
107+
echo "ACCUMULO_RESOURCE_GROUP named $ACCUMULO_RESOURCE_GROUP is not configured in accumulo-env.sh"
108108
exit 1
109109
;;
110110
esac

core/src/main/java/org/apache/accumulo/core/Constants.java

+2
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ public class Constants {
8888

8989
public static final String ZTABLE_LOCKS = "/table_locks";
9090
public static final String ZMINI_LOCK = "/mini";
91+
public static final String ZADMIN_LOCK = "/admin/lock";
92+
public static final String ZTEST_LOCK = "/test/lock";
9193

9294
public static final String BULK_PREFIX = "b-";
9395
public static final String BULK_RENAME_FILE = "renames.json";

core/src/main/java/org/apache/accumulo/core/classloader/ClassLoaderUtil.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static ContextClassLoaderFactory getContextFactory() {
6969
}
7070

7171
// for testing
72-
static synchronized void resetContextFactoryForTests() {
72+
public static synchronized void resetContextFactoryForTests() {
7373
FACTORY = null;
7474
}
7575

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* https://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.accumulo.core.client.admin;
20+
21+
import java.io.Serializable;
22+
import java.time.Duration;
23+
import java.util.Objects;
24+
import java.util.Optional;
25+
26+
import com.google.common.base.Preconditions;
27+
28+
/**
29+
* @since 4.0.0
30+
*/
31+
public class TabletMergeability implements Serializable {
32+
private static final long serialVersionUID = 1L;
33+
34+
private static final TabletMergeability NEVER = new TabletMergeability();
35+
private static final TabletMergeability ALWAYS = new TabletMergeability(Duration.ZERO);
36+
37+
private final Duration delay;
38+
39+
private TabletMergeability(Duration delay) {
40+
this.delay = Objects.requireNonNull(delay);
41+
}
42+
43+
// Edge case for NEVER
44+
private TabletMergeability() {
45+
this.delay = null;
46+
}
47+
48+
/**
49+
* Determines if the configured delay signals a tablet is never eligible to be automatically
50+
* merged.
51+
*
52+
* @return true if never mergeable, else false
53+
*/
54+
public boolean isNever() {
55+
return this.delay == null;
56+
}
57+
58+
/**
59+
* Determines if the configured delay signals a tablet is always eligible to be automatically
60+
* merged now. (Has a delay of 0)
61+
*
62+
* @return true if always mergeable now, else false
63+
*/
64+
public boolean isAlways() {
65+
return delay != null && this.delay.isZero();
66+
}
67+
68+
/**
69+
* Returns an Optional duration of the delay which is one of:
70+
*
71+
* <ul>
72+
* <li>empty (never)</li>
73+
* <li>0 (now)</li>
74+
* <li>positive delay</li>
75+
* </ul>
76+
*
77+
* @return the configured mergeability delay
78+
*/
79+
public Optional<Duration> getDelay() {
80+
return Optional.ofNullable(delay);
81+
}
82+
83+
@Override
84+
public boolean equals(Object o) {
85+
if (o == null || getClass() != o.getClass()) {
86+
return false;
87+
}
88+
TabletMergeability that = (TabletMergeability) o;
89+
return Objects.equals(delay, that.delay);
90+
}
91+
92+
@Override
93+
public int hashCode() {
94+
return Objects.hashCode(delay);
95+
}
96+
97+
@Override
98+
public String toString() {
99+
if (delay == null) {
100+
return "TabletMergeability=NEVER";
101+
}
102+
return "TabletMergeability=AFTER:" + delay.toMillis() + "ms";
103+
}
104+
105+
/**
106+
* Signifies that a tablet is never eligible to be automatically merged.
107+
*
108+
* @return a {@link TabletMergeability} with an empty delay signaling never merge
109+
*/
110+
public static TabletMergeability never() {
111+
return NEVER;
112+
}
113+
114+
/**
115+
* Signifies that a tablet is eligible now to be automatically merged
116+
*
117+
* @return a {@link TabletMergeability} with a delay of 0 signaling never merge
118+
*/
119+
public static TabletMergeability always() {
120+
return ALWAYS;
121+
}
122+
123+
/**
124+
* Creates a {@link TabletMergeability} that signals a tablet has a delay to a point in the future
125+
* before it is automatically eligible to be merged. The duration must be positive value.
126+
*
127+
* @param delay the duration of the delay
128+
*
129+
* @return a {@link TabletMergeability} from the given delay.
130+
*/
131+
public static TabletMergeability after(Duration delay) {
132+
Preconditions.checkArgument(delay.toNanos() >= 0, "Duration of delay must be greater than 0.");
133+
return new TabletMergeability(delay);
134+
}
135+
136+
}

0 commit comments

Comments
 (0)