From c88a9b207082da410e3a37407762805f3c551be8 Mon Sep 17 00:00:00 2001 From: Andrew Kyle Purtell Date: Mon, 29 Jun 2009 02:43:59 +0000 Subject: [PATCH] remove vestigial and incorrect deletes git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@789193 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop/hbase/stargate/RowResource.java | 47 ++++--------------- 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/RowResource.java b/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/RowResource.java index 990ab95b83c..e8d836f138a 100644 --- a/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/RowResource.java +++ b/src/contrib/stargate/src/java/org/apache/hadoop/hbase/stargate/RowResource.java @@ -133,33 +133,7 @@ public class RowResource implements Constants { } } - private void deleteRow() { - HTablePool pool; - try { - pool = RESTServlet.getInstance().getTablePool(this.table); - } catch (IOException e) { - throw new WebApplicationException(e, - Response.Status.INTERNAL_SERVER_ERROR); - } - HTable table = null; - try { - table = pool.get(); - table.delete(new Delete(rowspec.getRow())); - table.flushCommits(); - } catch (IOException e) { - throw new WebApplicationException(e, - Response.Status.SERVICE_UNAVAILABLE); - } finally { - if (table != null) { - pool.put(table); - } - } - } - private Response update(CellSetModel model, boolean replace) { - if (replace) { - deleteRow(); - } HTablePool pool; try { pool = RESTServlet.getInstance().getTablePool(this.table); @@ -173,11 +147,6 @@ public class RowResource implements Constants { for (RowModel row: model.getRows()) { Put put = new Put(row.getKey()); for (CellModel cell: row.getCells()) { - if (LOG.isDebugEnabled()) { - LOG.debug("update cell '" + - Bytes.toStringBinary(cell.getColumn()) + "' @" + - cell.getTimestamp() + " length " + cell.getValue().length); - } byte [][] parts = KeyValue.parseColumn(cell.getColumn()); if (cell.hasUserTimestamp()) { put.add(parts[0], parts[1], cell.getTimestamp(), cell.getValue()); @@ -186,6 +155,9 @@ public class RowResource implements Constants { } } table.put(put); + if (LOG.isDebugEnabled()) { + LOG.debug("PUT " + put.toString()); + } } table.flushCommits(); ResponseBuilder response = Response.ok(); @@ -202,9 +174,6 @@ public class RowResource implements Constants { private Response updateBinary(byte[] message, HttpHeaders headers, boolean replace) { - if (replace) { - deleteRow(); - } HTablePool pool; try { pool = RESTServlet.getInstance().getTablePool(this.table); @@ -236,10 +205,6 @@ public class RowResource implements Constants { if (column == null) { throw new WebApplicationException(Response.Status.BAD_REQUEST); } - if (LOG.isDebugEnabled()) { - LOG.debug("update cell '" + Bytes.toStringBinary(column) + "' @" + - timestamp + " length " + message.length); - } Put put = new Put(row); byte parts[][] = KeyValue.parseColumn(column); if (timestamp >= 0) { @@ -249,6 +214,9 @@ public class RowResource implements Constants { } table = pool.get(); table.put(put); + if (LOG.isDebugEnabled()) { + LOG.debug("PUT " + put.toString()); + } table.flushCommits(); return Response.ok().build(); } catch (IOException e) { @@ -328,6 +296,9 @@ public class RowResource implements Constants { try { table = pool.get(); table.delete(delete); + if (LOG.isDebugEnabled()) { + LOG.debug("DELETE " + delete.toString()); + } table.flushCommits(); } catch (IOException e) { throw new WebApplicationException(e,