http://git-wip-us.apache.org/repos/asf/hbase-site/blob/92a26cfb/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/AbstractMemStore.html ---------------------------------------------------------------------- diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/AbstractMemStore.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/AbstractMemStore.html index 68e703a..d1ce4f8 100644 --- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/AbstractMemStore.html +++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/AbstractMemStore.html @@ -173,183 +173,177 @@ <span class="sourceLineNo">165</span><a name="line.165"></a> <span class="sourceLineNo">166</span> @Override<a name="line.166"></a> <span class="sourceLineNo">167</span> public MemStoreSize getSnapshotSize() {<a name="line.167"></a> -<span class="sourceLineNo">168</span> return getSnapshotSizing();<a name="line.168"></a> +<span class="sourceLineNo">168</span> return this.snapshot.getMemStoreSize();<a name="line.168"></a> <span class="sourceLineNo">169</span> }<a name="line.169"></a> <span class="sourceLineNo">170</span><a name="line.170"></a> -<span class="sourceLineNo">171</span> MemStoreSizing getSnapshotSizing() {<a name="line.171"></a> -<span class="sourceLineNo">172</span> return new MemStoreSizing(this.snapshot.keySize(),<a name="line.172"></a> -<span class="sourceLineNo">173</span> this.snapshot.heapSize(),<a name="line.173"></a> -<span class="sourceLineNo">174</span> this.snapshot.offHeapSize());<a name="line.174"></a> -<span class="sourceLineNo">175</span> }<a name="line.175"></a> -<span class="sourceLineNo">176</span><a name="line.176"></a> -<span class="sourceLineNo">177</span> @Override<a name="line.177"></a> -<span class="sourceLineNo">178</span> public String toString() {<a name="line.178"></a> -<span class="sourceLineNo">179</span> StringBuilder buf = new StringBuilder();<a name="line.179"></a> -<span class="sourceLineNo">180</span> int i = 1;<a name="line.180"></a> -<span class="sourceLineNo">181</span> try {<a name="line.181"></a> -<span class="sourceLineNo">182</span> for (Segment segment : getSegments()) {<a name="line.182"></a> -<span class="sourceLineNo">183</span> buf.append("Segment (" + i + ") " + segment.toString() + "; ");<a name="line.183"></a> -<span class="sourceLineNo">184</span> i++;<a name="line.184"></a> -<span class="sourceLineNo">185</span> }<a name="line.185"></a> -<span class="sourceLineNo">186</span> } catch (IOException e){<a name="line.186"></a> -<span class="sourceLineNo">187</span> return e.toString();<a name="line.187"></a> -<span class="sourceLineNo">188</span> }<a name="line.188"></a> -<span class="sourceLineNo">189</span> return buf.toString();<a name="line.189"></a> -<span class="sourceLineNo">190</span> }<a name="line.190"></a> -<span class="sourceLineNo">191</span><a name="line.191"></a> -<span class="sourceLineNo">192</span> protected Configuration getConfiguration() {<a name="line.192"></a> -<span class="sourceLineNo">193</span> return conf;<a name="line.193"></a> -<span class="sourceLineNo">194</span> }<a name="line.194"></a> +<span class="sourceLineNo">171</span> @Override<a name="line.171"></a> +<span class="sourceLineNo">172</span> public String toString() {<a name="line.172"></a> +<span class="sourceLineNo">173</span> StringBuilder buf = new StringBuilder();<a name="line.173"></a> +<span class="sourceLineNo">174</span> int i = 1;<a name="line.174"></a> +<span class="sourceLineNo">175</span> try {<a name="line.175"></a> +<span class="sourceLineNo">176</span> for (Segment segment : getSegments()) {<a name="line.176"></a> +<span class="sourceLineNo">177</span> buf.append("Segment (" + i + ") " + segment.toString() + "; ");<a name="line.177"></a> +<span class="sourceLineNo">178</span> i++;<a name="line.178"></a> +<span class="sourceLineNo">179</span> }<a name="line.179"></a> +<span class="sourceLineNo">180</span> } catch (IOException e){<a name="line.180"></a> +<span class="sourceLineNo">181</span> return e.toString();<a name="line.181"></a> +<span class="sourceLineNo">182</span> }<a name="line.182"></a> +<span class="sourceLineNo">183</span> return buf.toString();<a name="line.183"></a> +<span class="sourceLineNo">184</span> }<a name="line.184"></a> +<span class="sourceLineNo">185</span><a name="line.185"></a> +<span class="sourceLineNo">186</span> protected Configuration getConfiguration() {<a name="line.186"></a> +<span class="sourceLineNo">187</span> return conf;<a name="line.187"></a> +<span class="sourceLineNo">188</span> }<a name="line.188"></a> +<span class="sourceLineNo">189</span><a name="line.189"></a> +<span class="sourceLineNo">190</span> protected void dump(Logger log) {<a name="line.190"></a> +<span class="sourceLineNo">191</span> active.dump(log);<a name="line.191"></a> +<span class="sourceLineNo">192</span> snapshot.dump(log);<a name="line.192"></a> +<span class="sourceLineNo">193</span> }<a name="line.193"></a> +<span class="sourceLineNo">194</span><a name="line.194"></a> <span class="sourceLineNo">195</span><a name="line.195"></a> -<span class="sourceLineNo">196</span> protected void dump(Logger log) {<a name="line.196"></a> -<span class="sourceLineNo">197</span> active.dump(log);<a name="line.197"></a> -<span class="sourceLineNo">198</span> snapshot.dump(log);<a name="line.198"></a> -<span class="sourceLineNo">199</span> }<a name="line.199"></a> -<span class="sourceLineNo">200</span><a name="line.200"></a> -<span class="sourceLineNo">201</span><a name="line.201"></a> -<span class="sourceLineNo">202</span> /*<a name="line.202"></a> -<span class="sourceLineNo">203</span> * Inserts the specified Cell into MemStore and deletes any existing<a name="line.203"></a> -<span class="sourceLineNo">204</span> * versions of the same row/family/qualifier as the specified Cell.<a name="line.204"></a> -<span class="sourceLineNo">205</span> * <p><a name="line.205"></a> -<span class="sourceLineNo">206</span> * First, the specified Cell is inserted into the Memstore.<a name="line.206"></a> -<span class="sourceLineNo">207</span> * <p><a name="line.207"></a> -<span class="sourceLineNo">208</span> * If there are any existing Cell in this MemStore with the same row,<a name="line.208"></a> -<span class="sourceLineNo">209</span> * family, and qualifier, they are removed.<a name="line.209"></a> -<span class="sourceLineNo">210</span> * <p><a name="line.210"></a> -<span class="sourceLineNo">211</span> * Callers must hold the read lock.<a name="line.211"></a> -<span class="sourceLineNo">212</span> *<a name="line.212"></a> -<span class="sourceLineNo">213</span> * @param cell the cell to be updated<a name="line.213"></a> -<span class="sourceLineNo">214</span> * @param readpoint readpoint below which we can safely remove duplicate KVs<a name="line.214"></a> -<span class="sourceLineNo">215</span> * @param memstoreSize<a name="line.215"></a> -<span class="sourceLineNo">216</span> */<a name="line.216"></a> -<span class="sourceLineNo">217</span> private void upsert(Cell cell, long readpoint, MemStoreSizing memstoreSizing) {<a name="line.217"></a> -<span class="sourceLineNo">218</span> // Add the Cell to the MemStore<a name="line.218"></a> -<span class="sourceLineNo">219</span> // Use the internalAdd method here since we (a) already have a lock<a name="line.219"></a> -<span class="sourceLineNo">220</span> // and (b) cannot safely use the MSLAB here without potentially<a name="line.220"></a> -<span class="sourceLineNo">221</span> // hitting OOME - see TestMemStore.testUpsertMSLAB for a<a name="line.221"></a> -<span class="sourceLineNo">222</span> // test that triggers the pathological case if we don't avoid MSLAB<a name="line.222"></a> -<span class="sourceLineNo">223</span> // here.<a name="line.223"></a> -<span class="sourceLineNo">224</span> // This cell data is backed by the same byte[] where we read request in RPC(See HBASE-15180). We<a name="line.224"></a> -<span class="sourceLineNo">225</span> // must do below deep copy. Or else we will keep referring to the bigger chunk of memory and<a name="line.225"></a> -<span class="sourceLineNo">226</span> // prevent it from getting GCed.<a name="line.226"></a> -<span class="sourceLineNo">227</span> cell = deepCopyIfNeeded(cell);<a name="line.227"></a> -<span class="sourceLineNo">228</span> this.active.upsert(cell, readpoint, memstoreSizing);<a name="line.228"></a> -<span class="sourceLineNo">229</span> setOldestEditTimeToNow();<a name="line.229"></a> -<span class="sourceLineNo">230</span> checkActiveSize();<a name="line.230"></a> -<span class="sourceLineNo">231</span> }<a name="line.231"></a> -<span class="sourceLineNo">232</span><a name="line.232"></a> -<span class="sourceLineNo">233</span> /*<a name="line.233"></a> -<span class="sourceLineNo">234</span> * @param a<a name="line.234"></a> -<span class="sourceLineNo">235</span> * @param b<a name="line.235"></a> -<span class="sourceLineNo">236</span> * @return Return lowest of a or b or null if both a and b are null<a name="line.236"></a> -<span class="sourceLineNo">237</span> */<a name="line.237"></a> -<span class="sourceLineNo">238</span> protected Cell getLowest(final Cell a, final Cell b) {<a name="line.238"></a> -<span class="sourceLineNo">239</span> if (a == null) {<a name="line.239"></a> -<span class="sourceLineNo">240</span> return b;<a name="line.240"></a> -<span class="sourceLineNo">241</span> }<a name="line.241"></a> -<span class="sourceLineNo">242</span> if (b == null) {<a name="line.242"></a> -<span class="sourceLineNo">243</span> return a;<a name="line.243"></a> -<span class="sourceLineNo">244</span> }<a name="line.244"></a> -<span class="sourceLineNo">245</span> return comparator.compareRows(a, b) <= 0? a: b;<a name="line.245"></a> -<span class="sourceLineNo">246</span> }<a name="line.246"></a> -<span class="sourceLineNo">247</span><a name="line.247"></a> -<span class="sourceLineNo">248</span> /*<a name="line.248"></a> -<span class="sourceLineNo">249</span> * @param key Find row that follows this one. If null, return first.<a name="line.249"></a> -<span class="sourceLineNo">250</span> * @param set Set to look in for a row beyond <code>row</code>.<a name="line.250"></a> -<span class="sourceLineNo">251</span> * @return Next row or null if none found. If one found, will be a new<a name="line.251"></a> -<span class="sourceLineNo">252</span> * KeyValue -- can be destroyed by subsequent calls to this method.<a name="line.252"></a> -<span class="sourceLineNo">253</span> */<a name="line.253"></a> -<span class="sourceLineNo">254</span> protected Cell getNextRow(final Cell key,<a name="line.254"></a> -<span class="sourceLineNo">255</span> final NavigableSet<Cell> set) {<a name="line.255"></a> -<span class="sourceLineNo">256</span> Cell result = null;<a name="line.256"></a> -<span class="sourceLineNo">257</span> SortedSet<Cell> tail = key == null? set: set.tailSet(key);<a name="line.257"></a> -<span class="sourceLineNo">258</span> // Iterate until we fall into the next row; i.e. move off current row<a name="line.258"></a> -<span class="sourceLineNo">259</span> for (Cell cell: tail) {<a name="line.259"></a> -<span class="sourceLineNo">260</span> if (comparator.compareRows(cell, key) <= 0) {<a name="line.260"></a> -<span class="sourceLineNo">261</span> continue;<a name="line.261"></a> -<span class="sourceLineNo">262</span> }<a name="line.262"></a> -<span class="sourceLineNo">263</span> // Note: Not suppressing deletes or expired cells. Needs to be handled<a name="line.263"></a> -<span class="sourceLineNo">264</span> // by higher up functions.<a name="line.264"></a> -<span class="sourceLineNo">265</span> result = cell;<a name="line.265"></a> -<span class="sourceLineNo">266</span> break;<a name="line.266"></a> -<span class="sourceLineNo">267</span> }<a name="line.267"></a> -<span class="sourceLineNo">268</span> return result;<a name="line.268"></a> -<span class="sourceLineNo">269</span> }<a name="line.269"></a> -<span class="sourceLineNo">270</span><a name="line.270"></a> -<span class="sourceLineNo">271</span> /**<a name="line.271"></a> -<span class="sourceLineNo">272</span> * If the segment has a memory allocator the cell is being cloned to this space, and returned;<a name="line.272"></a> -<span class="sourceLineNo">273</span> * Otherwise the given cell is returned<a name="line.273"></a> -<span class="sourceLineNo">274</span> *<a name="line.274"></a> -<span class="sourceLineNo">275</span> * When a cell's size is too big (bigger than maxAlloc), it is not allocated on MSLAB.<a name="line.275"></a> -<span class="sourceLineNo">276</span> * Since the process of flattening to CellChunkMap assumes that all cells are allocated on MSLAB,<a name="line.276"></a> -<span class="sourceLineNo">277</span> * during this process, the input parameter forceCloneOfBigCell is set to 'true'<a name="line.277"></a> -<span class="sourceLineNo">278</span> * and the cell is copied into MSLAB.<a name="line.278"></a> -<span class="sourceLineNo">279</span> *<a name="line.279"></a> -<span class="sourceLineNo">280</span> * @param cell the cell to clone<a name="line.280"></a> -<span class="sourceLineNo">281</span> * @param forceCloneOfBigCell true only during the process of flattening to CellChunkMap.<a name="line.281"></a> -<span class="sourceLineNo">282</span> * @return either the given cell or its clone<a name="line.282"></a> -<span class="sourceLineNo">283</span> */<a name="line.283"></a> -<span class="sourceLineNo">284</span> private Cell maybeCloneWithAllocator(Cell cell, boolean forceCloneOfBigCell) {<a name="line.284"></a> -<span class="sourceLineNo">285</span> return active.maybeCloneWithAllocator(cell, forceCloneOfBigCell);<a name="line.285"></a> -<span class="sourceLineNo">286</span> }<a name="line.286"></a> -<span class="sourceLineNo">287</span><a name="line.287"></a> -<span class="sourceLineNo">288</span> /*<a name="line.288"></a> -<span class="sourceLineNo">289</span> * Internal version of add() that doesn't clone Cells with the<a name="line.289"></a> -<span class="sourceLineNo">290</span> * allocator, and doesn't take the lock.<a name="line.290"></a> -<span class="sourceLineNo">291</span> *<a name="line.291"></a> -<span class="sourceLineNo">292</span> * Callers should ensure they already have the read lock taken<a name="line.292"></a> -<span class="sourceLineNo">293</span> * @param toAdd the cell to add<a name="line.293"></a> -<span class="sourceLineNo">294</span> * @param mslabUsed whether using MSLAB<a name="line.294"></a> -<span class="sourceLineNo">295</span> * @param memstoreSize<a name="line.295"></a> -<span class="sourceLineNo">296</span> */<a name="line.296"></a> -<span class="sourceLineNo">297</span> private void internalAdd(final Cell toAdd, final boolean mslabUsed, MemStoreSizing memstoreSizing) {<a name="line.297"></a> -<span class="sourceLineNo">298</span> active.add(toAdd, mslabUsed, memstoreSizing);<a name="line.298"></a> -<span class="sourceLineNo">299</span> setOldestEditTimeToNow();<a name="line.299"></a> -<span class="sourceLineNo">300</span> checkActiveSize();<a name="line.300"></a> +<span class="sourceLineNo">196</span> /*<a name="line.196"></a> +<span class="sourceLineNo">197</span> * Inserts the specified Cell into MemStore and deletes any existing<a name="line.197"></a> +<span class="sourceLineNo">198</span> * versions of the same row/family/qualifier as the specified Cell.<a name="line.198"></a> +<span class="sourceLineNo">199</span> * <p><a name="line.199"></a> +<span class="sourceLineNo">200</span> * First, the specified Cell is inserted into the Memstore.<a name="line.200"></a> +<span class="sourceLineNo">201</span> * <p><a name="line.201"></a> +<span class="sourceLineNo">202</span> * If there are any existing Cell in this MemStore with the same row,<a name="line.202"></a> +<span class="sourceLineNo">203</span> * family, and qualifier, they are removed.<a name="line.203"></a> +<span class="sourceLineNo">204</span> * <p><a name="line.204"></a> +<span class="sourceLineNo">205</span> * Callers must hold the read lock.<a name="line.205"></a> +<span class="sourceLineNo">206</span> *<a name="line.206"></a> +<span class="sourceLineNo">207</span> * @param cell the cell to be updated<a name="line.207"></a> +<span class="sourceLineNo">208</span> * @param readpoint readpoint below which we can safely remove duplicate KVs<a name="line.208"></a> +<span class="sourceLineNo">209</span> * @param memstoreSize<a name="line.209"></a> +<span class="sourceLineNo">210</span> */<a name="line.210"></a> +<span class="sourceLineNo">211</span> private void upsert(Cell cell, long readpoint, MemStoreSizing memstoreSizing) {<a name="line.211"></a> +<span class="sourceLineNo">212</span> // Add the Cell to the MemStore<a name="line.212"></a> +<span class="sourceLineNo">213</span> // Use the internalAdd method here since we (a) already have a lock<a name="line.213"></a> +<span class="sourceLineNo">214</span> // and (b) cannot safely use the MSLAB here without potentially<a name="line.214"></a> +<span class="sourceLineNo">215</span> // hitting OOME - see TestMemStore.testUpsertMSLAB for a<a name="line.215"></a> +<span class="sourceLineNo">216</span> // test that triggers the pathological case if we don't avoid MSLAB<a name="line.216"></a> +<span class="sourceLineNo">217</span> // here.<a name="line.217"></a> +<span class="sourceLineNo">218</span> // This cell data is backed by the same byte[] where we read request in RPC(See HBASE-15180). We<a name="line.218"></a> +<span class="sourceLineNo">219</span> // must do below deep copy. Or else we will keep referring to the bigger chunk of memory and<a name="line.219"></a> +<span class="sourceLineNo">220</span> // prevent it from getting GCed.<a name="line.220"></a> +<span class="sourceLineNo">221</span> cell = deepCopyIfNeeded(cell);<a name="line.221"></a> +<span class="sourceLineNo">222</span> this.active.upsert(cell, readpoint, memstoreSizing);<a name="line.222"></a> +<span class="sourceLineNo">223</span> setOldestEditTimeToNow();<a name="line.223"></a> +<span class="sourceLineNo">224</span> checkActiveSize();<a name="line.224"></a> +<span class="sourceLineNo">225</span> }<a name="line.225"></a> +<span class="sourceLineNo">226</span><a name="line.226"></a> +<span class="sourceLineNo">227</span> /*<a name="line.227"></a> +<span class="sourceLineNo">228</span> * @param a<a name="line.228"></a> +<span class="sourceLineNo">229</span> * @param b<a name="line.229"></a> +<span class="sourceLineNo">230</span> * @return Return lowest of a or b or null if both a and b are null<a name="line.230"></a> +<span class="sourceLineNo">231</span> */<a name="line.231"></a> +<span class="sourceLineNo">232</span> protected Cell getLowest(final Cell a, final Cell b) {<a name="line.232"></a> +<span class="sourceLineNo">233</span> if (a == null) {<a name="line.233"></a> +<span class="sourceLineNo">234</span> return b;<a name="line.234"></a> +<span class="sourceLineNo">235</span> }<a name="line.235"></a> +<span class="sourceLineNo">236</span> if (b == null) {<a name="line.236"></a> +<span class="sourceLineNo">237</span> return a;<a name="line.237"></a> +<span class="sourceLineNo">238</span> }<a name="line.238"></a> +<span class="sourceLineNo">239</span> return comparator.compareRows(a, b) <= 0? a: b;<a name="line.239"></a> +<span class="sourceLineNo">240</span> }<a name="line.240"></a> +<span class="sourceLineNo">241</span><a name="line.241"></a> +<span class="sourceLineNo">242</span> /*<a name="line.242"></a> +<span class="sourceLineNo">243</span> * @param key Find row that follows this one. If null, return first.<a name="line.243"></a> +<span class="sourceLineNo">244</span> * @param set Set to look in for a row beyond <code>row</code>.<a name="line.244"></a> +<span class="sourceLineNo">245</span> * @return Next row or null if none found. If one found, will be a new<a name="line.245"></a> +<span class="sourceLineNo">246</span> * KeyValue -- can be destroyed by subsequent calls to this method.<a name="line.246"></a> +<span class="sourceLineNo">247</span> */<a name="line.247"></a> +<span class="sourceLineNo">248</span> protected Cell getNextRow(final Cell key,<a name="line.248"></a> +<span class="sourceLineNo">249</span> final NavigableSet<Cell> set) {<a name="line.249"></a> +<span class="sourceLineNo">250</span> Cell result = null;<a name="line.250"></a> +<span class="sourceLineNo">251</span> SortedSet<Cell> tail = key == null? set: set.tailSet(key);<a name="line.251"></a> +<span class="sourceLineNo">252</span> // Iterate until we fall into the next row; i.e. move off current row<a name="line.252"></a> +<span class="sourceLineNo">253</span> for (Cell cell: tail) {<a name="line.253"></a> +<span class="sourceLineNo">254</span> if (comparator.compareRows(cell, key) <= 0) {<a name="line.254"></a> +<span class="sourceLineNo">255</span> continue;<a name="line.255"></a> +<span class="sourceLineNo">256</span> }<a name="line.256"></a> +<span class="sourceLineNo">257</span> // Note: Not suppressing deletes or expired cells. Needs to be handled<a name="line.257"></a> +<span class="sourceLineNo">258</span> // by higher up functions.<a name="line.258"></a> +<span class="sourceLineNo">259</span> result = cell;<a name="line.259"></a> +<span class="sourceLineNo">260</span> break;<a name="line.260"></a> +<span class="sourceLineNo">261</span> }<a name="line.261"></a> +<span class="sourceLineNo">262</span> return result;<a name="line.262"></a> +<span class="sourceLineNo">263</span> }<a name="line.263"></a> +<span class="sourceLineNo">264</span><a name="line.264"></a> +<span class="sourceLineNo">265</span> /**<a name="line.265"></a> +<span class="sourceLineNo">266</span> * If the segment has a memory allocator the cell is being cloned to this space, and returned;<a name="line.266"></a> +<span class="sourceLineNo">267</span> * Otherwise the given cell is returned<a name="line.267"></a> +<span class="sourceLineNo">268</span> *<a name="line.268"></a> +<span class="sourceLineNo">269</span> * When a cell's size is too big (bigger than maxAlloc), it is not allocated on MSLAB.<a name="line.269"></a> +<span class="sourceLineNo">270</span> * Since the process of flattening to CellChunkMap assumes that all cells are allocated on MSLAB,<a name="line.270"></a> +<span class="sourceLineNo">271</span> * during this process, the input parameter forceCloneOfBigCell is set to 'true'<a name="line.271"></a> +<span class="sourceLineNo">272</span> * and the cell is copied into MSLAB.<a name="line.272"></a> +<span class="sourceLineNo">273</span> *<a name="line.273"></a> +<span class="sourceLineNo">274</span> * @param cell the cell to clone<a name="line.274"></a> +<span class="sourceLineNo">275</span> * @param forceCloneOfBigCell true only during the process of flattening to CellChunkMap.<a name="line.275"></a> +<span class="sourceLineNo">276</span> * @return either the given cell or its clone<a name="line.276"></a> +<span class="sourceLineNo">277</span> */<a name="line.277"></a> +<span class="sourceLineNo">278</span> private Cell maybeCloneWithAllocator(Cell cell, boolean forceCloneOfBigCell) {<a name="line.278"></a> +<span class="sourceLineNo">279</span> return active.maybeCloneWithAllocator(cell, forceCloneOfBigCell);<a name="line.279"></a> +<span class="sourceLineNo">280</span> }<a name="line.280"></a> +<span class="sourceLineNo">281</span><a name="line.281"></a> +<span class="sourceLineNo">282</span> /*<a name="line.282"></a> +<span class="sourceLineNo">283</span> * Internal version of add() that doesn't clone Cells with the<a name="line.283"></a> +<span class="sourceLineNo">284</span> * allocator, and doesn't take the lock.<a name="line.284"></a> +<span class="sourceLineNo">285</span> *<a name="line.285"></a> +<span class="sourceLineNo">286</span> * Callers should ensure they already have the read lock taken<a name="line.286"></a> +<span class="sourceLineNo">287</span> * @param toAdd the cell to add<a name="line.287"></a> +<span class="sourceLineNo">288</span> * @param mslabUsed whether using MSLAB<a name="line.288"></a> +<span class="sourceLineNo">289</span> * @param memstoreSize<a name="line.289"></a> +<span class="sourceLineNo">290</span> */<a name="line.290"></a> +<span class="sourceLineNo">291</span> private void internalAdd(final Cell toAdd, final boolean mslabUsed, MemStoreSizing memstoreSizing) {<a name="line.291"></a> +<span class="sourceLineNo">292</span> active.add(toAdd, mslabUsed, memstoreSizing);<a name="line.292"></a> +<span class="sourceLineNo">293</span> setOldestEditTimeToNow();<a name="line.293"></a> +<span class="sourceLineNo">294</span> checkActiveSize();<a name="line.294"></a> +<span class="sourceLineNo">295</span> }<a name="line.295"></a> +<span class="sourceLineNo">296</span><a name="line.296"></a> +<span class="sourceLineNo">297</span> private void setOldestEditTimeToNow() {<a name="line.297"></a> +<span class="sourceLineNo">298</span> if (timeOfOldestEdit == Long.MAX_VALUE) {<a name="line.298"></a> +<span class="sourceLineNo">299</span> timeOfOldestEdit = EnvironmentEdgeManager.currentTime();<a name="line.299"></a> +<span class="sourceLineNo">300</span> }<a name="line.300"></a> <span class="sourceLineNo">301</span> }<a name="line.301"></a> <span class="sourceLineNo">302</span><a name="line.302"></a> -<span class="sourceLineNo">303</span> private void setOldestEditTimeToNow() {<a name="line.303"></a> -<span class="sourceLineNo">304</span> if (timeOfOldestEdit == Long.MAX_VALUE) {<a name="line.304"></a> -<span class="sourceLineNo">305</span> timeOfOldestEdit = EnvironmentEdgeManager.currentTime();<a name="line.305"></a> -<span class="sourceLineNo">306</span> }<a name="line.306"></a> -<span class="sourceLineNo">307</span> }<a name="line.307"></a> -<span class="sourceLineNo">308</span><a name="line.308"></a> -<span class="sourceLineNo">309</span> /**<a name="line.309"></a> -<span class="sourceLineNo">310</span> * @return The total size of cells in this memstore. We will not consider cells in the snapshot<a name="line.310"></a> +<span class="sourceLineNo">303</span> /**<a name="line.303"></a> +<span class="sourceLineNo">304</span> * @return The total size of cells in this memstore. We will not consider cells in the snapshot<a name="line.304"></a> +<span class="sourceLineNo">305</span> */<a name="line.305"></a> +<span class="sourceLineNo">306</span> protected abstract long keySize();<a name="line.306"></a> +<span class="sourceLineNo">307</span><a name="line.307"></a> +<span class="sourceLineNo">308</span> /**<a name="line.308"></a> +<span class="sourceLineNo">309</span> * @return The total heap size of cells in this memstore. We will not consider cells in the<a name="line.309"></a> +<span class="sourceLineNo">310</span> * snapshot<a name="line.310"></a> <span class="sourceLineNo">311</span> */<a name="line.311"></a> -<span class="sourceLineNo">312</span> protected abstract long keySize();<a name="line.312"></a> +<span class="sourceLineNo">312</span> protected abstract long heapSize();<a name="line.312"></a> <span class="sourceLineNo">313</span><a name="line.313"></a> -<span class="sourceLineNo">314</span> /**<a name="line.314"></a> -<span class="sourceLineNo">315</span> * @return The total heap size of cells in this memstore. We will not consider cells in the<a name="line.315"></a> -<span class="sourceLineNo">316</span> * snapshot<a name="line.316"></a> -<span class="sourceLineNo">317</span> */<a name="line.317"></a> -<span class="sourceLineNo">318</span> protected abstract long heapSize();<a name="line.318"></a> -<span class="sourceLineNo">319</span><a name="line.319"></a> -<span class="sourceLineNo">320</span> protected CellComparator getComparator() {<a name="line.320"></a> -<span class="sourceLineNo">321</span> return comparator;<a name="line.321"></a> -<span class="sourceLineNo">322</span> }<a name="line.322"></a> -<span class="sourceLineNo">323</span><a name="line.323"></a> -<span class="sourceLineNo">324</span> @VisibleForTesting<a name="line.324"></a> -<span class="sourceLineNo">325</span> MutableSegment getActive() {<a name="line.325"></a> -<span class="sourceLineNo">326</span> return active;<a name="line.326"></a> -<span class="sourceLineNo">327</span> }<a name="line.327"></a> -<span class="sourceLineNo">328</span><a name="line.328"></a> -<span class="sourceLineNo">329</span> @VisibleForTesting<a name="line.329"></a> -<span class="sourceLineNo">330</span> ImmutableSegment getSnapshot() {<a name="line.330"></a> -<span class="sourceLineNo">331</span> return snapshot;<a name="line.331"></a> -<span class="sourceLineNo">332</span> }<a name="line.332"></a> -<span class="sourceLineNo">333</span><a name="line.333"></a> -<span class="sourceLineNo">334</span> /**<a name="line.334"></a> -<span class="sourceLineNo">335</span> * Check whether anything need to be done based on the current active set size<a name="line.335"></a> -<span class="sourceLineNo">336</span> */<a name="line.336"></a> -<span class="sourceLineNo">337</span> protected abstract void checkActiveSize();<a name="line.337"></a> -<span class="sourceLineNo">338</span><a name="line.338"></a> -<span class="sourceLineNo">339</span> /**<a name="line.339"></a> -<span class="sourceLineNo">340</span> * @return an ordered list of segments from most recent to oldest in memstore<a name="line.340"></a> -<span class="sourceLineNo">341</span> */<a name="line.341"></a> -<span class="sourceLineNo">342</span> protected abstract List<Segment> getSegments() throws IOException;<a name="line.342"></a> -<span class="sourceLineNo">343</span><a name="line.343"></a> -<span class="sourceLineNo">344</span>}<a name="line.344"></a> +<span class="sourceLineNo">314</span> protected CellComparator getComparator() {<a name="line.314"></a> +<span class="sourceLineNo">315</span> return comparator;<a name="line.315"></a> +<span class="sourceLineNo">316</span> }<a name="line.316"></a> +<span class="sourceLineNo">317</span><a name="line.317"></a> +<span class="sourceLineNo">318</span> @VisibleForTesting<a name="line.318"></a> +<span class="sourceLineNo">319</span> MutableSegment getActive() {<a name="line.319"></a> +<span class="sourceLineNo">320</span> return active;<a name="line.320"></a> +<span class="sourceLineNo">321</span> }<a name="line.321"></a> +<span class="sourceLineNo">322</span><a name="line.322"></a> +<span class="sourceLineNo">323</span> @VisibleForTesting<a name="line.323"></a> +<span class="sourceLineNo">324</span> ImmutableSegment getSnapshot() {<a name="line.324"></a> +<span class="sourceLineNo">325</span> return snapshot;<a name="line.325"></a> +<span class="sourceLineNo">326</span> }<a name="line.326"></a> +<span class="sourceLineNo">327</span><a name="line.327"></a> +<span class="sourceLineNo">328</span> /**<a name="line.328"></a> +<span class="sourceLineNo">329</span> * Check whether anything need to be done based on the current active set size<a name="line.329"></a> +<span class="sourceLineNo">330</span> */<a name="line.330"></a> +<span class="sourceLineNo">331</span> protected abstract void checkActiveSize();<a name="line.331"></a> +<span class="sourceLineNo">332</span><a name="line.332"></a> +<span class="sourceLineNo">333</span> /**<a name="line.333"></a> +<span class="sourceLineNo">334</span> * @return an ordered list of segments from most recent to oldest in memstore<a name="line.334"></a> +<span class="sourceLineNo">335</span> */<a name="line.335"></a> +<span class="sourceLineNo">336</span> protected abstract List<Segment> getSegments() throws IOException;<a name="line.336"></a> +<span class="sourceLineNo">337</span><a name="line.337"></a> +<span class="sourceLineNo">338</span>}<a name="line.338"></a>
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/92a26cfb/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CSLMImmutableSegment.html ---------------------------------------------------------------------- diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CSLMImmutableSegment.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CSLMImmutableSegment.html index 35c5095..92937db 100644 --- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CSLMImmutableSegment.html +++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CSLMImmutableSegment.html @@ -48,7 +48,7 @@ <span class="sourceLineNo">040</span> super(segment);<a name="line.40"></a> <span class="sourceLineNo">041</span> // update the segment metadata heap size<a name="line.41"></a> <span class="sourceLineNo">042</span> long indexOverhead = -MutableSegment.DEEP_OVERHEAD + DEEP_OVERHEAD_CSLM;<a name="line.42"></a> -<span class="sourceLineNo">043</span> incSize(0, indexOverhead, 0); // CSLM is always on-heap<a name="line.43"></a> +<span class="sourceLineNo">043</span> incMemStoreSize(0, indexOverhead, 0); // CSLM is always on-heap<a name="line.43"></a> <span class="sourceLineNo">044</span> }<a name="line.44"></a> <span class="sourceLineNo">045</span><a name="line.45"></a> <span class="sourceLineNo">046</span> @Override<a name="line.46"></a> http://git-wip-us.apache.org/repos/asf/hbase-site/blob/92a26cfb/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CellArrayImmutableSegment.html ---------------------------------------------------------------------- diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CellArrayImmutableSegment.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CellArrayImmutableSegment.html index 1bfa25d..bb359ce 100644 --- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CellArrayImmutableSegment.html +++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CellArrayImmutableSegment.html @@ -53,7 +53,7 @@ <span class="sourceLineNo">045</span> protected CellArrayImmutableSegment(CellComparator comparator, MemStoreSegmentsIterator iterator,<a name="line.45"></a> <span class="sourceLineNo">046</span> MemStoreLAB memStoreLAB, int numOfCells, MemStoreCompactionStrategy.Action action) {<a name="line.46"></a> <span class="sourceLineNo">047</span> super(null, comparator, memStoreLAB); // initiailize the CellSet with NULL<a name="line.47"></a> -<span class="sourceLineNo">048</span> incSize(0, DEEP_OVERHEAD_CAM, 0); // CAM is always on-heap<a name="line.48"></a> +<span class="sourceLineNo">048</span> incMemStoreSize(0, DEEP_OVERHEAD_CAM, 0); // CAM is always on-heap<a name="line.48"></a> <span class="sourceLineNo">049</span> // build the new CellSet based on CellArrayMap and update the CellSet of the new Segment<a name="line.49"></a> <span class="sourceLineNo">050</span> initializeCellSet(numOfCells, iterator, action);<a name="line.50"></a> <span class="sourceLineNo">051</span> }<a name="line.51"></a> @@ -67,7 +67,7 @@ <span class="sourceLineNo">059</span> MemStoreCompactionStrategy.Action action) {<a name="line.59"></a> <span class="sourceLineNo">060</span> super(segment); // initiailize the upper class<a name="line.60"></a> <span class="sourceLineNo">061</span> long indexOverhead = DEEP_OVERHEAD_CAM - CSLMImmutableSegment.DEEP_OVERHEAD_CSLM;<a name="line.61"></a> -<span class="sourceLineNo">062</span> incSize(0, indexOverhead, 0); // CAM is always on-heap<a name="line.62"></a> +<span class="sourceLineNo">062</span> incMemStoreSize(0, indexOverhead, 0); // CAM is always on-heap<a name="line.62"></a> <span class="sourceLineNo">063</span> int numOfCells = segment.getCellsCount();<a name="line.63"></a> <span class="sourceLineNo">064</span> // build the new CellSet based on CellChunkMap and update the CellSet of this Segment<a name="line.64"></a> <span class="sourceLineNo">065</span> reinitializeCellSet(numOfCells, segment.getScanner(Long.MAX_VALUE), segment.getCellSet(),<a name="line.65"></a> @@ -75,7 +75,7 @@ <span class="sourceLineNo">067</span> // arrange the meta-data size, decrease all meta-data sizes related to SkipList;<a name="line.67"></a> <span class="sourceLineNo">068</span> // add sizes of CellArrayMap entry (reinitializeCellSet doesn't take the care for the sizes)<a name="line.68"></a> <span class="sourceLineNo">069</span> long newSegmentSizeDelta = numOfCells*(indexEntrySize()-ClassSize.CONCURRENT_SKIPLISTMAP_ENTRY);<a name="line.69"></a> -<span class="sourceLineNo">070</span> incSize(0, newSegmentSizeDelta, 0);<a name="line.70"></a> +<span class="sourceLineNo">070</span> incMemStoreSize(0, newSegmentSizeDelta, 0);<a name="line.70"></a> <span class="sourceLineNo">071</span> memstoreSizing.incMemStoreSize(0, newSegmentSizeDelta, 0);<a name="line.71"></a> <span class="sourceLineNo">072</span> }<a name="line.72"></a> <span class="sourceLineNo">073</span><a name="line.73"></a> http://git-wip-us.apache.org/repos/asf/hbase-site/blob/92a26cfb/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CellChunkImmutableSegment.html ---------------------------------------------------------------------- diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CellChunkImmutableSegment.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CellChunkImmutableSegment.html index a1eb5c3..3660875 100644 --- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CellChunkImmutableSegment.html +++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/CellChunkImmutableSegment.html @@ -66,9 +66,9 @@ <span class="sourceLineNo">058</span> boolean onHeap = getMemStoreLAB().isOnHeap();<a name="line.58"></a> <span class="sourceLineNo">059</span> // initiate the heapSize with the size of the segment metadata<a name="line.59"></a> <span class="sourceLineNo">060</span> if(onHeap) {<a name="line.60"></a> -<span class="sourceLineNo">061</span> incSize(0, indexOverhead, 0);<a name="line.61"></a> +<span class="sourceLineNo">061</span> incMemStoreSize(0, indexOverhead, 0);<a name="line.61"></a> <span class="sourceLineNo">062</span> } else {<a name="line.62"></a> -<span class="sourceLineNo">063</span> incSize(0, 0, indexOverhead);<a name="line.63"></a> +<span class="sourceLineNo">063</span> incMemStoreSize(0, 0, indexOverhead);<a name="line.63"></a> <span class="sourceLineNo">064</span> }<a name="line.64"></a> <span class="sourceLineNo">065</span> // build the new CellSet based on CellArrayMap and update the CellSet of the new Segment<a name="line.65"></a> <span class="sourceLineNo">066</span> initializeCellSet(numOfCells, iterator, action);<a name="line.66"></a> @@ -87,9 +87,9 @@ <span class="sourceLineNo">079</span> boolean onHeap = getMemStoreLAB().isOnHeap();<a name="line.79"></a> <span class="sourceLineNo">080</span> // initiate the heapSize with the size of the segment metadata<a name="line.80"></a> <span class="sourceLineNo">081</span> if(onHeap) {<a name="line.81"></a> -<span class="sourceLineNo">082</span> incSize(0, indexOverhead, 0);<a name="line.82"></a> +<span class="sourceLineNo">082</span> incMemStoreSize(0, indexOverhead, 0);<a name="line.82"></a> <span class="sourceLineNo">083</span> } else {<a name="line.83"></a> -<span class="sourceLineNo">084</span> incSize(0, -CSLMImmutableSegment.DEEP_OVERHEAD_CSLM, DEEP_OVERHEAD_CCM);<a name="line.84"></a> +<span class="sourceLineNo">084</span> incMemStoreSize(0, -CSLMImmutableSegment.DEEP_OVERHEAD_CSLM, DEEP_OVERHEAD_CCM);<a name="line.84"></a> <span class="sourceLineNo">085</span> }<a name="line.85"></a> <span class="sourceLineNo">086</span> int numOfCells = segment.getCellsCount();<a name="line.86"></a> <span class="sourceLineNo">087</span> // build the new CellSet based on CellChunkMap<a name="line.87"></a> @@ -100,10 +100,10 @@ <span class="sourceLineNo">092</span> // (reinitializeCellSet doesn't take the care for the sizes)<a name="line.92"></a> <span class="sourceLineNo">093</span> long newSegmentSizeDelta = numOfCells*(indexEntrySize()-ClassSize.CONCURRENT_SKIPLISTMAP_ENTRY);<a name="line.93"></a> <span class="sourceLineNo">094</span> if(onHeap) {<a name="line.94"></a> -<span class="sourceLineNo">095</span> incSize(0, newSegmentSizeDelta, 0);<a name="line.95"></a> +<span class="sourceLineNo">095</span> incMemStoreSize(0, newSegmentSizeDelta, 0);<a name="line.95"></a> <span class="sourceLineNo">096</span> memstoreSizing.incMemStoreSize(0, newSegmentSizeDelta, 0);<a name="line.96"></a> <span class="sourceLineNo">097</span> } else {<a name="line.97"></a> -<span class="sourceLineNo">098</span> incSize(0, 0, newSegmentSizeDelta);<a name="line.98"></a> +<span class="sourceLineNo">098</span> incMemStoreSize(0, 0, newSegmentSizeDelta);<a name="line.98"></a> <span class="sourceLineNo">099</span> memstoreSizing.incMemStoreSize(0, 0, newSegmentSizeDelta);<a name="line.99"></a> <span class="sourceLineNo">100</span><a name="line.100"></a> <span class="sourceLineNo">101</span> }<a name="line.101"></a> @@ -341,7 +341,7 @@ <span class="sourceLineNo">333</span> long heapOverhead = newHeapSize - oldHeapSize;<a name="line.333"></a> <span class="sourceLineNo">334</span> long offHeapOverhead = newOffHeapSize - oldOffHeapSize;<a name="line.334"></a> <span class="sourceLineNo">335</span> //TODO: maybe need to update the dataSize of the region<a name="line.335"></a> -<span class="sourceLineNo">336</span> incSize(newCellSize - oldCellSize, heapOverhead, offHeapOverhead);<a name="line.336"></a> +<span class="sourceLineNo">336</span> incMemStoreSize(newCellSize - oldCellSize, heapOverhead, offHeapOverhead);<a name="line.336"></a> <span class="sourceLineNo">337</span> return cell;<a name="line.337"></a> <span class="sourceLineNo">338</span> }<a name="line.338"></a> <span class="sourceLineNo">339</span>}<a name="line.339"></a>