HBASE-4815 Disable online altering by default, create a config for it
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1203916 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cc7e469310
commit
c42e7e1028
|
@ -437,6 +437,7 @@ Release 0.92.0 - Unreleased
|
|||
HBASE-4796 Race between SplitRegionHandlers for the same region kills the master
|
||||
HBASE-4816 Regionserver wouldn't go down because split happened exactly at same
|
||||
time we issued bulk user region close call on our way out
|
||||
HBASE-4815 Disable online altering by default, create a config for it
|
||||
|
||||
TESTS
|
||||
HBASE-4450 test for number of blocks read: to serve as baseline for expected
|
||||
|
|
|
@ -69,7 +69,8 @@ public abstract class TableEventHandler extends EventHandler {
|
|||
try {
|
||||
this.masterServices.checkTableModifiable(tableName);
|
||||
} catch (TableNotDisabledException ex) {
|
||||
if (eventType.isOnlineSchemaChangeSupported()) {
|
||||
if (isOnlineSchemaChangeAllowed()
|
||||
&& eventType.isOnlineSchemaChangeSupported()) {
|
||||
LOG.debug("Ignoring table not disabled exception " +
|
||||
"for supporting online schema changes.");
|
||||
} else {
|
||||
|
@ -79,6 +80,11 @@ public abstract class TableEventHandler extends EventHandler {
|
|||
this.tableNameStr = Bytes.toString(this.tableName);
|
||||
}
|
||||
|
||||
private boolean isOnlineSchemaChangeAllowed() {
|
||||
return this.server.getConfiguration().getBoolean(
|
||||
"hbase.online.schema.update.enable", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process() {
|
||||
try {
|
||||
|
|
|
@ -781,6 +781,16 @@
|
|||
simplify coprocessor failure analysis.
|
||||
</description>
|
||||
</property>
|
||||
<property>
|
||||
<name>hbase.online.schema.update.enable</name>
|
||||
<value>false</value>
|
||||
<description>
|
||||
Set true to enable online schema changes. This is an experimental feature.
|
||||
There are known issues modifying table schemas at the same time a region
|
||||
split is happening so your table needs to be quiescent or else you have to
|
||||
be running with splits disabled.
|
||||
</description>
|
||||
</property>
|
||||
<property>
|
||||
<name>dfs.support.append</name>
|
||||
<value>true</value>
|
||||
|
@ -789,5 +799,5 @@
|
|||
You must ensure that this config. is true serverside too when running hbase
|
||||
(You will have to restart your cluster after setting it).
|
||||
</description>
|
||||
</property>
|
||||
</property>
|
||||
</configuration>
|
||||
|
|
|
@ -308,6 +308,8 @@ public class TestAdmin {
|
|||
@Test
|
||||
public void testOnlineChangeTableSchema() throws IOException, InterruptedException {
|
||||
final byte [] tableName = Bytes.toBytes("changeTableSchemaOnline");
|
||||
TEST_UTIL.getMiniHBaseCluster().getMaster().getConfiguration().setBoolean(
|
||||
"hbase.online.schema.update.enable", true);
|
||||
HTableDescriptor [] tables = admin.listTables();
|
||||
int numTables = tables.length;
|
||||
TEST_UTIL.createTable(tableName, HConstants.CATALOG_FAMILY);
|
||||
|
@ -390,6 +392,38 @@ public class TestAdmin {
|
|||
assertFalse(this.admin.tableExists(tableName));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testShouldFailOnlineSchemaUpdateIfOnlineSchemaIsNotEnabled()
|
||||
throws Exception {
|
||||
final byte[] tableName = Bytes.toBytes("changeTableSchemaOnlineFailure");
|
||||
TEST_UTIL.getMiniHBaseCluster().getMaster().getConfiguration().setBoolean(
|
||||
"hbase.online.schema.update.enable", false);
|
||||
HTableDescriptor[] tables = admin.listTables();
|
||||
int numTables = tables.length;
|
||||
TEST_UTIL.createTable(tableName, HConstants.CATALOG_FAMILY);
|
||||
tables = this.admin.listTables();
|
||||
assertEquals(numTables + 1, tables.length);
|
||||
|
||||
// FIRST, do htabledescriptor changes.
|
||||
HTableDescriptor htd = this.admin.getTableDescriptor(tableName);
|
||||
// Make a copy and assert copy is good.
|
||||
HTableDescriptor copy = new HTableDescriptor(htd);
|
||||
assertTrue(htd.equals(copy));
|
||||
// Now amend the copy. Introduce differences.
|
||||
long newFlushSize = htd.getMemStoreFlushSize() / 2;
|
||||
copy.setMemStoreFlushSize(newFlushSize);
|
||||
final String key = "anyoldkey";
|
||||
assertTrue(htd.getValue(key) == null);
|
||||
copy.setValue(key, key);
|
||||
boolean expectedException = false;
|
||||
try {
|
||||
modifyTable(tableName, copy);
|
||||
} catch (TableNotDisabledException re) {
|
||||
expectedException = true;
|
||||
}
|
||||
assertTrue("Online schema update should not happen.", expectedException);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify table is async so wait on completion of the table operation in master.
|
||||
* @param tableName
|
||||
|
|
Loading…
Reference in New Issue