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
This commit is contained in:
Michael Stack 2009-06-17 23:32:20 +00:00
parent d7005e1d4d
commit c8918e2caa
3 changed files with 22 additions and 2 deletions

View File

@ -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

View File

@ -46,6 +46,7 @@ public class Put implements HeapSize, Writable, Comparable<Put> {
private byte [] row = null;
private long timestamp = HConstants.LATEST_TIMESTAMP;
private long lockId = -1L;
private boolean writeToWAL = true;
private Map<byte [], List<KeyValue>> familyMap =
new TreeMap<byte [], List<KeyValue>>(Bytes.BYTES_COMPARATOR);
@ -206,6 +207,21 @@ public class Put implements HeapSize, Writable, Comparable<Put> {
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<Put> {
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<byte [],List<KeyValue>>(Bytes.BYTES_COMPARATOR);
@ -286,6 +303,7 @@ public class Put implements HeapSize, Writable, Comparable<Put> {
Bytes.writeByteArray(out, this.row);
out.writeLong(this.timestamp);
out.writeLong(this.lockId);
out.writeBoolean(this.writeToWAL);
out.writeInt(familyMap.size());
for(Map.Entry<byte [], List<KeyValue>> entry : familyMap.entrySet()) {
Bytes.writeByteArray(out, entry.getKey());

View File

@ -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());
}
/**