Index: src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (revision 1133311) +++ src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java (working copy) @@ -2068,7 +2068,7 @@ throws IOException { checkOpen(); try { - boolean writeToWAL = true; + boolean writeToWAL = delete.getWriteToWAL(); this.requestCount.incrementAndGet(); HRegion region = getRegion(regionName); if (!region.getRegionInfo().isMetaTable()) { @@ -2088,7 +2088,6 @@ checkOpen(); HRegion region = null; try { - boolean writeToWAL = true; region = getRegion(regionName); if (!region.getRegionInfo().isMetaTable()) { this.cacheFlusher.reclaimMemStoreMemory(); @@ -2098,7 +2097,7 @@ for (Delete delete : deletes) { this.requestCount.incrementAndGet(); locks[i] = getLockFromId(delete.getLockId()); - region.delete(delete, locks[i], writeToWAL); + region.delete(delete, locks[i], delete.getWriteToWAL()); i++; } } catch (WrongRegionException ex) { Index: src/main/java/org/apache/hadoop/hbase/client/Delete.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/client/Delete.java (revision 1133311) +++ src/main/java/org/apache/hadoop/hbase/client/Delete.java (working copy) @@ -69,12 +69,13 @@ * timestamp. The constructor timestamp is not referenced. */ public class Delete implements Writable, Row, Comparable { - private static final byte DELETE_VERSION = (byte)2; + private static final byte DELETE_VERSION = (byte)3; private byte [] row = null; // This ts is only used when doing a deleteRow. Anything less, private long ts; private long lockId = -1L; + private boolean writeToWAL = true; private final Map> familyMap = new TreeMap>(Bytes.BYTES_COMPARATOR); @@ -128,6 +129,7 @@ this.ts = d.getTimeStamp(); this.lockId = d.getLockId(); this.familyMap.putAll(d.getFamilyMap()); + this.writeToWAL = d.writeToWAL; } public int compareTo(final Row d) { @@ -382,6 +384,9 @@ this.row = Bytes.readByteArray(in); this.ts = in.readLong(); this.lockId = in.readLong(); + if (version > 2) { + this.writeToWAL = in.readBoolean(); + } this.familyMap.clear(); int numFamilies = in.readInt(); for(int i=0;i> entry : familyMap.entrySet()) { Bytes.writeByteArray(out, entry.getKey()); @@ -460,4 +466,20 @@ this.deleteColumn(parts[0], parts[1], HConstants.LATEST_TIMESTAMP); return this; } + + /** + * @return true if edits should be applied to WAL, false if not + */ + public boolean getWriteToWAL() { + return this.writeToWAL; + } + + /** + * Set whether this Delete should be written to the WAL or not. + * Not writing the WAL means you may lose edits on server crash. + * @param write true if edits should be written to WAL, false if not + */ + public void setWriteToWAL(boolean write) { + this.writeToWAL = write; + } }