use of com.navercorp.pinpoint.hbase.schema.reader.core.ChangeType in project pinpoint by naver.
the class HbaseSchemaCommandManager method applyTableChange.
private void applyTableChange(TableChange tableChange) {
ChangeType changeType = tableChange.getType();
TableName tableName = TableName.valueOf(namespace, tableChange.getName());
switch(changeType) {
case CREATE:
if (tableCommandMap.containsKey(tableName)) {
throw new IllegalArgumentException("Cannot create an existing table : " + tableName);
}
TableCommand createTableCommand = new CreateTableCommand(tableName, compressionAlgorithm, tableChange.getSplitKeys());
createTableCommand.applyConfiguration(tableChange.getTableConfiguration());
createTableCommand.applyColumnFamilyChanges(tableChange.getColumnFamilyChanges());
tableCommandMap.put(tableName, createTableCommand);
break;
case MODIFY:
TableCommand tableCommand = tableCommandMap.get(tableName);
if (tableCommand == null) {
throw new IllegalArgumentException("Cannot modify a non-existent table : " + tableName);
}
tableCommand.applyConfiguration(tableChange.getTableConfiguration());
tableCommand.applyColumnFamilyChanges(tableChange.getColumnFamilyChanges());
break;
default:
throw new UnsupportedOperationException("Invalid change type : " + changeType);
}
affectedTables.add(tableName);
}
use of com.navercorp.pinpoint.hbase.schema.reader.core.ChangeType in project pinpoint by naver.
the class TableCommand method applyColumnFamilyChanges.
void applyColumnFamilyChanges(List<ColumnFamilyChange> columnFamilyChanges) {
if (CollectionUtils.isEmpty(columnFamilyChanges)) {
return;
}
for (ColumnFamilyChange columnFamilyChange : columnFamilyChanges) {
ChangeType changeType = columnFamilyChange.getType();
if (changeType == ChangeType.CREATE) {
HColumnDescriptor family = newColumnDescriptor(columnFamilyChange);
if (htd.hasFamily(family.getName())) {
throw new IllegalArgumentException("Cannot add an existing column family : " + htd.getNameAsString());
}
htd.addFamily(family);
} else {
throw new UnsupportedOperationException("Unknown change type : " + changeType);
}
}
}
Aggregations