Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 81f2c37

Browse files
committedFeb 25, 2025·
Address more comments
1 parent fc0dbec commit 81f2c37

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed
 

‎server/manager/src/main/java/org/apache/accumulo/manager/merge/FindMergeableRangeTask.java

+10-7
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import java.util.Map;
2626
import java.util.Map.Entry;
2727
import java.util.Objects;
28-
import java.util.Optional;
2928
import java.util.Set;
3029
import java.util.function.Predicate;
3130

@@ -48,6 +47,7 @@
4847
import org.slf4j.Logger;
4948
import org.slf4j.LoggerFactory;
5049

50+
import com.google.common.base.Preconditions;
5151
import com.google.common.collect.Sets;
5252

5353
public class FindMergeableRangeTask implements Runnable {
@@ -125,20 +125,20 @@ void submit(MergeableRange range, FateInstanceType type, Entry<TableId,String> t
125125
TableId tableId = table.getKey();
126126
String tableName = table.getValue();
127127

128-
range.startRow = Optional.ofNullable(range.startRow).map(Text::new).orElse(new Text(""));
129-
range.endRow = Optional.ofNullable(range.endRow).map(Text::new).orElse(new Text(""));
128+
final Text startRow = range.startRow != null ? range.startRow : new Text("");
129+
final Text endRow = range.endRow != null ? range.endRow : new Text("");
130130

131-
String startRowStr = StringUtils.defaultIfBlank(range.startRow.toString(), "-inf");
132-
String endRowStr = StringUtils.defaultIfBlank(range.endRow.toString(), "+inf");
131+
String startRowStr = StringUtils.defaultIfBlank(startRow.toString(), "-inf");
132+
String endRowStr = StringUtils.defaultIfBlank(endRow.toString(), "+inf");
133133
log.debug("FindMergeableRangeTask: Creating merge op: {} from startRow: {} to endRow: {}",
134134
tableId, startRowStr, endRowStr);
135135
var fateId = manager.fate(type).startTransaction();
136136
String goalMessage = TableOperation.MERGE + " Merge table " + tableName + "(" + tableId
137137
+ ") splits from " + startRowStr + " to " + endRowStr;
138138

139139
manager.fate(type).seedTransaction(FateOperation.SYSTEM_MERGE, fateId,
140-
new TraceRepo<>(new TableRangeOp(Operation.SYSTEM_MERGE, namespaceId, tableId,
141-
range.startRow, range.endRow)),
140+
new TraceRepo<>(
141+
new TableRangeOp(Operation.SYSTEM_MERGE, namespaceId, tableId, startRow, endRow)),
142142
true, goalMessage);
143143
}
144144

@@ -176,6 +176,9 @@ boolean add(TabletMetadata tm) {
176176

177177
private boolean validate(TabletMetadata tm) {
178178
if (tabletCount > 0) {
179+
// This is at least the second tablet seen so there should not be a null prevEndRow
180+
Preconditions.checkState(tm.getPrevEndRow() != null,
181+
"Unexpected null prevEndRow found for %s", tm.getExtent());
179182
// If this is not the first tablet, then verify its prevEndRow matches
180183
// the last endRow tracked, the server filter will skip tablets marked as never
181184
if (!tm.getPrevEndRow().equals(endRow)) {

0 commit comments

Comments
 (0)
Please sign in to comment.