You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2010/05/07 21:17:55 UTC
svn commit: r942184 [11/15] - in /hadoop/hbase/branches/0.20: ./
src/java/org/apache/hadoop/hbase/ src/java/org/apache/hadoop/hbase/client/
src/java/org/apache/hadoop/hbase/filter/
src/java/org/apache/hadoop/hbase/io/ src/java/org/apache/hadoop/hbase/i...
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/KeyValueHeap.java Fri May 7 19:17:48 2010
@@ -46,14 +46,14 @@ public class KeyValueHeap implements Key
private KVScannerComparator comparator;
/**
- * Constructor. This KeyValueHeap will handle closing of passed in
+ * Constructor. This KeyValueHeap will handle closing of passed in
* KeyValueScanners.
* @param scanners
* @param comparator
*/
public KeyValueHeap(List<KeyValueScanner> scanners, KVComparator comparator) {
this.comparator = new KVScannerComparator(comparator);
- this.heap = new PriorityQueue<KeyValueScanner>(scanners.size(),
+ this.heap = new PriorityQueue<KeyValueScanner>(scanners.size(),
this.comparator);
for (KeyValueScanner scanner : scanners) {
if (scanner.peek() != null) {
@@ -64,14 +64,14 @@ public class KeyValueHeap implements Key
}
this.current = heap.poll();
}
-
+
public KeyValue peek() {
if(this.current == null) {
return null;
}
return this.current.peek();
}
-
+
public KeyValue next() {
if(this.current == null) {
return null;
@@ -101,7 +101,7 @@ public class KeyValueHeap implements Key
* InternalScanner as well as KeyValueScanner (a {@link StoreScanner}).
* @param result
* @param limit
- * @return true if there are more keys, false if all scanners are done
+ * @return true if there are more keys, false if all scanners are done
*/
public boolean next(List<KeyValue> result, int limit) throws IOException {
InternalScanner currentAsInternal = (InternalScanner)this.current;
@@ -124,7 +124,7 @@ public class KeyValueHeap implements Key
* This can ONLY be called when you are using Scanners that implement
* InternalScanner as well as KeyValueScanner (a {@link StoreScanner}).
* @param result
- * @return true if there are more keys, false if all scanners are done
+ * @return true if there are more keys, false if all scanners are done
*/
public boolean next(List<KeyValue> result) throws IOException {
return next(result, -1);
@@ -168,9 +168,9 @@ public class KeyValueHeap implements Key
scanner.close();
}
}
-
+
/**
- * Seeks all scanners at or below the specified seek key. If we earlied-out
+ * Seeks all scanners at or below the specified seek key. If we earlied-out
* of a row, we may end up skipping values that were never reached yet.
* Rather than iterating down, we want to give the opportunity to re-seek.
* <p>
@@ -210,4 +210,4 @@ public class KeyValueHeap implements Key
public PriorityQueue<KeyValueScanner> getHeap() {
return this.heap;
}
-}
\ No newline at end of file
+}
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/KeyValueScanner.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/KeyValueScanner.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/KeyValueScanner.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/KeyValueScanner.java Fri May 7 19:17:48 2010
@@ -30,20 +30,20 @@ public interface KeyValueScanner {
* @return the next KeyValue
*/
public KeyValue peek();
-
+
/**
- * Return the next KeyValue in this scanner, iterating the scanner
+ * Return the next KeyValue in this scanner, iterating the scanner
* @return the next KeyValue
*/
public KeyValue next();
-
+
/**
* Seek the scanner at or after the specified KeyValue.
* @param key
* @return true if scanner has values left, false if end of scanner
*/
public boolean seek(KeyValue key);
-
+
/**
* Close the KeyValue scanner.
*/
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/KeyValueSkipListSet.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/KeyValueSkipListSet.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/KeyValueSkipListSet.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/KeyValueSkipListSet.java Fri May 7 19:17:48 2010
@@ -61,7 +61,7 @@ class KeyValueSkipListSet implements Nav
*/
static class MapEntryIterator implements Iterator<KeyValue> {
private final Iterator<Map.Entry<KeyValue, KeyValue>> iterator;
-
+
MapEntryIterator(final Iterator<Map.Entry<KeyValue, KeyValue>> i) {
this.iterator = i;
}
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/LogRoller.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/LogRoller.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/LogRoller.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/LogRoller.java Fri May 7 19:17:48 2010
@@ -30,13 +30,13 @@ import org.apache.hadoop.hbase.util.Byte
/**
* Runs periodically to determine if the HLog should be rolled.
- *
+ *
* NOTE: This class extends Thread rather than Chore because the sleep time
* can be interrupted when there is something to do, rather than the Chore
* sleep time which is invariant.
*/
class LogRoller extends Thread implements LogRollListener {
- static final Log LOG = LogFactory.getLog(LogRoller.class);
+ static final Log LOG = LogFactory.getLog(LogRoller.class);
private final ReentrantLock rollLock = new ReentrantLock();
private final AtomicBoolean rollLog = new AtomicBoolean(false);
private final HRegionServer server;
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/LruHashMap.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/LruHashMap.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/LruHashMap.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/LruHashMap.java Fri May 7 19:17:48 2010
@@ -37,8 +37,8 @@ import org.apache.commons.logging.LogFac
* The LruHashMap is a memory-aware HashMap with a configurable maximum
* memory footprint.
* <p>
- * It maintains an ordered list of all entries in the map ordered by
- * access time. When space needs to be freed becase the maximum has been
+ * It maintains an ordered list of all entries in the map ordered by
+ * access time. When space needs to be freed becase the maximum has been
* reached, or the application has asked to free memory, entries will be
* evicted according to an LRU (least-recently-used) algorithm. That is,
* those entries which have not been accessed the longest will be evicted
@@ -53,8 +53,8 @@ public class LruHashMap<K extends HeapSi
implements HeapSize, Map<K,V> {
static final Log LOG = LogFactory.getLog(LruHashMap.class);
-
- /** The default size (in bytes) of the LRU */
+
+ /** The default size (in bytes) of the LRU */
private static final long DEFAULT_MAX_MEM_USAGE = 50000;
/** The default capacity of the hash table */
private static final int DEFAULT_INITIAL_CAPACITY = 16;
@@ -62,12 +62,12 @@ implements HeapSize, Map<K,V> {
private static final int MAXIMUM_CAPACITY = 1 << 30;
/** The default load factor to use */
private static final float DEFAULT_LOAD_FACTOR = 0.75f;
-
+
/** Memory overhead of this Object (for HeapSize) */
- private static final int OVERHEAD = 5 * Bytes.SIZEOF_LONG +
- 2 * Bytes.SIZEOF_INT + 2 * Bytes.SIZEOF_FLOAT + 3 * ClassSize.REFERENCE +
+ private static final int OVERHEAD = 5 * Bytes.SIZEOF_LONG +
+ 2 * Bytes.SIZEOF_INT + 2 * Bytes.SIZEOF_FLOAT + 3 * ClassSize.REFERENCE +
1 * ClassSize.ARRAY;
-
+
/** Load factor allowed (usually 75%) */
private final float loadFactor;
/** Number of key/vals in the map */
@@ -86,7 +86,7 @@ implements HeapSize, Map<K,V> {
private long memTotal = 0;
/** Amount of available memory */
private long memFree = 0;
-
+
/** Number of successful (found) get() calls */
private long hitCount = 0;
/** Number of unsuccessful (not found) get() calls */
@@ -121,7 +121,7 @@ implements HeapSize, Map<K,V> {
throw new IllegalArgumentException("Max memory usage too small to " +
"support base overhead");
}
-
+
/** Find a power of 2 >= initialCapacity */
int capacity = calculateCapacity(initialCapacity);
this.loadFactor = loadFactor;
@@ -146,7 +146,7 @@ implements HeapSize, Map<K,V> {
public LruHashMap(int initialCapacity, float loadFactor) {
this(initialCapacity, loadFactor, DEFAULT_MAX_MEM_USAGE);
}
-
+
/**
* Constructs a new, empty map with the specified initial capacity and
* with the default load factor and maximum memory usage.
@@ -174,14 +174,14 @@ implements HeapSize, Map<K,V> {
}
/**
- * Constructs a new, empty map with the default initial capacity,
+ * Constructs a new, empty map with the default initial capacity,
* load factor and maximum memory usage.
*/
public LruHashMap() {
this(DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR,
DEFAULT_MAX_MEM_USAGE);
}
-
+
//--------------------------------------------------------------------------
/**
* Get the currently available memory for this LRU in bytes.
@@ -192,7 +192,7 @@ implements HeapSize, Map<K,V> {
public long getMemFree() {
return memFree;
}
-
+
/**
* Get the maximum memory allowed for this LRU in bytes.
*
@@ -201,7 +201,7 @@ implements HeapSize, Map<K,V> {
public long getMemMax() {
return memTotal;
}
-
+
/**
* Get the currently used memory for this LRU in bytes.
*
@@ -210,7 +210,7 @@ implements HeapSize, Map<K,V> {
public long getMemUsed() {
return (memTotal - memFree);
}
-
+
/**
* Get the number of hits to the map. This is the number of times
* a call to get() returns a matched key.
@@ -220,7 +220,7 @@ implements HeapSize, Map<K,V> {
public long getHitCount() {
return hitCount;
}
-
+
/**
* Get the number of misses to the map. This is the number of times
* a call to get() returns null.
@@ -230,7 +230,7 @@ implements HeapSize, Map<K,V> {
public long getMissCount() {
return missCount;
}
-
+
/**
* Get the hit ratio. This is the number of hits divided by the
* total number of requests.
@@ -241,7 +241,7 @@ implements HeapSize, Map<K,V> {
return (double)((double)hitCount/
((double)(hitCount+missCount)));
}
-
+
/**
* Free the requested amount of memory from the LRU map.
*
@@ -263,7 +263,7 @@ implements HeapSize, Map<K,V> {
}
return freedMemory;
}
-
+
/**
* The total memory usage of this map
*
@@ -272,7 +272,7 @@ implements HeapSize, Map<K,V> {
public long heapSize() {
return (memTotal - memFree);
}
-
+
//--------------------------------------------------------------------------
/**
* Retrieves the value associated with the specified key.
@@ -288,7 +288,7 @@ implements HeapSize, Map<K,V> {
checkKey((K)key);
int hash = hash(key);
int i = hashIndex(hash, entries.length);
- Entry<K,V> e = entries[i];
+ Entry<K,V> e = entries[i];
while (true) {
if (e == null) {
missCount++;
@@ -315,7 +315,7 @@ implements HeapSize, Map<K,V> {
* @param key the key
* @param value the value
* @return the value that was previously mapped to this key, null if none
- * @throws UnsupportedOperationException if either objects do not
+ * @throws UnsupportedOperationException if either objects do not
* implement HeapSize
* @throws NullPointerException if the key or value is null
*/
@@ -324,7 +324,7 @@ implements HeapSize, Map<K,V> {
checkValue(value);
int hash = hash(key);
int i = hashIndex(hash, entries.length);
-
+
// For old values
for (Entry<K,V> e = entries[i]; e != null; e = e.next) {
if (e.hash == hash && isEqual(key, e.key)) {
@@ -340,7 +340,7 @@ implements HeapSize, Map<K,V> {
checkAndFreeMemory(memChange);
return null;
}
-
+
/**
* Deletes the mapping for the specified key if it exists.
*
@@ -383,7 +383,7 @@ implements HeapSize, Map<K,V> {
public synchronized void clear() {
memFree += clearAll();
}
-
+
//--------------------------------------------------------------------------
/**
* Checks whether there is a value in the map for the specified key.
@@ -398,9 +398,9 @@ implements HeapSize, Map<K,V> {
checkKey((K)key);
int hash = hash(key);
int i = hashIndex(hash, entries.length);
- Entry e = entries[i];
+ Entry e = entries[i];
while (e != null) {
- if (e.hash == hash && isEqual(key, e.key))
+ if (e.hash == hash && isEqual(key, e.key))
return true;
e = e.next;
}
@@ -409,7 +409,7 @@ implements HeapSize, Map<K,V> {
/**
* Checks whether this is a mapping which contains the specified value.
- *
+ *
* Does not affect the LRU. This is an inefficient operation.
*
* @param value the value to check
@@ -445,7 +445,7 @@ implements HeapSize, Map<K,V> {
throw new NullPointerException("null keys are not allowed");
}
}
-
+
/**
* Enforces value constraints. Null values are not permitted and value must
* implement HeapSize. It should not be necessary to verify the second
@@ -463,7 +463,7 @@ implements HeapSize, Map<K,V> {
throw new NullPointerException("null values are not allowed");
}
}
-
+
/**
* Returns the minimum memory usage of the base map structure.
*
@@ -472,7 +472,7 @@ implements HeapSize, Map<K,V> {
private long getMinimumUsage() {
return OVERHEAD + (entries.length * ClassSize.REFERENCE);
}
-
+
//--------------------------------------------------------------------------
/**
* Evicts and frees based on LRU until at least as much memory as requested
@@ -499,7 +499,7 @@ implements HeapSize, Map<K,V> {
removeEntry(headPtr);
return freed;
}
-
+
/**
* Moves the specified entry to the most recently used slot of the
* LRU. This is called whenever an entry is fetched.
@@ -545,10 +545,10 @@ implements HeapSize, Map<K,V> {
} else {
prev.next = next;
}
-
+
Entry<K,V> prevPtr = e.getPrevPtr();
Entry<K,V> nextPtr = e.getNextPtr();
-
+
if(prevPtr != null && nextPtr != null) {
prevPtr.setNextPtr(nextPtr);
nextPtr.setPrevPtr(prevPtr);
@@ -559,7 +559,7 @@ implements HeapSize, Map<K,V> {
headPtr = nextPtr;
nextPtr.setPrevPtr(null);
}
-
+
return;
}
prev = e;
@@ -589,7 +589,7 @@ implements HeapSize, Map<K,V> {
} else {
prev.next = next;
}
-
+
// Updating LRU
Entry<K,V> prevPtr = e.getPrevPtr();
Entry<K,V> nextPtr = e.getNextPtr();
@@ -603,7 +603,7 @@ implements HeapSize, Map<K,V> {
headPtr = nextPtr;
nextPtr.setPrevPtr(null);
}
-
+
return e;
}
prev = e;
@@ -671,7 +671,7 @@ implements HeapSize, Map<K,V> {
size = 0;
return freedMemory;
}
-
+
//--------------------------------------------------------------------------
/**
* Recreates the entire contents of the hashmap into a new array
@@ -683,7 +683,7 @@ implements HeapSize, Map<K,V> {
private void growTable(int newCapacity) {
Entry [] oldTable = entries;
int oldCapacity = oldTable.length;
-
+
// Do not allow growing the table beyond the max capacity
if (oldCapacity == MAXIMUM_CAPACITY) {
threshold = Integer.MAX_VALUE;
@@ -692,12 +692,12 @@ implements HeapSize, Map<K,V> {
// Determine how much additional space will be required to grow the array
long requiredSpace = (newCapacity - oldCapacity) * ClassSize.REFERENCE;
-
+
// Verify/enforce we have sufficient memory to grow
checkAndFreeMemory(requiredSpace);
Entry [] newTable = new Entry[newCapacity];
-
+
// Transfer existing entries to new hash table
for(int i=0; i < oldCapacity; i++) {
Entry<K,V> entry = oldTable[i];
@@ -734,7 +734,7 @@ implements HeapSize, Map<K,V> {
h ^= (h >>> 10);
return h;
}
-
+
/**
* Compares two objects for equality. Method uses equals method and
* assumes neither value is null.
@@ -746,7 +746,7 @@ implements HeapSize, Map<K,V> {
private boolean isEqual(Object x, Object y) {
return (x == y || x.equals(y));
}
-
+
/**
* Determines the index into the current hash table for the specified
* hashValue.
@@ -781,7 +781,7 @@ implements HeapSize, Map<K,V> {
}
return newCapacity;
}
-
+
/**
* Calculates the threshold of the map given the capacity and load
* factor. Once the number of entries in the map grows to the
@@ -802,7 +802,7 @@ implements HeapSize, Map<K,V> {
memFree -= OVERHEAD;
memFree -= (entries.length * ClassSize.REFERENCE);
}
-
+
//--------------------------------------------------------------------------
/**
* Debugging function that returns a List sorted by access time.
@@ -836,7 +836,7 @@ implements HeapSize, Map<K,V> {
}
return entrySet;
}
-
+
/**
* Get the head of the linked list (least recently used).
*
@@ -845,16 +845,16 @@ implements HeapSize, Map<K,V> {
public Entry getHeadPtr() {
return headPtr;
}
-
+
/**
* Get the tail of the linked list (most recently used).
- *
+ *
* @return tail of linked list
*/
public Entry getTailPtr() {
return tailPtr;
}
-
+
//--------------------------------------------------------------------------
/**
* To best optimize this class, some of the methods that are part of a
@@ -863,7 +863,7 @@ implements HeapSize, Map<K,V> {
* significant overhead and code complexity to support and are
* unnecessary for the requirements of this class.
*/
-
+
/**
* Intentionally unimplemented.
*/
@@ -887,7 +887,7 @@ implements HeapSize, Map<K,V> {
throw new UnsupportedOperationException(
"hashCode(Object) is intentionally unimplemented");
}
-
+
/**
* Intentionally unimplemented.
*/
@@ -895,7 +895,7 @@ implements HeapSize, Map<K,V> {
throw new UnsupportedOperationException(
"keySet() is intentionally unimplemented");
}
-
+
/**
* Intentionally unimplemented.
*/
@@ -903,7 +903,7 @@ implements HeapSize, Map<K,V> {
throw new UnsupportedOperationException(
"putAll() is intentionally unimplemented");
}
-
+
/**
* Intentionally unimplemented.
*/
@@ -925,9 +925,9 @@ implements HeapSize, Map<K,V> {
protected static class Entry<K extends HeapSize, V extends HeapSize>
implements Map.Entry<K,V>, HeapSize {
/** The baseline overhead memory usage of this class */
- static final int OVERHEAD = 1 * Bytes.SIZEOF_LONG +
+ static final int OVERHEAD = 1 * Bytes.SIZEOF_LONG +
5 * ClassSize.REFERENCE + 2 * Bytes.SIZEOF_INT;
-
+
/** The key */
protected final K key;
/** The value */
@@ -936,12 +936,12 @@ implements HeapSize, Map<K,V> {
protected final int hash;
/** The next entry in the hash chain (for collisions) */
protected Entry<K,V> next;
-
+
/** The previous entry in the LRU list (towards LRU) */
protected Entry<K,V> prevPtr;
/** The next entry in the LRU list (towards MRU) */
protected Entry<K,V> nextPtr;
-
+
/** The precomputed heap size of this entry */
protected long heapSize;
@@ -982,7 +982,7 @@ implements HeapSize, Map<K,V> {
public V getValue() {
return value;
}
-
+
/**
* Set the value of this entry.
*
@@ -998,7 +998,7 @@ implements HeapSize, Map<K,V> {
value = newValue;
return oldValue;
}
-
+
/**
* Replace the value of this entry.
*
@@ -1014,7 +1014,7 @@ implements HeapSize, Map<K,V> {
heapSize += sizeDiff;
return sizeDiff;
}
-
+
/**
* Returns true is the specified entry has the same key and the
* same value as this entry.
@@ -1031,13 +1031,13 @@ implements HeapSize, Map<K,V> {
if (k1 == k2 || (k1 != null && k1.equals(k2))) {
Object v1 = getValue();
Object v2 = e.getValue();
- if (v1 == v2 || (v1 != null && v1.equals(v2)))
+ if (v1 == v2 || (v1 != null && v1.equals(v2)))
return true;
}
return false;
}
-
- /**
+
+ /**
* Returns the hash code of the entry by xor'ing the hash values
* of the key and value of this entry.
*
@@ -1046,7 +1046,7 @@ implements HeapSize, Map<K,V> {
public int hashCode() {
return (key.hashCode() ^ value.hashCode());
}
-
+
/**
* Returns String representation of the entry in form "key=value"
*
@@ -1064,15 +1064,15 @@ implements HeapSize, Map<K,V> {
protected void setPrevPtr(Entry<K,V> prevPtr){
this.prevPtr = prevPtr;
}
-
+
/**
* Returns the previous pointer for the entry in the LRU.
* @return previous entry
*/
protected Entry<K,V> getPrevPtr(){
return prevPtr;
- }
-
+ }
+
/**
* Sets the next pointer for the entry in the LRU.
* @param nextPtr next entry
@@ -1080,7 +1080,7 @@ implements HeapSize, Map<K,V> {
protected void setNextPtr(Entry<K,V> nextPtr){
this.nextPtr = nextPtr;
}
-
+
/**
* Returns the next pointer for the entry in teh LRU.
* @return next entry
@@ -1088,7 +1088,7 @@ implements HeapSize, Map<K,V> {
protected Entry<K,V> getNextPtr(){
return nextPtr;
}
-
+
/**
* Returns the pre-computed and "deep" size of the Entry
* @return size of the entry in bytes
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/MemStore.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/MemStore.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/MemStore.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/MemStore.java Fri May 7 19:17:48 2010
@@ -190,7 +190,7 @@ public class MemStore implements HeapSiz
return s;
}
- /**
+ /**
* Write a delete
* @param delete
* @return approximate size of the passed key and value.
@@ -207,7 +207,7 @@ public class MemStore implements HeapSiz
this.size.addAndGet(s);
return s;
}
-
+
/**
* @param kv Find the row that comes after this one. If null, we return the
* first.
@@ -455,7 +455,7 @@ public class MemStore implements HeapSiz
void readLockUnlock() {
this.lock.readLock().unlock();
}
-
+
/**
*
* @param set memstore or snapshot
@@ -486,7 +486,7 @@ public class MemStore implements HeapSiz
}
return false;
}
-
+
/*
* MemStoreScanner implements the KeyValueScanner.
@@ -520,7 +520,7 @@ public class MemStore implements HeapSiz
StoreScanner level with coordination with MemStoreScanner.
*/
-
+
MemStoreScanner() {
super();
@@ -531,7 +531,7 @@ public class MemStore implements HeapSiz
KeyValue ret = null;
long readPoint = ReadWriteConsistencyControl.getThreadReadPoint();
//DebugPrint.println( " MS@" + hashCode() + ": threadpoint = " + readPoint);
-
+
while (ret == null && it.hasNext()) {
KeyValue v = it.next();
if (v.getMemstoreTS() <= readPoint) {
@@ -566,7 +566,7 @@ public class MemStore implements HeapSiz
//DebugPrint.println( " MS@" + hashCode() + " snapshot seek: " + snapshotNextRow + " with size = " +
// snapshot.size() + " threadread = " + readPoint);
-
+
KeyValue lowest = getLowest();
// has data := (lowest != null)
@@ -631,7 +631,7 @@ public class MemStore implements HeapSiz
public final static long FIXED_OVERHEAD = ClassSize.align(
ClassSize.OBJECT + (7 * ClassSize.REFERENCE));
-
+
public final static long DEEP_OVERHEAD = ClassSize.align(FIXED_OVERHEAD +
ClassSize.REENTRANT_LOCK + ClassSize.ATOMIC_LONG +
ClassSize.COPYONWRITE_ARRAYSET + ClassSize.COPYONWRITE_ARRAYLIST +
@@ -645,11 +645,11 @@ public class MemStore implements HeapSiz
* @return Size
*/
long heapSizeChange(final KeyValue kv, final boolean notpresent) {
- return notpresent ?
+ return notpresent ?
ClassSize.align(ClassSize.CONCURRENT_SKIPLISTMAP_ENTRY + kv.heapSize()):
0;
}
-
+
/**
* Get the entire heap usage for this MemStore not including keys in the
* snapshot.
@@ -658,7 +658,7 @@ public class MemStore implements HeapSiz
public long heapSize() {
return size.get();
}
-
+
/**
* Get the heap usage of KVs in this MemStore.
*/
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/MemStoreFlusher.java Fri May 7 19:17:48 2010
@@ -45,14 +45,14 @@ import org.apache.hadoop.util.StringUtil
* NOTE: This class extends Thread rather than Chore because the sleep time
* can be interrupted when there is something to do, rather than the Chore
* sleep time which is invariant.
- *
+ *
* @see FlushRequester
*/
class MemStoreFlusher extends Thread implements FlushRequester {
static final Log LOG = LogFactory.getLog(MemStoreFlusher.class);
private final BlockingQueue<HRegion> flushQueue =
new LinkedBlockingQueue<HRegion>();
-
+
private final HashSet<HRegion> regionsInQueue = new HashSet<HRegion>();
private final long threadWakeFrequency;
@@ -61,7 +61,7 @@ class MemStoreFlusher extends Thread imp
protected final long globalMemStoreLimit;
protected final long globalMemStoreLimitLowMark;
-
+
private static final float DEFAULT_UPPER = 0.4f;
private static final float DEFAULT_LOWER = 0.25f;
private static final String UPPER_KEY =
@@ -91,7 +91,7 @@ class MemStoreFlusher extends Thread imp
"because supplied " + LOWER_KEY + " was > " + UPPER_KEY);
}
this.globalMemStoreLimitLowMark = lower;
- this.blockingStoreFilesNumber =
+ this.blockingStoreFilesNumber =
conf.getInt("hbase.hstore.blockingStoreFiles", -1);
if (this.blockingStoreFilesNumber == -1) {
this.blockingStoreFilesNumber = 1 +
@@ -120,7 +120,7 @@ class MemStoreFlusher extends Thread imp
float limit = c.getFloat(key, defaultLimit);
return getMemStoreLimit(max, limit, defaultLimit);
}
-
+
static long getMemStoreLimit(final long max, final float limit,
final float defaultLimit) {
if (limit >= 0.9f || limit < 0.1f) {
@@ -129,7 +129,7 @@ class MemStoreFlusher extends Thread imp
}
return (long)(max * limit);
}
-
+
@Override
public void run() {
while (!this.server.isStopRequested() && this.server.isInSafeMode()) {
@@ -166,7 +166,7 @@ class MemStoreFlusher extends Thread imp
flushQueue.clear();
LOG.info(getName() + " exiting");
}
-
+
public void request(HRegion r) {
synchronized (regionsInQueue) {
if (!regionsInQueue.contains(r)) {
@@ -175,10 +175,10 @@ class MemStoreFlusher extends Thread imp
}
}
}
-
+
/**
* Only interrupt once it's done with a run through the work loop.
- */
+ */
void interruptIfNecessary() {
lock.lock();
try {
@@ -187,10 +187,10 @@ class MemStoreFlusher extends Thread imp
lock.unlock();
}
}
-
+
/*
* Flush a region.
- *
+ *
* @param region the region to be flushed
* @param removeFromQueue True if the region needs to be removed from the
* flush queue. False if called from the main flusher run loop and true if
@@ -203,21 +203,21 @@ class MemStoreFlusher extends Thread imp
* That compactions do not run when called out of flushSomeRegions means that
* compactions can be reported by the historian without danger of deadlock
* (HBASE-670).
- *
+ *
* <p>In the main run loop, regions have already been removed from the flush
* queue, and if this method is called for the relief of memory pressure,
- * this may not be necessarily true. We want to avoid trying to remove
+ * this may not be necessarily true. We want to avoid trying to remove
* region from the queue because if it has already been removed, it requires a
* sequential scan of the queue to determine that it is not in the queue.
- *
+ *
* <p>If called from flushSomeRegions, the region may be in the queue but
- * it may have been determined that the region had a significant amount of
+ * it may have been determined that the region had a significant amount of
* memory in use and needed to be flushed to relieve memory pressure. In this
* case, its flush may preempt the pending request in the queue, and if so,
* it needs to be removed from the queue to avoid flushing the region
* multiple times.
- *
- * @return true if the region was successfully flushed, false otherwise. If
+ *
+ * @return true if the region was successfully flushed, false otherwise. If
* false, there will be accompanying log messages explaining why the log was
* not flushed.
*/
@@ -341,7 +341,7 @@ class MemStoreFlusher extends Thread imp
}
/**
- * Check if the regionserver's memstore memory usage is greater than the
+ * Check if the regionserver's memstore memory usage is greater than the
* limit. If so, flush regions with the biggest memstores until we're down
* to the lower limit. This method blocks callers until we're down to a safe
* amount of memstore consumption.
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/QueryMatcher.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/QueryMatcher.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/QueryMatcher.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/QueryMatcher.java Fri May 7 19:17:48 2010
@@ -33,7 +33,7 @@ import org.apache.hadoop.hbase.util.Byte
* This is the primary class used to process KeyValues during a Get or Scan
* operation.
* <p>
- * It encapsulates the handling of the column and version input parameters to
+ * It encapsulates the handling of the column and version input parameters to
* the query through a {@link ColumnTracker}.
* <p>
* Deletes are handled using the {@link DeleteTracker}.
@@ -41,10 +41,10 @@ import org.apache.hadoop.hbase.util.Byte
* All other query parameters are accessed from the client-specified Get.
* <p>
* The primary method used is {@link #match} with the current KeyValue. It will
- * return a {@link QueryMatcher.MatchCode}
- *
+ * return a {@link QueryMatcher.MatchCode}
+ *
* , deletes,
- * versions,
+ * versions,
*/
public class QueryMatcher {
/**
@@ -59,17 +59,17 @@ public class QueryMatcher {
* Include KeyValue in the returned result
*/
INCLUDE,
-
+
/**
* Do not include KeyValue in the returned result
*/
SKIP,
-
+
/**
* Do not include, jump to next StoreFile or memstore (in time order)
*/
NEXT,
-
+
/**
* Do not include, return current result
*/
@@ -93,25 +93,25 @@ public class QueryMatcher {
*/
DONE_SCAN,
}
-
+
/** Keeps track of deletes */
protected DeleteTracker deletes;
-
+
/** Keeps track of columns and versions */
protected ColumnTracker columns;
-
+
/** Key to seek to in memstore and StoreFiles */
protected KeyValue startKey;
-
+
/** Row comparator for the region this query is for */
KeyComparator rowComparator;
-
+
/** Row the query is on */
protected byte [] row;
-
+
/** TimeRange the query is for */
protected TimeRange tr;
-
+
/** Oldest allowed version stamp for TTL enforcement */
protected long oldestStamp;
@@ -125,7 +125,7 @@ public class QueryMatcher {
* @param ttl
* @param rowComparator
*/
- public QueryMatcher(Get get, byte [] family,
+ public QueryMatcher(Get get, byte [] family,
NavigableSet<byte[]> columns, long ttl, KeyComparator rowComparator,
int maxVersions) {
this.row = get.getRow();
@@ -164,7 +164,7 @@ public class QueryMatcher {
this.startKey = matcher.getStartKey();
reset();
}
-
+
/**
* Main method for ColumnMatcher.
* <p>
@@ -195,10 +195,10 @@ public class QueryMatcher {
// Directly act on KV buffer
byte [] bytes = kv.getBuffer();
int offset = kv.getOffset();
-
+
int keyLength = Bytes.toInt(bytes, offset);
offset += KeyValue.ROW_OFFSET;
-
+
short rowLength = Bytes.toShort(bytes, offset);
offset += Bytes.SIZEOF_SHORT;
@@ -207,7 +207,7 @@ public class QueryMatcher {
/* Check ROW
* If past query's row, go to next StoreFile
* If not reached query's row, go to next KeyValue
- */
+ */
int ret = this.rowComparator.compareRows(row, 0, row.length,
bytes, offset, rowLength);
if (ret <= -1) {
@@ -220,7 +220,7 @@ public class QueryMatcher {
offset += rowLength;
byte familyLength = bytes[offset];
offset += Bytes.SIZEOF_BYTE + familyLength;
-
+
int columnLength = keyLength + KeyValue.ROW_OFFSET -
(offset - kv.getOffset()) - KeyValue.TIMESTAMP_TYPE_SIZE;
int columnOffset = offset;
@@ -244,14 +244,14 @@ public class QueryMatcher {
*/
byte type = bytes[offset];
// if delete type == delete family, return done_row
-
+
if (isDelete(type)) {
if (tr.withinOrAfterTimeRange(timestamp)) {
this.deletes.add(bytes, columnOffset, columnLength, timestamp, type);
}
return MatchCode.SKIP; // skip the delete cell.
}
-
+
/* Check TimeRange
* If outside of range, move to next KeyValue
*/
@@ -274,8 +274,8 @@ public class QueryMatcher {
* Returns a MatchCode directly, identical language
* If matched column without enough versions, include
* If enough versions of this column or does not match, skip
- * If have moved past
- * If enough versions of everything,
+ * If have moved past
+ * If enough versions of everything,
* TODO: No mapping from Filter.ReturnCode to MatchCode.
*/
MatchCode mc = columns.checkColumn(bytes, columnOffset, columnLength);
@@ -293,7 +293,7 @@ public class QueryMatcher {
protected boolean isDelete(byte type) {
return (type != KeyValue.Type.Put.getCode());
}
-
+
protected boolean isExpired(long timestamp) {
return (timestamp < oldestStamp);
}
@@ -309,18 +309,18 @@ public class QueryMatcher {
public ColumnCount getSeekColumn() {
return this.columns.getColumnHint();
}
-
+
/**
* Called after reading each section (memstore, snapshot, storefiles).
* <p>
* This method will update the internal structures to be accurate for
- * the next section.
+ * the next section.
*/
public void update() {
this.deletes.update();
this.columns.update();
}
-
+
/**
* Resets the current columns and deletes
*/
@@ -336,52 +336,52 @@ public class QueryMatcher {
public void setRow(byte [] row) {
this.row = row;
}
-
+
/**
- *
+ *
* @return the start key
*/
public KeyValue getStartKey() {
return this.startKey;
}
-
+
/**
* @return the TimeRange
*/
public TimeRange getTimeRange() {
return this.tr;
}
-
+
/**
* @return the oldest stamp
*/
public long getOldestStamp() {
return this.oldestStamp;
}
-
+
/**
* @return current KeyComparator
*/
public KeyComparator getRowComparator() {
return this.rowComparator;
}
-
+
/**
* @return ColumnTracker
*/
public ColumnTracker getColumnTracker() {
return this.columns;
}
-
+
/**
* @return DeleteTracker
*/
public DeleteTracker getDeleteTracker() {
return this.deletes;
}
-
+
/**
- *
+ *
* @return <code>true</code> when done.
*/
public boolean isDone() {
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ReadWriteConsistencyControl.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ReadWriteConsistencyControl.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ReadWriteConsistencyControl.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ReadWriteConsistencyControl.java Fri May 7 19:17:48 2010
@@ -22,7 +22,7 @@ public class ReadWriteConsistencyControl
public static long getThreadReadPoint() {
return perThreadReadPoint.get();
}
-
+
public static long resetThreadReadPoint(ReadWriteConsistencyControl rwcc) {
perThreadReadPoint.set(rwcc.memstoreReadPoint());
return getThreadReadPoint();
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/RegionServerRunningException.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/RegionServerRunningException.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/RegionServerRunningException.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/RegionServerRunningException.java Fri May 7 19:17:48 2010
@@ -27,7 +27,7 @@ import java.io.IOException;
*/
public class RegionServerRunningException extends IOException {
private static final long serialVersionUID = 1L << 31 - 1L;
-
+
/** Default Constructor */
public RegionServerRunningException() {
super();
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ScanDeleteTracker.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ScanDeleteTracker.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ScanDeleteTracker.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ScanDeleteTracker.java Fri May 7 19:17:48 2010
@@ -36,7 +36,7 @@ import org.apache.hadoop.hbase.util.Byte
* <li>{@link #isDeleted} when checking if a Put KeyValue has been deleted
* <li>{@link #update} when reaching the end of a StoreFile or row for scans
* <p>
- * This class is NOT thread-safe as queries are never multi-threaded
+ * This class is NOT thread-safe as queries are never multi-threaded
*/
public class ScanDeleteTracker implements DeleteTracker {
@@ -53,7 +53,7 @@ public class ScanDeleteTracker implement
public ScanDeleteTracker() {
super();
}
-
+
/**
* Add the specified KeyValue to the list of deletes to check against for
* this row operation.
@@ -91,7 +91,7 @@ public class ScanDeleteTracker implement
// missing else is never called.
}
- /**
+ /**
* Check if the specified KeyValue buffer has been deleted by a previously
* seen delete.
*
@@ -107,7 +107,7 @@ public class ScanDeleteTracker implement
if (timestamp <= familyStamp) {
return true;
}
-
+
if (deleteBuffer != null) {
int ret = Bytes.compareTo(deleteBuffer, deleteOffset, deleteLength,
buffer, qualifierOffset, qualifierLength);
@@ -150,7 +150,7 @@ public class ScanDeleteTracker implement
}
@Override
- // should not be called at all even (!)
+ // should not be called at all even (!)
public void update() {
this.reset();
}
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java Fri May 7 19:17:48 2010
@@ -48,7 +48,7 @@ public class ScanQueryMatcher extends Qu
* @param rowComparator
*/
public ScanQueryMatcher(Scan scan, byte [] family,
- NavigableSet<byte[]> columns, long ttl,
+ NavigableSet<byte[]> columns, long ttl,
KeyValue.KeyComparator rowComparator, int maxVersions) {
this.tr = scan.getTimeRange();
this.oldestStamp = System.currentTimeMillis() - ttl;
@@ -62,7 +62,7 @@ public class ScanQueryMatcher extends Qu
}
this.filter = scan.getFilter();
this.oldFilter = scan.getOldFilter();
-
+
// Single branch to deal with two types of reads (columns vs all in family)
if (columns == null || columns.size() == 0) {
// use a specialized scan for wildcard column tracker.
@@ -81,7 +81,7 @@ public class ScanQueryMatcher extends Qu
* - include the current KeyValue (MatchCode.INCLUDE)
* - ignore the current KeyValue (MatchCode.SKIP)
* - got to the next row (MatchCode.DONE)
- *
+ *
* @param kv KeyValue to check
* @return The match code instance.
*/
@@ -95,14 +95,14 @@ public class ScanQueryMatcher extends Qu
byte [] bytes = kv.getBuffer();
int offset = kv.getOffset();
- int initialOffset = offset;
+ int initialOffset = offset;
int keyLength = Bytes.toInt(bytes, offset, Bytes.SIZEOF_INT);
offset += KeyValue.ROW_OFFSET;
-
+
short rowLength = Bytes.toShort(bytes, offset, Bytes.SIZEOF_SHORT);
offset += Bytes.SIZEOF_SHORT;
-
+
int ret = this.rowComparator.compareRows(row, 0, row.length,
bytes, offset, rowLength);
if (ret <= -1) {
@@ -122,17 +122,17 @@ public class ScanQueryMatcher extends Qu
stickyNextRow = true;
return MatchCode.SEEK_NEXT_ROW;
}
-
+
//Passing rowLength
offset += rowLength;
//Skipping family
byte familyLength = bytes [offset];
offset += familyLength + 1;
-
+
int qualLength = keyLength + KeyValue.ROW_OFFSET -
(offset - initialOffset) - KeyValue.TIMESTAMP_TYPE_SIZE;
-
+
long timestamp = kv.getTimestamp();
if (isExpired(timestamp)) {
// done, the rest of this column will also be expired as well.
@@ -145,7 +145,7 @@ public class ScanQueryMatcher extends Qu
this.deletes.add(bytes, offset, qualLength, timestamp, type);
// Can't early out now, because DelFam come before any other keys
}
- // May be able to optimize the SKIP here, if we matched
+ // May be able to optimize the SKIP here, if we matched
// due to a DelFam, we can skip to next row
// due to a DelCol, we can skip to next col
// But it requires more info out of isDelete().
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ScanWildcardColumnTracker.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ScanWildcardColumnTracker.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ScanWildcardColumnTracker.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/ScanWildcardColumnTracker.java Fri May 7 19:17:48 2010
@@ -29,7 +29,7 @@ import org.apache.hadoop.hbase.util.Byte
* Keeps track of the columns for a scan if they are not explicitly specified
*/
public class ScanWildcardColumnTracker implements ColumnTracker {
- private static final Log LOG =
+ private static final Log LOG =
LogFactory.getLog(ScanWildcardColumnTracker.class);
private byte [] columnBuffer = null;
private int columnOffset = 0;
@@ -103,7 +103,7 @@ public class ScanWildcardColumnTracker i
currentCount = 0;
if (++currentCount > maxVersions)
return MatchCode.SKIP;
- return MatchCode.INCLUDE;
+ return MatchCode.INCLUDE;
}
@Override
@@ -122,7 +122,7 @@ public class ScanWildcardColumnTracker i
* Used by matcher and scan/get to get a hint of the next column
* to seek to after checkColumn() returns SKIP. Returns the next interesting
* column we want, or NULL there is none (wildcard scanner).
- *
+ *
* @return The column count.
*/
public ColumnCount getColumnHint() {
@@ -131,7 +131,7 @@ public class ScanWildcardColumnTracker i
/**
- * We can never know a-priori if we are done, so always return false.
+ * We can never know a-priori if we are done, so always return false.
* @return false
*/
@Override
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/Store.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/Store.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/Store.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/Store.java Fri May 7 19:17:48 2010
@@ -66,7 +66,7 @@ import org.apache.hadoop.util.StringUtil
* A Store holds a column family in a Region. Its a memstore and a set of zero
* or more StoreFiles, which stretch backwards over time.
*
- * <p>There's no reason to consider append-logging at this level; all logging
+ * <p>There's no reason to consider append-logging at this level; all logging
* and locking is handled at the HRegion level. Store just provides
* services to manage sets of StoreFiles. One of the most important of those
* services is compaction services where files are aggregated once they pass
@@ -139,7 +139,7 @@ public class Store implements HConstants
private final int blocksize;
private final boolean blockcache;
private final Compression.Algorithm compression;
-
+
// Comparing KeyValues
final KeyValue.KVComparator comparator;
final KeyValue.KVComparator comparatorIgnoringType;
@@ -186,7 +186,7 @@ public class Store implements HConstants
this.ttl *= 1000;
}
this.memstore = new MemStore(this.comparator);
- this.regionCompactionDir = new Path(HRegion.getCompactionDir(basedir),
+ this.regionCompactionDir = new Path(HRegion.getCompactionDir(basedir),
Integer.toString(info.getEncodedName()));
this.storeName = this.family.getName();
this.storeNameStr = Bytes.toString(this.storeName);
@@ -195,10 +195,10 @@ public class Store implements HConstants
// MIN_COMMITS_FOR_COMPACTION map files
this.compactionThreshold =
conf.getInt("hbase.hstore.compactionThreshold", 3);
-
+
// Check if this is in-memory store
this.inMemory = family.isInMemory();
-
+
// By default we split region if a file > DEFAULT_MAX_FILE_SIZE.
long maxFileSize = info.getTableDesc().getMaxFileSize();
if (maxFileSize == HConstants.DEFAULT_MAX_FILE_SIZE) {
@@ -228,7 +228,7 @@ public class Store implements HConstants
this.maxSeqId = newId; // start with the log id we just recovered.
}
}
-
+
HColumnDescriptor getFamily() {
return this.family;
}
@@ -236,7 +236,7 @@ public class Store implements HConstants
long getMaxSequenceId() {
return this.maxSeqId;
}
-
+
long getMaxSeqIdBeforeLogRecovery() {
return maxSeqIdBeforeLogRecovery;
}
@@ -286,11 +286,11 @@ public class Store implements HConstants
}
/*
- * Read the reconstructionLog to see whether we need to build a brand-new
- * file out of non-flushed log entries.
+ * Read the reconstructionLog to see whether we need to build a brand-new
+ * file out of non-flushed log entries.
*
- * We can ignore any log message that has a sequence ID that's equal to or
- * lower than maxSeqID. (Because we know such log messages are already
+ * We can ignore any log message that has a sequence ID that's equal to or
+ * lower than maxSeqID. (Because we know such log messages are already
* reflected in the HFiles.)
*
* @return the new max sequence id as per the log, or -1 if no log recovered
@@ -447,7 +447,7 @@ public class Store implements HConstants
/**
* Adds a value to the memstore
- *
+ *
* @param kv
* @return memstore size delta
*/
@@ -462,7 +462,7 @@ public class Store implements HConstants
/**
* Adds a value to the memstore
- *
+ *
* @param kv
* @return memstore size delta
*/
@@ -484,10 +484,10 @@ public class Store implements HConstants
/**
* Close all the readers
- *
+ *
* We don't need to worry about subsequent requests because the HRegion holds
* a write lock that will prevent any more reads or writes.
- *
+ *
* @throws IOException
*/
List<StoreFile> close() throws IOException {
@@ -568,7 +568,7 @@ public class Store implements HConstants
writer.close();
}
}
- StoreFile sf = new StoreFile(this.fs, writer.getPath(), blockcache,
+ StoreFile sf = new StoreFile(this.fs, writer.getPath(), blockcache,
this.conf, this.inMemory);
Reader r = sf.getReader();
this.storeSize += r.length();
@@ -657,21 +657,21 @@ public class Store implements HConstants
//////////////////////////////////////////////////////////////////////////////
/**
- * Compact the StoreFiles. This method may take some time, so the calling
+ * Compact the StoreFiles. This method may take some time, so the calling
* thread must be able to block for long periods.
- *
+ *
* <p>During this time, the Store can work as usual, getting values from
* StoreFiles and writing new StoreFiles from the memstore.
- *
- * Existing StoreFiles are not destroyed until the new compacted StoreFile is
+ *
+ * Existing StoreFiles are not destroyed until the new compacted StoreFile is
* completely written-out to disk.
*
* <p>The compactLock prevents multiple simultaneous compactions.
* The structureLock prevents us from interfering with other write operations.
- *
- * <p>We don't want to hold the structureLock for the whole time, as a compact()
+ *
+ * <p>We don't want to hold the structureLock for the whole time, as a compact()
* can be lengthy and we want to allow cache-flushes during this period.
- *
+ *
* @param mc True to force a major compaction regardless of thresholds
* @return row to split around if a split is needed, null otherwise
* @throws IOException
@@ -699,7 +699,7 @@ public class Store implements HConstants
}
boolean references = hasReferences(filesToCompact);
- if (!majorcompaction && !references &&
+ if (!majorcompaction && !references &&
(forceSplit || (filesToCompact.size() < compactionThreshold))) {
return checkSplit(forceSplit);
}
@@ -733,10 +733,10 @@ public class Store implements HConstants
fileSizes[i] = len;
totalSize += len;
}
-
+
if (!majorcompaction && !references) {
- // Here we select files for incremental compaction.
- // The rule is: if the largest(oldest) one is more than twice the
+ // Here we select files for incremental compaction.
+ // The rule is: if the largest(oldest) one is more than twice the
// size of the second, skip the largest, and continue to next...,
// until we meet the compactionThreshold limit.
@@ -770,7 +770,7 @@ public class Store implements HConstants
" file(s), size: " + skipped);
}
}
-
+
// Ready to go. Have list of files to compact.
LOG.debug("Started compaction of " + filesToCompact.size() + " file(s)" +
(references? ", hasReferences=true,": " ") + " into " +
@@ -805,7 +805,7 @@ public class Store implements HConstants
/*
* Gets lowest timestamp from files in a dir
- *
+ *
* @param fs
* @param dir
* @throws IOException
@@ -873,7 +873,7 @@ public class Store implements HConstants
/**
* Do a minor/major compaction. Uses the scan infrastructure to make it easy.
- *
+ *
* @param filesToCompact which files to compact
* @param majorCompaction true to major compact (prune all deletes, max versions, etc)
* @param maxId Readers maximum sequence id.
@@ -939,14 +939,14 @@ public class Store implements HConstants
}
/*
- * It's assumed that the compactLock will be acquired prior to calling this
+ * It's assumed that the compactLock will be acquired prior to calling this
* method! Otherwise, it is not thread-safe!
*
* <p>It works by processing a compaction that's been written to disk.
- *
+ *
* <p>It is usually invoked at the end of a compaction, but might also be
* invoked at HStore startup, if the prior execution died midway through.
- *
+ *
* <p>Moving the compacted TreeMap into place means:
* <pre>
* 1) Moving the new compacted StoreFile into place
@@ -954,7 +954,7 @@ public class Store implements HConstants
* 3) Loading the new TreeMap.
* 4) Compute new store size
* </pre>
- *
+ *
* @param compactedFiles list of files that were compacted
* @param compactedFile StoreFile that is the result of the compaction
* @return StoreFile created. May be null.
@@ -1000,7 +1000,7 @@ public class Store implements HConstants
// WARN ugly hack here, but necessary sadly.
// TODO why is this necessary? need a comment here if it's unintuitive!
ReadWriteConsistencyControl.resetThreadReadPoint(region.getRWCC());
-
+
// Tell observers that list of StoreFiles has changed.
notifyChangedReadersObservers();
// Finally, delete old store files.
@@ -1040,7 +1040,7 @@ public class Store implements HConstants
public int getNumberOfstorefiles() {
return this.storefiles.size();
}
-
+
/*
* @param wantedVersions How many versions were asked for.
@@ -1068,8 +1068,8 @@ public class Store implements HConstants
/**
* Find the key that matches <i>row</i> exactly, or the one that immediately
- * preceeds it. WARNING: Only use this method on a table where writes occur
- * with strictly increasing timestamps. This method assumes this pattern of
+ * preceeds it. WARNING: Only use this method on a table where writes occur
+ * with strictly increasing timestamps. This method assumes this pattern of
* writes in order to make it reasonably performant. Also our search is
* dependent on the axiom that deletes are for cells that are in the container
* that follows whether a memstore snapshot or a storefile, not for the
@@ -1271,8 +1271,8 @@ public class Store implements HConstants
byte [] lk = r.getLastKey();
KeyValue lastKey = KeyValue.createKeyValueFromKey(lk, 0, lk.length);
// if the midkey is the same as the first and last keys, then we cannot
- // (ever) split this region.
- if (this.comparator.compareRows(mk, firstKey) == 0 &&
+ // (ever) split this region.
+ if (this.comparator.compareRows(mk, firstKey) == 0 &&
this.comparator.compareRows(mk, lastKey) == 0) {
if (LOG.isDebugEnabled()) {
LOG.debug("cannot split because midkey is the same as first or " +
@@ -1289,12 +1289,12 @@ public class Store implements HConstants
}
return null;
}
-
+
/** @return aggregate size of HStore */
public long getSize() {
return storeSize;
}
-
+
//////////////////////////////////////////////////////////////////////////////
// File administration
//////////////////////////////////////////////////////////////////////////////
@@ -1394,7 +1394,7 @@ public class Store implements HConstants
* @param kv Key to find.
* @return True if we were able to seek the scanner to <code>b</code> or to
* the key just after.
- * @throws IOException
+ * @throws IOException
*/
static boolean getClosest(final HFileScanner s, final KeyValue kv)
throws IOException {
@@ -1436,19 +1436,19 @@ public class Store implements HConstants
}
return false;
}
-
+
//
// HBASE-880/1249/1304
//
-
+
/**
* Retrieve results from this store given the specified Get parameters.
* @param get Get operation
* @param columns List of columns to match, can be empty (not null)
- * @param result List to add results to
+ * @param result List to add results to
* @throws IOException
*/
- public void get(Get get, NavigableSet<byte[]> columns, List<KeyValue> result)
+ public void get(Get get, NavigableSet<byte[]> columns, List<KeyValue> result)
throws IOException {
KeyComparator keyComparator = this.comparator.getRawComparator();
@@ -1462,12 +1462,12 @@ public class Store implements HConstants
// Received early-out from memstore
return;
}
-
+
// Check if we even have storefiles
if (this.storefiles.isEmpty()) {
return;
}
-
+
// Get storefiles for this store
List<HFileScanner> storefileScanners = new ArrayList<HFileScanner>();
for (StoreFile sf : this.storefiles.descendingMap().values()) {
@@ -1479,11 +1479,11 @@ public class Store implements HConstants
// Get a scanner that caches the block and uses pread
storefileScanners.add(r.getScanner(true, true));
}
-
+
// StoreFileGetScan will handle reading this store's storefiles
StoreFileGetScan scanner = new StoreFileGetScan(storefileScanners, matcher);
-
- // Run a GET scan and put results into the specified list
+
+ // Run a GET scan and put results into the specified list
scanner.get(result);
} finally {
this.lock.readLock().unlock();
@@ -1496,7 +1496,7 @@ public class Store implements HConstants
* This function will always be seen as atomic by other readers
* because it only puts a single KV to memstore. Thus no
* read/write control necessary.
- *
+ *
* @param row
* @param f
* @param qualifier
@@ -1562,17 +1562,17 @@ public class Store implements HConstants
public boolean hasTooManyStoreFiles() {
return this.storefiles.size() > this.compactionThreshold;
}
-
+
public static final long FIXED_OVERHEAD = ClassSize.align(
ClassSize.OBJECT + (17 * ClassSize.REFERENCE) +
(6 * Bytes.SIZEOF_LONG) + (3 * Bytes.SIZEOF_INT) + Bytes.SIZEOF_BOOLEAN +
ClassSize.align(ClassSize.ARRAY));
-
+
public static final long DEEP_OVERHEAD = ClassSize.align(FIXED_OVERHEAD +
- ClassSize.OBJECT + ClassSize.REENTRANT_LOCK +
- ClassSize.CONCURRENT_SKIPLISTMAP +
+ ClassSize.OBJECT + ClassSize.REENTRANT_LOCK +
+ ClassSize.CONCURRENT_SKIPLISTMAP +
ClassSize.CONCURRENT_SKIPLISTMAP_ENTRY + ClassSize.OBJECT);
-
+
@Override
public long heapSize() {
return DEEP_OVERHEAD + this.memstore.heapSize();
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreFile.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreFile.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreFile.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreFile.java Fri May 7 19:17:48 2010
@@ -78,7 +78,7 @@ public class StoreFile implements HConst
private boolean blockcache;
// Is this from an in-memory store
private boolean inMemory;
-
+
// Keys for metadata stored in backing HFile.
private static final byte [] MAX_SEQ_ID_KEY = Bytes.toBytes("MAX_SEQ_ID_KEY");
// Set when we obtain a Reader.
@@ -89,7 +89,7 @@ public class StoreFile implements HConst
// If true, this file was product of a major compaction. Its then set
// whenever you get a Reader.
private AtomicBoolean majorCompaction = null;
-
+
/*
* Regex that will work for straight filenames and for reference names.
* If reference, then the regex has more than just one group. Group 1 is
@@ -105,17 +105,17 @@ public class StoreFile implements HConst
private final HBaseConfiguration conf;
/**
- * Constructor, loads a reader and it's indices, etc. May allocate a
+ * Constructor, loads a reader and it's indices, etc. May allocate a
* substantial amount of ram depending on the underlying files (10-20MB?).
- *
+ *
* @param fs The current file system to use.
* @param p The path of the file.
* @param blockcache <code>true</code> if the block cache is enabled.
* @param conf The current configuration.
* @throws IOException When opening the reader fails.
*/
- StoreFile(final FileSystem fs, final Path p, final boolean blockcache,
- final HBaseConfiguration conf, final boolean inMemory)
+ StoreFile(final FileSystem fs, final Path p, final boolean blockcache,
+ final HBaseConfiguration conf, final boolean inMemory)
throws IOException {
this.conf = conf;
this.fs = fs;
@@ -220,7 +220,7 @@ public class StoreFile implements HConst
/**
* Returns the block cache or <code>null</code> in case none should be used.
- *
+ *
* @param conf The current configuration.
* @return The block cache or <code>null</code>.
*/
@@ -263,7 +263,7 @@ public class StoreFile implements HConst
throw new IllegalAccessError("Already open");
}
if (isReference()) {
- this.reader = new HalfHFileReader(this.fs, this.referencePath,
+ this.reader = new HalfHFileReader(this.fs, this.referencePath,
getBlockCache(), this.reference);
} else {
this.reader = new Reader(this.fs, this.path, getBlockCache(),
@@ -285,7 +285,7 @@ public class StoreFile implements HConst
this.sequenceid += 1;
}
}
-
+
}
b = map.get(MAJOR_COMPACTION_KEY);
if (b != null) {
@@ -327,7 +327,7 @@ public class StoreFile implements HConst
/**
* Delete this file
- * @throws IOException
+ * @throws IOException
*/
public void delete() throws IOException {
close();
@@ -446,7 +446,7 @@ public class StoreFile implements HConst
* Write file metadata.
* Call before you call close on the passed <code>w</code> since its written
* as metadata to that file.
- *
+ *
* @param w hfile writer
* @param maxSequenceId Maximum sequence id.
* @throws IOException
@@ -487,7 +487,7 @@ public class StoreFile implements HConst
throws IOException {
// A reference to the bottom half of the hsf store file.
Reference r = new Reference(splitRow, range);
- // Add the referred-to regions name as a dot separated suffix.
+ // Add the referred-to regions name as a dot separated suffix.
// See REF_NAME_PARSER regex above. The referred-to regions name is
// up in the path of the passed in <code>f</code> -- parentdir is family,
// then the directory above is the region name.
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreFileGetScan.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreFileGetScan.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreFileGetScan.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreFileGetScan.java Fri May 7 19:17:48 2010
@@ -35,7 +35,7 @@ public class StoreFileGetScan {
private QueryMatcher matcher;
private KeyValue startKey;
-
+
/**
* Constructor
* @param scanners
@@ -55,7 +55,7 @@ public class StoreFileGetScan {
* proceeding to the next StoreFile.
* <p>
* This strategy allows for optimal, stateless (no persisted Scanners)
- * early-out scenarios.
+ * early-out scenarios.
* @param result List to add results to
* @throws IOException
*/
@@ -67,15 +67,15 @@ public class StoreFileGetScan {
}
}
}
-
+
/**
* Performs a GET operation on a single StoreFile.
* @param scanner
* @param result
* @return true if done with this store, false if must continue to next
- * @throws IOException
+ * @throws IOException
*/
- public boolean getStoreFile(HFileScanner scanner, List<KeyValue> result)
+ public boolean getStoreFile(HFileScanner scanner, List<KeyValue> result)
throws IOException {
if (scanner.seekTo(startKey.getBuffer(), startKey.getKeyOffset(),
startKey.getKeyLength()) == -1) {
@@ -108,5 +108,5 @@ public class StoreFileGetScan {
} while(scanner.next());
return false;
}
-
+
}
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java Fri May 7 19:17:48 2010
@@ -36,10 +36,10 @@ import org.apache.hadoop.hbase.io.hfile.
*/
class StoreFileScanner implements KeyValueScanner {
static final Log LOG = LogFactory.getLog(Store.class);
-
+
private HFileScanner hfs;
private KeyValue cur = null;
-
+
/**
* Implements a {@link KeyValueScanner} on top of the specified {@link HFileScanner}
* @param hfs HFile scanner
@@ -74,11 +74,11 @@ class StoreFileScanner implements KeyVal
public String toString() {
return "StoreFileScanner[" + hfs.toString() + ", cur=" + cur + "]";
}
-
+
public KeyValue peek() {
return cur;
}
-
+
public KeyValue next() {
KeyValue retKey = cur;
cur = hfs.getKeyValue();
@@ -92,7 +92,7 @@ class StoreFileScanner implements KeyVal
}
return retKey;
}
-
+
public boolean seek(KeyValue key) {
try {
if(!seekAtOrAfter(hfs, key)) {
@@ -107,14 +107,14 @@ class StoreFileScanner implements KeyVal
return false;
}
}
-
+
public void close() {
// Nothing to close on HFileScanner?
cur = null;
}
-
+
/**
- *
+ *
* @param s
* @param k
* @return
@@ -134,4 +134,4 @@ class StoreFileScanner implements KeyVal
// Seeked to the exact key
return true;
}
-}
\ No newline at end of file
+}
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java Fri May 7 19:17:48 2010
@@ -77,7 +77,7 @@ class StoreScanner implements KeyValueSc
/**
* Used for major compactions.<p>
- *
+ *
* Opens a scanner across specified StoreFiles.
* @param store who we scan
* @param scan the spec
@@ -108,7 +108,7 @@ class StoreScanner implements KeyValueSc
this.store = null;
this.isGet = false;
this.cacheBlocks = scan.getCacheBlocks();
- this.matcher = new ScanQueryMatcher(scan, colFamily, columns, ttl,
+ this.matcher = new ScanQueryMatcher(scan, colFamily, columns, ttl,
comparator.getRawComparator(), scan.getMaxVersions());
// Seek all scanners to the initial key
@@ -209,12 +209,12 @@ class StoreScanner implements KeyValueSc
case SKIP:
this.heap.next();
break;
-
+
default:
throw new RuntimeException("UNEXPECTED");
}
}
-
+
if (!results.isEmpty()) {
// copy jazz
outResult.addAll(results);
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/WALEdit.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/WALEdit.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/WALEdit.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/WALEdit.java Fri May 7 19:17:48 2010
@@ -31,47 +31,47 @@ import org.apache.hadoop.io.Writable;
/**
* WALEdit: Used in HBase's transaction log (WAL) to represent
- * the collection of edits (KeyValue objects) corresponding to a
+ * the collection of edits (KeyValue objects) corresponding to a
* single transaction. The class implements "Writable" interface
* for serializing/deserializing a set of KeyValue items.
- *
+ *
* Previously, if a transaction contains 3 edits to c1, c2, c3 for a row R,
* the HLog would have three log entries as follows:
- *
+ *
* <logseq1-for-edit1>:<KeyValue-for-edit-c1>
* <logseq2-for-edit2>:<KeyValue-for-edit-c2>
* <logseq3-for-edit3>:<KeyValue-for-edit-c3>
- *
+ *
* This presents problems because row level atomicity of transactions
* was not guaranteed. If we crash after few of the above appends make
* it, then recovery will restore a partial transaction.
*
* In the new world, all the edits for a given transaction are written
* out as a single record, for example:
- *
+ *
* <logseq#-for-entire-txn>:<WALEdit-for-entire-txn>
- *
+ *
* where, the WALEdit is serialized as:
* <-1, # of edits, <KeyValue>, <KeyValue>, ... >
* For example:
* <-1, 3, <Keyvalue-for-edit-c1>, <KeyValue-for-edit-c2>, <KeyValue-for-edit-c3>>
- *
- * The -1 marker is just a special way of being backward compatible with
+ *
+ * The -1 marker is just a special way of being backward compatible with
* an old HLog which would have contained a single <KeyValue>.
- *
+ *
* The deserializer for WALEdit backward compatibly detects if the record
* is an old style KeyValue or the new style WALEdit.
*
*/
public class WALEdit implements Writable {
-
+
private final int VERSION_2 = -1;
-
+
private List<KeyValue> kvs = new ArrayList<KeyValue>();
-
+
public WALEdit() {
}
-
+
public void add(KeyValue kv) {
this.kvs.add(kv);
}
@@ -83,13 +83,13 @@ public class WALEdit implements Writable
public int size() {
return kvs.size();
}
-
+
public List<KeyValue> getKeyValues() {
return kvs;
}
public void readFields(DataInput in) throws IOException {
-
+
// ignore any old state in case caller is recycling an instance of this object.
kvs = new ArrayList<KeyValue>();
@@ -132,5 +132,5 @@ public class WALEdit implements Writable
sb.append(">]");
return sb.toString();
}
-
+
}
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/WildcardColumnTracker.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/WildcardColumnTracker.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/WildcardColumnTracker.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/WildcardColumnTracker.java Fri May 7 19:17:48 2010
@@ -26,7 +26,7 @@ import org.apache.hadoop.hbase.regionser
import org.apache.hadoop.hbase.util.Bytes;
/**
- * This class is used for the tracking and enforcement of columns and numbers
+ * This class is used for the tracking and enforcement of columns and numbers
* of versions during the course of a Get or Scan operation, when all available
* column qualifiers have been asked for in the query.
* <p>
@@ -36,20 +36,20 @@ import org.apache.hadoop.hbase.util.Byte
* what action should be taken.
* <li>{@link #update} is called at the end of every StoreFile or memstore.
* <p>
- * This class is NOT thread-safe as queries are never multi-threaded
+ * This class is NOT thread-safe as queries are never multi-threaded
*/
public class WildcardColumnTracker implements ColumnTracker {
-
+
private int maxVersions;
-
+
protected List<ColumnCount> columns;
private int index;
private ColumnCount column;
-
- private List<ColumnCount> newColumns;
+
+ private List<ColumnCount> newColumns;
private int newIndex;
private ColumnCount newColumn;
-
+
/**
* Default constructor.
* @param maxVersions maximum versions to return per columns
@@ -58,7 +58,7 @@ public class WildcardColumnTracker imple
this.maxVersions = maxVersions;
reset();
}
-
+
public void reset() {
this.index = 0;
this.column = null;
@@ -67,7 +67,7 @@ public class WildcardColumnTracker imple
this.newIndex = 0;
this.newColumn = null;
}
-
+
/**
* Can never early-out from reading more storefiles in Wildcard case.
*/
@@ -241,7 +241,7 @@ public class WildcardColumnTracker imple
}
} while(true);
}
-
+
/**
* Called at the end of every StoreFile or memstore.
*/
@@ -253,14 +253,14 @@ public class WildcardColumnTracker imple
}
return;
}
-
+
// If no new columns, retain previous columns and return
if(this.newColumns.size() == 0) {
this.index = 0;
this.column = this.columns.get(index);
return;
}
-
+
// Merge previous columns with new columns
// There will be no overlapping
List<ColumnCount> mergeColumns = new ArrayList<ColumnCount>(
@@ -271,14 +271,14 @@ public class WildcardColumnTracker imple
newColumn = newColumns.get(0);
while(true) {
int ret = Bytes.compareTo(
- column.getBuffer(), column.getOffset(),column.getLength(),
+ column.getBuffer(), column.getOffset(),column.getLength(),
newColumn.getBuffer(), newColumn.getOffset(), newColumn.getLength());
-
+
// Existing is smaller than new, add existing and iterate it
if(ret <= -1) {
mergeColumns.add(column);
if(++index == columns.size()) {
- // No more existing left, merge down rest of new and return
+ // No more existing left, merge down rest of new and return
mergeDown(mergeColumns, newColumns, newIndex);
finish(mergeColumns);
return;
@@ -286,7 +286,7 @@ public class WildcardColumnTracker imple
column = columns.get(index);
continue;
}
-
+
// New is smaller than existing, add new and iterate it
mergeColumns.add(newColumn);
if(++newIndex == newColumns.size()) {
@@ -299,23 +299,23 @@ public class WildcardColumnTracker imple
continue;
}
}
-
- private void mergeDown(List<ColumnCount> mergeColumns,
+
+ private void mergeDown(List<ColumnCount> mergeColumns,
List<ColumnCount> srcColumns, int srcIndex) {
int index = srcIndex;
while(index < srcColumns.size()) {
mergeColumns.add(srcColumns.get(index++));
}
}
-
+
private void finish(List<ColumnCount> mergeColumns) {
this.columns = mergeColumns;
this.index = 0;
this.column = this.columns.size() > 0? columns.get(index) : null;
-
+
this.newColumns = new ArrayList<ColumnCount>();
this.newIndex = 0;
this.newColumn = null;
}
-
+
}
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerMetrics.java Fri May 7 19:17:48 2010
@@ -36,7 +36,7 @@ import org.apache.hadoop.metrics.util.Me
import org.apache.hadoop.metrics.util.MetricsLongValue;
import org.apache.hadoop.metrics.util.MetricsRegistry;
-/**
+/**
* This class is for maintaining the various regionserver statistics
* and publishing them through the metrics interfaces.
* <p>
@@ -50,10 +50,10 @@ public class RegionServerMetrics impleme
private static final int MB = 1024*1024;
private MetricsRegistry registry = new MetricsRegistry();
private final RegionServerStatistics statistics;
-
+
public final MetricsTimeVaryingRate atomicIncrementTime =
new MetricsTimeVaryingRate("atomicIncrementTime", registry);
-
+
/**
* Count of regions carried by this regionserver
*/
@@ -110,19 +110,19 @@ public class RegionServerMetrics impleme
/**
* filesystem read latency
*/
- public final MetricsTimeVaryingRate fsReadLatency =
+ public final MetricsTimeVaryingRate fsReadLatency =
new MetricsTimeVaryingRate("fsReadLatency", registry);
/**
* filesystem write latency
*/
- public final MetricsTimeVaryingRate fsWriteLatency =
+ public final MetricsTimeVaryingRate fsWriteLatency =
new MetricsTimeVaryingRate("fsWriteLatency", registry);
/**
* filesystem sync latency
*/
- public final MetricsTimeVaryingRate fsSyncLatency =
+ public final MetricsTimeVaryingRate fsSyncLatency =
new MetricsTimeVaryingRate("fsSyncLatency", registry);
public RegionServerMetrics() {
@@ -148,7 +148,7 @@ public class RegionServerMetrics impleme
/**
* Since this object is a registered updater, this method will be called
* periodically, e.g. every 5 seconds.
- * @param unused
+ * @param unused
*/
public void doUpdates(MetricsContext unused) {
synchronized (this) {
@@ -163,7 +163,7 @@ public class RegionServerMetrics impleme
this.blockCacheFree.pushMetric(this.metricsRecord);
this.blockCacheCount.pushMetric(this.metricsRecord);
this.blockCacheHitRatio.pushMetric(this.metricsRecord);
-
+
// Mix in HFile and HLog metrics
// Be careful. Here is code for MTVR from up in hadoop:
// public synchronized void inc(final int numOps, final long time) {
@@ -204,14 +204,14 @@ public class RegionServerMetrics impleme
public float getRequests() {
return this.requests.getPreviousIntervalValue();
}
-
+
/**
* @param inc How much to add to requests.
*/
public void incrementRequests(final int inc) {
this.requests.inc(inc);
}
-
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerStatistics.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerStatistics.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerStatistics.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/metrics/RegionServerStatistics.java Fri May 7 19:17:48 2010
@@ -34,8 +34,8 @@ public class RegionServerStatistics exte
public RegionServerStatistics(MetricsRegistry registry, String rsName) {
super(registry, "RegionServerStatistics");
- mbeanName = MBeanUtil.registerMBean("RegionServer",
- "RegionServerStatistics", this);
+ mbeanName = MBeanUtil.registerMBean("RegionServer",
+ "RegionServerStatistics", this);
}
public void shutdown() {
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/AbstractController.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/AbstractController.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/AbstractController.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/AbstractController.java Fri May 7 19:17:48 2010
@@ -53,7 +53,7 @@ public abstract class AbstractController
protected abstract AbstractModel generateModel(HBaseConfiguration conf,
HBaseAdmin a);
-
+
protected byte[][] getColumnsFromQueryMap(Map<String, String[]> queryMap) {
byte[][] columns = null;
String[] columnArray = queryMap.get(RESTConstants.COLUMN);
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/Dispatcher.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/Dispatcher.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/Dispatcher.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/Dispatcher.java Fri May 7 19:17:48 2010
@@ -51,7 +51,7 @@ import java.util.Map;
* <p>
* This servlet has explicit dependency on Jetty server; it uses the jetty
* implementation of MultipartResponse.
- *
+ *
* <p>
* TODO:
* <ul>
@@ -65,7 +65,7 @@ import java.util.Map;
* <li>Minor items are we are decoding URLs in places where probably already
* done and how to timeout scanners that are in the scanner list.</li>
* </ul>
- *
+ *
* @see <a href="http://wiki.apache.org/lucene-hadoop/Hbase/HbaseRest">Hbase
* REST Specification</a>
* @deprecated Use the {@link org.apache.hadoop.hbase.stargate} hbase contrib instead.
@@ -73,7 +73,7 @@ import java.util.Map;
public class Dispatcher extends javax.servlet.http.HttpServlet {
/**
- *
+ *
*/
private static final long serialVersionUID = -8075335435797071569L;
private static final Log LOG = LogFactory.getLog(Dispatcher.class);
@@ -101,7 +101,7 @@ public class Dispatcher extends javax.se
/**
* Utility method used looking at Accept header content.
- *
+ *
* @param t
* The content type to examine.
* @return The enum that matches the prefix of <code>t</code> or the default
@@ -294,7 +294,7 @@ public class Dispatcher extends javax.se
Status s = createStatus(request, response);
byte[][] pathSegments = getPathSegments(request);
Map<String, String[]> queryMap = request.getParameterMap();
-
+
if(pathSegments.length == 0) {
throw new HBaseRestException("method not supported");
} else if (pathSegments.length == 1 && pathSegments[0].length > 0) {
@@ -332,17 +332,17 @@ public class Dispatcher extends javax.se
/**
* This method will get the path segments from the HttpServletRequest. Please
- * note that if the first segment of the path is /api this is removed from the
+ * note that if the first segment of the path is /api this is removed from the
* returning byte array.
- *
+ *
* @param request
- *
+ *
* @return request pathinfo split on the '/' ignoring the first '/' so first
* element in pathSegment is not the empty string.
*/
protected byte[][] getPathSegments(final HttpServletRequest request) {
int context_len = request.getContextPath().length() + 1;
-
+
byte[][] pathSegments = Bytes.toByteArrays(request.getRequestURI().substring(context_len)
.split("/"));
byte[] apiAsBytes = "api".getBytes();
@@ -377,7 +377,7 @@ public class Dispatcher extends javax.se
}
char [] c;// 40 characters * sizeof(UTF16)
while (true) {
- c = new char[bufferLength];
+ c = new char[bufferLength];
int n = r.read(c, 0, bufferLength);
if (n == -1) break;
resultant += new String(c, 0, n);
@@ -431,7 +431,7 @@ public class Dispatcher extends javax.se
/*
* Start up the REST servlet in standalone mode.
- *
+ *
* @param args
*/
protected static void doMain(final String[] args) throws Exception {
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/RowController.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/RowController.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/RowController.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/RowController.java Fri May 7 19:17:48 2010
@@ -61,7 +61,7 @@ public class RowController extends Abstr
tableName = pathSegments[0];
rowName = pathSegments[2];
RowResult row = null;
-
+
if (queryMap.size() == 0 && pathSegments.length <= 3) {
row = innerModel.get(tableName, rowName);
} else if (pathSegments.length == 4
Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/RowModel.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/RowModel.java?rev=942184&r1=942183&r2=942184&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/RowModel.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/rest/RowModel.java Fri May 7 19:17:48 2010
@@ -61,7 +61,7 @@ public class RowModel extends AbstractMo
throw new HBaseRestException(e);
}
}
-
+
@Deprecated
public RowResult get(byte[] tableName, byte[] rowName, byte[][] columns)
throws HBaseRestException {
@@ -84,7 +84,7 @@ public class RowModel extends AbstractMo
get.setTimeStamp(timestamp);
return get(tableName, get).getRowResult();
}
-
+
@Deprecated
public RowResult get(byte[] tableName, byte[] rowName, long timestamp)
throws HBaseRestException {
@@ -128,7 +128,7 @@ public class RowModel extends AbstractMo
throw new HBaseRestException(e);
}
}
-
+
@Deprecated
public void delete(byte[] tableName, byte[] rowName)
throws HBaseRestException {
@@ -146,7 +146,7 @@ public class RowModel extends AbstractMo
}
delete(tableName, delete);
}
-
+
public void delete(byte[] tableName, Delete delete)
throws HBaseRestException {
try {