hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject [32/51] [partial] hbase git commit: Published site at e73a9594c218ed969a2f5b0b356d7b8d0e1474c0.
Date Thu, 26 Nov 2015 04:29:57 GMT
http://git-wip-us.apache.org/repos/asf/hbase/blob/a986dfe6/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegion.FlushResultImpl.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegion.FlushResultImpl.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegion.FlushResultImpl.html
index 88901b0..fe65cea 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegion.FlushResultImpl.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/HRegion.FlushResultImpl.html
@@ -2982,5132 +2982,5131 @@
 <span class="sourceLineNo">2974</span>        }<a name="line.2974"></a>
 <span class="sourceLineNo">2975</span>        if (rowLock == null) {<a name="line.2975"></a>
 <span class="sourceLineNo">2976</span>          // We failed to grab another lock<a name="line.2976"></a>
-<span class="sourceLineNo">2977</span>          assert false: "Should never fail to get lock when blocking";<a name="line.2977"></a>
-<span class="sourceLineNo">2978</span>          break; // stop acquiring more rows for this batch<a name="line.2978"></a>
-<span class="sourceLineNo">2979</span>        } else {<a name="line.2979"></a>
-<span class="sourceLineNo">2980</span>          acquiredRowLocks.add(rowLock);<a name="line.2980"></a>
-<span class="sourceLineNo">2981</span>        }<a name="line.2981"></a>
-<span class="sourceLineNo">2982</span><a name="line.2982"></a>
-<span class="sourceLineNo">2983</span>        lastIndexExclusive++;<a name="line.2983"></a>
-<span class="sourceLineNo">2984</span>        numReadyToWrite++;<a name="line.2984"></a>
-<span class="sourceLineNo">2985</span><a name="line.2985"></a>
-<span class="sourceLineNo">2986</span>        if (isPutMutation) {<a name="line.2986"></a>
-<span class="sourceLineNo">2987</span>          // If Column Families stay consistent through out all of the<a name="line.2987"></a>
-<span class="sourceLineNo">2988</span>          // individual puts then metrics can be reported as a mutliput across<a name="line.2988"></a>
-<span class="sourceLineNo">2989</span>          // column families in the first put.<a name="line.2989"></a>
-<span class="sourceLineNo">2990</span>          if (putsCfSet == null) {<a name="line.2990"></a>
-<span class="sourceLineNo">2991</span>            putsCfSet = mutation.getFamilyCellMap().keySet();<a name="line.2991"></a>
-<span class="sourceLineNo">2992</span>          } else {<a name="line.2992"></a>
-<span class="sourceLineNo">2993</span>            putsCfSetConsistent = putsCfSetConsistent<a name="line.2993"></a>
-<span class="sourceLineNo">2994</span>                &amp;&amp; mutation.getFamilyCellMap().keySet().equals(putsCfSet);<a name="line.2994"></a>
-<span class="sourceLineNo">2995</span>          }<a name="line.2995"></a>
-<span class="sourceLineNo">2996</span>        } else {<a name="line.2996"></a>
-<span class="sourceLineNo">2997</span>          if (deletesCfSet == null) {<a name="line.2997"></a>
-<span class="sourceLineNo">2998</span>            deletesCfSet = mutation.getFamilyCellMap().keySet();<a name="line.2998"></a>
-<span class="sourceLineNo">2999</span>          } else {<a name="line.2999"></a>
-<span class="sourceLineNo">3000</span>            deletesCfSetConsistent = deletesCfSetConsistent<a name="line.3000"></a>
-<span class="sourceLineNo">3001</span>                &amp;&amp; mutation.getFamilyCellMap().keySet().equals(deletesCfSet);<a name="line.3001"></a>
-<span class="sourceLineNo">3002</span>          }<a name="line.3002"></a>
-<span class="sourceLineNo">3003</span>        }<a name="line.3003"></a>
-<span class="sourceLineNo">3004</span>      }<a name="line.3004"></a>
-<span class="sourceLineNo">3005</span><a name="line.3005"></a>
-<span class="sourceLineNo">3006</span>      // we should record the timestamp only after we have acquired the rowLock,<a name="line.3006"></a>
-<span class="sourceLineNo">3007</span>      // otherwise, newer puts/deletes are not guaranteed to have a newer timestamp<a name="line.3007"></a>
-<span class="sourceLineNo">3008</span>      now = EnvironmentEdgeManager.currentTime();<a name="line.3008"></a>
-<span class="sourceLineNo">3009</span>      byte[] byteNow = Bytes.toBytes(now);<a name="line.3009"></a>
-<span class="sourceLineNo">3010</span><a name="line.3010"></a>
-<span class="sourceLineNo">3011</span>      // Nothing to put/delete -- an exception in the above such as NoSuchColumnFamily?<a name="line.3011"></a>
-<span class="sourceLineNo">3012</span>      if (numReadyToWrite &lt;= 0) return 0L;<a name="line.3012"></a>
-<span class="sourceLineNo">3013</span><a name="line.3013"></a>
-<span class="sourceLineNo">3014</span>      // We've now grabbed as many mutations off the list as we can<a name="line.3014"></a>
-<span class="sourceLineNo">3015</span><a name="line.3015"></a>
-<span class="sourceLineNo">3016</span>      // ------------------------------------<a name="line.3016"></a>
-<span class="sourceLineNo">3017</span>      // STEP 2. Update any LATEST_TIMESTAMP timestamps<a name="line.3017"></a>
-<span class="sourceLineNo">3018</span>      // ----------------------------------<a name="line.3018"></a>
-<span class="sourceLineNo">3019</span>      for (int i = firstIndex; !isInReplay &amp;&amp; i &lt; lastIndexExclusive; i++) {<a name="line.3019"></a>
-<span class="sourceLineNo">3020</span>        // skip invalid<a name="line.3020"></a>
-<span class="sourceLineNo">3021</span>        if (batchOp.retCodeDetails[i].getOperationStatusCode()<a name="line.3021"></a>
-<span class="sourceLineNo">3022</span>            != OperationStatusCode.NOT_RUN) continue;<a name="line.3022"></a>
-<span class="sourceLineNo">3023</span><a name="line.3023"></a>
-<span class="sourceLineNo">3024</span>        Mutation mutation = batchOp.getMutation(i);<a name="line.3024"></a>
-<span class="sourceLineNo">3025</span>        if (mutation instanceof Put) {<a name="line.3025"></a>
-<span class="sourceLineNo">3026</span>          updateCellTimestamps(familyMaps[i].values(), byteNow);<a name="line.3026"></a>
-<span class="sourceLineNo">3027</span>          noOfPuts++;<a name="line.3027"></a>
-<span class="sourceLineNo">3028</span>        } else {<a name="line.3028"></a>
-<span class="sourceLineNo">3029</span>          prepareDeleteTimestamps(mutation, familyMaps[i], byteNow);<a name="line.3029"></a>
-<span class="sourceLineNo">3030</span>          noOfDeletes++;<a name="line.3030"></a>
-<span class="sourceLineNo">3031</span>        }<a name="line.3031"></a>
-<span class="sourceLineNo">3032</span>        rewriteCellTags(familyMaps[i], mutation);<a name="line.3032"></a>
-<span class="sourceLineNo">3033</span>      }<a name="line.3033"></a>
-<span class="sourceLineNo">3034</span><a name="line.3034"></a>
-<span class="sourceLineNo">3035</span>      lock(this.updatesLock.readLock(), numReadyToWrite);<a name="line.3035"></a>
-<span class="sourceLineNo">3036</span>      locked = true;<a name="line.3036"></a>
-<span class="sourceLineNo">3037</span><a name="line.3037"></a>
-<span class="sourceLineNo">3038</span>      // calling the pre CP hook for batch mutation<a name="line.3038"></a>
-<span class="sourceLineNo">3039</span>      if (!isInReplay &amp;&amp; coprocessorHost != null) {<a name="line.3039"></a>
-<span class="sourceLineNo">3040</span>        MiniBatchOperationInProgress&lt;Mutation&gt; miniBatchOp =<a name="line.3040"></a>
-<span class="sourceLineNo">3041</span>          new MiniBatchOperationInProgress&lt;Mutation&gt;(batchOp.getMutationsForCoprocs(),<a name="line.3041"></a>
-<span class="sourceLineNo">3042</span>          batchOp.retCodeDetails, batchOp.walEditsFromCoprocessors, firstIndex, lastIndexExclusive);<a name="line.3042"></a>
-<span class="sourceLineNo">3043</span>        if (coprocessorHost.preBatchMutate(miniBatchOp)) return 0L;<a name="line.3043"></a>
-<span class="sourceLineNo">3044</span>      }<a name="line.3044"></a>
-<span class="sourceLineNo">3045</span><a name="line.3045"></a>
-<span class="sourceLineNo">3046</span>      // ------------------------------------<a name="line.3046"></a>
-<span class="sourceLineNo">3047</span>      // STEP 3. Build WAL edit<a name="line.3047"></a>
-<span class="sourceLineNo">3048</span>      // ----------------------------------<a name="line.3048"></a>
-<span class="sourceLineNo">3049</span>      Durability durability = Durability.USE_DEFAULT;<a name="line.3049"></a>
-<span class="sourceLineNo">3050</span>      for (int i = firstIndex; i &lt; lastIndexExclusive; i++) {<a name="line.3050"></a>
-<span class="sourceLineNo">3051</span>        // Skip puts that were determined to be invalid during preprocessing<a name="line.3051"></a>
-<span class="sourceLineNo">3052</span>        if (batchOp.retCodeDetails[i].getOperationStatusCode() != OperationStatusCode.NOT_RUN) {<a name="line.3052"></a>
-<span class="sourceLineNo">3053</span>          continue;<a name="line.3053"></a>
-<span class="sourceLineNo">3054</span>        }<a name="line.3054"></a>
-<span class="sourceLineNo">3055</span><a name="line.3055"></a>
-<span class="sourceLineNo">3056</span>        Mutation m = batchOp.getMutation(i);<a name="line.3056"></a>
-<span class="sourceLineNo">3057</span>        Durability tmpDur = getEffectiveDurability(m.getDurability());<a name="line.3057"></a>
-<span class="sourceLineNo">3058</span>        if (tmpDur.ordinal() &gt; durability.ordinal()) {<a name="line.3058"></a>
-<span class="sourceLineNo">3059</span>          durability = tmpDur;<a name="line.3059"></a>
-<span class="sourceLineNo">3060</span>        }<a name="line.3060"></a>
-<span class="sourceLineNo">3061</span>        if (tmpDur == Durability.SKIP_WAL) {<a name="line.3061"></a>
-<span class="sourceLineNo">3062</span>          recordMutationWithoutWal(m.getFamilyCellMap());<a name="line.3062"></a>
-<span class="sourceLineNo">3063</span>          continue;<a name="line.3063"></a>
-<span class="sourceLineNo">3064</span>        }<a name="line.3064"></a>
-<span class="sourceLineNo">3065</span><a name="line.3065"></a>
-<span class="sourceLineNo">3066</span>        long nonceGroup = batchOp.getNonceGroup(i), nonce = batchOp.getNonce(i);<a name="line.3066"></a>
-<span class="sourceLineNo">3067</span>        // In replay, the batch may contain multiple nonces. If so, write WALEdit for each.<a name="line.3067"></a>
-<span class="sourceLineNo">3068</span>        // Given how nonces are originally written, these should be contiguous.<a name="line.3068"></a>
-<span class="sourceLineNo">3069</span>        // They don't have to be, it will still work, just write more WALEdits than needed.<a name="line.3069"></a>
-<span class="sourceLineNo">3070</span>        if (nonceGroup != currentNonceGroup || nonce != currentNonce) {<a name="line.3070"></a>
-<span class="sourceLineNo">3071</span>          if (walEdit.size() &gt; 0) {<a name="line.3071"></a>
-<span class="sourceLineNo">3072</span>            assert isInReplay;<a name="line.3072"></a>
-<span class="sourceLineNo">3073</span>            if (!isInReplay) {<a name="line.3073"></a>
-<span class="sourceLineNo">3074</span>              throw new IOException("Multiple nonces per batch and not in replay");<a name="line.3074"></a>
-<span class="sourceLineNo">3075</span>            }<a name="line.3075"></a>
-<span class="sourceLineNo">3076</span>            // txid should always increase, so having the one from the last call is ok.<a name="line.3076"></a>
-<span class="sourceLineNo">3077</span>            // we use HLogKey here instead of WALKey directly to support legacy coprocessors.<a name="line.3077"></a>
-<span class="sourceLineNo">3078</span>            walKey = new ReplayHLogKey(this.getRegionInfo().getEncodedNameAsBytes(),<a name="line.3078"></a>
-<span class="sourceLineNo">3079</span>              this.htableDescriptor.getTableName(), now, m.getClusterIds(),<a name="line.3079"></a>
-<span class="sourceLineNo">3080</span>              currentNonceGroup, currentNonce, mvcc);<a name="line.3080"></a>
-<span class="sourceLineNo">3081</span>            txid = this.wal.append(this.htableDescriptor,  this.getRegionInfo(),  walKey,<a name="line.3081"></a>
-<span class="sourceLineNo">3082</span>              walEdit, true);<a name="line.3082"></a>
-<span class="sourceLineNo">3083</span>            walEdit = new WALEdit(isInReplay);<a name="line.3083"></a>
-<span class="sourceLineNo">3084</span>            walKey = null;<a name="line.3084"></a>
-<span class="sourceLineNo">3085</span>          }<a name="line.3085"></a>
-<span class="sourceLineNo">3086</span>          currentNonceGroup = nonceGroup;<a name="line.3086"></a>
-<span class="sourceLineNo">3087</span>          currentNonce = nonce;<a name="line.3087"></a>
-<span class="sourceLineNo">3088</span>        }<a name="line.3088"></a>
-<span class="sourceLineNo">3089</span><a name="line.3089"></a>
-<span class="sourceLineNo">3090</span>        // Add WAL edits by CP<a name="line.3090"></a>
-<span class="sourceLineNo">3091</span>        WALEdit fromCP = batchOp.walEditsFromCoprocessors[i];<a name="line.3091"></a>
-<span class="sourceLineNo">3092</span>        if (fromCP != null) {<a name="line.3092"></a>
-<span class="sourceLineNo">3093</span>          for (Cell cell : fromCP.getCells()) {<a name="line.3093"></a>
-<span class="sourceLineNo">3094</span>            walEdit.add(cell);<a name="line.3094"></a>
-<span class="sourceLineNo">3095</span>          }<a name="line.3095"></a>
-<span class="sourceLineNo">3096</span>        }<a name="line.3096"></a>
-<span class="sourceLineNo">3097</span>        addFamilyMapToWALEdit(familyMaps[i], walEdit);<a name="line.3097"></a>
-<span class="sourceLineNo">3098</span>      }<a name="line.3098"></a>
-<span class="sourceLineNo">3099</span><a name="line.3099"></a>
-<span class="sourceLineNo">3100</span>      // -------------------------<a name="line.3100"></a>
-<span class="sourceLineNo">3101</span>      // STEP 4. Append the final edit to WAL. Do not sync wal.<a name="line.3101"></a>
-<span class="sourceLineNo">3102</span>      // -------------------------<a name="line.3102"></a>
-<span class="sourceLineNo">3103</span>      Mutation mutation = batchOp.getMutation(firstIndex);<a name="line.3103"></a>
-<span class="sourceLineNo">3104</span>      if (isInReplay) {<a name="line.3104"></a>
-<span class="sourceLineNo">3105</span>        // use wal key from the original<a name="line.3105"></a>
-<span class="sourceLineNo">3106</span>        walKey = new ReplayHLogKey(this.getRegionInfo().getEncodedNameAsBytes(),<a name="line.3106"></a>
-<span class="sourceLineNo">3107</span>          this.htableDescriptor.getTableName(), WALKey.NO_SEQUENCE_ID, now,<a name="line.3107"></a>
-<span class="sourceLineNo">3108</span>          mutation.getClusterIds(), currentNonceGroup, currentNonce, mvcc);<a name="line.3108"></a>
-<span class="sourceLineNo">3109</span>        long replaySeqId = batchOp.getReplaySequenceId();<a name="line.3109"></a>
-<span class="sourceLineNo">3110</span>        walKey.setOrigLogSeqNum(replaySeqId);<a name="line.3110"></a>
-<span class="sourceLineNo">3111</span>      }<a name="line.3111"></a>
-<span class="sourceLineNo">3112</span>      if (walEdit.size() &gt; 0) {<a name="line.3112"></a>
-<span class="sourceLineNo">3113</span>        if (!isInReplay) {<a name="line.3113"></a>
-<span class="sourceLineNo">3114</span>        // we use HLogKey here instead of WALKey directly to support legacy coprocessors.<a name="line.3114"></a>
-<span class="sourceLineNo">3115</span>        walKey = new HLogKey(this.getRegionInfo().getEncodedNameAsBytes(),<a name="line.3115"></a>
-<span class="sourceLineNo">3116</span>            this.htableDescriptor.getTableName(), WALKey.NO_SEQUENCE_ID, now,<a name="line.3116"></a>
-<span class="sourceLineNo">3117</span>            mutation.getClusterIds(), currentNonceGroup, currentNonce, mvcc);<a name="line.3117"></a>
-<span class="sourceLineNo">3118</span>        }<a name="line.3118"></a>
-<span class="sourceLineNo">3119</span>        txid = this.wal.append(this.htableDescriptor, this.getRegionInfo(), walKey, walEdit, true);<a name="line.3119"></a>
-<span class="sourceLineNo">3120</span>      }<a name="line.3120"></a>
-<span class="sourceLineNo">3121</span>      // ------------------------------------<a name="line.3121"></a>
-<span class="sourceLineNo">3122</span>      // Acquire the latest mvcc number<a name="line.3122"></a>
-<span class="sourceLineNo">3123</span>      // ----------------------------------<a name="line.3123"></a>
-<span class="sourceLineNo">3124</span>      if (walKey == null) {<a name="line.3124"></a>
-<span class="sourceLineNo">3125</span>        // If this is a skip wal operation just get the read point from mvcc<a name="line.3125"></a>
-<span class="sourceLineNo">3126</span>        walKey = this.appendEmptyEdit(this.wal);<a name="line.3126"></a>
-<span class="sourceLineNo">3127</span>      }<a name="line.3127"></a>
-<span class="sourceLineNo">3128</span>      if (!isInReplay) {<a name="line.3128"></a>
-<span class="sourceLineNo">3129</span>        writeEntry = walKey.getWriteEntry();<a name="line.3129"></a>
-<span class="sourceLineNo">3130</span>        mvccNum = writeEntry.getWriteNumber();<a name="line.3130"></a>
-<span class="sourceLineNo">3131</span>      } else {<a name="line.3131"></a>
-<span class="sourceLineNo">3132</span>        mvccNum = batchOp.getReplaySequenceId();<a name="line.3132"></a>
-<span class="sourceLineNo">3133</span>      }<a name="line.3133"></a>
-<span class="sourceLineNo">3134</span><a name="line.3134"></a>
-<span class="sourceLineNo">3135</span>      // ------------------------------------<a name="line.3135"></a>
-<span class="sourceLineNo">3136</span>      // STEP 5. Write back to memstore<a name="line.3136"></a>
-<span class="sourceLineNo">3137</span>      // Write to memstore. It is ok to write to memstore<a name="line.3137"></a>
-<span class="sourceLineNo">3138</span>      // first without syncing the WAL because we do not roll<a name="line.3138"></a>
-<span class="sourceLineNo">3139</span>      // forward the memstore MVCC. The MVCC will be moved up when<a name="line.3139"></a>
-<span class="sourceLineNo">3140</span>      // the complete operation is done. These changes are not yet<a name="line.3140"></a>
-<span class="sourceLineNo">3141</span>      // visible to scanners till we update the MVCC. The MVCC is<a name="line.3141"></a>
-<span class="sourceLineNo">3142</span>      // moved only when the sync is complete.<a name="line.3142"></a>
-<span class="sourceLineNo">3143</span>      // ----------------------------------<a name="line.3143"></a>
-<span class="sourceLineNo">3144</span>      long addedSize = 0;<a name="line.3144"></a>
-<span class="sourceLineNo">3145</span>      for (int i = firstIndex; i &lt; lastIndexExclusive; i++) {<a name="line.3145"></a>
-<span class="sourceLineNo">3146</span>        if (batchOp.retCodeDetails[i].getOperationStatusCode()<a name="line.3146"></a>
-<span class="sourceLineNo">3147</span>            != OperationStatusCode.NOT_RUN) {<a name="line.3147"></a>
-<span class="sourceLineNo">3148</span>          continue;<a name="line.3148"></a>
-<span class="sourceLineNo">3149</span>        }<a name="line.3149"></a>
-<span class="sourceLineNo">3150</span>        doRollBackMemstore = true; // If we have a failure, we need to clean what we wrote<a name="line.3150"></a>
-<span class="sourceLineNo">3151</span>        addedSize += applyFamilyMapToMemstore(familyMaps[i], mvccNum, isInReplay);<a name="line.3151"></a>
-<span class="sourceLineNo">3152</span>      }<a name="line.3152"></a>
-<span class="sourceLineNo">3153</span><a name="line.3153"></a>
-<span class="sourceLineNo">3154</span>      // -------------------------------<a name="line.3154"></a>
-<span class="sourceLineNo">3155</span>      // STEP 6. Release row locks, etc.<a name="line.3155"></a>
-<span class="sourceLineNo">3156</span>      // -------------------------------<a name="line.3156"></a>
-<span class="sourceLineNo">3157</span>      if (locked) {<a name="line.3157"></a>
-<span class="sourceLineNo">3158</span>        this.updatesLock.readLock().unlock();<a name="line.3158"></a>
-<span class="sourceLineNo">3159</span>        locked = false;<a name="line.3159"></a>
-<span class="sourceLineNo">3160</span>      }<a name="line.3160"></a>
-<span class="sourceLineNo">3161</span>      releaseRowLocks(acquiredRowLocks);<a name="line.3161"></a>
-<span class="sourceLineNo">3162</span><a name="line.3162"></a>
-<span class="sourceLineNo">3163</span>      // -------------------------<a name="line.3163"></a>
-<span class="sourceLineNo">3164</span>      // STEP 7. Sync wal.<a name="line.3164"></a>
-<span class="sourceLineNo">3165</span>      // -------------------------<a name="line.3165"></a>
-<span class="sourceLineNo">3166</span>      if (txid != 0) {<a name="line.3166"></a>
-<span class="sourceLineNo">3167</span>        syncOrDefer(txid, durability);<a name="line.3167"></a>
-<span class="sourceLineNo">3168</span>      }<a name="line.3168"></a>
-<span class="sourceLineNo">3169</span><a name="line.3169"></a>
-<span class="sourceLineNo">3170</span>      doRollBackMemstore = false;<a name="line.3170"></a>
-<span class="sourceLineNo">3171</span>      // calling the post CP hook for batch mutation<a name="line.3171"></a>
-<span class="sourceLineNo">3172</span>      if (!isInReplay &amp;&amp; coprocessorHost != null) {<a name="line.3172"></a>
-<span class="sourceLineNo">3173</span>        MiniBatchOperationInProgress&lt;Mutation&gt; miniBatchOp =<a name="line.3173"></a>
-<span class="sourceLineNo">3174</span>          new MiniBatchOperationInProgress&lt;Mutation&gt;(batchOp.getMutationsForCoprocs(),<a name="line.3174"></a>
-<span class="sourceLineNo">3175</span>          batchOp.retCodeDetails, batchOp.walEditsFromCoprocessors, firstIndex, lastIndexExclusive);<a name="line.3175"></a>
-<span class="sourceLineNo">3176</span>        coprocessorHost.postBatchMutate(miniBatchOp);<a name="line.3176"></a>
-<span class="sourceLineNo">3177</span>      }<a name="line.3177"></a>
-<span class="sourceLineNo">3178</span><a name="line.3178"></a>
-<span class="sourceLineNo">3179</span>      // ------------------------------------------------------------------<a name="line.3179"></a>
-<span class="sourceLineNo">3180</span>      // STEP 8. Advance mvcc. This will make this put visible to scanners and getters.<a name="line.3180"></a>
-<span class="sourceLineNo">3181</span>      // ------------------------------------------------------------------<a name="line.3181"></a>
-<span class="sourceLineNo">3182</span>      if (writeEntry != null) {<a name="line.3182"></a>
-<span class="sourceLineNo">3183</span>        mvcc.completeAndWait(writeEntry);<a name="line.3183"></a>
-<span class="sourceLineNo">3184</span>        writeEntry = null;<a name="line.3184"></a>
-<span class="sourceLineNo">3185</span>      } else if (isInReplay) {<a name="line.3185"></a>
-<span class="sourceLineNo">3186</span>        // ensure that the sequence id of the region is at least as big as orig log seq id<a name="line.3186"></a>
-<span class="sourceLineNo">3187</span>        mvcc.advanceTo(mvccNum);<a name="line.3187"></a>
-<span class="sourceLineNo">3188</span>      }<a name="line.3188"></a>
-<span class="sourceLineNo">3189</span><a name="line.3189"></a>
-<span class="sourceLineNo">3190</span>      for (int i = firstIndex; i &lt; lastIndexExclusive; i ++) {<a name="line.3190"></a>
-<span class="sourceLineNo">3191</span>        if (batchOp.retCodeDetails[i] == OperationStatus.NOT_RUN) {<a name="line.3191"></a>
-<span class="sourceLineNo">3192</span>          batchOp.retCodeDetails[i] = OperationStatus.SUCCESS;<a name="line.3192"></a>
-<span class="sourceLineNo">3193</span>        }<a name="line.3193"></a>
-<span class="sourceLineNo">3194</span>      }<a name="line.3194"></a>
-<span class="sourceLineNo">3195</span><a name="line.3195"></a>
-<span class="sourceLineNo">3196</span>      // ------------------------------------<a name="line.3196"></a>
-<span class="sourceLineNo">3197</span>      // STEP 9. Run coprocessor post hooks. This should be done after the wal is<a name="line.3197"></a>
-<span class="sourceLineNo">3198</span>      // synced so that the coprocessor contract is adhered to.<a name="line.3198"></a>
-<span class="sourceLineNo">3199</span>      // ------------------------------------<a name="line.3199"></a>
-<span class="sourceLineNo">3200</span>      if (!isInReplay &amp;&amp; coprocessorHost != null) {<a name="line.3200"></a>
-<span class="sourceLineNo">3201</span>        for (int i = firstIndex; i &lt; lastIndexExclusive; i++) {<a name="line.3201"></a>
-<span class="sourceLineNo">3202</span>          // only for successful puts<a name="line.3202"></a>
-<span class="sourceLineNo">3203</span>          if (batchOp.retCodeDetails[i].getOperationStatusCode()<a name="line.3203"></a>
-<span class="sourceLineNo">3204</span>              != OperationStatusCode.SUCCESS) {<a name="line.3204"></a>
-<span class="sourceLineNo">3205</span>            continue;<a name="line.3205"></a>
-<span class="sourceLineNo">3206</span>          }<a name="line.3206"></a>
-<span class="sourceLineNo">3207</span>          Mutation m = batchOp.getMutation(i);<a name="line.3207"></a>
-<span class="sourceLineNo">3208</span>          if (m instanceof Put) {<a name="line.3208"></a>
-<span class="sourceLineNo">3209</span>            coprocessorHost.postPut((Put) m, walEdit, m.getDurability());<a name="line.3209"></a>
-<span class="sourceLineNo">3210</span>          } else {<a name="line.3210"></a>
-<span class="sourceLineNo">3211</span>            coprocessorHost.postDelete((Delete) m, walEdit, m.getDurability());<a name="line.3211"></a>
-<span class="sourceLineNo">3212</span>          }<a name="line.3212"></a>
-<span class="sourceLineNo">3213</span>        }<a name="line.3213"></a>
-<span class="sourceLineNo">3214</span>      }<a name="line.3214"></a>
-<span class="sourceLineNo">3215</span><a name="line.3215"></a>
-<span class="sourceLineNo">3216</span>      success = true;<a name="line.3216"></a>
-<span class="sourceLineNo">3217</span>      return addedSize;<a name="line.3217"></a>
-<span class="sourceLineNo">3218</span>    } finally {<a name="line.3218"></a>
-<span class="sourceLineNo">3219</span>      // if the wal sync was unsuccessful, remove keys from memstore<a name="line.3219"></a>
-<span class="sourceLineNo">3220</span>      if (doRollBackMemstore) {<a name="line.3220"></a>
-<span class="sourceLineNo">3221</span>        for (int j = 0; j &lt; familyMaps.length; j++) {<a name="line.3221"></a>
-<span class="sourceLineNo">3222</span>          for(List&lt;Cell&gt; cells:familyMaps[j].values()) {<a name="line.3222"></a>
-<span class="sourceLineNo">3223</span>            rollbackMemstore(cells);<a name="line.3223"></a>
-<span class="sourceLineNo">3224</span>          }<a name="line.3224"></a>
-<span class="sourceLineNo">3225</span>        }<a name="line.3225"></a>
-<span class="sourceLineNo">3226</span>        if (writeEntry != null) mvcc.complete(writeEntry);<a name="line.3226"></a>
-<span class="sourceLineNo">3227</span>      } else if (writeEntry != null) {<a name="line.3227"></a>
-<span class="sourceLineNo">3228</span>        mvcc.completeAndWait(writeEntry);<a name="line.3228"></a>
-<span class="sourceLineNo">3229</span>      }<a name="line.3229"></a>
-<span class="sourceLineNo">3230</span><a name="line.3230"></a>
-<span class="sourceLineNo">3231</span>      if (locked) {<a name="line.3231"></a>
-<span class="sourceLineNo">3232</span>        this.updatesLock.readLock().unlock();<a name="line.3232"></a>
-<span class="sourceLineNo">3233</span>      }<a name="line.3233"></a>
-<span class="sourceLineNo">3234</span>      releaseRowLocks(acquiredRowLocks);<a name="line.3234"></a>
-<span class="sourceLineNo">3235</span><a name="line.3235"></a>
-<span class="sourceLineNo">3236</span>      // See if the column families were consistent through the whole thing.<a name="line.3236"></a>
-<span class="sourceLineNo">3237</span>      // if they were then keep them. If they were not then pass a null.<a name="line.3237"></a>
-<span class="sourceLineNo">3238</span>      // null will be treated as unknown.<a name="line.3238"></a>
-<span class="sourceLineNo">3239</span>      // Total time taken might be involving Puts and Deletes.<a name="line.3239"></a>
-<span class="sourceLineNo">3240</span>      // Split the time for puts and deletes based on the total number of Puts and Deletes.<a name="line.3240"></a>
-<span class="sourceLineNo">3241</span><a name="line.3241"></a>
-<span class="sourceLineNo">3242</span>      if (noOfPuts &gt; 0) {<a name="line.3242"></a>
-<span class="sourceLineNo">3243</span>        // There were some Puts in the batch.<a name="line.3243"></a>
-<span class="sourceLineNo">3244</span>        if (this.metricsRegion != null) {<a name="line.3244"></a>
-<span class="sourceLineNo">3245</span>          this.metricsRegion.updatePut();<a name="line.3245"></a>
-<span class="sourceLineNo">3246</span>        }<a name="line.3246"></a>
-<span class="sourceLineNo">3247</span>      }<a name="line.3247"></a>
-<span class="sourceLineNo">3248</span>      if (noOfDeletes &gt; 0) {<a name="line.3248"></a>
-<span class="sourceLineNo">3249</span>        // There were some Deletes in the batch.<a name="line.3249"></a>
-<span class="sourceLineNo">3250</span>        if (this.metricsRegion != null) {<a name="line.3250"></a>
-<span class="sourceLineNo">3251</span>          this.metricsRegion.updateDelete();<a name="line.3251"></a>
-<span class="sourceLineNo">3252</span>        }<a name="line.3252"></a>
-<span class="sourceLineNo">3253</span>      }<a name="line.3253"></a>
-<span class="sourceLineNo">3254</span>      if (!success) {<a name="line.3254"></a>
-<span class="sourceLineNo">3255</span>        for (int i = firstIndex; i &lt; lastIndexExclusive; i++) {<a name="line.3255"></a>
-<span class="sourceLineNo">3256</span>          if (batchOp.retCodeDetails[i].getOperationStatusCode() == OperationStatusCode.NOT_RUN) {<a name="line.3256"></a>
-<span class="sourceLineNo">3257</span>            batchOp.retCodeDetails[i] = OperationStatus.FAILURE;<a name="line.3257"></a>
-<span class="sourceLineNo">3258</span>          }<a name="line.3258"></a>
-<span class="sourceLineNo">3259</span>        }<a name="line.3259"></a>
-<span class="sourceLineNo">3260</span>      }<a name="line.3260"></a>
-<span class="sourceLineNo">3261</span>      if (coprocessorHost != null &amp;&amp; !batchOp.isInReplay()) {<a name="line.3261"></a>
-<span class="sourceLineNo">3262</span>        // call the coprocessor hook to do any finalization steps<a name="line.3262"></a>
-<span class="sourceLineNo">3263</span>        // after the put is done<a name="line.3263"></a>
-<span class="sourceLineNo">3264</span>        MiniBatchOperationInProgress&lt;Mutation&gt; miniBatchOp =<a name="line.3264"></a>
-<span class="sourceLineNo">3265</span>            new MiniBatchOperationInProgress&lt;Mutation&gt;(batchOp.getMutationsForCoprocs(),<a name="line.3265"></a>
-<span class="sourceLineNo">3266</span>                batchOp.retCodeDetails, batchOp.walEditsFromCoprocessors, firstIndex,<a name="line.3266"></a>
-<span class="sourceLineNo">3267</span>                lastIndexExclusive);<a name="line.3267"></a>
-<span class="sourceLineNo">3268</span>        coprocessorHost.postBatchMutateIndispensably(miniBatchOp, success);<a name="line.3268"></a>
-<span class="sourceLineNo">3269</span>      }<a name="line.3269"></a>
-<span class="sourceLineNo">3270</span><a name="line.3270"></a>
-<span class="sourceLineNo">3271</span>      batchOp.nextIndexToProcess = lastIndexExclusive;<a name="line.3271"></a>
-<span class="sourceLineNo">3272</span>    }<a name="line.3272"></a>
-<span class="sourceLineNo">3273</span>  }<a name="line.3273"></a>
-<span class="sourceLineNo">3274</span><a name="line.3274"></a>
-<span class="sourceLineNo">3275</span>  /**<a name="line.3275"></a>
-<span class="sourceLineNo">3276</span>   * Returns effective durability from the passed durability and<a name="line.3276"></a>
-<span class="sourceLineNo">3277</span>   * the table descriptor.<a name="line.3277"></a>
-<span class="sourceLineNo">3278</span>   */<a name="line.3278"></a>
-<span class="sourceLineNo">3279</span>  protected Durability getEffectiveDurability(Durability d) {<a name="line.3279"></a>
-<span class="sourceLineNo">3280</span>    return d == Durability.USE_DEFAULT ? this.durability : d;<a name="line.3280"></a>
-<span class="sourceLineNo">3281</span>  }<a name="line.3281"></a>
-<span class="sourceLineNo">3282</span><a name="line.3282"></a>
-<span class="sourceLineNo">3283</span>  //TODO, Think that gets/puts and deletes should be refactored a bit so that<a name="line.3283"></a>
-<span class="sourceLineNo">3284</span>  //the getting of the lock happens before, so that you would just pass it into<a name="line.3284"></a>
-<span class="sourceLineNo">3285</span>  //the methods. So in the case of checkAndMutate you could just do lockRow,<a name="line.3285"></a>
-<span class="sourceLineNo">3286</span>  //get, put, unlockRow or something<a name="line.3286"></a>
-<span class="sourceLineNo">3287</span><a name="line.3287"></a>
-<span class="sourceLineNo">3288</span>  @Override<a name="line.3288"></a>
-<span class="sourceLineNo">3289</span>  public boolean checkAndMutate(byte [] row, byte [] family, byte [] qualifier,<a name="line.3289"></a>
-<span class="sourceLineNo">3290</span>      CompareOp compareOp, ByteArrayComparable comparator, Mutation w,<a name="line.3290"></a>
-<span class="sourceLineNo">3291</span>      boolean writeToWAL)<a name="line.3291"></a>
-<span class="sourceLineNo">3292</span>  throws IOException{<a name="line.3292"></a>
-<span class="sourceLineNo">3293</span>    checkReadOnly();<a name="line.3293"></a>
-<span class="sourceLineNo">3294</span>    //TODO, add check for value length or maybe even better move this to the<a name="line.3294"></a>
-<span class="sourceLineNo">3295</span>    //client if this becomes a global setting<a name="line.3295"></a>
-<span class="sourceLineNo">3296</span>    checkResources();<a name="line.3296"></a>
-<span class="sourceLineNo">3297</span>    boolean isPut = w instanceof Put;<a name="line.3297"></a>
-<span class="sourceLineNo">3298</span>    if (!isPut &amp;&amp; !(w instanceof Delete))<a name="line.3298"></a>
-<span class="sourceLineNo">3299</span>      throw new org.apache.hadoop.hbase.DoNotRetryIOException("Action must " +<a name="line.3299"></a>
-<span class="sourceLineNo">3300</span>          "be Put or Delete");<a name="line.3300"></a>
-<span class="sourceLineNo">3301</span>    if (!Bytes.equals(row, w.getRow())) {<a name="line.3301"></a>
-<span class="sourceLineNo">3302</span>      throw new org.apache.hadoop.hbase.DoNotRetryIOException("Action's " +<a name="line.3302"></a>
-<span class="sourceLineNo">3303</span>          "getRow must match the passed row");<a name="line.3303"></a>
-<span class="sourceLineNo">3304</span>    }<a name="line.3304"></a>
-<span class="sourceLineNo">3305</span><a name="line.3305"></a>
-<span class="sourceLineNo">3306</span>    startRegionOperation();<a name="line.3306"></a>
-<span class="sourceLineNo">3307</span>    try {<a name="line.3307"></a>
-<span class="sourceLineNo">3308</span>      Get get = new Get(row);<a name="line.3308"></a>
-<span class="sourceLineNo">3309</span>      checkFamily(family);<a name="line.3309"></a>
-<span class="sourceLineNo">3310</span>      get.addColumn(family, qualifier);<a name="line.3310"></a>
-<span class="sourceLineNo">3311</span><a name="line.3311"></a>
-<span class="sourceLineNo">3312</span>      // Lock row - note that doBatchMutate will relock this row if called<a name="line.3312"></a>
-<span class="sourceLineNo">3313</span>      RowLock rowLock = getRowLock(get.getRow());<a name="line.3313"></a>
-<span class="sourceLineNo">3314</span>      // wait for all previous transactions to complete (with lock held)<a name="line.3314"></a>
-<span class="sourceLineNo">3315</span>      mvcc.await();<a name="line.3315"></a>
-<span class="sourceLineNo">3316</span>      try {<a name="line.3316"></a>
-<span class="sourceLineNo">3317</span>        if (this.getCoprocessorHost() != null) {<a name="line.3317"></a>
-<span class="sourceLineNo">3318</span>          Boolean processed = null;<a name="line.3318"></a>
-<span class="sourceLineNo">3319</span>          if (w instanceof Put) {<a name="line.3319"></a>
-<span class="sourceLineNo">3320</span>            processed = this.getCoprocessorHost().preCheckAndPutAfterRowLock(row, family,<a name="line.3320"></a>
-<span class="sourceLineNo">3321</span>                qualifier, compareOp, comparator, (Put) w);<a name="line.3321"></a>
-<span class="sourceLineNo">3322</span>          } else if (w instanceof Delete) {<a name="line.3322"></a>
-<span class="sourceLineNo">3323</span>            processed = this.getCoprocessorHost().preCheckAndDeleteAfterRowLock(row, family,<a name="line.3323"></a>
-<span class="sourceLineNo">3324</span>                qualifier, compareOp, comparator, (Delete) w);<a name="line.3324"></a>
-<span class="sourceLineNo">3325</span>          }<a name="line.3325"></a>
-<span class="sourceLineNo">3326</span>          if (processed != null) {<a name="line.3326"></a>
-<span class="sourceLineNo">3327</span>            return processed;<a name="line.3327"></a>
-<span class="sourceLineNo">3328</span>          }<a name="line.3328"></a>
-<span class="sourceLineNo">3329</span>        }<a name="line.3329"></a>
-<span class="sourceLineNo">3330</span>        List&lt;Cell&gt; result = get(get, false);<a name="line.3330"></a>
-<span class="sourceLineNo">3331</span><a name="line.3331"></a>
-<span class="sourceLineNo">3332</span>        boolean valueIsNull = comparator.getValue() == null ||<a name="line.3332"></a>
-<span class="sourceLineNo">3333</span>          comparator.getValue().length == 0;<a name="line.3333"></a>
-<span class="sourceLineNo">3334</span>        boolean matches = false;<a name="line.3334"></a>
-<span class="sourceLineNo">3335</span>        long cellTs = 0;<a name="line.3335"></a>
-<span class="sourceLineNo">3336</span>        if (result.size() == 0 &amp;&amp; valueIsNull) {<a name="line.3336"></a>
-<span class="sourceLineNo">3337</span>          matches = true;<a name="line.3337"></a>
-<span class="sourceLineNo">3338</span>        } else if (result.size() &gt; 0 &amp;&amp; result.get(0).getValueLength() == 0 &amp;&amp;<a name="line.3338"></a>
-<span class="sourceLineNo">3339</span>            valueIsNull) {<a name="line.3339"></a>
-<span class="sourceLineNo">3340</span>          matches = true;<a name="line.3340"></a>
-<span class="sourceLineNo">3341</span>          cellTs = result.get(0).getTimestamp();<a name="line.3341"></a>
-<span class="sourceLineNo">3342</span>        } else if (result.size() == 1 &amp;&amp; !valueIsNull) {<a name="line.3342"></a>
-<span class="sourceLineNo">3343</span>          Cell kv = result.get(0);<a name="line.3343"></a>
-<span class="sourceLineNo">3344</span>          cellTs = kv.getTimestamp();<a name="line.3344"></a>
-<span class="sourceLineNo">3345</span>          int compareResult = CellComparator.compareValue(kv, comparator);<a name="line.3345"></a>
-<span class="sourceLineNo">3346</span>          switch (compareOp) {<a name="line.3346"></a>
-<span class="sourceLineNo">3347</span>          case LESS:<a name="line.3347"></a>
-<span class="sourceLineNo">3348</span>            matches = compareResult &lt; 0;<a name="line.3348"></a>
-<span class="sourceLineNo">3349</span>            break;<a name="line.3349"></a>
-<span class="sourceLineNo">3350</span>          case LESS_OR_EQUAL:<a name="line.3350"></a>
-<span class="sourceLineNo">3351</span>            matches = compareResult &lt;= 0;<a name="line.3351"></a>
-<span class="sourceLineNo">3352</span>            break;<a name="line.3352"></a>
-<span class="sourceLineNo">3353</span>          case EQUAL:<a name="line.3353"></a>
-<span class="sourceLineNo">3354</span>            matches = compareResult == 0;<a name="line.3354"></a>
-<span class="sourceLineNo">3355</span>            break;<a name="line.3355"></a>
-<span class="sourceLineNo">3356</span>          case NOT_EQUAL:<a name="line.3356"></a>
-<span class="sourceLineNo">3357</span>            matches = compareResult != 0;<a name="line.3357"></a>
-<span class="sourceLineNo">3358</span>            break;<a name="line.3358"></a>
-<span class="sourceLineNo">3359</span>          case GREATER_OR_EQUAL:<a name="line.3359"></a>
-<span class="sourceLineNo">3360</span>            matches = compareResult &gt;= 0;<a name="line.3360"></a>
-<span class="sourceLineNo">3361</span>            break;<a name="line.3361"></a>
-<span class="sourceLineNo">3362</span>          case GREATER:<a name="line.3362"></a>
-<span class="sourceLineNo">3363</span>            matches = compareResult &gt; 0;<a name="line.3363"></a>
-<span class="sourceLineNo">3364</span>            break;<a name="line.3364"></a>
-<span class="sourceLineNo">3365</span>          default:<a name="line.3365"></a>
-<span class="sourceLineNo">3366</span>            throw new RuntimeException("Unknown Compare op " + compareOp.name());<a name="line.3366"></a>
-<span class="sourceLineNo">3367</span>          }<a name="line.3367"></a>
-<span class="sourceLineNo">3368</span>        }<a name="line.3368"></a>
-<span class="sourceLineNo">3369</span>        //If matches put the new put or delete the new delete<a name="line.3369"></a>
-<span class="sourceLineNo">3370</span>        if (matches) {<a name="line.3370"></a>
-<span class="sourceLineNo">3371</span>          // We have acquired the row lock already. If the system clock is NOT monotonically<a name="line.3371"></a>
-<span class="sourceLineNo">3372</span>          // non-decreasing (see HBASE-14070) we should make sure that the mutation has a<a name="line.3372"></a>
-<span class="sourceLineNo">3373</span>          // larger timestamp than what was observed via Get. doBatchMutate already does this, but<a name="line.3373"></a>
-<span class="sourceLineNo">3374</span>          // there is no way to pass the cellTs. See HBASE-14054.<a name="line.3374"></a>
-<span class="sourceLineNo">3375</span>          long now = EnvironmentEdgeManager.currentTime();<a name="line.3375"></a>
-<span class="sourceLineNo">3376</span>          long ts = Math.max(now, cellTs); // ensure write is not eclipsed<a name="line.3376"></a>
-<span class="sourceLineNo">3377</span>          byte[] byteTs = Bytes.toBytes(ts);<a name="line.3377"></a>
-<span class="sourceLineNo">3378</span><a name="line.3378"></a>
-<span class="sourceLineNo">3379</span>          if (w instanceof Put) {<a name="line.3379"></a>
-<span class="sourceLineNo">3380</span>            updateCellTimestamps(w.getFamilyCellMap().values(), byteTs);<a name="line.3380"></a>
-<span class="sourceLineNo">3381</span>          }<a name="line.3381"></a>
-<span class="sourceLineNo">3382</span>          // else delete is not needed since it already does a second get, and sets the timestamp<a name="line.3382"></a>
-<span class="sourceLineNo">3383</span>          // from get (see prepareDeleteTimestamps).<a name="line.3383"></a>
-<span class="sourceLineNo">3384</span><a name="line.3384"></a>
-<span class="sourceLineNo">3385</span>          // All edits for the given row (across all column families) must<a name="line.3385"></a>
-<span class="sourceLineNo">3386</span>          // happen atomically.<a name="line.3386"></a>
-<span class="sourceLineNo">3387</span>          doBatchMutate(w);<a name="line.3387"></a>
-<span class="sourceLineNo">3388</span>          this.checkAndMutateChecksPassed.increment();<a name="line.3388"></a>
-<span class="sourceLineNo">3389</span>          return true;<a name="line.3389"></a>
-<span class="sourceLineNo">3390</span>        }<a name="line.3390"></a>
-<span class="sourceLineNo">3391</span>        this.checkAndMutateChecksFailed.increment();<a name="line.3391"></a>
-<span class="sourceLineNo">3392</span>        return false;<a name="line.3392"></a>
-<span class="sourceLineNo">3393</span>      } finally {<a name="line.3393"></a>
-<span class="sourceLineNo">3394</span>        rowLock.release();<a name="line.3394"></a>
-<span class="sourceLineNo">3395</span>      }<a name="line.3395"></a>
-<span class="sourceLineNo">3396</span>    } finally {<a name="line.3396"></a>
-<span class="sourceLineNo">3397</span>      closeRegionOperation();<a name="line.3397"></a>
-<span class="sourceLineNo">3398</span>    }<a name="line.3398"></a>
-<span class="sourceLineNo">3399</span>  }<a name="line.3399"></a>
-<span class="sourceLineNo">3400</span><a name="line.3400"></a>
-<span class="sourceLineNo">3401</span>  //TODO, Think that gets/puts and deletes should be refactored a bit so that<a name="line.3401"></a>
-<span class="sourceLineNo">3402</span>  //the getting of the lock happens before, so that you would just pass it into<a name="line.3402"></a>
-<span class="sourceLineNo">3403</span>  //the methods. So in the case of checkAndMutate you could just do lockRow,<a name="line.3403"></a>
-<span class="sourceLineNo">3404</span>  //get, put, unlockRow or something<a name="line.3404"></a>
-<span class="sourceLineNo">3405</span><a name="line.3405"></a>
-<span class="sourceLineNo">3406</span>  @Override<a name="line.3406"></a>
-<span class="sourceLineNo">3407</span>  public boolean checkAndRowMutate(byte [] row, byte [] family, byte [] qualifier,<a name="line.3407"></a>
-<span class="sourceLineNo">3408</span>      CompareOp compareOp, ByteArrayComparable comparator, RowMutations rm,<a name="line.3408"></a>
-<span class="sourceLineNo">3409</span>      boolean writeToWAL) throws IOException {<a name="line.3409"></a>
-<span class="sourceLineNo">3410</span>    checkReadOnly();<a name="line.3410"></a>
-<span class="sourceLineNo">3411</span>    //TODO, add check for value length or maybe even better move this to the<a name="line.3411"></a>
-<span class="sourceLineNo">3412</span>    //client if this becomes a global setting<a name="line.3412"></a>
-<span class="sourceLineNo">3413</span>    checkResources();<a name="line.3413"></a>
-<span class="sourceLineNo">3414</span><a name="line.3414"></a>
-<span class="sourceLineNo">3415</span>    startRegionOperation();<a name="line.3415"></a>
-<span class="sourceLineNo">3416</span>    try {<a name="line.3416"></a>
-<span class="sourceLineNo">3417</span>      Get get = new Get(row);<a name="line.3417"></a>
-<span class="sourceLineNo">3418</span>      checkFamily(family);<a name="line.3418"></a>
-<span class="sourceLineNo">3419</span>      get.addColumn(family, qualifier);<a name="line.3419"></a>
-<span class="sourceLineNo">3420</span><a name="line.3420"></a>
-<span class="sourceLineNo">3421</span>      // Lock row - note that doBatchMutate will relock this row if called<a name="line.3421"></a>
-<span class="sourceLineNo">3422</span>      RowLock rowLock = getRowLock(get.getRow());<a name="line.3422"></a>
-<span class="sourceLineNo">3423</span>      // wait for all previous transactions to complete (with lock held)<a name="line.3423"></a>
-<span class="sourceLineNo">3424</span>      mvcc.await();<a name="line.3424"></a>
-<span class="sourceLineNo">3425</span>      try {<a name="line.3425"></a>
-<span class="sourceLineNo">3426</span>        List&lt;Cell&gt; result = get(get, false);<a name="line.3426"></a>
-<span class="sourceLineNo">3427</span><a name="line.3427"></a>
-<span class="sourceLineNo">3428</span>        boolean valueIsNull = comparator.getValue() == null ||<a name="line.3428"></a>
-<span class="sourceLineNo">3429</span>            comparator.getValue().length == 0;<a name="line.3429"></a>
-<span class="sourceLineNo">3430</span>        boolean matches = false;<a name="line.3430"></a>
-<span class="sourceLineNo">3431</span>        long cellTs = 0;<a name="line.3431"></a>
-<span class="sourceLineNo">3432</span>        if (result.size() == 0 &amp;&amp; valueIsNull) {<a name="line.3432"></a>
-<span class="sourceLineNo">3433</span>          matches = true;<a name="line.3433"></a>
-<span class="sourceLineNo">3434</span>        } else if (result.size() &gt; 0 &amp;&amp; result.get(0).getValueLength() == 0 &amp;&amp;<a name="line.3434"></a>
-<span class="sourceLineNo">3435</span>            valueIsNull) {<a name="line.3435"></a>
-<span class="sourceLineNo">3436</span>          matches = true;<a name="line.3436"></a>
-<span class="sourceLineNo">3437</span>          cellTs = result.get(0).getTimestamp();<a name="line.3437"></a>
-<span class="sourceLineNo">3438</span>        } else if (result.size() == 1 &amp;&amp; !valueIsNull) {<a name="line.3438"></a>
-<span class="sourceLineNo">3439</span>          Cell kv = result.get(0);<a name="line.3439"></a>
-<span class="sourceLineNo">3440</span>          cellTs = kv.getTimestamp();<a name="line.3440"></a>
-<span class="sourceLineNo">3441</span>          int compareResult = CellComparator.compareValue(kv, comparator);<a name="line.3441"></a>
-<span class="sourceLineNo">3442</span>          switch (compareOp) {<a name="line.3442"></a>
-<span class="sourceLineNo">3443</span>          case LESS:<a name="line.3443"></a>
-<span class="sourceLineNo">3444</span>            matches = compareResult &lt; 0;<a name="line.3444"></a>
-<span class="sourceLineNo">3445</span>            break;<a name="line.3445"></a>
-<span class="sourceLineNo">3446</span>          case LESS_OR_EQUAL:<a name="line.3446"></a>
-<span class="sourceLineNo">3447</span>            matches = compareResult &lt;= 0;<a name="line.3447"></a>
-<span class="sourceLineNo">3448</span>            break;<a name="line.3448"></a>
-<span class="sourceLineNo">3449</span>          case EQUAL:<a name="line.3449"></a>
-<span class="sourceLineNo">3450</span>            matches = compareResult == 0;<a name="line.3450"></a>
-<span class="sourceLineNo">3451</span>            break;<a name="line.3451"></a>
-<span class="sourceLineNo">3452</span>          case NOT_EQUAL:<a name="line.3452"></a>
-<span class="sourceLineNo">3453</span>            matches = compareResult != 0;<a name="line.3453"></a>
-<span class="sourceLineNo">3454</span>            break;<a name="line.3454"></a>
-<span class="sourceLineNo">3455</span>          case GREATER_OR_EQUAL:<a name="line.3455"></a>
-<span class="sourceLineNo">3456</span>            matches = compareResult &gt;= 0;<a name="line.3456"></a>
-<span class="sourceLineNo">3457</span>            break;<a name="line.3457"></a>
-<span class="sourceLineNo">3458</span>          case GREATER:<a name="line.3458"></a>
-<span class="sourceLineNo">3459</span>            matches = compareResult &gt; 0;<a name="line.3459"></a>
-<span class="sourceLineNo">3460</span>            break;<a name="line.3460"></a>
-<span class="sourceLineNo">3461</span>          default:<a name="line.3461"></a>
-<span class="sourceLineNo">3462</span>            throw new RuntimeException("Unknown Compare op " + compareOp.name());<a name="line.3462"></a>
-<span class="sourceLineNo">3463</span>          }<a name="line.3463"></a>
-<span class="sourceLineNo">3464</span>        }<a name="line.3464"></a>
-<span class="sourceLineNo">3465</span>        //If matches put the new put or delete the new delete<a name="line.3465"></a>
-<span class="sourceLineNo">3466</span>        if (matches) {<a name="line.3466"></a>
-<span class="sourceLineNo">3467</span>          // We have acquired the row lock already. If the system clock is NOT monotonically<a name="line.3467"></a>
-<span class="sourceLineNo">3468</span>          // non-decreasing (see HBASE-14070) we should make sure that the mutation has a<a name="line.3468"></a>
-<span class="sourceLineNo">3469</span>          // larger timestamp than what was observed via Get. doBatchMutate already does this, but<a name="line.3469"></a>
-<span class="sourceLineNo">3470</span>          // there is no way to pass the cellTs. See HBASE-14054.<a name="line.3470"></a>
-<span class="sourceLineNo">3471</span>          long now = EnvironmentEdgeManager.currentTime();<a name="line.3471"></a>
-<span class="sourceLineNo">3472</span>          long ts = Math.max(now, cellTs); // ensure write is not eclipsed<a name="line.3472"></a>
-<span class="sourceLineNo">3473</span>          byte[] byteTs = Bytes.toBytes(ts);<a name="line.3473"></a>
-<span class="sourceLineNo">3474</span><a name="line.3474"></a>
-<span class="sourceLineNo">3475</span>          for (Mutation w : rm.getMutations()) {<a name="line.3475"></a>
-<span class="sourceLineNo">3476</span>            if (w instanceof Put) {<a name="line.3476"></a>
-<span class="sourceLineNo">3477</span>              updateCellTimestamps(w.getFamilyCellMap().values(), byteTs);<a name="line.3477"></a>
-<span class="sourceLineNo">3478</span>            }<a name="line.3478"></a>
-<span class="sourceLineNo">3479</span>            // else delete is not needed since it already does a second get, and sets the timestamp<a name="line.3479"></a>
-<span class="sourceLineNo">3480</span>            // from get (see prepareDeleteTimestamps).<a name="line.3480"></a>
-<span class="sourceLineNo">3481</span>          }<a name="line.3481"></a>
-<span class="sourceLineNo">3482</span><a name="line.3482"></a>
-<span class="sourceLineNo">3483</span>          // All edits for the given row (across all column families) must<a name="line.3483"></a>
-<span class="sourceLineNo">3484</span>          // happen atomically.<a name="line.3484"></a>
-<span class="sourceLineNo">3485</span>          mutateRow(rm);<a name="line.3485"></a>
-<span class="sourceLineNo">3486</span>          this.checkAndMutateChecksPassed.increment();<a name="line.3486"></a>
-<span class="sourceLineNo">3487</span>          return true;<a name="line.3487"></a>
-<span class="sourceLineNo">3488</span>        }<a name="line.3488"></a>
-<span class="sourceLineNo">3489</span>        this.checkAndMutateChecksFailed.increment();<a name="line.3489"></a>
-<span class="sourceLineNo">3490</span>        return false;<a name="line.3490"></a>
-<span class="sourceLineNo">3491</span>      } finally {<a name="line.3491"></a>
-<span class="sourceLineNo">3492</span>        rowLock.release();<a name="line.3492"></a>
-<span class="sourceLineNo">3493</span>      }<a name="line.3493"></a>
-<span class="sourceLineNo">3494</span>    } finally {<a name="line.3494"></a>
-<span class="sourceLineNo">3495</span>      closeRegionOperation();<a name="line.3495"></a>
-<span class="sourceLineNo">3496</span>    }<a name="line.3496"></a>
-<span class="sourceLineNo">3497</span>  }<a name="line.3497"></a>
-<span class="sourceLineNo">3498</span><a name="line.3498"></a>
-<span class="sourceLineNo">3499</span>  private void doBatchMutate(Mutation mutation) throws IOException {<a name="line.3499"></a>
-<span class="sourceLineNo">3500</span>    // Currently this is only called for puts and deletes, so no nonces.<a name="line.3500"></a>
-<span class="sourceLineNo">3501</span>    OperationStatus[] batchMutate = this.batchMutate(new Mutation[]{mutation});<a name="line.3501"></a>
-<span class="sourceLineNo">3502</span>    if (batchMutate[0].getOperationStatusCode().equals(OperationStatusCode.SANITY_CHECK_FAILURE)) {<a name="line.3502"></a>
-<span class="sourceLineNo">3503</span>      throw new FailedSanityCheckException(batchMutate[0].getExceptionMsg());<a name="line.3503"></a>
-<span class="sourceLineNo">3504</span>    } else if (batchMutate[0].getOperationStatusCode().equals(OperationStatusCode.BAD_FAMILY)) {<a name="line.3504"></a>
-<span class="sourceLineNo">3505</span>      throw new NoSuchColumnFamilyException(batchMutate[0].getExceptionMsg());<a name="line.3505"></a>
-<span class="sourceLineNo">3506</span>    }<a name="line.3506"></a>
-<span class="sourceLineNo">3507</span>  }<a name="line.3507"></a>
-<span class="sourceLineNo">3508</span><a name="line.3508"></a>
-<span class="sourceLineNo">3509</span>  /**<a name="line.3509"></a>
-<span class="sourceLineNo">3510</span>   * Complete taking the snapshot on the region. Writes the region info and adds references to the<a name="line.3510"></a>
-<span class="sourceLineNo">3511</span>   * working snapshot directory.<a name="line.3511"></a>
-<span class="sourceLineNo">3512</span>   *<a name="line.3512"></a>
-<span class="sourceLineNo">3513</span>   * TODO for api consistency, consider adding another version with no {@link ForeignExceptionSnare}<a name="line.3513"></a>
-<span class="sourceLineNo">3514</span>   * arg.  (In the future other cancellable HRegion methods could eventually add a<a name="line.3514"></a>
-<span class="sourceLineNo">3515</span>   * {@link ForeignExceptionSnare}, or we could do something fancier).<a name="line.3515"></a>
-<span class="sourceLineNo">3516</span>   *<a name="line.3516"></a>
-<span class="sourceLineNo">3517</span>   * @param desc snapshot description object<a name="line.3517"></a>
-<span class="sourceLineNo">3518</span>   * @param exnSnare ForeignExceptionSnare that captures external exceptions in case we need to<a name="line.3518"></a>
-<span class="sourceLineNo">3519</span>   *   bail out.  This is allowed to be null and will just be ignored in that case.<a name="line.3519"></a>
-<span class="sourceLineNo">3520</span>   * @throws IOException if there is an external or internal error causing the snapshot to fail<a name="line.3520"></a>
-<span class="sourceLineNo">3521</span>   */<a name="line.3521"></a>
-<span class="sourceLineNo">3522</span>  public void addRegionToSnapshot(SnapshotDescription desc,<a name="line.3522"></a>
-<span class="sourceLineNo">3523</span>      ForeignExceptionSnare exnSnare) throws IOException {<a name="line.3523"></a>
-<span class="sourceLineNo">3524</span>    Path rootDir = FSUtils.getRootDir(conf);<a name="line.3524"></a>
-<span class="sourceLineNo">3525</span>    Path snapshotDir = SnapshotDescriptionUtils.getWorkingSnapshotDir(desc, rootDir);<a name="line.3525"></a>
-<span class="sourceLineNo">3526</span><a name="line.3526"></a>
-<span class="sourceLineNo">3527</span>    SnapshotManifest manifest = SnapshotManifest.create(conf, getFilesystem(),<a name="line.3527"></a>
-<span class="sourceLineNo">3528</span>            snapshotDir, desc, exnSnare);<a name="line.3528"></a>
-<span class="sourceLineNo">3529</span>    manifest.addRegion(this);<a name="line.3529"></a>
-<span class="sourceLineNo">3530</span><a name="line.3530"></a>
-<span class="sourceLineNo">3531</span>    // The regionserver holding the first region of the table is responsible for taking the<a name="line.3531"></a>
-<span class="sourceLineNo">3532</span>    // manifest of the mob dir.<a name="line.3532"></a>
-<span class="sourceLineNo">3533</span>    if (!Bytes.equals(getRegionInfo().getStartKey(), HConstants.EMPTY_START_ROW))<a name="line.3533"></a>
-<span class="sourceLineNo">3534</span>      return;<a name="line.3534"></a>
-<span class="sourceLineNo">3535</span><a name="line.3535"></a>
-<span class="sourceLineNo">3536</span>    // if any cf's have is mob enabled, add the "mob region" to the manifest.<a name="line.3536"></a>
-<span class="sourceLineNo">3537</span>    List&lt;Store&gt; stores = getStores();<a name="line.3537"></a>
-<span class="sourceLineNo">3538</span>    for (Store store : stores) {<a name="line.3538"></a>
-<span class="sourceLineNo">3539</span>      boolean hasMobStore = store.getFamily().isMobEnabled();<a name="line.3539"></a>
-<span class="sourceLineNo">3540</span>      if (hasMobStore) {<a name="line.3540"></a>
-<span class="sourceLineNo">3541</span>        // use the .mob as the start key and 0 as the regionid<a name="line.3541"></a>
-<span class="sourceLineNo">3542</span>        HRegionInfo mobRegionInfo = MobUtils.getMobRegionInfo(this.getTableDesc().getTableName());<a name="line.3542"></a>
-<span class="sourceLineNo">3543</span>        mobRegionInfo.setOffline(true);<a name="line.3543"></a>
-<span class="sourceLineNo">3544</span>        manifest.addMobRegion(mobRegionInfo, this.getTableDesc().getColumnFamilies());<a name="line.3544"></a>
-<span class="sourceLineNo">3545</span>        return;<a name="line.3545"></a>
-<span class="sourceLineNo">3546</span>      }<a name="line.3546"></a>
-<span class="sourceLineNo">3547</span>    }<a name="line.3547"></a>
-<span class="sourceLineNo">3548</span>  }<a name="line.3548"></a>
-<span class="sourceLineNo">3549</span><a name="line.3549"></a>
-<span class="sourceLineNo">3550</span>  @Override<a name="line.3550"></a>
-<span class="sourceLineNo">3551</span>  public void updateCellTimestamps(final Iterable&lt;List&lt;Cell&gt;&gt; cellItr, final byte[] now)<a name="line.3551"></a>
-<span class="sourceLineNo">3552</span>      throws IOException {<a name="line.3552"></a>
-<span class="sourceLineNo">3553</span>    for (List&lt;Cell&gt; cells: cellItr) {<a name="line.3553"></a>
-<span class="sourceLineNo">3554</span>      if (cells == null) continue;<a name="line.3554"></a>
-<span class="sourceLineNo">3555</span>      assert cells instanceof RandomAccess;<a name="line.3555"></a>
-<span class="sourceLineNo">3556</span>      int listSize = cells.size();<a name="line.3556"></a>
-<span class="sourceLineNo">3557</span>      for (int i = 0; i &lt; listSize; i++) {<a name="line.3557"></a>
-<span class="sourceLineNo">3558</span>        CellUtil.updateLatestStamp(cells.get(i), now, 0);<a name="line.3558"></a>
-<span class="sourceLineNo">3559</span>      }<a name="line.3559"></a>
-<span class="sourceLineNo">3560</span>    }<a name="line.3560"></a>
-<span class="sourceLineNo">3561</span>  }<a name="line.3561"></a>
-<span class="sourceLineNo">3562</span><a name="line.3562"></a>
-<span class="sourceLineNo">3563</span>  /**<a name="line.3563"></a>
-<span class="sourceLineNo">3564</span>   * Possibly rewrite incoming cell tags.<a name="line.3564"></a>
-<span class="sourceLineNo">3565</span>   */<a name="line.3565"></a>
-<span class="sourceLineNo">3566</span>  void rewriteCellTags(Map&lt;byte[], List&lt;Cell&gt;&gt; familyMap, final Mutation m) {<a name="line.3566"></a>
-<span class="sourceLineNo">3567</span>    // Check if we have any work to do and early out otherwise<a name="line.3567"></a>
-<span class="sourceLineNo">3568</span>    // Update these checks as more logic is added here<a name="line.3568"></a>
-<span class="sourceLineNo">3569</span><a name="line.3569"></a>
-<span class="sourceLineNo">3570</span>    if (m.getTTL() == Long.MAX_VALUE) {<a name="line.3570"></a>
-<span class="sourceLineNo">3571</span>      return;<a name="line.3571"></a>
-<span class="sourceLineNo">3572</span>    }<a name="line.3572"></a>
-<span class="sourceLineNo">3573</span><a name="line.3573"></a>
-<span class="sourceLineNo">3574</span>    // From this point we know we have some work to do<a name="line.3574"></a>
-<span class="sourceLineNo">3575</span><a name="line.3575"></a>
-<span class="sourceLineNo">3576</span>    for (Map.Entry&lt;byte[], List&lt;Cell&gt;&gt; e: familyMap.entrySet()) {<a name="line.3576"></a>
-<span class="sourceLineNo">3577</span>      List&lt;Cell&gt; cells = e.getValue();<a name="line.3577"></a>
-<span class="sourceLineNo">3578</span>      assert cells instanceof RandomAccess;<a name="line.3578"></a>
-<span class="sourceLineNo">3579</span>      int listSize = cells.size();<a name="line.3579"></a>
-<span class="sourceLineNo">3580</span>      for (int i = 0; i &lt; listSize; i++) {<a name="line.3580"></a>
-<span class="sourceLineNo">3581</span>        Cell cell = cells.get(i);<a name="line.3581"></a>
-<span class="sourceLineNo">3582</span>        List&lt;Tag&gt; newTags = new ArrayList&lt;Tag&gt;();<a name="line.3582"></a>
-<span class="sourceLineNo">3583</span>        Iterator&lt;Tag&gt; tagIterator = CellUtil.tagsIterator(cell.getTagsArray(),<a name="line.3583"></a>
-<span class="sourceLineNo">3584</span>          cell.getTagsOffset(), cell.getTagsLength());<a name="line.3584"></a>
-<span class="sourceLineNo">3585</span><a name="line.3585"></a>
-<span class="sourceLineNo">3586</span>        // Carry forward existing tags<a name="line.3586"></a>
-<span class="sourceLineNo">3587</span><a name="line.3587"></a>
-<span class="sourceLineNo">3588</span>        while (tagIterator.hasNext()) {<a name="line.3588"></a>
-<span class="sourceLineNo">3589</span><a name="line.3589"></a>
-<span class="sourceLineNo">3590</span>          // Add any filters or tag specific rewrites here<a name="line.3590"></a>
-<span class="sourceLineNo">3591</span><a name="line.3591"></a>
-<span class="sourceLineNo">3592</span>          newTags.add(tagIterator.next());<a name="line.3592"></a>
-<span class="sourceLineNo">3593</span>        }<a name="line.3593"></a>
-<span class="sourceLineNo">3594</span><a name="line.3594"></a>
-<span class="sourceLineNo">3595</span>        // Cell TTL handling<a name="line.3595"></a>
-<span class="sourceLineNo">3596</span><a name="line.3596"></a>
-<span class="sourceLineNo">3597</span>        // Check again if we need to add a cell TTL because early out logic<a name="line.3597"></a>
-<span class="sourceLineNo">3598</span>        // above may change when there are more tag based features in core.<a name="line.3598"></a>
-<span class="sourceLineNo">3599</span>        if (m.getTTL() != Long.MAX_VALUE) {<a name="line.3599"></a>
-<span class="sourceLineNo">3600</span>          // Add a cell TTL tag<a name="line.3600"></a>
-<span class="sourceLineNo">3601</span>          newTags.add(new Tag(TagType.TTL_TAG_TYPE, Bytes.toBytes(m.getTTL())));<a name="line.3601"></a>
-<span class="sourceLineNo">3602</span>        }<a name="line.3602"></a>
-<span class="sourceLineNo">3603</span><a name="line.3603"></a>
-<span class="sourceLineNo">3604</span>        // Rewrite the cell with the updated set of tags<a name="line.3604"></a>
-<span class="sourceLineNo">3605</span>        cells.set(i, new TagRewriteCell(cell, Tag.fromList(newTags)));<a name="line.3605"></a>
-<span class="sourceLineNo">3606</span>      }<a name="line.3606"></a>
-<span class="sourceLineNo">3607</span>    }<a name="line.3607"></a>
-<span class="sourceLineNo">3608</span>  }<a name="line.3608"></a>
-<span class="sourceLineNo">3609</span><a name="line.3609"></a>
-<span class="sourceLineNo">3610</span>  /*<a name="line.3610"></a>
-<span class="sourceLineNo">3611</span>   * Check if resources to support an update.<a name="line.3611"></a>
-<span class="sourceLineNo">3612</span>   *<a name="line.3612"></a>
-<span class="sourceLineNo">3613</span>   * We throw RegionTooBusyException if above memstore limit<a name="line.3613"></a>
-<span class="sourceLineNo">3614</span>   * and expect client to retry using some kind of backoff<a name="line.3614"></a>
-<span class="sourceLineNo">3615</span>  */<a name="line.3615"></a>
-<span class="sourceLineNo">3616</span>  private void checkResources() throws RegionTooBusyException {<a name="line.3616"></a>
-<span class="sourceLineNo">3617</span>    // If catalog region, do not impose resource constraints or block updates.<a name="line.3617"></a>
-<span class="sourceLineNo">3618</span>    if (this.getRegionInfo().isMetaRegion()) return;<a name="line.3618"></a>
-<span class="sourceLineNo">3619</span><a name="line.3619"></a>
-<span class="sourceLineNo">3620</span>    if (this.memstoreSize.get() &gt; this.blockingMemStoreSize) {<a name="line.3620"></a>
-<span class="sourceLineNo">3621</span>      blockedRequestsCount.increment();<a name="line.3621"></a>
-<span class="sourceLineNo">3622</span>      requestFlush();<a name="line.3622"></a>
-<span class="sourceLineNo">3623</span>      throw new RegionTooBusyException("Above memstore limit, " +<a name="line.3623"></a>
-<span class="sourceLineNo">3624</span>          "regionName=" + (this.getRegionInfo() == null ? "unknown" :<a name="line.3624"></a>
-<span class="sourceLineNo">3625</span>          this.getRegionInfo().getRegionNameAsString()) +<a name="line.3625"></a>
-<span class="sourceLineNo">3626</span>          ", server=" + (this.getRegionServerServices() == null ? "unknown" :<a name="line.3626"></a>
-<span class="sourceLineNo">3627</span>          this.getRegionServerServices().getServerName()) +<a name="line.3627"></a>
-<span class="sourceLineNo">3628</span>          ", memstoreSize=" + memstoreSize.get() +<a name="line.3628"></a>
-<span class="sourceLineNo">3629</span>          ", blockingMemStoreSize=" + blockingMemStoreSize);<a name="line.3629"></a>
-<span class="sourceLineNo">3630</span>    }<a name="line.3630"></a>
-<span class="sourceLineNo">3631</span>  }<a name="line.3631"></a>
-<span class="sourceLineNo">3632</span><a name="line.3632"></a>
-<span class="sourceLineNo">3633</span>  /**<a name="line.3633"></a>
-<span class="sourceLineNo">3634</span>   * @throws IOException Throws exception if region is in read-only mode.<a name="line.3634"></a>
-<span class="sourceLineNo">3635</span>   */<a name="line.3635"></a>
-<span class="sourceLineNo">3636</span>  protected void checkReadOnly() throws IOException {<a name="line.3636"></a>
-<span class="sourceLineNo">3637</span>    if (isReadOnly()) {<a name="line.3637"></a>
-<span class="sourceLineNo">3638</span>      throw new DoNotRetryIOException("region is read only");<a name="line.3638"></a>
-<span class="sourceLineNo">3639</span>    }<a name="line.3639"></a>
-<span class="sourceLineNo">3640</span>  }<a name="line.3640"></a>
-<span class="sourceLineNo">3641</span><a name="line.3641"></a>
-<span class="sourceLineNo">3642</span>  protected void checkReadsEnabled() throws IOException {<a name="line.3642"></a>
-<span class="sourceLineNo">3643</span>    if (!this.writestate.readsEnabled) {<a name="line.3643"></a>
-<span class="sourceLineNo">3644</span>      throw new IOException(getRegionInfo().getEncodedName()<a name="line.3644"></a>
-<span class="sourceLineNo">3645</span>        + ": The region's reads are disabled. Cannot serve the request");<a name="line.3645"></a>
-<span class="sourceLineNo">3646</span>    }<a name="line.3646"></a>
-<span class="sourceLineNo">3647</span>  }<a name="line.3647"></a>
-<span class="sourceLineNo">3648</span><a name="line.3648"></a>
-<span class="sourceLineNo">3649</span>  public void setReadsEnabled(boolean readsEnabled) {<a name="line.3649"></a>
-<span class="sourceLineNo">3650</span>   if (readsEnabled &amp;&amp; !this.writestate.readsEnabled) {<a name="line.3650"></a>
-<span class="sourceLineNo">3651</span>     LOG.info(getRegionInfo().getEncodedName() + " : Enabling reads for region.");<a name="line.3651"></a>
-<span class="sourceLineNo">3652</span>    }<a name="line.3652"></a>
-<span class="sourceLineNo">3653</span>    this.writestate.setReadsEnabled(readsEnabled);<a name="line.3653"></a>
-<span class="sourceLineNo">3654</span>  }<a name="line.3654"></a>
-<span class="sourceLineNo">3655</span><a name="line.3655"></a>
-<span class="sourceLineNo">3656</span>  /**<a name="line.3656"></a>
-<span class="sourceLineNo">3657</span>   * Add updates first to the wal and then add values to memstore.<a name="line.3657"></a>
-<span class="sourceLineNo">3658</span>   * Warning: Assumption is caller has lock on passed in row.<a name="line.3658"></a>
-<span class="sourceLineNo">3659</span>   * @param edits Cell updates by column<a name="line.3659"></a>
-<span class="sourceLineNo">3660</span>   * @throws IOException<a name="line.3660"></a>
-<span class="sourceLineNo">3661</span>   */<a name="line.3661"></a>
-<span class="sourceLineNo">3662</span>  private void put(final byte [] row, byte [] family, List&lt;Cell&gt; edits)<a name="line.3662"></a>
-<span class="sourceLineNo">3663</span>  throws IOException {<a name="line.3663"></a>
-<span class="sourceLineNo">3664</span>    NavigableMap&lt;byte[], List&lt;Cell&gt;&gt; familyMap;<a name="line.3664"></a>
-<span class="sourceLineNo">3665</span>    familyMap = new TreeMap&lt;byte[], List&lt;Cell&gt;&gt;(Bytes.BYTES_COMPARATOR);<a name="line.3665"></a>
-<span class="sourceLineNo">3666</span><a name="line.3666"></a>
-<span class="sourceLineNo">3667</span>    familyMap.put(family, edits);<a name="line.3667"></a>
-<span class="sourceLineNo">3668</span>    Put p = new Put(row);<a name="line.3668"></a>
-<span class="sourceLineNo">3669</span>    p.setFamilyCellMap(familyMap);<a name="line.3669"></a>
-<span class="sourceLineNo">3670</span>    doBatchMutate(p);<a name="line.3670"></a>
-<span class="sourceLineNo">3671</span>  }<a name="line.3671"></a>
-<span class="sourceLineNo">3672</span><a name="line.3672"></a>
-<span class="sourceLineNo">3673</span>  /**<a name="line.3673"></a>
-<span class="sourceLineNo">3674</span>   * Atomically apply the given map of family-&gt;edits to the memstore.<a name="line.3674"></a>
-<span class="sourceLineNo">3675</span>   * This handles the consistency control on its own, but the caller<a name="line.3675"></a>
-<span class="sourceLineNo">3676</span>   * should already have locked updatesLock.readLock(). This also does<a name="line.3676"></a>
-<span class="sourceLineNo">3677</span>   * &lt;b&gt;not&lt;/b&gt; check the families for validity.<a name="line.3677"></a>
-<span class="sourceLineNo">3678</span>   *<a name="line.3678"></a>
-<span class="sourceLineNo">3679</span>   * @param familyMap Map of kvs per family<a name="line.3679"></a>
-<span class="sourceLineNo">3680</span>   * @param mvccNum The MVCC for this transaction.<a name="line.3680"></a>
-<span class="sourceLineNo">3681</span>   * @param isInReplay true when adding replayed KVs into memstore<a name="line.3681"></a>
-<span class="sourceLineNo">3682</span>   * @return the additional memory usage of the memstore caused by the<a name="line.3682"></a>
-<span class="sourceLineNo">3683</span>   * new entries.<a name="line.3683"></a>
-<span class="sourceLineNo">3684</span>   */<a name="line.3684"></a>
-<span class="sourceLineNo">3685</span>  private long applyFamilyMapToMemstore(Map&lt;byte[], List&lt;Cell&gt;&gt; familyMap,<a name="line.3685"></a>
-<span class="sourceLineNo">3686</span>    long mvccNum, boolean isInReplay) throws IOException {<a name="line.3686"></a>
-<span class="sourceLineNo">3687</span>    long size = 0;<a name="line.3687"></a>
-<span class="sourceLineNo">3688</span><a name="line.3688"></a>
-<span class="sourceLineNo">3689</span>    for (Map.Entry&lt;byte[], List&lt;Cell&gt;&gt; e : familyMap.entrySet()) {<a name="line.3689"></a>
-<span class="sourceLineNo">3690</span>      byte[] family = e.getKey();<a name="line.3690"></a>
-<span class="sourceLineNo">3691</span>      List&lt;Cell&gt; cells = e.getValue();<a name="line.3691"></a>
-<span class="sourceLineNo">3692</span>      assert cells instanceof RandomAccess;<a name="line.3692"></a>
-<span class="sourceLineNo">3693</span>      Store store = getStore(family);<a name="line.3693"></a>
-<span class="sourceLineNo">3694</span>      int listSize = cells.size();<a name="line.3694"></a>
-<span class="sourceLineNo">3695</span>      for (int i=0; i &lt; listSize; i++) {<a name="line.3695"></a>
-<span class="sourceLineNo">3696</span>        Cell cell = cells.get(i);<a name="line.3696"></a>
-<span class="sourceLineNo">3697</span>        if (cell.getSequenceId() == 0 || isInReplay) {<a name="line.3697"></a>
-<span class="sourceLineNo">3698</span>          CellUtil.setSequenceId(cell, mvccNum);<a name="line.3698"></a>
-<span class="sourceLineNo">3699</span>        }<a name="line.3699"></a>
-<span class="sourceLineNo">3700</span>        size += store.add(cell);<a name="line.3700"></a>
-<span class="sourceLineNo">3701</span>      }<a name="line.3701"></a>
-<span class="sourceLineNo">3702</span>    }<a name="line.3702"></a>
-<span class="sourceLineNo">3703</span><a name="line.3703"></a>
-<span class="sourceLineNo">3704</span>     return size;<a name="line.3704"></a>
-<span class="sourceLineNo">3705</span>   }<a name="line.3705"></a>
-<span class="sourceLineNo">3706</span><a name="line.3706"></a>
-<span class="sourceLineNo">3707</span>  /**<a name="line.3707"></a>
-<span class="sourceLineNo">3708</span>   * Remove all the keys listed in the map from the memstore. This method is<a name="line.3708"></a>
-<span class="sourceLineNo">3709</span>   * called when a Put/Delete has updated memstore but subsequently fails to update<a name="line.3709"></a>
-<span class="sourceLineNo">3710</span>   * the wal. This method is then invoked to rollback the memstore.<a name="line.3710"></a>
-<span class="sourceLineNo">3711</span>   */<a name="line.3711"></a>
-<span class="sourceLineNo">3712</span>  private void rollbackMemstore(List&lt;Cell&gt; memstoreCells) {<a name="line.3712"></a>
-<span class="sourceLineNo">3713</span>    int kvsRolledback = 0;<a name="line.3713"></a>
-<span class="sourceLineNo">3714</span><a name="line.3714"></a>
-<span class="sourceLineNo">3715</span>    for (Cell cell : memstoreCells) {<a name="line.3715"></a>
-<span class="sourceLineNo">3716</span>      byte[] family = CellUtil.cloneFamily(cell);<a name="line.3716"></a>
-<span class="sourceLineNo">3717</span>      Store store = getStore(family);<a name="line.3717"></a>
-<span class="sourceLineNo">3718</span>      store.rollback(cell);<a name="line.3718"></a>
-<span class="sourceLineNo">3719</span>      kvsRolledback++;<a name="line.3719"></a>
-<span class="sourceLineNo">3720</span>    }<a name="line.3720"></a>
-<span class="sourceLineNo">3721</span>    LOG.debug("rollbackMemstore rolled back " + kvsRolledback);<a name="line.3721"></a>
-<span class="sourceLineNo">3722</span>  }<a name="line.3722"></a>
-<span class="sourceLineNo">3723</span><a name="line.3723"></a>
-<span class="sourceLineNo">3724</span>  @Override<a name="line.3724"></a>
-<span class="sourceLineNo">3725</span>  public void checkFamilies(Collection&lt;byte[]&gt; families) throws NoSuchColumnFamilyException {<a name="line.3725"></a>
-<span class="sourceLineNo">3726</span>    for (byte[] family : families) {<a name="line.3726"></a>
-<span class="sourceLineNo">3727</span>      checkFamily(family);<a name="line.3727"></a>
-<span class="sourceLineNo">3728</span>    }<a name="line.3728"></a>
-<span class="sourceLineNo">3729</span>  }<a name="line.3729"></a>
-<span class="sourceLineNo">3730</span><a name="line.3730"></a>
-<span class="sourceLineNo">3731</span>  /**<a name="line.3731"></a>
-<span class="sourceLineNo">3732</span>   * During replay, there could exist column families which are removed between region server<a name="line.3732"></a>
-<span class="sourceLineNo">3733</span>   * failure and replay<a name="line.3733"></a>
-<span class="sourceLineNo">3734</span>   */<a name="line.3734"></a>
-<span class="sourceLineNo">3735</span>  private void removeNonExistentColumnFamilyForReplay(<a name="line.3735"></a>
-<span class="sourceLineNo">3736</span>      final Map&lt;byte[], List&lt;Cell&gt;&gt; familyMap) {<a name="line.3736"></a>
-<span class="sourceLineNo">3737</span>    List&lt;byte[]&gt; nonExistentList = null;<a name="line.3737"></a>
-<span class="sourceLineNo">3738</span>    for (byte[] family : familyMap.keySet()) {<a name="line.3738"></a>
-<span class="sourceLineNo">3739</span>      if (!this.htableDescriptor.hasFamily(family)) {<a name="line.3739"></a>
-<span class="sourceLineNo">3740</span>        if (nonExistentList == null) {<a name="line.3740"></a>
-<span class="sourceLineNo">3741</span>          nonExistentList = new ArrayList&lt;byte[]&gt;();<a name="line.3741"></a>
-<span class="sourceLineNo">3742</span>        }<a name="line.3742"></a>
-<span class="sourceLineNo">3743</span>        nonExistentList.add(family);<a name="line.3743"></a>
-<span class="sourceLineNo">3744</span>      }<a name="line.3744"></a>
-<span class="sourceLineNo">3745</span>    }<a name="line.3745"></a>
-<span class="sourceLineNo">3746</span>    if (nonExistentList != null) {<a name="line.3746"></a>
-<span class="sourceLineNo">3747</span>      for (byte[] family : nonExistentList) {<a name="line.3747"></a>
-<span class="sourceLineNo">3748</span>        // Perhaps schema was changed between crash and replay<a name="line.3748"></a>
-<span class="sourceLineNo">3749</span>        LOG.info("No family for " + Bytes.toString(family) + " omit from reply.");<a name="line.3749"></a>
-<span class="sourceLineNo">3750</span>        familyMap.remove(family);<a name="line.3750"></a>
-<span class="sourceLineNo">3751</span>      }<a name="line.3751"></a>
-<span class="sourceLineNo">3752</span>    }<a name="line.3752"></a>
-<span class="sourceLineNo">3753</span>  }<a name="line.3753"></a>
-<span class="sourceLineNo">3754</span><a name="line.3754"></a>
-<span class="sourceLineNo">3755</span>  @Override<a name="line.3755"></a>
-<span class="sourceLineNo">3756</span>  public void checkTimestamps(final Map&lt;byte[], List&lt;Cell&gt;&gt; familyMap, long now)<a name="line.3756"></a>
-<span class="sourceLineNo">3757</span>      throws FailedSanityCheckException {<a name="line.3757"></a>
-<span class="sourceLineNo">3758</span>    if (timestampSlop == HConstants.LATEST_TIMESTAMP) {<a name="line.3758"></a>
-<span class="sourceLineNo">3759</span>      return;<a name="line.3759"></a>
-<span class="sourceLineNo">3760</span>    }<a name="line.3760"></a>
-<span class="sourceLineNo">3761</span>    long maxTs = now + timestampSlop;<a name="line.3761"></a>
-<span class="sourceLineNo">3762</span>    for (List&lt;Cell&gt; kvs : familyMap.values()) {<a name="line.3762"></a>
-<span class="sourceLineNo">3763</span>      assert kvs instanceof RandomAccess;<a name="line.3763"></a>
-<span class="sourceLineNo">3764</span>      int listSize  = kvs.size();<a name="line.3764"></a>
-<span class="sourceLineNo">3765</span>      for (int i=0; i &lt; listSize; i++) {<a name="line.3765"></a>
-<span class="sourceLineNo">3766</span>        Cell cell = kvs.get(i);<a name="line.3766"></a>
-<span class="sourceLineNo">3767</span>        // see if the user-side TS is out of range. latest = server-side<a name="line.3767"></a>
-<span class="sourceLineNo">3768</span>        long ts = cell.getTimestamp();<a name="line.3768"></a>
-<span class="sourceLineNo">3769</span>        if (ts != HConstants.LATEST_TIMESTAMP &amp;&amp; ts &gt; maxTs) {<a name="line.3769"></a>
-<span class="sourceLineNo">3770</span>          throw new FailedSanityCheckException("Timestamp for KV out of range "<a name="line.3770"></a>
-<span class="sourceLineNo">3771</span>              + cell + " (too.new=" + timestampSlop + ")");<a name="line.3771"></a>
-<span class="sourceLineNo">3772</span>        }<a name="line.3772"></a>
-<span class="sourceLineNo">3773</span>      }<a name="line.3773"></a>
-<span class="sourceLineNo">3774</span>    }<a name="line.3774"></a>
-<span class="sourceLineNo">3775</span>  }<a name="line.3775"></a>
-<span class="sourceLineNo">3776</span><a name="line.3776"></a>
-<span class="sourceLineNo">3777</span>  /**<a name="line.3777"></a>
-<span class="sourceLineNo">3778</span>   * Append the given map of family-&gt;edits to a WALEdit data structure.<a name="line.3778"></a>
-<span class="sourceLineNo">3779</span>   * This does not write to the WAL itself.<a name="line.3779"></a>
-<span class="sourceLineNo">3780</span>   * @param familyMap map of family-&gt;edits<a name="line.3780"></a>
-<span class="sourceLineNo">3781</span>   * @param walEdit the destination entry to append into<a name="line.3781"></a>
-<span class="sourceLineNo">3782</span>   */<a name="line.3782"></a>
-<span class="sourceLineNo">3783</span>  private void addFamilyMapToWALEdit(Map&lt;byte[], List&lt;Cell&gt;&gt; familyMap,<a name="line.3783"></a>
-<span class="sourceLineNo">3784</span>      WALEdit walEdit) {<a name="line.3784"></a>
-<span class="sourceLineNo">3785</span>    for (List&lt;Cell&gt; edits : familyMap.values()) {<a name="line.3785"></a>
-<span class="sourceLineNo">3786</span>      assert edits instanceof RandomAccess;<a name="line.3786"></a>
-<span class="sourceLineNo">3787</span>      int listSize = edits.size();<a name="line.3787"></a>
-<span class="sourceLineNo">3788</span>      for (int i=0; i &lt; listSize; i++) {<a name="line.3788"></a>
-<span class="sourceLineNo">3789</span>        Cell cell = edits.get(i);<a name="line.3789"></a>
-<span class="sourceLineNo">3790</span>        walEdit.add(cell);<a name="line.3790"></a>
-<span class="sourceLineNo">3791</span>      }<a name="line.3791"></a>
-<span class="sourceLineNo">3792</span>    }<a name="line.3792"></a>
-<span class="sourceLineNo">3793</span>  }<a name="line.3793"></a>
-<span class="sourceLineNo">3794</span><a name="line.3794"></a>
-<span class="sourceLineNo">3795</span>  private void requestFlush() {<a name="line.3795"></a>
-<span class="sourceLineNo">3796</span>    if (this.rsServices == null) {<a name="line.3796"></a>
-<span class="sourceLineNo">3797</span>      return;<a name="line.3797"></a>
-<span class="sourceLineNo">3798</span>    }<a name="line.3798"></a>
-<span class="sourceLineNo">3799</span>    synchronized (writestate) {<a name="line.3799"></a>
-<span class="sourceLineNo">3800</span>      if (this.writestate.isFlushRequested()) {<a name="line.3800"></a>
-<span class="sourceLineNo">3801</span>        return;<a name="line.3801"></a>
-<span class="sourceLineNo">3802</span>      }<a name="line.3802"></a>
-<span class="sourceLineNo">3803</span>      writestate.flushRequested = true;<a name="line.3803"></a>
-<span class="sourceLineNo">3804</span>    }<a name="line.3804"></a>
-<span class="sourceLineNo">3805</span>    // Make request outside of synchronize block; HBASE-818.<a name="line.3805"></a>
-<span class="sourceLineNo">3806</span>    this.rsServices.getFlushRequester().requestFlush(this, false);<a name="line.3806"></a>
-<span class="sourceLineNo">3807</span>    if (LOG.isDebugEnabled()) {<a name="line.3807"></a>
-<span class="sourceLineNo">3808</span>      LOG.debug("Flush requested on " + this.getRegionInfo().getEncodedName());<a name="line.3808"></a>
-<span class="sourceLineNo">3809</span>    }<a name="line.3809"></a>
-<span class="sourceLineNo">3810</span>  }<a name="line.3810"></a>
-<span class="sourceLineNo">3811</span><a name="line.3811"></a>
-<span class="sourceLineNo">3812</span>  /*<a name="line.3812"></a>
-<span class="sourceLineNo">3813</span>   * @param size<a name="line.3813"></a>
-<span class="sourceLineNo">3814</span>   * @return True if size is over the flush threshold<a name="line.3814"></a>
-<span class="sourceLineNo">3815</span>   */<a name="line.3815"></a>
-<span class="sourceLineNo">3816</span>  private boolean isFlushSize(final long size) {<a name="line.3816"></a>
-<span class="sourceLineNo">3817</span>    return size &gt; this.memstoreFlushSize;<a name="line.3817"></a>
-<span class="sourceLineNo">3818</span>  }<a name="line.3818"></a>
-<span class="sourceLineNo">3819</span><a name="line.3819"></a>
-<span class="sourceLineNo">3820</span>  /**<a name="line.3820"></a>
-<span class="sourceLineNo">3821</span>   * Read the edits put under this region by wal splitting process.  Put<a name="line.3821"></a>
-<span class="sourceLineNo">3822</span>   * the recovered edits back up into this region.<a name="line.3822"></a>
-<span class="sourceLineNo">3823</span>   *<a name="line.3823"></a>
-<span class="sourceLineNo">3824</span>   * &lt;p&gt;We can ignore any wal message that has a sequence ID that's equal to or<a name="line.3824"></a>
-<span class="sourceLineNo">3825</span>   * lower than minSeqId.  (Because we know such messages are already<a name="line.3825"></a>
-<span class="sourceLineNo">3826</span>   * reflected in the HFiles.)<a name="line.3826"></a>
-<span class="sourceLineNo">3827</span>   *<a name="line.3827"></a>
-<span class="sourceLineNo">3828</span>   * &lt;p&gt;While this is running we are putting pressure on memory yet we are<a name="line.3828"></a>
-<span class="sourceLineNo">3829</span>   * outside of our usual accounting because we are not yet an onlined region<a name="line.3829"></a>
-<span class="sourceLineNo">3830</span>   * (this stuff is being run as part of Region initialization).  This means<a name="line.3830"></a>
-<span class="sourceLineNo">3831</span>   * that if we're up against global memory limits, we'll not be flagged to flush<a name="line.3831"></a>
-<span class="sourceLineNo">3832</span>   * because we are not online. We can't be flushed by usual mechanisms anyways;<a name="line.3832"></a>
-<span class="sourceLineNo">3833</span>   * we're not yet online so our relative sequenceids are not yet aligned with<a name="line.3833"></a>
-<span class="sourceLineNo">3834</span>   * WAL sequenceids -- not till we come up online, post processing of split<a name="line.3834"></a>
-<span class="sourceLineNo">3835</span>   * edits.<a name="line.3835"></a>
-<span class="sourceLineNo">3836</span>   *<a name="line.3836"></a>
-<span class="sourceLineNo">3837</span>   * &lt;p&gt;But to help relieve memory pressure, at least manage our own heap size<a name="line.3837"></a>
-<span class="sourceLineNo">3838</span>   * flushing if are in excess of per-region limits.  Flushing, though, we have<a name="line.3838"></a>
-<span class="sourceLineNo">3839</span>   * to be careful and avoid using the regionserver/wal sequenceid.  Its running<a name="line.3839"></a>
-<span class="sourceLineNo">3840</span>   * on a different line to whats going on in here in this region context so if we<a name="line.3840"></a>
-<span class="sourceLineNo">3841</span>   * crashed replaying these edits, but in the midst had a flush that used the<a name="line.3841"></a>
-<span class="sourceLineNo">3842</span>   * regio

<TRUNCATED>

Mime
View raw message