3939import org .apache .hadoop .hbase .client .TableDescriptor ;
4040import org .apache .hadoop .hbase .errorhandling .ForeignExceptionSnare ;
4141import org .apache .hadoop .hbase .mob .MobUtils ;
42+ import org .apache .hadoop .hbase .monitoring .MonitoredTask ;
4243import org .apache .hadoop .hbase .regionserver .HRegion ;
4344import org .apache .hadoop .hbase .regionserver .HRegionFileSystem ;
4445import org .apache .hadoop .hbase .regionserver .HStore ;
@@ -84,6 +85,7 @@ public final class SnapshotManifest {
8485 private final FileSystem rootFs ;
8586 private final FileSystem workingDirFs ;
8687 private int manifestSizeLimit ;
88+ private final MonitoredTask statusTask ;
8789
8890 /**
8991 *
@@ -97,12 +99,13 @@ public final class SnapshotManifest {
9799 */
98100 private SnapshotManifest (final Configuration conf , final FileSystem rootFs ,
99101 final Path workingDir , final SnapshotDescription desc ,
100- final ForeignExceptionSnare monitor ) throws IOException {
102+ final ForeignExceptionSnare monitor , final MonitoredTask statusTask ) throws IOException {
101103 this .monitor = monitor ;
102104 this .desc = desc ;
103105 this .workingDir = workingDir ;
104106 this .conf = conf ;
105107 this .rootFs = rootFs ;
108+ this .statusTask = statusTask ;
106109 this .workingDirFs = this .workingDir .getFileSystem (this .conf );
107110 this .manifestSizeLimit = conf .getInt (SNAPSHOT_MANIFEST_SIZE_LIMIT_CONF_KEY , 64 * 1024 * 1024 );
108111 }
@@ -123,7 +126,14 @@ private SnapshotManifest(final Configuration conf, final FileSystem rootFs,
123126 public static SnapshotManifest create (final Configuration conf , final FileSystem fs ,
124127 final Path workingDir , final SnapshotDescription desc ,
125128 final ForeignExceptionSnare monitor ) throws IOException {
126- return new SnapshotManifest (conf , fs , workingDir , desc , monitor );
129+ return create (conf , fs , workingDir , desc , monitor , null );
130+
131+ }
132+
133+ public static SnapshotManifest create (final Configuration conf , final FileSystem fs ,
134+ final Path workingDir , final SnapshotDescription desc , final ForeignExceptionSnare monitor ,
135+ final MonitoredTask statusTask ) throws IOException {
136+ return new SnapshotManifest (conf , fs , workingDir , desc , monitor , statusTask );
127137
128138 }
129139
@@ -138,7 +148,7 @@ public static SnapshotManifest create(final Configuration conf, final FileSystem
138148 */
139149 public static SnapshotManifest open (final Configuration conf , final FileSystem fs ,
140150 final Path workingDir , final SnapshotDescription desc ) throws IOException {
141- SnapshotManifest manifest = new SnapshotManifest (conf , fs , workingDir , desc , null );
151+ SnapshotManifest manifest = new SnapshotManifest (conf , fs , workingDir , desc , null , null );
142152 manifest .load ();
143153 return manifest ;
144154 }
@@ -455,6 +465,12 @@ public List<SnapshotRegionManifest> getRegionManifests() {
455465 return this .regionManifests ;
456466 }
457467
468+ private void setStatusMsg (String msg ) {
469+ if (this .statusTask != null ) {
470+ statusTask .setStatus (msg );
471+ }
472+ }
473+
458474 /**
459475 * Get all the Region Manifest from the snapshot.
460476 * This is an helper to get a map with the region encoded name
@@ -478,7 +494,7 @@ public void consolidate() throws IOException {
478494 new FSTableDescriptors (conf , workingDirFs , rootDir )
479495 .createTableDescriptorForTableDirectory (workingDir , htd , false );
480496 } else {
481- LOG .debug ("Convert to Single Snapshot Manifest" );
497+ LOG .debug ("Convert to Single Snapshot Manifest for {}" , this . desc . getName () );
482498 convertToV2SingleManifest ();
483499 }
484500 }
@@ -491,6 +507,7 @@ private void convertToV2SingleManifest() throws IOException {
491507 // Try to load v1 and v2 regions
492508 List <SnapshotRegionManifest > v1Regions , v2Regions ;
493509 ThreadPoolExecutor tpool = createExecutor ("SnapshotManifestLoader" );
510+ setStatusMsg ("Loading Region manifests for " + this .desc .getName ());
494511 try {
495512 v1Regions = SnapshotManifestV1 .loadRegionManifests (conf , tpool , workingDirFs ,
496513 workingDir , desc );
@@ -514,6 +531,7 @@ private void convertToV2SingleManifest() throws IOException {
514531 // Once the data-manifest is written, the snapshot can be considered complete.
515532 // Currently snapshots are written in a "temporary" directory and later
516533 // moved to the "complated" snapshot directory.
534+ setStatusMsg ("Writing data manifest for " + this .desc .getName ());
517535 SnapshotDataManifest dataManifest = dataManifestBuilder .build ();
518536 writeDataManifest (dataManifest );
519537 this .regionManifests = dataManifest .getRegionManifestsList ();
0 commit comments