414 Move client classes into client package
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@627918 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
21932c5981
commit
51a7b53e5b
|
@ -51,6 +51,7 @@ Hbase Change Log
|
|||
HBASE-407 Keep HRegionLocation information in LRU structure
|
||||
HBASE-444 hbase is very slow at determining table is not present
|
||||
HBASE-438 XMLOutputter state should be initialized.
|
||||
HBASE-414 Move client classes into client package
|
||||
|
||||
Branch 0.1
|
||||
|
||||
|
|
|
@ -34,7 +34,9 @@ import org.apache.hadoop.hbase.util.Writables;
|
|||
import org.apache.hadoop.io.Text;
|
||||
|
||||
import org.apache.hadoop.hbase.io.BatchUpdate;
|
||||
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.hbase.client.HConnection;
|
||||
import org.apache.hadoop.hbase.client.HConnectionManager;
|
||||
/**
|
||||
* A non-instantiable class that has a static method capable of compacting
|
||||
* a table by merging adjacent regions that have grown too small.
|
||||
|
|
|
@ -67,6 +67,7 @@ import org.apache.hadoop.ipc.Server;
|
|||
import org.apache.hadoop.net.DNS;
|
||||
import org.apache.hadoop.util.StringUtils;
|
||||
import org.apache.hadoop.hbase.master.HMasterRegionInterface;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
|
||||
/**
|
||||
* HRegionServer makes a set of HRegions available to clients. It checks in with
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.util.ReflectionUtils;
|
||||
import org.apache.hadoop.hbase.master.HMaster;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
|
||||
/**
|
||||
* This class creates a single process HBase cluster. One thread is created for
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.hbase;
|
||||
package org.apache.hadoop.hbase.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
@ -32,6 +32,19 @@ import org.apache.hadoop.io.Text;
|
|||
import org.apache.hadoop.io.Writable;
|
||||
import org.apache.hadoop.ipc.RemoteException;
|
||||
import org.apache.hadoop.hbase.master.HMasterInterface;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.MasterNotRunningException;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
import org.apache.hadoop.hbase.HRegionLocation;
|
||||
import org.apache.hadoop.hbase.TableNotFoundException;
|
||||
import org.apache.hadoop.hbase.TableExistsException;
|
||||
import org.apache.hadoop.hbase.RemoteExceptionHandler;
|
||||
import org.apache.hadoop.hbase.HRegionInterface;
|
||||
import org.apache.hadoop.hbase.HRegionInfo;
|
||||
import org.apache.hadoop.hbase.HRegionLocation;
|
||||
import org.apache.hadoop.hbase.HStoreKey;
|
||||
|
||||
/**
|
||||
* Provides administrative functions for HBase
|
|
@ -17,14 +17,18 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.hbase;
|
||||
package org.apache.hadoop.hbase.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.SortedMap;
|
||||
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.master.HMasterInterface;
|
||||
|
||||
import org.apache.hadoop.hbase.MasterNotRunningException;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.HRegionLocation;
|
||||
import org.apache.hadoop.hbase.HServerAddress;
|
||||
import org.apache.hadoop.hbase.HRegionInterface;
|
||||
/**
|
||||
*
|
||||
*/
|
|
@ -17,7 +17,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.hbase;
|
||||
package org.apache.hadoop.hbase.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
@ -39,6 +39,22 @@ import org.apache.hadoop.io.Writable;
|
|||
import org.apache.hadoop.ipc.RemoteException;
|
||||
import org.apache.hadoop.hbase.master.HMasterInterface;
|
||||
import org.apache.hadoop.hbase.util.SoftSortedMap;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HRegionInterface;
|
||||
import org.apache.hadoop.hbase.MasterNotRunningException;
|
||||
import org.apache.hadoop.hbase.HRegionLocation;
|
||||
import org.apache.hadoop.hbase.HServerAddress;
|
||||
import org.apache.hadoop.hbase.LocalHBaseCluster;
|
||||
import org.apache.hadoop.hbase.HStoreKey;
|
||||
import org.apache.hadoop.hbase.HRegionInterface;
|
||||
import org.apache.hadoop.hbase.HRegionLocation;
|
||||
import org.apache.hadoop.hbase.HRegionInfo;
|
||||
import org.apache.hadoop.hbase.HStoreKey;
|
||||
import org.apache.hadoop.hbase.NoServerForRegionException;
|
||||
import org.apache.hadoop.hbase.TableNotFoundException;
|
||||
import org.apache.hadoop.hbase.RemoteExceptionHandler;
|
||||
|
||||
/**
|
||||
* A non-instantiable class that manages connections to multiple tables in
|
|
@ -17,7 +17,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.hbase;
|
||||
package org.apache.hadoop.hbase.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -43,6 +43,18 @@ import org.apache.hadoop.hbase.util.Writables;
|
|||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.io.Writable;
|
||||
import org.apache.hadoop.ipc.RemoteException;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HRegionLocation;
|
||||
import org.apache.hadoop.hbase.HScannerInterface;
|
||||
import org.apache.hadoop.hbase.HRegionInterface;
|
||||
import org.apache.hadoop.hbase.HStoreKey;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.HRegionInfo;
|
||||
import org.apache.hadoop.hbase.RemoteExceptionHandler;
|
||||
import org.apache.hadoop.hbase.NotServingRegionException;
|
||||
import org.apache.hadoop.hbase.HRegionInterface;
|
||||
import org.apache.hadoop.hbase.HStoreKey;
|
||||
|
||||
/**
|
||||
* Used to communicate with a single HBase table
|
||||
|
@ -83,7 +95,7 @@ public class HTable implements HConstants {
|
|||
* @param row Row to find.
|
||||
* @return Location of row.
|
||||
*/
|
||||
HRegionLocation getRegionLocation(Text row) throws IOException {
|
||||
public HRegionLocation getRegionLocation(Text row) throws IOException {
|
||||
return this.connection.locateRegion(this.tableName, row);
|
||||
}
|
||||
|
|
@ -9,10 +9,9 @@ import org.apache.hadoop.util.VersionInfo;
|
|||
import org.apache.hadoop.hbase.master.HMaster;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.master.MetaRegion;
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HServerInfo;
|
||||
import org.apache.hadoop.hbase.HServerAddress;
|
||||
import org.apache.hadoop.hbase.HRegionInfo;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.hql.ShowCommand;
|
||||
import org.apache.hadoop.hbase.hql.TableFormatter;
|
||||
|
|
|
@ -25,12 +25,12 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.HConnection;
|
||||
import org.apache.hadoop.hbase.HConnectionManager;
|
||||
import org.apache.hadoop.hbase.client.HConnection;
|
||||
import org.apache.hadoop.hbase.client.HConnectionManager;
|
||||
import org.apache.hadoop.io.Text;
|
||||
|
||||
import org.apache.hadoop.hbase.BloomFilterDescriptor;
|
||||
|
|
|
@ -24,11 +24,11 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
import org.apache.hadoop.hbase.HConnection;
|
||||
import org.apache.hadoop.hbase.HConnectionManager;
|
||||
import org.apache.hadoop.hbase.client.HConnection;
|
||||
import org.apache.hadoop.hbase.client.HConnectionManager;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.io.Text;
|
||||
|
||||
|
@ -45,12 +45,11 @@ public class CreateCommand extends SchemaModificationCommand {
|
|||
|
||||
public ReturnMsg execute(HBaseConfiguration conf) {
|
||||
try {
|
||||
HConnection conn = HConnectionManager.getConnection(conf);
|
||||
if (conn.tableExists(tableName)) {
|
||||
HBaseAdmin admin = new HBaseAdmin(conf);
|
||||
if (admin.tableExists(tableName)) {
|
||||
return new ReturnMsg(0, "'" + tableName + "' table already exist.");
|
||||
}
|
||||
|
||||
HBaseAdmin admin = new HBaseAdmin(conf);
|
||||
HTableDescriptor tableDesc = new HTableDescriptor(tableName.toString());
|
||||
HColumnDescriptor columnDesc = null;
|
||||
Set<String> columns = columnSpecMap.keySet();
|
||||
|
|
|
@ -24,12 +24,10 @@ import java.io.Writer;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HConnection;
|
||||
import org.apache.hadoop.hbase.HConnectionManager;
|
||||
import org.apache.hadoop.hbase.HTable;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
|
||||
/**
|
||||
* Deletes values from tables.
|
||||
|
@ -48,12 +46,12 @@ public class DeleteCommand extends BasicCommand {
|
|||
throw new IllegalArgumentException("Column list is null");
|
||||
}
|
||||
try {
|
||||
HConnection conn = HConnectionManager.getConnection(conf);
|
||||
if (!conn.tableExists(tableName)) {
|
||||
HBaseAdmin admin = new HBaseAdmin(conf);
|
||||
|
||||
if (!admin.tableExists(tableName)) {
|
||||
return new ReturnMsg(0, "'" + tableName + "'" + TABLE_NOT_FOUND);
|
||||
}
|
||||
|
||||
HBaseAdmin admin = new HBaseAdmin(conf);
|
||||
HTable hTable = new HTable(conf, tableName);
|
||||
|
||||
if (rowKey != null) {
|
||||
|
|
|
@ -24,8 +24,7 @@ import java.io.Writer;
|
|||
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
import org.apache.hadoop.hbase.HConnection;
|
||||
import org.apache.hadoop.hbase.HConnectionManager;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.io.Text;
|
||||
|
||||
|
@ -52,11 +51,11 @@ public class DescCommand extends BasicCommand {
|
|||
if (tableName == null)
|
||||
return new ReturnMsg(0, "Syntax error : Please check 'Describe' syntax.");
|
||||
try {
|
||||
HConnection conn = HConnectionManager.getConnection(conf);
|
||||
if (!conn.tableExists(tableName)) {
|
||||
HBaseAdmin admin = new HBaseAdmin(conf);
|
||||
if (!admin.tableExists(tableName)) {
|
||||
return new ReturnMsg(0, "Table not found.");
|
||||
}
|
||||
HTableDescriptor[] tables = conn.listTables();
|
||||
HTableDescriptor[] tables = admin.listTables();
|
||||
HColumnDescriptor[] columns = null;
|
||||
for (int i = 0; i < tables.length; i++) {
|
||||
if (tables[i].getName().equals(tableName)) {
|
||||
|
|
|
@ -22,10 +22,8 @@ package org.apache.hadoop.hbase.hql;
|
|||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HConnection;
|
||||
import org.apache.hadoop.hbase.HConnectionManager;
|
||||
import org.apache.hadoop.io.Text;
|
||||
|
||||
/**
|
||||
|
@ -42,12 +40,12 @@ public class DisableCommand extends BasicCommand {
|
|||
assert tableName != null;
|
||||
|
||||
try {
|
||||
HConnection conn = HConnectionManager.getConnection(conf);
|
||||
if (!conn.tableExists(new Text(tableName))) {
|
||||
HBaseAdmin admin = new HBaseAdmin(conf);
|
||||
|
||||
if (!admin.tableExists(new Text(tableName))) {
|
||||
return new ReturnMsg(0, "'" + tableName + "'" + TABLE_NOT_FOUND);
|
||||
}
|
||||
|
||||
HBaseAdmin admin = new HBaseAdmin(conf);
|
||||
admin.disableTable(new Text(tableName));
|
||||
|
||||
return new ReturnMsg(1, "Table disabled successfully.");
|
||||
|
|
|
@ -23,10 +23,8 @@ import java.io.IOException;
|
|||
import java.io.Writer;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HConnection;
|
||||
import org.apache.hadoop.hbase.HConnectionManager;
|
||||
import org.apache.hadoop.io.Text;
|
||||
|
||||
/**
|
||||
|
@ -46,11 +44,10 @@ public class DropCommand extends BasicCommand {
|
|||
|
||||
try {
|
||||
HBaseAdmin admin = new HBaseAdmin(conf);
|
||||
HConnection conn = HConnectionManager.getConnection(conf);
|
||||
|
||||
int count = 0;
|
||||
for (String table : tableList) {
|
||||
if (!conn.tableExists(new Text(table))) {
|
||||
if (!admin.tableExists(new Text(table))) {
|
||||
println("'" + table + "' table not found.");
|
||||
} else {
|
||||
println("Dropping " + table + "... Please wait.");
|
||||
|
|
|
@ -22,10 +22,8 @@ package org.apache.hadoop.hbase.hql;
|
|||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HConnection;
|
||||
import org.apache.hadoop.hbase.HConnectionManager;
|
||||
import org.apache.hadoop.io.Text;
|
||||
|
||||
/**
|
||||
|
@ -41,12 +39,10 @@ public class EnableCommand extends BasicCommand {
|
|||
public ReturnMsg execute(HBaseConfiguration conf) {
|
||||
assert tableName != null;
|
||||
try {
|
||||
HConnection conn = HConnectionManager.getConnection(conf);
|
||||
if (!conn.tableExists(new Text(tableName))) {
|
||||
HBaseAdmin admin = new HBaseAdmin(conf);
|
||||
if (!admin.tableExists(new Text(tableName))) {
|
||||
return new ReturnMsg(0, "'" + tableName + "'" + TABLE_NOT_FOUND);
|
||||
}
|
||||
|
||||
HBaseAdmin admin = new HBaseAdmin(conf);
|
||||
admin.enableTable(new Text(tableName));
|
||||
return new ReturnMsg(1, "Table enabled successfully.");
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -24,10 +24,10 @@ import java.io.Writer;
|
|||
import java.util.List;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HConnection;
|
||||
import org.apache.hadoop.hbase.HConnectionManager;
|
||||
import org.apache.hadoop.hbase.HTable;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.MasterNotRunningException;
|
||||
|
||||
/**
|
||||
* Inserts values into tables.
|
||||
|
@ -47,8 +47,9 @@ public class InsertCommand extends BasicCommand {
|
|||
if (tableName == null || values == null || rowKey == null)
|
||||
return new ReturnMsg(0, "Syntax error : Please check 'Insert' syntax.");
|
||||
|
||||
HConnection conn = HConnectionManager.getConnection(conf);
|
||||
if (!conn.tableExists(tableName)) {
|
||||
try {
|
||||
HBaseAdmin admin = new HBaseAdmin(conf);
|
||||
if (!admin.tableExists(tableName)) {
|
||||
return new ReturnMsg(0, "'" + tableName + "'" + TABLE_NOT_FOUND);
|
||||
}
|
||||
|
||||
|
@ -79,6 +80,9 @@ public class InsertCommand extends BasicCommand {
|
|||
String[] msg = e.getMessage().split("[\n]");
|
||||
return new ReturnMsg(0, msg[0]);
|
||||
}
|
||||
} catch (MasterNotRunningException e) {
|
||||
return new ReturnMsg(0, "Master is not running!");
|
||||
}
|
||||
}
|
||||
|
||||
public void setTable(String table) {
|
||||
|
|
|
@ -28,14 +28,10 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HConnection;
|
||||
import org.apache.hadoop.hbase.HConnectionManager;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HScannerInterface;
|
||||
import org.apache.hadoop.hbase.HStoreKey;
|
||||
import org.apache.hadoop.hbase.HTable;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.Shell;
|
||||
import org.apache.hadoop.hbase.filter.RowFilterInterface;
|
||||
|
@ -44,6 +40,8 @@ import org.apache.hadoop.hbase.filter.WhileMatchRowFilter;
|
|||
import org.apache.hadoop.hbase.hql.generated.HQLParser;
|
||||
import org.apache.hadoop.hbase.util.Writables;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
|
||||
/**
|
||||
* Selects values from tables.
|
||||
|
@ -82,13 +80,12 @@ public class SelectCommand extends BasicCommand {
|
|||
return new ReturnMsg(0, "Syntax error : Please check 'Select' syntax.");
|
||||
}
|
||||
try {
|
||||
HConnection conn = HConnectionManager.getConnection(conf);
|
||||
if (!conn.tableExists(tableName) && !isMetaTable()) {
|
||||
HBaseAdmin admin = new HBaseAdmin(conf);
|
||||
if (!admin.tableExists(tableName) && !isMetaTable()) {
|
||||
return new ReturnMsg(0, "'" + tableName + "'" + TABLE_NOT_FOUND);
|
||||
}
|
||||
|
||||
HTable table = new HTable(conf, tableName);
|
||||
HBaseAdmin admin = new HBaseAdmin(conf);
|
||||
int count = 0;
|
||||
if (whereClause) {
|
||||
if (countFunction) {
|
||||
|
|
|
@ -22,7 +22,7 @@ package org.apache.hadoop.hbase.hql;
|
|||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
|
||||
|
|
|
@ -22,11 +22,9 @@ package org.apache.hadoop.hbase.hql;
|
|||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
import org.apache.hadoop.hbase.HConnection;
|
||||
import org.apache.hadoop.hbase.HConnectionManager;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.io.Text;
|
||||
|
||||
|
@ -45,14 +43,12 @@ public class TruncateCommand extends BasicCommand {
|
|||
return new ReturnMsg(0, "Syntax error : Please check 'Truncate' syntax.");
|
||||
|
||||
try {
|
||||
HConnection conn = HConnectionManager.getConnection(conf);
|
||||
HBaseAdmin admin = new HBaseAdmin(conf);
|
||||
|
||||
if (!conn.tableExists(tableName)) {
|
||||
if (!admin.tableExists(tableName)) {
|
||||
return new ReturnMsg(0, "Table not found.");
|
||||
}
|
||||
|
||||
HTableDescriptor[] tables = conn.listTables();
|
||||
HTableDescriptor[] tables = admin.listTables();
|
||||
HColumnDescriptor[] columns = null;
|
||||
for (int i = 0; i < tables.length; i++) {
|
||||
if (tables[i].getName().equals(tableName)) {
|
||||
|
|
|
@ -37,10 +37,10 @@ import org.apache.hadoop.mapred.RecordReader;
|
|||
import org.apache.hadoop.mapred.Reporter;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HTable;
|
||||
import org.apache.hadoop.hbase.HScannerInterface;
|
||||
import org.apache.hadoop.hbase.HStoreKey;
|
||||
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ import org.apache.hadoop.mapred.Reporter;
|
|||
import org.apache.hadoop.util.Progressable;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HTable;
|
||||
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
|
@ -62,8 +62,8 @@ import org.apache.hadoop.hbase.HConstants;
|
|||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.Leases;
|
||||
import org.apache.hadoop.hbase.HServerAddress;
|
||||
import org.apache.hadoop.hbase.HConnection;
|
||||
import org.apache.hadoop.hbase.HConnectionManager;
|
||||
import org.apache.hadoop.hbase.client.HConnection;
|
||||
import org.apache.hadoop.hbase.client.HConnectionManager;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.HRegionInterface;
|
||||
|
@ -72,7 +72,7 @@ import org.apache.hadoop.hbase.HServerLoad;
|
|||
import org.apache.hadoop.hbase.HRegion;
|
||||
import org.apache.hadoop.hbase.RemoteExceptionHandler;
|
||||
import org.apache.hadoop.hbase.HMsg;
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.LocalHBaseCluster;
|
||||
import org.apache.hadoop.hbase.HStoreKey;
|
||||
import org.apache.hadoop.hbase.HServerInfo;
|
||||
|
|
|
@ -28,7 +28,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.util.InfoServer;
|
||||
import org.apache.hadoop.mapred.StatusHttpServer;
|
||||
|
|
|
@ -29,16 +29,15 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HTable;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.mortbay.servlet.MultiPartResponse;
|
||||
import org.znerd.xmlenc.LineBreak;
|
||||
import org.znerd.xmlenc.XMLOutputter;
|
||||
|
||||
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
/**
|
||||
* GenericHandler contains some basic common stuff that all the individual
|
||||
* REST handler types take advantage of.
|
||||
|
|
|
@ -26,7 +26,7 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.znerd.xmlenc.XMLOutputter;
|
||||
|
|
|
@ -30,8 +30,8 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HTable;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HScannerInterface;
|
||||
|
|
|
@ -33,13 +33,14 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.HTable;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
|
||||
import org.mortbay.servlet.MultiPartResponse;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
|
|
@ -30,13 +30,12 @@ import java.util.Map.Entry;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HScannerInterface;
|
||||
import org.apache.hadoop.hbase.HStoreKey;
|
||||
import org.apache.hadoop.hbase.HTable;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.MasterNotRunningException;
|
||||
import org.apache.hadoop.hbase.thrift.generated.AlreadyExists;
|
||||
|
@ -49,6 +48,7 @@ import org.apache.hadoop.hbase.thrift.generated.NotFound;
|
|||
import org.apache.hadoop.hbase.thrift.generated.RegionDescriptor;
|
||||
import org.apache.hadoop.hbase.thrift.generated.ScanEntry;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
|
||||
import com.facebook.thrift.TException;
|
||||
import com.facebook.thrift.protocol.TBinaryProtocol;
|
||||
|
|
|
@ -51,7 +51,7 @@ import org.apache.hadoop.util.GenericOptionsParser;
|
|||
import org.apache.hadoop.util.Tool;
|
||||
import org.apache.hadoop.util.ToolRunner;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseConfiguration;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HLog;
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.hadoop.hbase;
|
|||
|
||||
import junit.framework.TestSuite;
|
||||
import junit.textui.TestRunner;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
|
||||
/**
|
||||
* Test ability of HBase to handle DFS failure
|
||||
|
|
|
@ -43,6 +43,8 @@ import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
|
|||
import org.apache.hadoop.hbase.util.Writables;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.io.Writable;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
|
||||
/**
|
||||
* Additional scanner tests.
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.io.PrintWriter;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.util.ReflectionUtils;
|
||||
import org.apache.hadoop.hbase.client.HConnectionManager;
|
||||
|
||||
/**
|
||||
* Abstract base class for HBase cluster junit tests. Spins up an hbase
|
||||
|
|
|
@ -32,6 +32,7 @@ import org.apache.hadoop.fs.Path;
|
|||
import org.apache.hadoop.hbase.HColumnDescriptor.CompressionType;
|
||||
import org.apache.hadoop.hbase.io.BatchUpdate;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
|
||||
/**
|
||||
* Abstract base class for test cases. Performs all static initialization
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.hadoop.fs.FileSystem;
|
|||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.hbase.util.Writables;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
|
||||
/**
|
||||
* Utility class to build a table of multiple regions.
|
||||
|
|
|
@ -46,6 +46,8 @@ import org.apache.hadoop.mapred.Reporter;
|
|||
import org.apache.hadoop.mapred.TextInputFormat;
|
||||
import org.apache.hadoop.mapred.TextOutputFormat;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
|
||||
/**
|
||||
* Script used evaluating HBase performance and scalability. Runs a HBase
|
||||
|
|
|
@ -23,6 +23,8 @@ import java.io.IOException;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
|
||||
/** Tests per-column bloom filters */
|
||||
public class TestBloomFilters extends HBaseClusterTestCase {
|
||||
|
|
|
@ -25,6 +25,8 @@ import java.util.Set;
|
|||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
|
||||
/**
|
||||
* Test HBase Master and Region servers, client API
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.net.URL;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
|
||||
/**
|
||||
* Testing, info servers are disabled. This test enables then and checks that
|
||||
|
|
|
@ -26,6 +26,8 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.dfs.MiniDFSCluster;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
|
||||
/**
|
||||
* Test log deletion as logs are rolled.
|
||||
|
|
|
@ -22,6 +22,8 @@ package org.apache.hadoop.hbase;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
|
||||
/** tests administrative functions */
|
||||
public class TestMasterAdmin extends HBaseClusterTestCase {
|
||||
|
|
|
@ -29,6 +29,8 @@ import org.apache.commons.logging.LogFactory;
|
|||
import org.apache.hadoop.io.Text;
|
||||
|
||||
import org.apache.hadoop.hbase.io.BatchUpdate;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
|
||||
/**
|
||||
* Tests region server failover when a region server exits both cleanly and
|
||||
|
|
|
@ -28,6 +28,8 @@ import java.util.SortedMap;
|
|||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
|
||||
/** test the scanner API at all levels */
|
||||
public class TestScannerAPI extends HBaseClusterTestCase {
|
||||
|
|
|
@ -22,6 +22,8 @@ import org.apache.hadoop.io.Text;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
|
||||
/** Tests table creation restrictions*/
|
||||
public class TestTable extends HBaseClusterTestCase {
|
||||
|
|
|
@ -26,6 +26,8 @@ import org.apache.hadoop.dfs.MiniDFSCluster;
|
|||
import org.apache.hadoop.hbase.HColumnDescriptor.CompressionType;
|
||||
import org.apache.hadoop.hbase.util.Writables;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
|
||||
/**
|
||||
* Tests user specifiable time stamps putting, getting and scanning. Also
|
||||
|
|
|
@ -17,13 +17,19 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.hbase;
|
||||
package org.apache.hadoop.hbase.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.HBaseClusterTestCase;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HScannerInterface;
|
||||
import org.apache.hadoop.hbase.HStoreKey;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
|
||||
/**
|
||||
* Test batch updates
|
|
@ -17,7 +17,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.hbase;
|
||||
package org.apache.hadoop.hbase.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
@ -27,7 +27,13 @@ import org.apache.hadoop.io.Text;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseClusterTestCase;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.TableNotFoundException;
|
||||
import org.apache.hadoop.hbase.HScannerInterface;
|
||||
import org.apache.hadoop.hbase.HStoreKey;
|
||||
|
||||
/**
|
||||
* Tests HTable
|
|
@ -17,11 +17,15 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.hbase;
|
||||
package org.apache.hadoop.hbase.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import org.apache.hadoop.hbase.HBaseClusterTestCase;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
|
||||
/**
|
||||
* Tests the listTables client API
|
|
@ -17,9 +17,12 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.hbase;
|
||||
package org.apache.hadoop.hbase.client;
|
||||
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.hbase.HBaseClusterTestCase;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
|
||||
/**
|
||||
* Tests that HClient protects against multiple updates
|
|
@ -28,7 +28,7 @@ import java.io.Writer;
|
|||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HBaseClusterTestCase;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
|
|
|
@ -34,13 +34,13 @@ import org.apache.hadoop.dfs.MiniDFSCluster;
|
|||
import org.apache.hadoop.fs.FileStatus;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HRegion;
|
||||
import org.apache.hadoop.hbase.HScannerInterface;
|
||||
import org.apache.hadoop.hbase.HStoreKey;
|
||||
import org.apache.hadoop.hbase.HTable;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.MiniHBaseCluster;
|
||||
import org.apache.hadoop.hbase.MultiRegionTable;
|
||||
|
|
|
@ -28,12 +28,12 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.dfs.MiniDFSCluster;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.hbase.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||
import org.apache.hadoop.hbase.HColumnDescriptor;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HScannerInterface;
|
||||
import org.apache.hadoop.hbase.HStoreKey;
|
||||
import org.apache.hadoop.hbase.HTable;
|
||||
import org.apache.hadoop.hbase.client.HTable;
|
||||
import org.apache.hadoop.hbase.HTableDescriptor;
|
||||
import org.apache.hadoop.hbase.MiniHBaseCluster;
|
||||
import org.apache.hadoop.hbase.MultiRegionTable;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
import="org.apache.hadoop.hbase.master.HMaster"
|
||||
import="org.apache.hadoop.hbase.HConstants"
|
||||
import="org.apache.hadoop.hbase.master.MetaRegion"
|
||||
import="org.apache.hadoop.hbase.HBaseAdmin"
|
||||
import="org.apache.hadoop.hbase.client.HBaseAdmin"
|
||||
import="org.apache.hadoop.hbase.HServerInfo"
|
||||
import="org.apache.hadoop.hbase.HServerAddress"
|
||||
import="org.apache.hadoop.hbase.HBaseConfiguration"
|
||||
|
|
Loading…
Reference in New Issue