@InterfaceAudience.Private public class SplitTransaction extends Object
prepare()
to setup
the transaction, execute(Server, RegionServerServices)
to run the
transaction and rollback(Server, RegionServerServices)
to cleanup if execute fails.
Here is an example of how you would use this class:
SplitTransaction st = new SplitTransaction(this.conf, parent, midKey) if (!st.prepare()) return; try { st.execute(server, services); } catch (IOException ioe) { try { st.rollback(server, services); return; } catch (RuntimeException e) { myAbortable.abort("Failed split, abort"); } }
This class is not thread safe. Caller needs ensure split is run by one thread only.
Modifier and Type | Field and Description |
---|---|
SplitTransactionCoordination.SplitTransactionDetails |
std |
Constructor and Description |
---|
SplitTransaction(HRegion r,
byte[] splitrow)
Constructor
|
Modifier and Type | Method and Description |
---|---|
Put |
addLocation(Put p,
ServerName sn,
long openSeqNum) |
PairOfSameType<HRegion> |
execute(Server server,
RegionServerServices services)
Run the transaction.
|
boolean |
prepare()
Does checks on split inputs.
|
boolean |
rollback(Server server,
RegionServerServices services) |
PairOfSameType<HRegion> |
stepsAfterPONR(Server server,
RegionServerServices services,
PairOfSameType<HRegion> regions) |
PairOfSameType<HRegion> |
stepsBeforePONR(Server server,
RegionServerServices services,
boolean testing) |
public SplitTransactionCoordination.SplitTransactionDetails std
public SplitTransaction(HRegion r, byte[] splitrow)
r
- Region to splitsplitrow
- Row to split aroundpublic boolean prepare()
true
if the region is splittable else
false
if it is not (e.g. its already closed, etc.).public PairOfSameType<HRegion> stepsBeforePONR(Server server, RegionServerServices services, boolean testing) throws IOException
IOException
public PairOfSameType<HRegion> execute(Server server, RegionServerServices services) throws IOException
server
- Hosting server instance. Can be null when testingservices
- Used to online/offline regions.IOException
- If thrown, transaction failed.
Call rollback(Server, RegionServerServices)
IOException
rollback(Server, RegionServerServices)
public PairOfSameType<HRegion> stepsAfterPONR(Server server, RegionServerServices services, PairOfSameType<HRegion> regions) throws IOException
IOException
public Put addLocation(Put p, ServerName sn, long openSeqNum)
public boolean rollback(Server server, RegionServerServices services) throws IOException
server
- Hosting server instance (May be null when testing).services
- IOException
- If thrown, rollback failed. Take drastic action.Copyright © 2015 The Apache Software Foundation. All rights reserved.