hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [21/51] [partial] hbase-site git commit: Published site at .
Date Fri, 15 Dec 2017 15:18:00 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/071f974b/devapidocs/src-html/org/apache/hadoop/hbase/MetaTableAccessor.DefaultVisitorBase.html
----------------------------------------------------------------------
diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/MetaTableAccessor.DefaultVisitorBase.html b/devapidocs/src-html/org/apache/hadoop/hbase/MetaTableAccessor.DefaultVisitorBase.html
index f1a2443..a469e93 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/MetaTableAccessor.DefaultVisitorBase.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/MetaTableAccessor.DefaultVisitorBase.html
@@ -1350,415 +1350,415 @@
 <span class="sourceLineNo">1342</span>    return delete;<a name="line.1342"></a>
 <span class="sourceLineNo">1343</span>  }<a name="line.1343"></a>
 <span class="sourceLineNo">1344</span><a name="line.1344"></a>
-<span class="sourceLineNo">1345</span>  public static Put makeBarrierPut(byte[] encodedRegionName, long seq, byte[] tableName) {<a name="line.1345"></a>
-<span class="sourceLineNo">1346</span>    byte[] seqBytes = Bytes.toBytes(seq);<a name="line.1346"></a>
-<span class="sourceLineNo">1347</span>    return new Put(encodedRegionName)<a name="line.1347"></a>
-<span class="sourceLineNo">1348</span>        .addImmutable(HConstants.REPLICATION_BARRIER_FAMILY, seqBytes, seqBytes)<a name="line.1348"></a>
-<span class="sourceLineNo">1349</span>        .addImmutable(HConstants.REPLICATION_META_FAMILY, tableNameCq, tableName);<a name="line.1349"></a>
-<span class="sourceLineNo">1350</span>  }<a name="line.1350"></a>
-<span class="sourceLineNo">1351</span><a name="line.1351"></a>
-<span class="sourceLineNo">1352</span><a name="line.1352"></a>
-<span class="sourceLineNo">1353</span>  public static Put makeDaughterPut(byte[] encodedRegionName, byte[] value) {<a name="line.1353"></a>
-<span class="sourceLineNo">1354</span>    return new Put(encodedRegionName).addImmutable(HConstants.REPLICATION_META_FAMILY,<a name="line.1354"></a>
-<span class="sourceLineNo">1355</span>        daughterNameCq, value);<a name="line.1355"></a>
-<span class="sourceLineNo">1356</span>  }<a name="line.1356"></a>
-<span class="sourceLineNo">1357</span><a name="line.1357"></a>
-<span class="sourceLineNo">1358</span>  public static Put makeParentPut(byte[] encodedRegionName, byte[] value) {<a name="line.1358"></a>
-<span class="sourceLineNo">1359</span>    return new Put(encodedRegionName).addImmutable(HConstants.REPLICATION_META_FAMILY,<a name="line.1359"></a>
-<span class="sourceLineNo">1360</span>        parentNameCq, value);<a name="line.1360"></a>
-<span class="sourceLineNo">1361</span>  }<a name="line.1361"></a>
-<span class="sourceLineNo">1362</span><a name="line.1362"></a>
-<span class="sourceLineNo">1363</span>  /**<a name="line.1363"></a>
-<span class="sourceLineNo">1364</span>   * Adds split daughters to the Put<a name="line.1364"></a>
-<span class="sourceLineNo">1365</span>   */<a name="line.1365"></a>
-<span class="sourceLineNo">1366</span>  public static Put addDaughtersToPut(Put put, RegionInfo splitA, RegionInfo splitB) {<a name="line.1366"></a>
-<span class="sourceLineNo">1367</span>    if (splitA != null) {<a name="line.1367"></a>
-<span class="sourceLineNo">1368</span>      put.addImmutable(<a name="line.1368"></a>
-<span class="sourceLineNo">1369</span>        HConstants.CATALOG_FAMILY, HConstants.SPLITA_QUALIFIER, RegionInfo.toByteArray(splitA));<a name="line.1369"></a>
-<span class="sourceLineNo">1370</span>    }<a name="line.1370"></a>
-<span class="sourceLineNo">1371</span>    if (splitB != null) {<a name="line.1371"></a>
-<span class="sourceLineNo">1372</span>      put.addImmutable(<a name="line.1372"></a>
-<span class="sourceLineNo">1373</span>        HConstants.CATALOG_FAMILY, HConstants.SPLITB_QUALIFIER, RegionInfo.toByteArray(splitB));<a name="line.1373"></a>
-<span class="sourceLineNo">1374</span>    }<a name="line.1374"></a>
-<span class="sourceLineNo">1375</span>    return put;<a name="line.1375"></a>
-<span class="sourceLineNo">1376</span>  }<a name="line.1376"></a>
-<span class="sourceLineNo">1377</span><a name="line.1377"></a>
-<span class="sourceLineNo">1378</span>  /**<a name="line.1378"></a>
-<span class="sourceLineNo">1379</span>   * Put the passed &lt;code&gt;puts&lt;/code&gt; to the &lt;code&gt;hbase:meta&lt;/code&gt; table.<a name="line.1379"></a>
-<span class="sourceLineNo">1380</span>   * Non-atomic for multi puts.<a name="line.1380"></a>
-<span class="sourceLineNo">1381</span>   * @param connection connection we're using<a name="line.1381"></a>
-<span class="sourceLineNo">1382</span>   * @param puts Put to add to hbase:meta<a name="line.1382"></a>
-<span class="sourceLineNo">1383</span>   * @throws IOException<a name="line.1383"></a>
-<span class="sourceLineNo">1384</span>   */<a name="line.1384"></a>
-<span class="sourceLineNo">1385</span>  public static void putToMetaTable(final Connection connection, final Put... puts)<a name="line.1385"></a>
-<span class="sourceLineNo">1386</span>    throws IOException {<a name="line.1386"></a>
-<span class="sourceLineNo">1387</span>    put(getMetaHTable(connection), Arrays.asList(puts));<a name="line.1387"></a>
-<span class="sourceLineNo">1388</span>  }<a name="line.1388"></a>
-<span class="sourceLineNo">1389</span><a name="line.1389"></a>
-<span class="sourceLineNo">1390</span>  /**<a name="line.1390"></a>
-<span class="sourceLineNo">1391</span>   * @param t Table to use (will be closed when done).<a name="line.1391"></a>
-<span class="sourceLineNo">1392</span>   * @param puts puts to make<a name="line.1392"></a>
-<span class="sourceLineNo">1393</span>   * @throws IOException<a name="line.1393"></a>
-<span class="sourceLineNo">1394</span>   */<a name="line.1394"></a>
-<span class="sourceLineNo">1395</span>  private static void put(final Table t, final List&lt;Put&gt; puts) throws IOException {<a name="line.1395"></a>
-<span class="sourceLineNo">1396</span>    try {<a name="line.1396"></a>
-<span class="sourceLineNo">1397</span>      if (METALOG.isDebugEnabled()) {<a name="line.1397"></a>
-<span class="sourceLineNo">1398</span>        METALOG.debug(mutationsToString(puts));<a name="line.1398"></a>
-<span class="sourceLineNo">1399</span>      }<a name="line.1399"></a>
-<span class="sourceLineNo">1400</span>      t.put(puts);<a name="line.1400"></a>
-<span class="sourceLineNo">1401</span>    } finally {<a name="line.1401"></a>
-<span class="sourceLineNo">1402</span>      t.close();<a name="line.1402"></a>
-<span class="sourceLineNo">1403</span>    }<a name="line.1403"></a>
-<span class="sourceLineNo">1404</span>  }<a name="line.1404"></a>
-<span class="sourceLineNo">1405</span><a name="line.1405"></a>
-<span class="sourceLineNo">1406</span>  /**<a name="line.1406"></a>
-<span class="sourceLineNo">1407</span>   * Put the passed &lt;code&gt;ps&lt;/code&gt; to the &lt;code&gt;hbase:meta&lt;/code&gt; table.<a name="line.1407"></a>
-<span class="sourceLineNo">1408</span>   * @param connection connection we're using<a name="line.1408"></a>
-<span class="sourceLineNo">1409</span>   * @param ps Put to add to hbase:meta<a name="line.1409"></a>
-<span class="sourceLineNo">1410</span>   * @throws IOException<a name="line.1410"></a>
-<span class="sourceLineNo">1411</span>   */<a name="line.1411"></a>
-<span class="sourceLineNo">1412</span>  public static void putsToMetaTable(final Connection connection, final List&lt;Put&gt; ps)<a name="line.1412"></a>
-<span class="sourceLineNo">1413</span>    throws IOException {<a name="line.1413"></a>
-<span class="sourceLineNo">1414</span>    Table t = getMetaHTable(connection);<a name="line.1414"></a>
-<span class="sourceLineNo">1415</span>    try {<a name="line.1415"></a>
-<span class="sourceLineNo">1416</span>      if (METALOG.isDebugEnabled()) {<a name="line.1416"></a>
-<span class="sourceLineNo">1417</span>        METALOG.debug(mutationsToString(ps));<a name="line.1417"></a>
-<span class="sourceLineNo">1418</span>      }<a name="line.1418"></a>
-<span class="sourceLineNo">1419</span>      t.put(ps);<a name="line.1419"></a>
-<span class="sourceLineNo">1420</span>    } finally {<a name="line.1420"></a>
-<span class="sourceLineNo">1421</span>      t.close();<a name="line.1421"></a>
-<span class="sourceLineNo">1422</span>    }<a name="line.1422"></a>
-<span class="sourceLineNo">1423</span>  }<a name="line.1423"></a>
-<span class="sourceLineNo">1424</span><a name="line.1424"></a>
-<span class="sourceLineNo">1425</span>  /**<a name="line.1425"></a>
-<span class="sourceLineNo">1426</span>   * Delete the passed &lt;code&gt;d&lt;/code&gt; from the &lt;code&gt;hbase:meta&lt;/code&gt; table.<a name="line.1426"></a>
-<span class="sourceLineNo">1427</span>   * @param connection connection we're using<a name="line.1427"></a>
-<span class="sourceLineNo">1428</span>   * @param d Delete to add to hbase:meta<a name="line.1428"></a>
-<span class="sourceLineNo">1429</span>   * @throws IOException<a name="line.1429"></a>
-<span class="sourceLineNo">1430</span>   */<a name="line.1430"></a>
-<span class="sourceLineNo">1431</span>  static void deleteFromMetaTable(final Connection connection, final Delete d)<a name="line.1431"></a>
-<span class="sourceLineNo">1432</span>    throws IOException {<a name="line.1432"></a>
-<span class="sourceLineNo">1433</span>    List&lt;Delete&gt; dels = new ArrayList&lt;&gt;(1);<a name="line.1433"></a>
-<span class="sourceLineNo">1434</span>    dels.add(d);<a name="line.1434"></a>
-<span class="sourceLineNo">1435</span>    deleteFromMetaTable(connection, dels);<a name="line.1435"></a>
-<span class="sourceLineNo">1436</span>  }<a name="line.1436"></a>
-<span class="sourceLineNo">1437</span><a name="line.1437"></a>
-<span class="sourceLineNo">1438</span>  /**<a name="line.1438"></a>
-<span class="sourceLineNo">1439</span>   * Delete the passed &lt;code&gt;deletes&lt;/code&gt; from the &lt;code&gt;hbase:meta&lt;/code&gt; table.<a name="line.1439"></a>
-<span class="sourceLineNo">1440</span>   * @param connection connection we're using<a name="line.1440"></a>
-<span class="sourceLineNo">1441</span>   * @param deletes Deletes to add to hbase:meta  This list should support #remove.<a name="line.1441"></a>
-<span class="sourceLineNo">1442</span>   * @throws IOException<a name="line.1442"></a>
-<span class="sourceLineNo">1443</span>   */<a name="line.1443"></a>
-<span class="sourceLineNo">1444</span>  public static void deleteFromMetaTable(final Connection connection, final List&lt;Delete&gt; deletes)<a name="line.1444"></a>
-<span class="sourceLineNo">1445</span>    throws IOException {<a name="line.1445"></a>
-<span class="sourceLineNo">1446</span>    Table t = getMetaHTable(connection);<a name="line.1446"></a>
-<span class="sourceLineNo">1447</span>    try {<a name="line.1447"></a>
-<span class="sourceLineNo">1448</span>      if (METALOG.isDebugEnabled()) {<a name="line.1448"></a>
-<span class="sourceLineNo">1449</span>        METALOG.debug(mutationsToString(deletes));<a name="line.1449"></a>
-<span class="sourceLineNo">1450</span>      }<a name="line.1450"></a>
-<span class="sourceLineNo">1451</span>      t.delete(deletes);<a name="line.1451"></a>
-<span class="sourceLineNo">1452</span>    } finally {<a name="line.1452"></a>
-<span class="sourceLineNo">1453</span>      t.close();<a name="line.1453"></a>
-<span class="sourceLineNo">1454</span>    }<a name="line.1454"></a>
-<span class="sourceLineNo">1455</span>  }<a name="line.1455"></a>
-<span class="sourceLineNo">1456</span><a name="line.1456"></a>
-<span class="sourceLineNo">1457</span>  /**<a name="line.1457"></a>
-<span class="sourceLineNo">1458</span>   * Deletes some replica columns corresponding to replicas for the passed rows<a name="line.1458"></a>
-<span class="sourceLineNo">1459</span>   * @param metaRows rows in hbase:meta<a name="line.1459"></a>
-<span class="sourceLineNo">1460</span>   * @param replicaIndexToDeleteFrom the replica ID we would start deleting from<a name="line.1460"></a>
-<span class="sourceLineNo">1461</span>   * @param numReplicasToRemove how many replicas to remove<a name="line.1461"></a>
-<span class="sourceLineNo">1462</span>   * @param connection connection we're using to access meta table<a name="line.1462"></a>
-<span class="sourceLineNo">1463</span>   * @throws IOException<a name="line.1463"></a>
-<span class="sourceLineNo">1464</span>   */<a name="line.1464"></a>
-<span class="sourceLineNo">1465</span>  public static void removeRegionReplicasFromMeta(Set&lt;byte[]&gt; metaRows,<a name="line.1465"></a>
-<span class="sourceLineNo">1466</span>    int replicaIndexToDeleteFrom, int numReplicasToRemove, Connection connection)<a name="line.1466"></a>
-<span class="sourceLineNo">1467</span>      throws IOException {<a name="line.1467"></a>
-<span class="sourceLineNo">1468</span>    int absoluteIndex = replicaIndexToDeleteFrom + numReplicasToRemove;<a name="line.1468"></a>
-<span class="sourceLineNo">1469</span>    for (byte[] row : metaRows) {<a name="line.1469"></a>
-<span class="sourceLineNo">1470</span>      long now = EnvironmentEdgeManager.currentTime();<a name="line.1470"></a>
-<span class="sourceLineNo">1471</span>      Delete deleteReplicaLocations = new Delete(row);<a name="line.1471"></a>
-<span class="sourceLineNo">1472</span>      for (int i = replicaIndexToDeleteFrom; i &lt; absoluteIndex; i++) {<a name="line.1472"></a>
-<span class="sourceLineNo">1473</span>        deleteReplicaLocations.addColumns(getCatalogFamily(),<a name="line.1473"></a>
-<span class="sourceLineNo">1474</span>          getServerColumn(i), now);<a name="line.1474"></a>
-<span class="sourceLineNo">1475</span>        deleteReplicaLocations.addColumns(getCatalogFamily(),<a name="line.1475"></a>
-<span class="sourceLineNo">1476</span>          getSeqNumColumn(i), now);<a name="line.1476"></a>
-<span class="sourceLineNo">1477</span>        deleteReplicaLocations.addColumns(getCatalogFamily(),<a name="line.1477"></a>
-<span class="sourceLineNo">1478</span>          getStartCodeColumn(i), now);<a name="line.1478"></a>
-<span class="sourceLineNo">1479</span>      }<a name="line.1479"></a>
-<span class="sourceLineNo">1480</span>      deleteFromMetaTable(connection, deleteReplicaLocations);<a name="line.1480"></a>
-<span class="sourceLineNo">1481</span>    }<a name="line.1481"></a>
-<span class="sourceLineNo">1482</span>  }<a name="line.1482"></a>
-<span class="sourceLineNo">1483</span><a name="line.1483"></a>
-<span class="sourceLineNo">1484</span>  /**<a name="line.1484"></a>
-<span class="sourceLineNo">1485</span>   * Execute the passed &lt;code&gt;mutations&lt;/code&gt; against &lt;code&gt;hbase:meta&lt;/code&gt; table.<a name="line.1485"></a>
-<span class="sourceLineNo">1486</span>   * @param connection connection we're using<a name="line.1486"></a>
-<span class="sourceLineNo">1487</span>   * @param mutations Puts and Deletes to execute on hbase:meta<a name="line.1487"></a>
-<span class="sourceLineNo">1488</span>   * @throws IOException<a name="line.1488"></a>
-<span class="sourceLineNo">1489</span>   */<a name="line.1489"></a>
-<span class="sourceLineNo">1490</span>  public static void mutateMetaTable(final Connection connection,<a name="line.1490"></a>
-<span class="sourceLineNo">1491</span>                                     final List&lt;Mutation&gt; mutations)<a name="line.1491"></a>
-<span class="sourceLineNo">1492</span>    throws IOException {<a name="line.1492"></a>
-<span class="sourceLineNo">1493</span>    Table t = getMetaHTable(connection);<a name="line.1493"></a>
-<span class="sourceLineNo">1494</span>    try {<a name="line.1494"></a>
-<span class="sourceLineNo">1495</span>      if (METALOG.isDebugEnabled()) {<a name="line.1495"></a>
-<span class="sourceLineNo">1496</span>        METALOG.debug(mutationsToString(mutations));<a name="line.1496"></a>
-<span class="sourceLineNo">1497</span>      }<a name="line.1497"></a>
-<span class="sourceLineNo">1498</span>      t.batch(mutations, null);<a name="line.1498"></a>
-<span class="sourceLineNo">1499</span>    } catch (InterruptedException e) {<a name="line.1499"></a>
-<span class="sourceLineNo">1500</span>      InterruptedIOException ie = new InterruptedIOException(e.getMessage());<a name="line.1500"></a>
-<span class="sourceLineNo">1501</span>      ie.initCause(e);<a name="line.1501"></a>
-<span class="sourceLineNo">1502</span>      throw ie;<a name="line.1502"></a>
-<span class="sourceLineNo">1503</span>    } finally {<a name="line.1503"></a>
-<span class="sourceLineNo">1504</span>      t.close();<a name="line.1504"></a>
-<span class="sourceLineNo">1505</span>    }<a name="line.1505"></a>
-<span class="sourceLineNo">1506</span>  }<a name="line.1506"></a>
-<span class="sourceLineNo">1507</span><a name="line.1507"></a>
-<span class="sourceLineNo">1508</span>  /**<a name="line.1508"></a>
-<span class="sourceLineNo">1509</span>   * Adds a hbase:meta row for the specified new region.<a name="line.1509"></a>
-<span class="sourceLineNo">1510</span>   * @param connection connection we're using<a name="line.1510"></a>
-<span class="sourceLineNo">1511</span>   * @param regionInfo region information<a name="line.1511"></a>
-<span class="sourceLineNo">1512</span>   * @throws IOException if problem connecting or updating meta<a name="line.1512"></a>
-<span class="sourceLineNo">1513</span>   */<a name="line.1513"></a>
-<span class="sourceLineNo">1514</span>  public static void addRegionToMeta(Connection connection,<a name="line.1514"></a>
-<span class="sourceLineNo">1515</span>                                     RegionInfo regionInfo)<a name="line.1515"></a>
-<span class="sourceLineNo">1516</span>    throws IOException {<a name="line.1516"></a>
-<span class="sourceLineNo">1517</span>    putToMetaTable(connection, makePutFromRegionInfo(regionInfo));<a name="line.1517"></a>
-<span class="sourceLineNo">1518</span>    LOG.info("Added " + regionInfo.getRegionNameAsString());<a name="line.1518"></a>
-<span class="sourceLineNo">1519</span>  }<a name="line.1519"></a>
-<span class="sourceLineNo">1520</span><a name="line.1520"></a>
-<span class="sourceLineNo">1521</span>  /**<a name="line.1521"></a>
-<span class="sourceLineNo">1522</span>   * Adds a hbase:meta row for the specified new region to the given catalog table. The<a name="line.1522"></a>
-<span class="sourceLineNo">1523</span>   * Table is not flushed or closed.<a name="line.1523"></a>
-<span class="sourceLineNo">1524</span>   * @param meta the Table for META<a name="line.1524"></a>
-<span class="sourceLineNo">1525</span>   * @param regionInfo region information<a name="line.1525"></a>
-<span class="sourceLineNo">1526</span>   * @throws IOException if problem connecting or updating meta<a name="line.1526"></a>
-<span class="sourceLineNo">1527</span>   */<a name="line.1527"></a>
-<span class="sourceLineNo">1528</span>  public static void addRegionToMeta(Table meta, RegionInfo regionInfo) throws IOException {<a name="line.1528"></a>
-<span class="sourceLineNo">1529</span>    addRegionToMeta(meta, regionInfo, null, null);<a name="line.1529"></a>
-<span class="sourceLineNo">1530</span>  }<a name="line.1530"></a>
-<span class="sourceLineNo">1531</span><a name="line.1531"></a>
-<span class="sourceLineNo">1532</span>  /**<a name="line.1532"></a>
-<span class="sourceLineNo">1533</span>   * Adds a (single) hbase:meta row for the specified new region and its daughters. Note that this<a name="line.1533"></a>
-<span class="sourceLineNo">1534</span>   * does not add its daughter's as different rows, but adds information about the daughters<a name="line.1534"></a>
-<span class="sourceLineNo">1535</span>   * in the same row as the parent. Use<a name="line.1535"></a>
-<span class="sourceLineNo">1536</span>   * {@link #splitRegion(Connection, RegionInfo, RegionInfo, RegionInfo, ServerName,int,boolean)}<a name="line.1536"></a>
-<span class="sourceLineNo">1537</span>   * if you want to do that.<a name="line.1537"></a>
-<span class="sourceLineNo">1538</span>   * @param meta the Table for META<a name="line.1538"></a>
-<span class="sourceLineNo">1539</span>   * @param regionInfo region information<a name="line.1539"></a>
-<span class="sourceLineNo">1540</span>   * @param splitA first split daughter of the parent regionInfo<a name="line.1540"></a>
-<span class="sourceLineNo">1541</span>   * @param splitB second split daughter of the parent regionInfo<a name="line.1541"></a>
-<span class="sourceLineNo">1542</span>   * @throws IOException if problem connecting or updating meta<a name="line.1542"></a>
-<span class="sourceLineNo">1543</span>   */<a name="line.1543"></a>
-<span class="sourceLineNo">1544</span>  public static void addRegionToMeta(Table meta, RegionInfo regionInfo,<a name="line.1544"></a>
-<span class="sourceLineNo">1545</span>                                     RegionInfo splitA, RegionInfo splitB) throws IOException {<a name="line.1545"></a>
-<span class="sourceLineNo">1546</span>    Put put = makePutFromRegionInfo(regionInfo);<a name="line.1546"></a>
-<span class="sourceLineNo">1547</span>    addDaughtersToPut(put, splitA, splitB);<a name="line.1547"></a>
-<span class="sourceLineNo">1548</span>    meta.put(put);<a name="line.1548"></a>
-<span class="sourceLineNo">1549</span>    if (METALOG.isDebugEnabled()) {<a name="line.1549"></a>
-<span class="sourceLineNo">1550</span>      METALOG.debug(mutationToString(put));<a name="line.1550"></a>
-<span class="sourceLineNo">1551</span>    }<a name="line.1551"></a>
-<span class="sourceLineNo">1552</span>    if (LOG.isDebugEnabled()) {<a name="line.1552"></a>
-<span class="sourceLineNo">1553</span>      LOG.debug("Added " + regionInfo.getRegionNameAsString());<a name="line.1553"></a>
-<span class="sourceLineNo">1554</span>    }<a name="line.1554"></a>
-<span class="sourceLineNo">1555</span>  }<a name="line.1555"></a>
-<span class="sourceLineNo">1556</span><a name="line.1556"></a>
-<span class="sourceLineNo">1557</span>  /**<a name="line.1557"></a>
-<span class="sourceLineNo">1558</span>   * Adds a (single) hbase:meta row for the specified new region and its daughters. Note that this<a name="line.1558"></a>
-<span class="sourceLineNo">1559</span>   * does not add its daughter's as different rows, but adds information about the daughters<a name="line.1559"></a>
-<span class="sourceLineNo">1560</span>   * in the same row as the parent. Use<a name="line.1560"></a>
-<span class="sourceLineNo">1561</span>   * {@link #splitRegion(Connection, RegionInfo, RegionInfo, RegionInfo, ServerName,int,boolean)}<a name="line.1561"></a>
-<span class="sourceLineNo">1562</span>   * if you want to do that.<a name="line.1562"></a>
-<span class="sourceLineNo">1563</span>   * @param connection connection we're using<a name="line.1563"></a>
-<span class="sourceLineNo">1564</span>   * @param regionInfo region information<a name="line.1564"></a>
-<span class="sourceLineNo">1565</span>   * @param splitA first split daughter of the parent regionInfo<a name="line.1565"></a>
-<span class="sourceLineNo">1566</span>   * @param splitB second split daughter of the parent regionInfo<a name="line.1566"></a>
-<span class="sourceLineNo">1567</span>   * @throws IOException if problem connecting or updating meta<a name="line.1567"></a>
-<span class="sourceLineNo">1568</span>   */<a name="line.1568"></a>
-<span class="sourceLineNo">1569</span>  public static void addRegionToMeta(Connection connection, RegionInfo regionInfo,<a name="line.1569"></a>
-<span class="sourceLineNo">1570</span>                                     RegionInfo splitA, RegionInfo splitB) throws IOException {<a name="line.1570"></a>
-<span class="sourceLineNo">1571</span>    Table meta = getMetaHTable(connection);<a name="line.1571"></a>
-<span class="sourceLineNo">1572</span>    try {<a name="line.1572"></a>
-<span class="sourceLineNo">1573</span>      addRegionToMeta(meta, regionInfo, splitA, splitB);<a name="line.1573"></a>
-<span class="sourceLineNo">1574</span>    } finally {<a name="line.1574"></a>
-<span class="sourceLineNo">1575</span>      meta.close();<a name="line.1575"></a>
-<span class="sourceLineNo">1576</span>    }<a name="line.1576"></a>
-<span class="sourceLineNo">1577</span>  }<a name="line.1577"></a>
-<span class="sourceLineNo">1578</span><a name="line.1578"></a>
-<span class="sourceLineNo">1579</span>  /**<a name="line.1579"></a>
-<span class="sourceLineNo">1580</span>   * Adds a hbase:meta row for each of the specified new regions.<a name="line.1580"></a>
-<span class="sourceLineNo">1581</span>   * @param connection connection we're using<a name="line.1581"></a>
-<span class="sourceLineNo">1582</span>   * @param regionInfos region information list<a name="line.1582"></a>
-<span class="sourceLineNo">1583</span>   * @throws IOException if problem connecting or updating meta<a name="line.1583"></a>
-<span class="sourceLineNo">1584</span>   */<a name="line.1584"></a>
-<span class="sourceLineNo">1585</span>  public static void addRegionsToMeta(Connection connection,<a name="line.1585"></a>
-<span class="sourceLineNo">1586</span>                                      List&lt;RegionInfo&gt; regionInfos, int regionReplication)<a name="line.1586"></a>
-<span class="sourceLineNo">1587</span>    throws IOException {<a name="line.1587"></a>
-<span class="sourceLineNo">1588</span>    addRegionsToMeta(connection, regionInfos, regionReplication, HConstants.LATEST_TIMESTAMP);<a name="line.1588"></a>
-<span class="sourceLineNo">1589</span>  }<a name="line.1589"></a>
-<span class="sourceLineNo">1590</span>  /**<a name="line.1590"></a>
-<span class="sourceLineNo">1591</span>   * Adds a hbase:meta row for each of the specified new regions.<a name="line.1591"></a>
-<span class="sourceLineNo">1592</span>   * @param connection connection we're using<a name="line.1592"></a>
-<span class="sourceLineNo">1593</span>   * @param regionInfos region information list<a name="line.1593"></a>
-<span class="sourceLineNo">1594</span>   * @param regionReplication<a name="line.1594"></a>
-<span class="sourceLineNo">1595</span>   * @param ts desired timestamp<a name="line.1595"></a>
-<span class="sourceLineNo">1596</span>   * @throws IOException if problem connecting or updating meta<a name="line.1596"></a>
-<span class="sourceLineNo">1597</span>   */<a name="line.1597"></a>
-<span class="sourceLineNo">1598</span>  public static void addRegionsToMeta(Connection connection,<a name="line.1598"></a>
-<span class="sourceLineNo">1599</span>      List&lt;RegionInfo&gt; regionInfos, int regionReplication, long ts)<a name="line.1599"></a>
-<span class="sourceLineNo">1600</span>          throws IOException {<a name="line.1600"></a>
-<span class="sourceLineNo">1601</span>    List&lt;Put&gt; puts = new ArrayList&lt;&gt;();<a name="line.1601"></a>
-<span class="sourceLineNo">1602</span>    for (RegionInfo regionInfo : regionInfos) {<a name="line.1602"></a>
-<span class="sourceLineNo">1603</span>      if (RegionReplicaUtil.isDefaultReplica(regionInfo)) {<a name="line.1603"></a>
-<span class="sourceLineNo">1604</span>        Put put = makePutFromRegionInfo(regionInfo, ts);<a name="line.1604"></a>
-<span class="sourceLineNo">1605</span>        // Add empty locations for region replicas so that number of replicas can be cached<a name="line.1605"></a>
-<span class="sourceLineNo">1606</span>        // whenever the primary region is looked up from meta<a name="line.1606"></a>
-<span class="sourceLineNo">1607</span>        for (int i = 1; i &lt; regionReplication; i++) {<a name="line.1607"></a>
-<span class="sourceLineNo">1608</span>          addEmptyLocation(put, i);<a name="line.1608"></a>
-<span class="sourceLineNo">1609</span>        }<a name="line.1609"></a>
-<span class="sourceLineNo">1610</span>        puts.add(put);<a name="line.1610"></a>
-<span class="sourceLineNo">1611</span>      }<a name="line.1611"></a>
-<span class="sourceLineNo">1612</span>    }<a name="line.1612"></a>
-<span class="sourceLineNo">1613</span>    putsToMetaTable(connection, puts);<a name="line.1613"></a>
-<span class="sourceLineNo">1614</span>    LOG.info("Added " + puts.size());<a name="line.1614"></a>
-<span class="sourceLineNo">1615</span>  }<a name="line.1615"></a>
-<span class="sourceLineNo">1616</span><a name="line.1616"></a>
-<span class="sourceLineNo">1617</span>  /**<a name="line.1617"></a>
-<span class="sourceLineNo">1618</span>   * Adds a daughter region entry to meta.<a name="line.1618"></a>
-<span class="sourceLineNo">1619</span>   * @param regionInfo the region to put<a name="line.1619"></a>
-<span class="sourceLineNo">1620</span>   * @param sn the location of the region<a name="line.1620"></a>
-<span class="sourceLineNo">1621</span>   * @param openSeqNum the latest sequence number obtained when the region was open<a name="line.1621"></a>
-<span class="sourceLineNo">1622</span>   */<a name="line.1622"></a>
-<span class="sourceLineNo">1623</span>  public static void addDaughter(final Connection connection,<a name="line.1623"></a>
-<span class="sourceLineNo">1624</span>      final RegionInfo regionInfo, final ServerName sn, final long openSeqNum)<a name="line.1624"></a>
-<span class="sourceLineNo">1625</span>      throws NotAllMetaRegionsOnlineException, IOException {<a name="line.1625"></a>
-<span class="sourceLineNo">1626</span>    long now = EnvironmentEdgeManager.currentTime();<a name="line.1626"></a>
-<span class="sourceLineNo">1627</span>    Put put = new Put(regionInfo.getRegionName(), now);<a name="line.1627"></a>
-<span class="sourceLineNo">1628</span>    addRegionInfo(put, regionInfo);<a name="line.1628"></a>
-<span class="sourceLineNo">1629</span>    if (sn != null) {<a name="line.1629"></a>
-<span class="sourceLineNo">1630</span>      addLocation(put, sn, openSeqNum, -1, regionInfo.getReplicaId());<a name="line.1630"></a>
-<span class="sourceLineNo">1631</span>    }<a name="line.1631"></a>
-<span class="sourceLineNo">1632</span>    putToMetaTable(connection, put);<a name="line.1632"></a>
-<span class="sourceLineNo">1633</span>    LOG.info("Added daughter " + regionInfo.getEncodedName() +<a name="line.1633"></a>
-<span class="sourceLineNo">1634</span>      (sn == null? ", serverName=null": ", serverName=" + sn.toString()));<a name="line.1634"></a>
-<span class="sourceLineNo">1635</span>  }<a name="line.1635"></a>
-<span class="sourceLineNo">1636</span><a name="line.1636"></a>
-<span class="sourceLineNo">1637</span>  /**<a name="line.1637"></a>
-<span class="sourceLineNo">1638</span>   * Merge the two regions into one in an atomic operation. Deletes the two<a name="line.1638"></a>
-<span class="sourceLineNo">1639</span>   * merging regions in hbase:meta and adds the merged region with the information of<a name="line.1639"></a>
-<span class="sourceLineNo">1640</span>   * two merging regions.<a name="line.1640"></a>
-<span class="sourceLineNo">1641</span>   * @param connection connection we're using<a name="line.1641"></a>
-<span class="sourceLineNo">1642</span>   * @param mergedRegion the merged region<a name="line.1642"></a>
-<span class="sourceLineNo">1643</span>   * @param regionA<a name="line.1643"></a>
-<span class="sourceLineNo">1644</span>   * @param regionB<a name="line.1644"></a>
-<span class="sourceLineNo">1645</span>   * @param sn the location of the region<a name="line.1645"></a>
-<span class="sourceLineNo">1646</span>   * @param masterSystemTime<a name="line.1646"></a>
-<span class="sourceLineNo">1647</span>   * @param saveBarrier true if need save replication barrier in meta, used for serial replication<a name="line.1647"></a>
-<span class="sourceLineNo">1648</span>   * @throws IOException<a name="line.1648"></a>
-<span class="sourceLineNo">1649</span>   */<a name="line.1649"></a>
-<span class="sourceLineNo">1650</span>  public static void mergeRegions(final Connection connection, RegionInfo mergedRegion,<a name="line.1650"></a>
-<span class="sourceLineNo">1651</span>      RegionInfo regionA, RegionInfo regionB, ServerName sn, int regionReplication,<a name="line.1651"></a>
-<span class="sourceLineNo">1652</span>      long masterSystemTime, boolean saveBarrier)<a name="line.1652"></a>
-<span class="sourceLineNo">1653</span>          throws IOException {<a name="line.1653"></a>
-<span class="sourceLineNo">1654</span>    Table meta = getMetaHTable(connection);<a name="line.1654"></a>
-<span class="sourceLineNo">1655</span>    try {<a name="line.1655"></a>
-<span class="sourceLineNo">1656</span>      // use the maximum of what master passed us vs local time.<a name="line.1656"></a>
-<span class="sourceLineNo">1657</span>      long time = Math.max(EnvironmentEdgeManager.currentTime(), masterSystemTime);<a name="line.1657"></a>
-<span class="sourceLineNo">1658</span><a name="line.1658"></a>
-<span class="sourceLineNo">1659</span>      // Put for parent<a name="line.1659"></a>
-<span class="sourceLineNo">1660</span>      Put putOfMerged = makePutFromRegionInfo(mergedRegion, time);<a name="line.1660"></a>
-<span class="sourceLineNo">1661</span>      putOfMerged.addImmutable(HConstants.CATALOG_FAMILY, HConstants.MERGEA_QUALIFIER,<a name="line.1661"></a>
-<span class="sourceLineNo">1662</span>        RegionInfo.toByteArray(regionA));<a name="line.1662"></a>
-<span class="sourceLineNo">1663</span>      putOfMerged.addImmutable(HConstants.CATALOG_FAMILY, HConstants.MERGEB_QUALIFIER,<a name="line.1663"></a>
-<span class="sourceLineNo">1664</span>          RegionInfo.toByteArray(regionB));<a name="line.1664"></a>
-<span class="sourceLineNo">1665</span><a name="line.1665"></a>
-<span class="sourceLineNo">1666</span>      // Deletes for merging regions<a name="line.1666"></a>
-<span class="sourceLineNo">1667</span>      Delete deleteA = makeDeleteFromRegionInfo(regionA, time);<a name="line.1667"></a>
-<span class="sourceLineNo">1668</span>      Delete deleteB = makeDeleteFromRegionInfo(regionB, time);<a name="line.1668"></a>
-<span class="sourceLineNo">1669</span><a name="line.1669"></a>
-<span class="sourceLineNo">1670</span>      // The merged is a new region, openSeqNum = 1 is fine. ServerName may be null<a name="line.1670"></a>
-<span class="sourceLineNo">1671</span>      // if crash after merge happened but before we got to here.. means in-memory<a name="line.1671"></a>
-<span class="sourceLineNo">1672</span>      // locations of offlined merged, now-closed, regions is lost. Should be ok. We<a name="line.1672"></a>
-<span class="sourceLineNo">1673</span>      // assign the merged region later.<a name="line.1673"></a>
-<span class="sourceLineNo">1674</span>      if (sn != null) addLocation(putOfMerged, sn, 1, -1, mergedRegion.getReplicaId());<a name="line.1674"></a>
-<span class="sourceLineNo">1675</span><a name="line.1675"></a>
-<span class="sourceLineNo">1676</span>      // Add empty locations for region replicas of the merged region so that number of replicas can<a name="line.1676"></a>
-<span class="sourceLineNo">1677</span>      // be cached whenever the primary region is looked up from meta<a name="line.1677"></a>
-<span class="sourceLineNo">1678</span>      for (int i = 1; i &lt; regionReplication; i++) {<a name="line.1678"></a>
-<span class="sourceLineNo">1679</span>        addEmptyLocation(putOfMerged, i);<a name="line.1679"></a>
-<span class="sourceLineNo">1680</span>      }<a name="line.1680"></a>
+<span class="sourceLineNo">1345</span>  public static Put makeBarrierPut(byte[] encodedRegionName, long seq, byte[] tableName)<a name="line.1345"></a>
+<span class="sourceLineNo">1346</span>      throws IOException {<a name="line.1346"></a>
+<span class="sourceLineNo">1347</span>    byte[] seqBytes = Bytes.toBytes(seq);<a name="line.1347"></a>
+<span class="sourceLineNo">1348</span>    Put put = new Put(encodedRegionName);<a name="line.1348"></a>
+<span class="sourceLineNo">1349</span>    put.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)<a name="line.1349"></a>
+<span class="sourceLineNo">1350</span>            .setRow(put.getRow())<a name="line.1350"></a>
+<span class="sourceLineNo">1351</span>            .setFamily(HConstants.REPLICATION_BARRIER_FAMILY)<a name="line.1351"></a>
+<span class="sourceLineNo">1352</span>            .setQualifier(seqBytes)<a name="line.1352"></a>
+<span class="sourceLineNo">1353</span>            .setTimestamp(put.getTimeStamp())<a name="line.1353"></a>
+<span class="sourceLineNo">1354</span>            .setType(CellBuilder.DataType.Put)<a name="line.1354"></a>
+<span class="sourceLineNo">1355</span>            .setValue(seqBytes)<a name="line.1355"></a>
+<span class="sourceLineNo">1356</span>            .build())<a name="line.1356"></a>
+<span class="sourceLineNo">1357</span>       .add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)<a name="line.1357"></a>
+<span class="sourceLineNo">1358</span>            .setRow(put.getRow())<a name="line.1358"></a>
+<span class="sourceLineNo">1359</span>            .setFamily(HConstants.REPLICATION_META_FAMILY)<a name="line.1359"></a>
+<span class="sourceLineNo">1360</span>            .setQualifier(tableNameCq)<a name="line.1360"></a>
+<span class="sourceLineNo">1361</span>            .setTimestamp(put.getTimeStamp())<a name="line.1361"></a>
+<span class="sourceLineNo">1362</span>            .setType(CellBuilder.DataType.Put)<a name="line.1362"></a>
+<span class="sourceLineNo">1363</span>            .setValue(tableName)<a name="line.1363"></a>
+<span class="sourceLineNo">1364</span>            .build());<a name="line.1364"></a>
+<span class="sourceLineNo">1365</span>    return put;<a name="line.1365"></a>
+<span class="sourceLineNo">1366</span>  }<a name="line.1366"></a>
+<span class="sourceLineNo">1367</span><a name="line.1367"></a>
+<span class="sourceLineNo">1368</span><a name="line.1368"></a>
+<span class="sourceLineNo">1369</span>  public static Put makeDaughterPut(byte[] encodedRegionName, byte[] value) throws IOException {<a name="line.1369"></a>
+<span class="sourceLineNo">1370</span>    Put put = new Put(encodedRegionName);<a name="line.1370"></a>
+<span class="sourceLineNo">1371</span>    put.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)<a name="line.1371"></a>
+<span class="sourceLineNo">1372</span>            .setRow(put.getRow())<a name="line.1372"></a>
+<span class="sourceLineNo">1373</span>            .setFamily(HConstants.REPLICATION_META_FAMILY)<a name="line.1373"></a>
+<span class="sourceLineNo">1374</span>            .setQualifier(daughterNameCq)<a name="line.1374"></a>
+<span class="sourceLineNo">1375</span>            .setTimestamp(put.getTimeStamp())<a name="line.1375"></a>
+<span class="sourceLineNo">1376</span>            .setType(CellBuilder.DataType.Put)<a name="line.1376"></a>
+<span class="sourceLineNo">1377</span>            .setValue(value)<a name="line.1377"></a>
+<span class="sourceLineNo">1378</span>            .build());<a name="line.1378"></a>
+<span class="sourceLineNo">1379</span>    return put;<a name="line.1379"></a>
+<span class="sourceLineNo">1380</span>  }<a name="line.1380"></a>
+<span class="sourceLineNo">1381</span><a name="line.1381"></a>
+<span class="sourceLineNo">1382</span>  public static Put makeParentPut(byte[] encodedRegionName, byte[] value) throws IOException {<a name="line.1382"></a>
+<span class="sourceLineNo">1383</span>    Put put = new Put(encodedRegionName);<a name="line.1383"></a>
+<span class="sourceLineNo">1384</span>    put.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)<a name="line.1384"></a>
+<span class="sourceLineNo">1385</span>            .setRow(put.getRow())<a name="line.1385"></a>
+<span class="sourceLineNo">1386</span>            .setFamily(HConstants.REPLICATION_META_FAMILY)<a name="line.1386"></a>
+<span class="sourceLineNo">1387</span>            .setQualifier(parentNameCq)<a name="line.1387"></a>
+<span class="sourceLineNo">1388</span>            .setTimestamp(put.getTimeStamp())<a name="line.1388"></a>
+<span class="sourceLineNo">1389</span>            .setType(CellBuilder.DataType.Put)<a name="line.1389"></a>
+<span class="sourceLineNo">1390</span>            .setValue(value)<a name="line.1390"></a>
+<span class="sourceLineNo">1391</span>            .build());<a name="line.1391"></a>
+<span class="sourceLineNo">1392</span>    return put;<a name="line.1392"></a>
+<span class="sourceLineNo">1393</span>  }<a name="line.1393"></a>
+<span class="sourceLineNo">1394</span><a name="line.1394"></a>
+<span class="sourceLineNo">1395</span>  /**<a name="line.1395"></a>
+<span class="sourceLineNo">1396</span>   * Adds split daughters to the Put<a name="line.1396"></a>
+<span class="sourceLineNo">1397</span>   */<a name="line.1397"></a>
+<span class="sourceLineNo">1398</span>  public static Put addDaughtersToPut(Put put, RegionInfo splitA, RegionInfo splitB)<a name="line.1398"></a>
+<span class="sourceLineNo">1399</span>      throws IOException {<a name="line.1399"></a>
+<span class="sourceLineNo">1400</span>    if (splitA != null) {<a name="line.1400"></a>
+<span class="sourceLineNo">1401</span>      put.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)<a name="line.1401"></a>
+<span class="sourceLineNo">1402</span>                .setRow(put.getRow())<a name="line.1402"></a>
+<span class="sourceLineNo">1403</span>                .setFamily(HConstants.CATALOG_FAMILY)<a name="line.1403"></a>
+<span class="sourceLineNo">1404</span>                .setQualifier(HConstants.SPLITA_QUALIFIER)<a name="line.1404"></a>
+<span class="sourceLineNo">1405</span>                .setTimestamp(put.getTimeStamp())<a name="line.1405"></a>
+<span class="sourceLineNo">1406</span>                .setType(CellBuilder.DataType.Put)<a name="line.1406"></a>
+<span class="sourceLineNo">1407</span>                .setValue(RegionInfo.toByteArray(splitA))<a name="line.1407"></a>
+<span class="sourceLineNo">1408</span>                .build());<a name="line.1408"></a>
+<span class="sourceLineNo">1409</span>    }<a name="line.1409"></a>
+<span class="sourceLineNo">1410</span>    if (splitB != null) {<a name="line.1410"></a>
+<span class="sourceLineNo">1411</span>      put.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)<a name="line.1411"></a>
+<span class="sourceLineNo">1412</span>                .setRow(put.getRow())<a name="line.1412"></a>
+<span class="sourceLineNo">1413</span>                .setFamily(HConstants.CATALOG_FAMILY)<a name="line.1413"></a>
+<span class="sourceLineNo">1414</span>                .setQualifier(HConstants.SPLITB_QUALIFIER)<a name="line.1414"></a>
+<span class="sourceLineNo">1415</span>                .setTimestamp(put.getTimeStamp())<a name="line.1415"></a>
+<span class="sourceLineNo">1416</span>                .setType(CellBuilder.DataType.Put)<a name="line.1416"></a>
+<span class="sourceLineNo">1417</span>                .setValue(RegionInfo.toByteArray(splitB))<a name="line.1417"></a>
+<span class="sourceLineNo">1418</span>                .build());<a name="line.1418"></a>
+<span class="sourceLineNo">1419</span>    }<a name="line.1419"></a>
+<span class="sourceLineNo">1420</span>    return put;<a name="line.1420"></a>
+<span class="sourceLineNo">1421</span>  }<a name="line.1421"></a>
+<span class="sourceLineNo">1422</span><a name="line.1422"></a>
+<span class="sourceLineNo">1423</span>  /**<a name="line.1423"></a>
+<span class="sourceLineNo">1424</span>   * Put the passed &lt;code&gt;puts&lt;/code&gt; to the &lt;code&gt;hbase:meta&lt;/code&gt; table.<a name="line.1424"></a>
+<span class="sourceLineNo">1425</span>   * Non-atomic for multi puts.<a name="line.1425"></a>
+<span class="sourceLineNo">1426</span>   * @param connection connection we're using<a name="line.1426"></a>
+<span class="sourceLineNo">1427</span>   * @param puts Put to add to hbase:meta<a name="line.1427"></a>
+<span class="sourceLineNo">1428</span>   * @throws IOException<a name="line.1428"></a>
+<span class="sourceLineNo">1429</span>   */<a name="line.1429"></a>
+<span class="sourceLineNo">1430</span>  public static void putToMetaTable(final Connection connection, final Put... puts)<a name="line.1430"></a>
+<span class="sourceLineNo">1431</span>    throws IOException {<a name="line.1431"></a>
+<span class="sourceLineNo">1432</span>    put(getMetaHTable(connection), Arrays.asList(puts));<a name="line.1432"></a>
+<span class="sourceLineNo">1433</span>  }<a name="line.1433"></a>
+<span class="sourceLineNo">1434</span><a name="line.1434"></a>
+<span class="sourceLineNo">1435</span>  /**<a name="line.1435"></a>
+<span class="sourceLineNo">1436</span>   * @param t Table to use (will be closed when done).<a name="line.1436"></a>
+<span class="sourceLineNo">1437</span>   * @param puts puts to make<a name="line.1437"></a>
+<span class="sourceLineNo">1438</span>   * @throws IOException<a name="line.1438"></a>
+<span class="sourceLineNo">1439</span>   */<a name="line.1439"></a>
+<span class="sourceLineNo">1440</span>  private static void put(final Table t, final List&lt;Put&gt; puts) throws IOException {<a name="line.1440"></a>
+<span class="sourceLineNo">1441</span>    try {<a name="line.1441"></a>
+<span class="sourceLineNo">1442</span>      if (METALOG.isDebugEnabled()) {<a name="line.1442"></a>
+<span class="sourceLineNo">1443</span>        METALOG.debug(mutationsToString(puts));<a name="line.1443"></a>
+<span class="sourceLineNo">1444</span>      }<a name="line.1444"></a>
+<span class="sourceLineNo">1445</span>      t.put(puts);<a name="line.1445"></a>
+<span class="sourceLineNo">1446</span>    } finally {<a name="line.1446"></a>
+<span class="sourceLineNo">1447</span>      t.close();<a name="line.1447"></a>
+<span class="sourceLineNo">1448</span>    }<a name="line.1448"></a>
+<span class="sourceLineNo">1449</span>  }<a name="line.1449"></a>
+<span class="sourceLineNo">1450</span><a name="line.1450"></a>
+<span class="sourceLineNo">1451</span>  /**<a name="line.1451"></a>
+<span class="sourceLineNo">1452</span>   * Put the passed &lt;code&gt;ps&lt;/code&gt; to the &lt;code&gt;hbase:meta&lt;/code&gt; table.<a name="line.1452"></a>
+<span class="sourceLineNo">1453</span>   * @param connection connection we're using<a name="line.1453"></a>
+<span class="sourceLineNo">1454</span>   * @param ps Put to add to hbase:meta<a name="line.1454"></a>
+<span class="sourceLineNo">1455</span>   * @throws IOException<a name="line.1455"></a>
+<span class="sourceLineNo">1456</span>   */<a name="line.1456"></a>
+<span class="sourceLineNo">1457</span>  public static void putsToMetaTable(final Connection connection, final List&lt;Put&gt; ps)<a name="line.1457"></a>
+<span class="sourceLineNo">1458</span>    throws IOException {<a name="line.1458"></a>
+<span class="sourceLineNo">1459</span>    Table t = getMetaHTable(connection);<a name="line.1459"></a>
+<span class="sourceLineNo">1460</span>    try {<a name="line.1460"></a>
+<span class="sourceLineNo">1461</span>      if (METALOG.isDebugEnabled()) {<a name="line.1461"></a>
+<span class="sourceLineNo">1462</span>        METALOG.debug(mutationsToString(ps));<a name="line.1462"></a>
+<span class="sourceLineNo">1463</span>      }<a name="line.1463"></a>
+<span class="sourceLineNo">1464</span>      t.put(ps);<a name="line.1464"></a>
+<span class="sourceLineNo">1465</span>    } finally {<a name="line.1465"></a>
+<span class="sourceLineNo">1466</span>      t.close();<a name="line.1466"></a>
+<span class="sourceLineNo">1467</span>    }<a name="line.1467"></a>
+<span class="sourceLineNo">1468</span>  }<a name="line.1468"></a>
+<span class="sourceLineNo">1469</span><a name="line.1469"></a>
+<span class="sourceLineNo">1470</span>  /**<a name="line.1470"></a>
+<span class="sourceLineNo">1471</span>   * Delete the passed &lt;code&gt;d&lt;/code&gt; from the &lt;code&gt;hbase:meta&lt;/code&gt; table.<a name="line.1471"></a>
+<span class="sourceLineNo">1472</span>   * @param connection connection we're using<a name="line.1472"></a>
+<span class="sourceLineNo">1473</span>   * @param d Delete to add to hbase:meta<a name="line.1473"></a>
+<span class="sourceLineNo">1474</span>   * @throws IOException<a name="line.1474"></a>
+<span class="sourceLineNo">1475</span>   */<a name="line.1475"></a>
+<span class="sourceLineNo">1476</span>  static void deleteFromMetaTable(final Connection connection, final Delete d)<a name="line.1476"></a>
+<span class="sourceLineNo">1477</span>    throws IOException {<a name="line.1477"></a>
+<span class="sourceLineNo">1478</span>    List&lt;Delete&gt; dels = new ArrayList&lt;&gt;(1);<a name="line.1478"></a>
+<span class="sourceLineNo">1479</span>    dels.add(d);<a name="line.1479"></a>
+<span class="sourceLineNo">1480</span>    deleteFromMetaTable(connection, dels);<a name="line.1480"></a>
+<span class="sourceLineNo">1481</span>  }<a name="line.1481"></a>
+<span class="sourceLineNo">1482</span><a name="line.1482"></a>
+<span class="sourceLineNo">1483</span>  /**<a name="line.1483"></a>
+<span class="sourceLineNo">1484</span>   * Delete the passed &lt;code&gt;deletes&lt;/code&gt; from the &lt;code&gt;hbase:meta&lt;/code&gt; table.<a name="line.1484"></a>
+<span class="sourceLineNo">1485</span>   * @param connection connection we're using<a name="line.1485"></a>
+<span class="sourceLineNo">1486</span>   * @param deletes Deletes to add to hbase:meta  This list should support #remove.<a name="line.1486"></a>
+<span class="sourceLineNo">1487</span>   * @throws IOException<a name="line.1487"></a>
+<span class="sourceLineNo">1488</span>   */<a name="line.1488"></a>
+<span class="sourceLineNo">1489</span>  public static void deleteFromMetaTable(final Connection connection, final List&lt;Delete&gt; deletes)<a name="line.1489"></a>
+<span class="sourceLineNo">1490</span>    throws IOException {<a name="line.1490"></a>
+<span class="sourceLineNo">1491</span>    Table t = getMetaHTable(connection);<a name="line.1491"></a>
+<span class="sourceLineNo">1492</span>    try {<a name="line.1492"></a>
+<span class="sourceLineNo">1493</span>      if (METALOG.isDebugEnabled()) {<a name="line.1493"></a>
+<span class="sourceLineNo">1494</span>        METALOG.debug(mutationsToString(deletes));<a name="line.1494"></a>
+<span class="sourceLineNo">1495</span>      }<a name="line.1495"></a>
+<span class="sourceLineNo">1496</span>      t.delete(deletes);<a name="line.1496"></a>
+<span class="sourceLineNo">1497</span>    } finally {<a name="line.1497"></a>
+<span class="sourceLineNo">1498</span>      t.close();<a name="line.1498"></a>
+<span class="sourceLineNo">1499</span>    }<a name="line.1499"></a>
+<span class="sourceLineNo">1500</span>  }<a name="line.1500"></a>
+<span class="sourceLineNo">1501</span><a name="line.1501"></a>
+<span class="sourceLineNo">1502</span>  /**<a name="line.1502"></a>
+<span class="sourceLineNo">1503</span>   * Deletes some replica columns corresponding to replicas for the passed rows<a name="line.1503"></a>
+<span class="sourceLineNo">1504</span>   * @param metaRows rows in hbase:meta<a name="line.1504"></a>
+<span class="sourceLineNo">1505</span>   * @param replicaIndexToDeleteFrom the replica ID we would start deleting from<a name="line.1505"></a>
+<span class="sourceLineNo">1506</span>   * @param numReplicasToRemove how many replicas to remove<a name="line.1506"></a>
+<span class="sourceLineNo">1507</span>   * @param connection connection we're using to access meta table<a name="line.1507"></a>
+<span class="sourceLineNo">1508</span>   * @throws IOException<a name="line.1508"></a>
+<span class="sourceLineNo">1509</span>   */<a name="line.1509"></a>
+<span class="sourceLineNo">1510</span>  public static void removeRegionReplicasFromMeta(Set&lt;byte[]&gt; metaRows,<a name="line.1510"></a>
+<span class="sourceLineNo">1511</span>    int replicaIndexToDeleteFrom, int numReplicasToRemove, Connection connection)<a name="line.1511"></a>
+<span class="sourceLineNo">1512</span>      throws IOException {<a name="line.1512"></a>
+<span class="sourceLineNo">1513</span>    int absoluteIndex = replicaIndexToDeleteFrom + numReplicasToRemove;<a name="line.1513"></a>
+<span class="sourceLineNo">1514</span>    for (byte[] row : metaRows) {<a name="line.1514"></a>
+<span class="sourceLineNo">1515</span>      long now = EnvironmentEdgeManager.currentTime();<a name="line.1515"></a>
+<span class="sourceLineNo">1516</span>      Delete deleteReplicaLocations = new Delete(row);<a name="line.1516"></a>
+<span class="sourceLineNo">1517</span>      for (int i = replicaIndexToDeleteFrom; i &lt; absoluteIndex; i++) {<a name="line.1517"></a>
+<span class="sourceLineNo">1518</span>        deleteReplicaLocations.addColumns(getCatalogFamily(),<a name="line.1518"></a>
+<span class="sourceLineNo">1519</span>          getServerColumn(i), now);<a name="line.1519"></a>
+<span class="sourceLineNo">1520</span>        deleteReplicaLocations.addColumns(getCatalogFamily(),<a name="line.1520"></a>
+<span class="sourceLineNo">1521</span>          getSeqNumColumn(i), now);<a name="line.1521"></a>
+<span class="sourceLineNo">1522</span>        deleteReplicaLocations.addColumns(getCatalogFamily(),<a name="line.1522"></a>
+<span class="sourceLineNo">1523</span>          getStartCodeColumn(i), now);<a name="line.1523"></a>
+<span class="sourceLineNo">1524</span>      }<a name="line.1524"></a>
+<span class="sourceLineNo">1525</span>      deleteFromMetaTable(connection, deleteReplicaLocations);<a name="line.1525"></a>
+<span class="sourceLineNo">1526</span>    }<a name="line.1526"></a>
+<span class="sourceLineNo">1527</span>  }<a name="line.1527"></a>
+<span class="sourceLineNo">1528</span><a name="line.1528"></a>
+<span class="sourceLineNo">1529</span>  /**<a name="line.1529"></a>
+<span class="sourceLineNo">1530</span>   * Execute the passed &lt;code&gt;mutations&lt;/code&gt; against &lt;code&gt;hbase:meta&lt;/code&gt; table.<a name="line.1530"></a>
+<span class="sourceLineNo">1531</span>   * @param connection connection we're using<a name="line.1531"></a>
+<span class="sourceLineNo">1532</span>   * @param mutations Puts and Deletes to execute on hbase:meta<a name="line.1532"></a>
+<span class="sourceLineNo">1533</span>   * @throws IOException<a name="line.1533"></a>
+<span class="sourceLineNo">1534</span>   */<a name="line.1534"></a>
+<span class="sourceLineNo">1535</span>  public static void mutateMetaTable(final Connection connection,<a name="line.1535"></a>
+<span class="sourceLineNo">1536</span>                                     final List&lt;Mutation&gt; mutations)<a name="line.1536"></a>
+<span class="sourceLineNo">1537</span>    throws IOException {<a name="line.1537"></a>
+<span class="sourceLineNo">1538</span>    Table t = getMetaHTable(connection);<a name="line.1538"></a>
+<span class="sourceLineNo">1539</span>    try {<a name="line.1539"></a>
+<span class="sourceLineNo">1540</span>      if (METALOG.isDebugEnabled()) {<a name="line.1540"></a>
+<span class="sourceLineNo">1541</span>        METALOG.debug(mutationsToString(mutations));<a name="line.1541"></a>
+<span class="sourceLineNo">1542</span>      }<a name="line.1542"></a>
+<span class="sourceLineNo">1543</span>      t.batch(mutations, null);<a name="line.1543"></a>
+<span class="sourceLineNo">1544</span>    } catch (InterruptedException e) {<a name="line.1544"></a>
+<span class="sourceLineNo">1545</span>      InterruptedIOException ie = new InterruptedIOException(e.getMessage());<a name="line.1545"></a>
+<span class="sourceLineNo">1546</span>      ie.initCause(e);<a name="line.1546"></a>
+<span class="sourceLineNo">1547</span>      throw ie;<a name="line.1547"></a>
+<span class="sourceLineNo">1548</span>    } finally {<a name="line.1548"></a>
+<span class="sourceLineNo">1549</span>      t.close();<a name="line.1549"></a>
+<span class="sourceLineNo">1550</span>    }<a name="line.1550"></a>
+<span class="sourceLineNo">1551</span>  }<a name="line.1551"></a>
+<span class="sourceLineNo">1552</span><a name="line.1552"></a>
+<span class="sourceLineNo">1553</span>  /**<a name="line.1553"></a>
+<span class="sourceLineNo">1554</span>   * Adds a hbase:meta row for the specified new region.<a name="line.1554"></a>
+<span class="sourceLineNo">1555</span>   * @param connection connection we're using<a name="line.1555"></a>
+<span class="sourceLineNo">1556</span>   * @param regionInfo region information<a name="line.1556"></a>
+<span class="sourceLineNo">1557</span>   * @throws IOException if problem connecting or updating meta<a name="line.1557"></a>
+<span class="sourceLineNo">1558</span>   */<a name="line.1558"></a>
+<span class="sourceLineNo">1559</span>  public static void addRegionToMeta(Connection connection,<a name="line.1559"></a>
+<span class="sourceLineNo">1560</span>                                     RegionInfo regionInfo)<a name="line.1560"></a>
+<span class="sourceLineNo">1561</span>    throws IOException {<a name="line.1561"></a>
+<span class="sourceLineNo">1562</span>    putToMetaTable(connection, makePutFromRegionInfo(regionInfo));<a name="line.1562"></a>
+<span class="sourceLineNo">1563</span>    LOG.info("Added " + regionInfo.getRegionNameAsString());<a name="line.1563"></a>
+<span class="sourceLineNo">1564</span>  }<a name="line.1564"></a>
+<span class="sourceLineNo">1565</span><a name="line.1565"></a>
+<span class="sourceLineNo">1566</span>  /**<a name="line.1566"></a>
+<span class="sourceLineNo">1567</span>   * Adds a hbase:meta row for the specified new region to the given catalog table. The<a name="line.1567"></a>
+<span class="sourceLineNo">1568</span>   * Table is not flushed or closed.<a name="line.1568"></a>
+<span class="sourceLineNo">1569</span>   * @param meta the Table for META<a name="line.1569"></a>
+<span class="sourceLineNo">1570</span>   * @param regionInfo region information<a name="line.1570"></a>
+<span class="sourceLineNo">1571</span>   * @throws IOException if problem connecting or updating meta<a name="line.1571"></a>
+<span class="sourceLineNo">1572</span>   */<a name="line.1572"></a>
+<span class="sourceLineNo">1573</span>  public static void addRegionToMeta(Table meta, RegionInfo regionInfo) throws IOException {<a name="line.1573"></a>
+<span class="sourceLineNo">1574</span>    addRegionToMeta(meta, regionInfo, null, null);<a name="line.1574"></a>
+<span class="sourceLineNo">1575</span>  }<a name="line.1575"></a>
+<span class="sourceLineNo">1576</span><a name="line.1576"></a>
+<span class="sourceLineNo">1577</span>  /**<a name="line.1577"></a>
+<span class="sourceLineNo">1578</span>   * Adds a (single) hbase:meta row for the specified new region and its daughters. Note that this<a name="line.1578"></a>
+<span class="sourceLineNo">1579</span>   * does not add its daughter's as different rows, but adds information about the daughters<a name="line.1579"></a>
+<span class="sourceLineNo">1580</span>   * in the same row as the parent. Use<a name="line.1580"></a>
+<span class="sourceLineNo">1581</span>   * {@link #splitRegion(Connection, RegionInfo, RegionInfo, RegionInfo, ServerName,int,boolean)}<a name="line.1581"></a>
+<span class="sourceLineNo">1582</span>   * if you want to do that.<a name="line.1582"></a>
+<span class="sourceLineNo">1583</span>   * @param meta the Table for META<a name="line.1583"></a>
+<span class="sourceLineNo">1584</span>   * @param regionInfo region information<a name="line.1584"></a>
+<span class="sourceLineNo">1585</span>   * @param splitA first split daughter of the parent regionInfo<a name="line.1585"></a>
+<span class="sourceLineNo">1586</span>   * @param splitB second split daughter of the parent regionInfo<a name="line.1586"></a>
+<span class="sourceLineNo">1587</span>   * @throws IOException if problem connecting or updating meta<a name="line.1587"></a>
+<span class="sourceLineNo">1588</span>   */<a name="line.1588"></a>
+<span class="sourceLineNo">1589</span>  public static void addRegionToMeta(Table meta, RegionInfo regionInfo,<a name="line.1589"></a>
+<span class="sourceLineNo">1590</span>                                     RegionInfo splitA, RegionInfo splitB) throws IOException {<a name="line.1590"></a>
+<span class="sourceLineNo">1591</span>    Put put = makePutFromRegionInfo(regionInfo);<a name="line.1591"></a>
+<span class="sourceLineNo">1592</span>    addDaughtersToPut(put, splitA, splitB);<a name="line.1592"></a>
+<span class="sourceLineNo">1593</span>    meta.put(put);<a name="line.1593"></a>
+<span class="sourceLineNo">1594</span>    if (METALOG.isDebugEnabled()) {<a name="line.1594"></a>
+<span class="sourceLineNo">1595</span>      METALOG.debug(mutationToString(put));<a name="line.1595"></a>
+<span class="sourceLineNo">1596</span>    }<a name="line.1596"></a>
+<span class="sourceLineNo">1597</span>    if (LOG.isDebugEnabled()) {<a name="line.1597"></a>
+<span class="sourceLineNo">1598</span>      LOG.debug("Added " + regionInfo.getRegionNameAsString());<a name="line.1598"></a>
+<span class="sourceLineNo">1599</span>    }<a name="line.1599"></a>
+<span class="sourceLineNo">1600</span>  }<a name="line.1600"></a>
+<span class="sourceLineNo">1601</span><a name="line.1601"></a>
+<span class="sourceLineNo">1602</span>  /**<a name="line.1602"></a>
+<span class="sourceLineNo">1603</span>   * Adds a (single) hbase:meta row for the specified new region and its daughters. Note that this<a name="line.1603"></a>
+<span class="sourceLineNo">1604</span>   * does not add its daughter's as different rows, but adds information about the daughters<a name="line.1604"></a>
+<span class="sourceLineNo">1605</span>   * in the same row as the parent. Use<a name="line.1605"></a>
+<span class="sourceLineNo">1606</span>   * {@link #splitRegion(Connection, RegionInfo, RegionInfo, RegionInfo, ServerName,int,boolean)}<a name="line.1606"></a>
+<span class="sourceLineNo">1607</span>   * if you want to do that.<a name="line.1607"></a>
+<span class="sourceLineNo">1608</span>   * @param connection connection we're using<a name="line.1608"></a>
+<span class="sourceLineNo">1609</span>   * @param regionInfo region information<a name="line.1609"></a>
+<span class="sourceLineNo">1610</span>   * @param splitA first split daughter of the parent regionInfo<a name="line.1610"></a>
+<span class="sourceLineNo">1611</span>   * @param splitB second split daughter of the parent regionInfo<a name="line.1611"></a>
+<span class="sourceLineNo">1612</span>   * @throws IOException if problem connecting or updating meta<a name="line.1612"></a>
+<span class="sourceLineNo">1613</span>   */<a name="line.1613"></a>
+<span class="sourceLineNo">1614</span>  public static void addRegionToMeta(Connection connection, RegionInfo regionInfo,<a name="line.1614"></a>
+<span class="sourceLineNo">1615</span>                                     RegionInfo splitA, RegionInfo splitB) throws IOException {<a name="line.1615"></a>
+<span class="sourceLineNo">1616</span>    Table meta = getMetaHTable(connection);<a name="line.1616"></a>
+<span class="sourceLineNo">1617</span>    try {<a name="line.1617"></a>
+<span class="sourceLineNo">1618</span>      addRegionToMeta(meta, regionInfo, splitA, splitB);<a name="line.1618"></a>
+<span class="sourceLineNo">1619</span>    } finally {<a name="line.1619"></a>
+<span class="sourceLineNo">1620</span>      meta.close();<a name="line.1620"></a>
+<span class="sourceLineNo">1621</span>    }<a name="line.1621"></a>
+<span class="sourceLineNo">1622</span>  }<a name="line.1622"></a>
+<span class="sourceLineNo">1623</span><a name="line.1623"></a>
+<span class="sourceLineNo">1624</span>  /**<a name="line.1624"></a>
+<span class="sourceLineNo">1625</span>   * Adds a hbase:meta row for each of the specified new regions.<a name="line.1625"></a>
+<span class="sourceLineNo">1626</span>   * @param connection connection we're using<a name="line.1626"></a>
+<span class="sourceLineNo">1627</span>   * @param regionInfos region information list<a name="line.1627"></a>
+<span class="sourceLineNo">1628</span>   * @throws IOException if problem connecting or updating meta<a name="line.1628"></a>
+<span class="sourceLineNo">1629</span>   */<a name="line.1629"></a>
+<span class="sourceLineNo">1630</span>  public static void addRegionsToMeta(Connection connection,<a name="line.1630"></a>
+<span class="sourceLineNo">1631</span>                                      List&lt;RegionInfo&gt; regionInfos, int regionReplication)<a name="line.1631"></a>
+<span class="sourceLineNo">1632</span>    throws IOException {<a name="line.1632"></a>
+<span class="sourceLineNo">1633</span>    addRegionsToMeta(connection, regionInfos, regionReplication, HConstants.LATEST_TIMESTAMP);<a name="line.1633"></a>
+<span class="sourceLineNo">1634</span>  }<a name="line.1634"></a>
+<span class="sourceLineNo">1635</span>  /**<a name="line.1635"></a>
+<span class="sourceLineNo">1636</span>   * Adds a hbase:meta row for each of the specified new regions.<a name="line.1636"></a>
+<span class="sourceLineNo">1637</span>   * @param connection connection we're using<a name="line.1637"></a>
+<span class="sourceLineNo">1638</span>   * @param regionInfos region information list<a name="line.1638"></a>
+<span class="sourceLineNo">1639</span>   * @param regionReplication<a name="line.1639"></a>
+<span class="sourceLineNo">1640</span>   * @param ts desired timestamp<a name="line.1640"></a>
+<span class="sourceLineNo">1641</span>   * @throws IOException if problem connecting or updating meta<a name="line.1641"></a>
+<span class="sourceLineNo">1642</span>   */<a name="line.1642"></a>
+<span class="sourceLineNo">1643</span>  public static void addRegionsToMeta(Connection connection,<a name="line.1643"></a>
+<span class="sourceLineNo">1644</span>      List&lt;RegionInfo&gt; regionInfos, int regionReplication, long ts)<a name="line.1644"></a>
+<span class="sourceLineNo">1645</span>          throws IOException {<a name="line.1645"></a>
+<span class="sourceLineNo">1646</span>    List&lt;Put&gt; puts = new ArrayList&lt;&gt;();<a name="line.1646"></a>
+<span class="sourceLineNo">1647</span>    for (RegionInfo regionInfo : regionInfos) {<a name="line.1647"></a>
+<span class="sourceLineNo">1648</span>      if (RegionReplicaUtil.isDefaultReplica(regionInfo)) {<a name="line.1648"></a>
+<span class="sourceLineNo">1649</span>        Put put = makePutFromRegionInfo(regionInfo, ts);<a name="line.1649"></a>
+<span class="sourceLineNo">1650</span>        // Add empty locations for region replicas so that number of replicas can be cached<a name="line.1650"></a>
+<span class="sourceLineNo">1651</span>        // whenever the primary region is looked up from meta<a name="line.1651"></a>
+<span class="sourceLineNo">1652</span>        for (int i = 1; i &lt; regionReplication; i++) {<a name="line.1652"></a>
+<span class="sourceLineNo">1653</span>          addEmptyLocation(put, i);<a name="line.1653"></a>
+<span class="sourceLineNo">1654</span>        }<a name="line.1654"></a>
+<span class="sourceLineNo">1655</span>        puts.add(put);<a name="line.1655"></a>
+<span class="sourceLineNo">1656</span>      }<a name="line.1656"></a>
+<span class="sourceLineNo">1657</span>    }<a name="line.1657"></a>
+<span class="sourceLineNo">1658</span>    putsToMetaTable(connection, puts);<a name="line.1658"></a>
+<span class="sourceLineNo">1659</span>    LOG.info("Added " + puts.size());<a name="line.1659"></a>
+<span class="sourceLineNo">1660</span>  }<a name="line.1660"></a>
+<span class="sourceLineNo">1661</span><a name="line.1661"></a>
+<span class="sourceLineNo">1662</span>  /**<a name="line.1662"></a>
+<span class="sourceLineNo">1663</span>   * Adds a daughter region entry to meta.<a name="line.1663"></a>
+<span class="sourceLineNo">1664</span>   * @param regionInfo the region to put<a name="line.1664"></a>
+<span class="sourceLineNo">1665</span>   * @param sn the location of the region<a name="line.1665"></a>
+<span class="sourceLineNo">1666</span>   * @param openSeqNum the latest sequence number obtained when the region was open<a name="line.1666"></a>
+<span class="sourceLineNo">1667</span>   */<a name="line.1667"></a>
+<span class="sourceLineNo">1668</span>  public static void addDaughter(final Connection connection,<a name="line.1668"></a>
+<span class="sourceLineNo">1669</span>      final RegionInfo regionInfo, final ServerName sn, final long openSeqNum)<a name="line.1669"></a>
+<span class="sourceLineNo">1670</span>      throws NotAllMetaRegionsOnlineException, IOException {<a name="line.1670"></a>
+<span class="sourceLineNo">1671</span>    long now = EnvironmentEdgeManager.currentTime();<a name="line.1671"></a>
+<span class="sourceLineNo">1672</span>    Put put = new Put(regionInfo.getRegionName(), now);<a name="line.1672"></a>
+<span class="sourceLineNo">1673</span>    addRegionInfo(put, regionInfo);<a name="line.1673"></a>
+<span class="sourceLineNo">1674</span>    if (sn != null) {<a name="line.1674"></a>
+<span class="sourceLineNo">1675</span>      addLocation(put, sn, openSeqNum, -1, regionInfo.getReplicaId());<a name="line.1675"></a>
+<span class="sourceLineNo">1676</span>    }<a name="line.1676"></a>
+<span class="sourceLineNo">1677</span>    putToMetaTable(connection, put);<a name="line.1677"></a>
+<span class="sourceLineNo">1678</span>    LOG.info("Added daughter " + regionInfo.getEncodedName() +<a name="line.1678"></a>
+<span class="sourceLineNo">1679</span>      (sn == null? ", serverName=null": ", serverName=" + sn.toString()));<a name="line.1679"></a>
+<span class="sourceLineNo">1680</span>  }<a name="line.1680"></a>
 <span class="sourceLineNo">1681</span><a name="line.1681"></a>
