public class RegionTransitionData extends Object implements org.apache.hadoop.io.Writable
Constructor and Description |
---|
RegionTransitionData()
Writable constructor.
|
RegionTransitionData(EventHandler.EventType eventType,
byte[] regionName)
Construct data for a new region transition event with the specified event
type and region name.
|
RegionTransitionData(EventHandler.EventType eventType,
byte[] regionName,
ServerName origin)
Construct data for a new region transition event with the specified event
type, region name, and server name.
|
RegionTransitionData(EventHandler.EventType eventType,
byte[] regionName,
ServerName serverName,
byte[] payload)
Construct data for a new region transition event with the specified event
type, region name, and server name.
|
Modifier and Type | Method and Description |
---|---|
static RegionTransitionData |
fromBytes(byte[] bytes)
Get an instance from bytes.
|
byte[] |
getBytes()
Get the bytes for this instance.
|
EventHandler.EventType |
getEventType()
Gets the type of region transition event.
|
ServerName |
getOrigin()
Gets the server the event originated from.
|
byte[] |
getPayload() |
byte[] |
getRegionName()
Gets the name of the region being transitioned.
|
long |
getStamp()
Gets the timestamp when this event was created.
|
void |
readFields(DataInput in) |
String |
toString() |
void |
write(DataOutput out) |
public RegionTransitionData()
public RegionTransitionData(EventHandler.EventType eventType, byte[] regionName)
Used when the server name is not known (the master is setting it). This happens during cluster startup or during failure scenarios. When processing a failed regionserver, the master assigns the regions from that server to other servers though the region was never 'closed'. During master failover, the new master may have regions stuck in transition without a destination so may have to set regions offline and generate a new assignment.
Since only the master uses this constructor, the type should always be
EventHandler.EventType.M_ZK_REGION_OFFLINE
.
eventType
- type of eventregionName
- name of region as per HRegionInfo#getRegionName()
public RegionTransitionData(EventHandler.EventType eventType, byte[] regionName, ServerName origin)
Used when the server name is known (a regionserver is setting it).
Valid types for this constructor are EventHandler.EventType.M_ZK_REGION_CLOSING
,
EventHandler.EventType.RS_ZK_REGION_CLOSED
, EventHandler.EventType.RS_ZK_REGION_OPENING
,
EventHandler.EventType.RS_ZK_REGION_SPLITTING
,
and EventHandler.EventType.RS_ZK_REGION_OPENED
.
eventType
- type of eventregionName
- name of region as per HRegionInfo#getRegionName()
origin
- Originating ServerName
public RegionTransitionData(EventHandler.EventType eventType, byte[] regionName, ServerName serverName, byte[] payload)
Used when the server name is known (a regionserver is setting it).
Valid types for this constructor are EventHandler.EventType.RS_ZK_REGION_SPLIT
since SPLIT is only type that currently carries a payload.
eventType
- type of eventregionName
- name of region as per HRegionInfo#getRegionName()
serverName
- Originating ServerName
payload
- Payload examples include the daughters involved in a
EventHandler.EventType.RS_ZK_REGION_SPLIT
. Can be nullpublic EventHandler.EventType getEventType()
One of:
EventHandler.EventType.M_ZK_REGION_OFFLINE
EventHandler.EventType.M_ZK_REGION_CLOSING
EventHandler.EventType.RS_ZK_REGION_CLOSED
EventHandler.EventType.RS_ZK_REGION_OPENING
EventHandler.EventType.RS_ZK_REGION_OPENED
EventHandler.EventType.RS_ZK_REGION_SPLITTING
EventHandler.EventType.RS_ZK_REGION_SPLIT
public byte[] getRegionName()
Region name is required so this never returns null.
HRegionInfo#getRegionName()
public ServerName getOrigin()
public long getStamp()
public byte[] getPayload()
public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public byte[] getBytes()
RuntimeException
if
there is an error deserializing this instance because it represents a code
bug.public static RegionTransitionData fromBytes(byte[] bytes)
RuntimeException
if
there is an error serializing this instance from bytes because it
represents a code bug.bytes
- binary representation of this instanceCopyright © 2014 The Apache Software Foundation. All Rights Reserved.