hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mi...@apache.org
Subject [07/51] [partial] hbase git commit: Published site at 86be690b0723e814a655ad0ae8a6577d7111c1f2.
Date Sun, 22 Nov 2015 22:40:17 GMT
http://git-wip-us.apache.org/repos/asf/hbase/blob/155d5cd0/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannersCloseCallBack.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannersCloseCallBack.html b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannersCloseCallBack.html
index 9959b14..ab1be3a 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannersCloseCallBack.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/regionserver/RSRpcServices.RegionScannersCloseCallBack.html
@@ -1802,946 +1802,948 @@
 <span class="sourceLineNo">1794</span>  public ReplicateWALEntryResponse replicateWALEntry(final RpcController controller,<a name="line.1794"></a>
 <span class="sourceLineNo">1795</span>      final ReplicateWALEntryRequest request) throws ServiceException {<a name="line.1795"></a>
 <span class="sourceLineNo">1796</span>    try {<a name="line.1796"></a>
-<span class="sourceLineNo">1797</span>      if (regionServer.replicationSinkHandler != null) {<a name="line.1797"></a>
-<span class="sourceLineNo">1798</span>        checkOpen();<a name="line.1798"></a>
+<span class="sourceLineNo">1797</span>      checkOpen();<a name="line.1797"></a>
+<span class="sourceLineNo">1798</span>      if (regionServer.replicationSinkHandler != null) {<a name="line.1798"></a>
 <span class="sourceLineNo">1799</span>        requestCount.increment();<a name="line.1799"></a>
 <span class="sourceLineNo">1800</span>        List&lt;WALEntry&gt; entries = request.getEntryList();<a name="line.1800"></a>
 <span class="sourceLineNo">1801</span>        CellScanner cellScanner = ((PayloadCarryingRpcController)controller).cellScanner();<a name="line.1801"></a>
 <span class="sourceLineNo">1802</span>        regionServer.getRegionServerCoprocessorHost().preReplicateLogEntries(entries, cellScanner);<a name="line.1802"></a>
 <span class="sourceLineNo">1803</span>        regionServer.replicationSinkHandler.replicateLogEntries(entries, cellScanner);<a name="line.1803"></a>
 <span class="sourceLineNo">1804</span>        regionServer.getRegionServerCoprocessorHost().postReplicateLogEntries(entries, cellScanner);<a name="line.1804"></a>
-<span class="sourceLineNo">1805</span>      }<a name="line.1805"></a>
-<span class="sourceLineNo">1806</span>      return ReplicateWALEntryResponse.newBuilder().build();<a name="line.1806"></a>
-<span class="sourceLineNo">1807</span>    } catch (IOException ie) {<a name="line.1807"></a>
-<span class="sourceLineNo">1808</span>      throw new ServiceException(ie);<a name="line.1808"></a>
-<span class="sourceLineNo">1809</span>    }<a name="line.1809"></a>
-<span class="sourceLineNo">1810</span>  }<a name="line.1810"></a>
-<span class="sourceLineNo">1811</span><a name="line.1811"></a>
-<span class="sourceLineNo">1812</span>  /**<a name="line.1812"></a>
-<span class="sourceLineNo">1813</span>   * Roll the WAL writer of the region server.<a name="line.1813"></a>
-<span class="sourceLineNo">1814</span>   * @param controller the RPC controller<a name="line.1814"></a>
-<span class="sourceLineNo">1815</span>   * @param request the request<a name="line.1815"></a>
-<span class="sourceLineNo">1816</span>   * @throws ServiceException<a name="line.1816"></a>
-<span class="sourceLineNo">1817</span>   */<a name="line.1817"></a>
-<span class="sourceLineNo">1818</span>  @Override<a name="line.1818"></a>
-<span class="sourceLineNo">1819</span>  public RollWALWriterResponse rollWALWriter(final RpcController controller,<a name="line.1819"></a>
-<span class="sourceLineNo">1820</span>      final RollWALWriterRequest request) throws ServiceException {<a name="line.1820"></a>
-<span class="sourceLineNo">1821</span>    try {<a name="line.1821"></a>
-<span class="sourceLineNo">1822</span>      checkOpen();<a name="line.1822"></a>
-<span class="sourceLineNo">1823</span>      requestCount.increment();<a name="line.1823"></a>
-<span class="sourceLineNo">1824</span>      regionServer.getRegionServerCoprocessorHost().preRollWALWriterRequest();<a name="line.1824"></a>
-<span class="sourceLineNo">1825</span>      regionServer.walRoller.requestRollAll();<a name="line.1825"></a>
-<span class="sourceLineNo">1826</span>      regionServer.getRegionServerCoprocessorHost().postRollWALWriterRequest();<a name="line.1826"></a>
-<span class="sourceLineNo">1827</span>      RollWALWriterResponse.Builder builder = RollWALWriterResponse.newBuilder();<a name="line.1827"></a>
-<span class="sourceLineNo">1828</span>      return builder.build();<a name="line.1828"></a>
-<span class="sourceLineNo">1829</span>    } catch (IOException ie) {<a name="line.1829"></a>
-<span class="sourceLineNo">1830</span>      throw new ServiceException(ie);<a name="line.1830"></a>
-<span class="sourceLineNo">1831</span>    }<a name="line.1831"></a>
-<span class="sourceLineNo">1832</span>  }<a name="line.1832"></a>
-<span class="sourceLineNo">1833</span><a name="line.1833"></a>
-<span class="sourceLineNo">1834</span>  /**<a name="line.1834"></a>
-<span class="sourceLineNo">1835</span>   * Split a region on the region server.<a name="line.1835"></a>
-<span class="sourceLineNo">1836</span>   *<a name="line.1836"></a>
-<span class="sourceLineNo">1837</span>   * @param controller the RPC controller<a name="line.1837"></a>
-<span class="sourceLineNo">1838</span>   * @param request the request<a name="line.1838"></a>
-<span class="sourceLineNo">1839</span>   * @throws ServiceException<a name="line.1839"></a>
-<span class="sourceLineNo">1840</span>   */<a name="line.1840"></a>
-<span class="sourceLineNo">1841</span>  @Override<a name="line.1841"></a>
-<span class="sourceLineNo">1842</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1842"></a>
-<span class="sourceLineNo">1843</span>  public SplitRegionResponse splitRegion(final RpcController controller,<a name="line.1843"></a>
-<span class="sourceLineNo">1844</span>      final SplitRegionRequest request) throws ServiceException {<a name="line.1844"></a>
-<span class="sourceLineNo">1845</span>    try {<a name="line.1845"></a>
-<span class="sourceLineNo">1846</span>      checkOpen();<a name="line.1846"></a>
-<span class="sourceLineNo">1847</span>      requestCount.increment();<a name="line.1847"></a>
-<span class="sourceLineNo">1848</span>      Region region = getRegion(request.getRegion());<a name="line.1848"></a>
-<span class="sourceLineNo">1849</span>      region.startRegionOperation(Operation.SPLIT_REGION);<a name="line.1849"></a>
-<span class="sourceLineNo">1850</span>      if (region.getRegionInfo().getReplicaId() != HRegionInfo.DEFAULT_REPLICA_ID) {<a name="line.1850"></a>
-<span class="sourceLineNo">1851</span>        throw new IOException("Can't split replicas directly. "<a name="line.1851"></a>
-<span class="sourceLineNo">1852</span>            + "Replicas are auto-split when their primary is split.");<a name="line.1852"></a>
-<span class="sourceLineNo">1853</span>      }<a name="line.1853"></a>
-<span class="sourceLineNo">1854</span>      LOG.info("Splitting " + region.getRegionInfo().getRegionNameAsString());<a name="line.1854"></a>
-<span class="sourceLineNo">1855</span>      long startTime = EnvironmentEdgeManager.currentTime();<a name="line.1855"></a>
-<span class="sourceLineNo">1856</span>      FlushResult flushResult = region.flush(true);<a name="line.1856"></a>
-<span class="sourceLineNo">1857</span>      if (flushResult.isFlushSucceeded()) {<a name="line.1857"></a>
-<span class="sourceLineNo">1858</span>        long endTime = EnvironmentEdgeManager.currentTime();<a name="line.1858"></a>
-<span class="sourceLineNo">1859</span>        regionServer.metricsRegionServer.updateFlushTime(endTime - startTime);<a name="line.1859"></a>
-<span class="sourceLineNo">1860</span>      }<a name="line.1860"></a>
-<span class="sourceLineNo">1861</span>      byte[] splitPoint = null;<a name="line.1861"></a>
-<span class="sourceLineNo">1862</span>      if (request.hasSplitPoint()) {<a name="line.1862"></a>
-<span class="sourceLineNo">1863</span>        splitPoint = request.getSplitPoint().toByteArray();<a name="line.1863"></a>
-<span class="sourceLineNo">1864</span>      }<a name="line.1864"></a>
-<span class="sourceLineNo">1865</span>      ((HRegion)region).forceSplit(splitPoint);<a name="line.1865"></a>
-<span class="sourceLineNo">1866</span>      regionServer.compactSplitThread.requestSplit(region, ((HRegion)region).checkSplit(),<a name="line.1866"></a>
-<span class="sourceLineNo">1867</span>        RpcServer.getRequestUser());<a name="line.1867"></a>
-<span class="sourceLineNo">1868</span>      return SplitRegionResponse.newBuilder().build();<a name="line.1868"></a>
-<span class="sourceLineNo">1869</span>    } catch (DroppedSnapshotException ex) {<a name="line.1869"></a>
-<span class="sourceLineNo">1870</span>      regionServer.abort("Replay of WAL required. Forcing server shutdown", ex);<a name="line.1870"></a>
-<span class="sourceLineNo">1871</span>      throw new ServiceException(ex);<a name="line.1871"></a>
-<span class="sourceLineNo">1872</span>    } catch (IOException ie) {<a name="line.1872"></a>
-<span class="sourceLineNo">1873</span>      throw new ServiceException(ie);<a name="line.1873"></a>
-<span class="sourceLineNo">1874</span>    }<a name="line.1874"></a>
-<span class="sourceLineNo">1875</span>  }<a name="line.1875"></a>
-<span class="sourceLineNo">1876</span><a name="line.1876"></a>
-<span class="sourceLineNo">1877</span>  /**<a name="line.1877"></a>
-<span class="sourceLineNo">1878</span>   * Stop the region server.<a name="line.1878"></a>
-<span class="sourceLineNo">1879</span>   *<a name="line.1879"></a>
-<span class="sourceLineNo">1880</span>   * @param controller the RPC controller<a name="line.1880"></a>
-<span class="sourceLineNo">1881</span>   * @param request the request<a name="line.1881"></a>
-<span class="sourceLineNo">1882</span>   * @throws ServiceException<a name="line.1882"></a>
-<span class="sourceLineNo">1883</span>   */<a name="line.1883"></a>
-<span class="sourceLineNo">1884</span>  @Override<a name="line.1884"></a>
-<span class="sourceLineNo">1885</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1885"></a>
-<span class="sourceLineNo">1886</span>  public StopServerResponse stopServer(final RpcController controller,<a name="line.1886"></a>
-<span class="sourceLineNo">1887</span>      final StopServerRequest request) throws ServiceException {<a name="line.1887"></a>
-<span class="sourceLineNo">1888</span>    requestCount.increment();<a name="line.1888"></a>
-<span class="sourceLineNo">1889</span>    String reason = request.getReason();<a name="line.1889"></a>
-<span class="sourceLineNo">1890</span>    regionServer.stop(reason);<a name="line.1890"></a>
-<span class="sourceLineNo">1891</span>    return StopServerResponse.newBuilder().build();<a name="line.1891"></a>
-<span class="sourceLineNo">1892</span>  }<a name="line.1892"></a>
-<span class="sourceLineNo">1893</span><a name="line.1893"></a>
-<span class="sourceLineNo">1894</span>  @Override<a name="line.1894"></a>
-<span class="sourceLineNo">1895</span>  public UpdateFavoredNodesResponse updateFavoredNodes(RpcController controller,<a name="line.1895"></a>
-<span class="sourceLineNo">1896</span>      UpdateFavoredNodesRequest request) throws ServiceException {<a name="line.1896"></a>
-<span class="sourceLineNo">1897</span>    List&lt;UpdateFavoredNodesRequest.RegionUpdateInfo&gt; openInfoList = request.getUpdateInfoList();<a name="line.1897"></a>
-<span class="sourceLineNo">1898</span>    UpdateFavoredNodesResponse.Builder respBuilder = UpdateFavoredNodesResponse.newBuilder();<a name="line.1898"></a>
-<span class="sourceLineNo">1899</span>    for (UpdateFavoredNodesRequest.RegionUpdateInfo regionUpdateInfo : openInfoList) {<a name="line.1899"></a>
-<span class="sourceLineNo">1900</span>      HRegionInfo hri = HRegionInfo.convert(regionUpdateInfo.getRegion());<a name="line.1900"></a>
-<span class="sourceLineNo">1901</span>      regionServer.updateRegionFavoredNodesMapping(hri.getEncodedName(),<a name="line.1901"></a>
-<span class="sourceLineNo">1902</span>        regionUpdateInfo.getFavoredNodesList());<a name="line.1902"></a>
-<span class="sourceLineNo">1903</span>    }<a name="line.1903"></a>
-<span class="sourceLineNo">1904</span>    respBuilder.setResponse(openInfoList.size());<a name="line.1904"></a>
-<span class="sourceLineNo">1905</span>    return respBuilder.build();<a name="line.1905"></a>
-<span class="sourceLineNo">1906</span>  }<a name="line.1906"></a>
-<span class="sourceLineNo">1907</span><a name="line.1907"></a>
-<span class="sourceLineNo">1908</span>  /**<a name="line.1908"></a>
-<span class="sourceLineNo">1909</span>   * Atomically bulk load several HFiles into an open region<a name="line.1909"></a>
-<span class="sourceLineNo">1910</span>   * @return true if successful, false is failed but recoverably (no action)<a name="line.1910"></a>
-<span class="sourceLineNo">1911</span>   * @throws ServiceException if failed unrecoverably<a name="line.1911"></a>
-<span class="sourceLineNo">1912</span>   */<a name="line.1912"></a>
-<span class="sourceLineNo">1913</span>  @Override<a name="line.1913"></a>
-<span class="sourceLineNo">1914</span>  public BulkLoadHFileResponse bulkLoadHFile(final RpcController controller,<a name="line.1914"></a>
-<span class="sourceLineNo">1915</span>      final BulkLoadHFileRequest request) throws ServiceException {<a name="line.1915"></a>
-<span class="sourceLineNo">1916</span>    try {<a name="line.1916"></a>
-<span class="sourceLineNo">1917</span>      checkOpen();<a name="line.1917"></a>
-<span class="sourceLineNo">1918</span>      requestCount.increment();<a name="line.1918"></a>
-<span class="sourceLineNo">1919</span>      Region region = getRegion(request.getRegion());<a name="line.1919"></a>
-<span class="sourceLineNo">1920</span>      List&lt;Pair&lt;byte[], String&gt;&gt; familyPaths = new ArrayList&lt;Pair&lt;byte[], String&gt;&gt;();<a name="line.1920"></a>
-<span class="sourceLineNo">1921</span>      for (FamilyPath familyPath: request.getFamilyPathList()) {<a name="line.1921"></a>
-<span class="sourceLineNo">1922</span>        familyPaths.add(new Pair&lt;byte[], String&gt;(familyPath.getFamily().toByteArray(),<a name="line.1922"></a>
-<span class="sourceLineNo">1923</span>          familyPath.getPath()));<a name="line.1923"></a>
-<span class="sourceLineNo">1924</span>      }<a name="line.1924"></a>
-<span class="sourceLineNo">1925</span>      boolean bypass = false;<a name="line.1925"></a>
-<span class="sourceLineNo">1926</span>      if (region.getCoprocessorHost() != null) {<a name="line.1926"></a>
-<span class="sourceLineNo">1927</span>        bypass = region.getCoprocessorHost().preBulkLoadHFile(familyPaths);<a name="line.1927"></a>
-<span class="sourceLineNo">1928</span>      }<a name="line.1928"></a>
-<span class="sourceLineNo">1929</span>      boolean loaded = false;<a name="line.1929"></a>
-<span class="sourceLineNo">1930</span>      if (!bypass) {<a name="line.1930"></a>
-<span class="sourceLineNo">1931</span>        loaded = region.bulkLoadHFiles(familyPaths, request.getAssignSeqNum(), null);<a name="line.1931"></a>
-<span class="sourceLineNo">1932</span>      }<a name="line.1932"></a>
-<span class="sourceLineNo">1933</span>      if (region.getCoprocessorHost() != null) {<a name="line.1933"></a>
-<span class="sourceLineNo">1934</span>        loaded = region.getCoprocessorHost().postBulkLoadHFile(familyPaths, loaded);<a name="line.1934"></a>
-<span class="sourceLineNo">1935</span>      }<a name="line.1935"></a>
-<span class="sourceLineNo">1936</span>      BulkLoadHFileResponse.Builder builder = BulkLoadHFileResponse.newBuilder();<a name="line.1936"></a>
-<span class="sourceLineNo">1937</span>      builder.setLoaded(loaded);<a name="line.1937"></a>
-<span class="sourceLineNo">1938</span>      return builder.build();<a name="line.1938"></a>
-<span class="sourceLineNo">1939</span>    } catch (IOException ie) {<a name="line.1939"></a>
-<span class="sourceLineNo">1940</span>      throw new ServiceException(ie);<a name="line.1940"></a>
-<span class="sourceLineNo">1941</span>    }<a name="line.1941"></a>
-<span class="sourceLineNo">1942</span>  }<a name="line.1942"></a>
-<span class="sourceLineNo">1943</span><a name="line.1943"></a>
-<span class="sourceLineNo">1944</span>  @Override<a name="line.1944"></a>
-<span class="sourceLineNo">1945</span>  public CoprocessorServiceResponse execService(final RpcController controller,<a name="line.1945"></a>
-<span class="sourceLineNo">1946</span>      final CoprocessorServiceRequest request) throws ServiceException {<a name="line.1946"></a>
-<span class="sourceLineNo">1947</span>    try {<a name="line.1947"></a>
-<span class="sourceLineNo">1948</span>      checkOpen();<a name="line.1948"></a>
-<span class="sourceLineNo">1949</span>      requestCount.increment();<a name="line.1949"></a>
-<span class="sourceLineNo">1950</span>      Region region = getRegion(request.getRegion());<a name="line.1950"></a>
-<span class="sourceLineNo">1951</span>      Message result = execServiceOnRegion(region, request.getCall());<a name="line.1951"></a>
-<span class="sourceLineNo">1952</span>      CoprocessorServiceResponse.Builder builder =<a name="line.1952"></a>
-<span class="sourceLineNo">1953</span>        CoprocessorServiceResponse.newBuilder();<a name="line.1953"></a>
-<span class="sourceLineNo">1954</span>      builder.setRegion(RequestConverter.buildRegionSpecifier(<a name="line.1954"></a>
-<span class="sourceLineNo">1955</span>        RegionSpecifierType.REGION_NAME, region.getRegionInfo().getRegionName()));<a name="line.1955"></a>
-<span class="sourceLineNo">1956</span>      builder.setValue(<a name="line.1956"></a>
-<span class="sourceLineNo">1957</span>        builder.getValueBuilder().setName(result.getClass().getName())<a name="line.1957"></a>
-<span class="sourceLineNo">1958</span>          .setValue(result.toByteString()));<a name="line.1958"></a>
-<span class="sourceLineNo">1959</span>      return builder.build();<a name="line.1959"></a>
-<span class="sourceLineNo">1960</span>    } catch (IOException ie) {<a name="line.1960"></a>
-<span class="sourceLineNo">1961</span>      throw new ServiceException(ie);<a name="line.1961"></a>
-<span class="sourceLineNo">1962</span>    }<a name="line.1962"></a>
-<span class="sourceLineNo">1963</span>  }<a name="line.1963"></a>
-<span class="sourceLineNo">1964</span><a name="line.1964"></a>
-<span class="sourceLineNo">1965</span>  private Message execServiceOnRegion(Region region,<a name="line.1965"></a>
-<span class="sourceLineNo">1966</span>      final ClientProtos.CoprocessorServiceCall serviceCall) throws IOException {<a name="line.1966"></a>
-<span class="sourceLineNo">1967</span>    // ignore the passed in controller (from the serialized call)<a name="line.1967"></a>
-<span class="sourceLineNo">1968</span>    ServerRpcController execController = new ServerRpcController();<a name="line.1968"></a>
-<span class="sourceLineNo">1969</span>    return region.execService(execController, serviceCall);<a name="line.1969"></a>
-<span class="sourceLineNo">1970</span>  }<a name="line.1970"></a>
-<span class="sourceLineNo">1971</span><a name="line.1971"></a>
-<span class="sourceLineNo">1972</span>  /**<a name="line.1972"></a>
-<span class="sourceLineNo">1973</span>   * Get data from a table.<a name="line.1973"></a>
-<span class="sourceLineNo">1974</span>   *<a name="line.1974"></a>
-<span class="sourceLineNo">1975</span>   * @param controller the RPC controller<a name="line.1975"></a>
-<span class="sourceLineNo">1976</span>   * @param request the get request<a name="line.1976"></a>
-<span class="sourceLineNo">1977</span>   * @throws ServiceException<a name="line.1977"></a>
-<span class="sourceLineNo">1978</span>   */<a name="line.1978"></a>
-<span class="sourceLineNo">1979</span>  @Override<a name="line.1979"></a>
-<span class="sourceLineNo">1980</span>  public GetResponse get(final RpcController controller,<a name="line.1980"></a>
-<span class="sourceLineNo">1981</span>      final GetRequest request) throws ServiceException {<a name="line.1981"></a>
-<span class="sourceLineNo">1982</span>    long before = EnvironmentEdgeManager.currentTime();<a name="line.1982"></a>
-<span class="sourceLineNo">1983</span>    OperationQuota quota = null;<a name="line.1983"></a>
-<span class="sourceLineNo">1984</span>    try {<a name="line.1984"></a>
-<span class="sourceLineNo">1985</span>      checkOpen();<a name="line.1985"></a>
-<span class="sourceLineNo">1986</span>      requestCount.increment();<a name="line.1986"></a>
-<span class="sourceLineNo">1987</span>      Region region = getRegion(request.getRegion());<a name="line.1987"></a>
-<span class="sourceLineNo">1988</span><a name="line.1988"></a>
-<span class="sourceLineNo">1989</span>      GetResponse.Builder builder = GetResponse.newBuilder();<a name="line.1989"></a>
-<span class="sourceLineNo">1990</span>      ClientProtos.Get get = request.getGet();<a name="line.1990"></a>
-<span class="sourceLineNo">1991</span>      Boolean existence = null;<a name="line.1991"></a>
-<span class="sourceLineNo">1992</span>      Result r = null;<a name="line.1992"></a>
-<span class="sourceLineNo">1993</span>      RpcCallContext context = RpcServer.getCurrentCall();<a name="line.1993"></a>
-<span class="sourceLineNo">1994</span>      quota = getQuotaManager().checkQuota(region, OperationQuota.OperationType.GET);<a name="line.1994"></a>
-<span class="sourceLineNo">1995</span><a name="line.1995"></a>
-<span class="sourceLineNo">1996</span>      Get clientGet = ProtobufUtil.toGet(get);<a name="line.1996"></a>
-<span class="sourceLineNo">1997</span>      if (get.getExistenceOnly() &amp;&amp; region.getCoprocessorHost() != null) {<a name="line.1997"></a>
-<span class="sourceLineNo">1998</span>        existence = region.getCoprocessorHost().preExists(clientGet);<a name="line.1998"></a>
-<span class="sourceLineNo">1999</span>      }<a name="line.1999"></a>
-<span class="sourceLineNo">2000</span>      if (existence == null) {<a name="line.2000"></a>
-<span class="sourceLineNo">2001</span>        if (context != null) {<a name="line.2001"></a>
-<span class="sourceLineNo">2002</span>          r = get(clientGet, ((HRegion) region), null, context);<a name="line.2002"></a>
-<span class="sourceLineNo">2003</span>        } else {<a name="line.2003"></a>
-<span class="sourceLineNo">2004</span>          // for test purpose<a name="line.2004"></a>
-<span class="sourceLineNo">2005</span>          r = region.get(clientGet);<a name="line.2005"></a>
-<span class="sourceLineNo">2006</span>        }<a name="line.2006"></a>
-<span class="sourceLineNo">2007</span>        if (get.getExistenceOnly()) {<a name="line.2007"></a>
-<span class="sourceLineNo">2008</span>          boolean exists = r.getExists();<a name="line.2008"></a>
-<span class="sourceLineNo">2009</span>          if (region.getCoprocessorHost() != null) {<a name="line.2009"></a>
-<span class="sourceLineNo">2010</span>            exists = region.getCoprocessorHost().postExists(clientGet, exists);<a name="line.2010"></a>
-<span class="sourceLineNo">2011</span>          }<a name="line.2011"></a>
-<span class="sourceLineNo">2012</span>          existence = exists;<a name="line.2012"></a>
-<span class="sourceLineNo">2013</span>        }<a name="line.2013"></a>
-<span class="sourceLineNo">2014</span>      }<a name="line.2014"></a>
-<span class="sourceLineNo">2015</span>      if (existence != null) {<a name="line.2015"></a>
-<span class="sourceLineNo">2016</span>        ClientProtos.Result pbr =<a name="line.2016"></a>
-<span class="sourceLineNo">2017</span>            ProtobufUtil.toResult(existence, region.getRegionInfo().getReplicaId() != 0);<a name="line.2017"></a>
-<span class="sourceLineNo">2018</span>        builder.setResult(pbr);<a name="line.2018"></a>
-<span class="sourceLineNo">2019</span>      } else if (r != null) {<a name="line.2019"></a>
-<span class="sourceLineNo">2020</span>        ClientProtos.Result pbr = ProtobufUtil.toResult(r);<a name="line.2020"></a>
-<span class="sourceLineNo">2021</span>        builder.setResult(pbr);<a name="line.2021"></a>
-<span class="sourceLineNo">2022</span>      }<a name="line.2022"></a>
-<span class="sourceLineNo">2023</span>      if (r != null) {<a name="line.2023"></a>
-<span class="sourceLineNo">2024</span>        quota.addGetResult(r);<a name="line.2024"></a>
-<span class="sourceLineNo">2025</span>      }<a name="line.2025"></a>
-<span class="sourceLineNo">2026</span>      return builder.build();<a name="line.2026"></a>
-<span class="sourceLineNo">2027</span>    } catch (IOException ie) {<a name="line.2027"></a>
-<span class="sourceLineNo">2028</span>      throw new ServiceException(ie);<a name="line.2028"></a>
-<span class="sourceLineNo">2029</span>    } finally {<a name="line.2029"></a>
-<span class="sourceLineNo">2030</span>      if (regionServer.metricsRegionServer != null) {<a name="line.2030"></a>
-<span class="sourceLineNo">2031</span>        regionServer.metricsRegionServer.updateGet(EnvironmentEdgeManager.currentTime() - before);<a name="line.2031"></a>
-<span class="sourceLineNo">2032</span>      }<a name="line.2032"></a>
-<span class="sourceLineNo">2033</span>      if (quota != null) {<a name="line.2033"></a>
-<span class="sourceLineNo">2034</span>        quota.close();<a name="line.2034"></a>
-<span class="sourceLineNo">2035</span>      }<a name="line.2035"></a>
-<span class="sourceLineNo">2036</span>    }<a name="line.2036"></a>
-<span class="sourceLineNo">2037</span>  }<a name="line.2037"></a>
-<span class="sourceLineNo">2038</span><a name="line.2038"></a>
-<span class="sourceLineNo">2039</span>  private Result get(Get get, HRegion region, RegionScannersCloseCallBack closeCallBack,<a name="line.2039"></a>
-<span class="sourceLineNo">2040</span>      RpcCallContext context) throws IOException {<a name="line.2040"></a>
-<span class="sourceLineNo">2041</span>    region.prepareGet(get);<a name="line.2041"></a>
-<span class="sourceLineNo">2042</span>    List&lt;Cell&gt; results = new ArrayList&lt;Cell&gt;();<a name="line.2042"></a>
-<span class="sourceLineNo">2043</span>    boolean stale = region.getRegionInfo().getReplicaId() != 0;<a name="line.2043"></a>
-<span class="sourceLineNo">2044</span>    // pre-get CP hook<a name="line.2044"></a>
-<span class="sourceLineNo">2045</span>    if (region.getCoprocessorHost() != null) {<a name="line.2045"></a>
-<span class="sourceLineNo">2046</span>      if (region.getCoprocessorHost().preGet(get, results)) {<a name="line.2046"></a>
-<span class="sourceLineNo">2047</span>        return Result<a name="line.2047"></a>
-<span class="sourceLineNo">2048</span>            .create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : null, stale);<a name="line.2048"></a>
-<span class="sourceLineNo">2049</span>      }<a name="line.2049"></a>
-<span class="sourceLineNo">2050</span>    }<a name="line.2050"></a>
-<span class="sourceLineNo">2051</span><a name="line.2051"></a>
-<span class="sourceLineNo">2052</span>    Scan scan = new Scan(get);<a name="line.2052"></a>
+<span class="sourceLineNo">1805</span>        return ReplicateWALEntryResponse.newBuilder().build();<a name="line.1805"></a>
+<span class="sourceLineNo">1806</span>      } else {<a name="line.1806"></a>
+<span class="sourceLineNo">1807</span>        throw new ServiceException("Replication services are not initialized yet");<a name="line.1807"></a>
+<span class="sourceLineNo">1808</span>      }<a name="line.1808"></a>
+<span class="sourceLineNo">1809</span>    } catch (IOException ie) {<a name="line.1809"></a>
+<span class="sourceLineNo">1810</span>      throw new ServiceException(ie);<a name="line.1810"></a>
+<span class="sourceLineNo">1811</span>    }<a name="line.1811"></a>
+<span class="sourceLineNo">1812</span>  }<a name="line.1812"></a>
+<span class="sourceLineNo">1813</span><a name="line.1813"></a>
+<span class="sourceLineNo">1814</span>  /**<a name="line.1814"></a>
+<span class="sourceLineNo">1815</span>   * Roll the WAL writer of the region server.<a name="line.1815"></a>
+<span class="sourceLineNo">1816</span>   * @param controller the RPC controller<a name="line.1816"></a>
+<span class="sourceLineNo">1817</span>   * @param request the request<a name="line.1817"></a>
+<span class="sourceLineNo">1818</span>   * @throws ServiceException<a name="line.1818"></a>
+<span class="sourceLineNo">1819</span>   */<a name="line.1819"></a>
+<span class="sourceLineNo">1820</span>  @Override<a name="line.1820"></a>
+<span class="sourceLineNo">1821</span>  public RollWALWriterResponse rollWALWriter(final RpcController controller,<a name="line.1821"></a>
+<span class="sourceLineNo">1822</span>      final RollWALWriterRequest request) throws ServiceException {<a name="line.1822"></a>
+<span class="sourceLineNo">1823</span>    try {<a name="line.1823"></a>
+<span class="sourceLineNo">1824</span>      checkOpen();<a name="line.1824"></a>
+<span class="sourceLineNo">1825</span>      requestCount.increment();<a name="line.1825"></a>
+<span class="sourceLineNo">1826</span>      regionServer.getRegionServerCoprocessorHost().preRollWALWriterRequest();<a name="line.1826"></a>
+<span class="sourceLineNo">1827</span>      regionServer.walRoller.requestRollAll();<a name="line.1827"></a>
+<span class="sourceLineNo">1828</span>      regionServer.getRegionServerCoprocessorHost().postRollWALWriterRequest();<a name="line.1828"></a>
+<span class="sourceLineNo">1829</span>      RollWALWriterResponse.Builder builder = RollWALWriterResponse.newBuilder();<a name="line.1829"></a>
+<span class="sourceLineNo">1830</span>      return builder.build();<a name="line.1830"></a>
+<span class="sourceLineNo">1831</span>    } catch (IOException ie) {<a name="line.1831"></a>
+<span class="sourceLineNo">1832</span>      throw new ServiceException(ie);<a name="line.1832"></a>
+<span class="sourceLineNo">1833</span>    }<a name="line.1833"></a>
+<span class="sourceLineNo">1834</span>  }<a name="line.1834"></a>
+<span class="sourceLineNo">1835</span><a name="line.1835"></a>
+<span class="sourceLineNo">1836</span>  /**<a name="line.1836"></a>
+<span class="sourceLineNo">1837</span>   * Split a region on the region server.<a name="line.1837"></a>
+<span class="sourceLineNo">1838</span>   *<a name="line.1838"></a>
+<span class="sourceLineNo">1839</span>   * @param controller the RPC controller<a name="line.1839"></a>
+<span class="sourceLineNo">1840</span>   * @param request the request<a name="line.1840"></a>
+<span class="sourceLineNo">1841</span>   * @throws ServiceException<a name="line.1841"></a>
+<span class="sourceLineNo">1842</span>   */<a name="line.1842"></a>
+<span class="sourceLineNo">1843</span>  @Override<a name="line.1843"></a>
+<span class="sourceLineNo">1844</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1844"></a>
+<span class="sourceLineNo">1845</span>  public SplitRegionResponse splitRegion(final RpcController controller,<a name="line.1845"></a>
+<span class="sourceLineNo">1846</span>      final SplitRegionRequest request) throws ServiceException {<a name="line.1846"></a>
+<span class="sourceLineNo">1847</span>    try {<a name="line.1847"></a>
+<span class="sourceLineNo">1848</span>      checkOpen();<a name="line.1848"></a>
+<span class="sourceLineNo">1849</span>      requestCount.increment();<a name="line.1849"></a>
+<span class="sourceLineNo">1850</span>      Region region = getRegion(request.getRegion());<a name="line.1850"></a>
+<span class="sourceLineNo">1851</span>      region.startRegionOperation(Operation.SPLIT_REGION);<a name="line.1851"></a>
+<span class="sourceLineNo">1852</span>      if (region.getRegionInfo().getReplicaId() != HRegionInfo.DEFAULT_REPLICA_ID) {<a name="line.1852"></a>
+<span class="sourceLineNo">1853</span>        throw new IOException("Can't split replicas directly. "<a name="line.1853"></a>
+<span class="sourceLineNo">1854</span>            + "Replicas are auto-split when their primary is split.");<a name="line.1854"></a>
+<span class="sourceLineNo">1855</span>      }<a name="line.1855"></a>
+<span class="sourceLineNo">1856</span>      LOG.info("Splitting " + region.getRegionInfo().getRegionNameAsString());<a name="line.1856"></a>
+<span class="sourceLineNo">1857</span>      long startTime = EnvironmentEdgeManager.currentTime();<a name="line.1857"></a>
+<span class="sourceLineNo">1858</span>      FlushResult flushResult = region.flush(true);<a name="line.1858"></a>
+<span class="sourceLineNo">1859</span>      if (flushResult.isFlushSucceeded()) {<a name="line.1859"></a>
+<span class="sourceLineNo">1860</span>        long endTime = EnvironmentEdgeManager.currentTime();<a name="line.1860"></a>
+<span class="sourceLineNo">1861</span>        regionServer.metricsRegionServer.updateFlushTime(endTime - startTime);<a name="line.1861"></a>
+<span class="sourceLineNo">1862</span>      }<a name="line.1862"></a>
+<span class="sourceLineNo">1863</span>      byte[] splitPoint = null;<a name="line.1863"></a>
+<span class="sourceLineNo">1864</span>      if (request.hasSplitPoint()) {<a name="line.1864"></a>
+<span class="sourceLineNo">1865</span>        splitPoint = request.getSplitPoint().toByteArray();<a name="line.1865"></a>
+<span class="sourceLineNo">1866</span>      }<a name="line.1866"></a>
+<span class="sourceLineNo">1867</span>      ((HRegion)region).forceSplit(splitPoint);<a name="line.1867"></a>
+<span class="sourceLineNo">1868</span>      regionServer.compactSplitThread.requestSplit(region, ((HRegion)region).checkSplit(),<a name="line.1868"></a>
+<span class="sourceLineNo">1869</span>        RpcServer.getRequestUser());<a name="line.1869"></a>
+<span class="sourceLineNo">1870</span>      return SplitRegionResponse.newBuilder().build();<a name="line.1870"></a>
+<span class="sourceLineNo">1871</span>    } catch (DroppedSnapshotException ex) {<a name="line.1871"></a>
+<span class="sourceLineNo">1872</span>      regionServer.abort("Replay of WAL required. Forcing server shutdown", ex);<a name="line.1872"></a>
+<span class="sourceLineNo">1873</span>      throw new ServiceException(ex);<a name="line.1873"></a>
+<span class="sourceLineNo">1874</span>    } catch (IOException ie) {<a name="line.1874"></a>
+<span class="sourceLineNo">1875</span>      throw new ServiceException(ie);<a name="line.1875"></a>
+<span class="sourceLineNo">1876</span>    }<a name="line.1876"></a>
+<span class="sourceLineNo">1877</span>  }<a name="line.1877"></a>
+<span class="sourceLineNo">1878</span><a name="line.1878"></a>
+<span class="sourceLineNo">1879</span>  /**<a name="line.1879"></a>
+<span class="sourceLineNo">1880</span>   * Stop the region server.<a name="line.1880"></a>
+<span class="sourceLineNo">1881</span>   *<a name="line.1881"></a>
+<span class="sourceLineNo">1882</span>   * @param controller the RPC controller<a name="line.1882"></a>
+<span class="sourceLineNo">1883</span>   * @param request the request<a name="line.1883"></a>
+<span class="sourceLineNo">1884</span>   * @throws ServiceException<a name="line.1884"></a>
+<span class="sourceLineNo">1885</span>   */<a name="line.1885"></a>
+<span class="sourceLineNo">1886</span>  @Override<a name="line.1886"></a>
+<span class="sourceLineNo">1887</span>  @QosPriority(priority=HConstants.ADMIN_QOS)<a name="line.1887"></a>
+<span class="sourceLineNo">1888</span>  public StopServerResponse stopServer(final RpcController controller,<a name="line.1888"></a>
+<span class="sourceLineNo">1889</span>      final StopServerRequest request) throws ServiceException {<a name="line.1889"></a>
+<span class="sourceLineNo">1890</span>    requestCount.increment();<a name="line.1890"></a>
+<span class="sourceLineNo">1891</span>    String reason = request.getReason();<a name="line.1891"></a>
+<span class="sourceLineNo">1892</span>    regionServer.stop(reason);<a name="line.1892"></a>
+<span class="sourceLineNo">1893</span>    return StopServerResponse.newBuilder().build();<a name="line.1893"></a>
+<span class="sourceLineNo">1894</span>  }<a name="line.1894"></a>
+<span class="sourceLineNo">1895</span><a name="line.1895"></a>
+<span class="sourceLineNo">1896</span>  @Override<a name="line.1896"></a>
+<span class="sourceLineNo">1897</span>  public UpdateFavoredNodesResponse updateFavoredNodes(RpcController controller,<a name="line.1897"></a>
+<span class="sourceLineNo">1898</span>      UpdateFavoredNodesRequest request) throws ServiceException {<a name="line.1898"></a>
+<span class="sourceLineNo">1899</span>    List&lt;UpdateFavoredNodesRequest.RegionUpdateInfo&gt; openInfoList = request.getUpdateInfoList();<a name="line.1899"></a>
+<span class="sourceLineNo">1900</span>    UpdateFavoredNodesResponse.Builder respBuilder = UpdateFavoredNodesResponse.newBuilder();<a name="line.1900"></a>
+<span class="sourceLineNo">1901</span>    for (UpdateFavoredNodesRequest.RegionUpdateInfo regionUpdateInfo : openInfoList) {<a name="line.1901"></a>
+<span class="sourceLineNo">1902</span>      HRegionInfo hri = HRegionInfo.convert(regionUpdateInfo.getRegion());<a name="line.1902"></a>
+<span class="sourceLineNo">1903</span>      regionServer.updateRegionFavoredNodesMapping(hri.getEncodedName(),<a name="line.1903"></a>
+<span class="sourceLineNo">1904</span>        regionUpdateInfo.getFavoredNodesList());<a name="line.1904"></a>
+<span class="sourceLineNo">1905</span>    }<a name="line.1905"></a>
+<span class="sourceLineNo">1906</span>    respBuilder.setResponse(openInfoList.size());<a name="line.1906"></a>
+<span class="sourceLineNo">1907</span>    return respBuilder.build();<a name="line.1907"></a>
+<span class="sourceLineNo">1908</span>  }<a name="line.1908"></a>
+<span class="sourceLineNo">1909</span><a name="line.1909"></a>
+<span class="sourceLineNo">1910</span>  /**<a name="line.1910"></a>
+<span class="sourceLineNo">1911</span>   * Atomically bulk load several HFiles into an open region<a name="line.1911"></a>
+<span class="sourceLineNo">1912</span>   * @return true if successful, false is failed but recoverably (no action)<a name="line.1912"></a>
+<span class="sourceLineNo">1913</span>   * @throws ServiceException if failed unrecoverably<a name="line.1913"></a>
+<span class="sourceLineNo">1914</span>   */<a name="line.1914"></a>
+<span class="sourceLineNo">1915</span>  @Override<a name="line.1915"></a>
+<span class="sourceLineNo">1916</span>  public BulkLoadHFileResponse bulkLoadHFile(final RpcController controller,<a name="line.1916"></a>
+<span class="sourceLineNo">1917</span>      final BulkLoadHFileRequest request) throws ServiceException {<a name="line.1917"></a>
+<span class="sourceLineNo">1918</span>    try {<a name="line.1918"></a>
+<span class="sourceLineNo">1919</span>      checkOpen();<a name="line.1919"></a>
+<span class="sourceLineNo">1920</span>      requestCount.increment();<a name="line.1920"></a>
+<span class="sourceLineNo">1921</span>      Region region = getRegion(request.getRegion());<a name="line.1921"></a>
+<span class="sourceLineNo">1922</span>      List&lt;Pair&lt;byte[], String&gt;&gt; familyPaths = new ArrayList&lt;Pair&lt;byte[], String&gt;&gt;();<a name="line.1922"></a>
+<span class="sourceLineNo">1923</span>      for (FamilyPath familyPath: request.getFamilyPathList()) {<a name="line.1923"></a>
+<span class="sourceLineNo">1924</span>        familyPaths.add(new Pair&lt;byte[], String&gt;(familyPath.getFamily().toByteArray(),<a name="line.1924"></a>
+<span class="sourceLineNo">1925</span>          familyPath.getPath()));<a name="line.1925"></a>
+<span class="sourceLineNo">1926</span>      }<a name="line.1926"></a>
+<span class="sourceLineNo">1927</span>      boolean bypass = false;<a name="line.1927"></a>
+<span class="sourceLineNo">1928</span>      if (region.getCoprocessorHost() != null) {<a name="line.1928"></a>
+<span class="sourceLineNo">1929</span>        bypass = region.getCoprocessorHost().preBulkLoadHFile(familyPaths);<a name="line.1929"></a>
+<span class="sourceLineNo">1930</span>      }<a name="line.1930"></a>
+<span class="sourceLineNo">1931</span>      boolean loaded = false;<a name="line.1931"></a>
+<span class="sourceLineNo">1932</span>      if (!bypass) {<a name="line.1932"></a>
+<span class="sourceLineNo">1933</span>        loaded = region.bulkLoadHFiles(familyPaths, request.getAssignSeqNum(), null);<a name="line.1933"></a>
+<span class="sourceLineNo">1934</span>      }<a name="line.1934"></a>
+<span class="sourceLineNo">1935</span>      if (region.getCoprocessorHost() != null) {<a name="line.1935"></a>
+<span class="sourceLineNo">1936</span>        loaded = region.getCoprocessorHost().postBulkLoadHFile(familyPaths, loaded);<a name="line.1936"></a>
+<span class="sourceLineNo">1937</span>      }<a name="line.1937"></a>
+<span class="sourceLineNo">1938</span>      BulkLoadHFileResponse.Builder builder = BulkLoadHFileResponse.newBuilder();<a name="line.1938"></a>
+<span class="sourceLineNo">1939</span>      builder.setLoaded(loaded);<a name="line.1939"></a>
+<span class="sourceLineNo">1940</span>      return builder.build();<a name="line.1940"></a>
+<span class="sourceLineNo">1941</span>    } catch (IOException ie) {<a name="line.1941"></a>
+<span class="sourceLineNo">1942</span>      throw new ServiceException(ie);<a name="line.1942"></a>
+<span class="sourceLineNo">1943</span>    }<a name="line.1943"></a>
+<span class="sourceLineNo">1944</span>  }<a name="line.1944"></a>
+<span class="sourceLineNo">1945</span><a name="line.1945"></a>
+<span class="sourceLineNo">1946</span>  @Override<a name="line.1946"></a>
+<span class="sourceLineNo">1947</span>  public CoprocessorServiceResponse execService(final RpcController controller,<a name="line.1947"></a>
+<span class="sourceLineNo">1948</span>      final CoprocessorServiceRequest request) throws ServiceException {<a name="line.1948"></a>
+<span class="sourceLineNo">1949</span>    try {<a name="line.1949"></a>
+<span class="sourceLineNo">1950</span>      checkOpen();<a name="line.1950"></a>
+<span class="sourceLineNo">1951</span>      requestCount.increment();<a name="line.1951"></a>
+<span class="sourceLineNo">1952</span>      Region region = getRegion(request.getRegion());<a name="line.1952"></a>
+<span class="sourceLineNo">1953</span>      Message result = execServiceOnRegion(region, request.getCall());<a name="line.1953"></a>
+<span class="sourceLineNo">1954</span>      CoprocessorServiceResponse.Builder builder =<a name="line.1954"></a>
+<span class="sourceLineNo">1955</span>        CoprocessorServiceResponse.newBuilder();<a name="line.1955"></a>
+<span class="sourceLineNo">1956</span>      builder.setRegion(RequestConverter.buildRegionSpecifier(<a name="line.1956"></a>
+<span class="sourceLineNo">1957</span>        RegionSpecifierType.REGION_NAME, region.getRegionInfo().getRegionName()));<a name="line.1957"></a>
+<span class="sourceLineNo">1958</span>      builder.setValue(<a name="line.1958"></a>
+<span class="sourceLineNo">1959</span>        builder.getValueBuilder().setName(result.getClass().getName())<a name="line.1959"></a>
+<span class="sourceLineNo">1960</span>          .setValue(result.toByteString()));<a name="line.1960"></a>
+<span class="sourceLineNo">1961</span>      return builder.build();<a name="line.1961"></a>
+<span class="sourceLineNo">1962</span>    } catch (IOException ie) {<a name="line.1962"></a>
+<span class="sourceLineNo">1963</span>      throw new ServiceException(ie);<a name="line.1963"></a>
+<span class="sourceLineNo">1964</span>    }<a name="line.1964"></a>
+<span class="sourceLineNo">1965</span>  }<a name="line.1965"></a>
+<span class="sourceLineNo">1966</span><a name="line.1966"></a>
+<span class="sourceLineNo">1967</span>  private Message execServiceOnRegion(Region region,<a name="line.1967"></a>
+<span class="sourceLineNo">1968</span>      final ClientProtos.CoprocessorServiceCall serviceCall) throws IOException {<a name="line.1968"></a>
+<span class="sourceLineNo">1969</span>    // ignore the passed in controller (from the serialized call)<a name="line.1969"></a>
+<span class="sourceLineNo">1970</span>    ServerRpcController execController = new ServerRpcController();<a name="line.1970"></a>
+<span class="sourceLineNo">1971</span>    return region.execService(execController, serviceCall);<a name="line.1971"></a>
+<span class="sourceLineNo">1972</span>  }<a name="line.1972"></a>
+<span class="sourceLineNo">1973</span><a name="line.1973"></a>
+<span class="sourceLineNo">1974</span>  /**<a name="line.1974"></a>
+<span class="sourceLineNo">1975</span>   * Get data from a table.<a name="line.1975"></a>
+<span class="sourceLineNo">1976</span>   *<a name="line.1976"></a>
+<span class="sourceLineNo">1977</span>   * @param controller the RPC controller<a name="line.1977"></a>
+<span class="sourceLineNo">1978</span>   * @param request the get request<a name="line.1978"></a>
+<span class="sourceLineNo">1979</span>   * @throws ServiceException<a name="line.1979"></a>
+<span class="sourceLineNo">1980</span>   */<a name="line.1980"></a>
+<span class="sourceLineNo">1981</span>  @Override<a name="line.1981"></a>
+<span class="sourceLineNo">1982</span>  public GetResponse get(final RpcController controller,<a name="line.1982"></a>
+<span class="sourceLineNo">1983</span>      final GetRequest request) throws ServiceException {<a name="line.1983"></a>
+<span class="sourceLineNo">1984</span>    long before = EnvironmentEdgeManager.currentTime();<a name="line.1984"></a>
+<span class="sourceLineNo">1985</span>    OperationQuota quota = null;<a name="line.1985"></a>
+<span class="sourceLineNo">1986</span>    try {<a name="line.1986"></a>
+<span class="sourceLineNo">1987</span>      checkOpen();<a name="line.1987"></a>
+<span class="sourceLineNo">1988</span>      requestCount.increment();<a name="line.1988"></a>
+<span class="sourceLineNo">1989</span>      Region region = getRegion(request.getRegion());<a name="line.1989"></a>
+<span class="sourceLineNo">1990</span><a name="line.1990"></a>
+<span class="sourceLineNo">1991</span>      GetResponse.Builder builder = GetResponse.newBuilder();<a name="line.1991"></a>
+<span class="sourceLineNo">1992</span>      ClientProtos.Get get = request.getGet();<a name="line.1992"></a>
+<span class="sourceLineNo">1993</span>      Boolean existence = null;<a name="line.1993"></a>
+<span class="sourceLineNo">1994</span>      Result r = null;<a name="line.1994"></a>
+<span class="sourceLineNo">1995</span>      RpcCallContext context = RpcServer.getCurrentCall();<a name="line.1995"></a>
+<span class="sourceLineNo">1996</span>      quota = getQuotaManager().checkQuota(region, OperationQuota.OperationType.GET);<a name="line.1996"></a>
+<span class="sourceLineNo">1997</span><a name="line.1997"></a>
+<span class="sourceLineNo">1998</span>      Get clientGet = ProtobufUtil.toGet(get);<a name="line.1998"></a>
+<span class="sourceLineNo">1999</span>      if (get.getExistenceOnly() &amp;&amp; region.getCoprocessorHost() != null) {<a name="line.1999"></a>
+<span class="sourceLineNo">2000</span>        existence = region.getCoprocessorHost().preExists(clientGet);<a name="line.2000"></a>
+<span class="sourceLineNo">2001</span>      }<a name="line.2001"></a>
+<span class="sourceLineNo">2002</span>      if (existence == null) {<a name="line.2002"></a>
+<span class="sourceLineNo">2003</span>        if (context != null) {<a name="line.2003"></a>
+<span class="sourceLineNo">2004</span>          r = get(clientGet, ((HRegion) region), null, context);<a name="line.2004"></a>
+<span class="sourceLineNo">2005</span>        } else {<a name="line.2005"></a>
+<span class="sourceLineNo">2006</span>          // for test purpose<a name="line.2006"></a>
+<span class="sourceLineNo">2007</span>          r = region.get(clientGet);<a name="line.2007"></a>
+<span class="sourceLineNo">2008</span>        }<a name="line.2008"></a>
+<span class="sourceLineNo">2009</span>        if (get.getExistenceOnly()) {<a name="line.2009"></a>
+<span class="sourceLineNo">2010</span>          boolean exists = r.getExists();<a name="line.2010"></a>
+<span class="sourceLineNo">2011</span>          if (region.getCoprocessorHost() != null) {<a name="line.2011"></a>
+<span class="sourceLineNo">2012</span>            exists = region.getCoprocessorHost().postExists(clientGet, exists);<a name="line.2012"></a>
+<span class="sourceLineNo">2013</span>          }<a name="line.2013"></a>
+<span class="sourceLineNo">2014</span>          existence = exists;<a name="line.2014"></a>
+<span class="sourceLineNo">2015</span>        }<a name="line.2015"></a>
+<span class="sourceLineNo">2016</span>      }<a name="line.2016"></a>
+<span class="sourceLineNo">2017</span>      if (existence != null) {<a name="line.2017"></a>
+<span class="sourceLineNo">2018</span>        ClientProtos.Result pbr =<a name="line.2018"></a>
+<span class="sourceLineNo">2019</span>            ProtobufUtil.toResult(existence, region.getRegionInfo().getReplicaId() != 0);<a name="line.2019"></a>
+<span class="sourceLineNo">2020</span>        builder.setResult(pbr);<a name="line.2020"></a>
+<span class="sourceLineNo">2021</span>      } else if (r != null) {<a name="line.2021"></a>
+<span class="sourceLineNo">2022</span>        ClientProtos.Result pbr = ProtobufUtil.toResult(r);<a name="line.2022"></a>
+<span class="sourceLineNo">2023</span>        builder.setResult(pbr);<a name="line.2023"></a>
+<span class="sourceLineNo">2024</span>      }<a name="line.2024"></a>
+<span class="sourceLineNo">2025</span>      if (r != null) {<a name="line.2025"></a>
+<span class="sourceLineNo">2026</span>        quota.addGetResult(r);<a name="line.2026"></a>
+<span class="sourceLineNo">2027</span>      }<a name="line.2027"></a>
+<span class="sourceLineNo">2028</span>      return builder.build();<a name="line.2028"></a>
+<span class="sourceLineNo">2029</span>    } catch (IOException ie) {<a name="line.2029"></a>
+<span class="sourceLineNo">2030</span>      throw new ServiceException(ie);<a name="line.2030"></a>
+<span class="sourceLineNo">2031</span>    } finally {<a name="line.2031"></a>
+<span class="sourceLineNo">2032</span>      if (regionServer.metricsRegionServer != null) {<a name="line.2032"></a>
+<span class="sourceLineNo">2033</span>        regionServer.metricsRegionServer.updateGet(EnvironmentEdgeManager.currentTime() - before);<a name="line.2033"></a>
+<span class="sourceLineNo">2034</span>      }<a name="line.2034"></a>
+<span class="sourceLineNo">2035</span>      if (quota != null) {<a name="line.2035"></a>
+<span class="sourceLineNo">2036</span>        quota.close();<a name="line.2036"></a>
+<span class="sourceLineNo">2037</span>      }<a name="line.2037"></a>
+<span class="sourceLineNo">2038</span>    }<a name="line.2038"></a>
+<span class="sourceLineNo">2039</span>  }<a name="line.2039"></a>
+<span class="sourceLineNo">2040</span><a name="line.2040"></a>
+<span class="sourceLineNo">2041</span>  private Result get(Get get, HRegion region, RegionScannersCloseCallBack closeCallBack,<a name="line.2041"></a>
+<span class="sourceLineNo">2042</span>      RpcCallContext context) throws IOException {<a name="line.2042"></a>
+<span class="sourceLineNo">2043</span>    region.prepareGet(get);<a name="line.2043"></a>
+<span class="sourceLineNo">2044</span>    List&lt;Cell&gt; results = new ArrayList&lt;Cell&gt;();<a name="line.2044"></a>
+<span class="sourceLineNo">2045</span>    boolean stale = region.getRegionInfo().getReplicaId() != 0;<a name="line.2045"></a>
+<span class="sourceLineNo">2046</span>    // pre-get CP hook<a name="line.2046"></a>
+<span class="sourceLineNo">2047</span>    if (region.getCoprocessorHost() != null) {<a name="line.2047"></a>
+<span class="sourceLineNo">2048</span>      if (region.getCoprocessorHost().preGet(get, results)) {<a name="line.2048"></a>
+<span class="sourceLineNo">2049</span>        return Result<a name="line.2049"></a>
+<span class="sourceLineNo">2050</span>            .create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : null, stale);<a name="line.2050"></a>
+<span class="sourceLineNo">2051</span>      }<a name="line.2051"></a>
+<span class="sourceLineNo">2052</span>    }<a name="line.2052"></a>
 <span class="sourceLineNo">2053</span><a name="line.2053"></a>
