Search in sources :

Example 1 with TableCommand

use of com.navercorp.pinpoint.hbase.schema.core.command.TableCommand in project pinpoint by naver.

the class HbaseSchemaServiceImpl method applyChangeSets.

private boolean applyChangeSets(HbaseSchemaCommandManager commandManager, List<ChangeSet> changeSets, List<SchemaChangeLog> executedLogs) {
    if (CollectionUtils.isEmpty(changeSets)) {
        return false;
    }
    String namespace = commandManager.getNamespace();
    List<String> changeSetIds = changeSets.stream().map(ChangeSet::getId).collect(Collectors.toList());
    logger.info("[{}] Applying change sets : {}", namespace, changeSetIds);
    for (ChangeSet changeSet : changeSets) {
        commandManager.applyChangeSet(changeSet);
    }
    List<TableCommand> commands = commandManager.getCommands();
    boolean changesMade = commands.stream().map(command -> command.execute(hbaseAdminOperation)).reduce(Boolean::logicalOr).orElse(Boolean.FALSE);
    schemaChangeLogService.recordChangeSets(namespace, executedLogs.size() + 1, changeSets);
    return changesMade;
}
Also used : ChangeSet(com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet) TableCommand(com.navercorp.pinpoint.hbase.schema.core.command.TableCommand)

Aggregations

TableCommand (com.navercorp.pinpoint.hbase.schema.core.command.TableCommand)1 ChangeSet (com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet)1