HBASE-7864 Rename HMaster#listSnapshots as getCompletedSnapshots() (Ted Yu)

git-svn-id: https://svn.apache.org/repos/asf/hbase/branches/hbase-7290v2@1448302 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2013-02-20 17:10:21 +00:00
parent c36b6fb32c
commit ae300d6759
11 changed files with 45 additions and 45 deletions

View File

@ -19609,7 +19609,7 @@ public final class MasterAdminProtos {
org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.TakeSnapshotRequest request,
com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.TakeSnapshotResponse> done);
public abstract void listSnapshots(
public abstract void getCompletedSnapshots(
com.google.protobuf.RpcController controller,
org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotRequest request,
com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotResponse> done);
@ -19808,11 +19808,11 @@ public final class MasterAdminProtos {
}
@java.lang.Override
public void listSnapshots(
public void getCompletedSnapshots(
com.google.protobuf.RpcController controller,
org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotRequest request,
com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotResponse> done) {
impl.listSnapshots(controller, request, done);
impl.getCompletedSnapshots(controller, request, done);
}
@java.lang.Override
@ -19912,7 +19912,7 @@ public final class MasterAdminProtos {
case 20:
return impl.snapshot(controller, (org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.TakeSnapshotRequest)request);
case 21:
return impl.listSnapshots(controller, (org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotRequest)request);
return impl.getCompletedSnapshots(controller, (org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotRequest)request);
case 22:
return impl.deleteSnapshot(controller, (org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.DeleteSnapshotRequest)request);
case 23:
@ -20166,7 +20166,7 @@ public final class MasterAdminProtos {
org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.TakeSnapshotRequest request,
com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.TakeSnapshotResponse> done);
public abstract void listSnapshots(
public abstract void getCompletedSnapshots(
com.google.protobuf.RpcController controller,
org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotRequest request,
com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotResponse> done);
@ -20319,7 +20319,7 @@ public final class MasterAdminProtos {
done));
return;
case 21:
this.listSnapshots(controller, (org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotRequest)request,
this.getCompletedSnapshots(controller, (org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotRequest)request,
com.google.protobuf.RpcUtil.<org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotResponse>specializeCallback(
done));
return;
@ -20811,7 +20811,7 @@ public final class MasterAdminProtos {
org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.TakeSnapshotResponse.getDefaultInstance()));
}
public void listSnapshots(
public void getCompletedSnapshots(
com.google.protobuf.RpcController controller,
org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotRequest request,
com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotResponse> done) {
@ -20998,7 +20998,7 @@ public final class MasterAdminProtos {
org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.TakeSnapshotRequest request)
throws com.google.protobuf.ServiceException;
public org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotResponse listSnapshots(
public org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotResponse getCompletedSnapshots(
com.google.protobuf.RpcController controller,
org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotRequest request)
throws com.google.protobuf.ServiceException;
@ -21283,7 +21283,7 @@ public final class MasterAdminProtos {
}
public org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotResponse listSnapshots(
public org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotResponse getCompletedSnapshots(
com.google.protobuf.RpcController controller,
org.apache.hadoop.hbase.protobuf.generated.MasterAdminProtos.ListSnapshotRequest request)
throws com.google.protobuf.ServiceException {
@ -21661,7 +21661,7 @@ public final class MasterAdminProtos {
"iption\"F\n\034IsRestoreSnapshotDoneRequest\022&" +
"\n\010snapshot\030\001 \001(\0132\024.SnapshotDescription\"3" +
"\n\035IsRestoreSnapshotDoneResponse\022\022\n\004done\030" +
"\001 \001(\010:\004true2\234\r\n\022MasterAdminService\0222\n\tad" +
"\001 \001(\010:\004true2\244\r\n\022MasterAdminService\0222\n\tad" +
"dColumn\022\021.AddColumnRequest\032\022.AddColumnRe" +
"sponse\022;\n\014deleteColumn\022\024.DeleteColumnReq",
"uest\032\025.DeleteColumnResponse\022;\n\014modifyCol" +
@ -21694,18 +21694,18 @@ public final class MasterAdminProtos {
"orEnabledResponse\022L\n\021execMasterService\022\032" +
".CoprocessorServiceRequest\032\033.Coprocessor" +
"ServiceResponse\0227\n\010snapshot\022\024.TakeSnapsh",
"otRequest\032\025.TakeSnapshotResponse\022<\n\rlist" +
"Snapshots\022\024.ListSnapshotRequest\032\025.ListSn" +
"apshotResponse\022A\n\016deleteSnapshot\022\026.Delet" +
"eSnapshotRequest\032\027.DeleteSnapshotRespons" +
"e\022A\n\016isSnapshotDone\022\026.IsSnapshotDoneRequ" +
"est\032\027.IsSnapshotDoneResponse\022D\n\017restoreS" +
"napshot\022\027.RestoreSnapshotRequest\032\030.Resto" +
"reSnapshotResponse\022V\n\025isRestoreSnapshotD" +
"one\022\035.IsRestoreSnapshotDoneRequest\032\036.IsR" +
"estoreSnapshotDoneResponseBG\n*org.apache",
".hadoop.hbase.protobuf.generatedB\021Master" +
"AdminProtosH\001\210\001\001\240\001\001"
"otRequest\032\025.TakeSnapshotResponse\022D\n\025getC" +
"ompletedSnapshots\022\024.ListSnapshotRequest\032" +
"\025.ListSnapshotResponse\022A\n\016deleteSnapshot" +
"\022\026.DeleteSnapshotRequest\032\027.DeleteSnapsho" +
"tResponse\022A\n\016isSnapshotDone\022\026.IsSnapshot" +
"DoneRequest\032\027.IsSnapshotDoneResponse\022D\n\017" +
"restoreSnapshot\022\027.RestoreSnapshotRequest" +
"\032\030.RestoreSnapshotResponse\022V\n\025isRestoreS" +
"napshotDone\022\035.IsRestoreSnapshotDoneReque" +
"st\032\036.IsRestoreSnapshotDoneResponseBG\n*or",
"g.apache.hadoop.hbase.protobuf.generated" +
"B\021MasterAdminProtosH\001\210\001\001\240\001\001"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {

View File

@ -337,10 +337,10 @@ service MasterAdminService {
rpc snapshot(TakeSnapshotRequest) returns(TakeSnapshotResponse);
/**
* List existing snapshots.
* @return a list of snapshot descriptors
* List completed snapshots.
* @return a list of snapshot descriptors for completed snapshots
*/
rpc listSnapshots(ListSnapshotRequest) returns(ListSnapshotResponse);
rpc getCompletedSnapshots(ListSnapshotRequest) returns(ListSnapshotResponse);
/**
* Delete an existing snapshot. This method can also be used to clean up an aborted snapshot.

View File

@ -319,7 +319,7 @@ org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
<%def userSnapshots>
<%java>
List<SnapshotDescription> snapshots = admin.listSnapshots();
List<SnapshotDescription> snapshots = admin.getCompletedSnapshots();
</%java>
<%if (snapshots != null && snapshots.size() > 0)%>
<table class="table table-striped">

View File

@ -2333,7 +2333,7 @@ public class HBaseAdmin implements Abortable, Closeable {
String rollbackSnapshot = snapshotName + "-" + EnvironmentEdgeManager.currentTimeMillis();
String tableName = null;
for (SnapshotDescription snapshotInfo: listSnapshots()) {
for (SnapshotDescription snapshotInfo: getCompletedSnapshots()) {
if (snapshotInfo.getName().equals(snapshotName)) {
tableName = snapshotInfo.getTable();
break;
@ -2475,15 +2475,15 @@ public class HBaseAdmin implements Abortable, Closeable {
}
/**
* List existing snapshots.
* @return a list of snapshot descriptor for existing snapshots
* List completed snapshots.
* @return a list of snapshot descriptors for completed snapshots
* @throws IOException if a network error occurs
*/
public List<SnapshotDescription> listSnapshots() throws IOException {
public List<SnapshotDescription> getCompletedSnapshots() throws IOException {
return execute(new MasterAdminCallable<List<SnapshotDescription>>() {
@Override
public List<SnapshotDescription> call() throws ServiceException {
return masterAdmin.listSnapshots(null, ListSnapshotRequest.newBuilder().build())
return masterAdmin.getCompletedSnapshots(null, ListSnapshotRequest.newBuilder().build())
.getSnapshotsList();
}
});

View File

@ -2483,8 +2483,8 @@ Server {
* List the currently available/stored snapshots. Any in-progress snapshots are ignored
*/
@Override
public ListSnapshotResponse listSnapshots(RpcController controller, ListSnapshotRequest request)
throws ServiceException {
public ListSnapshotResponse getCompletedSnapshots(RpcController controller,
ListSnapshotRequest request) throws ServiceException {
try {
ListSnapshotResponse.Builder builder = ListSnapshotResponse.newBuilder();
List<SnapshotDescription> snapshots = snapshotManager.getCompletedSnapshots();

View File

@ -41,7 +41,7 @@
boolean readOnly = conf.getBoolean("hbase.master.ui.readonly", false);
String snapshotName = request.getParameter("name");
SnapshotDescription snapshot = null;
for (SnapshotDescription snapshotDesc: hbadmin.listSnapshots()) {
for (SnapshotDescription snapshotDesc: hbadmin.getCompletedSnapshots()) {
if (snapshotName.equals(snapshotDesc.getName())) {
snapshot = snapshotDesc;
break;

View File

@ -688,7 +688,7 @@ module Hbase
#----------------------------------------------------------------------------------------------
# Returns a list of snapshots
def list_snapshot
@admin.listSnapshots
@admin.getCompletedSnapshots
end
# Apply config specific to a table/column to its descriptor

View File

@ -194,7 +194,7 @@ public class TestSnapshotFromClient {
admin, fs, false, new Path(rootDir, HConstants.HREGION_LOGDIR_NAME), snapshotServers);
admin.deleteSnapshot(snapshot);
snapshots = admin.listSnapshots();
snapshots = admin.getCompletedSnapshots();
SnapshotTestingUtils.assertNoSnapshots(admin);
}

View File

@ -222,10 +222,10 @@ public class TestSnapshotFromMaster {
}
@Test
public void testListSnapshots() throws Exception {
public void testGetCompletedSnapshots() throws Exception {
// first check when there are no snapshots
ListSnapshotRequest request = ListSnapshotRequest.newBuilder().build();
ListSnapshotResponse response = master.listSnapshots(null, request);
ListSnapshotResponse response = master.getCompletedSnapshots(null, request);
assertEquals("Found unexpected number of snapshots", 0, response.getSnapshotsCount());
// write one snapshot to the fs
@ -235,7 +235,7 @@ public class TestSnapshotFromMaster {
SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);
// check that we get one snapshot
response = master.listSnapshots(null, request);
response = master.getCompletedSnapshots(null, request);
assertEquals("Found unexpected number of snapshots", 1, response.getSnapshotsCount());
List<SnapshotDescription> snapshots = response.getSnapshotsList();
List<SnapshotDescription> expected = Lists.newArrayList(snapshot);
@ -249,7 +249,7 @@ public class TestSnapshotFromMaster {
expected.add(snapshot);
// check that we get one snapshot
response = master.listSnapshots(null, request);
response = master.getCompletedSnapshots(null, request);
assertEquals("Found unexpected number of snapshots", 2, response.getSnapshotsCount());
snapshots = response.getSnapshotsList();
assertEquals("Returned snapshots don't match created snapshots", expected, snapshots);

View File

@ -67,7 +67,7 @@ public class SnapshotTestingUtils {
* if the admin operation fails
*/
public static void assertNoSnapshots(HBaseAdmin admin) throws IOException {
assertEquals("Have some previous snapshots", 0, admin.listSnapshots()
assertEquals("Have some previous snapshots", 0, admin.getCompletedSnapshots()
.size());
}
@ -79,7 +79,7 @@ public class SnapshotTestingUtils {
HBaseAdmin admin, String snapshotName, String tableName)
throws IOException {
// list the snapshot
List<SnapshotDescription> snapshots = admin.listSnapshots();
List<SnapshotDescription> snapshots = admin.getCompletedSnapshots();
List<SnapshotDescription> returnedSnapshots = new ArrayList<SnapshotDescription>();
for (SnapshotDescription sd : snapshots) {
@ -108,7 +108,7 @@ public class SnapshotTestingUtils {
HBaseAdmin admin, String snapshotName, String tableName)
throws IOException {
// list the snapshot
List<SnapshotDescription> snapshots = admin.listSnapshots();
List<SnapshotDescription> snapshots = admin.getCompletedSnapshots();
assertEquals("Should only have 1 snapshot", 1, snapshots.size());
assertEquals(snapshotName, snapshots.get(0).getName());

View File

@ -177,7 +177,7 @@ public class TestFlushSnapshotFromClient {
admin, fs, false, new Path(rootDir, HConstants.HREGION_LOGDIR_NAME), snapshotServers);
admin.deleteSnapshot(snapshot);
snapshots = admin.listSnapshots();
snapshots = admin.getCompletedSnapshots();
SnapshotTestingUtils.assertNoSnapshots(admin);
}
@ -382,7 +382,7 @@ public class TestFlushSnapshotFromClient {
// dump for debugging
logFSTree(new Path(UTIL.getConfiguration().get(HConstants.HBASE_DIR)));
List<SnapshotDescription> taken = admin.listSnapshots();
List<SnapshotDescription> taken = admin.getCompletedSnapshots();
int takenSize = taken.size();
LOG.info("Taken " + takenSize + " snapshots: " + taken);
assertTrue("We expect at least 1 request to be rejected because of we concurrently" +