Skip to content

Commit

Permalink
Merge branch 'main' into 4.0-feature-fate-inter-it-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrr888 committed Jan 17, 2025
2 parents 8319506 + 139d850 commit 2aad38f
Show file tree
Hide file tree
Showing 281 changed files with 5,682 additions and 5,337 deletions.
331 changes: 193 additions & 138 deletions assemble/bin/accumulo-cluster

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions assemble/bin/accumulo-service
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ function rotate_log() {

function get_group() {
# Find the group parameter if any
GROUP_PATTERN="^(compactor.group|sserver.group|tserver.group)=(.*)$"
group="default"
local group="default"
local param
for param in "$@"; do
if [[ $param =~ $GROUP_PATTERN ]]; then
group="${BASH_REMATCH[2]}"
if [[ $param =~ ^[a-z]*[.]group=(.*)$ ]]; then
group="${BASH_REMATCH[1]}"
fi
done
echo "${group}"
echo "$group"
}

function start_service() {
Expand Down Expand Up @@ -111,7 +111,7 @@ function start_service() {
rotate_log "$outfile"
rotate_log "$errfile"

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

done
Expand Down
2 changes: 1 addition & 1 deletion assemble/conf/accumulo-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ case "${ACCUMULO_RESOURCE_GROUP:-default}" in
esac
;;
*)
echo "ACCUMULO_RESOURCE_GROUP named $ACCUMULO_RESOURCE_GROUP is not configured"
echo "ACCUMULO_RESOURCE_GROUP named $ACCUMULO_RESOURCE_GROUP is not configured in accumulo-env.sh"
exit 1
;;
esac
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/org/apache/accumulo/core/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ public class Constants {

public static final String ZTABLE_LOCKS = "/table_locks";
public static final String ZMINI_LOCK = "/mini";
public static final String ZADMIN_LOCK = "/admin/lock";
public static final String ZTEST_LOCK = "/test/lock";

public static final String BULK_PREFIX = "b-";
public static final String BULK_RENAME_FILE = "renames.json";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static ContextClassLoaderFactory getContextFactory() {
}

// for testing
static synchronized void resetContextFactoryForTests() {
public static synchronized void resetContextFactoryForTests() {
FACTORY = null;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
*
* https://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.
*/
package org.apache.accumulo.core.client.admin;

import java.io.Serializable;
import java.time.Duration;
import java.util.Objects;
import java.util.Optional;

import com.google.common.base.Preconditions;

/**
* @since 4.0.0
*/
public class TabletMergeability implements Serializable {
private static final long serialVersionUID = 1L;

private static final TabletMergeability NEVER = new TabletMergeability();
private static final TabletMergeability ALWAYS = new TabletMergeability(Duration.ZERO);

private final Duration delay;

private TabletMergeability(Duration delay) {
this.delay = Objects.requireNonNull(delay);
}

// Edge case for NEVER
private TabletMergeability() {
this.delay = null;
}

/**
* Determines if the configured delay signals a tablet is never eligible to be automatically
* merged.
*
* @return true if never mergeable, else false
*/
public boolean isNever() {
return this.delay == null;
}

/**
* Determines if the configured delay signals a tablet is always eligible to be automatically
* merged now. (Has a delay of 0)
*
* @return true if always mergeable now, else false
*/
public boolean isAlways() {
return delay != null && this.delay.isZero();
}

/**
* Returns an Optional duration of the delay which is one of:
*
* <ul>
* <li>empty (never)</li>
* <li>0 (now)</li>
* <li>positive delay</li>
* </ul>
*
* @return the configured mergeability delay
*/
public Optional<Duration> getDelay() {
return Optional.ofNullable(delay);
}

@Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
TabletMergeability that = (TabletMergeability) o;
return Objects.equals(delay, that.delay);
}

@Override
public int hashCode() {
return Objects.hashCode(delay);
}

@Override
public String toString() {
if (delay == null) {
return "TabletMergeability=NEVER";
}
return "TabletMergeability=AFTER:" + delay.toMillis() + "ms";
}

/**
* Signifies that a tablet is never eligible to be automatically merged.
*
* @return a {@link TabletMergeability} with an empty delay signaling never merge
*/
public static TabletMergeability never() {
return NEVER;
}

/**
* Signifies that a tablet is eligible now to be automatically merged
*
* @return a {@link TabletMergeability} with a delay of 0 signaling never merge
*/
public static TabletMergeability always() {
return ALWAYS;
}

/**
* Creates a {@link TabletMergeability} that signals a tablet has a delay to a point in the future
* before it is automatically eligible to be merged. The duration must be positive value.
*
* @param delay the duration of the delay
*
* @return a {@link TabletMergeability} from the given delay.
*/
public static TabletMergeability after(Duration delay) {
Preconditions.checkArgument(delay.toNanos() >= 0, "Duration of delay must be greater than 0.");
return new TabletMergeability(delay);
}

}
Loading

0 comments on commit 2aad38f

Please sign in to comment.