HBASE-16892 Use TableName instead of String in SnapshotDescription

This commit is contained in:
Matteo Bertozzi 2016-11-04 13:18:10 -07:00
parent efe0a0eead
commit 00ea7aeafe
12 changed files with 124 additions and 100 deletions

View File

@ -2338,14 +2338,15 @@ public class HBaseAdmin implements Admin {
public void snapshot(final String snapshotName, final TableName tableName,
SnapshotType type)
throws IOException, SnapshotCreationException, IllegalArgumentException {
snapshot(new SnapshotDescription(snapshotName, tableName.getNameAsString(), type));
snapshot(new SnapshotDescription(snapshotName, tableName, type));
}
@Override
public void snapshot(SnapshotDescription snapshotDesc)
throws IOException, SnapshotCreationException, IllegalArgumentException {
// actually take the snapshot
HBaseProtos.SnapshotDescription snapshot = createHBaseProtosSnapshotDesc(snapshotDesc);
HBaseProtos.SnapshotDescription snapshot =
ProtobufUtil.createHBaseProtosSnapshotDesc(snapshotDesc);
SnapshotResponse response = asyncSnapshot(snapshot);
final IsSnapshotDoneRequest request =
IsSnapshotDoneRequest.newBuilder().setSnapshot(snapshot).build();
@ -2387,31 +2388,7 @@ public class HBaseAdmin implements Admin {
@Override
public void takeSnapshotAsync(SnapshotDescription snapshotDesc) throws IOException,
SnapshotCreationException {
HBaseProtos.SnapshotDescription snapshot = createHBaseProtosSnapshotDesc(snapshotDesc);
asyncSnapshot(snapshot);
}
private HBaseProtos.SnapshotDescription
createHBaseProtosSnapshotDesc(SnapshotDescription snapshotDesc) {
HBaseProtos.SnapshotDescription.Builder builder = HBaseProtos.SnapshotDescription.newBuilder();
if (snapshotDesc.getTable() != null) {
builder.setTable(snapshotDesc.getTable());
}
if (snapshotDesc.getName() != null) {
builder.setName(snapshotDesc.getName());
}
if (snapshotDesc.getOwner() != null) {
builder.setOwner(snapshotDesc.getOwner());
}
if (snapshotDesc.getCreationTime() != -1) {
builder.setCreationTime(snapshotDesc.getCreationTime());
}
if (snapshotDesc.getVersion() != -1) {
builder.setVersion(snapshotDesc.getVersion());
}
builder.setType(ProtobufUtil.createProtosSnapShotDescType(snapshotDesc.getType()));
HBaseProtos.SnapshotDescription snapshot = builder.build();
return snapshot;
asyncSnapshot(ProtobufUtil.createHBaseProtosSnapshotDesc(snapshotDesc));
}
private SnapshotResponse asyncSnapshot(HBaseProtos.SnapshotDescription snapshot)
@ -2432,7 +2409,8 @@ public class HBaseAdmin implements Admin {
@Override
public boolean isSnapshotFinished(final SnapshotDescription snapshotDesc)
throws IOException, HBaseSnapshotException, UnknownSnapshotException {
final HBaseProtos.SnapshotDescription snapshot = createHBaseProtosSnapshotDesc(snapshotDesc);
final HBaseProtos.SnapshotDescription snapshot =
ProtobufUtil.createHBaseProtosSnapshotDesc(snapshotDesc);
return executeCallable(new MasterCallable<IsSnapshotDoneResponse>(getConnection(),
getRpcControllerFactory()) {
@Override
@ -2475,7 +2453,7 @@ public class HBaseAdmin implements Admin {
TableName tableName = null;
for (SnapshotDescription snapshotInfo: listSnapshots()) {
if (snapshotInfo.getName().equals(snapshotName)) {
tableName = TableName.valueOf(snapshotInfo.getTable());
tableName = snapshotInfo.getTableName();
break;
}
}
@ -2729,8 +2707,7 @@ public class HBaseAdmin implements Admin {
}
});
return new RestoreSnapshotFuture(
this, snapshot, TableName.valueOf(snapshot.getTable()), response);
return new RestoreSnapshotFuture(this, snapshot, tableName, response);
}
private static class RestoreSnapshotFuture extends TableFuture<Void> {
@ -2772,9 +2749,7 @@ public class HBaseAdmin implements Admin {
.getSnapshotsList();
List<SnapshotDescription> result = new ArrayList<SnapshotDescription>(snapshotsList.size());
for (HBaseProtos.SnapshotDescription snapshot : snapshotsList) {
result.add(new SnapshotDescription(snapshot.getName(), snapshot.getTable(),
ProtobufUtil.createSnapshotType(snapshot.getType()), snapshot.getOwner(),
snapshot.getCreationTime(), snapshot.getVersion()));
result.add(ProtobufUtil.createSnapshotDesc(snapshot));
}
return result;
}
@ -2814,7 +2789,7 @@ public class HBaseAdmin implements Admin {
List<TableName> listOfTableNames = Arrays.asList(tableNames);
for (SnapshotDescription snapshot : snapshots) {
if (listOfTableNames.contains(TableName.valueOf(snapshot.getTable()))) {
if (listOfTableNames.contains(snapshot.getTableName())) {
tableSnapshots.add(snapshot);
}
}
@ -2857,7 +2832,7 @@ public class HBaseAdmin implements Admin {
internalDeleteSnapshot(snapshot);
} catch (IOException ex) {
LOG.info(
"Failed to delete snapshot " + snapshot.getName() + " for table " + snapshot.getTable(),
"Failed to delete snapshot " + snapshot.getName() + " for table " + snapshot.getTableNameAsString(),
ex);
}
}
@ -2868,7 +2843,7 @@ public class HBaseAdmin implements Admin {
@Override
protected Void rpcCall() throws Exception {
this.master.deleteSnapshot(getRpcController(), DeleteSnapshotRequest.newBuilder()
.setSnapshot(createHBaseProtosSnapshotDesc(snapshot)).build());
.setSnapshot(ProtobufUtil.createHBaseProtosSnapshotDesc(snapshot)).build());
return null;
}
});

View File

@ -16,6 +16,8 @@
* limitations under the License.
*/
package org.apache.hadoop.hbase.client;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
@ -25,31 +27,64 @@ import org.apache.hadoop.hbase.classification.InterfaceStability;
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class SnapshotDescription {
private String name;
private String table;
private SnapshotType snapShotType = SnapshotType.DISABLED;
private String owner;
private long creationTime = -1L;
private int version = -1;
private final String name;
private final TableName table;
private final SnapshotType snapShotType;
private final String owner;
private final long creationTime;
private final int version;
public SnapshotDescription(String name) {
this(name, null);
this(name, (TableName)null);
}
/**
* @deprecated Use the version with the TableName instance instead
*/
@Deprecated
public SnapshotDescription(String name, String table) {
this(name, TableName.valueOf(table));
}
public SnapshotDescription(String name, TableName table) {
this(name, table, SnapshotType.DISABLED, null);
}
/**
* @deprecated Use the version with the TableName instance instead
*/
@Deprecated
public SnapshotDescription(String name, String table, SnapshotType type) {
this(name, TableName.valueOf(table), type);
}
public SnapshotDescription(String name, TableName table, SnapshotType type) {
this(name, table, type, null);
}
/**
* @deprecated Use the version with the TableName instance instead
*/
@Deprecated
public SnapshotDescription(String name, String table, SnapshotType type, String owner) {
this(name, TableName.valueOf(table), type, owner);
}
public SnapshotDescription(String name, TableName table, SnapshotType type, String owner) {
this(name, table, type, owner, -1, -1);
}
/**
* @deprecated Use the version with the TableName instance instead
*/
@Deprecated
public SnapshotDescription(String name, String table, SnapshotType type, String owner,
long creationTime, int version) {
this(name, TableName.valueOf(table), type, owner, creationTime, version);
}
public SnapshotDescription(String name, TableName table, SnapshotType type, String owner,
long creationTime, int version) {
this.name = name;
this.table = table;
this.snapShotType = type;
@ -62,7 +97,19 @@ public class SnapshotDescription {
return this.name;
}
/**
* @deprecated Use getTableName() or getTableNameAsString() instead.
*/
@Deprecated
public String getTable() {
return getTableNameAsString();
}
public String getTableNameAsString() {
return this.table.getNameAsString();
}
public TableName getTableName() {
return this.table;
}

View File

@ -2871,8 +2871,8 @@ public final class ProtobufUtil {
public static HBaseProtos.SnapshotDescription
createHBaseProtosSnapshotDesc(SnapshotDescription snapshotDesc) {
HBaseProtos.SnapshotDescription.Builder builder = HBaseProtos.SnapshotDescription.newBuilder();
if (snapshotDesc.getTable() != null) {
builder.setTable(snapshotDesc.getTable());
if (snapshotDesc.getTableName() != null) {
builder.setTable(snapshotDesc.getTableNameAsString());
}
if (snapshotDesc.getName() != null) {
builder.setName(snapshotDesc.getName());
@ -2900,7 +2900,8 @@ public final class ProtobufUtil {
*/
public static SnapshotDescription
createSnapshotDesc(HBaseProtos.SnapshotDescription snapshotDesc) {
return new SnapshotDescription(snapshotDesc.getName(), snapshotDesc.getTable(),
return new SnapshotDescription(snapshotDesc.getName(),
snapshotDesc.hasTable() ? TableName.valueOf(snapshotDesc.getTable()) : null,
createSnapshotType(snapshotDesc.getType()), snapshotDesc.getOwner(),
snapshotDesc.getCreationTime(), snapshotDesc.getVersion());
}
@ -3176,7 +3177,7 @@ public final class ProtobufUtil {
* has a serialized {@link ServerName} in it.
* @return Returns null if <code>data</code> is null else converts passed data
* to a ServerName instance.
* @throws DeserializationException
* @throws DeserializationException
*/
public static ServerName parseServerNameFrom(final byte [] data) throws DeserializationException {
if (data == null || data.length <= 0) return null;

View File

@ -147,10 +147,10 @@ public class TestSnapshotFromAdmin {
failSnapshotStart(admin, new SnapshotDescription("snap$hot"));
failSnapshotStart(admin, new SnapshotDescription("snap:hot"));
// check the table name also get verified
failSnapshotStart(admin, new SnapshotDescription("snapshot", ".table"));
failSnapshotStart(admin, new SnapshotDescription("snapshot", "-table"));
failSnapshotStart(admin, new SnapshotDescription("snapshot", "table fails"));
failSnapshotStart(admin, new SnapshotDescription("snapshot", "tab%le"));
failSnapshotDescriptorCreation("snapshot", ".table");
failSnapshotDescriptorCreation("snapshot", "-table");
failSnapshotDescriptorCreation("snapshot", "table fails");
failSnapshotDescriptorCreation("snapshot", "tab%le");
// mock the master connection
MasterKeepAliveConnection master = Mockito.mock(MasterKeepAliveConnection.class);
@ -165,7 +165,7 @@ public class TestSnapshotFromAdmin {
Mockito.any(IsSnapshotDoneRequest.class))).thenReturn(doneResponse);
// make sure that we can use valid names
admin.snapshot(new SnapshotDescription("snapshot", "table"));
admin.snapshot(new SnapshotDescription("snapshot", TableName.valueOf("table")));
}
private void failSnapshotStart(Admin admin, SnapshotDescription snapshot)
@ -177,4 +177,13 @@ public class TestSnapshotFromAdmin {
LOG.debug("Correctly failed to start snapshot:" + e.getMessage());
}
}
private void failSnapshotDescriptorCreation(final String snapshotName, final String tableName) {
try {
new SnapshotDescription(snapshotName, tableName);
fail("SnapshotDescription should not have succeed with name:" + snapshotName);
} catch (IllegalArgumentException e) {
LOG.debug("Correctly failed to create SnapshotDescription:" + e.getMessage());
}
}
}

View File

@ -486,7 +486,7 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
</tr>
<%for SnapshotDescription snapshotDesc : snapshots%>
<%java>
TableName snapshotTable = TableName.valueOf(snapshotDesc.getTable());
TableName snapshotTable = snapshotDesc.getTableName();
</%java>
<tr>
<td><a href="snapshot.jsp?name=<% snapshotDesc.getName() %>"><% snapshotDesc.getName() %></a> </td>

View File

@ -34,7 +34,7 @@ import java.util.Arrays;
* This is a command line class that will snapshot a given table.
*/
public class CreateSnapshot extends AbstractHBaseTool {
private String tableName = null;
private TableName tableName = null;
private String snapshotName = null;
private String snapshotType = null;
@ -53,7 +53,7 @@ public class CreateSnapshot extends AbstractHBaseTool {
@Override
protected void processOptions(CommandLine cmd) {
this.tableName = cmd.getOptionValue('t');
this.tableName = TableName.valueOf(cmd.getOptionValue('t'));
this.snapshotName = cmd.getOptionValue('n');
this.snapshotType = cmd.getOptionValue('s');

View File

@ -142,7 +142,7 @@ public final class SnapshotInfo extends Configured implements Tool {
final SnapshotDescription snapshot)
{
this.snapshot = ProtobufUtil.createHBaseProtosSnapshotDesc(snapshot);
this.snapshotTable = TableName.valueOf(snapshot.getTable());
this.snapshotTable = snapshot.getTableName();
this.conf = conf;
this.fs = fs;
}
@ -158,9 +158,7 @@ public final class SnapshotInfo extends Configured implements Tool {
/** @return the snapshot descriptor */
public SnapshotDescription getSnapshotDescription() {
return new SnapshotDescription(this.snapshot.getName(), this.snapshot.getTable(),
ProtobufUtil.createSnapshotType(this.snapshot.getType()), this.snapshot.getOwner(),
this.snapshot.getCreationTime(), this.snapshot.getVersion());
return ProtobufUtil.createSnapshotDesc(this.snapshot);
}
/** @return true if the snapshot is corrupted */
@ -399,7 +397,7 @@ public final class SnapshotInfo extends Configured implements Tool {
System.out.printf("%-20s | %20s | %s%n",
desc.getName(),
df.format(new Date(desc.getCreationTime())),
desc.getTable());
desc.getTableNameAsString());
}
return 0;
}
@ -485,9 +483,7 @@ public final class SnapshotInfo extends Configured implements Tool {
// Collect information about hfiles and logs in the snapshot
final HBaseProtos.SnapshotDescription snapshotDesc = snapshotManifest.getSnapshotDescription();
final String table = snapshotDesc.getTable();
SnapshotDescription desc = new SnapshotDescription(snapshotDesc.getName(),
snapshotDesc.getTable(), ProtobufUtil.createSnapshotType(snapshotDesc.getType()),
snapshotDesc.getOwner(), snapshotDesc.getCreationTime(), snapshotDesc.getVersion());
final SnapshotDescription desc = ProtobufUtil.createSnapshotDesc(snapshotDesc);
final SnapshotStats stats = new SnapshotStats(this.getConf(), this.fs, desc);
SnapshotReferenceUtil.concurrentVisitReferencedFiles(getConf(), fs, snapshotManifest,
"SnapshotInfo",
@ -566,9 +562,8 @@ public final class SnapshotInfo extends Configured implements Tool {
*/
public static SnapshotStats getSnapshotStats(final Configuration conf,
final SnapshotDescription snapshot) throws IOException {
HBaseProtos.SnapshotDescription snapshotDesc = ProtobufUtil.createHBaseProtosSnapshotDesc(
snapshot);
HBaseProtos.SnapshotDescription snapshotDesc =
ProtobufUtil.createHBaseProtosSnapshotDesc(snapshot);
return getSnapshotStats(conf, snapshotDesc, null);
}
@ -616,9 +611,7 @@ public final class SnapshotInfo extends Configured implements Tool {
for (FileStatus snapshotDirStat: snapshots) {
HBaseProtos.SnapshotDescription snapshotDesc =
SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDirStat.getPath());
snapshotLists.add(new SnapshotDescription(snapshotDesc.getName(),
snapshotDesc.getTable(), ProtobufUtil.createSnapshotType(snapshotDesc.getType()),
snapshotDesc.getOwner(), snapshotDesc.getCreationTime(), snapshotDesc.getVersion()));
snapshotLists.add(ProtobufUtil.createSnapshotDesc(snapshotDesc));
}
return snapshotLists;
}
@ -639,8 +632,8 @@ public final class SnapshotInfo extends Configured implements Tool {
final ConcurrentHashMap<Path, Integer> filesMap,
final AtomicLong uniqueHFilesArchiveSize, final AtomicLong uniqueHFilesSize,
final AtomicLong uniqueHFilesMobSize) throws IOException {
HBaseProtos.SnapshotDescription snapshotDesc = ProtobufUtil.createHBaseProtosSnapshotDesc(
snapshot);
HBaseProtos.SnapshotDescription snapshotDesc =
ProtobufUtil.createHBaseProtosSnapshotDesc(snapshot);
Path rootDir = FSUtils.getRootDir(conf);
final FileSystem fs = FileSystem.get(rootDir.toUri(), conf);
@ -651,9 +644,8 @@ public final class SnapshotInfo extends Configured implements Tool {
@Override public void storeFile(final HRegionInfo regionInfo, final String family,
final SnapshotRegionManifest.StoreFile storeFile) throws IOException {
if (!storeFile.hasReference()) {
HFileLink link = HFileLink
.build(conf, TableName.valueOf(snapshot.getTable()), regionInfo.getEncodedName(),
family, storeFile.getName());
HFileLink link = HFileLink.build(conf, snapshot.getTableName(),
regionInfo.getEncodedName(), family, storeFile.getName());
long size;
Integer count;
Path p;

View File

@ -41,7 +41,7 @@
if (snapshotName.equals(snapshotDesc.getName())) {
snapshot = snapshotDesc;
stats = SnapshotInfo.getSnapshotStats(conf, snapshot);
snapshotTable = TableName.valueOf(snapshot.getTable());
snapshotTable = snapshot.getTableName();
tableExists = admin.tableExists(snapshotTable);
break;
}

View File

@ -212,7 +212,7 @@ public class TestSnapshotFromClient {
final String SNAPSHOT_NAME = "offlineTableSnapshot";
byte[] snapshot = Bytes.toBytes(SNAPSHOT_NAME);
admin.snapshot(new SnapshotDescription(SNAPSHOT_NAME, STRING_TABLE_NAME,
admin.snapshot(new SnapshotDescription(SNAPSHOT_NAME, TABLE_NAME,
SnapshotType.DISABLED, null, -1, SnapshotManifestV1.DESCRIPTOR_VERSION));
LOG.debug("Snapshot completed.");

View File

@ -206,9 +206,7 @@ public class TestSnapshotFromMaster {
// then create a snapshot to the fs and make sure that we can find it when checking done
snapshotName = "completed";
Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
desc = desc.toBuilder().setName(snapshotName).build();
SnapshotDescriptionUtils.writeSnapshotInfo(desc, snapshotDir, fs);
desc = createSnapshot(snapshotName);
builder.setSnapshot(desc);
response = master.getMasterRpcServices().isSnapshotDone(null, builder.build());
@ -225,9 +223,7 @@ public class TestSnapshotFromMaster {
// write one snapshot to the fs
String snapshotName = "completed";
Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
SnapshotDescription snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();
SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);
SnapshotDescription snapshot = createSnapshot(snapshotName);
// check that we get one snapshot
response = master.getMasterRpcServices().getCompletedSnapshots(null, request);
@ -238,9 +234,7 @@ public class TestSnapshotFromMaster {
// write a second snapshot
snapshotName = "completed_two";
snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();
SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);
snapshot = createSnapshot(snapshotName);
expected.add(snapshot);
// check that we get one snapshot
@ -266,8 +260,7 @@ public class TestSnapshotFromMaster {
}
// write one snapshot to the fs
Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);
createSnapshot(snapshotName);
// then delete the existing snapshot,which shouldn't cause an exception to be thrown
master.getMasterRpcServices().deleteSnapshot(null, request);
@ -405,4 +398,13 @@ public class TestSnapshotFromMaster {
private static void ensureHFileCleanersRun() {
UTIL.getHBaseCluster().getMaster().getHFileCleaner().chore();
}
private SnapshotDescription createSnapshot(final String snapshotName) throws IOException {
SnapshotTestingUtils.SnapshotMock snapshotMock =
new SnapshotTestingUtils.SnapshotMock(UTIL.getConfiguration(), fs, rootDir);
SnapshotTestingUtils.SnapshotMock.SnapshotBuilder builder =
snapshotMock.createSnapshotV2(snapshotName, "test", 0);
builder.commit();
return builder.getSnapshotDescription();
}
}

View File

@ -114,8 +114,7 @@ public final class SnapshotTestingUtils {
List<SnapshotDescription> returnedSnapshots = new ArrayList<SnapshotDescription>();
for (SnapshotDescription sd : snapshots) {
if (snapshotName.equals(sd.getName()) &&
tableName.equals(TableName.valueOf(sd.getTable()))) {
if (snapshotName.equals(sd.getName()) && tableName.equals(sd.getTableName())) {
returnedSnapshots.add(sd);
}
}
@ -129,8 +128,7 @@ public final class SnapshotTestingUtils {
*/
public static void assertOneSnapshotThatMatches(Admin admin,
HBaseProtos.SnapshotDescription snapshot) throws IOException {
assertOneSnapshotThatMatches(admin, snapshot.getName(),
TableName.valueOf(snapshot.getTable()));
assertOneSnapshotThatMatches(admin, snapshot.getName(), TableName.valueOf(snapshot.getTable()));
}
/**
@ -145,7 +143,7 @@ public final class SnapshotTestingUtils {
assertEquals("Should only have 1 snapshot", 1, snapshots.size());
assertEquals(snapshotName, snapshots.get(0).getName());
assertEquals(tableName, TableName.valueOf(snapshots.get(0).getTable()));
assertEquals(tableName, snapshots.get(0).getTableName());
return snapshots;
}
@ -271,7 +269,7 @@ public final class SnapshotTestingUtils {
* @param snapshot: the snapshot to check
* @param sleep: amount to sleep between checks to see if the snapshot is done
* @throws ServiceException if the snapshot fails
* @throws org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException
* @throws org.apache.hadoop.hbase.shaded.com.google.protobuf.ServiceException
*/
public static void waitForSnapshotToComplete(HMaster master,
HBaseProtos.SnapshotDescription snapshot, long sleep)
@ -301,7 +299,7 @@ public final class SnapshotTestingUtils {
CorruptedSnapshotException lastEx = null;
while (tries++ < numTries) {
try {
admin.snapshot(new SnapshotDescription(snapshotName, tableName,
admin.snapshot(new SnapshotDescription(snapshotName, TableName.valueOf(tableName),
SnapshotType.valueOf(type.toString())));
return;
} catch (CorruptedSnapshotException cse) {

View File

@ -282,7 +282,7 @@ public class TestFlushSnapshotFromClient {
// take the snapshot async
admin.takeSnapshotAsync(
new SnapshotDescription("asyncSnapshot", TABLE_NAME.getNameAsString(),
new SnapshotDescription("asyncSnapshot", TABLE_NAME,
ProtobufUtil.createSnapshotType(HBaseProtos.SnapshotDescription.Type.FLUSH)));
// constantly loop, looking for the snapshot to complete
@ -456,10 +456,10 @@ public class TestFlushSnapshotFromClient {
HBaseProtos.SnapshotDescription.Builder builder =
HBaseProtos.SnapshotDescription.newBuilder();
if(i %2 ==0) {
descs[i] = new SnapshotDescription("ss" + i, TABLE_NAME.getNameAsString(),
descs[i] = new SnapshotDescription("ss" + i, TABLE_NAME,
ProtobufUtil.createSnapshotType(HBaseProtos.SnapshotDescription.Type.FLUSH));
} else {
descs[i] = new SnapshotDescription("ss" + i, TABLE2_NAME.getNameAsString(),
descs[i] = new SnapshotDescription("ss" + i, TABLE2_NAME,
ProtobufUtil.createSnapshotType(HBaseProtos.SnapshotDescription.Type.FLUSH));
}
}
@ -504,9 +504,9 @@ public class TestFlushSnapshotFromClient {
int t1SnapshotsCount = 0;
int t2SnapshotsCount = 0;
for (SnapshotDescription ss : taken) {
if (TableName.valueOf(ss.getTable()).equals(TABLE_NAME)) {
if (ss.getTableName().equals(TABLE_NAME)) {
t1SnapshotsCount++;
} else if (TableName.valueOf(ss.getTable()).equals(TABLE2_NAME)) {
} else if (ss.getTableName().equals(TABLE2_NAME)) {
t2SnapshotsCount++;
}
}