Skip to content

Commit 23810d2

Browse files
committed
Merge branch '2.1' into 3.1
2 parents d6900d8 + 7679f0c commit 23810d2

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/MinorCompactor.java

+15-5
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@
2929

3030
import org.apache.accumulo.core.conf.AccumuloConfiguration;
3131
import org.apache.accumulo.core.data.ByteSequence;
32+
import org.apache.accumulo.core.lock.ServiceLock;
3233
import org.apache.accumulo.core.manager.state.tables.TableState;
3334
import org.apache.accumulo.core.metadata.ReferencedTabletFile;
35+
import org.apache.accumulo.core.util.Halt;
3436
import org.apache.accumulo.core.util.LocalityGroupUtil;
3537
import org.apache.accumulo.server.compaction.CompactionStats;
3638
import org.apache.accumulo.server.compaction.FileCompactor;
@@ -89,11 +91,19 @@ public CompactionStats call() {
8991
try {
9092
do {
9193
try {
92-
CompactionStats ret = super.call();
93-
94-
// log.debug(String.format("MinC %,d recs in | %,d recs out | %,d recs/sec | %6.3f secs |
95-
// %,d bytes ",map.size(), entriesCompacted,
96-
// (int)(map.size()/((t2 - t1)/1000.0)), (t2 - t1)/1000.0, estimatedSizeInBytes()));
94+
CompactionStats ret = null;
95+
try {
96+
ret = super.call();
97+
} catch (Exception e) {
98+
final ServiceLock tserverLock = tabletServer.getLock();
99+
if (tserverLock == null || !tserverLock.verifyLockAtSource()) {
100+
log.error("Minor compaction of {} has failed and TabletServer lock does not exist."
101+
+ " Halting...", getExtent(), e);
102+
Halt.halt("TabletServer lock does not exist", -1);
103+
} else {
104+
throw e;
105+
}
106+
}
97107

98108
return ret;
99109
} catch (IOException | UnsatisfiedLinkError e) {

server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
import org.apache.accumulo.core.file.FilePrefix;
6969
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
7070
import org.apache.accumulo.core.iteratorsImpl.system.SourceSwitchingIterator;
71+
import org.apache.accumulo.core.lock.ServiceLock;
7172
import org.apache.accumulo.core.logging.ConditionalLogger.DeduplicatingLogger;
7273
import org.apache.accumulo.core.logging.TabletLogger;
7374
import org.apache.accumulo.core.manager.state.tables.TableState;
@@ -91,6 +92,7 @@
9192
import org.apache.accumulo.core.tabletserver.log.LogEntry;
9293
import org.apache.accumulo.core.tabletserver.thrift.TabletStats;
9394
import org.apache.accumulo.core.trace.TraceUtil;
95+
import org.apache.accumulo.core.util.Halt;
9496
import org.apache.accumulo.core.util.Pair;
9597
import org.apache.accumulo.core.volume.Volume;
9698
import org.apache.accumulo.server.ServerContext;
@@ -490,8 +492,15 @@ DataFileValue minorCompact(InMemoryMap memTable, ReferencedTabletFile tmpDatafil
490492
flushId);
491493
storedFile.ifPresent(stf -> compactable.filesAdded());
492494
} catch (Exception e) {
493-
TraceUtil.setException(span2, e, true);
494-
throw e;
495+
final ServiceLock tserverLock = tabletServer.getLock();
496+
if (tserverLock == null || !tserverLock.verifyLockAtSource()) {
497+
log.error("Minor compaction of {} has failed and TabletServer lock does not exist."
498+
+ " Halting...", getExtent(), e);
499+
Halt.halt("TabletServer lock does not exist", -1);
500+
} else {
501+
TraceUtil.setException(span2, e, true);
502+
throw e;
503+
}
495504
} finally {
496505
span2.end();
497506
}

0 commit comments

Comments
 (0)