You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2008/08/17 00:03:35 UTC
svn commit: r686567 [1/3] - in /hadoop/hbase/branches/0.2: ./ lib/
src/examples/thrift/ src/java/org/apache/hadoop/hbase/thrift/
src/java/org/apache/hadoop/hbase/thrift/generated/
Author: stack
Date: Sat Aug 16 15:03:35 2008
New Revision: 686567
URL: http://svn.apache.org/viewvc?rev=686567&view=rev
Log:
HBASE-697 thrift idl needs update/edit to match new 0.2 API (and to fix bugs)
Added:
hadoop/hbase/branches/0.2/lib/libthrift-20080411p1.jar (with props)
Removed:
hadoop/hbase/branches/0.2/lib/libthrift-r746.jar
Modified:
hadoop/hbase/branches/0.2/CHANGES.txt
hadoop/hbase/branches/0.2/src/examples/thrift/DemoClient.java
hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/Hbase.thrift
hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/ThriftUtilities.java
hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/AlreadyExists.java
hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/BatchMutation.java
hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/ColumnDescriptor.java
hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/Constants.java
hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/Hbase.java
hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/IOError.java
hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/IllegalArgument.java
hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/Mutation.java
hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/NotFound.java
hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/RegionDescriptor.java
hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/ScanEntry.java
hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/package.html
Modified: hadoop/hbase/branches/0.2/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/CHANGES.txt?rev=686567&r1=686566&r2=686567&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.2/CHANGES.txt Sat Aug 16 15:03:35 2008
@@ -3,6 +3,9 @@
Release 0.2.1 - Unreleased
INCOMPATIBLE CHANGES
+ HBASE-697 Thrift idl needs update/edit to match new 0.2 API (and to fix bugs)
+ (Tim Sell via Stack)
+
BUG FIXES
HBASE-805 Remove unnecessary getRow overloads in HRS (Jonathan Gray via
Jim Kellerman) (Fix whitespace changes in HRegionServer)
Added: hadoop/hbase/branches/0.2/lib/libthrift-20080411p1.jar
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/lib/libthrift-20080411p1.jar?rev=686567&view=auto
==============================================================================
Binary file - no diff available.
Propchange: hadoop/hbase/branches/0.2/lib/libthrift-20080411p1.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: hadoop/hbase/branches/0.2/src/examples/thrift/DemoClient.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/examples/thrift/DemoClient.java?rev=686567&r1=686566&r2=686567&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/examples/thrift/DemoClient.java (original)
+++ hadoop/hbase/branches/0.2/src/examples/thrift/DemoClient.java Sat Aug 16 15:03:35 2008
@@ -25,8 +25,9 @@
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.text.NumberFormat;
-import java.util.AbstractMap;
import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
import java.util.TreeMap;
import java.util.SortedMap;
@@ -37,7 +38,9 @@
import org.apache.hadoop.hbase.thrift.generated.IllegalArgument;
import org.apache.hadoop.hbase.thrift.generated.Mutation;
import org.apache.hadoop.hbase.thrift.generated.NotFound;
-import org.apache.hadoop.hbase.thrift.generated.ScanEntry;
+import org.apache.hadoop.hbase.thrift.generated.TCell;
+import org.apache.hadoop.hbase.thrift.generated.TRowResult;
+
import com.facebook.thrift.TException;
import com.facebook.thrift.protocol.TBinaryProtocol;
import com.facebook.thrift.protocol.TProtocol;
@@ -81,6 +84,7 @@
private void run() throws IOError, TException, NotFound, IllegalArgument,
AlreadyExists {
+
TTransport transport = new TSocket("localhost", port);
TProtocol protocol = new TBinaryProtocol(transport, true, true);
Hbase.Client client = new Hbase.Client(protocol);
@@ -96,7 +100,10 @@
for (byte[] name : client.getTableNames()) {
System.out.println(" found: " + utf8(name));
if (utf8(name).equals(utf8(t))) {
- System.out.println(" deleting table: " + utf8(name));
+ System.out.println(" disabling table: " + utf8(name));
+ if (client.isTableEnabled(name))
+ client.disableTable(name);
+ System.out.println(" deleting table: " + utf8(name));
client.deleteTable(name);
}
}
@@ -122,7 +129,7 @@
}
System.out.println("column families in " + utf8(t) + ": ");
- AbstractMap<byte[], ColumnDescriptor> columnMap = client.getColumnDescriptors(t);
+ Map<byte[], ColumnDescriptor> columnMap = client.getColumnDescriptors(t);
for (ColumnDescriptor col2 : columnMap.values()) {
System.out.println(" column: " + utf8(col2.name) + ", maxVer: " + Integer.toString(col2.maxVersions));
}
@@ -133,18 +140,27 @@
byte[] invalid = { (byte) 'f', (byte) 'o', (byte) 'o', (byte) '-', (byte) 0xfc, (byte) 0xa1, (byte) 0xa1, (byte) 0xa1, (byte) 0xa1 };
byte[] valid = { (byte) 'f', (byte) 'o', (byte) 'o', (byte) '-', (byte) 0xE7, (byte) 0x94, (byte) 0x9F, (byte) 0xE3, (byte) 0x83, (byte) 0x93, (byte) 0xE3, (byte) 0x83, (byte) 0xBC, (byte) 0xE3, (byte) 0x83, (byte) 0xAB};
+ ArrayList<Mutation> mutations;
// non-utf8 is fine for data
- client.put(t, bytes("foo"), bytes("entry:foo"), invalid);
+ mutations = new ArrayList<Mutation>();
+ mutations.add(new Mutation(false, bytes("entry:foo"), invalid));
+ client.mutateRow(t, bytes("foo"), mutations);
// try empty strings
- client.put(t, bytes(""), bytes("entry:"), bytes(""));
-
+ mutations = new ArrayList<Mutation>();
+ mutations.add(new Mutation(false, bytes("entry:"), bytes("")));
+ client.mutateRow(t, bytes(""), mutations);
+
// this row name is valid utf8
- client.put(t, valid, bytes("entry:foo"), valid);
+ mutations = new ArrayList<Mutation>();
+ mutations.add(new Mutation(false, bytes("entry:foo"), valid));
+ client.mutateRow(t, bytes("foo"), mutations);
// non-utf8 is not allowed in row names
try {
- client.put(t, invalid, bytes("entry:foo"), invalid);
+ mutations = new ArrayList<Mutation>();
+ mutations.add(new Mutation(false, bytes("entry:foo"), invalid));
+ client.mutateRow(t, invalid, mutations);
System.out.println("FATAL: shouldn't get here");
System.exit(-1);
} catch (IOError e) {
@@ -156,12 +172,11 @@
columnNames.add(bytes("entry:"));
System.out.println("Starting scanner...");
- int scanner = client
- .scannerOpen(t, bytes(""), columnNames);
+ int scanner = client.scannerOpen(t, bytes(""), columnNames);
try {
while (true) {
- ScanEntry value = client.scannerGet(scanner);
- printEntry(value);
+ TRowResult entry = client.scannerGet(scanner);
+ printRow(entry);
}
} catch (NotFound nf) {
client.scannerClose(scanner);
@@ -178,16 +193,20 @@
nf.setGroupingUsed(false);
byte[] row = bytes(nf.format(i));
- client.put(t, row, bytes("unused:"), bytes("DELETE_ME"));
- printRow(row, client.getRow(t, row));
+ mutations = new ArrayList<Mutation>();
+ mutations.add(new Mutation(false, bytes("unused:"), bytes("DELETE_ME")));
+ client.mutateRow(t, row, mutations);
+ printRow(client.getRow(t, row));
client.deleteAllRow(t, row);
- client.put(t, row, bytes("entry:num"), bytes("0"));
- client.put(t, row, bytes("entry:foo"), bytes("FOO"));
- printRow(row, client.getRow(t, row));
+ mutations = new ArrayList<Mutation>();
+ mutations.add(new Mutation(false, bytes("entry:num"), bytes("0")));
+ mutations.add(new Mutation(false, bytes("entry:foo"), bytes("FOO")));
+ client.mutateRow(t, row, mutations);
+ printRow(client.getRow(t, row));
- Mutation m = null;
- ArrayList<Mutation> mutations = new ArrayList<Mutation>();
+ Mutation m = null;
+ mutations = new ArrayList<Mutation>();
m = new Mutation();
m.column = bytes("entry:foo");
m.isDelete = true;
@@ -197,11 +216,13 @@
m.value = bytes("-1");
mutations.add(m);
client.mutateRow(t, row, mutations);
- printRow(row, client.getRow(t, row));
+ printRow(client.getRow(t, row));
- client.put(t, row, bytes("entry:num"), bytes(Integer.toString(i)));
- client.put(t, row, bytes("entry:sqr"), bytes(Integer.toString(i * i)));
- printRow(row, client.getRow(t, row));
+ mutations = new ArrayList<Mutation>();
+ mutations.add(new Mutation(false, bytes("entry:num"), bytes(Integer.toString(i))));
+ mutations.add(new Mutation(false, bytes("entry:sqr"), bytes(Integer.toString(i * i))));
+ client.mutateRow(t, row, mutations);
+ printRow(client.getRow(t, row));
// sleep to force later timestamp
try {
@@ -219,9 +240,9 @@
m.column = bytes("entry:sqr");
m.isDelete = true;
client.mutateRowTs(t, row, mutations, 1); // shouldn't override latest
- printRow(row, client.getRow(t, row));
+ printRow(client.getRow(t, row));
- ArrayList<byte[]> versions = client.getVer(t, row, bytes("entry:num"), 10);
+ List<TCell> versions = client.getVer(t, row, bytes("entry:num"), 10);
printVersions(row, versions);
if (versions.size() != 4) {
System.out.println("FATAL: wrong # of versions");
@@ -243,7 +264,9 @@
columnNames.clear();
for (ColumnDescriptor col2 : client.getColumnDescriptors(t).values()) {
- columnNames.add(col2.name);
+ System.out.println("column name is " + new String(col2.name));
+ System.out.println(col2.toString());
+ columnNames.add((utf8(col2.name) + ":").getBytes());
}
System.out.println("Starting scanner...");
@@ -251,8 +274,8 @@
columnNames);
try {
while (true) {
- ScanEntry value = client.scannerGet(scanner);
- printEntry(value);
+ TRowResult entry = client.scannerGet(scanner);
+ printRow(entry);
}
} catch (NotFound nf) {
client.scannerClose(scanner);
@@ -262,34 +285,30 @@
transport.close();
}
- private final void printVersions(byte[] row, ArrayList<byte[]> values) {
+ private final void printVersions(byte[] row, List<TCell> versions) {
StringBuilder rowStr = new StringBuilder();
- for (byte[] value : values) {
- rowStr.append(utf8(value));
+ for (TCell cell : versions) {
+ rowStr.append(utf8(cell.value));
rowStr.append("; ");
}
System.out.println("row: " + utf8(row) + ", values: " + rowStr);
}
- private final void printEntry(ScanEntry entry) {
- printRow(entry.row, entry.columns);
- }
-
- private final void printRow(byte[] row, AbstractMap<byte[], byte[]> values) {
+ private final void printRow(TRowResult rowResult) {
// copy values into a TreeMap to get them in sorted order
- TreeMap<String,byte[]> sorted = new TreeMap<String,byte[]>();
- for (AbstractMap.Entry<byte[], byte[]> entry : values.entrySet()) {
- sorted.put(utf8(entry.getKey()), entry.getValue());
+ TreeMap<String,TCell> sorted = new TreeMap<String,TCell>();
+ for (Map.Entry<byte[], TCell> column : rowResult.columns.entrySet()) {
+ sorted.put(utf8(column.getKey()), column.getValue());
}
StringBuilder rowStr = new StringBuilder();
- for (SortedMap.Entry<String, byte[]> entry : sorted.entrySet()) {
+ for (SortedMap.Entry<String, TCell> entry : sorted.entrySet()) {
rowStr.append(entry.getKey());
rowStr.append(" => ");
- rowStr.append(utf8(entry.getValue()));
+ rowStr.append(utf8(entry.getValue().value));
rowStr.append("; ");
}
- System.out.println("row: " + utf8(row) + ", cols: " + rowStr);
+ System.out.println("row: " + utf8(rowResult.row) + ", cols: " + rowStr);
}
}
Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/Hbase.thrift
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/Hbase.thrift?rev=686567&r1=686566&r2=686567&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/Hbase.thrift (original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/Hbase.thrift Sat Aug 16 15:03:35 2008
@@ -31,9 +31,10 @@
// used to generate the *.java files checked into the Hbase project.
// ----------------------------------------------------------------
-java_package org.apache.hadoop.hbase.thrift.generated
-cpp_namespace apache.hadoop.hbase.thrift
-ruby_namespace Apache.Hadoop.Hbase.Thrift
+namespace java org.apache.hadoop.hbase.thrift.generated
+namespace cpp apache.hadoop.hbase.thrift
+namespace rb Apache.Hadoop.Hbase.Thrift
+
// note: other language namespaces tbd...
//
@@ -50,6 +51,16 @@
typedef binary Bytes
typedef i32 ScannerID
+/**
+ * TCell - Used to transport a cell value (byte[]) and the timestamp it was
+ * stored with together as a result for get and getRow methods. This promotes
+ * the timestamp of a cell to a first-class value, making it easy to take
+ * note of temporal data. Cell is used all the way from HStore up to HTable.
+ */
+struct TCell{
+ 1:Bytes value,
+ 2:i64 timestamp
+}
/**
* An HColumnDescriptor contains information about a column family
@@ -70,11 +81,14 @@
}
/**
- * A RegionDescriptor contains informationa about an HTable region.
- * Currently, this is just the startKey of the region.
+ * A TRegionInfo contains information about an HTable region.
*/
-struct RegionDescriptor {
+struct TRegionInfo {
1:Text startKey,
+ 2:Text endKey,
+ 3:i64 id,
+ 4:Text name,
+ 5:byte version
}
/**
@@ -97,12 +111,11 @@
/**
- * A ScanEntry contains the row, column, and value information for a scanner's
- * current location.
+ * Holds row name and then a map of columns to cells.
*/
-struct ScanEntry {
+struct TRowResult {
1:Text row,
- 2:map<Text, Bytes> columns
+ 2:map<Text, TCell> columns
}
//
@@ -146,8 +159,29 @@
//
service Hbase {
+ /**
+ * Brings a table on-line (enables it)
+ * @param tableName name of the table
+ */
+ void enableTable(1:Bytes tableName)
+ throws (1:IOError io)
+
+ /**
+ * Disables a table (takes it off-line) If it is being served, the master
+ * will tell the servers to stop serving it.
+ * @param tableName name of the table
+ */
+ void disableTable(1:Bytes tableName)
+ throws (1:IOError io)
/**
+ * @param tableName name of table to check
+ * @return true if table is on-line
+ */
+ bool isTableEnabled(1:Bytes tableName)
+ throws (1:IOError io)
+
+ /**
* List all the userspace tables.
* @return - returns a list of names
*/
@@ -167,7 +201,7 @@
* @param tableName table name
* @return list of region descriptors
*/
- list<RegionDescriptor> getTableRegions(1:Text tableName)
+ list<TRegionInfo> getTableRegions(1:Text tableName)
throws (1:IOError io)
/**
@@ -194,7 +228,7 @@
throws (1:IOError io, 2:NotFound nf)
/**
- * Get a single value for the specified table, row, and column at the
+ * Get a single TCell for the specified table, row, and column at the
* latest timestamp.
*
* @param tableName name of table
@@ -202,7 +236,7 @@
* @param column column name
* @return value for specified row/column
*/
- Bytes get(1:Text tableName, 2:Text row, 3:Text column)
+ TCell get(1:Text tableName, 2:Text row, 3:Text column)
throws (1:IOError io, 2:NotFound nf)
/**
@@ -213,9 +247,9 @@
* @param row row key
* @param column column name
* @param numVersions number of versions to retrieve
- * @return list of values for specified row/column
+ * @return list of cells for specified row/column
*/
- list<Bytes> getVer(1:Text tableName, 2:Text row, 3:Text column, 4:i32 numVersions)
+ list<TCell> getVer(1:Text tableName, 2:Text row, 3:Text column, 4:i32 numVersions)
throws (1:IOError io, 2:NotFound nf)
/**
@@ -228,9 +262,9 @@
* @param column column name
* @param timestamp timestamp
* @param numVersions number of versions to retrieve
- * @return list of values for specified row/column
+ * @return list of cells for specified row/column
*/
- list<Bytes> getVerTs(1:Text tableName, 2:Text row, 3:Text column, 4:i64 timestamp, 5:i32 numVersions)
+ list<TCell> getVerTs(1:Text tableName, 2:Text row, 3:Text column, 4:i64 timestamp, 5:i32 numVersions)
throws (1:IOError io, 2:NotFound nf)
/**
@@ -239,9 +273,9 @@
*
* @param tableName name of table
* @param row row key
- * @return Map of columns to values. Map is empty if row does not exist.
+ * @return TRowResult containing the row and map of columns to TCells. Map is empty if row does not exist.
*/
- map<Text, Bytes> getRow(1:Text tableName, 2:Text row)
+ TRowResult getRow(1:Text tableName, 2:Text row)
throws (1:IOError io)
/**
@@ -251,25 +285,12 @@
* @param tableName of table
* @param row row key
* @param timestamp timestamp
- * @return Map of columns to values. Map is empty if row does not exist.
+ * @return TRowResult containing the row and map of columns to TCells. Map is empty if row does not exist.
*/
- map<Text, Bytes> getRowTs(1:Text tableName, 2:Text row, 3:i64 timestamp)
+ TRowResult getRowTs(1:Text tableName, 2:Text row, 3:i64 timestamp)
throws (1:IOError io)
/**
- * Put a single value at the specified table, row, and column.
- * To put muliple values in a single transaction, or to specify
- * a non-default timestamp, use {@link #mutateRow} and/or
- * {@link #mutateRowTs}
- *
- * @param tableName name of table
- * @param row row key
- * @param column column name
- */
- void put(1:Text tableName, 2:Text row, 3:Text column, 4:Bytes value)
- throws (1:IOError io, 2:IllegalArgument ia)
-
- /**
* Apply a series of mutations (updates/deletes) to a row in a
* single transaction. If an exception is thrown, then the
* transaction is aborted. Default current timestamp is used, and
@@ -456,11 +477,11 @@
* a NotFound exception is returned.
*
* @param id id of a scanner returned by scannerOpen
- * @return a ScanEntry object representing the current row's values
+ * @return a TRowResult containing the current row and a map of the columns to TCells.
* @throws IllegalArgument if ScannerID is invalid
* @throws NotFound when the scanner reaches the end
*/
- ScanEntry scannerGet(1:ScannerID id)
+ TRowResult scannerGet(1:ScannerID id)
throws (1:IOError io, 2:IllegalArgument ia, 3:NotFound nf)
/**
Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java?rev=686567&r1=686566&r2=686567&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java (original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/ThriftServer.java Sat Aug 16 15:03:35 2008
@@ -20,18 +20,19 @@
import java.io.IOException;
import java.nio.charset.MalformedInputException;
-import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.TreeMap;
-import java.util.Map.Entry;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.HServerAddress;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.client.HBaseAdmin;
@@ -48,8 +49,9 @@
import org.apache.hadoop.hbase.thrift.generated.IllegalArgument;
import org.apache.hadoop.hbase.thrift.generated.Mutation;
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.hbase.thrift.generated.TRegionInfo;
+import org.apache.hadoop.hbase.thrift.generated.TCell;
+import org.apache.hadoop.hbase.thrift.generated.TRowResult;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.io.Text;
@@ -164,7 +166,34 @@
// used to generate the interface.
//
- public ArrayList<byte[]> getTableNames() throws IOError {
+ public void enableTable(final byte[] tableName) throws IOError {
+ LOG.debug("enableTable");
+ try{
+ admin.enableTable(tableName);
+ } catch (IOException e) {
+ throw new IOError(e.getMessage());
+ }
+ }
+
+ public void disableTable(final byte[] tableName) throws IOError{
+ LOG.debug("disableTable");
+ try{
+ admin.disableTable(tableName);
+ } catch (IOException e) {
+ throw new IOError(e.getMessage());
+ }
+ }
+
+ public boolean isTableEnabled(final byte[] tableName) throws IOError {
+ LOG.debug("isTableEnabled");
+ try {
+ return HTable.isTableEnabled(tableName);
+ } catch (IOException e) {
+ throw new IOError(e.getMessage());
+ }
+ }
+
+ public List<byte[]> getTableNames() throws IOError {
LOG.debug("getTableNames");
try {
HTableDescriptor[] tables = this.admin.listTables();
@@ -178,25 +207,31 @@
}
}
- public ArrayList<RegionDescriptor> getTableRegions(byte[] tableName)
- throws IOError {
- LOG.debug("getTableRegions: " + new String(tableName));
- try {
+ public List<TRegionInfo> getTableRegions(byte[] tableName)
+ throws IOError {
+ try{
+ LOG.debug("getTableRegions: " + new String(tableName));
+
HTable table = getTable(tableName);
- byte [][] startKeys = table.getStartKeys();
- ArrayList<RegionDescriptor> regions = new ArrayList<RegionDescriptor>();
- for (int i = 0; i < startKeys.length; i++) {
- RegionDescriptor region = new RegionDescriptor();
- region.startKey = startKeys[i];
+ Map<HRegionInfo, HServerAddress> regionsInfo = table.getRegionsInfo();
+ List<TRegionInfo> regions = new ArrayList<TRegionInfo>();
+
+ for (HRegionInfo regionInfo : regionsInfo.keySet()){
+ TRegionInfo region = new TRegionInfo();
+ region.startKey = regionInfo.getStartKey();
+ region.endKey = regionInfo.getEndKey();
+ region.id = regionInfo.getRegionId();
+ region.name = regionInfo.getRegionName();
+ region.version = regionInfo.getVersion();
regions.add(region);
}
return regions;
- } catch (IOException e) {
+ } catch (IOException e){
throw new IOError(e.getMessage());
}
}
- public byte[] get(byte[] tableName, byte[] row, byte[] column)
+ public TCell get(byte[] tableName, byte[] row, byte[] column)
throws NotFound, IOError {
if (LOG.isDebugEnabled()) {
LOG.debug("get: table=" + new String(tableName) + ", row="
@@ -204,17 +239,17 @@
}
try {
HTable table = getTable(tableName);
- Cell value = table.get(getText(row), getText(column));
- if (value == null) {
+ Cell cell = table.get(getText(row), getText(column));
+ if (cell == null) {
throw new NotFound();
}
- return value.getValue();
+ return ThriftUtilities.cellFromHBase(cell);
} catch (IOException e) {
throw new IOError(e.getMessage());
}
}
- public ArrayList<byte[]> getVer(byte[] tableName, byte[] row,
+ public List<TCell> getVer(byte[] tableName, byte[] row,
byte[] column, int numVersions) throws IOError, NotFound {
if (LOG.isDebugEnabled()) {
LOG.debug("getVer: table=" + new String(tableName) + ", row="
@@ -223,14 +258,14 @@
}
try {
HTable table = getTable(tableName);
- Cell[] values =
+ Cell[] cells =
table.get(getText(row), getText(column), numVersions);
- if (values == null) {
+ if (cells == null) {
throw new NotFound();
}
- ArrayList<byte[]> list = new ArrayList<byte[]>();
- for (int i = 0; i < values.length; i++) {
- list.add(values[i].getValue());
+ List<TCell> list = new ArrayList<TCell>();
+ for (int i = 0; i < cells.length; i++) {
+ list.add(ThriftUtilities.cellFromHBase(cells[i]));
}
return list;
} catch (IOException e) {
@@ -238,7 +273,7 @@
}
}
- public ArrayList<byte[]> getVerTs(byte[] tableName, byte[] row,
+ public List<TCell> getVerTs(byte[] tableName, byte[] row,
byte[] column, long timestamp, int numVersions) throws IOError,
NotFound {
if (LOG.isDebugEnabled()) {
@@ -248,14 +283,14 @@
}
try {
HTable table = getTable(tableName);
- Cell[] values = table.get(getText(row),
+ Cell[] cells = table.get(getText(row),
getText(column), timestamp, numVersions);
- if (values == null) {
+ if (cells == null) {
throw new NotFound();
}
- ArrayList<byte[]> list = new ArrayList<byte[]>();
- for (int i = 0; i < values.length; i++) {
- list.add(values[i].getValue());
+ List<TCell> list = new ArrayList<TCell>();
+ for (int i = 0; i < cells.length; i++) {
+ list.add(ThriftUtilities.cellFromHBase(cells[i]));
}
return list;
} catch (IOException e) {
@@ -263,12 +298,12 @@
}
}
- public AbstractMap<byte[], byte[]> getRow(byte[] tableName, byte[] row)
+ public TRowResult getRow(byte[] tableName, byte[] row)
throws IOError {
return getRowTs(tableName, row, HConstants.LATEST_TIMESTAMP);
}
- public AbstractMap<byte[], byte[]> getRowTs(byte[] tableName, byte[] row,
+ public TRowResult getRowTs(byte[] tableName, byte[] row,
long timestamp) throws IOError {
if (LOG.isDebugEnabled()) {
LOG.debug("getRowTs: table=" + new String(tableName) + ", row="
@@ -276,36 +311,9 @@
}
try {
HTable table = getTable(tableName);
- Map<byte [], Cell> values =
- table.getRow(getText(row), timestamp);
- // copy the map from type <Text, Cell> to <byte[], byte[]>
- TreeMap<byte[], byte[]> returnValues =
- new TreeMap<byte[], byte[]>(Bytes.BYTES_COMPARATOR);
- for (Entry<byte [], Cell> e : values.entrySet()) {
- returnValues.put(e.getKey(), e.getValue().getValue());
- }
- return returnValues;
- } catch (IOException e) {
- throw new IOError(e.getMessage());
- }
- }
-
- public void put(byte[] tableName, byte[] row, byte[] column, byte[] value)
- throws IOError, IllegalArgument {
- if (LOG.isDebugEnabled()) {
- LOG.debug("put: table=" + new String(tableName) + ", row="
- + new String(row) + ", col=" + new String(column)
- + ", value.length=" + value.length);
- }
- try {
- HTable table = getTable(tableName);
- BatchUpdate batchUpdate = new BatchUpdate(getText(row));
- batchUpdate.put(getText(column), value);
- table.commit(batchUpdate);
+ return ThriftUtilities.rowResultFromHBase(table.getRow(getText(row), timestamp));
} catch (IOException e) {
throw new IOError(e.getMessage());
- } catch (IllegalArgumentException e) {
- throw new IllegalArgument(e.getMessage());
}
}
@@ -348,7 +356,7 @@
}
public void createTable(byte[] tableName,
- ArrayList<ColumnDescriptor> columnFamilies) throws IOError,
+ List<ColumnDescriptor> columnFamilies) throws IOError,
IllegalArgument, AlreadyExists {
if (LOG.isDebugEnabled()) {
LOG.debug("createTable: table=" + new String(tableName));
@@ -363,7 +371,7 @@
HColumnDescriptor colDesc = ThriftUtilities.colDescFromThrift(col);
desc.addFamily(colDesc);
if (LOG.isDebugEnabled()) {
- LOG.debug("createTable: col=" + colDesc.getName());
+ LOG.debug("createTable: col=" + new String(colDesc.getName()));
}
}
admin.createTable(desc);
@@ -390,29 +398,27 @@
}
public void mutateRow(byte[] tableName, byte[] row,
- ArrayList<Mutation> mutations) throws IOError, IllegalArgument {
+ List<Mutation> mutations) throws IOError, IllegalArgument {
mutateRowTs(tableName, row, mutations, HConstants.LATEST_TIMESTAMP);
}
public void mutateRowTs(byte[] tableName, byte[] row,
- ArrayList<Mutation> mutations, long timestamp) throws IOError, IllegalArgument {
+ List<Mutation> mutations, long timestamp) throws IOError, IllegalArgument {
if (LOG.isDebugEnabled()) {
LOG.debug("mutateRowTs: table=" + new String(tableName) + ", row="
+ new String(row) + ", ts=" + timestamp + " mutations="
+ mutations.size());
for (Mutation m : mutations) {
if (m.isDelete) {
- LOG.debug("mutateRowTs: : delete - " + getText(m.column));
+ LOG.debug("mutateRowTs: : delete - " + new String(getText(m.column)));
} else {
- LOG.debug("mutateRowTs: : put - " + getText(m.column) + " => "
- + m.value);
+ LOG.debug("mutateRowTs: : put - " + new String(getText(m.column)) + " => "
+ + new String(m.value));
}
}
}
- Long lockid = null;
HTable table = null;
-
try {
table = getTable(tableName);
BatchUpdate batchUpdate = new BatchUpdate(getText(row), timestamp);
@@ -431,29 +437,30 @@
}
}
-
- public void mutateRows(byte[] tableName, ArrayList<BatchMutation> rowBatches)
+ public void mutateRows(byte[] tableName, List<BatchMutation> rowBatches)
throws IOError, IllegalArgument, TException {
mutateRowsTs(tableName, rowBatches, HConstants.LATEST_TIMESTAMP);
}
- public void mutateRowsTs(byte[] tableName, ArrayList<BatchMutation> rowBatches, long timestamp)
+ public void mutateRowsTs(byte[] tableName, List<BatchMutation> rowBatches, long timestamp)
throws IOError, IllegalArgument, TException {
- ArrayList<BatchUpdate> batchUpdates = new ArrayList<BatchUpdate>();
+ List<BatchUpdate> batchUpdates = new ArrayList<BatchUpdate>();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("mutateRowsTs: table=" + new String(tableName) + ", rows="
+ + rowBatches.size() + ", ts=" + timestamp);
+ }
for (BatchMutation batch : rowBatches) {
byte[] row = batch.row;
- ArrayList<Mutation> mutations = batch.mutations;
+ List<Mutation> mutations = batch.mutations;
if (LOG.isDebugEnabled()) {
- LOG.debug("mutateRowTs: table=" + new String(tableName) + ", row="
- + new String(row) + ", ts=" + timestamp + " mutations="
- + mutations.size());
+ LOG.debug("mutateRowsTs: : row=" + new String(row) + " mutations=" + mutations.size());
for (Mutation m : mutations) {
if (m.isDelete) {
- LOG.debug("mutateRowTs: : delete - " + getText(m.column));
+ LOG.debug("mutateRowsTs: : delete - " + new String(getText(m.column)));
} else {
- LOG.debug("mutateRowTs: : put - " + getText(m.column) + " => "
- + m.value);
+ LOG.debug("mutateRowsTs: : put - " + new String(getText(m.column)) + " => "
+ + new String(m.value));
}
}
}
@@ -489,7 +496,7 @@
removeScanner(id);
}
- public ScanEntry scannerGet(int id) throws IllegalArgument, NotFound,
+ public TRowResult scannerGet(int id) throws IllegalArgument, NotFound,
IOError {
LOG.debug("scannerGet: id=" + id);
Scanner scanner = getScanner(id);
@@ -507,22 +514,14 @@
} catch (IOException e) {
throw new IOError(e.getMessage());
}
-
- ScanEntry retval = new ScanEntry();
- retval.row = results.getRow();
- retval.columns = new TreeMap<byte[], byte[]>(Bytes.BYTES_COMPARATOR);
-
- for (Map.Entry<byte [], Cell> e : results.entrySet()) {
- retval.columns.put(e.getKey(), e.getValue().getValue());
- }
- return retval;
+ return ThriftUtilities.rowResultFromHBase(results);
}
public int scannerOpen(byte[] tableName, byte[] startRow,
- ArrayList<byte[]> columns) throws IOError {
+ List<byte[]> columns) throws IOError {
if (LOG.isDebugEnabled()) {
- LOG.debug("scannerOpen: table=" + getText(tableName) + ", start="
- + getText(startRow) + ", columns=" + columns.toString());
+ LOG.debug("scannerOpen: table=" + new String(getText(tableName)) + ", start="
+ + new String(getText(startRow)) + ", columns=" + columns.toString());
}
try {
HTable table = getTable(tableName);
@@ -539,10 +538,10 @@
}
public int scannerOpenWithStop(byte[] tableName, byte[] startRow,
- byte[] stopRow, ArrayList<byte[]> columns) throws IOError, TException {
+ byte[] stopRow, List<byte[]> columns) throws IOError, TException {
if (LOG.isDebugEnabled()) {
- LOG.debug("scannerOpen: table=" + getText(tableName) + ", start="
- + getText(startRow) + ", stop=" + getText(stopRow) + ", columns="
+ LOG.debug("scannerOpen: table=" + new String(getText(tableName)) + ", start="
+ + new String(getText(startRow)) + ", stop=" + new String(getText(stopRow)) + ", columns="
+ columns.toString());
}
try {
@@ -560,10 +559,10 @@
}
public int scannerOpenTs(byte[] tableName, byte[] startRow,
- ArrayList<byte[]> columns, long timestamp) throws IOError, TException {
+ List<byte[]> columns, long timestamp) throws IOError, TException {
if (LOG.isDebugEnabled()) {
- LOG.debug("scannerOpen: table=" + getText(tableName) + ", start="
- + getText(startRow) + ", columns=" + columns.toString()
+ LOG.debug("scannerOpen: table=" + new String(getText(tableName)) + ", start="
+ + new String(getText(startRow)) + ", columns=" + columns.toString()
+ ", timestamp=" + timestamp);
}
try {
@@ -581,11 +580,11 @@
}
public int scannerOpenWithStopTs(byte[] tableName, byte[] startRow,
- byte[] stopRow, ArrayList<byte[]> columns, long timestamp)
+ byte[] stopRow, List<byte[]> columns, long timestamp)
throws IOError, TException {
if (LOG.isDebugEnabled()) {
- LOG.debug("scannerOpen: table=" + getText(tableName) + ", start="
- + getText(startRow) + ", stop=" + getText(stopRow) + ", columns="
+ LOG.debug("scannerOpen: table=" + new String(getText(tableName)) + ", start="
+ + new String(getText(startRow)) + ", stop=" + new String(getText(stopRow)) + ", columns="
+ columns.toString() + ", timestamp=" + timestamp);
}
try {
@@ -602,7 +601,7 @@
}
}
- public AbstractMap<byte[], ColumnDescriptor> getColumnDescriptors(
+ public Map<byte[], ColumnDescriptor> getColumnDescriptors(
byte[] tableName) throws IOError, TException {
if (LOG.isDebugEnabled()) {
LOG.debug("getColumnDescriptors: table=" + new String(tableName));
@@ -612,7 +611,7 @@
new TreeMap<byte[], ColumnDescriptor>(Bytes.BYTES_COMPARATOR);
HTable table = getTable(tableName);
- HTableDescriptor desc = table.getMetadata();
+ HTableDescriptor desc = table.getTableDescriptor();
for (HColumnDescriptor e : desc.getFamilies()) {
ColumnDescriptor col = ThriftUtilities.colDescFromHbase(e);
Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/ThriftUtilities.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/ThriftUtilities.java?rev=686567&r1=686566&r2=686567&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/ThriftUtilities.java (original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/ThriftUtilities.java Sat Aug 16 15:03:35 2008
@@ -18,10 +18,21 @@
package org.apache.hadoop.hbase.thrift;
+import java.io.IOException;
+import java.util.Map;
+import java.util.TreeMap;
+
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HColumnDescriptor.CompressionType;
+import org.apache.hadoop.hbase.io.Cell;
+import org.apache.hadoop.hbase.io.RowResult;
import org.apache.hadoop.hbase.thrift.generated.ColumnDescriptor;
+import org.apache.hadoop.hbase.thrift.generated.IOError;
import org.apache.hadoop.hbase.thrift.generated.IllegalArgument;
+import org.apache.hadoop.hbase.thrift.generated.NotFound;
+import org.apache.hadoop.hbase.thrift.generated.TCell;
+import org.apache.hadoop.hbase.thrift.generated.TRowResult;
+import org.apache.hadoop.hbase.util.Bytes;
public class ThriftUtilities {
@@ -71,4 +82,34 @@
return col;
}
-}
\ No newline at end of file
+ /**
+ * This utility method creates a new Thrift TCell "struct" based on
+ * an Hbase Cell object.
+ *
+ * @param in
+ * Hbase Cell object
+ * @return Thrift TCell
+ */
+ static public TCell cellFromHBase(Cell in) {
+ return new TCell(in.getValue(), in.getTimestamp());
+ }
+
+ /**
+ * This utility method creates a new Thrift TRowResult "struct" based on
+ * an Hbase RowResult object.
+ *
+ * @param in
+ * Hbase RowResult object
+ * @return Thrift TRowResult
+ */
+ static public TRowResult rowResultFromHBase(RowResult in) {
+ TRowResult result = new TRowResult();
+ result.row = in.getRow();
+ result.columns = new TreeMap<byte[], TCell>(Bytes.BYTES_COMPARATOR);
+ for (Map.Entry<byte[], Cell> entry : in.entrySet()){
+ result.columns.put(entry.getKey(), ThriftUtilities.cellFromHBase(entry.getValue()));
+ }
+ return result;
+ }
+}
+
Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/AlreadyExists.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/AlreadyExists.java?rev=686567&r1=686566&r2=686567&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/AlreadyExists.java (original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/AlreadyExists.java Sat Aug 16 15:03:35 2008
@@ -23,9 +23,11 @@
*/
package org.apache.hadoop.hbase.thrift.generated;
+import java.util.List;
import java.util.ArrayList;
-import java.util.AbstractMap;
+import java.util.Map;
import java.util.HashMap;
+import java.util.Set;
import java.util.HashSet;
import com.facebook.thrift.*;
@@ -40,7 +42,7 @@
public String message;
public final Isset __isset = new Isset();
- public static final class Isset {
+ public static final class Isset implements java.io.Serializable {
public boolean message = false;
}
@@ -55,6 +57,34 @@
this.__isset.message = true;
}
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof AlreadyExists)
+ return this.equals((AlreadyExists)that);
+ return false;
+ }
+
+ public boolean equals(AlreadyExists that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_message = true && (this.message != null);
+ boolean that_present_message = true && (that.message != null);
+ if (this_present_message || that_present_message) {
+ if (!(this_present_message && that_present_message))
+ return false;
+ if (!this.message.equals(that.message))
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/BatchMutation.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/BatchMutation.java?rev=686567&r1=686566&r2=686567&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/BatchMutation.java (original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/BatchMutation.java Sat Aug 16 15:03:35 2008
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+
/**
* Autogenerated by Thrift
*
@@ -23,9 +23,11 @@
*/
package org.apache.hadoop.hbase.thrift.generated;
+import java.util.List;
import java.util.ArrayList;
-import java.util.AbstractMap;
+import java.util.Map;
import java.util.HashMap;
+import java.util.Set;
import java.util.HashSet;
import com.facebook.thrift.*;
@@ -37,10 +39,10 @@
*/
public class BatchMutation implements TBase, java.io.Serializable {
public byte[] row;
- public ArrayList<Mutation> mutations;
+ public List<Mutation> mutations;
public final Isset __isset = new Isset();
- public static final class Isset {
+ public static final class Isset implements java.io.Serializable {
public boolean row = false;
public boolean mutations = false;
}
@@ -50,7 +52,7 @@
public BatchMutation(
byte[] row,
- ArrayList<Mutation> mutations)
+ List<Mutation> mutations)
{
this();
this.row = row;
@@ -59,6 +61,43 @@
this.__isset.mutations = true;
}
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof BatchMutation)
+ return this.equals((BatchMutation)that);
+ return false;
+ }
+
+ public boolean equals(BatchMutation that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_row = true && (this.row != null);
+ boolean that_present_row = true && (that.row != null);
+ if (this_present_row || that_present_row) {
+ if (!(this_present_row && that_present_row))
+ return false;
+ if (!java.util.Arrays.equals(this.row, that.row))
+ return false;
+ }
+
+ boolean this_present_mutations = true && (this.mutations != null);
+ boolean that_present_mutations = true && (that.mutations != null);
+ if (this_present_mutations || that_present_mutations) {
+ if (!(this_present_mutations && that_present_mutations))
+ return false;
+ if (!this.mutations.equals(that.mutations))
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/ColumnDescriptor.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/ColumnDescriptor.java?rev=686567&r1=686566&r2=686567&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/ColumnDescriptor.java (original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/ColumnDescriptor.java Sat Aug 16 15:03:35 2008
@@ -23,9 +23,11 @@
*/
package org.apache.hadoop.hbase.thrift.generated;
+import java.util.List;
import java.util.ArrayList;
-import java.util.AbstractMap;
+import java.util.Map;
import java.util.HashMap;
+import java.util.Set;
import java.util.HashSet;
import com.facebook.thrift.*;
@@ -50,7 +52,7 @@
public int timeToLive;
public final Isset __isset = new Isset();
- public static final class Isset {
+ public static final class Isset implements java.io.Serializable {
public boolean name = false;
public boolean maxVersions = false;
public boolean compression = false;
@@ -119,6 +121,115 @@
this.__isset.timeToLive = true;
}
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof ColumnDescriptor)
+ return this.equals((ColumnDescriptor)that);
+ return false;
+ }
+
+ public boolean equals(ColumnDescriptor that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_name = true && (this.name != null);
+ boolean that_present_name = true && (that.name != null);
+ if (this_present_name || that_present_name) {
+ if (!(this_present_name && that_present_name))
+ return false;
+ if (!java.util.Arrays.equals(this.name, that.name))
+ return false;
+ }
+
+ boolean this_present_maxVersions = true;
+ boolean that_present_maxVersions = true;
+ if (this_present_maxVersions || that_present_maxVersions) {
+ if (!(this_present_maxVersions && that_present_maxVersions))
+ return false;
+ if (this.maxVersions != that.maxVersions)
+ return false;
+ }
+
+ boolean this_present_compression = true && (this.compression != null);
+ boolean that_present_compression = true && (that.compression != null);
+ if (this_present_compression || that_present_compression) {
+ if (!(this_present_compression && that_present_compression))
+ return false;
+ if (!this.compression.equals(that.compression))
+ return false;
+ }
+
+ boolean this_present_inMemory = true;
+ boolean that_present_inMemory = true;
+ if (this_present_inMemory || that_present_inMemory) {
+ if (!(this_present_inMemory && that_present_inMemory))
+ return false;
+ if (this.inMemory != that.inMemory)
+ return false;
+ }
+
+ boolean this_present_maxValueLength = true;
+ boolean that_present_maxValueLength = true;
+ if (this_present_maxValueLength || that_present_maxValueLength) {
+ if (!(this_present_maxValueLength && that_present_maxValueLength))
+ return false;
+ if (this.maxValueLength != that.maxValueLength)
+ return false;
+ }
+
+ boolean this_present_bloomFilterType = true && (this.bloomFilterType != null);
+ boolean that_present_bloomFilterType = true && (that.bloomFilterType != null);
+ if (this_present_bloomFilterType || that_present_bloomFilterType) {
+ if (!(this_present_bloomFilterType && that_present_bloomFilterType))
+ return false;
+ if (!this.bloomFilterType.equals(that.bloomFilterType))
+ return false;
+ }
+
+ boolean this_present_bloomFilterVectorSize = true;
+ boolean that_present_bloomFilterVectorSize = true;
+ if (this_present_bloomFilterVectorSize || that_present_bloomFilterVectorSize) {
+ if (!(this_present_bloomFilterVectorSize && that_present_bloomFilterVectorSize))
+ return false;
+ if (this.bloomFilterVectorSize != that.bloomFilterVectorSize)
+ return false;
+ }
+
+ boolean this_present_bloomFilterNbHashes = true;
+ boolean that_present_bloomFilterNbHashes = true;
+ if (this_present_bloomFilterNbHashes || that_present_bloomFilterNbHashes) {
+ if (!(this_present_bloomFilterNbHashes && that_present_bloomFilterNbHashes))
+ return false;
+ if (this.bloomFilterNbHashes != that.bloomFilterNbHashes)
+ return false;
+ }
+
+ boolean this_present_blockCacheEnabled = true;
+ boolean that_present_blockCacheEnabled = true;
+ if (this_present_blockCacheEnabled || that_present_blockCacheEnabled) {
+ if (!(this_present_blockCacheEnabled && that_present_blockCacheEnabled))
+ return false;
+ if (this.blockCacheEnabled != that.blockCacheEnabled)
+ return false;
+ }
+
+ boolean this_present_timeToLive = true;
+ boolean that_present_timeToLive = true;
+ if (this_present_timeToLive || that_present_timeToLive) {
+ if (!(this_present_timeToLive && that_present_timeToLive))
+ return false;
+ if (this.timeToLive != that.timeToLive)
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return 0;
+ }
+
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
@@ -203,13 +314,13 @@
}
break;
case 10:
- if (field.type == TType.I32) {
- this.timeToLive = iprot.readI32();
- this.__isset.timeToLive = true;
- } else {
- TProtocolUtil.skip(iprot, field.type);
- }
- break;
+ if (field.type == TType.I32) {
+ this.timeToLive = iprot.readI32();
+ this.__isset.timeToLive = true;
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
default:
TProtocolUtil.skip(iprot, field.type);
break;
Modified: hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/Constants.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/Constants.java?rev=686567&r1=686566&r2=686567&view=diff
==============================================================================
--- hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/Constants.java (original)
+++ hadoop/hbase/branches/0.2/src/java/org/apache/hadoop/hbase/thrift/generated/Constants.java Sat Aug 16 15:03:35 2008
@@ -23,9 +23,11 @@
*/
package org.apache.hadoop.hbase.thrift.generated;
+import java.util.List;
import java.util.ArrayList;
-import java.util.AbstractMap;
+import java.util.Map;
import java.util.HashMap;
+import java.util.Set;
import java.util.HashSet;
import com.facebook.thrift.*;