-<span class="sourceLineNo">1682</span>      byte[] tableRow = Bytes.toBytes(mergedRegion.getRegionNameAsString()<a name="line.1682"></a>
-<span class="sourceLineNo">1683</span>        + HConstants.DELIMITER);<a name="line.1683"></a>
-<span class="sourceLineNo">1684</span>      Mutation[] mutations;<a name="line.1684"></a>
-<span class="sourceLineNo">1685</span>      if (saveBarrier) {<a name="line.1685"></a>
-<span class="sourceLineNo">1686</span>        Put putBarrierA = makeDaughterPut(regionA.getEncodedNameAsBytes(),<a name="line.1686"></a>
-<span class="sourceLineNo">1687</span>            mergedRegion.getEncodedNameAsBytes());<a name="line.1687"></a>
-<span class="sourceLineNo">1688</span>        Put putBarrierB = makeDaughterPut(regionB.getEncodedNameAsBytes(),<a name="line.1688"></a>
-<span class="sourceLineNo">1689</span>            mergedRegion.getEncodedNameAsBytes());<a name="line.1689"></a>
-<span class="sourceLineNo">1690</span>        Put putDaughter = makeParentPut(mergedRegion.getEncodedNameAsBytes(), Bytes.toBytes(<a name="line.1690"></a>
-<span class="sourceLineNo">1691</span>            regionA.getEncodedName() + "," + regionB.getEncodedName()));<a name="line.1691"></a>
-<span class="sourceLineNo">1692</span>        mutations = new Mutation[] { putOfMerged, deleteA, deleteB,<a name="line.1692"></a>
-<span class="sourceLineNo">1693</span>            putBarrierA, putBarrierB, putDaughter};<a name="line.1693"></a>
-<span class="sourceLineNo">1694</span>      } else {<a name="line.1694"></a>
-<span class="sourceLineNo">1695</span>        mutations = new Mutation[] { putOfMerged, deleteA, deleteB };<a name="line.1695"></a>
-<span class="sourceLineNo">1696</span>      }<a name="line.1696"></a>
-<span class="sourceLineNo">1697</span>      multiMutate(connection, meta, tableRow, mutations);<a name="line.1697"></a>
-<span class="sourceLineNo">1698</span>    } finally {<a name="line.1698"></a>
-<span class="sourceLineNo">1699</span>      meta.close();<a name="line.1699"></a>
-<span class="sourceLineNo">1700</span>    }<a name="line.1700"></a>
-<span class="sourceLineNo">1701</span>  }<a name="line.1701"></a>
-<span class="sourceLineNo">1702</span><a name="line.1702"></a>
-<span class="sourceLineNo">1703</span>  /**<a name="line.1703"></a>
-<span class="sourceLineNo">1704</span>   * Splits the region into two in an atomic operation. Offlines the parent<a name="line.1704"></a>
-<span class="sourceLineNo">1705</span>   * region with the information that it is split into two, and also adds<a name="line.1705"></a>
-<span class="sourceLineNo">1706</span>   * the daughter regions. Does not add the location information to the daughter<a name="line.1706"></a>
-<span class="sourceLineNo">1707</span>   * regions since they are not open yet.<a name="line.1707"></a>
-<span class="sourceLineNo">1708</span>   * @param connection connection we're using<a name="line.1708"></a>
-<span class="sourceLineNo">1709</span>   * @param parent the parent region which is split<a name="line.1709"></a>
-<span class="sourceLineNo">1710</span>   * @param splitA Split daughter region A<a name="line.1710"></a>
-<span class="sourceLineNo">1711</span>   * @param splitB Split daughter region A<a name="line.1711"></a>
-<span class="sourceLineNo">1712</span>   * @param sn the location of the region<a name="line.1712"></a>
-<span class="sourceLineNo">1713</span>   * @param saveBarrier true if need save replication barrier in meta, used for serial replication<a name="line.1713"></a>
-<span class="sourceLineNo">1714</span>   */<a name="line.1714"></a>
-<span class="sourceLineNo">1715</span>  public static void splitRegion(final Connection connection, RegionInfo parent,<a name="line.1715"></a>
-<span class="sourceLineNo">1716</span>      RegionInfo splitA, RegionInfo splitB, ServerName sn, int regionReplication,<a name="line.1716"></a>
-<span class="sourceLineNo">1717</span>      boolean saveBarrier) throws IOException {<a name="line.1717"></a>
-<span class="sourceLineNo">1718</span>    Table meta = getMetaHTable(connection);<a name="line.1718"></a>
-<span class="sourceLineNo">1719</span>    try {<a name="line.1719"></a>
-<span class="sourceLineNo">1720</span>      //Put for parent<a name="line.1720"></a>
-<span class="sourceLineNo">1721</span>      Put putParent = makePutFromRegionInfo(RegionInfoBuilder.newBuilder(parent)<a name="line.1721"></a>
-<span class="sourceLineNo">1722</span>                        .setOffline(true)<a name="line.1722"></a>
-<span class="sourceLineNo">1723</span>                        .setSplit(true).build());<a name="line.1723"></a>
-<span class="sourceLineNo">1724</span>      addDaughtersToPut(putParent, splitA, splitB);<a name="line.1724"></a>
-<span class="sourceLineNo">1725</span><a name="line.1725"></a>
-<span class="sourceLineNo">1726</span>      //Puts for daughters<a name="line.1726"></a>
-<span class="sourceLineNo">1727</span>      Put putA = makePutFromRegionInfo(splitA);<a name="line.1727"></a>
-<span class="sourceLineNo">1728</span>      Put putB = makePutFromRegionInfo(splitB);<a name="line.1728"></a>
-<span class="sourceLineNo">1729</span><a name="line.1729"></a>
-<span class="sourceLineNo">1730</span>      addSequenceNum(putA, 1, -1, splitA.getReplicaId()); //new regions, openSeqNum = 1 is fine.<a name="line.1730"></a>
-<span class="sourceLineNo">1731</span>      addSequenceNum(putB, 1, -1, splitB.getReplicaId());<a name="line.1731"></a>
+<span class="sourceLineNo">1682</span>  /**<a name="line.1682"></a>
+<span class="sourceLineNo">1683</span>   * Merge the two regions into one in an atomic operation. Deletes the two<a name="line.1683"></a>
+<span class="sourceLineNo">1684</span>   * merging regions in hbase:meta and adds the merged region with the information of<a name="line.1684"></a>
+<span class="sourceLineNo">1685</span>   * two merging regions.<a name="line.1685"></a>
+<span class="sourceLineNo">1686</span>   * @param connection connection we're using<a name="line.1686"></a>
+<span class="sourceLineNo">1687</span>   * @param mergedRegion the merged region<a name="line.1687"></a>
+<span class="sourceLineNo">1688</span>   * @param regionA<a name="line.1688"></a>
+<span class="sourceLineNo">1689</span>   * @param regionB<a name="line.1689"></a>
+<span class="sourceLineNo">1690</span>   * @param sn the location of the region<a name="line.1690"></a>
+<span class="sourceLineNo">1691</span>   * @param masterSystemTime<a name="line.1691"></a>
+<span class="sourceLineNo">1692</span>   * @param saveBarrier true if need save replication barrier in meta, used for serial replication<a name="line.1692"></a>
+<span class="sourceLineNo">1693</span>   * @throws IOException<a name="line.1693"></a>
+<span class="sourceLineNo">1694</span>   */<a name="line.1694"></a>
+<span class="sourceLineNo">1695</span>  public static void mergeRegions(final Connection connection, RegionInfo mergedRegion,<a name="line.1695"></a>
+<span class="sourceLineNo">1696</span>      RegionInfo regionA, RegionInfo regionB, ServerName sn, int regionReplication,<a name="line.1696"></a>
+<span class="sourceLineNo">1697</span>      long masterSystemTime, boolean saveBarrier)<a name="line.1697"></a>
+<span class="sourceLineNo">1698</span>          throws IOException {<a name="line.1698"></a>
+<span class="sourceLineNo">1699</span>    Table meta = getMetaHTable(connection);<a name="line.1699"></a>
+<span class="sourceLineNo">1700</span>    try {<a name="line.1700"></a>
+<span class="sourceLineNo">1701</span>      // use the maximum of what master passed us vs local time.<a name="line.1701"></a>
+<span class="sourceLineNo">1702</span>      long time = Math.max(EnvironmentEdgeManager.currentTime(), masterSystemTime);<a name="line.1702"></a>
+<span class="sourceLineNo">1703</span><a name="line.1703"></a>
+<span class="sourceLineNo">1704</span>      // Put for parent<a name="line.1704"></a>
+<span class="sourceLineNo">1705</span>      Put putOfMerged = makePutFromRegionInfo(mergedRegion, time);<a name="line.1705"></a>
+<span class="sourceLineNo">1706</span>      putOfMerged.add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)<a name="line.1706"></a>
+<span class="sourceLineNo">1707</span>              .setRow(putOfMerged.getRow())<a name="line.1707"></a>
+<span class="sourceLineNo">1708</span>              .setFamily(HConstants.CATALOG_FAMILY)<a name="line.1708"></a>
+<span class="sourceLineNo">1709</span>              .setQualifier(HConstants.MERGEA_QUALIFIER)<a name="line.1709"></a>
+<span class="sourceLineNo">1710</span>              .setTimestamp(putOfMerged.getTimeStamp())<a name="line.1710"></a>
+<span class="sourceLineNo">1711</span>              .setType(CellBuilder.DataType.Put)<a name="line.1711"></a>
+<span class="sourceLineNo">1712</span>              .setValue(RegionInfo.toByteArray(regionA))<a name="line.1712"></a>
+<span class="sourceLineNo">1713</span>              .build())<a name="line.1713"></a>
+<span class="sourceLineNo">1714</span>          .add(CellBuilderFactory.create(CellBuilderType.SHALLOW_COPY)<a name="line.1714"></a>
+<span class="sourceLineNo">1715</span>              .setRow(putOfMerged.getRow())<a name="line.1715"></a>
+<span class="sourceLineNo">1716</span>              .setFamily(HConstants.CATALOG_FAMILY)<a name="line.1716"></a>
+<span class="sourceLineNo">1717</span>              .setQualifier(HConstants.MERGEB_QUALIFIER)<a name="line.1717"></a>
+<span class="sourceLineNo">1718</span>              .setTimestamp(putOfMerged.getTimeStamp())<a name="line.1718"></a>
+<span class="sourceLineNo">1719</span>              .setType(CellBuilder.DataType.Put)<a name="line.1719"></a>
+<span class="sourceLineNo">1720</span>              .setValue(RegionInfo.toByteArray(regionB))<a name="line.1720"></a>
+<span class="sourceLineNo">1721</span>              .build());<a name="line.1721"></a>
+<span class="sourceLineNo">1722</span><a name="line.1722"></a>
+<span class="sourceLineNo">1723</span>      // Deletes for merging regions<a name="line.1723"></a>
+<span class="sourceLineNo">1724</span>      Delete deleteA = makeDeleteFromRegionInfo(regionA, time);<a name="line.1724"></a>
+<span class="sourceLineNo">1725</span>      Delete deleteB = makeDeleteFromRegionInfo(regionB, time);<a name="line.1725"></a>
+<span class="sourceLineNo">1726</span><a name="line.1726"></a>
+<span class="sourceLineNo">1727</span>      // The merged is a new region, openSeqNum = 1 is fine. ServerName may be null<a name="line.1727"></a>
+<span class="sourceLineNo">1728</span>      // if crash after merge happened but before we got to here.. means in-memory<a name="line.1728"></a>
+<span class="sourceLineNo">1729</span>      // locations of offlined merged, now-closed, regions is lost. Should be ok. We<a name="line.1729"></a>
+<span class="sourceLineNo">1730</span>      // assign the merged region later.<a name="line.1730"></a>
+<span class="sourceLineNo">1731</span>      if (sn != null) addLocation(putOfMerged, sn, 1, -1, mergedRegion.getReplicaId());<a name="line.1731"></a>
 <span class="sourceLineNo">1732</span><a name="line.1732"></a>
-<span class="sourceLineNo">1733</span>      // Add empty locations for region replicas of daughters so that number of replicas can be<a name="line.1733"></a>
-<span class="sourceLineNo">1734</span>      // cached whenever the primary region is looked up from meta<a name="line.1734"></a>
+<span class="sourceLineNo">1733</span>      // Add empty locations for region replicas of the merged region so that number of replicas can<a name="line.1733"></a>
+<span class="sourceLineNo">1734</span>      // be cached whenever the primary region is looked up from meta<a name="line.1734"></a>
 <span class="sourceLineNo">1735</span>      for (int i = 1; i &lt; regionReplication; i++) {<a name="line.1735"></a>
-<span class="sourceLineNo">1736</span>        addEmptyLocation(putA, i);<a name="line.1736"></a>
-<span class="sourceLineNo">1737</span>        addEmptyLocation(putB, i);<a name="line.1737"></a>
-<span class="sourceLineNo">1738</span>      }<a name="line.1738"></a>
-<span class="sourceLineNo">1739</span><a name="line.1739"></a>
-<span class="sourceLineNo">1740</span>      Mutation[] mutations;<a name="line.1740"></a>
-<span class="sourceLineNo">1741</span>      if (saveBarrier) {<a name="line.1741"></a>
-<span class="sourceLineNo">1742</span>        Put parentPut = makeDaughterPut(parent.getEncodedNameAsBytes(),<a name="line.1742"></a>
-<span class="sourceLineNo">1743</span>            Bytes.toBytes(splitA.getEncodedName() + "," + splitB.getEncodedName()));<a name="line.1743"></a>
-<span class="sourceLineNo">1744</span>        Put daughterPutA = makeParentPut(splitA.getEncodedNameAsBytes(),<a name="line.1744"></a>
-<span class="sourceLineNo">1745</span>            parent.getEncodedNameAsBytes());<a name="line.1745"></a>
-<span class="sourceLineNo">1746</span>        Put daughterPutB = makeParentPut(splitB.getEncodedNameAsBytes(),<a name="line.1746"></a>
-<span class="sourceLineNo">1747</span>            parent.getEncodedNameAsBytes());<a name="line.1747"></a>
-<span class="sourceLineNo">1748</span><a name="line.1748"></a>
-<span class="sourceLineNo">1749</span>        mutations = new Mutation[]{putParent, putA, putB, parentPut, daughterPutA, daughterPutB};<a name="line.1749"></a>
-<span class="sourceLineNo">1750</span>      } else {<a name="line.1750"></a>
-<span class="sourceLineNo">1751</span>        mutations = new Mutation[]{putParent, putA, putB};<a name="line.1751"></a>
-<span class="sourceLineNo">1752</span>      }<a name="line.1752"></a>
-<span class="sourceLineNo">1753</span>      byte[] tableRow = Bytes.toBytes(parent.getRegionNameAsString() + HConstants.DELIMITER);<a name="line.1753"></a>
+<span class="sourceLineNo">1736</span>        addEmptyLocation(putOfMerged, i);<a name="line.1736"></a>
+<span class="sourceLineNo">1737</span>      }<a name="line.1737"></a>
+<span class="sourceLineNo">1738</span><a name="line.1738"></a>
+<span class="sourceLineNo">1739</span>      byte[] tableRow = Bytes.toBytes(mergedRegion.getRegionNameAsString()<a name="line.1739"></a>
+<span class="sourceLineNo">1740</span>        + HConstants.DELIMITER);<a name="line.1740"></a>
+<span class="sourceLineNo">1741</span>      Mutation[] mutations;<a name="line.1741"></a>
+<span class="sourceLineNo">1742</span>      if (saveBarrier) {<a name="line.1742"></a>
+<span class="sourceLineNo">1743</span>        Put putBarrierA = makeDaughterPut(regionA.getEncodedNameAsBytes(),<a name="line.1743"></a>
+<span class="sourceLineNo">1744</span>            mergedRegion.getEncodedNameAsBytes());<a name="line.1744"></a>
+<span class="sourceLineNo">1745</span>        Put putBarrierB = makeDaughterPut(regionB.getEncodedNameAsBytes(),<a name="line.1745"></a>
+<span class="sourceLineNo">1746</span>            mergedRegion.getEncodedNameAsBytes());<a name="line.1746"></a>
+<span class="sourceLineNo">1747</span>        Put putDaughter = makeParentPut(mergedRegion.getEncodedNameAsBytes(), Bytes.toBytes(<a name="line.1747"></a>
+<span class="sourceLineNo">1748</span>            regionA.getEncodedName() + "," + regionB.getEncodedName()));<a name="line.1748"></a>
+<span class="sourceLineNo">1749</span>        mutations = new Mutation[] { putOfMerged, deleteA, deleteB,<a name="line.1749"></a>
+<span class="sourceLineNo">1750</span>            putBarrierA, putBarrierB, putDaughter};<a name="line.1750"></a>
+<span class="sourceLineNo">1751</span>      } else {<a name="line.1751"></a>
+<span class="sourceLineNo">1752</span>        mutations = new Mutation[] { putOfMerged, deleteA, deleteB };<a name="line.1752"></a>
+<span class="sourceLineNo">1753</span>      }<a name="line.1753"></a>
 <span class="sourceLineNo">1754</span>      multiMutate(connection, meta, tableRow, mutations);<a name="line.1754"></a>
 <span class="sourceLineNo">1755</span>    } finally {<a name="line.1755"></a>
 <span class="sourceLineNo">1756</span>      meta.close();<a name="line.1756"></a>
@@ -1766,497 +1766,607 @@
 <span class="sourceLineNo">1758</span>  }<a name="line.1758"></a>
 <span class="sourceLineNo">1759</span><a name="line.1759"></a>
 <span class="sourceLineNo">1760</span>  /**<a name="line.1760"></a>
-<span class="sourceLineNo">1761</span>   * Update state of the table in meta.<a name="line.1761"></a>
-<span class="sourceLineNo">1762</span>   * @param connection what we use for update<a name="line.1762"></a>
-<span class="sourceLineNo">1763</span>   * @param state new state<a name="line.1763"></a>
-<span class="sourceLineNo">1764</span>   * @throws IOException<a name="line.1764"></a>
-<span class="sourceLineNo">1765</span>   */<a name="line.1765"></a>
-<span class="sourceLineNo">1766</span>  public static void updateTableState(Connection connection, TableState state)<a name="line.1766"></a>
-<span class="sourceLineNo">1767</span>      throws IOException {<a name="line.1767"></a>
-<span class="sourceLineNo">1768</span>    Put put = makePutFromTableState(state);<a name="line.1768"></a>
-<span class="sourceLineNo">1769</span>    putToMetaTable(connection, put);<a name="line.1769"></a>
-<span class="sourceLineNo">1770</span>    LOG.info(<a name="line.1770"></a>
-<span class="sourceLineNo">1771</span>        "Updated table " + state.getTableName() + " state to " + state.getState() + " in META");<a name="line.1771"></a>
-<span class="sourceLineNo">1772</span>  }<a name="line.1772"></a>
-<span class="sourceLineNo">1773</span><a name="line.1773"></a>
-<span class="sourceLineNo">1774</span>  /**<a name="line.1774"></a>
-<span class="sourceLineNo">1775</span>   * Construct PUT for given state<a name="line.1775"></a>
-<span class="sourceLineNo">1776</span>   * @param state new state<a name="line.1776"></a>
-<span class="sourceLineNo">1777</span>   */<a name="line.1777"></a>
-<span class="sourceLineNo">1778</span>  public static Put makePutFromTableState(TableState state) {<a name="line.1778"></a>
-<span class="sourceLineNo">1779</span>    long time = EnvironmentEdgeManager.currentTime();<a name="line.1779"></a>
-<span class="sourceLineNo">1780</span>    Put put = new Put(state.getTableName().getName(), time);<a name="line.1780"></a>
-<span class="sourceLineNo">1781</span>    put.addColumn(getTableFamily(), getStateColumn(), state.convert().toByteArray());<a name="line.1781"></a>
-<span class="sourceLineNo">1782</span>    return put;<a name="line.1782"></a>
-<span class="sourceLineNo">1783</span>  }<a name="line.1783"></a>
-<span class="sourceLineNo">1784</span><a name="line.1784"></a>
-<span class="sourceLineNo">1785</span>  /**<a name="line.1785"></a>
-<span class="sourceLineNo">1786</span>   * Remove state for table from meta<a name="line.1786"></a>
-<span class="sourceLineNo">1787</span>   * @param connection to use for deletion<a name="line.1787"></a>
-<span class="sourceLineNo">1788</span>   * @param table to delete state for<a name="line.1788"></a>
-<span class="sourceLineNo">1789</span>   */<a name="line.1789"></a>
-<span class="sourceLineNo">1790</span>  public static void deleteTableState(Connection connection, TableName table)<a name="line.1790"></a>
-<span class="sourceLineNo">1791</span>      throws IOException {<a name="line.1791"></a>
-<span class="sourceLineNo">1792</span>    long time = EnvironmentEdgeManager.currentTime();<a name="line.1792"></a>
-<span class="sourceLineNo">1793</span>    Delete delete = new Delete(table.getName());<a name="line.1793"></a>
-<span class="sourceLineNo">1794</span>    delete.addColumns(getTableFamily(), getStateColumn(), time);<a name="line.1794"></a>
-<span class="sourceLineNo">1795</span>    deleteFromMetaTable(connection, delete);<a name="line.1795"></a>
-<span class="sourceLineNo">1796</span>    LOG.info("Deleted table " + table + " state from META");<a name="line.1796"></a>
-<span class="sourceLineNo">1797</span>  }<a name="line.1797"></a>
-<span class="sourceLineNo">1798</span><a name="line.1798"></a>
-<span class="sourceLineNo">1799</span>  private static void multiMutate(Connection connection, Table table, by

<TRUNCATED>

Mime
View raw message