[18/35] hbase-site git commit: Published site at 8cc56bd18c40ba9a7131336e97c74f8d97d8b2be.
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/713132a3/devapidocs/src-html/org/apache/hadoop/hbase/tool/Canary.RegionMonitor.html -- diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/tool/Canary.RegionMonitor.html b/devapidocs/src-html/org/apache/hadoop/hbase/tool/Canary.RegionMonitor.html index ce887a2..506bc5c 100644 --- a/devapidocs/src-html/org/apache/hadoop/hbase/tool/Canary.RegionMonitor.html +++ b/devapidocs/src-html/org/apache/hadoop/hbase/tool/Canary.RegionMonitor.html @@ -98,1529 +98,1560 @@ 090import org.apache.hadoop.util.GenericOptionsParser; 091import org.apache.hadoop.util.Tool; 092import org.apache.hadoop.util.ToolRunner; -093import org.apache.yetus.audience.InterfaceAudience; -094import org.apache.zookeeper.KeeperException; -095import org.apache.zookeeper.ZooKeeper; -096import org.apache.zookeeper.client.ConnectStringParser; -097import org.apache.zookeeper.data.Stat; -098import org.slf4j.Logger; -099import org.slf4j.LoggerFactory; -100 -101import org.apache.hbase.thirdparty.com.google.common.collect.Lists; -102 -103/** -104 * HBase Canary Tool, that that can be used to do -105 * "canary monitoring" of a running HBase cluster. +093import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting; +094import org.apache.yetus.audience.InterfaceAudience; +095import org.apache.zookeeper.KeeperException; +096import org.apache.zookeeper.ZooKeeper; +097import org.apache.zookeeper.client.ConnectStringParser; +098import org.apache.zookeeper.data.Stat; +099import org.slf4j.Logger; +100import org.slf4j.LoggerFactory; +101 +102import org.apache.hbase.thirdparty.com.google.common.collect.Lists; +103 +104/** +105 * HBase Canary Tool for "canary monitoring" of a running HBase cluster. 106 * -107 * Here are three modes -108 * 1. region mode - Foreach region tries to get one row per column family -109 * and outputs some information about failure or latency. -110 * -111 * 2. regionserver mode - Foreach regionserver tries to get one row from one table -112 * selected randomly and outputs some information about failure or latency. -113 * -114 * 3. zookeeper mode - for each zookeeper instance, selects a zNode and -115 * outputs some information about failure or latency. -116 */ -117@InterfaceAudience.Private -118public final class Canary implements Tool { -119 // Sink interface used by the canary to outputs information -120 public interface Sink { -121public long getReadFailureCount(); -122public long incReadFailureCount(); -123public MapString,String getReadFailures(); -124public void updateReadFailures(String regionName, String serverName); -125public long getWriteFailureCount(); -126public long incWriteFailureCount(); -127public MapString,String getWriteFailures(); -128public void updateWriteFailures(String regionName, String serverName); -129 } -130 -131 // Simple implementation of canary sink that allows to plot on -132 // file or standard output timings or failures. -133 public static class StdOutSink implements Sink { -134private AtomicLong readFailureCount = new AtomicLong(0), -135writeFailureCount = new AtomicLong(0); -136 -137private MapString, String readFailures = new ConcurrentHashMap(); -138private MapString, String writeFailures = new ConcurrentHashMap(); -139 -140@Override -141public long getReadFailureCount() { -142 return readFailureCount.get(); -143} -144 -145@Override -146public long incReadFailureCount() { -147 return readFailureCount.incrementAndGet(); -148} -149 -150@Override -151public MapString, String getReadFailures() { -152 return readFailures; -153} -154 -155@Override -156public void updateReadFailures(String regionName, String serverName) { -157 readFailures.put(regionName, serverName); -158} -159 -160@Override -161public long getWriteFailureCount() { -162 return writeFailureCount.get(); -163} -164 -165@Override -166public long incWriteFailureCount() { -167 return writeFailureCount.incrementAndGet(); -168} -169 -170@Override -171public MapString, String getWriteFailures() { -172 return writeFailures; -173} -174 -175@Override -176public void updateWriteFailures(String regionName, String serverName) { -177 writeFailures.put(regionName, serverName); -178} -179 } -180 -181 public static class RegionServerStdOutSink extends StdOutSink { -182 -183public void publishReadFailure(String table, String server) { -184 incReadFailureCount(); -185 LOG.error(String.format("Read from table:%s on region server:%s", table, server)); -186} +107 * There are three modes: +108 * ol +109 * liregion mode (Default): For each region, try to get one row per column family outputting +110 * information on failure (ERROR) or else the latency. +111
[18/35] hbase-site git commit: Published site at 42d5447cfbc593becfc26684e03f482eb3a0fc49.
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a610f23a/testdevapidocs/src-html/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithClusters.html -- diff --git a/testdevapidocs/src-html/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithClusters.html b/testdevapidocs/src-html/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithClusters.html index 19c72a2..f6a8245 100644 --- a/testdevapidocs/src-html/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithClusters.html +++ b/testdevapidocs/src-html/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithClusters.html @@ -104,213 +104,219 @@ 096admin1.modifyTable(tableName, table); 097admin1.enableTable(tableName); 098 -099 -100 admin1.disableTableReplication(tableName); -101table = admin1.getTableDescriptor(tableName); -102for (HColumnDescriptor fam : table.getColumnFamilies()) { -103 assertEquals(HConstants.REPLICATION_SCOPE_LOCAL, fam.getScope()); -104} -105 } -106 -107 @Test -108 public void testEnableReplicationWhenSlaveClusterDoesntHaveTable() throws Exception { -109 admin1.disableTableReplication(tableName); -110admin2.disableTable(tableName); -111admin2.deleteTable(tableName); -112 assertFalse(admin2.tableExists(tableName)); -113 admin1.enableTableReplication(tableName); -114 assertTrue(admin2.tableExists(tableName)); -115 } -116 -117 @Test -118 public void testEnableReplicationWhenReplicationNotEnabled() throws Exception { -119HTableDescriptor table = new HTableDescriptor(admin1.getTableDescriptor(tableName)); -120for (HColumnDescriptor fam : table.getColumnFamilies()) { -121 fam.setScope(HConstants.REPLICATION_SCOPE_LOCAL); -122} -123admin1.disableTable(tableName); -124admin1.modifyTable(tableName, table); -125admin1.enableTable(tableName); -126 -127admin2.disableTable(tableName); -128admin2.modifyTable(tableName, table); -129admin2.enableTable(tableName); -130 -131 admin1.enableTableReplication(tableName); -132table = admin1.getTableDescriptor(tableName); -133for (HColumnDescriptor fam : table.getColumnFamilies()) { -134 assertEquals(HConstants.REPLICATION_SCOPE_GLOBAL, fam.getScope()); -135} -136 } -137 -138 @Test -139 public void testEnableReplicationWhenTableDescriptorIsNotSameInClusters() throws Exception { -140HTableDescriptor table = new HTableDescriptor(admin2.getTableDescriptor(tableName)); -141HColumnDescriptor f = new HColumnDescriptor("newFamily"); -142table.addFamily(f); -143admin2.disableTable(tableName); -144admin2.modifyTable(tableName, table); -145admin2.enableTable(tableName); -146 -147try { -148 admin1.enableTableReplication(tableName); -149 fail("Exception should be thrown if table descriptors in the clusters are not same."); -150} catch (RuntimeException ignored) { -151 -152} -153admin1.disableTable(tableName); -154admin1.modifyTable(tableName, table); -155admin1.enableTable(tableName); -156 admin1.enableTableReplication(tableName); -157table = admin1.getTableDescriptor(tableName); -158for (HColumnDescriptor fam : table.getColumnFamilies()) { -159 assertEquals(HConstants.REPLICATION_SCOPE_GLOBAL, fam.getScope()); -160} -161 } +099 admin1.disableTableReplication(tableName); +100table = admin1.getTableDescriptor(tableName); +101for (HColumnDescriptor fam : table.getColumnFamilies()) { +102 assertEquals(HConstants.REPLICATION_SCOPE_LOCAL, fam.getScope()); +103} +104 +105 admin1.deleteColumnFamily(table.getTableName(), f.getName()); +106 } +107 +108 @Test +109 public void testEnableReplicationWhenSlaveClusterDoesntHaveTable() throws Exception { +110 admin1.disableTableReplication(tableName); +111admin2.disableTable(tableName); +112admin2.deleteTable(tableName); +113 assertFalse(admin2.tableExists(tableName)); +114 admin1.enableTableReplication(tableName); +115 assertTrue(admin2.tableExists(tableName)); +116 } +117 +118 @Test +119 public void testEnableReplicationWhenReplicationNotEnabled() throws Exception { +120HTableDescriptor table = new HTableDescriptor(admin1.getTableDescriptor(tableName)); +121for (HColumnDescriptor fam : table.getColumnFamilies()) { +122 fam.setScope(HConstants.REPLICATION_SCOPE_LOCAL); +123} +124admin1.disableTable(tableName); +125admin1.modifyTable(tableName, table); +126admin1.enableTable(tableName); +127 +128admin2.disableTable(tableName); +129admin2.modifyTable(tableName, table); +130admin2.enableTable(tableName); +131 +132 admin1.enableTableReplication(tableName); +133table = admin1.getTableDescriptor(tableName); +134for (HColumnDescriptor fam : table.getColumnFamilies()) { +135
[18/35] hbase-site git commit: Published site at .
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/04d647a7/devapidocs/src-html/org/apache/hadoop/hbase/util/HBaseFsck.HdfsEntry.html -- diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/util/HBaseFsck.HdfsEntry.html b/devapidocs/src-html/org/apache/hadoop/hbase/util/HBaseFsck.HdfsEntry.html index bf1a2cc..89317aa 100644 --- a/devapidocs/src-html/org/apache/hadoop/hbase/util/HBaseFsck.HdfsEntry.html +++ b/devapidocs/src-html/org/apache/hadoop/hbase/util/HBaseFsck.HdfsEntry.html @@ -1813,3325 +1813,3330 @@ 1805 private void loadTableStates() 1806 throws IOException { 1807tableStates = MetaTableAccessor.getTableStates(connection); -1808 } -1809 -1810 /** -1811 * Check if the specified region's table is disabled. -1812 * @param tableName table to check status of -1813 */ -1814 private boolean isTableDisabled(TableName tableName) { -1815return tableStates.containsKey(tableName) -1816 tableStates.get(tableName) -1817 .inStates(TableState.State.DISABLED, TableState.State.DISABLING); -1818 } -1819 -1820 /** -1821 * Scan HDFS for all regions, recording their information into -1822 * regionInfoMap -1823 */ -1824 public void loadHdfsRegionDirs() throws IOException, InterruptedException { -1825Path rootDir = FSUtils.getRootDir(getConf()); -1826FileSystem fs = rootDir.getFileSystem(getConf()); -1827 -1828// list all tables from HDFS -1829ListFileStatus tableDirs = Lists.newArrayList(); -1830 -1831boolean foundVersionFile = fs.exists(new Path(rootDir, HConstants.VERSION_FILE_NAME)); +1808// Add hbase:meta so this tool keeps working. In hbase2, meta is always enabled though it +1809// has no entry in the table states. HBCK doesn't work right w/ hbase2 but just do this in +1810// meantime. +1811 this.tableStates.put(TableName.META_TABLE_NAME, +1812new TableState(TableName.META_TABLE_NAME, TableState.State.ENABLED)); +1813 } +1814 +1815 /** +1816 * Check if the specified region's table is disabled. +1817 * @param tableName table to check status of +1818 */ +1819 private boolean isTableDisabled(TableName tableName) { +1820return tableStates.containsKey(tableName) +1821 tableStates.get(tableName) +1822 .inStates(TableState.State.DISABLED, TableState.State.DISABLING); +1823 } +1824 +1825 /** +1826 * Scan HDFS for all regions, recording their information into +1827 * regionInfoMap +1828 */ +1829 public void loadHdfsRegionDirs() throws IOException, InterruptedException { +1830Path rootDir = FSUtils.getRootDir(getConf()); +1831FileSystem fs = rootDir.getFileSystem(getConf()); 1832 -1833ListPath paths = FSUtils.getTableDirs(fs, rootDir); -1834for (Path path : paths) { -1835 TableName tableName = FSUtils.getTableName(path); -1836 if ((!checkMetaOnly -1837 isTableIncluded(tableName)) || -1838 tableName.equals(TableName.META_TABLE_NAME)) { -1839 tableDirs.add(fs.getFileStatus(path)); -1840 } -1841} -1842 -1843// verify that version file exists -1844if (!foundVersionFile) { -1845 errors.reportError(ERROR_CODE.NO_VERSION_FILE, -1846 "Version file does not exist in root dir " + rootDir); -1847 if (shouldFixVersionFile()) { -1848LOG.info("Trying to create a new " + HConstants.VERSION_FILE_NAME -1849+ " file."); -1850setShouldRerun(); -1851FSUtils.setVersion(fs, rootDir, getConf().getInt( -1852 HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000), getConf().getInt( -1853 HConstants.VERSION_FILE_WRITE_ATTEMPTS, -1854 HConstants.DEFAULT_VERSION_FILE_WRITE_ATTEMPTS)); -1855 } -1856} -1857 -1858// Avoid multithreading at table-level because already multithreaded internally at -1859// region-level. Additionally multithreading at table-level can lead to deadlock -1860// if there are many tables in the cluster. Since there are a limited # of threads -1861// in the executor's thread pool and if we multithread at the table-level by putting -1862// WorkItemHdfsDir callables into the executor, then we will have some threads in the -1863// executor tied up solely in waiting for the tables' region-level calls to complete. -1864// If there are enough tables then there will be no actual threads in the pool left -1865// for the region-level callables to be serviced. -1866for (FileStatus tableDir : tableDirs) { -1867 LOG.debug("Loading region dirs from " +tableDir.getPath()); -1868 WorkItemHdfsDir item = new WorkItemHdfsDir(fs, errors, tableDir); -1869 try { -1870item.call(); -1871 } catch (ExecutionException e) { -1872LOG.warn("Could not completely load table dir " + -1873tableDir.getPath(), e.getCause()); -1874 } -1875} -1876
[18/35] hbase-site git commit: Published site at 9250bf809155ebe93fd6ae8a0485b22c744fdf70.
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/f17356a7/devapidocs/src-html/org/apache/hadoop/hbase/util/RegionSplitter.SplitAlgorithm.html -- diff --git a/devapidocs/src-html/org/apache/hadoop/hbase/util/RegionSplitter.SplitAlgorithm.html b/devapidocs/src-html/org/apache/hadoop/hbase/util/RegionSplitter.SplitAlgorithm.html index 89b0f0c..df6f4e7 100644 --- a/devapidocs/src-html/org/apache/hadoop/hbase/util/RegionSplitter.SplitAlgorithm.html +++ b/devapidocs/src-html/org/apache/hadoop/hbase/util/RegionSplitter.SplitAlgorithm.html @@ -28,1103 +28,1096 @@ 020 021import java.io.IOException; 022import java.math.BigInteger; -023import java.util.Arrays; -024import java.util.Collection; -025import java.util.Collections; -026import java.util.Comparator; -027import java.util.LinkedList; -028import java.util.List; +023 +024import java.util.Arrays; +025import java.util.Collection; +026import java.util.LinkedList; +027import java.util.List; +028import java.util.Map; 029import java.util.Set; 030import java.util.TreeMap; -031 -032import org.apache.commons.cli.CommandLine; -033import org.apache.commons.cli.GnuParser; -034import org.apache.commons.cli.HelpFormatter; -035import org.apache.commons.cli.OptionBuilder; -036import org.apache.commons.cli.Options; -037import org.apache.commons.cli.ParseException; -038import org.apache.commons.lang.ArrayUtils; -039import org.apache.commons.lang.StringUtils; -040import org.apache.commons.logging.Log; -041import org.apache.commons.logging.LogFactory; -042import org.apache.hadoop.conf.Configuration; -043import org.apache.hadoop.fs.FSDataInputStream; -044import org.apache.hadoop.fs.FSDataOutputStream; -045import org.apache.hadoop.fs.FileSystem; -046import org.apache.hadoop.fs.Path; -047import org.apache.hadoop.hbase.ClusterStatus; -048import org.apache.hadoop.hbase.HBaseConfiguration; -049import org.apache.hadoop.hbase.HColumnDescriptor; -050import org.apache.hadoop.hbase.HRegionInfo; -051import org.apache.hadoop.hbase.HRegionLocation; -052import org.apache.hadoop.hbase.HTableDescriptor; -053import org.apache.hadoop.hbase.MetaTableAccessor; -054import org.apache.hadoop.hbase.ServerName; -055import org.apache.hadoop.hbase.TableName; -056import org.apache.hadoop.hbase.classification.InterfaceAudience; -057import org.apache.hadoop.hbase.client.Admin; -058import org.apache.hadoop.hbase.client.ClusterConnection; -059import org.apache.hadoop.hbase.client.Connection; -060import org.apache.hadoop.hbase.client.ConnectionFactory; -061import org.apache.hadoop.hbase.client.NoServerForRegionException; -062import org.apache.hadoop.hbase.client.RegionLocator; -063import org.apache.hadoop.hbase.client.Table; -064import org.apache.hadoop.hbase.regionserver.HRegionFileSystem; -065 -066import com.google.common.base.Preconditions; -067import com.google.common.collect.Lists; -068import com.google.common.collect.Maps; -069import com.google.common.collect.Sets; -070 -071/** -072 * The {@link RegionSplitter} class provides several utilities to help in the -073 * administration lifecycle for developers who choose to manually split regions -074 * instead of having HBase handle that automatically. The most useful utilities -075 * are: -076 * p -077 * ul -078 * liCreate a table with a specified number of pre-split regions -079 * liExecute a rolling split of all regions on an existing table -080 * /ul -081 * p -082 * Both operations can be safely done on a live server. -083 * p -084 * bQuestion:/b How do I turn off automatic splitting? br -085 * bAnswer:/b Automatic splitting is determined by the configuration value -086 * iHConstants.HREGION_MAX_FILESIZE/i. It is not recommended that you set this -087 * to Long.MAX_VALUE in case you forget about manual splits. A suggested setting -088 * is 100GB, which would result in gt; 1hr major compactions if reached. -089 * p -090 * bQuestion:/b Why did the original authors decide to manually split? br -091 * bAnswer:/b Specific workload characteristics of our use case allowed us -092 * to benefit from a manual split system. -093 * p -094 * ul -095 * liData (~1k) that would grow instead of being replaced -096 * liData growth was roughly uniform across all regions -097 * liOLTP workload. Data loss is a big deal. -098 * /ul -099 * p -100 * bQuestion:/b Why is manual splitting good for this workload? br -101 * bAnswer:/b Although automated splitting is not a bad option, there are -102 * benefits to manual splitting. -103 * p -104 * ul -105 * liWith growing amounts of data, splits will continually be needed. Since -106 * you always know exactly what regions you have, long-term debugging and -107 * profiling is much easier with manual splits. It is hard to trace the logs to -108 * understand region level problems if it keeps splitting and getting renamed. -109 * liData offlining bugs + unknown number of split regions == oh crap! If an -110