@@ -1313,56 +1313,6 @@ private void completeCompaction(CompactionJob job, Set<StoredTabletFile> jobFile
1313
1313
selectFiles ();
1314
1314
}
1315
1315
1316
- private final Set <CompactionInterrupter > compactionInterrupters = ConcurrentHashMap .newKeySet ();
1317
-
1318
- private class CompactionInterrupter implements AutoCloseable {
1319
- private Thread thread ;
1320
-
1321
- CompactionInterrupter () throws InterruptedException {
1322
-
1323
- this .thread = Thread .currentThread ();
1324
-
1325
- if (Thread .currentThread ().isInterrupted () || closed ) {
1326
- throw new InterruptedException ();
1327
- }
1328
-
1329
- compactionInterrupters .add (this );
1330
- log .trace ("Registered compaction interrupter for {} {}" , thread .getId (), getExtent ());
1331
- }
1332
-
1333
- public synchronized void interrupt () {
1334
- if (thread != null ) {
1335
- log .debug ("Interrupting compaction thread {} for {}" , thread .getId (), getExtent ());
1336
- thread .interrupt ();
1337
- }
1338
- }
1339
-
1340
- @ Override
1341
- public void close () throws InterruptedException {
1342
- synchronized (this ) {
1343
- Preconditions .checkState (thread == Thread .currentThread ());
1344
-
1345
- // The goal of this class is not to interrupt the compaction thread after this close()
1346
- // method returns. Two things help achieve this goal, first we set the thread instance var
1347
- // null here. Second this code block and the interrupt() method are synchronized.
1348
- thread = null ;
1349
- }
1350
-
1351
- // call this outside of synchronized block to avoid deadlock with the locks inside the
1352
- // concurrent hash set
1353
- compactionInterrupters .remove (this );
1354
-
1355
- log .trace ("Unregistered compaction interrupter for {} {}" , Thread .currentThread ().getId (),
1356
- getExtent ());
1357
-
1358
- // Its possible the threads interrupt status was set but nothing ever checked it. For example
1359
- // interrupt() could have been called immediately before this method was called.
1360
- if (Thread .interrupted ()) {
1361
- throw new InterruptedException ();
1362
- }
1363
- }
1364
- }
1365
-
1366
1316
@ Override
1367
1317
public void compact (CompactionServiceId service , CompactionJob job , BooleanSupplier keepRunning ,
1368
1318
RateLimiter readLimiter , RateLimiter writeLimiter , long queuedTime ) {
@@ -1382,7 +1332,6 @@ public void compact(CompactionServiceId service, CompactionJob job, BooleanSuppl
1382
1332
boolean successful = false ;
1383
1333
try {
1384
1334
TabletLogger .compacting (getExtent (), job , cInfo .localCompactionCfg );
1385
-
1386
1335
tablet .incrementStatusMajor ();
1387
1336
var check = new CompactionCheck (service , kind , keepRunning , cInfo .checkCompactionId );
1388
1337
TabletFile tmpFileName = tablet .getNextMapFilenameForMajc (cInfo .propagateDeletes );
@@ -1391,11 +1340,8 @@ public void compact(CompactionServiceId service, CompactionJob job, BooleanSuppl
1391
1340
SortedMap <StoredTabletFile ,DataFileValue > allFiles = tablet .getDatafiles ();
1392
1341
HashMap <StoredTabletFile ,DataFileValue > compactFiles = new HashMap <>();
1393
1342
cInfo .jobFiles .forEach (file -> compactFiles .put (file , allFiles .get (file )));
1394
- // Limit interrupting compactions to the part that reads and writes files and avoid
1395
- // interrupting the metadata table updates.
1396
- try (var ignored = new CompactionInterrupter ()) {
1397
- stats = CompactableUtils .compact (tablet , job , cInfo , compactEnv , compactFiles , tmpFileName );
1398
- }
1343
+
1344
+ stats = CompactableUtils .compact (tablet , job , cInfo , compactEnv , compactFiles , tmpFileName );
1399
1345
1400
1346
newFile = CompactableUtils .bringOnline (tablet .getDatafileManager (), cInfo , stats ,
1401
1347
compactFiles , allFiles , kind , tmpFileName );
@@ -1653,8 +1599,6 @@ public void close() {
1653
1599
1654
1600
closed = true ;
1655
1601
1656
- compactionInterrupters .forEach (CompactionInterrupter ::interrupt );
1657
-
1658
1602
// Wait while internal jobs are running or external compactions are committing. When
1659
1603
// chopStatus is MARKING or selectStatus is SELECTING, there may be metadata table writes so
1660
1604
// wait on those. Do not wait on external compactions that are running.
0 commit comments