|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.rep.ReplicationMutableConfig
com.sleepycat.je.rep.ReplicationConfig
public class ReplicationConfig
Specifies the immutable attributes of a replicated environment.
To change the default settings for a replicated environment, an application
creates a configuration object, customizes settings and uses it for ReplicatedEnvironment
construction. The set methods of this class validate
the configuration values when the method is invoked. An
IllegalArgumentException is thrown if the value is not valid for that
attribute.
Note that ReplicationConfig only describes those attributes which must be
set at ReplicatedEnvironment
construction time, while its superclass
ReplicationMutableConfig
describes attributes that may be modified
during the life of the replication group.
ReplicationConfig follows precedence rules similar to those of
EnvironmentConfig
.
ReplicatedEnvironment
construction are next.
After a ReplicatedEnvironment
has been constructed, its mutable
properties may be changed using ReplicatedEnvironment#setMutableConfig
. See ReplicationMutableConfig
for a list of mutable properties; all other
properties are immutable. Whether a property is mutable or immutable is
also described along with the parameter name String constants in this class.
ReplicatedEnvironment.getRepConfig()
or ReplicatedEnvironment.getRepMutableConfig()
. The original ReplicationConfig
or ReplicationMutableConfig object used to set the properties is not kept up
to date as properties are changed, and does not reflect property validation
or properties that are computed.
Field Summary | |
---|---|
static String |
CONSISTENCY_POLICY
The default consistency policy used by a replica. |
static ReplicationConfig |
DEFAULT
|
static String |
DEFAULT_PORT
The default port used for replication. |
static String |
ELECTIONS_PRIMARY_RETRIES
The number of times an unsuccessful election will be retried by a designated Primary in a two node group before it is
activated and becomes the Master. |
static String |
ENV_CONSISTENCY_TIMEOUT
The amount of time to wait for a Replica to become consistent with the Master, when a ReplicatedEnvironment handle is created and
no ConsistencyPolicy is specified. |
static String |
FEEDER_TIMEOUT
A heartbeat is exchanged between the feeder and replica to ensure they are alive. |
static String |
GROUP_NAME
The name for the replication group. |
static String |
HELPER_HOSTS
The string identifying one or more helper host and port pairs in this format: |
static String |
INSUFFICIENT_REPLICAS_TIMEOUT
The amount of time that a Environment.beginTransaction(com.sleepycat.je.Transaction, com.sleepycat.je.TransactionConfig)
on the Master will wait for a sufficient number of Replicas, as
determined by the default Durability policy, to contact the
Master. |
static String |
MAX_CLOCK_DELTA
Sets the maximum acceptable clock skew between this Replica and its Feeder, which is the node that is the source of its replication stream. |
static String |
MAX_MESSAGE_SIZE
The maximum message size which will be accepted by a node (to prevent DOS attacks). |
static String |
NODE_HOST_PORT
Names the hostname and port associated with this node in the replication group, e.g. |
static String |
NODE_NAME
The node name uniquely identifies this node within the replication group. |
static String |
NODE_TYPE
The type of this node. |
static String |
REP_STREAM_TIMEOUT
The maximum amount of time the replication group guarantees preservation of the log files constituting the replication stream. |
static String |
REPLAY_TXN_LOCK_TIMEOUT
The maximum amount of time for a replay transaction to wait for a lock. |
static String |
REPLICA_ACK_TIMEOUT
The amount of time that the Transaction.commit(com.sleepycat.je.Durability)
on the Master will wait for a sufficient number of acknowledgments from
the Replicas. |
static String |
REPLICA_TIMEOUT
A heartbeat is exchanged between the feeder and replica to ensure they are alive. |
static String |
TXN_ROLLBACK_LIMIT
In rare cases, a node may need to rollback committed transactions in order to rejoin a replication group. |
Fields inherited from class com.sleepycat.je.rep.ReplicationMutableConfig |
---|
DESIGNATED_PRIMARY, ELECTABLE_GROUP_SIZE_OVERRIDE, props, validateParams |
Constructor Summary | |
---|---|
ReplicationConfig()
Creates a ReplicationConfig initialized with the system default settings. |
|
ReplicationConfig(Properties properties)
Creates a ReplicationConfig which includes the properties specified in the properties parameter. |
|
ReplicationConfig(Properties properties,
boolean validateParams)
Internal use only, from RepConfigManager. |
|
ReplicationConfig(String groupName,
String nodeName,
String hostPort)
Creates a ReplicationConfig initialized with the system default settings and the specified group name, node name, and hostname/port values. |
Method Summary | |
---|---|
ReplicationConfig |
clone()
Returns a copy of this configuration object. |
(package private) boolean |
getAllowConvert()
For internal use only. |
ReplicaConsistencyPolicy |
getConsistencyPolicy()
Returns the default consistency policy associated with the configuration. |
String |
getGroupName()
Gets the name associated with the replication group. |
String |
getHelperHosts()
Returns the string identifying one or more helper host and port pairs in this format: |
Set<InetSocketAddress> |
getHelperSockets()
|
long |
getMaxClockDelta(TimeUnit unit)
Returns the maximum acceptable clock skew between this Replica and its Feeder, which is the node that is the source of its replication stream. |
String |
getNodeHostname()
Returns the hostname component of the nodeHost property. |
String |
getNodeHostPort()
Returns the hostname and port associated with this node. |
String |
getNodeName()
Returns the unique name associated with this node. |
int |
getNodePort()
Returns the port component of the nodeHost property. |
InetSocketAddress |
getNodeSocketAddress()
|
NodeType |
getNodeType()
Returns the type ( ELECTABLE , MONITOR ) of this node. |
long |
getReplicaAckTimeout(TimeUnit unit)
Returns the configured replica timeout value. |
(package private) void |
setAllowConvert(boolean allowConvert)
For internal use only. |
ReplicationConfig |
setConfigParam(String paramName,
String value)
Set this configuration parameter with this value. |
ReplicationConfig |
setConsistencyPolicy(ReplicaConsistencyPolicy policy)
Sets the consistency policy to be associated with the configuration. |
ReplicationConfig |
setGroupName(String groupName)
Sets the name for the replication group. |
ReplicationConfig |
setHelperHosts(String hostsAndPorts)
Identify one or more helpers nodes by their host and port pairs in this format: |
ReplicationConfig |
setMaxClockDelta(long maxClockDelta,
TimeUnit unit)
Sets the maximum acceptable clock skew between this Replica and its Feeder, which is the node that is the source of its replication stream. |
ReplicationConfig |
setNodeHostPort(String hostPort)
Sets the hostname and port associated with this node. |
ReplicationConfig |
setNodeName(String nodeName)
Sets the name to be associated with this node. |
ReplicationConfig |
setNodeType(NodeType nodeType)
Sets the type of this node. |
ReplicationConfig |
setReplicaAckTimeout(long replicaCommitTimeout,
TimeUnit unit)
Set the replica commit timeout. |
void |
verify()
|
Methods inherited from class com.sleepycat.je.rep.ReplicationMutableConfig |
---|
copyMutablePropsTo, fillInEnvironmentGeneratedProps, getConfigParam, getDesignatedPrimary, getElectableGroupSizeOverride, getPriority, getProps, getValidateParams, setDesignatedPrimary, setElectableGroupSizeOverride, setOverrideValidateParams, setPriority, toString, validateProperties |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String GROUP_NAME
Name | Type | Mutable | Default |
"je.rep.groupName" | String | No | "DefaultGroup" |
setGroupName(java.lang.String)
,
getGroupName()
,
Constant Field Valuespublic static final String NODE_NAME
Name | Type | Mutable | Default |
"je.rep.nodeName" | String | No | "DefaultRepNodeName" |
setNodeName(java.lang.String)
,
getNodeName()
,
Constant Field Valuespublic static final String NODE_TYPE
Name | Type | Mutable | Default |
"je.rep.nodeType" | NodeType |
No | ELECTABLE |
setNodeType(com.sleepycat.je.rep.NodeType)
,
getNodeType()
,
Constant Field Valuespublic static final String HELPER_HOSTS
hostname[:port][,hostname[:port]]*
Name | Type | Mutable | Default |
"je.rep.helperHosts" | String | No | "" |
setHelperHosts(java.lang.String)
,
getHelperHosts()
,
Constant Field Valuespublic static final String DEFAULT_PORT
Name | Type | Mutable | Default | Minimum | Maximum |
"je.rep.defaultPort" | Integer | No | 5001 | 1024 | Short.MAX_VALUE |
public static final String NODE_HOST_PORT
The hostname is defaulted to "localhost" to make it easy to prototype and to execute the examples, but the user should be very sure to set a specific hostname before starting nodes on multiple machines. The value of je.rep.nodeHostPort is saved persistently in replication group metadata and is expected to be a unique address, and a value of "localhost" in the replication metadata will cause severe communication confusion.
The port portion of the host value is optional. If it's not specified, the value of "je.rep.defaultPort" is used.
Name | Type | Mutable | Default |
"je.rep.nodeHostPort" | String | No | "localhost" |
setNodeHostPort(java.lang.String)
,
getNodeHostPort()
,
Constant Field Valuespublic static final String CONSISTENCY_POLICY
NoConsistencyRequiredPolicy
and
TimeConsistencyPolicy
. They
can be specified as:
NoConsistencyRequiredPolicyor
TimeConsistencyPolicy(<permissibleLag>,<timeout>)
where <permissibleLag>
and <timeout>
are Time Duration
Properties.
For example, a time based consistency policy with a lag of one second
and a timeout of one hour is denoted by the string:
TimeConsistencyPolicy(1 s,1 h)
Name | Type | Mutable | Default |
"je.rep.consistencyPolicy" | String | No | "TimeConsistencyPolicy(1 s,1 h)" |
setConsistencyPolicy(com.sleepycat.je.ReplicaConsistencyPolicy)
,
getConsistencyPolicy()
,
TransactionConfig.setConsistencyPolicy(com.sleepycat.je.ReplicaConsistencyPolicy)
,
TransactionConfig.getConsistencyPolicy()
,
Time Duration
Properties,
Constant Field Valuespublic static final String REP_STREAM_TIMEOUT
Name | Type | Mutable | Default | Minimum | Maximum |
"je.rep.repStreamTimeout" | Duration | No | 24 h | 0 | -none- |
public static final String REPLAY_TXN_LOCK_TIMEOUT
Name | Type | Mutable | Default | Minimum | Maximum |
"je.rep.replayTxnLockTimeout" | Duration | No | 500 ms | 1 ms | 75 min |
public static final String ENV_CONSISTENCY_TIMEOUT
ReplicatedEnvironment
handle is created and
no ConsistencyPolicy
is specified. If the Replica does not
become consistent within this period, a
ReplicaConsistencyException
is thrown by the
ReplicatedEnvironment
constructor.
If an explicit ConsistencyPolicy
is specified via a
constructor argument, then the timeout defined by the
ConsistencyPolicy
argument is used instead of this default.
Name | Type | Mutable | Default | Minimum | Maximum |
"je.rep.envConsistencyTimeout" | Duration | No | 5 min | 10 ms | -none- |
public static final String REPLICA_ACK_TIMEOUT
Transaction.commit(com.sleepycat.je.Durability)
on the Master will wait for a sufficient number of acknowledgments from
the Replicas. If the Master does not receive a sufficient number of
acknowledgments within this timeout period, the commit()
will throw InsufficientAcksException
. In the special case of a
two node group, if this node is the designated Primary
,
the Primary
will be activated
, and the
commit()
will proceed normally instead of throwing an
exception.
Name | Type | Mutable | Default | Minimum | Maximum |
"je.rep.replicaAckTimeout" | Duration | No | 5 s | 10 ms | -none- |
ReplicationMutableConfig.DESIGNATED_PRIMARY
,
Constant Field Valuespublic static final String INSUFFICIENT_REPLICAS_TIMEOUT
Environment.beginTransaction(com.sleepycat.je.Transaction, com.sleepycat.je.TransactionConfig)
on the Master will wait for a sufficient number of Replicas, as
determined by the default Durability
policy, to contact the
Master. If the timeout period expires before a sufficient number of
Replicas contact the Master, the
Environment.beginTransaction(com.sleepycat.je.Transaction, com.sleepycat.je.TransactionConfig)
will throw InsufficientReplicasException
. In the special case of
a two node group, if this node is the designated Primary
,
the Primary
will be activated
, and the
beginTransaction()
will proceed normally instead of
throwing an exception.
Name | Type | Mutable | Default | Minimum | Maximum |
"je.rep.insufficientReplicasTimeout" | Duration | No | 10 s | 10 ms | -none- |
ReplicationMutableConfig.DESIGNATED_PRIMARY
,
Constant Field Valuespublic static final String MAX_MESSAGE_SIZE
Name | Type | Mutable | Default | Minimum | Maximum |
"je.rep.maxMessageSize" | Long | No | half of cache size | 256KB | Long.MAX_VALUE |
public static final String MAX_CLOCK_DELTA
Name | Type | Mutable | Default | Minimum | Maximum |
"je.rep.maxClockDelta" | Duration | No | 2 s | 0 s | 1 min |
setMaxClockDelta(long, java.util.concurrent.TimeUnit)
,
getMaxClockDelta(java.util.concurrent.TimeUnit)
,
Time Duration
Properties,
Constant Field Valuespublic static final String ELECTIONS_PRIMARY_RETRIES
Primary
in a two node group before it is
activated and becomes the Master.
Name | Type | Mutable | Default | Minimum | Maximum |
"je.rep.electionsPrimaryRetries" | Integer | No | 2 | 0 | Integer.MAX_VALUE |
ReplicationMutableConfig.DESIGNATED_PRIMARY
,
Constant Field Valuespublic static final String TXN_ROLLBACK_LIMIT
RollbackProhibitedException
will be thrown.
Name | Type | Mutable | Default | Minimum | Maximum |
"je.rep.txnRollbackLimit" | Integer | No | 10 | 0 | Integer.MAX_VALUE |
RollbackProhibitedException
,
Constant Field Valuespublic static final String FEEDER_TIMEOUT
Reducing this value enables the master to discover failed Replicas, and recycle feeder connections, faster. However, it increases the chances of false timeouts, if the network is experiencing transient problems, or the Java GC is responsible for long pauses. In the latter case, it's generally better to tune the GC to avoid such pauses.
Name | Type | Mutable | Default | Minimum | Maximum |
"je.rep.feederTimeout" | Duration | No | 30 s | 2 s | -none- |
public static final String REPLICA_TIMEOUT
Reducing the value means that a master failure will be discovered more promptly in some circumstances and the overall time needed to failover to a new master will be reduced. However, it increases the chances of false timeouts, if the network is experiencing transient problems, or the Java GC is responsible for long pauses. In the latter case, it's generally better to tune the GC to avoid such pauses.
Name | Type | Mutable | Default | Minimum | Maximum |
"je.rep.replicaTimeout" | Duration | No | 30 s | 2 s | -none- |
public static final ReplicationConfig DEFAULT
Constructor Detail |
---|
public ReplicationConfig()
public ReplicationConfig(String groupName, String nodeName, String hostPort)
groupName
- the name for the replication groupnodeName
- the name for this nodehostPort
- the hostname and port for this nodepublic ReplicationConfig(Properties properties) throws IllegalArgumentException
properties
- Supported properties are described as the string
constants in this class.
IllegalArgumentException
- If any properties read from the
properties parameter are invalid.ReplicationConfig(Properties properties, boolean validateParams) throws IllegalArgumentException
IllegalArgumentException
Method Detail |
---|
public String getGroupName()
public ReplicationConfig setGroupName(String groupName) throws IllegalArgumentException
groupName
- the alpha numeric string representing the name
IllegalArgumentException
- If the string name is not validboolean getAllowConvert()
void setAllowConvert(boolean allowConvert)
allowConvert
- if true, this environment should be converted to
replicated format.public String getNodeName()
public ReplicationConfig setNodeName(String nodeName) throws IllegalArgumentException
RestartRequiredException
is thrown if it is not.
nodeName
- the node name for this replicated environment.
IllegalArgumentException
public NodeType getNodeType()
ELECTABLE
, MONITOR
) of this node.
public ReplicationConfig setNodeType(NodeType nodeType)
nodeType
- the node type
public String getNodeHostPort()
hostname:port
NODE_HOST_PORT
public ReplicationConfig setNodeHostPort(String hostPort)
hostname[:port]The port must be outside the range of "Well Known Ports" (zero through 1023).
hostPort
- the string containing the hostname and port as above.
NODE_HOST_PORT
public long getReplicaAckTimeout(TimeUnit unit)
public ReplicationConfig setReplicaAckTimeout(long replicaCommitTimeout, TimeUnit unit)
replicaCommitTimeout
- time in milliseconds
public long getMaxClockDelta(TimeUnit unit)
public ReplicationConfig setMaxClockDelta(long maxClockDelta, TimeUnit unit) throws IllegalArgumentException
maxClockDelta
- the maximum acceptable clock skew
IllegalArgumentException
- if the value is not a positive integerpublic String getHelperHosts()
hostname[:port][,hostname[:port]]*The port name may be omitted if it's the default port.
public ReplicationConfig setHelperHosts(String hostsAndPorts)
hostname[:port][,hostname[:port]]*If the port is omitted, the default port defined by XXX is used.
hostsAndPorts
- the string representing the host and port pairs.
public ReplicationConfig setConsistencyPolicy(ReplicaConsistencyPolicy policy)
policy
- the consistency policy to be set for this config.
public ReplicaConsistencyPolicy getConsistencyPolicy()
If the user does not set the default consistency policy through setConsistencyPolicy(com.sleepycat.je.ReplicaConsistencyPolicy)
, the system will use the policy
defined by CONSISTENCY_POLICY
.
getConsistencyPolicy
in interface RepConfigProxy
public ReplicationConfig setConfigParam(String paramName, String value) throws IllegalArgumentException
ReplicationMutableConfig
setConfigParam
in class ReplicationMutableConfig
paramName
- the configuration parameter name, one of the String
constants in this classvalue
- the configuration value.
IllegalArgumentException
- if the paramName or value is invalid.public ReplicationConfig clone()
clone
in class ReplicationMutableConfig
public Set<InetSocketAddress> getHelperSockets()
public InetSocketAddress getNodeSocketAddress()
public String getNodeHostname()
public int getNodePort()
public void verify() throws IllegalArgumentException
IllegalArgumentException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |