Search in sources :

Example 1 with ProcedureTree

use of org.apache.hadoop.hbase.procedure2.store.ProcedureTree in project hbase by apache.

the class RegionProcedureStore method load.

@Override
public void load(ProcedureLoader loader) throws IOException {
    List<ProcedureProtos.Procedure> procs = new ArrayList<>();
    long maxProcId = 0;
    try (RegionScanner scanner = region.getRegionScanner(new Scan().addColumn(PROC_FAMILY, PROC_QUALIFIER))) {
        List<Cell> cells = new ArrayList<>();
        boolean moreRows;
        do {
            moreRows = scanner.next(cells);
            if (cells.isEmpty()) {
                continue;
            }
            Cell cell = cells.get(0);
            cells.clear();
            maxProcId = Math.max(maxProcId, Bytes.toLong(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()));
            if (cell.getValueLength() > 0) {
                ProcedureProtos.Procedure proto = ProcedureProtos.Procedure.parser().parseFrom(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
                procs.add(proto);
            }
        } while (moreRows);
    }
    loader.setMaxProcId(maxProcId);
    ProcedureTree tree = ProcedureTree.build(procs);
    loader.load(tree.getValidProcs());
    loader.handleCorrupted(tree.getCorruptedProcs());
}
Also used : RegionScanner(org.apache.hadoop.hbase.regionserver.RegionScanner) ArrayList(java.util.ArrayList) UnassignProcedure(org.apache.hadoop.hbase.master.assignment.UnassignProcedure) RecoverMetaProcedure(org.apache.hadoop.hbase.master.procedure.RecoverMetaProcedure) Procedure(org.apache.hadoop.hbase.procedure2.Procedure) AssignProcedure(org.apache.hadoop.hbase.master.assignment.AssignProcedure) MoveRegionProcedure(org.apache.hadoop.hbase.master.assignment.MoveRegionProcedure) ServerCrashProcedure(org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure) Scan(org.apache.hadoop.hbase.client.Scan) ProcedureTree(org.apache.hadoop.hbase.procedure2.store.ProcedureTree) ProcedureProtos(org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos) Cell(org.apache.hadoop.hbase.Cell)

Example 2 with ProcedureTree

use of org.apache.hadoop.hbase.procedure2.store.ProcedureTree in project hbase by apache.

the class ProcedureWALFormatReader method finish.

public void finish() throws IOException {
    // notify the loader about the max proc ID
    loader.setMaxProcId(maxProcId);
    // build the procedure execution tree. When building we will verify that whether a procedure is
    // valid.
    ProcedureTree tree = ProcedureTree.build(procedureMap.getProcedures());
    loader.load(tree.getValidProcs());
    loader.handleCorrupted(tree.getCorruptedProcs());
}
Also used : ProcedureTree(org.apache.hadoop.hbase.procedure2.store.ProcedureTree)

Aggregations

ProcedureTree (org.apache.hadoop.hbase.procedure2.store.ProcedureTree)2 ArrayList (java.util.ArrayList)1 Cell (org.apache.hadoop.hbase.Cell)1 Scan (org.apache.hadoop.hbase.client.Scan)1 AssignProcedure (org.apache.hadoop.hbase.master.assignment.AssignProcedure)1 MoveRegionProcedure (org.apache.hadoop.hbase.master.assignment.MoveRegionProcedure)1 UnassignProcedure (org.apache.hadoop.hbase.master.assignment.UnassignProcedure)1 RecoverMetaProcedure (org.apache.hadoop.hbase.master.procedure.RecoverMetaProcedure)1 ServerCrashProcedure (org.apache.hadoop.hbase.master.procedure.ServerCrashProcedure)1 Procedure (org.apache.hadoop.hbase.procedure2.Procedure)1 RegionScanner (org.apache.hadoop.hbase.regionserver.RegionScanner)1 ProcedureProtos (org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos)1