@InterfaceAudience.Private public class RegionMergeTransactionImpl extends Object implements RegionMergeTransaction
Modifier and Type | Class and Description |
---|---|
static class |
RegionMergeTransactionImpl.JournalEntryImpl |
RegionMergeTransaction.JournalEntry, RegionMergeTransaction.RegionMergeTransactionPhase, RegionMergeTransaction.TransactionListener
Constructor and Description |
---|
RegionMergeTransactionImpl(Region a,
Region b,
boolean forcible)
Constructor
|
RegionMergeTransactionImpl(Region a,
Region b,
boolean forcible,
long masterSystemTime)
Constructor
|
Modifier and Type | Method and Description |
---|---|
Put |
addLocation(Put p,
ServerName sn,
long openSeqNum) |
HRegion |
execute(Server server,
RegionServerServices services)
Run the transaction.
|
HRegion |
execute(Server server,
RegionServerServices services,
User user)
Run the transaction.
|
List<RegionMergeTransaction.JournalEntry> |
getJournal()
Get the journal for the transaction.
|
HRegionInfo |
getMergedRegionInfo() |
static HRegionInfo |
getMergedRegionInfo(HRegionInfo a,
HRegionInfo b)
Get merged region info through the specified two regions
|
RegionServerServices |
getRegionServerServices()
Get the RegonServerServices of the server running the transaction or rollback
|
Server |
getServer()
Get the Server running the transaction or rollback
|
boolean |
prepare(RegionServerServices services)
Does checks on merge inputs.
|
void |
prepareMutationsForMerge(HRegionInfo mergedRegion,
HRegionInfo regionA,
HRegionInfo regionB,
ServerName serverName,
List<Mutation> mutations,
int regionReplication) |
RegionMergeTransaction |
registerTransactionListener(RegionMergeTransaction.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
|
void |
stepsAfterPONR(Server server,
RegionServerServices services,
HRegion mergedRegion)
Deprecated.
|
void |
stepsAfterPONR(Server server,
RegionServerServices services,
HRegion mergedRegion,
User user) |
HRegion |
stepsBeforePONR(Server server,
RegionServerServices services,
boolean testing) |
public RegionMergeTransactionImpl(Region a, Region b, boolean forcible)
a
- region a to mergeb
- region b to mergeforcible
- if false, we will only merge adjacent regionspublic boolean prepare(RegionServerServices services) throws IOException
prepare
in interface RegionMergeTransaction
services
- true
if the regions are mergeable else
false
if they are not (e.g. its already closed, etc.).IOException
public HRegion execute(Server server, RegionServerServices services) throws IOException
execute
in interface RegionMergeTransaction
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 HRegion execute(Server server, RegionServerServices services, User user) throws IOException
RegionMergeTransaction
execute
in interface RegionMergeTransaction
server
- Hosting server instance. Can be null when testingservices
- Used to online/offline regions.IOException
- If thrown, transaction failed. Call
RegionMergeTransaction.rollback(Server, RegionServerServices)
RegionMergeTransaction.rollback(Server, RegionServerServices, User)
@Deprecated public void stepsAfterPONR(Server server, RegionServerServices services, HRegion mergedRegion) throws IOException
IOException
public void stepsAfterPONR(Server server, RegionServerServices services, HRegion mergedRegion, User user) throws IOException
IOException
public void prepareMutationsForMerge(HRegionInfo mergedRegion, HRegionInfo regionA, HRegionInfo regionB, ServerName serverName, List<Mutation> mutations, int regionReplication) throws IOException
IOException
public Put addLocation(Put p, ServerName sn, long openSeqNum)
public HRegion stepsBeforePONR(Server server, RegionServerServices services, boolean testing) throws IOException
IOException
public static HRegionInfo getMergedRegionInfo(HRegionInfo a, HRegionInfo b)
a
- merging region Ab
- merging region Bpublic boolean rollback(Server server, RegionServerServices services) throws IOException
RegionMergeTransaction
rollback
in interface RegionMergeTransaction
server
- Hosting server instance (May be null when testing).services
- Services of regionserver, used to online regions.IOException
- If thrown, rollback failed. Take drastic action.public boolean rollback(Server server, RegionServerServices services, User user) throws IOException
RegionMergeTransaction
rollback
in interface RegionMergeTransaction
server
- Hosting server instance (May be null when testing).services
- Services of regionserver, used to online regions.IOException
- If thrown, rollback failed. Take drastic action.public HRegionInfo getMergedRegionInfo()
getMergedRegionInfo
in interface RegionMergeTransaction
public List<RegionMergeTransaction.JournalEntry> getJournal()
RegionMergeTransaction
Journal entries are an opaque type represented as JournalEntry. They can also provide useful debugging information via their toString method.
getJournal
in interface RegionMergeTransaction
public RegionMergeTransaction registerTransactionListener(RegionMergeTransaction.TransactionListener listener)
RegionMergeTransaction
A listener can abort a transaction by throwing an exception.
registerTransactionListener
in interface RegionMergeTransaction
listener
- the listenerpublic Server getServer()
RegionMergeTransaction
getServer
in interface RegionMergeTransaction
public RegionServerServices getRegionServerServices()
RegionMergeTransaction
getRegionServerServices
in interface RegionMergeTransaction