-<span class="sourceLineNo">2054</span>    RegionScanner scanner = null;<a name="line.2054"></a>
-<span class="sourceLineNo">2055</span>    try {<a name="line.2055"></a>
-<span class="sourceLineNo">2056</span>      scanner = region.getScanner(scan, false);<a name="line.2056"></a>
-<span class="sourceLineNo">2057</span>      scanner.next(results);<a name="line.2057"></a>
-<span class="sourceLineNo">2058</span>    } finally {<a name="line.2058"></a>
-<span class="sourceLineNo">2059</span>      if (scanner != null) {<a name="line.2059"></a>
-<span class="sourceLineNo">2060</span>        if (closeCallBack == null) {<a name="line.2060"></a>
-<span class="sourceLineNo">2061</span>          // If there is a context then the scanner can be added to the current<a name="line.2061"></a>
-<span class="sourceLineNo">2062</span>          // RpcCallContext. The rpc callback will take care of closing the<a name="line.2062"></a>
-<span class="sourceLineNo">2063</span>          // scanner, for eg in case<a name="line.2063"></a>
-<span class="sourceLineNo">2064</span>          // of get()<a name="line.2064"></a>
-<span class="sourceLineNo">2065</span>          assert scanner instanceof org.apache.hadoop.hbase.ipc.RpcCallback;<a name="line.2065"></a>
-<span class="sourceLineNo">2066</span>          context.setCallBack((RegionScannerImpl) scanner);<a name="line.2066"></a>
-<span class="sourceLineNo">2067</span>        } else {<a name="line.2067"></a>
-<span class="sourceLineNo">2068</span>          // The call is from multi() where the results from the get() are<a name="line.2068"></a>
-<span class="sourceLineNo">2069</span>          // aggregated and then send out to the<a name="line.2069"></a>
-<span class="sourceLineNo">2070</span>          // rpc. The rpccall back will close all such scanners created as part<a name="line.2070"></a>
-<span class="sourceLineNo">2071</span>          // of multi().<a name="line.2071"></a>
-<span class="sourceLineNo">2072</span>          closeCallBack.addScanner(scanner);<a name="line.2072"></a>
-<span class="sourceLineNo">2073</span>        }<a name="line.2073"></a>
-<span class="sourceLineNo">2074</span>      }<a name="line.2074"></a>
-<span class="sourceLineNo">2075</span>    }<a name="line.2075"></a>
-<span class="sourceLineNo">2076</span><a name="line.2076"></a>
-<span class="sourceLineNo">2077</span>    // post-get CP hook<a name="line.2077"></a>
-<span class="sourceLineNo">2078</span>    if (region.getCoprocessorHost() != null) {<a name="line.2078"></a>
-<span class="sourceLineNo">2079</span>      region.getCoprocessorHost().postGet(get, results);<a name="line.2079"></a>
-<span class="sourceLineNo">2080</span>    }<a name="line.2080"></a>
-<span class="sourceLineNo">2081</span>    region.metricsUpdateForGet(results);<a name="line.2081"></a>
-<span class="sourceLineNo">2082</span>    return Result.create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : null, stale);<a name="line.2082"></a>
-<span class="sourceLineNo">2083</span>  }<a name="line.2083"></a>
-<span class="sourceLineNo">2084</span><a name="line.2084"></a>
-<span class="sourceLineNo">2085</span>  /**<a name="line.2085"></a>
-<span class="sourceLineNo">2086</span>   * Execute multiple actions on a table: get, mutate, and/or execCoprocessor<a name="line.2086"></a>
-<span class="sourceLineNo">2087</span>   *<a name="line.2087"></a>
-<span class="sourceLineNo">2088</span>   * @param rpcc the RPC controller<a name="line.2088"></a>
-<span class="sourceLineNo">2089</span>   * @param request the multi request<a name="line.2089"></a>
-<span class="sourceLineNo">2090</span>   * @throws ServiceException<a name="line.2090"></a>
-<span class="sourceLineNo">2091</span>   */<a name="line.2091"></a>
-<span class="sourceLineNo">2092</span>  @Override<a name="line.2092"></a>
-<span class="sourceLineNo">2093</span>  public MultiResponse multi(final RpcController rpcc, final MultiRequest request)<a name="line.2093"></a>
-<span class="sourceLineNo">2094</span>  throws ServiceException {<a name="line.2094"></a>
-<span class="sourceLineNo">2095</span>    try {<a name="line.2095"></a>
-<span class="sourceLineNo">2096</span>      checkOpen();<a name="line.2096"></a>
-<span class="sourceLineNo">2097</span>    } catch (IOException ie) {<a name="line.2097"></a>
-<span class="sourceLineNo">2098</span>      throw new ServiceException(ie);<a name="line.2098"></a>
-<span class="sourceLineNo">2099</span>    }<a name="line.2099"></a>
-<span class="sourceLineNo">2100</span><a name="line.2100"></a>
-<span class="sourceLineNo">2101</span>    // rpc controller is how we bring in data via the back door;  it is unprotobuf'ed data.<a name="line.2101"></a>
-<span class="sourceLineNo">2102</span>    // It is also the conduit via which we pass back data.<a name="line.2102"></a>
-<span class="sourceLineNo">2103</span>    PayloadCarryingRpcController controller = (PayloadCarryingRpcController)rpcc;<a name="line.2103"></a>
-<span class="sourceLineNo">2104</span>    CellScanner cellScanner = controller != null ? controller.cellScanner(): null;<a name="line.2104"></a>
-<span class="sourceLineNo">2105</span>    if (controller != null) controller.setCellScanner(null);<a name="line.2105"></a>
-<span class="sourceLineNo">2106</span><a name="line.2106"></a>
-<span class="sourceLineNo">2107</span>    long nonceGroup = request.hasNonceGroup() ? request.getNonceGroup() : HConstants.NO_NONCE;<a name="line.2107"></a>
+<span class="sourceLineNo">2054</span>    Scan scan = new Scan(get);<a name="line.2054"></a>
+<span class="sourceLineNo">2055</span><a name="line.2055"></a>
+<span class="sourceLineNo">2056</span>    RegionScanner scanner = null;<a name="line.2056"></a>
+<span class="sourceLineNo">2057</span>    try {<a name="line.2057"></a>
+<span class="sourceLineNo">2058</span>      scanner = region.getScanner(scan, false);<a name="line.2058"></a>
+<span class="sourceLineNo">2059</span>      scanner.next(results);<a name="line.2059"></a>
+<span class="sourceLineNo">2060</span>    } finally {<a name="line.2060"></a>
+<span class="sourceLineNo">2061</span>      if (scanner != null) {<a name="line.2061"></a>
+<span class="sourceLineNo">2062</span>        if (closeCallBack == null) {<a name="line.2062"></a>
+<span class="sourceLineNo">2063</span>          // If there is a context then the scanner can be added to the current<a name="line.2063"></a>
+<span class="sourceLineNo">2064</span>          // RpcCallContext. The rpc callback will take care of closing the<a name="line.2064"></a>
+<span class="sourceLineNo">2065</span>          // scanner, for eg in case<a name="line.2065"></a>
+<span class="sourceLineNo">2066</span>          // of get()<a name="line.2066"></a>
+<span class="sourceLineNo">2067</span>          assert scanner instanceof org.apache.hadoop.hbase.ipc.RpcCallback;<a name="line.2067"></a>
+<span class="sourceLineNo">2068</span>          context.setCallBack((RegionScannerImpl) scanner);<a name="line.2068"></a>
+<span class="sourceLineNo">2069</span>        } else {<a name="line.2069"></a>
+<span class="sourceLineNo">2070</span>          // The call is from multi() where the results from the get() are<a name="line.2070"></a>
+<span class="sourceLineNo">2071</span>          // aggregated and then send out to the<a name="line.2071"></a>
+<span class="sourceLineNo">2072</span>          // rpc. The rpccall back will close all such scanners created as part<a name="line.2072"></a>
+<span class="sourceLineNo">2073</span>          // of multi().<a name="line.2073"></a>
+<span class="sourceLineNo">2074</span>          closeCallBack.addScanner(scanner);<a name="line.2074"></a>
+<span class="sourceLineNo">2075</span>        }<a name="line.2075"></a>
+<span class="sourceLineNo">2076</span>      }<a name="line.2076"></a>
+<span class="sourceLineNo">2077</span>    }<a name="line.2077"></a>
+<span class="sourceLineNo">2078</span><a name="line.2078"></a>
+<span class="sourceLineNo">2079</span>    // post-get CP hook<a name="line.2079"></a>
+<span class="sourceLineNo">2080</span>    if (region.getCoprocessorHost() != null) {<a name="line.2080"></a>
+<span class="sourceLineNo">2081</span>      region.getCoprocessorHost().postGet(get, results);<a name="line.2081"></a>
+<span class="sourceLineNo">2082</span>    }<a name="line.2082"></a>
+<span class="sourceLineNo">2083</span>    region.metricsUpdateForGet(results);<a name="line.2083"></a>
+<span class="sourceLineNo">2084</span>    return Result.create(results, get.isCheckExistenceOnly() ? !results.isEmpty() : null, stale);<a name="line.2084"></a>
+<span class="sourceLineNo">2085</span>  }<a name="line.2085"></a>
+<span class="sourceLineNo">2086</span><a name="line.2086"></a>
+<span class="sourceLineNo">2087</span>  /**<a name="line.2087"></a>
+<span class="sourceLineNo">2088</span>   * Execute multiple actions on a table: get, mutate, and/or execCoprocessor<a name="line.2088"></a>
+<span class="sourceLineNo">2089</span>   *<a name="line.2089"></a>
+<span class="sourceLineNo">2090</span>   * @param rpcc the RPC controller<a name="line.2090"></a>
+<span class="sourceLineNo">2091</span>   * @param request the multi request<a name="line.2091"></a>
+<span class="sourceLineNo">2092</span>   * @throws ServiceException<a name="line.2092"></a>
+<span class="sourceLineNo">2093</span>   */<a name="line.2093"></a>
+<span class="sourceLineNo">2094</span>  @Override<a name="line.2094"></a>
+<span class="sourceLineNo">2095</span>  public MultiResponse multi(final RpcController rpcc, final MultiRequest request)<a name="line.2095"></a>
+<span class="sourceLineNo">2096</span>  throws ServiceException {<a name="line.2096"></a>
+<span class="sourceLineNo">2097</span>    try {<a name="line.2097"></a>
+<span class="sourceLineNo">2098</span>      checkOpen();<a name="line.2098"></a>
+<span class="sourceLineNo">2099</span>    } catch (IOException ie) {<a name="line.2099"></a>
+<span class="sourceLineNo">2100</span>      throw new ServiceException(ie);<a name="line.2100"></a>
+<span class="sourceLineNo">2101</span>    }<a name="line.2101"></a>
+<span class="sourceLineNo">2102</span><a name="line.2102"></a>
+<span class="sourceLineNo">2103</span>    // rpc controller is how we bring in data via the back door;  it is unprotobuf'ed data.<a name="line.2103"></a>
+<span class="sourceLineNo">2104</span>    // It is also the conduit via which we pass back data.<a name="line.2104"></a>
+<span class="sourceLineNo">2105</span>    PayloadCarryingRpcController controller = (PayloadCarryingRpcController)rpcc;<a name="line.2105"></a>
+<span class="sourceLineNo">2106</span>    CellScanner cellScanner = controller != null ? controller.cellScanner(): null;<a name="line.2106"></a>
+<span class="sourceLineNo">2107</span>    if (controller != null) controller.setCellScanner(null);<a name="line.2107"></a>
 <span class="sourceLineNo">2108</span><a name="line.2108"></a>
-<span class="sourceLineNo">2109</span>    // this will contain all the cells that we need to return. It's created later, if needed.<a name="line.2109"></a>
-<span class="sourceLineNo">2110</span>    List&lt;CellScannable&gt; cellsToReturn = null;<a name="line.2110"></a>
-<span class="sourceLineNo">2111</span>    MultiResponse.Builder responseBuilder = MultiResponse.newBuilder();<a name="line.2111"></a>
-<span class="sourceLineNo">2112</span>    RegionActionResult.Builder regionActionResultBuilder = RegionActionResult.newBuilder();<a name="line.2112"></a>
-<span class="sourceLineNo">2113</span>    Boolean processed = null;<a name="line.2113"></a>
-<span class="sourceLineNo">2114</span>    RegionScannersCloseCallBack closeCallBack = null;<a name="line.2114"></a>
-<span class="sourceLineNo">2115</span>    RpcCallContext context = RpcServer.getCurrentCall();<a name="line.2115"></a>
-<span class="sourceLineNo">2116</span>    for (RegionAction regionAction : request.getRegionActionList()) {<a name="line.2116"></a>
-<span class="sourceLineNo">2117</span>      this.requestCount.add(regionAction.getActionCount());<a name="line.2117"></a>
-<span class="sourceLineNo">2118</span>      OperationQuota quota;<a name="line.2118"></a>
-<span class="sourceLineNo">2119</span>      Region region;<a name="line.2119"></a>
-<span class="sourceLineNo">2120</span>      regionActionResultBuilder.clear();<a name="line.2120"></a>
-<span class="sourceLineNo">2121</span>      try {<a name="line.2121"></a>
-<span class="sourceLineNo">2122</span>        region = getRegion(regionAction.getRegion());<a name="line.2122"></a>
-<span class="sourceLineNo">2123</span>        quota = getQuotaManager().checkQuota(region, regionAction.getActionList());<a name="line.2123"></a>
-<span class="sourceLineNo">2124</span>      } catch (IOException e) {<a name="line.2124"></a>
-<span class="sourceLineNo">2125</span>        rpcServer.getMetrics().exception(e);<a name="line.2125"></a>
-<span class="sourceLineNo">2126</span>        regionActionResultBuilder.setException(ResponseConverter.buildException(e));<a name="line.2126"></a>
-<span class="sourceLineNo">2127</span>        responseBuilder.addRegionActionResult(regionActionResultBuilder.build());<a name="line.2127"></a>
-<span class="sourceLineNo">2128</span>        continue;  // For this region it's a failure.<a name="line.2128"></a>
-<span class="sourceLineNo">2129</span>      }<a name="line.2129"></a>
-<span class="sourceLineNo">2130</span><a name="line.2130"></a>
-<span class="sourceLineNo">2131</span>      if (regionAction.hasAtomic() &amp;&amp; regionAction.getAtomic()) {<a name="line.2131"></a>
-<span class="sourceLineNo">2132</span>        // How does this call happen?  It may need some work to play well w/ the surroundings.<a name="line.2132"></a>
-<span class="sourceLineNo">2133</span>        // Need to return an item per Action along w/ Action index.  TODO.<a name="line.2133"></a>
-<span class="sourceLineNo">2134</span>        try {<a name="line.2134"></a>
-<span class="sourceLineNo">2135</span>          if (request.hasCondition()) {<a name="line.2135"></a>
-<span class="sourceLineNo">2136</span>            Condition condition = request.getCondition();<a name="line.2136"></a>
-<span class="sourceLineNo">2137</span>            byte[] row = condition.getRow().toByteArray();<a name="line.2137"></a>
-<span class="sourceLineNo">2138</span>            byte[] family = condition.getFamily().toByteArray();<a name="line.2138"></a>
-<span class="sourceLineNo">2139</span>            byte[] qualifier = condition.getQualifier().toByteArray();<a name="line.2139"></a>
-<span class="sourceLineNo">2140</span>            CompareOp compareOp = CompareOp.valueOf(condition.getCompareType().name());<a name="line.2140"></a>
-<span class="sourceLineNo">2141</span>            ByteArrayComparable comparator =<a name="line.2141"></a>
-<span class="sourceLineNo">2142</span>                ProtobufUtil.toComparator(condition.getComparator());<a name="line.2142"></a>
-<span class="sourceLineNo">2143</span>            processed = checkAndRowMutate(region, regionAction.getActionList(),<a name="line.2143"></a>
-<span class="sourceLineNo">2144</span>                  cellScanner, row, family, qualifier, compareOp, comparator);<a name="line.2144"></a>
-<span class="sourceLineNo">2145</span>          } else {<a name="line.2145"></a>
-<span class="sourceLineNo">2146</span>            ClientProtos.RegionLoadStats stats = mutateRows(region, regionAction.getActionList(),<a name="line.2146"></a>
-<span class="sourceLineNo">2147</span>                cellScanner);<a name="line.2147"></a>
-<span class="sourceLineNo">2148</span>            // add the stats to the request<a name="line.2148"></a>
-<span class="sourceLineNo">2149</span>            if(stats != null) {<a name="line.2149"></a>
-<span class="sourceLineNo">2150</span>              responseBuilder.addRegionActionResult(RegionActionResult.newBuilder()<a name="line.2150"></a>
-<span class="sourceLineNo">2151</span>                  .addResultOrException(ResultOrException.newBuilder().setLoadStats(stats)));<a name="line.2151"></a>
-<span class="sourceLineNo">2152</span>            }<a name="line.2152"></a>
-<span class="sourceLineNo">2153</span>            processed = Boolean.TRUE;<a name="line.2153"></a>
-<span class="sourceLineNo">2154</span>          }<a name="line.2154"></a>
-<span class="sourceLineNo">2155</span>        } catch (IOException e) {<a name="line.2155"></a>
-<span class="sourceLineNo">2156</span>          rpcServer.getMetrics().exception(e);<a name="line.2156"></a>
-<span class="sourceLineNo">2157</span>          // As it's atomic, we may expect it's a global failure.<a name="line.2157"></a>
-<span class="sourceLineNo">2158</span>          regionActionResultBuilder.setException(ResponseConverter.buildException(e));<a name="line.2158"></a>
-<span class="sourceLineNo">2159</span>        }<a name="line.2159"></a>
-<span class="sourceLineNo">2160</span>      } else {<a name="line.2160"></a>
-<span class="sourceLineNo">2161</span>        // doNonAtomicRegionMutation manages the exception internally<a name="line.2161"></a>
-<span class="sourceLineNo">2162</span>        if (context != null &amp;&amp; closeCallBack == null) {<a name="line.2162"></a>
-<span class="sourceLineNo">2163</span>          // An RpcCallBack that creates a list of scanners that needs to perform callBack<a name="line.2163"></a>
-<span class="sourceLineNo">2164</span>          // operation on completion of multiGets.<a name="line.2164"></a>
-<span class="sourceLineNo">2165</span>          // Set this only once<a name="line.2165"></a>
-<span class="sourceLineNo">2166</span>          closeCallBack = new RegionScannersCloseCallBack();<a name="line.2166"></a>
-<span class="sourceLineNo">2167</span>          context.setCallBack(closeCallBack);<a name="line.2167"></a>
-<span class="sourceLineNo">2168</span>        }<a name="line.2168"></a>
-<span class="sourceLineNo">2169</span>        cellsToReturn = doNonAtomicRegionMutation(region, quota, regionAction, cellScanner,<a name="line.2169"></a>
-<span class="sourceLineNo">2170</span>            regionActionResultBuilder, cellsToReturn, nonceGroup, closeCallBack, context);<a name="line.2170"></a>
-<span class="sourceLineNo">2171</span>      }<a name="line.2171"></a>
-<span class="sourceLineNo">2172</span>      responseBuilder.addRegionActionResult(regionActionResultBuilder.build());<a name="line.2172"></a>
-<span class="sourceLineNo">2173</span>      quota.close();<a name="line.2173"></a>
-<span class="sourceLineNo">2174</span>    }<a name="line.2174"></a>
-<span class="sourceLineNo">2175</span>    // Load the controller with the Cells to return.<a name="line.2175"></a>
-<span class="sourceLineNo">2176</span>    if (cellsToReturn != null &amp;&amp; !cellsToReturn.isEmpty() &amp;&amp; controller != null) {<a name="line.2176"></a>
-<span class="sourceLineNo">2177</span>      controller.setCellScanner(CellUtil.createCellScanner(cellsToReturn));<a name="line.2177"></a>
-<span class="sourceLineNo">2178</span>    }<a name="line.2178"></a>
-<span class="sourceLineNo">2179</span>    if (processed != null) responseBuilder.setProcessed(processed);<a name="line.2179"></a>
-<span class="sourceLineNo">2180</span>    return responseBuilder.build();<a name="line.2180"></a>
-<span class="sourceLineNo">2181</span>  }<a name="line.2181"></a>
-<span class="sourceLineNo">2182</span><a name="line.2182"></a>
-<span class="sourceLineNo">2183</span>  /**<a name="line.2183"></a>
-<span class="sourceLineNo">2184</span>   * Mutate data in a table.<a name="line.2184"></a>
-<span class="sourceLineNo">2185</span>   *<a name="line.2185"></a>
-<span class="sourceLineNo">2186</span>   * @param rpcc the RPC controller<a name="line.2186"></a>
-<span class="sourceLineNo">2187</span>   * @param request the mutate request<a name="line.2187"></a>
-<span class="sourceLineNo">2188</span>   * @throws ServiceException<a name="line.2188"></a>
-<span class="sourceLineNo">2189</span>   */<a name="line.2189"></a>
-<span class="sourceLineNo">2190</span>  @Override<a name="line.2190"></a>
-<span class="sourceLineNo">2191</span>  public MutateResponse mutate(final RpcController rpcc,<a name="line.2191"></a>
-<span class="sourceLineNo">2192</span>      final MutateRequest request) throws ServiceException {<a name="line.2192"></a>
-<span class="sourceLineNo">2193</span>    // rpc controller is how we bring in data via the back door;  it is unprotobuf'ed data.<a name="line.2193"></a>
-<span class="sourceLineNo">2194</span>    // It is also the conduit via which we pass back data.<a name="line.2194"></a>
-<span class="sourceLineNo">2195</span>    PayloadCarryingRpcController controller = (PayloadCarryingRpcController)rpcc;<a name="line.2195"></a>
-<span class="sourceLineNo">2196</span>    CellScanner cellScanner = controller != null? controller.cellScanner(): null;<a name="line.2196"></a>
-<span class="sourceLineNo">2197</span>    OperationQuota quota = null;<a name="line.2197"></a>
-<span class="sourceLineNo">2198</span>    // Clear scanner so we are not holding on to reference across call.<a name="line.2198"></a>
-<span class="sourceLineNo">2199</span>    if (controller != null) controller.setCellScanner(null);<a name="line.2199"></a>
-<span class="sourceLineNo">2200</span>    try {<a name="line.2200"></a>
-<span class="sourceLineNo">2201</span>      checkOpen();<a name="line.2201"></a>
-<span class="sourceLineNo">2202</span>      requestCount.increment();<a name="line.2202"></a>
-<span class="sourceLineNo">2203</span>      Region region = getRegion(request.getRegion());<a name="line.2203"></a>
-<span class="sourceLineNo">2204</span>      MutateResponse.Builder builder = MutateResponse.newBuilder();<a name="line.2204"></a>
-<span class="sourceLineNo">2205</span>      MutationProto mutation = request.getMutation();<a name="line.2205"></a>
-<span class="sourceLineNo">2206</span>      if (!region.getRegionInfo().isMetaTable()) {<a name="line.2206"></a>
-<span class="sourceLineNo">2207</span>        regionServer.cacheFlusher.reclaimMemStoreMemory();<a name="line.2207"></a>
-<span class="sourceLineNo">2208</span>      }<a name="line.2208"></a>
-<span class="sourceLineNo">2209</span>      long nonceGroup = request.hasNonceGroup() ? request.getNonceGroup() : HConstants.NO_NONCE;<a name="line.2209"></a>
-<span class="sourceLineNo">2210</span>      Result r = null;<a name="line.2210"></a>
-<span class="sourceLineNo">2211</span>      Boolean processed = null;<a name="line.2211"></a>
-<span class="sourceLineNo">2212</span>      MutationType type = mutation.getMutateType();<a name="line.2212"></a>
-<span class="sourceLineNo">2213</span><a name="line.2213"></a>
-<span class="sourceLineNo">2214</span>      quota = getQuotaManager().checkQuota(region, OperationQuota.OperationType.MUTATE);<a name="line.2214"></a>
+<span class="sourceLineNo">2109</span>    long nonceGroup = request.hasNonceGroup() ? request.getNonceGroup() : HConstants.NO_NONCE;<a name="line.2109"></a>
+<span class="sourceLineNo">2110</span><a name="line.2110"></a>
+<span class="sourceLineNo">2111</span>    // this will contain all the cells that we need to return. It's created later, if needed.<a name="line.2111"></a>
+<span class="sourceLineNo">2112</span>    List&lt;CellScannable&gt; cellsToReturn = null;<a name="line.2112"></a>
+<span class="sourceLineNo">2113</span>    MultiResponse.Builder responseBuilder = MultiResponse.newBuilder();<a name="line.2113"></a>
+<span class="sourceLineNo">2114</span>    RegionActionResult.Builder regionActionResultBuilder = RegionActionResult.newBuilder();<a name="line.2114"></a>
+<span class="sourceLineNo">2115</span>    Boolean processed = null;<a name="line.2115"></a>
+<span class="sourceLineNo">2116</span>    RegionScannersCloseCallBack closeCallBack = null;<a name="line.2116"></a>
+<span class="sourceLineNo">2117</span>    RpcCallContext context = RpcServer.getCurrentCall();<a name="line.2117"></a>
+<span class="sourceLineNo">2118</span>    for (RegionAction regionAction : request.getRegionActionList()) {<a name="line.2118"></a>
+<span class="sourceLineNo">2119</span>      this.requestCount.add(regionAction.getActionCount());<a name="line.2119"></a>
+<span class="sourceLineNo">2120</span>      OperationQuota quota;<a name="line.2120"></a>
+<span class="sourceLineNo">2121</span>      Region region;<a name="line.2121"></a>
+<span class="sourceLineNo">2122</span>      regionActionResultBuilder.clear();<a name="line.2122"></a>
+<span class="sourceLineNo">2123</span>      try {<a name="line.2123"></a>
+<span class="sourceLineNo">2124</span>        region = getRegion(regionAction.getRegion());<a name="line.2124"></a>
+<span class="sourceLineNo">2125</span>        quota = getQuotaManager().checkQuota(region, regionAction.getActionList());<a name="line.2125"></a>
+<span class="sourceLineNo">2126</span>      } catch (IOException e) {<a name="line.2126"></a>
+<span class="sourceLineNo">2127</span>        rpcServer.getMetrics().exception(e);<a name="line.2127"></a>
+<span class="sourceLineNo">2128</span>        regionActionResultBuilder.setException(ResponseConverter.buildException(e));<a name="line.2128"></a>
+<span class="sourceLineNo">2129</span>        responseBuilder.addRegionActionResult(regionActionResultBuilder.build());<a name="line.2129"></a>
+<span class="sourceLineNo">2130</span>        continue;  // For this region it's a failure.<a name="line.2130"></a>
+<span class="sourceLineNo">2131</span>      }<a name="line.2131"></a>
+<span class="sourceLineNo">2132</span><a name="line.2132"></a>
+<span class="sourceLineNo">2133</span>      if (regionAction.hasAtomic() &amp;&amp; regionAction.getAtomic()) {<a name="line.2133"></a>
+<span class="sourceLineNo">2134</span>        // How does this call happen?  It may need some work to play well w/ the surroundings.<a name="line.2134"></a>
+<span class="sourceLineNo">2135</span>        // Need to return an item per Action along w/ Action index.  TODO.<a name="line.2135"></a>
+<span class="sourceLineNo">2136</span>        try {<a name="line.2136"></a>
+<span class="sourceLineNo">2137</span>          if (request.hasCondition()) {<a name="line.2137"></a>
+<span class="sourceLineNo">2138</span>            Condition condition = request.getCondition();<a name="line.2138"></a>
+<span class="sourceLineNo">2139</span>            byte[] row = condition.getRow().toByteArray();<a name="line.2139"></a>
+<span class="sourceLineNo">2140</span>            byte[] family = condition.getFamily().toByteArray();<a name="line.2140"></a>
+<span class="sourceLineNo">2141</span>            byte[] qualifier = condition.getQualifier().toByteArray();<a name="line.2141"></a>
+<span class="sourceLineNo">2142</span>            CompareOp compareOp = CompareOp.valueOf(condition.getCompareType().name());<a name="line.2142"></a>
+<span class="sourceLineNo">2143</span>            ByteArrayComparable comparator =<a name="line.2143"></a>
+<span class="sourceLineNo">2144</span>                ProtobufUtil.toComparator(condition.getComparator());<a name="line.2144"></a>
+<span class="sourceLineNo">2145</span>            processed = checkAndRowMutate(region, regionAction.getActionList(),<a name="line.2145"></a>
+<span class="sourceLineNo">2146</span>                  cellScanner, row, family, qualifier, compareOp, comparator);<a name="line.2146"></a>
+<span class="sourceLineNo">2147</span>          } else {<a name="line.2147"></a>
+<span class="sourceLineNo">2148</span>            ClientProtos.RegionLoadStats stats = mutateRows(region, regionAction.getActionList(),<a name="line.2148"></a>
+<span class="sourceLineNo">2149</span>                cellScanner);<a name="line.2149"></a>
+<span class="sourceLineNo">2150</span>            // add the stats to the request<a name="line.2150"></a>
+<span class="sourceLineNo">2151</span>            if(stats != null) {<a name="line.2151"></a>
+<span class="sourceLineNo">2152</span>              responseBuilder.addRegionActionResult(RegionActionResult.newBuilder()<a name="line.2152"></a>
+<span class="sourceLineNo">2153</span>                  .addResultOrException(ResultOrException.newBuilder().setLoadStats(stats)));<a name="line.2153"></a>
+<span class="sourceLineNo">2154</span>            }<a name="line.2154"></a>
+<span class="sourceLineNo">2155</span>            processed = Boolean.TRUE;<a name="line.2155"></a>
+<span class="sourceLineNo">2156</span>          }<a name="line.2156"></a>
+<span class="sourceLineNo">2157</span>        } catch (IOException e) {<a name="line.2157"></a>
+<span class="sourceLineNo">2158</span>          rpcServer.getMetrics().exception(e);<a name="line.2158"></a>
+<span class="sourceLineNo">2159</span>          // As it's atomic, we may expect it's a global failure.<a name="line.2159"></a>
+<span class="sourceLineNo">2160</span>          regionActionResultBuilder.setException(ResponseConverter.buildException(e));<a name="line.2160"></a>
+<span class="sourceLineNo">2161</span>        }<a name="line.2161"></a>
+<span class="sourceLineNo">2162</span>      } else {<a name="line.2162"></a>
+<span class="sourceLineNo">2163</span>        // doNonAtomicRegionMutation manages the exception internally<a name="line.2163"></a>
+<span class="sourceLineNo">2164</span>        if (context != null &amp;&amp; closeCallBack == null) {<a name="line.2164"></a>
+<span class="sourceLineNo">2165</span>          // An RpcCallBack that creates a list of scanners that needs to perform callBack<a name="line.2165"></a>
+<span class="sourceLineNo">2166</span>          // operation on completion of multiGets.<a name="line.2166"></a>
+<span class="sourceLineNo">2167</span>          // Set this only once<a name="line.2167"></a>
+<span class="sourceLineNo">2168</span>          closeCallBack = new RegionScannersCloseCallBack();<a name="line.2168"></a>
+<span class="sourceLineNo">2169</span>          context.setCallBack(closeCallBack);<a name="line.2169"></a>
+<span class="sourceLineNo">2170</span>        }<a name="line.2170"></a>
+<span class="sourceLineNo">2171</span>        cellsToReturn = doNonAtomicRegionMutation(region, quota, regionAction, cellScanner,<a name="line.2171"></a>
+<span class="sourceLineNo">2172</span>            regionActionResultBuilder, cellsToReturn, nonceGroup, closeCallBack, context);<a name="line.2172"></a>
+<span class="sourceLineNo">2173</span>      }<a name="line.2173"></a>
+<span class="sourceLineNo">2174</span>      responseBuilder.addRegionActionResult(regionActionResultBuilder.build());<a name="line.2174"></a>
+<span class="sourceLineNo">2175</span>      quota.close();<a name="line.2175"></a>
+<span class="sourceLineNo">2176</span>    }<a name="line.2176"></a>
+<span class="sourceLineNo">2177</span>    // Load the controller with the Cells to return.<a name="line.2177"></a>
+<span class="sourceLineNo">2178</span>    if (cellsToReturn != null &amp;&amp; !cellsToReturn.isEmpty() &amp;&amp; controller != null) {<a name="line.2178"></a>
+<span class="sourceLineNo">2179</span>      controller.setCellScanner(CellUtil.createCellScanner(cellsToReturn));<a name="line.2179"></a>
+<span class="sourceLineNo">2180</span>    }<a name="line.2180"></a>
+<span class="sourceLineNo">2181</span>    if (processed != null) responseBuilder.setProcessed(processed);<a name="line.2181"></a>
+<span class="sourceLineNo">2182</span>    return responseBuilder.build();<a name="line.2182"></a>
+<span class="sourceLineNo">2183</span>  }<a name="line.2183"></a>
+<span class="sourceLineNo">2184</span><a name="line.2184"></a>
+<span class="sourceLineNo">2185</span>  /**<a name="line.2185"></a>
+<span class="sourceLineNo">2186</span>   * Mutate data in a table.<a name="line.2186"></a>
+<span class="sourceLineNo">2187</span>   *<a name="line.2187"></a>
+<span class="sourceLineNo">2188</span>   * @param rpcc the RPC controller<a name="line.2188"></a>
+<span class="sourceLineNo">2189</span>   * @param request the mutate request<a name="line.2189"></a>
+<span class="sourceLineNo">2190</span>   * @throws ServiceException<a name="line.2190"></a>
+<span class="sourceLineNo">2191</span>   */<a name="line.2191"></a>
+<span class="sourceLineNo">2192</span>  @Override<a name="line.2192"></a>
+<span class="sourceLineNo">2193</span>  public MutateResponse mutate(final RpcController rpcc,<a name="line.2193"></a>
+<span class="sourceLineNo">2194</span>      final MutateRequest request) throws ServiceException {<a name="line.2194"></a>
+<span class="sourceLineNo">2195</span>    // rpc controller is how we bring in data via the back door;  it is unprotobuf'ed data.<a name="line.2195"></a>
+<span class="sourceLineNo">2196</span>    // It is also the conduit via which we pass back data.<a name="line.2196"></a>
+<span class="sourceLineNo">2197</span>    PayloadCarryingRpcController controller = (PayloadCarryingRpcController)rpcc;<a name="line.2197"></a>
+<span class="sourceLineNo">2198</span>    CellScanner cellScanner = controller != null? controller.cellScanner(): null;<a name="line.2198"></a>
+<span class="sourceLineNo">2199</span>    OperationQuota quota = null;<a name="line.2199"></a>
+<span class="sourceLineNo">2200</span>    // Clear scanner so we are not holding on to reference across call.<a name="line.2200"></a>
+<span class="sourceLineNo">2201</span>    if (controller != null) controller.setCellScanner(null);<a name="line.2201"></a>
+<span class="sourceLineNo">2202</span>    try {<a name="line.2202"></a>
+<span class="sourceLineNo">2203</span>      checkOpen();<a name="line.2203"></a>
+<span class="sourceLineNo">2204</span>      requestCount.increment();<a name="line.2204"></a>
+<span class="sourceLineNo">2205</span>      Region region = getRegion(request.getRegion());<a name="line.2205"></a>
+<span class="sourceLineNo">2206</span>      MutateResponse.Builder builder = MutateResponse.newBuilder();<a name="line.2206"></a>
+<span class="sourceLineNo">2207</span>      MutationProto mutation = request.getMutation();<a name="line.2207"></a>
+<span class="sourceLineNo">2208</span>      if (!region.getRegionInfo().isMetaTable()) {<a name="line.2208"></a>
+<span class="sourceLineNo">2209</span>        regionServer.cacheFlusher.reclaimMemStoreMemory();<a name="line.2209"></a>
+<span class="sourceLineNo">2210</span>      }<a name="line.2210"></a>
+<span class="sourceLineNo">2211</span>      long nonceGroup = request.hasNonceGroup() ? request.getNonceGroup() : HConstants.NO_NONCE;<a name="line.2211"></a>
+<span class="sourceLineNo">2212</span>      Result r = null;<a name="line.2212"></a>
+<span class="sourceLineNo">2213</span>      Boolean processed = null;<a name="line.2213"></a>
+<span class="sourceLineNo">2214</span>      MutationType type = mutation.getMutateType();<a name="line.2214"></a>
 <span class="sourceLineNo">2215</span><a name="line.2215"></a>
-<span class="sourceLineNo">2216</span>      switch (type) {<a name="line.2216"></a>
-<span class="sourceLineNo">2217</span>      case APPEND:<a name="line.2217"></a>
-<span class="sourceLineNo">2218</span>        // TODO: this doesn't actually check anything.<a name="line.2218"></a>
-<span class="sourceLineNo">2219</span>        r = append(region, quota, mutation, cellScanner, nonceGroup);<a name="line.2219"></a>
-<span class="sourceLineNo">2220</span>        break;<a name="line.2220"></a>
-<span class="sourceLineNo">2221</span>      case INCREMENT:<a name="line.2221"></a>
-<span class="sourceLineNo">2222</span>        // TODO: this doesn't actually check anything.<a name="line.2222"></a>
-<span class="sourceLineNo">2223</span>        r = increment(region, quota, mutation, cellScanner, nonceGroup);<a name="line.2223"></a>
-<span class="sourceLineNo">2224</span>        break;<a name="line.2224"></a>
-<span class="sourceLineNo">2225</span>      case PUT:<a name="line.2225"></a>
-<span class="sourceLineNo">2226</span>        Put put = ProtobufUtil.toPut(mutation, cellScanner);<a name="line.2226"></a>
-<span class="sourceLineNo">2227</span>        quota.addMutation(put);<a name="line.2227"></a>
-<span class="sourceLineNo">2228</span>        if (request.hasCondition()) {<a name="line.2228"></a>
-<span class="sourceLineNo">2229</span>          Condition condition = request.getCondition();<a name="line.2229"></a>
-<span class="sourceLineNo">2230</span>          byte[] row = condition.getRow().toByteArray();<a name="line.2230"></a>
-<span class="sourceLineNo">2231</span>          byte[] family = condition.getFamily().toByteArray();<a name="line.2231"></a>
-<span class="sourceLineNo">2232</span>          byte[] qualifier = condition.getQualifier().toByteArray();<a name="line.2232"></a>
-<span class="sourceLineNo">2233</span>          CompareOp compareOp = CompareOp.valueOf(condition.getCompareType().name());<a name="line.2233"></a>
-<span class="sourceLineNo">2234</span>          ByteArrayComparable comparator =<a name="line.2234"></a>
-<span class="sourceLineNo">2235</span>            ProtobufUtil.toComparator(condition.getComparator());<a name="line.2235"></a>
-<span class

<TRUNCATED>

Mime
View raw message