HBASE-7167 Thrift's deleteMultiple() raises exception instead of returning list of failed deletes (Daniel Gomez)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1412594 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2012-11-22 15:58:49 +00:00
parent 7e2e57f48e
commit c3ba700c82
3 changed files with 6 additions and 19 deletions

View File

@ -19,7 +19,6 @@
package org.apache.hadoop.hbase.thrift2; package org.apache.hadoop.hbase.thrift2;
import static org.apache.hadoop.hbase.thrift2.ThriftUtilities.deleteFromThrift; import static org.apache.hadoop.hbase.thrift2.ThriftUtilities.deleteFromThrift;
import static org.apache.hadoop.hbase.thrift2.ThriftUtilities.deletesFromHBase;
import static org.apache.hadoop.hbase.thrift2.ThriftUtilities.deletesFromThrift; import static org.apache.hadoop.hbase.thrift2.ThriftUtilities.deletesFromThrift;
import static org.apache.hadoop.hbase.thrift2.ThriftUtilities.getFromThrift; import static org.apache.hadoop.hbase.thrift2.ThriftUtilities.getFromThrift;
import static org.apache.hadoop.hbase.thrift2.ThriftUtilities.getsFromThrift; import static org.apache.hadoop.hbase.thrift2.ThriftUtilities.getsFromThrift;
@ -36,6 +35,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Proxy; import java.lang.reflect.Proxy;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -261,15 +261,14 @@ public class ThriftHBaseServiceHandler implements THBaseService.Iface {
@Override @Override
public List<TDelete> deleteMultiple(ByteBuffer table, List<TDelete> deletes) throws TIOError, TException { public List<TDelete> deleteMultiple(ByteBuffer table, List<TDelete> deletes) throws TIOError, TException {
HTableInterface htable = getTable(table.array()); HTableInterface htable = getTable(table.array());
List<Delete> tempDeletes = deletesFromThrift(deletes);
try { try {
htable.delete(tempDeletes); htable.delete(deletesFromThrift(deletes));
} catch (IOException e) { } catch (IOException e) {
throw getTIOError(e); throw getTIOError(e);
} finally { } finally {
closeTable(htable); closeTable(htable);
} }
return deletesFromHBase(tempDeletes); return Collections.emptyList();
} }
@Override @Override

View File

@ -282,18 +282,6 @@ public class ThriftUtilities {
return out; return out;
} }
public static List<TDelete> deletesFromHBase(List<Delete> in) {
List<TDelete> out = new ArrayList<TDelete>(in.size());
for (Delete delete : in) {
if (delete == null) {
out.add(null);
} else {
out.add(deleteFromHBase(delete));
}
}
return out;
}
public static Scan scanFromThrift(TScan in) throws IOException { public static Scan scanFromThrift(TScan in) throws IOException {
Scan out = new Scan(); Scan out = new Scan();

View File

@ -314,9 +314,9 @@ service THBaseService {
/** /**
* Bulk commit a List of TDeletes to the table. * Bulk commit a List of TDeletes to the table.
* *
* This returns a list of TDeletes that were not * Throws a TIOError if any of the deletes fail.
* executed. So if everything succeeds you'll *
* receive an empty list. * Always returns an empty list for backwards compatibility.
*/ */
list<TDelete> deleteMultiple( list<TDelete> deleteMultiple(
/** the table to delete from */ /** the table to delete from */