1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002, 2014 Oracle and/or its affiliates.  All rights reserved.
5  *
6  */
7 
8 package com.sleepycat.je.rep.impl;
9 
10 import java.io.IOException;
11 import java.net.InetAddress;
12 import java.net.InetSocketAddress;
13 import java.net.ServerSocket;
14 import java.net.UnknownHostException;
15 import java.util.HashSet;
16 import java.util.StringTokenizer;
17 
18 import com.sleepycat.je.config.BooleanConfigParam;
19 import com.sleepycat.je.config.ConfigParam;
20 import com.sleepycat.je.config.DurationConfigParam;
21 import com.sleepycat.je.config.EnvironmentParams;
22 import com.sleepycat.je.config.IntConfigParam;
23 import com.sleepycat.je.config.LongConfigParam;
24 import com.sleepycat.je.rep.NodeType;
25 import com.sleepycat.je.rep.ReplicationConfig;
26 import com.sleepycat.je.rep.ReplicationMutableConfig;
27 import com.sleepycat.je.rep.ReplicationNetworkConfig;
28 import com.sleepycat.je.rep.ReplicationSSLConfig;
29 import com.sleepycat.je.rep.util.DbResetRepGroup;
30 import com.sleepycat.je.rep.utilint.RepUtils;
31 import com.sleepycat.je.rep.utilint.net.SSLChannelFactory;
32 
33 public class RepParams {
34 
35     /*
36      * Note: all replicated parameters should start with
37      * EnvironmentParams.REP_PARAM_PREFIX, which is "je.rep.",
38      * see SR [#19080].
39      */
40 
41     /**
42      * @hidden
43      * Name of a java System property (boolean) which can be turned on in order
44      * to avoid input validation checks on node names.  This is undocumented.
45      * <p>
46      * Generally users should not skip validation, because there are a few
47      * kinds of punctuation characters that would cause problems if they were
48      * allowed in node names.  But in the past users might have inadvertantly
49      * created node names that do not conform to the new, stricter rules.  In
50      * that case they would not be able to upgrade to the newer version of JE
51      * that now includes this checking.
52      * <p>
53      * This flag actually applies to the group name too.  But for group names
54      * the new rules are actually less strict than they used to be, so there
55      * should be no problem.
56      */
57     public static final String SKIP_NODENAME_VALIDATION =
58         "je.rep.skipNodenameValidation";
59 
60     /**
61      * A JE/HA configuration parameter describing an Identifier name.
62      */
63     static public class IdentifierConfigParam extends ConfigParam {
64         private static final String DEBUG_NAME =
65             IdentifierConfigParam.class.getName();
66 
IdentifierConfigParam(String configName, String defaultValue, boolean mutable, boolean forReplication)67         public IdentifierConfigParam(String configName,
68                                      String defaultValue,
69                                      boolean mutable,
70                                      boolean forReplication) {
71             super(configName, defaultValue, mutable, forReplication);
72         }
73 
74         @Override
validateValue(String value)75         public void validateValue(String value) {
76             if (Boolean.getBoolean(SKIP_NODENAME_VALIDATION)) {
77                 return;
78             }
79             if ((value == null) || (value.length() == 0)) {
80                 throw new IllegalArgumentException
81                     (DEBUG_NAME + ": a value is required");
82             }
83             for (char c : value.toCharArray()) {
84                 if (!isValid(c)) {
85                     throw new IllegalArgumentException
86                         (DEBUG_NAME + ": " + name + ", must consist of " +
87                          "letters, digits, hyphen, underscore, period.");
88                 }
89             }
90         }
91 
isValid(char c)92         private boolean isValid(char c) {
93             if (Character.isLetterOrDigit(c) ||
94                 c == '-' ||
95                 c == '_' ||
96                 c == '.') {
97                 return true;
98             }
99             return false;
100         }
101     }
102 
103     /*
104      * Replication group-wide properties. These properties are candidates for
105      * consistency checking whenever there is a handshake between a master and
106      * replica.
107      */
108 
109     /** Names the Replication group. */
110     public static final ConfigParam GROUP_NAME =
111         new IdentifierConfigParam(ReplicationConfig.GROUP_NAME,
112                                   "DefaultGroup",      // default
113                                   false,               // mutable
114                                   true);               // forReplication
115 
116     /**
117      * The maximum amount of time the replication group guarantees preservation
118      * of the log files constituting the replication stream. After this period
119      * of time, nodes are free to do log cleaning and to remove log files
120      * earlier than this period. If a node has crashed and does not re-join the
121      * group within this timeout period it may need to perform a network
122      * restore operation to catch up.
123      */
124     public static final DurationConfigParam REP_STREAM_TIMEOUT =
125         new DurationConfigParam(ReplicationConfig.REP_STREAM_TIMEOUT,
126                                 null,                         // min
127                                 null,                         // max
128                                 "24 h",                       // default
129                                 false,                        // mutable
130                                 true);
131 
132     /**
133      * The minimum number of, most recent, VLSNs that are retained as part of
134      * the replication stream. This ensures that any requests to sync in the
135      * current vlsn range between: [ VLSNRange.getLast() - MIN_RETAINED_VLSNS
136      * .. VLSNRange.getLast ] are guaranteed to succeed as long as there is a
137      * syncable VLSN in this range.
138      *
139      * The default value of 200000 vlsns, roughly corresponds to 10K of records
140      * each committed in its own transaction. Assuming an average record size
141      * of 1K, this represents ~100MB of retained storage.
142      *
143      * Note that this value must be set consistently across all the RNs in the
144      * replication group.
145      */
146     public static final IntConfigParam MIN_RETAINED_VLSNS =
147         new IntConfigParam(EnvironmentParams.REP_PARAM_PREFIX +
148                            "minRetainedVLSNs",
149                            0,               // min
150                            null,            // max
151                            200000,          // default
152                            false,           // mutable
153                            true);           // forReplication
154 
155 
156     /**
157      * @see ReplicationConfig#REPLICA_RECEIVE_BUFFER_SIZE
158      */
159     public static final IntConfigParam REPLICA_RECEIVE_BUFFER_SIZE =
160             new IntConfigParam(ReplicationConfig.REPLICA_RECEIVE_BUFFER_SIZE,
161                                0,               // min
162                                null,            // max
163                                1048576,         // default
164                                false,           // mutable
165                                true);           // forReplication
166 
167     /**
168      * The size of the message queue used for communication between the thread
169      * reading the replication stream and the thread doing the replay. The
170      * default buffer size has been chosen to hold 500 single operation
171      * transactions (the ln + commit record) assuming 1K sized LN record.
172      * <p>
173      * Larger values of buffer size may result in higher peak memory
174      * utilization, due to a larger number of LNs sitting in the queue. The
175      * size of the queue itself is unlikely to be an issue, since it's tiny
176      * relative to cache sizes. At 1000, 1kbyte LNs it raises the peak
177      * utilization by 1MB which for most apps is an insignificant rise in the
178      * peak.
179      *
180      * Note that the parameter is lazily mutable, that is, the change will take
181      * effect the next time the node transitions to a replica state.
182      */
183     public static final IntConfigParam REPLICA_MESSAGE_QUEUE_SIZE =
184             new IntConfigParam(EnvironmentParams.REP_PARAM_PREFIX +
185                                "replicaMessageQueueSize",
186                                1,               // min
187                                null,            // max
188                                1000,            // default
189                                true,            // mutable
190                                true);           // forReplication
191 
192     /**
193      * The lock timeout for replay transactions.
194      */
195     public static final DurationConfigParam REPLAY_TXN_LOCK_TIMEOUT =
196         new DurationConfigParam(ReplicationConfig.REPLAY_TXN_LOCK_TIMEOUT,
197                                 "1 ms",            // min
198                                 "75 min",          // max
199                                 "500 ms",          // default
200                                 false,             // mutable
201                                 true);             // forReplication
202 
203     /**
204      * @see ReplicationConfig#ENV_SETUP_TIMEOUT
205      */
206     public static final DurationConfigParam ENV_SETUP_TIMEOUT =
207         new DurationConfigParam
208         (ReplicationConfig.ENV_SETUP_TIMEOUT,
209          null,                          // min
210          null,                          // max
211          "10 h",                        // default 10 hrs
212          false,                         // mutable
213          true);
214 
215     /**
216      * @see ReplicationConfig#ENV_CONSISTENCY_TIMEOUT
217      */
218     public static final DurationConfigParam
219         ENV_CONSISTENCY_TIMEOUT =
220             new DurationConfigParam(ReplicationConfig.ENV_CONSISTENCY_TIMEOUT,
221                                     "10 ms",                      // min
222                                     null,                         // max
223                                     "5 min",                      // default
224                                     false,                        // mutable
225                                     true);
226 
227     /**
228      * @see ReplicationConfig#ENV_UNKNOWN_STATE_TIMEOUT
229      */
230     public static final DurationConfigParam ENV_UNKNOWN_STATE_TIMEOUT =
231         new DurationConfigParam
232         (ReplicationConfig.ENV_UNKNOWN_STATE_TIMEOUT,
233          null,                          // min
234          null,                          // max
235          "0 s",                         // default
236          false,                         // mutable
237          true);
238 
239     /**
240      * @see ReplicationConfig#REPLICA_ACK_TIMEOUT
241      */
242     public static final DurationConfigParam REPLICA_ACK_TIMEOUT =
243         new DurationConfigParam(ReplicationConfig.REPLICA_ACK_TIMEOUT,
244                                 "10 ms",                     // min
245                                 null,                        // max
246                                 "5 s",                       // default
247                                 false,                       // mutable
248                                 true);                       // forReplication
249 
250     /**
251      * @see ReplicationConfig#INSUFFICIENT_REPLICAS_TIMEOUT
252      */
253     public static final DurationConfigParam INSUFFICIENT_REPLICAS_TIMEOUT =
254         new DurationConfigParam(ReplicationConfig.INSUFFICIENT_REPLICAS_TIMEOUT,
255                                 "10 ms",                     // min
256                                 null,                        // max
257                                 "10 s",                       // default
258                                 false,                       // mutable
259                                 true);                       // forReplication
260 
261     /**
262      * Internal parameter enable use of the group ack message. It's off by
263      * default for now until we get to a release in which we can change the HA
264      * protocol version number.
265      */
266     public static final BooleanConfigParam ENABLE_GROUP_ACKS  =
267         new BooleanConfigParam(EnvironmentParams.REP_PARAM_PREFIX +
268                                "enableGroupAcks",
269                                false,            // default
270                                false,            // mutable
271                                true);
272     /**
273      * The maximum message size which will be accepted by a node (to prevent
274      * DOS attacks).  While the default shown here is 0, it dynamically
275      * calculated when the node is created and is set to the half of the
276      * environment cache size. The cache size is mutable, but changing the
277      * cache size at run time (after environment initialization) will not
278      * change the value of this parameter.  If a value other than cache size /
279      * 2 is desired, this non-mutable parameter should be specified at
280      * initialization time.
281      */
282     public static final LongConfigParam MAX_MESSAGE_SIZE =
283         new LongConfigParam(ReplicationConfig.MAX_MESSAGE_SIZE,
284                             Long.valueOf(1 << 18),        // min (256KB)
285                             Long.valueOf(Long.MAX_VALUE), // max
286                             Long.valueOf(0),         // default (cachesize / 2)
287                             false,                   // mutable
288                             true);                   // forReplication
289 
290     /**
291      * Identifies the default consistency policy used by a replica. Only two
292      * policies are meaningful as properties denoting environment level default
293      * policies: NoConsistencyRequiredPolicy and TimeConsistencyPolicy.  They
294      * can be specified as: NoConsistencyRequiredPolicy or
295      * TimeConsistencyPolicy(<permissibleLag>,<timeout>). For example, a time
296      * based consistency policy with a lag of 1 second and a timeout of 1 hour
297      * is denoted by the string: TimeConsistencyPolicy(1000,3600000)
298      */
299     public static final ConfigParam CONSISTENCY_POLICY =
300         new ConfigParam(ReplicationConfig.CONSISTENCY_POLICY,
301                         // Default lag of 1 sec, and timeout of 1 hour
302                         "TimeConsistencyPolicy(1 s,1 h)",
303                         false,                   // mutable
304                         true) {                  // for Replication
305         @Override
306         public void validateValue(String propertyValue)
307             throws IllegalArgumentException {
308 
309             /* Evaluate for the checking side-effect. */
310             RepUtils.getReplicaConsistencyPolicy(propertyValue);
311         }
312     };
313 
314     /* The ports used by a replication group */
315 
316     /**
317      * The port used for replication.
318      */
319     public static final IntConfigParam DEFAULT_PORT =
320         new IntConfigParam(ReplicationConfig.DEFAULT_PORT,
321                            Integer.valueOf(1024),   // min
322                            Integer.valueOf(Short.MAX_VALUE), // max
323                            Integer.valueOf(5001),   // default
324                            false,                   // mutable
325                            true);                   // forReplication
326 
327     /**
328      * Names the host (or interface) and port associated with the node in the
329      * replication group, e.g. je.rep.nodeHostPort=foo.com:5001
330      */
331     public static final ConfigParam NODE_HOST_PORT =
332         new ConfigParam(ReplicationConfig.NODE_HOST_PORT,
333                         "localhost",         // default
334                         false,               // mutable
335                         true) {              // forReplication
336 
337         @Override
338         public void validateValue(String hostAndPort)
339             throws IllegalArgumentException {
340 
341             if ((hostAndPort == null) || (hostAndPort.length() == 0)) {
342                 throw new IllegalArgumentException
343                     ("The value cannot be null or zero length: " + name);
344             }
345             int colonToken = hostAndPort.indexOf(":");
346             String hostName = (colonToken >= 0) ?
347                                hostAndPort.substring(0,colonToken) :
348                                hostAndPort;
349             ServerSocket testSocket = null;
350             try {
351                 testSocket = new ServerSocket();
352                 /* The bind will fail if the hostName does not name this m/c.*/
353                 testSocket.bind(new InetSocketAddress(hostName, 0));
354                 testSocket.close();
355             } catch (UnknownHostException e) {
356                 throw new IllegalArgumentException
357                     ("Property: " + name +
358                      " Invalid hostname: " + hostName, e);
359             } catch (IOException e) {
360 
361                 /*
362                  * Server socket could not be bound to any port. Hostname is
363                  * not associated with this m/c.
364                  */
365                 throw new IllegalArgumentException
366                     ("Property: " + name +
367                      " Invalid hostname: " + hostName, e);
368             }
369 
370             if (colonToken >= 0) {
371                 validatePort(hostAndPort.substring(colonToken+1));
372             }
373         }
374     };
375 
376     /*
377      * The Name uniquely identifies this node within the replication group.
378      */
379     public static final ConfigParam NODE_NAME =
380         new IdentifierConfigParam(ReplicationConfig.NODE_NAME,
381                                   "DefaultRepNodeName",// default
382                                   false,               // mutable
383                                   true);               // forReplication
384 
385     /*
386      * Identifies the type of the node.
387      */
388     public static final EnumConfigParam<NodeType> NODE_TYPE =
389         new EnumConfigParam<NodeType>(ReplicationConfig.NODE_TYPE,
390                                       NodeType.ELECTABLE,         // default
391                                       false,                      // mutable
392                                       true,
393                                       NodeType.class);
394 
395     /*
396      * Associated a priority with this node. The priority is used during
397      * elections to favor one node over another. All other considerations being
398      * equal, the priority is used as a tie-breaker; the node with the higher
399      * priority is selected as the master.
400      */
401     public static final IntConfigParam NODE_PRIORITY =
402         new IntConfigParam(ReplicationMutableConfig.NODE_PRIORITY,
403                            Integer.valueOf(0),   // min
404                            Integer.valueOf(Integer.MAX_VALUE), // max
405                            Integer.valueOf(1),   // default
406                            true,                 // mutable
407                            true);                // forReplication
408 
409     /*
410      * Identifies the Primary node in a two node group.
411      */
412     public static final BooleanConfigParam DESIGNATED_PRIMARY  =
413         new BooleanConfigParam(ReplicationMutableConfig.DESIGNATED_PRIMARY,
414                                false,           // default
415                                true,            // mutable
416                                true);
417 
418 
419     /*
420      * An internal option used to control the use of Nagle's algorithm
421      * on feeder connections. A value of true disables use of Nagle's algorithm
422      * and causes output to be sent immediately without delay.
423      */
424     public static final BooleanConfigParam FEEDER_TCP_NO_DELAY  =
425             new BooleanConfigParam(EnvironmentParams.REP_PARAM_PREFIX +
426                                    "feederTcpNoDelay",
427                                    true,              // default
428                                    false,            // mutable
429                                    true);
430 
431     /**
432      * The time interval in nanoseconds during which records from a feeder may
433      * be batched before being written to the network.
434      *
435      * Larger values can result in fewer network packets and lower interrupt
436      * processing overheads. Since the grouping is only done when the feeder
437      * knows that the replica is not completely in sync, it's unlikely to have
438      * an adverse impact on overall throughput. Consequently this parameter is
439      * retained as an internal tuning knob.
440      *
441      * The HEARTBEAT_INTERVAL parameter serves as a ceiling on this time
442      * interval. Parameter values larger than HEARTBEAT_INTERVAL are truncated
443      * to HEARTBEAT_INTERVAL.
444      */
445     public static final IntConfigParam FEEDER_BATCH_NS =
446         new IntConfigParam(EnvironmentParams.REP_PARAM_PREFIX +
447                            "feederBatchNs",
448                            Integer.valueOf(0),                // min
449                            Integer.valueOf(Integer.MAX_VALUE),// max
450                            Integer.valueOf(1000000),           // default 1 ms
451                            true,                              // mutable
452                            true);                             // forReplication
453 
454     /**
455      * The size in KB used to batch outgoing feeder records. Upon overflow the
456      * existing buffer contents are written to the network and a new batch is
457      * initiated. The default value is 64K to take advantage of networks that
458      * support jumbo frames.
459      */
460     public static final IntConfigParam FEEDER_BATCH_BUFF_KB =
461         new IntConfigParam(EnvironmentParams.REP_PARAM_PREFIX +
462                            "feederBatchBuffKb",
463                            Integer.valueOf(4),                // min
464                            Integer.valueOf(Integer.MAX_VALUE),// max
465                            Integer.valueOf(64),               // default 64K
466                            true,                              // mutable
467                            true);                             // forReplication
468 
469     /**
470      * @see ReplicationMutableConfig#ELECTABLE_GROUP_SIZE_OVERRIDE
471      */
472     public static final IntConfigParam ELECTABLE_GROUP_SIZE_OVERRIDE =
473         new IntConfigParam(ReplicationMutableConfig.
474                            ELECTABLE_GROUP_SIZE_OVERRIDE,
475                            Integer.valueOf(0),                // min
476                            Integer.valueOf(Integer.MAX_VALUE),// max
477                            Integer.valueOf(0),                // default
478                            true,                              // mutable
479                            true);                             // forReplication
480 
481     /**
482      * An internal option, accessed only via the utility
483      * {@link DbResetRepGroup} utility, to reset a replication group to a
484      * single new member when the replicated environment is opened.
485      */
486     public static final BooleanConfigParam RESET_REP_GROUP  =
487         new BooleanConfigParam(EnvironmentParams.REP_PARAM_PREFIX +
488                                "resetRepGroup",
489                                false,            // default
490                                false,            // mutable
491                                true);
492 
493     /**
494      * An internal option, used with {@link #RESET_REP_GROUP}, that causes the
495      * reset of the replication group to retain the original group UUID and to
496      * not truncate the VLSN index.  Use this option when converting a
497      * SECONDARY node to an ELECTABLE node when recovering a replication group.
498      */
499     public static final BooleanConfigParam RESET_REP_GROUP_RETAIN_UUID =
500         new BooleanConfigParam(EnvironmentParams.REP_PARAM_PREFIX +
501                                "resetRepGroupRetainUUID",
502                                false,            // default
503                                false,            // mutable
504                                true);
505 
506     /**
507      * An internal option to allow converting an ELECTABLE node to a SECONDARY
508      * node by ignoring the electable node ID stored in the local rep group
509      * DB.
510      */
511     public static final BooleanConfigParam IGNORE_SECONDARY_NODE_ID =
512         new BooleanConfigParam(EnvironmentParams.REP_PARAM_PREFIX +
513                                "ignoreSecondaryNodeId",
514                                false,            // default
515                                false,            // mutable
516                                true);
517 
518     /*
519      * Sets the maximum allowable skew between a Feeder and its replica. The
520      * clock skew is checked as part of the handshake when the Replica
521      * establishes a connection to its Feeder.
522      */
523     public static final DurationConfigParam MAX_CLOCK_DELTA =
524         new DurationConfigParam(ReplicationConfig.MAX_CLOCK_DELTA,
525                                 null,               // min
526                                 "1 min",            // max
527                                 "2 s",              // default
528                                 false,              // mutable
529                                 true);              // forReplication
530 
531     /*
532      * The list of helper node and port pairs.
533      */
534     public static final ConfigParam HELPER_HOSTS =
535         new ConfigParam(ReplicationConfig.HELPER_HOSTS,
536                         "",                  // default
537                         true,                // mutable
538                         true) {              // forReplication
539 
540         @Override
541         public void validateValue(String hostPortPairs)
542             throws IllegalArgumentException {
543 
544             if ((hostPortPairs == null) || (hostPortPairs.length() == 0)) {
545                 return;
546             }
547             HashSet<String> hostPortSet = new HashSet<String>();
548             for (StringTokenizer tokenizer =
549                  new StringTokenizer(hostPortPairs,",");
550                  tokenizer.hasMoreTokens();) {
551                 try {
552                     String hostPortPair = tokenizer.nextToken();
553                     if (!hostPortSet.add(hostPortPair)) {
554                         throw new IllegalArgumentException
555                             ("Property: " + name +
556                              " Duplicate specification: " + hostPortPair);
557                     }
558                     validateHostAndPort(hostPortPair);
559                 } catch (IllegalArgumentException iae) {
560                     throw new IllegalArgumentException
561                         ("Property: " + name + "Error: " + iae.getMessage(),
562                          iae);
563                 }
564             }
565         }
566     };
567 
568     /* Heartbeat interval in milliseconds. */
569     public static final IntConfigParam HEARTBEAT_INTERVAL =
570         new IntConfigParam
571         (EnvironmentParams.REP_PARAM_PREFIX + "heartbeatInterval",
572          Integer.valueOf(1000),// min
573          null,                 // max
574          Integer.valueOf(1000),// default
575          false,                // mutable
576          true);                // forReplication
577 
578     /* Replay Op Count after which we clear the DbTree cache. */
579     public static final IntConfigParam DBTREE_CACHE_CLEAR_COUNT =
580         new IntConfigParam
581         (EnvironmentParams.REP_PARAM_PREFIX + "dbIdCacheOpCount",
582          Integer.valueOf(1),    // min
583          null,                  // max
584          Integer.valueOf(5000), // default
585          false,                 // mutable
586          true);                 // forReplication
587 
588     public static final IntConfigParam VLSN_STRIDE =
589         new IntConfigParam(EnvironmentParams.REP_PARAM_PREFIX + "vlsn.stride",
590                            Integer.valueOf(1),     // min
591                            null,                   // max
592                            Integer.valueOf(10),    // default
593                            false,                  // mutable
594                            true);                  // forReplication
595 
596     public static final IntConfigParam VLSN_MAX_MAP =
597         new IntConfigParam
598         (EnvironmentParams.REP_PARAM_PREFIX + "vlsn.mappings",
599          Integer.valueOf(1),      // min
600          null,                    // max
601          Integer.valueOf(1000),   // default
602          false,                   // mutable
603          true);                   // forReplication
604 
605     public static final IntConfigParam VLSN_MAX_DIST =
606         new IntConfigParam
607         (EnvironmentParams.REP_PARAM_PREFIX + "vlsn.distance",
608          Integer.valueOf(1),      // min
609          null,                    // max
610          Integer.valueOf(100000), // default
611          false,                   // mutable
612          true);                   // forReplication
613 
614     /*
615      * Internal testing use only: Simulate a delay in the replica loop for test
616      * purposes. The value is the delay in milliseconds.
617      */
618     public static final IntConfigParam TEST_REPLICA_DELAY =
619         new IntConfigParam
620         (EnvironmentParams.REP_PARAM_PREFIX + "test.replicaDelay",
621          Integer.valueOf(0), // min
622          Integer.valueOf(Integer.MAX_VALUE), // max
623          Integer.valueOf(0), // default
624          false,              // mutable
625          true);              // forReplication
626 
627     /*
628      * Sets the VLSNIndex cache holding recent log items in support of the
629      * feeders. The size must be a power of two.
630      */
631     public static final IntConfigParam VLSN_LOG_CACHE_SIZE =
632         new IntConfigParam
633         (EnvironmentParams.REP_PARAM_PREFIX + "vlsn.logCacheSize",
634          Integer.valueOf(0),      // min
635          Integer.valueOf(1<<10),  // max
636          Integer.valueOf(32),     // default
637          false,                   // mutable
638          true);                   // forReplication
639 
640     /*
641      * The socket timeout value used by a Replica when it opens a new
642      * connection to establish a replication stream with a feeder.
643      */
644     public static final DurationConfigParam REPSTREAM_OPEN_TIMEOUT =
645         new DurationConfigParam
646         (EnvironmentParams.REP_PARAM_PREFIX + "repstreamOpenTimeout",
647          null,               // min
648          "5 min",            // max
649          "5 s",              // default
650          false,              // mutable
651          true);              // forReplication
652 
653     /*
654      * The socket timeout value used by Elections agents when they open
655      * sockets to communicate with each other using the Elections protocol.
656      */
657     public static final DurationConfigParam ELECTIONS_OPEN_TIMEOUT =
658         new DurationConfigParam
659         (EnvironmentParams.REP_PARAM_PREFIX + "electionsOpenTimeout",
660          null,               // min
661          "1 min",            // max
662          "10 s",             // default
663          false,              // mutable
664          true);              // forReplication
665 
666     /*
667      * The maximum amount of time a Learner or Acceptor agent will wait for
668      * input on a network connection, while listening for a message before
669      * timing out. This timeout applies to the Elections protocol.
670      */
671     public static final DurationConfigParam ELECTIONS_READ_TIMEOUT =
672         new DurationConfigParam
673         (EnvironmentParams.REP_PARAM_PREFIX + "electionsReadTimeout",
674          null,               // min
675          "1 min",            // max
676          "10 s",             // default
677          false,              // mutable
678          true);              // forReplication
679 
680     /**
681      * The master re-broadcasts the results of an election with this period.
682      */
683     public static final DurationConfigParam
684         ELECTIONS_REBROADCAST_PERIOD =
685         new DurationConfigParam
686         (ReplicationConfig.ELECTIONS_REBROADCAST_PERIOD,
687          null,               // min
688          null,               // max
689          "1 min",            // default
690          false,              // mutable
691          true);
692 
693     /**
694      * @see ReplicationConfig#ELECTIONS_PRIMARY_RETRIES
695      */
696     public static final IntConfigParam ELECTIONS_PRIMARY_RETRIES =
697         new IntConfigParam(ReplicationConfig.ELECTIONS_PRIMARY_RETRIES,
698                            0,
699                            Integer.MAX_VALUE,
700                            2,
701                            false,
702                            true);
703 
704     /*
705      * Socket open timeout for use with the RepGroupProtocol.
706      */
707     public static final DurationConfigParam REP_GROUP_OPEN_TIMEOUT =
708         new DurationConfigParam
709         (EnvironmentParams.REP_PARAM_PREFIX + "repGroupOpenTimeout",
710          null,               // min
711          "1 min",            // max
712          "10 s",             // default
713          false,              // mutable
714          true);              // forReplication
715 
716     /*
717      * Socket read timeout for use with the RepGroupProtocol.
718      */
719     public static final DurationConfigParam REP_GROUP_READ_TIMEOUT =
720         new DurationConfigParam
721         (EnvironmentParams.REP_PARAM_PREFIX + "repGroupReadTimeout",
722          null,               // min
723          "1 min",            // max
724          "10 s",             // default
725          false,              // mutable
726          true);              // forReplication
727 
728     /*
729      * Socket open timeout for use with the Monitor Protocol.
730      */
731     public static final DurationConfigParam MONITOR_OPEN_TIMEOUT =
732         new DurationConfigParam
733         (EnvironmentParams.REP_PARAM_PREFIX + "monitorOpenTimeout",
734          null,               // min
735          "1 min",            // max
736          "10 s",             // default
737          false,              // mutable
738          true);              // forReplication
739 
740     /*
741      * Socket read timeout for use with the MonitorProtocol.
742      */
743     public static final DurationConfigParam MONITOR_READ_TIMEOUT =
744         new DurationConfigParam
745         (EnvironmentParams.REP_PARAM_PREFIX + "monitorReadTimeout",
746          null,               // min
747          "1 min",            // max
748          "10 s",             // default
749          false,              // mutable
750          true);              // forReplication
751 
752     /**
753      * @see ReplicationConfig#REPLICA_TIMEOUT
754      */
755     public static final  DurationConfigParam REPLICA_TIMEOUT =
756         new DurationConfigParam(ReplicationConfig.REPLICA_TIMEOUT,
757                            "2 s", // min
758                            null, // max
759                            "30 s", // default
760                            false,              // mutable
761                            true);              // forReplication
762 
763     /* @see ReplicationConfig#REPLAY_MAX_OPEN_DB_HANDLES */
764     public static final IntConfigParam REPLAY_MAX_OPEN_DB_HANDLES =
765         new IntConfigParam(ReplicationMutableConfig.REPLAY_MAX_OPEN_DB_HANDLES,
766                            Integer.valueOf(1), // min
767                            Integer.valueOf(Integer.MAX_VALUE), // max
768                            Integer.valueOf(10), // default
769                            true,               // mutable
770                            true);              // forReplication
771 
772     /* @see ReplicationConfig#REPLAY_DB_HANDLE_TIMEOUT */
773     public static final DurationConfigParam REPLAY_DB_HANDLE_TIMEOUT =
774         new DurationConfigParam(ReplicationConfig.REPLAY_DB_HANDLE_TIMEOUT,
775                                 "1 s",              // min
776                                 null,               // max
777                                 "30 s",             // default
778                                 true,              // mutable
779                                 true);              // forReplication
780 
781     /* @see ReplicationConfig#REPLICA_MAX_GROUP_COMMIT */
782     public static final IntConfigParam REPLICA_MAX_GROUP_COMMIT =
783         new IntConfigParam(ReplicationConfig.REPLICA_MAX_GROUP_COMMIT,
784                            Integer.valueOf(0),      // min
785                            null,                    // max
786                            Integer.valueOf(200),    // default
787                            false,                   // mutable
788                            true);                   // forReplication
789 
790     /* @see ReplicationConfig#REPLICA_GROUP_COMMIT_INTERVAL */
791     public static final DurationConfigParam REPLICA_GROUP_COMMIT_INTERVAL =
792         new DurationConfigParam(ReplicationConfig.REPLICA_GROUP_COMMIT_INTERVAL,
793                                 "0 ms",             // min
794                                 null,               // max
795                                 "3 ms",             // default
796                                 false,              // mutable
797                                 true);              // forReplication
798 
799     /*
800      * The number of heartbeat responses that must be detected as missing
801      * during an otherwise idle period before the Feeder shuts down the
802      * connection with the Replica.
803      *
804      * This value provides the basis for the "read timeout" used by the Feeder
805      * when communicating with the Replica. The timeout is calculated as
806      * FEEDER_HEARTBEAT_TIMEOUT * HEARTBEAT_INTERVAL. Upon a timeout the Feeder
807      * closes the connection.
808      *
809      * Reducing this value permits the master to discover failed Replicas
810      * faster. However, it increases the chances of false positives as well, if
811      * the network is experiencing transient problems from which it might
812      * just recover.
813      */
814     public static final IntConfigParam FEEDER_HEARTBEAT_TIMEOUT =
815         new IntConfigParam
816         (EnvironmentParams.REP_PARAM_PREFIX + "feederHeartbeatTrigger",
817          Integer.valueOf(0), // min
818          Integer.valueOf(Integer.MAX_VALUE), // max
819          Integer.valueOf(4), // default
820          false,              // mutable
821          true);
822 
823 
824     /**
825      * Used to force setting of SO_REUSEADDR to true on the HA server socket
826      * when it binds to its port.
827      *
828      * Note that the default is false, meaning that the socket has the
829      * system-specific default setting associated with it. We set it to true
830      * primarily in unit tests where the interacting HA processes are all on
831      * the same machine and use of this option is safe.
832      *
833      * This option is currently intended just for internal test use.
834      */
835     public static final BooleanConfigParam SO_REUSEADDR =
836         new BooleanConfigParam
837         (EnvironmentParams.REP_PARAM_PREFIX + "soReuseAddr",
838          false,             // default
839          false,             // mutable
840          true);
841 
842     /**
843      * This option was motivated by the BDA. The BDA uses IB for intra-rack
844      * node communications and 10gigE for inter-rack node communications. DNS
845      * is used to map the hostname to different IP addresses depending on
846      * whether the hostname was resolved from within the rack or outside it.
847      * The host thus gets HA traffic on both the IB and 10gigE interfaces and
848      * therefore needs to listen on both interfaces. It does so binding its
849      * socket using a wild card address when this option iks turned on.
850      *
851      * @see ReplicationConfig#BIND_INADDR_ANY
852      */
853     public static final BooleanConfigParam BIND_INADDR_ANY =
854         new BooleanConfigParam
855         (ReplicationConfig.BIND_INADDR_ANY,
856          false,             // default
857          false,             // mutable
858          true);
859 
860     /**
861      * Determines how long to wait for a bound socket to come free. This option
862      * can be useful when dealing with sockets in the TIME_WAIT state to come
863      * free so they can be reused. Attempts are made to retry binding to this
864      * period at intervals of 1 second until the port is bound successfully, or
865      * this wait period is exceeded.
866      *
867      * A value of zero means that there are no retries. It does not make sense
868      * to wait too much longer than the 2 min TIME_WAIT period, but we allow
869      * waiting as long as 2.5 min to account for race conditions.
870      *
871      * This option is currently intended just for internal test use.
872      */
873     public static final IntConfigParam SO_BIND_WAIT_MS =
874         new IntConfigParam
875         (EnvironmentParams.REP_PARAM_PREFIX + "retrySocketBind",
876          Integer.valueOf(0), // min
877          Integer.valueOf(150 * 1000), // max
878          Integer.valueOf(0), // default
879          false,              // mutable
880          true);
881 
882     /**
883      * @see ReplicationConfig#FEEDER_TIMEOUT
884      */
885     public static final DurationConfigParam FEEDER_TIMEOUT =
886         new DurationConfigParam(ReplicationConfig.FEEDER_TIMEOUT,
887                                 "2 s", // min
888                                 null, // max
889                                 "30 s", // default
890                                 false,              // mutable
891                                 true);              // forReplication
892 
893     /**
894      * Used to log an info message when a commit log record exceeds this
895      * time interval from the time it was created, to the time it was written
896      * out to the network.
897      */
898     public static final DurationConfigParam TRANSFER_LOGGING_THRESHOLD =
899         new DurationConfigParam
900         (EnvironmentParams.REP_PARAM_PREFIX + "transferLoggingThreshold",
901          "1 ms",              // min
902          null,               // max
903          "5 s",              // default
904          false,              // mutable
905          true);              // forReplication
906 
907     /**
908      * Used to log an info message when the time taken to replay a single log
909      * entry at a replica exceeds this threshold.
910      */
911     public static final DurationConfigParam REPLAY_LOGGING_THRESHOLD =
912         new DurationConfigParam
913         (EnvironmentParams.REP_PARAM_PREFIX + "replayLoggingThreshold",
914          "1 ms",             // min
915          null,               // max
916          "5 s",              // default
917          false,              // mutable
918          true);              // forReplication
919 
920 
921     /**
922      * Changes the notion of an ack. When set to true, a replica is considered
923      * to have acknowledged a commit as soon as the feeder has written the
924      * commit record to the network. That is, it does not wait for the replica
925      * to actually acknowledge the commit via a return message. This permits
926      * the master to operate in a more async manner relative to the replica
927      * provide for higher throughput.
928      *
929      * This config parameter is internal.
930      */
931     public static final BooleanConfigParam COMMIT_TO_NETWORK =
932         new BooleanConfigParam
933         (EnvironmentParams.REP_PARAM_PREFIX + "commitToNetwork",
934          false,            // default
935          false,             // mutable
936          true);
937 
938 
939     public static final DurationConfigParam PRE_HEARTBEAT_TIMEOUT =
940         new DurationConfigParam
941         (EnvironmentParams.REP_PARAM_PREFIX + "preHeartbeatTimeoutMs",
942          "1 s", // min
943          null, // max
944          "60 s", // default
945          false,              // mutable
946          true);
947 
948     /**
949      * Verifies that the port is a reasonable number. The port must be outside
950      * the range of "Well Known Ports" (zero through 1024).
951      *
952      * @param portString the string representing the port.
953      */
validatePort(String portString)954     private static void validatePort(String portString)
955         throws IllegalArgumentException {
956 
957         try {
958             int port = Integer.parseInt(portString);
959 
960             if ((port <= 0) || (port > 0xffff)) {
961                 throw new IllegalArgumentException
962                     ("Invalid port number: " + portString);
963             }
964             if (port <= 1023) {
965                 throw new IllegalArgumentException
966                     ("Port number " + port +
967                      " is invalid because the port must be outside the range of \"well known\" ports");
968             }
969         } catch (NumberFormatException e) {
970             throw new IllegalArgumentException
971                 ("Invalid port number: " + portString);
972         }
973     }
974 
975     /**
976      * Validates that the hostPort is a string of the form:
977      *
978      * hostName[:port]
979      *
980      * @param hostAndPort
981      * @throws IllegalArgumentException
982      */
validateHostAndPort(String hostAndPort)983     private static void validateHostAndPort(String hostAndPort)
984         throws IllegalArgumentException {
985 
986         int colonToken = hostAndPort.indexOf(":");
987         String hostName = (colonToken >= 0) ?
988             hostAndPort.substring(0,colonToken) :
989             hostAndPort;
990         if ("".equals(hostName)) {
991             throw new IllegalArgumentException("missing hostname");
992         }
993         try {
994             InetAddress.getByName(hostName);
995         } catch (UnknownHostException e) {
996             throw new IllegalArgumentException
997                 ("Invalid hostname: " + e.getMessage());
998         }
999         if (colonToken >= 0) {
1000             validatePort(hostAndPort.substring(colonToken+1));
1001         }
1002     }
1003 
1004     /**
1005      * @see ReplicationConfig#TXN_ROLLBACK_LIMIT
1006      */
1007     public static final IntConfigParam TXN_ROLLBACK_LIMIT =
1008         new IntConfigParam(ReplicationConfig.
1009                            TXN_ROLLBACK_LIMIT,
1010                            Integer.valueOf(0),                // min
1011                            Integer.valueOf(Integer.MAX_VALUE),// max
1012                            Integer.valueOf(10),               // default
1013                            false,                             // mutable
1014                            true);                             // forReplication
1015 
1016     /**
1017      * @see ReplicationConfig#RUN_LOG_FLUSH_TASK
1018      */
1019     public static final BooleanConfigParam RUN_LOG_FLUSH_TASK  =
1020         new BooleanConfigParam(ReplicationMutableConfig.RUN_LOG_FLUSH_TASK,
1021                                true,             // default
1022                                true,             // mutable
1023                                true);            // forReplication
1024 
1025     /**
1026      * @see ReplicationConfig#LOG_FLUSH_TASK_INTERVAL
1027      */
1028     public static final DurationConfigParam LOG_FLUSH_TASK_INTERVAL =
1029         new DurationConfigParam
1030         (ReplicationMutableConfig.LOG_FLUSH_TASK_INTERVAL,
1031          "1 s",           // min
1032          null,            // max
1033          "5 min",         // default
1034          true,            // mutable
1035          true);           // forReplication
1036 
1037     /**
1038      * @see ReplicationConfig#ALLOW_UNKNOWN_STATE_ENV_OPEN
1039      */
1040     @SuppressWarnings({ "javadoc", "deprecation" })
1041     public static final BooleanConfigParam ALLOW_UNKNOWN_STATE_ENV_OPEN =
1042         new BooleanConfigParam(ReplicationConfig.ALLOW_UNKNOWN_STATE_ENV_OPEN,
1043                                false,           // default
1044                                false,           // mutable
1045                                true);
1046 
1047     /**
1048      * If true, the replica runs with this property will not join the
1049      * replication group.
1050      */
1051     public static final BooleanConfigParam DONT_JOIN_REP_GROUP =
1052         new BooleanConfigParam(EnvironmentParams.REP_PARAM_PREFIX +
1053                                "dontJoinRepGroup",
1054                                false,
1055                                false,
1056                                true);
1057 
1058     /**
1059      * Internal parameter to preserve record version (VLSN).  Is immutable
1060      * forever, i.e., it may not be changed after the environment has been
1061      * created.  It has the following impacts:
1062      *
1063      * . The VLSN is stored with the LN in the Btree and is available via the
1064      *   CursorImpl API.
1065      * . The VLSN is included when migrating an LN during log cleaning.
1066      *
1067      * FUTURE: Expose this in ReplicationConfig and improve doc if we make
1068      * record versions part of the public API.
1069      */
1070     public static final BooleanConfigParam PRESERVE_RECORD_VERSION =
1071         new BooleanConfigParam(EnvironmentParams.REP_PARAM_PREFIX +
1072                                "preserveRecordVersion",
1073                                false,         // default
1074                                false,         // mutable
1075                                true);         // forReplication
1076 
1077     /**
1078      * Whether to cache the VLSN in the BIN after the LN has been stripped by
1079      * eviction, unless caching is explicitly disabled using the
1080      * CACHE_RECORD_VERSION setting.
1081      *
1082      * This setting has no impact if PRESERVE_RECORD_VERSION is not also
1083      * enabled.
1084      *
1085      * FUTURE: Expose this in ReplicationConfig and improve doc if we make
1086      * record versions part of the public API.
1087      */
1088     public static final BooleanConfigParam CACHE_RECORD_VERSION =
1089         new BooleanConfigParam(EnvironmentParams.REP_PARAM_PREFIX +
1090                                "cacheRecordVersion",
1091                                true,          // default
1092                                false,         // mutable
1093                                true);         // forReplication
1094 
1095     /**
1096      * The initial number of bytes per record version (per VLSN sequence) in
1097      * the record version cache.  The default value, 5, is appropriate for data
1098      * set sizes roughly from 1 to 100 billion.  A smaller value may be
1099      * configured to save memory for smaller data sets.  A larger value may be
1100      * configured to avoid mutation of the cache as the data set grows.
1101      *
1102      * This setting has no impact unless CACHE_RECORD_VERSION and
1103      * PRESERVE_RECORD_VERSION are not also enabled.
1104      *
1105      * FUTURE: Expose this in ReplicationConfig and improve doc if we make
1106      * record versions part of the public API.
1107      */
1108     public static final IntConfigParam CACHED_RECORD_VERSION_MIN_LENGTH =
1109         new IntConfigParam(EnvironmentParams.REP_PARAM_PREFIX +
1110                            "cachedRecordVersionMinLength",
1111                            Integer.valueOf(1), // min
1112                            Integer.valueOf(8), // max
1113                            Integer.valueOf(5), // default
1114                            false,              // mutable
1115                            true);              // forReplication
1116 
1117     /**
1118      * @see ReplicationConfig#PROTOCOL_OLD_STRING_ENCODING
1119      * TODO: Change default to false in JE 5.1.
1120      */
1121     public static final BooleanConfigParam PROTOCOL_OLD_STRING_ENCODING =
1122         new BooleanConfigParam(ReplicationConfig.PROTOCOL_OLD_STRING_ENCODING,
1123                                true,          // default
1124                                false,         // mutable
1125                                true);         // forReplication
1126 
1127     /**
1128      * A JE/HA configuration parameter specifying a data channel type
1129      */
1130     static public class ChannelTypeConfigParam extends ConfigParam {
1131         public static final String BASIC = "basic";
1132         public static final String SSL = "ssl";
1133         public static final String CUSTOM = "custom";
1134 
1135         private static final String DEBUG_NAME =
1136             ChannelTypeConfigParam.class.getName();
1137 
ChannelTypeConfigParam(String configName, String defaultValue, boolean mutable, boolean forReplication)1138         public ChannelTypeConfigParam(String configName,
1139                                       String defaultValue,
1140                                       boolean mutable,
1141                                       boolean forReplication) {
1142             super(configName, defaultValue, mutable, forReplication);
1143         }
1144 
1145         @Override
validateValue(String value)1146         public void validateValue(String value) {
1147             if (value == null) {
1148                 throw new IllegalArgumentException
1149                     (DEBUG_NAME + ": a value is required");
1150             }
1151             if (!(BASIC.equals(value) ||
1152                   SSL.equals(value) ||
1153                   CUSTOM.equals(value))) {
1154                 throw new IllegalArgumentException
1155                     (DEBUG_NAME + ": " + value + " a not a valid value");
1156             }
1157         }
1158     }
1159 
1160     /**
1161      * Replication data channel factory configuration
1162      * @see ReplicationNetworkConfig#CHANNEL_TYPE
1163      */
1164     public static final ConfigParam CHANNEL_TYPE =
1165         new ChannelTypeConfigParam(
1166             ReplicationNetworkConfig.CHANNEL_TYPE,
1167             ChannelTypeConfigParam.BASIC,  // default
1168             false,                         // mutable
1169             true);                         // forReplication
1170 
1171     /**
1172      * Replication data channel logging identifier.
1173      * @see ReplicationNetworkConfig#CHANNEL_LOG_NAME
1174      */
1175     public static final ConfigParam CHANNEL_LOG_NAME =
1176         new ConfigParam(
1177             ReplicationNetworkConfig.CHANNEL_LOG_NAME,
1178             "",                            // default
1179             false,                         // mutable
1180             true);                         // forReplication
1181 
1182     /**
1183      * Data channel factory class
1184      * @see ReplicationNetworkConfig#CHANNEL_FACTORY_CLASS
1185      */
1186     public static final ConfigParam CHANNEL_FACTORY_CLASS =
1187         new ConfigParam(ReplicationNetworkConfig.CHANNEL_FACTORY_CLASS,
1188                         "",                  // default
1189                         false,               // mutable
1190                         true);               // forReplication
1191 
1192     /**
1193      * Data channel factory parameters
1194      * @see ReplicationNetworkConfig#CHANNEL_FACTORY_PARAMS
1195      */
1196     public static final ConfigParam CHANNEL_FACTORY_PARAMS =
1197         new ConfigParam(ReplicationNetworkConfig.CHANNEL_FACTORY_PARAMS,
1198                         "",                  // default
1199                         false,               // mutable
1200                         true);               // forReplication
1201 
1202     /**
1203      * SSL KeyStore file
1204      * @see ReplicationSSLConfig#SSL_KEYSTORE_FILE
1205      */
1206     public static final ConfigParam SSL_KEYSTORE_FILE =
1207         new ConfigParam(ReplicationSSLConfig.SSL_KEYSTORE_FILE,
1208                         "",                  // default
1209                         false,               // mutable
1210                         true);               // forReplication
1211 
1212     /**
1213      * SSL KeyStore password
1214      * @see ReplicationSSLConfig#SSL_KEYSTORE_PASSWORD
1215      */
1216     public static final ConfigParam SSL_KEYSTORE_PASSWORD =
1217         new ConfigParam(ReplicationSSLConfig.SSL_KEYSTORE_PASSWORD,
1218                         "",                  // default
1219                         false,               // mutable
1220                         true);               // forReplication
1221 
1222     /**
1223      * SSL KeyStore password source class
1224      * @see ReplicationSSLConfig#SSL_KEYSTORE_PASSWORD_CLASS
1225      */
1226     public static final ConfigParam SSL_KEYSTORE_PASSWORD_CLASS =
1227         new ConfigParam(ReplicationSSLConfig.SSL_KEYSTORE_PASSWORD_CLASS,
1228                         "",                  // default
1229                         false,               // mutable
1230                         true);               // forReplication
1231 
1232     /**
1233      * SSL KeyStore password source constructor parameters
1234      * @see ReplicationSSLConfig#SSL_KEYSTORE_PASSWORD_PARAMS
1235      */
1236     public static final ConfigParam SSL_KEYSTORE_PASSWORD_PARAMS =
1237         new ConfigParam(ReplicationSSLConfig.SSL_KEYSTORE_PASSWORD_PARAMS,
1238                         "",                  // default
1239                         false,               // mutable
1240                         true);               // forReplication
1241 
1242     /**
1243      * SSL KeyStore type
1244      * @see ReplicationSSLConfig#SSL_KEYSTORE_TYPE
1245      */
1246     public static final ConfigParam SSL_KEYSTORE_TYPE =
1247         new ConfigParam(ReplicationSSLConfig.SSL_KEYSTORE_TYPE,
1248                         "",                  // default
1249                         false,               // mutable
1250                         true);               // forReplication
1251 
1252     /**
1253      * SSL server key alias
1254      * @see ReplicationSSLConfig#SSL_SERVER_KEY_ALIAS
1255      */
1256     public static final ConfigParam SSL_SERVER_KEY_ALIAS =
1257         new ConfigParam(ReplicationSSLConfig.SSL_SERVER_KEY_ALIAS,
1258                         "",                  // default
1259                         false,               // mutable
1260                         true);               // forReplication
1261 
1262     /**
1263      * SSL client key alias
1264      * @see ReplicationSSLConfig#SSL_CLIENT_KEY_ALIAS
1265      */
1266     public static final ConfigParam SSL_CLIENT_KEY_ALIAS =
1267         new ConfigParam(ReplicationSSLConfig.SSL_CLIENT_KEY_ALIAS,
1268                         "",                  // default
1269                         false,               // mutable
1270                         true);               // forReplication
1271 
1272     /**
1273      * SSL TrustStore file
1274      * @see ReplicationSSLConfig#SSL_TRUSTSTORE_FILE
1275      */
1276     public static final ConfigParam SSL_TRUSTSTORE_FILE =
1277         new ConfigParam(ReplicationSSLConfig.SSL_TRUSTSTORE_FILE,
1278                         "",                  // default
1279                         false,               // mutable
1280                         true);               // forReplication
1281 
1282     /**
1283      * SSL TrustStore type
1284      * @see ReplicationSSLConfig#SSL_TRUSTSTORE_TYPE
1285      */
1286     public static final ConfigParam SSL_TRUSTSTORE_TYPE =
1287         new ConfigParam(ReplicationSSLConfig.SSL_TRUSTSTORE_TYPE,
1288                         "",                  // default
1289                         false,               // mutable
1290                         true);               // forReplication
1291 
1292     /**
1293      * SSL cipher suites
1294      * @see ReplicationSSLConfig#SSL_CIPHER_SUITES
1295      */
1296     public static final ConfigParam SSL_CIPHER_SUITES =
1297         new ConfigParam(ReplicationSSLConfig.SSL_CIPHER_SUITES,
1298                         "",                  // default
1299                         false,               // mutable
1300                         true);               // forReplication
1301 
1302     /**
1303      * SSL protocols
1304      * @see ReplicationSSLConfig#SSL_PROTOCOLS
1305      */
1306     public static final ConfigParam SSL_PROTOCOLS =
1307         new ConfigParam(ReplicationSSLConfig.SSL_PROTOCOLS,
1308                         "",                  // default
1309                         false,               // mutable
1310                         true);               // forReplication
1311 
1312     /**
1313      * SSL Authenticator
1314      * @see ReplicationSSLConfig#SSL_AUTHENTICATOR
1315      */
1316     public static final ConfigParam SSL_AUTHENTICATOR =
1317         new ConfigParam(ReplicationSSLConfig.SSL_AUTHENTICATOR,
1318                         "",                  // default
1319                         false,               // mutable
1320                         true) {              // forReplication
1321 
1322             @Override
1323             public void validateValue(String value) {
1324                 if (value == null) {
1325                     throw new IllegalArgumentException
1326                         ("a value is required");
1327                 }
1328                 if (!SSLChannelFactory.isValidAuthenticator(value)) {
1329                     throw new IllegalArgumentException
1330                         (value + " a not a valid value");
1331                 }
1332             }
1333         };
1334 
1335     /**
1336      * SSL Authenticator class
1337      * @see ReplicationSSLConfig#SSL_AUTHENTICATOR_CLASS
1338      */
1339     public static final ConfigParam SSL_AUTHENTICATOR_CLASS =
1340         new ConfigParam(ReplicationSSLConfig.SSL_AUTHENTICATOR_CLASS,
1341                         "",                  // default
1342                         false,               // mutable
1343                         true);               // forReplication
1344 
1345     /**
1346      * SSL Authenticator parameters
1347      * @see ReplicationSSLConfig#SSL_AUTHENTICATOR_PARAMS
1348      */
1349     public static final ConfigParam SSL_AUTHENTICATOR_PARAMS =
1350         new ConfigParam(ReplicationSSLConfig.SSL_AUTHENTICATOR_PARAMS,
1351                         "",                  // default
1352                         false,               // mutable
1353                         true);               // forReplication
1354 
1355     /**
1356      * SSL Host Verifier
1357      * @see ReplicationSSLConfig#SSL_HOST_VERIFIER
1358      */
1359     public static final ConfigParam SSL_HOST_VERIFIER =
1360         new ConfigParam(ReplicationSSLConfig.SSL_HOST_VERIFIER,
1361                         "",                  // default
1362                         false,               // mutable
1363                         true) {              // forReplication
1364 
1365             @Override
1366             public void validateValue(String value) {
1367                 if (value == null) {
1368                     throw new IllegalArgumentException
1369                         ("a value is required");
1370                 }
1371                 if (!SSLChannelFactory.isValidHostVerifier(value)) {
1372                     throw new IllegalArgumentException
1373                         (value + " a not a valid value");
1374                 }
1375             }
1376         };
1377 
1378     /**
1379      * SSL Host Verifier class
1380      * @see ReplicationSSLConfig#SSL_HOST_VERIFIER_CLASS
1381      */
1382     public static final ConfigParam SSL_HOST_VERIFIER_CLASS =
1383         new ConfigParam(ReplicationSSLConfig.SSL_HOST_VERIFIER_CLASS,
1384                         "",                  // default
1385                         false,               // mutable
1386                         true);               // forReplication
1387 
1388     /**
1389      * SSL Host Verifier parameters
1390      * @see ReplicationSSLConfig#SSL_HOST_VERIFIER_PARAMS
1391      */
1392     public static final ConfigParam SSL_HOST_VERIFIER_PARAMS =
1393         new ConfigParam(ReplicationSSLConfig.SSL_HOST_VERIFIER_PARAMS,
1394                         "",                  // default
1395                         false,               // mutable
1396                         true);               // forReplication
1397 
1398 
1399     /**
1400      * Override the current JE version, for testing only.
1401      */
1402     public static final ConfigParam TEST_JE_VERSION = new ConfigParam(
1403         EnvironmentParams.REP_PARAM_PREFIX + "test.jeVersion",
1404         "",                     // default
1405         false,                  // mutable
1406         true);                  // forReplication
1407 
1408     /**
1409      * @see ReplicationConfig#REPLAY_COST_PERCENT
1410      */
1411     public static final IntConfigParam REPLAY_COST_PERCENT =
1412         new IntConfigParam(ReplicationConfig.REPLAY_COST_PERCENT,
1413                            0,     // min
1414                            200,   // max
1415                            150,   // default
1416                            false, // mutable
1417                            true); // forReplication
1418 
1419     /**
1420      * @see ReplicationConfig#REPLAY_FREE_DISK_PERCENT
1421      */
1422     public static final IntConfigParam REPLAY_FREE_DISK_PERCENT =
1423         new IntConfigParam(ReplicationConfig.REPLAY_FREE_DISK_PERCENT,
1424                            0,     // min
1425                            99,    // max
1426                            10,    // default
1427                            false, // mutable
1428                            true); // forReplication
1429 }
1430