72
72
import org .apache .accumulo .core .metadata .schema .MetadataSchema .TabletsSection .ServerColumnFamily ;
73
73
import org .apache .accumulo .core .metadata .schema .MetadataSchema .TabletsSection .SuspendLocationColumn ;
74
74
import org .apache .accumulo .core .metadata .schema .MetadataSchema .TabletsSection .TabletColumnFamily ;
75
+ import org .apache .accumulo .core .metadata .schema .MetadataSchema .TabletsSection .UserCompactionRequestedColumnFamily ;
75
76
import org .apache .accumulo .core .tabletserver .log .LogEntry ;
76
77
import org .apache .commons .lang3 .builder .ToStringBuilder ;
77
78
import org .apache .commons .lang3 .builder .ToStringStyle ;
@@ -118,6 +119,7 @@ public class TabletMetadata {
118
119
private TabletOperationId operationId ;
119
120
private boolean futureAndCurrentLocationSet = false ;
120
121
private Set <FateId > compacted ;
122
+ private Set <FateId > userCompactionsRequested ;
121
123
122
124
public static TabletMetadataBuilder builder (KeyExtent extent ) {
123
125
return new TabletMetadataBuilder (extent );
@@ -147,7 +149,8 @@ public enum ColumnType {
147
149
HOSTING_REQUESTED ,
148
150
OPID ,
149
151
SELECTED ,
150
- COMPACTED
152
+ COMPACTED ,
153
+ USER_COMPACTION_REQUESTED
151
154
}
152
155
153
156
public static class Location {
@@ -358,6 +361,11 @@ public boolean hasMerged() {
358
361
return merged ;
359
362
}
360
363
364
+ public Set <FateId > getUserCompactionsRequested () {
365
+ ensureFetched (ColumnType .USER_COMPACTION_REQUESTED );
366
+ return userCompactionsRequested ;
367
+ }
368
+
361
369
public TabletAvailability getTabletAvailability () {
362
370
if (AccumuloTable .ROOT .tableId ().equals (getTableId ())
363
371
|| AccumuloTable .METADATA .tableId ().equals (getTableId ())) {
@@ -385,7 +393,8 @@ public String toString() {
385
393
.append ("extCompactions" , extCompactions ).append ("availability" , availability )
386
394
.append ("onDemandHostingRequested" , onDemandHostingRequested )
387
395
.append ("operationId" , operationId ).append ("selectedFiles" , selectedFiles )
388
- .append ("futureAndCurrentLocationSet" , futureAndCurrentLocationSet ).toString ();
396
+ .append ("futureAndCurrentLocationSet" , futureAndCurrentLocationSet )
397
+ .append ("userCompactionsRequested" , userCompactionsRequested ).toString ();
389
398
}
390
399
391
400
public SortedMap <Key ,Value > getKeyValues () {
@@ -431,6 +440,7 @@ public static <E extends Entry<Key,Value>> TabletMetadata convertRow(Iterator<E>
431
440
final var extCompBuilder = ImmutableMap .<ExternalCompactionId ,CompactionMetadata >builder ();
432
441
final var loadedFilesBuilder = ImmutableMap .<StoredTabletFile ,FateId >builder ();
433
442
final var compactedBuilder = ImmutableSet .<FateId >builder ();
443
+ final var userCompactionsRequestedBuilder = ImmutableSet .<FateId >builder ();
434
444
ByteSequence row = null ;
435
445
436
446
while (rowIter .hasNext ()) {
@@ -488,7 +498,7 @@ public static <E extends Entry<Key,Value>> TabletMetadata convertRow(Iterator<E>
488
498
te .flushNonce = OptionalLong .of (Long .parseUnsignedLong (val , 16 ));
489
499
break ;
490
500
case OPID_QUAL :
491
- te .setOperationIdOnce (val , suppressLocationError );
501
+ te .setOperationIdOnce (val );
492
502
break ;
493
503
case SELECTED_QUAL :
494
504
te .selectedFiles = SelectedFiles .from (val );
@@ -532,6 +542,9 @@ public static <E extends Entry<Key,Value>> TabletMetadata convertRow(Iterator<E>
532
542
case CompactedColumnFamily .STR_NAME :
533
543
compactedBuilder .add (FateId .from (qual ));
534
544
break ;
545
+ case UserCompactionRequestedColumnFamily .STR_NAME :
546
+ userCompactionsRequestedBuilder .add (FateId .from (qual ));
547
+ break ;
535
548
default :
536
549
throw new IllegalStateException ("Unexpected family " + fam );
537
550
@@ -551,6 +564,7 @@ public static <E extends Entry<Key,Value>> TabletMetadata convertRow(Iterator<E>
551
564
te .logs = logsBuilder .build ();
552
565
te .extCompactions = extCompBuilder .build ();
553
566
te .compacted = compactedBuilder .build ();
567
+ te .userCompactionsRequested = userCompactionsRequestedBuilder .build ();
554
568
if (buildKeyValueMap ) {
555
569
te .keyValues = kvBuilder .build ();
556
570
}
@@ -581,10 +595,9 @@ private void setLocationOnce(String val, String qual, LocationType lt, boolean s
581
595
* Sets an operation ID only once.
582
596
*
583
597
* @param val operation id to set
584
- * @param suppressError set to true to suppress an exception being thrown, else false
585
598
* @throws IllegalStateException if an operation id or location is already set
586
599
*/
587
- private void setOperationIdOnce (String val , boolean suppressError ) {
600
+ private void setOperationIdOnce (String val ) {
588
601
Preconditions .checkState (operationId == null );
589
602
operationId = TabletOperationId .from (val );
590
603
}
0 commit comments