@InterfaceAudience.Private public class SplitTransactionImpl extends Object implements SplitTransaction
Modifier and Type | Class and Description |
---|---|
(package private) class |
SplitTransactionImpl.DaughterOpener |
static class |
SplitTransactionImpl.JournalEntryImpl |
(package private) static class |
SplitTransactionImpl.LoggingProgressable |
(package private) class |
SplitTransactionImpl.StoreFileSplitter
Utility class used to do the file splitting / reference writing
in parallel instead of sequentially.
|
SplitTransaction.JournalEntry, SplitTransaction.SplitTransactionPhase, SplitTransaction.TransactionListener
Modifier and Type | Field and Description |
---|---|
private static IOException |
closedByOtherException |
private SplitTransaction.SplitTransactionPhase |
currentPhase |
private long |
fileSplitTimeout |
private HRegionInfo |
hri_a |
private HRegionInfo |
hri_b |
private List<SplitTransaction.JournalEntry> |
journal |
private ArrayList<SplitTransaction.TransactionListener> |
listeners
Listeners
|
private static org.apache.commons.logging.Log |
LOG |
private HRegion |
parent |
private RegionServerServices |
rsServices |
private Server |
server |
private byte[] |
splitrow |
SplitTransactionCoordination.SplitTransactionDetails |
std |
(package private) boolean |
useZKForAssignment |
Constructor and Description |
---|
SplitTransactionImpl(Region r,
byte[] splitrow)
Constructor
|
Modifier and Type | Method and Description |
---|---|
private static Put |
addEmptyLocation(Put p,
int replicaId) |
Put |
addLocation(Put p,
ServerName sn,
long openSeqNum) |
(package private) void |
assertReferenceFileCount(int expectedReferenceFileCount,
org.apache.hadoop.fs.Path dir) |
(package private) PairOfSameType<Region> |
createDaughters(Server server,
RegionServerServices services) |
(package private) PairOfSameType<Region> |
createDaughters(Server server,
RegionServerServices services,
User user)
Prepare the regions and region files.
|
PairOfSameType<Region> |
execute(Server server,
RegionServerServices services)
Run the transaction.
|
PairOfSameType<Region> |
execute(Server server,
RegionServerServices services,
User user)
Run the transaction.
|
private static long |
getDaughterRegionIdTimestamp(HRegionInfo hri)
Calculate daughter regionid to use.
|
(package private) HRegionInfo |
getFirstDaughter() |
List<SplitTransaction.JournalEntry> |
getJournal()
Get the journal for the transaction.
|
RegionServerServices |
getRegionServerServices()
Get the RegonServerServices of the server running the transaction or rollback
|
(package private) HRegionInfo |
getSecondDaughter() |
Server |
getServer()
Get the Server running the transaction or rollback
|
private void |
offlineParentInMetaAndputMetaEntries(HConnection hConnection,
HRegionInfo parent,
HRegionInfo splitA,
HRegionInfo splitB,
ServerName serverName,
List<Mutation> metaEntries,
int regionReplication) |
(package private) void |
openDaughterRegion(Server server,
HRegion daughter)
Open daughter regions, add them to online list and update meta.
|
(package private) void |
openDaughters(Server server,
RegionServerServices services,
Region a,
Region b)
Perform time consuming opening of the daughter regions.
|
boolean |
prepare()
Does checks on split inputs.
|
SplitTransaction |
registerTransactionListener(SplitTransaction.TransactionListener listener)
Register a listener for transaction preparation, execution, and possibly
rollback phases.
|
boolean |
rollback(Server server,
RegionServerServices services)
Roll back a failed transaction
|
boolean |
rollback(Server server,
RegionServerServices services,
User user)
Roll back a failed transaction
|
private Pair<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.Path> |
splitStoreFile(byte[] family,
StoreFile sf) |
private Pair<Integer,Integer> |
splitStoreFiles(Map<byte[],List<StoreFile>> hstoreFilesToSplit)
Creates reference files for top and bottom half of the
|
PairOfSameType<Region> |
stepsAfterPONR(Server server,
RegionServerServices services,
PairOfSameType<Region> regions)
Deprecated.
|
PairOfSameType<Region> |
stepsAfterPONR(Server server,
RegionServerServices services,
PairOfSameType<Region> regions,
User user) |
PairOfSameType<Region> |
stepsBeforePONR(Server server,
RegionServerServices services,
boolean testing) |
private void |
transition(SplitTransaction.SplitTransactionPhase nextPhase) |
private void |
transition(SplitTransaction.SplitTransactionPhase nextPhase,
boolean isRollback) |
private boolean |
useCoordinatedStateManager(Server server) |
private static final org.apache.commons.logging.Log LOG
private final HRegion parent
private HRegionInfo hri_a
private HRegionInfo hri_b
private long fileSplitTimeout
public SplitTransactionCoordination.SplitTransactionDetails std
boolean useZKForAssignment
private final byte[] splitrow
private SplitTransaction.SplitTransactionPhase currentPhase
private Server server
private RegionServerServices rsServices
private final List<SplitTransaction.JournalEntry> journal
private final ArrayList<SplitTransaction.TransactionListener> listeners
private static IOException closedByOtherException
public SplitTransactionImpl(Region r, byte[] splitrow)
r
- Region to splitsplitrow
- Row to split aroundprivate void transition(SplitTransaction.SplitTransactionPhase nextPhase) throws IOException
IOException
private void transition(SplitTransaction.SplitTransactionPhase nextPhase, boolean isRollback) throws IOException
IOException
public boolean prepare() throws IOException
prepare
in interface SplitTransaction
true
if the region is splittable else
false
if it is not (e.g. its already closed, etc.).IOException
private static long getDaughterRegionIdTimestamp(HRegionInfo hri)
hri
- Parent HRegionInfo
PairOfSameType<Region> createDaughters(Server server, RegionServerServices services) throws IOException
IOException
PairOfSameType<Region> createDaughters(Server server, RegionServerServices services, User user) throws IOException
server
- Hosting server instance. Can be null when testing (won't try
and update in zk if a null server)services
- Used to online/offline regions.user
- IOException
- If thrown, transaction failed.
Call rollback(Server, RegionServerServices)
public PairOfSameType<Region> stepsBeforePONR(Server server, RegionServerServices services, boolean testing) throws IOException
IOException
void assertReferenceFileCount(int expectedReferenceFileCount, org.apache.hadoop.fs.Path dir) throws IOException
IOException
void openDaughters(Server server, RegionServerServices services, Region a, Region b) throws IOException
server
- Hosting server instance. Can be null when testingservices
- Used to online/offline regions.a
- first daughter regiona
- second daughter regionIOException
- If thrown, transaction failed.
Call rollback(Server, RegionServerServices)
public PairOfSameType<Region> execute(Server server, RegionServerServices services) throws IOException
SplitTransaction
execute
in interface SplitTransaction
server
- Hosting server instance. Can be null when testing.services
- Used to online/offline regions.IOException
- If thrown, transaction failed.
Call SplitTransaction.rollback(Server, RegionServerServices)
SplitTransaction.rollback(Server, RegionServerServices)
public PairOfSameType<Region> execute(Server server, RegionServerServices services, User user) throws IOException
execute
in interface SplitTransaction
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)
@Deprecated public PairOfSameType<Region> stepsAfterPONR(Server server, RegionServerServices services, PairOfSameType<Region> regions) throws IOException
IOException
public PairOfSameType<Region> stepsAfterPONR(Server server, RegionServerServices services, PairOfSameType<Region> regions, User user) throws IOException
IOException
private void offlineParentInMetaAndputMetaEntries(HConnection hConnection, HRegionInfo parent, HRegionInfo splitA, HRegionInfo splitB, ServerName serverName, List<Mutation> metaEntries, int regionReplication) throws IOException
IOException
public Put addLocation(Put p, ServerName sn, long openSeqNum)
void openDaughterRegion(Server server, HRegion daughter) throws IOException, org.apache.zookeeper.KeeperException
server
- daughter
- IOException
org.apache.zookeeper.KeeperException
private boolean useCoordinatedStateManager(Server server)
private Pair<Integer,Integer> splitStoreFiles(Map<byte[],List<StoreFile>> hstoreFilesToSplit) throws IOException
hstoreFilesToSplit
- map of store files to create half file references for.IOException
private Pair<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.Path> splitStoreFile(byte[] family, StoreFile sf) throws IOException
IOException
public boolean rollback(Server server, RegionServerServices services) throws IOException
SplitTransaction
rollback
in interface SplitTransaction
server
- Hosting server instance (May be null when testing).IOException
- If thrown, rollback failed. Take drastic action.public boolean rollback(Server server, RegionServerServices services, User user) throws IOException
SplitTransaction
rollback
in interface SplitTransaction
server
- Hosting server instance (May be null when testing).services
- IOException
- If thrown, rollback failed. Take drastic action.HRegionInfo getFirstDaughter()
HRegionInfo getSecondDaughter()
public List<SplitTransaction.JournalEntry> getJournal()
SplitTransaction
Journal entries are an opaque type represented as JournalEntry. They can also provide useful debugging information via their toString method.
getJournal
in interface SplitTransaction
public SplitTransaction registerTransactionListener(SplitTransaction.TransactionListener listener)
SplitTransaction
A listener can abort a transaction by throwing an exception.
registerTransactionListener
in interface SplitTransaction
listener
- the listenerpublic Server getServer()
SplitTransaction
getServer
in interface SplitTransaction
public RegionServerServices getRegionServerServices()
SplitTransaction
getRegionServerServices
in interface SplitTransaction
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.