From c8918e2caafb060970e9908d66e793c16f5f3363 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Wed, 17 Jun 2009 23:32:20 +0000 Subject: [PATCH] HBASE-1535 Add client ability to perform mutations without the WAL git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@785854 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ .../org/apache/hadoop/hbase/client/Put.java | 18 ++++++++++++++++++ .../hadoop/hbase/regionserver/HRegion.java | 4 ++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 843ab80c464..f556f9f9153 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -361,6 +361,8 @@ Release 0.20.0 - Unreleased OPTIMIZATIONS HBASE-1412 Change values for delete column and column family in KeyValue + HBASE-1535 Add client ability to perform mutations without the WAL + (Jon Gray via Stack) Release 0.19.0 - 01/21/2009 INCOMPATIBLE CHANGES diff --git a/src/java/org/apache/hadoop/hbase/client/Put.java b/src/java/org/apache/hadoop/hbase/client/Put.java index b3225ef15b7..d30f9d73402 100644 --- a/src/java/org/apache/hadoop/hbase/client/Put.java +++ b/src/java/org/apache/hadoop/hbase/client/Put.java @@ -46,6 +46,7 @@ public class Put implements HeapSize, Writable, Comparable { private byte [] row = null; private long timestamp = HConstants.LATEST_TIMESTAMP; private long lockId = -1L; + private boolean writeToWAL = true; private Map> familyMap = new TreeMap>(Bytes.BYTES_COMPARATOR); @@ -206,6 +207,21 @@ public class Put implements HeapSize, Writable, Comparable { return size; } + /** + * @return true if edits should be applied to WAL, false if not + */ + public boolean writeToWAL() { + return this.writeToWAL; + } + + /** + * Set whether this Put should be written to the WAL or not. + * @param writeToWAL true if edits should be written to WAL, false if not + */ + public void writeToWAL(boolean writeToWAL) { + this.writeToWAL = writeToWAL; + } + /** * @return String */ @@ -261,6 +277,7 @@ public class Put implements HeapSize, Writable, Comparable { this.row = Bytes.readByteArray(in); this.timestamp = in.readLong(); this.lockId = in.readLong(); + this.writeToWAL = in.readBoolean(); int numFamilies = in.readInt(); this.familyMap = new TreeMap>(Bytes.BYTES_COMPARATOR); @@ -286,6 +303,7 @@ public class Put implements HeapSize, Writable, Comparable { Bytes.writeByteArray(out, this.row); out.writeLong(this.timestamp); out.writeLong(this.lockId); + out.writeBoolean(this.writeToWAL); out.writeInt(familyMap.size()); for(Map.Entry> entry : familyMap.entrySet()) { Bytes.writeByteArray(out, entry.getKey()); diff --git a/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java index e861d383004..ca4c50af52f 100644 --- a/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ b/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -1176,7 +1176,7 @@ public class HRegion implements HConstants { // , Writable{ * @throws IOException */ public void put(Put put) throws IOException { - this.put(put, null, true); + this.put(put, null, put.writeToWAL()); } /** @@ -1194,7 +1194,7 @@ public class HRegion implements HConstants { // , Writable{ * @throws IOException */ public void put(Put put, Integer lockid) throws IOException { - this.put(put, lockid, true); + this.put(put, lockid, put.writeToWAL()); } /**