KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > config > EnvironmentParams


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: EnvironmentParams.java,v 1.84 2006/11/27 23:07:12 mark Exp $
7  */

8
9 package com.sleepycat.je.config;
10
11 import java.io.File JavaDoc;
12 import java.io.FileWriter JavaDoc;
13 import java.util.HashMap JavaDoc;
14 import java.util.Iterator JavaDoc;
15 import java.util.Map JavaDoc;
16 import java.util.TreeSet JavaDoc;
17
18 /**
19  * Javadoc for this public class is generated
20  * via the doc templates in the doc_src directory.
21  */

22 public class EnvironmentParams {
23
24     /*
25      * The map of supported environment parameters where the key is parameter
26      * name and the data is the configuration parameter object. Put first,
27      * before any declarations of ConfigParams.
28      */

29     public final static Map JavaDoc SUPPORTED_PARAMS = new HashMap JavaDoc();
30
31     /*
32      * Environment
33      */

34     public static final LongConfigParam MAX_MEMORY =
35         new LongConfigParam("je.maxMemory",
36                             null, // min
37
null, // max
38
new Long JavaDoc(0), // default uses je.maxMemoryPercent
39
true, // mutable
40
false, // forReplication
41
"# Specify the cache size in bytes, as an absolute number. The system\n"+
42       "# attempts to stay within this budget and will evict database\n" +
43       "# objects when it comes within a prescribed margin of the limit.\n" +
44       "# By default, this parameter is 0 and JE instead sizes the cache\n" +
45       "# proportionally to the memory available to the JVM, based on\n"+
46       "# je.maxMemoryPercent.");
47
48     public static final IntConfigParam MAX_MEMORY_PERCENT =
49         new IntConfigParam("je.maxMemoryPercent",
50                            new Integer JavaDoc(1), // min
51
new Integer JavaDoc(90), // max
52
new Integer JavaDoc(60), // default
53
true, // mutable
54
false, // forReplication
55
"# By default, JE sizes the cache as a percentage of the maximum\n" +
56      "# memory available to the JVM. For example, if the JVM is\n" +
57      "# started with -Xmx128M, the cache size will be\n" +
58      "# (je.maxMemoryPercent * 128M) / 100\n" +
59      "# Setting je.maxMemory to an non-zero value will override\n" +
60      "# je.maxMemoryPercent");
61      
62     public static final BooleanConfigParam ENV_RECOVERY =
63         new BooleanConfigParam("je.env.recovery",
64                                true, // default
65
false, // mutable
66
false, // forReplication
67
"# If true, an environment is created with recovery and the related\n" +
68      "# daemons threads enabled.");
69      
70     public static final BooleanConfigParam ENV_RECOVERY_FORCE_CHECKPOINT =
71         new BooleanConfigParam("je.env.recoveryForceCheckpoint",
72                                false, // default
73
false, // mutable
74
false, // forReplication
75
"# If true, a checkpoint is forced following recovery, even if the\n" +
76      "# log ends with a checkpoint.");
77      
78     public static final BooleanConfigParam ENV_RUN_INCOMPRESSOR =
79         new BooleanConfigParam("je.env.runINCompressor",
80                                true, // default
81
true, // mutable
82
false, // forReplication
83
"# If true, starts up the INCompressor.\n" +
84      "# This parameter is true by default");
85      
86     /* @deprecated As of 2.0, eviction is performed in-line. */
87     public static final BooleanConfigParam ENV_RUN_EVICTOR =
88         new BooleanConfigParam("je.env.runEvictor",
89                                false, // default
90
true, // mutable
91
false, // forReplication
92
"# If true, starts up the evictor.\n" +
93      "# This parameter is false by default\n" +
94      "# (deprecated, eviction is performed in-line");
95      
96     public static final BooleanConfigParam ENV_RUN_CHECKPOINTER =
97         new BooleanConfigParam("je.env.runCheckpointer",
98                                true, // default
99
true, // mutable
100
false, // forReplication
101
"# If true, starts up the checkpointer.\n" +
102      "# This parameter is true by default");
103
104     public static final BooleanConfigParam ENV_RUN_CLEANER =
105         new BooleanConfigParam("je.env.runCleaner",
106                                true, // default
107
true, // mutable
108
false, // forReplication
109
"# If true, starts up the cleaner.\n" +
110      "# This parameter is true by default");
111      
112     public static final IntConfigParam ENV_BACKGROUND_READ_LIMIT =
113         new IntConfigParam("je.env.backgroundReadLimit",
114                             new Integer JavaDoc(0), // min
115
new Integer JavaDoc(Integer.MAX_VALUE), // max
116
new Integer JavaDoc(0), // default
117
true, // mutable
118
false, // forReplication
119
"# The maximum number of read operations performed by JE background\n" +
120      "# activities (e.g., cleaning) before sleeping to ensure that\n" +
121      "# application threads can perform I/O.\n" +
122      "# If zero (the default) then no limitation on I/O is enforced.\n" +
123      "# See je.env.backgroundSleepInterval.");
124      
125     public static final IntConfigParam ENV_BACKGROUND_WRITE_LIMIT =
126         new IntConfigParam("je.env.backgroundWriteLimit",
127                             new Integer JavaDoc(0), // min
128
new Integer JavaDoc(Integer.MAX_VALUE), // max
129
new Integer JavaDoc(0), // default
130
true, // mutable
131
false, // forReplication
132
"# The maximum number of write operations performed by JE background\n" +
133      "# activities (e.g., checkpointing and eviction) before sleeping to\n" +
134      "# ensure that application threads can perform I/O.\n" +
135      "# If zero (the default) then no limitation on I/O is enforced.\n" +
136      "# See je.env.backgroundSleepInterval.");
137      
138     public static final LongConfigParam ENV_BACKGROUND_SLEEP_INTERVAL =
139         new LongConfigParam("je.env.backgroundSleepInterval",
140                            new Long JavaDoc(1000), // min
141
new Long JavaDoc(Long.MAX_VALUE), // max
142
new Long JavaDoc(1000), // default
143
true, // mutable
144
false, // forReplication
145
"# The number of microseconds that JE background activities will\n" +
146      "# sleep when the je.env.backgroundWriteLimit or backgroundReadLimit\n" +
147      "# is reached. If je.env.backgroundWriteLimit and\n" +
148      "# backgroundReadLimit are zero, this setting is not used.\n" +
149      "# By default this setting is 1000 or 1 millisecond.");
150
151     public static final BooleanConfigParam ENV_CHECK_LEAKS =
152         new BooleanConfigParam("je.env.checkLeaks",
153                                true, // default
154
false, // mutable
155
false, // forReplication
156
"# Debugging support: check leaked locks and txns at env close.");
157
158     public static final BooleanConfigParam ENV_FORCED_YIELD =
159         new BooleanConfigParam("je.env.forcedYield",
160                                false, // default
161
false, // mutable
162
false, // forReplication
163
"# Debugging support: call Thread.yield() at strategic points.");
164
165     public static final BooleanConfigParam ENV_INIT_TXN =
166         new BooleanConfigParam("je.env.isTransactional",
167                                false, // default
168
false, // mutable
169
false, // forReplication
170
"# If true, create the environment w/ transactions.");
171
172     public static final BooleanConfigParam ENV_INIT_LOCKING =
173         new BooleanConfigParam("je.env.isLocking",
174                                true, // default
175
false, // mutable
176
false, // forReplication
177
"# If true, create the environment with locking.");
178
179     public static final BooleanConfigParam ENV_RDONLY =
180         new BooleanConfigParam("je.env.isReadOnly",
181                                false, // default
182
false, // mutable
183
false, // forReplication
184
"# If true, create the environment read only.");
185
186     public static final BooleanConfigParam ENV_FAIR_LATCHES =
187         new BooleanConfigParam("je.env.fairLatches",
188                                false, // default
189
false, // mutable
190
false, // forReplication
191
"# If true, use latches instead of synchronized blocks to\n" +
192      "# implement the lock table and log write mutexes. Latches require\n" +
193      "# that threads queue to obtain the mutex in question and\n" +
194      "# therefore guarantee that there will be no mutex starvation, but \n" +
195      "# do incur a performance penalty. Latches should not be necessary in\n"+
196      "# most cases, so synchronized blocks are the default. An application\n" +
197      "# that puts heavy load on JE with threads with different thread\n"+
198      "# priorities might find it useful to use latches. In a Java 5 JVM,\n" +
199      "# where java.util.concurrent.locks.ReentrantLock is used for the\n" +
200      "# latch implementation, this parameter will determine whether they\n" +
201      "# are 'fair' or not. This parameter is 'static' across all\n" +
202      "# environments.\n");
203     
204     public static final BooleanConfigParam ENV_SHARED_LATCHES =
205         new BooleanConfigParam("je.env.sharedLatches",
206                                false, // default
207
false, // mutable
208
false, // forReplication
209
"# If true, use shared latches for Internal Nodes (INs).\n");
210
211     public static final IntConfigParam ADLER32_CHUNK_SIZE =
212         new IntConfigParam("je.adler32.chunkSize",
213                            new Integer JavaDoc(0), // min
214
new Integer JavaDoc(1 << 20), // max
215
new Integer JavaDoc(0), // default
216
true, // mutable
217
false, // forReplication
218
"# By default, JE passes an entire log record to the Adler32 class\n" +
219      "# for checksumming. This can cause problems with the GC in some\n" +
220      "# cases if the records are large and there is concurrency. Setting\n" +
221      "# this parameter will cause JE to pass chunks of the log record to\n" +
222      "# the checksumming class so that the GC does not block. 0 means\n" +
223      "# do not chunk.\n");
224      
225     /*
226      * Database Logs
227      */

228     /* default: 2k * NUM_LOG_BUFFERS */
229     public static final int MIN_LOG_BUFFER_SIZE = 2048;
230     private static final int NUM_LOG_BUFFERS_DEFAULT = 3;
231     public static final long LOG_MEM_SIZE_MIN =
232         NUM_LOG_BUFFERS_DEFAULT * MIN_LOG_BUFFER_SIZE;
233     public static final String JavaDoc LOG_MEM_SIZE_MIN_STRING =
234         Long.toString(LOG_MEM_SIZE_MIN);
235
236     public static final LongConfigParam LOG_MEM_SIZE =
237         new LongConfigParam("je.log.totalBufferBytes",
238                             new Long JavaDoc(LOG_MEM_SIZE_MIN),// min
239
null, // max
240
new Long JavaDoc(0), // by default computed
241
// from je.maxMemory
242
false, // mutable
243
false, // forReplication
244
"# The total memory taken by log buffers, in bytes. If 0, use\n" +
245      "# 7% of je.maxMemory");
246
247     public static final IntConfigParam NUM_LOG_BUFFERS =
248         new IntConfigParam("je.log.numBuffers",
249                            new Integer JavaDoc(2), // min
250
null, // max
251
new Integer JavaDoc(NUM_LOG_BUFFERS_DEFAULT), // default
252
false, // mutable
253
false, // forReplication
254
"# The number of JE log buffers");
255
256     public static final IntConfigParam LOG_BUFFER_MAX_SIZE =
257         new IntConfigParam("je.log.bufferSize",
258                            new Integer JavaDoc(1<<10), // min
259
null, // max
260
new Integer JavaDoc(1<<20), // default
261
false, // mutable
262
false, // forReplication
263
"# maximum starting size of a JE log buffer");
264
265     public static final IntConfigParam LOG_FAULT_READ_SIZE =
266         new IntConfigParam("je.log.faultReadSize",
267                            new Integer JavaDoc(32), // min
268
null, // max
269
new Integer JavaDoc(2048), // default
270
false, // mutable
271
false, // forReplication
272
"# The buffer size for faulting in objects from disk, in bytes.");
273
274     public static final IntConfigParam LOG_ITERATOR_READ_SIZE =
275         new IntConfigParam("je.log.iteratorReadSize",
276                            new Integer JavaDoc(128), // min
277
null, // max
278
new Integer JavaDoc(8192), // default
279
false, // mutable
280
false, // forReplication
281
"# The read buffer size for log iterators, which are used when\n" +
282      "# scanning the log during activities like log cleaning and\n" +
283      "# environment open, in bytes. This may grow as the system encounters\n" +
284      "# larger log entries");
285
286     public static final IntConfigParam LOG_ITERATOR_MAX_SIZE =
287         new IntConfigParam("je.log.iteratorMaxSize",
288                            new Integer JavaDoc(128), // min
289
null, // max
290
new Integer JavaDoc(16777216), // default
291
false, // mutable
292
false, // forReplication
293
"# The maximum read buffer size for log iterators, which are used\n" +
294      "# when scanning the log during activities like log cleaning\n" +
295      "# and environment open, in bytes.");
296      
297     public static final LongConfigParam LOG_FILE_MAX =
298         new LongConfigParam("je.log.fileMax",
299                             new Long JavaDoc(1000000), // min
300
new Long JavaDoc(4294967296L), // max
301
new Long JavaDoc(10000000), // default
302
false, // mutable
303
false, // forReplication
304
"# The maximum size of each individual JE log file, in bytes.");
305      
306     public static final BooleanConfigParam LOG_CHECKSUM_READ =
307         new BooleanConfigParam("je.log.checksumRead",
308                                true, // default
309
false, // mutable
310
false, // forReplication
311
"# If true, perform a checksum check when reading entries from log.");
312      
313     public static final BooleanConfigParam LOG_MEMORY_ONLY =
314         new BooleanConfigParam("je.log.memOnly",
315                                false, // default
316
false, // mutable
317
false, // forReplication
318
"# If true, operates in an in-memory test mode without flushing\n" +
319      "# the log to disk. An environment directory must be specified, but\n" +
320      "# it need not exist and no files are written. The system operates\n" +
321      "# until it runs out of memory, at which time an OutOfMemoryError\n" +
322      "# is thrown. Because the entire log is kept in memory, this mode\n" +
323      "# is normally useful only for testing.");
324
325     public static final IntConfigParam LOG_FILE_CACHE_SIZE =
326         new IntConfigParam("je.log.fileCacheSize",
327                            new Integer JavaDoc(3), // min
328
null, // max
329
new Integer JavaDoc(100), // default
330
false, // mutable
331
false, // forReplication
332
"# The size of the file handle cache.");
333
334     public static final LongConfigParam LOG_FSYNC_TIMEOUT =
335         new LongConfigParam("je.log.fsyncTimeout",
336                             new Long JavaDoc(10000L), // min
337
null, // max
338
new Long JavaDoc(500000L), // default
339
false, // mutable
340
false, // forReplication
341
"# Timeout limit for group file sync, in microseconds.");
342      
343     public static final BooleanConfigParam LOG_USE_NIO =
344         new BooleanConfigParam("je.log.useNIO",
345                                false, // default
346
false, // mutable
347
false, // forReplication
348
"# If true (default is false) NIO is used for all file I/O.");
349      
350     public static final BooleanConfigParam LOG_DIRECT_NIO =
351         new BooleanConfigParam("je.log.directNIO",
352                                false, // default
353
false, // mutable
354
false, // forReplication
355
"# If true (default is false) direct NIO buffers are used.\n" +
356      "# This setting is only used if je.log.useNIO=true.");
357
358     public static final LongConfigParam LOG_CHUNKED_NIO =
359         new LongConfigParam("je.log.chunkedNIO",
360                             new Long JavaDoc(0L), // min
361
new Long JavaDoc(1 << 26), // max (64M)
362
new Long JavaDoc(0L), // default (no chunks)
363
false, // mutable
364
false, // forReplication
365
"# If non-0 (default is 0) break all IO into chunks of this size.\n" +
366      "# This setting is only used if je.log.useNIO=true.");
367
368     public static final BooleanConfigParam LOG_DEFERREDWRITE_TEMP =
369         new BooleanConfigParam("je.deferredWrite.temp",
370                                false, // default
371
false, // mutable
372
false, // forReplication
373
"# If true, assume that deferred write database will never be\n" +
374      "# used after an environment is closed. This permits a more efficient\n" +
375      "# form of logging of deferred write objects that overflow to disk\n" +
376      "# through cache eviction or Database.sync() and reduces log cleaner\n" +
377      "# overhead.");
378
379     /*
380      * Tree
381      */

382     public static final IntConfigParam NODE_MAX =
383         new IntConfigParam("je.nodeMaxEntries",
384                            new Integer JavaDoc(4), // min
385
new Integer JavaDoc(32767), // max
386
new Integer JavaDoc(128), // default
387
false, // mutable
388
false, // forReplication
389
"# The maximum number of entries in an internal btree node.\n" +
390      "# This can be set per-database using the DatabaseConfig object.");
391
392     public static final IntConfigParam NODE_MAX_DUPTREE =
393         new IntConfigParam("je.nodeDupTreeMaxEntries",
394                            new Integer JavaDoc(4), // min
395
new Integer JavaDoc(32767), // max
396
new Integer JavaDoc(128), // default
397
false, // mutable
398
false, // forReplication
399
"# The maximum number of entries in an internal dup btree node.\n" +
400      "# This can be set per-database using the DatabaseConfig object.");
401
402     public static final IntConfigParam BIN_MAX_DELTAS =
403         new IntConfigParam("je.tree.maxDelta",
404                            new Integer JavaDoc(0), // min
405
new Integer JavaDoc(100), // max
406
new Integer JavaDoc(10), // default
407
false, // mutable
408
false, // forReplication
409
"# After this many deltas, logs a full version.");
410      
411     public static final IntConfigParam BIN_DELTA_PERCENT =
412         new IntConfigParam("je.tree.binDelta",
413                            new Integer JavaDoc(0), // min
414
new Integer JavaDoc(75), // max
415
new Integer JavaDoc(25), // default
416
false, // mutable
417
false, // forReplication
418
"# If less than this percentage of entries are changed on a BIN,\n" +
419      "# logs a delta instead of a full version.");
420
421     /*
422      * IN Compressor
423      */

424     public static final LongConfigParam COMPRESSOR_WAKEUP_INTERVAL =
425         new LongConfigParam("je.compressor.wakeupInterval",
426                             new Long JavaDoc(1000000), // min
427
new Long JavaDoc(4294967296L), // max
428
new Long JavaDoc(5000000), // default
429
false, // mutable
430
false, // forReplication
431
"# The compressor wakeup interval in microseconds.");
432      
433     public static final IntConfigParam COMPRESSOR_RETRY =
434         new IntConfigParam("je.compressor.deadlockRetry",
435                            new Integer JavaDoc(0), // min
436
new Integer JavaDoc(Integer.MAX_VALUE),// max
437
new Integer JavaDoc(3), // default
438
false, // mutable
439
false, // forReplication
440
"# Number of times to retry a compression run if a deadlock occurs.");
441
442     public static final LongConfigParam COMPRESSOR_LOCK_TIMEOUT =
443         new LongConfigParam("je.compressor.lockTimeout",
444                             new Long JavaDoc(0), // min
445
new Long JavaDoc(4294967296L), // max
446
new Long JavaDoc(500000L), // default
447
false, // mutable
448
false, // forReplication
449
"# The lock timeout for compressor transactions in microseconds.");
450
451     public static final BooleanConfigParam COMPRESSOR_PURGE_ROOT =
452         new BooleanConfigParam("je.compressor.purgeRoot",
453                                            false, // default
454
false, // mutable
455
false, // forReplication
456
"# If true, when the compressor encounters an empty tree, the root\n" +
457      "# node of the tree is deleted.");
458      
459     /*
460      * Evictor
461      */

462     public static final LongConfigParam EVICTOR_EVICT_BYTES =
463         new LongConfigParam("je.evictor.evictBytes",
464                              new Long JavaDoc(1024), // min
465
null, // max
466
new Long JavaDoc(524288), // default
467
false, // mutable
468
false, // forReplication
469
"# When eviction happens, the evictor will push memory usage to this\n" +
470      "# number of bytes below je.maxMemory. The default is 512KB and the\n" +
471      "# minimum is 1 KB (1024).");
472
473     /* @deprecated As of 2.0, this is replaced by je.evictor.evictBytes */
474     public static final IntConfigParam EVICTOR_USEMEM_FLOOR =
475         new IntConfigParam("je.evictor.useMemoryFloor",
476                            new Integer JavaDoc(50), // min
477
new Integer JavaDoc(100), // max
478
new Integer JavaDoc(95), // default
479
false, // mutable
480
false, // forReplication
481
"# When eviction happens, the evictor will push memory usage to this\n" +
482      "# percentage of je.maxMemory." +
483      "# (deprecated in favor of je.evictor.evictBytes");
484
485     /* @deprecated As of 1.7.2, this is replaced by je.evictor.nodesPerScan */
486     public static final IntConfigParam EVICTOR_NODE_SCAN_PERCENTAGE =
487         new IntConfigParam("je.evictor.nodeScanPercentage",
488                            new Integer JavaDoc(1), // min
489
new Integer JavaDoc(100), // max
490
new Integer JavaDoc(10), // default
491
false, // mutable
492
false, // forReplication
493
"# The evictor percentage of total nodes to scan per wakeup.\n" +
494      "# (deprecated in favor of je.evictor.nodesPerScan");
495
496     /* @deprecated As of 1.7.2, 1 node is chosen per scan. */
497     public static final
498         IntConfigParam EVICTOR_EVICTION_BATCH_PERCENTAGE =
499         new IntConfigParam("je.evictor.evictionBatchPercentage",
500                            new Integer JavaDoc(1), // min
501
new Integer JavaDoc(100), // max
502
new Integer JavaDoc(10), // default
503
false, // mutable
504
false, // forReplication
505
"# The evictor percentage of scanned nodes to evict per wakeup.\n" +
506      "# (deprecated)");
507
508     public static final IntConfigParam EVICTOR_NODES_PER_SCAN =
509         new IntConfigParam("je.evictor.nodesPerScan",
510                            new Integer JavaDoc(1), // min
511
new Integer JavaDoc(1000), // max
512
new Integer JavaDoc(10), // default
513
false, // mutable
514
false, // forReplication
515
"# The number of nodes in one evictor scan");
516
517     /* @deprecated As of 2.0, eviction is performed in-line. */
518     public static final
519         IntConfigParam EVICTOR_CRITICAL_PERCENTAGE =
520         new IntConfigParam("je.evictor.criticalPercentage",
521                            new Integer JavaDoc(0), // min
522
new Integer JavaDoc(1000), // max
523
new Integer JavaDoc(0), // default
524
false, // mutable
525
false, // forReplication
526
"# At this percentage over the allotted cache, critical eviction\n" +
527      "# will start." +
528      "# (deprecated, eviction is performed in-line");
529
530     public static final IntConfigParam EVICTOR_RETRY =
531         new IntConfigParam("je.evictor.deadlockRetry",
532                            new Integer JavaDoc(0), // min
533
new Integer JavaDoc(Integer.MAX_VALUE),// max
534
new Integer JavaDoc(3), // default
535
false, // mutable
536
false, // forReplication
537
"# The number of times to retry the evictor if it runs into a deadlock.");
538       
539     public static final BooleanConfigParam EVICTOR_LRU_ONLY =
540         new BooleanConfigParam("je.evictor.lruOnly",
541                                true, // default
542
false, // mutable
543
false, // forReplication
544
"# If true (the default), use an LRU-only policy to select nodes for\n" +
545      "# eviction. If false, select by Btree level first, and then by LRU.");
546
547     /*
548      * Checkpointer
549      */

550     public static final LongConfigParam CHECKPOINTER_BYTES_INTERVAL =
551         new LongConfigParam("je.checkpointer.bytesInterval",
552                             new Long JavaDoc(0), // min
553
new Long JavaDoc(Long.MAX_VALUE), // max
554
new Long JavaDoc(20000000), // default
555
false, // mutable
556
false, // forReplication
557
"# Ask the checkpointer to run every time we write this many bytes\n" +
558      "# to the log. If set, supercedes je.checkpointer.wakeupInterval. To\n" +
559      "# use time based checkpointing, set this to 0.");
560
561     public static final LongConfigParam CHECKPOINTER_WAKEUP_INTERVAL =
562         new LongConfigParam("je.checkpointer.wakeupInterval",
563                             new Long JavaDoc(1000000), // min
564
new Long JavaDoc(4294967296L), // max
565
new Long JavaDoc(0), // default
566
false, // mutable
567
false, // forReplication
568
"# The checkpointer wakeup interval in microseconds. By default, this\n"+
569      "# is inactive and we wakeup the checkpointer as a function of the\n" +
570      "# number of bytes written to the log. (je.checkpointer.bytesInterval)");
571
572     public static final IntConfigParam CHECKPOINTER_RETRY =
573         new IntConfigParam("je.checkpointer.deadlockRetry",
574                            new Integer JavaDoc(0), // miyn
575
new Integer JavaDoc(Integer.MAX_VALUE), // max
576
new Integer JavaDoc(3), // default
577
false, // mutable
578
false, // forReplication
579
"# The number of times to retry a checkpoint if it runs into a deadlock.");
580     /*
581      * Cleaner
582      */

583     public static final IntConfigParam CLEANER_MIN_UTILIZATION =
584         new IntConfigParam("je.cleaner.minUtilization",
585                            new Integer JavaDoc(0), // min
586
new Integer JavaDoc(90), // max
587
new Integer JavaDoc(50), // default
588
true, // mutable
589
false, // forReplication
590
"# The cleaner will keep the total disk space utilization percentage\n" +
591      "# above this value. The default is set to 50 percent.");
592
593     public static final IntConfigParam CLEANER_MIN_FILE_UTILIZATION =
594         new IntConfigParam("je.cleaner.minFileUtilization",
595                            new Integer JavaDoc(0), // min
596
new Integer JavaDoc(50), // max
597
new Integer JavaDoc(5), // default
598
true, // mutable
599
false, // forReplication
600
"# A log file will be cleaned if its utilization percentage is below\n" +
601      "# this value, irrespective of total utilization. The default is\n" +
602      "# set to 5 percent.");
603
604     public static final LongConfigParam CLEANER_BYTES_INTERVAL =
605         new LongConfigParam("je.cleaner.bytesInterval",
606                             new Long JavaDoc(0), // min
607
new Long JavaDoc(Long.MAX_VALUE), // max
608
new Long JavaDoc(0), // default
609
true, // mutable
610
false, // forReplication
611
"# The cleaner checks disk utilization every time we write this many\n" +
612      "# bytes to the log. If zero (and by default) it is set to the\n" +
613      "# je.log.fileMax value divided by four.");
614       
615     public static final BooleanConfigParam CLEANER_FETCH_OBSOLETE_SIZE =
616         new BooleanConfigParam("je.cleaner.fetchObsoleteSize",
617                                false, // default
618
true, // mutable
619
false, // forReplication
620
"# If true, the cleaner will fetch records to determine their size\n" +
621      "# to more accurately calculate log utilization. This setting is\n" +
622      "# used during DB truncation/removal and during recovery, and will\n" +
623      "# cause more I/O during those operations when set to true.");
624
625     public static final IntConfigParam CLEANER_DEADLOCK_RETRY =
626         new IntConfigParam("je.cleaner.deadlockRetry",
627                            new Integer JavaDoc(0), // min
628
new Integer JavaDoc(Integer.MAX_VALUE),// max
629
new Integer JavaDoc(3), // default
630
true, // mutable
631
false, // forReplication
632
"# The number of times to retry cleaning if a deadlock occurs.\n" +
633      "# The default is set to 3.");
634
635     public static final LongConfigParam CLEANER_LOCK_TIMEOUT =
636         new LongConfigParam("je.cleaner.lockTimeout",
637                             new Long JavaDoc(0), // min
638
new Long JavaDoc(4294967296L), // max
639
new Long JavaDoc(500000L), // default
640
true, // mutable
641
false, // forReplication
642
"# The lock timeout for cleaner transactions in microseconds.\n" +
643      "# The default is set to 0.5 seconds.");
644       
645     public static final BooleanConfigParam CLEANER_REMOVE =
646         new BooleanConfigParam("je.cleaner.expunge",
647                                true, // default
648
true, // mutable
649
false, // forReplication
650
"# If true, the cleaner deletes log files after successful cleaning.\n" +
651      "# If false, the cleaner changes log file extensions to .DEL\n" +
652      "# instead of deleting them. The default is set to true.");
653
654     /* @deprecated As of 1.7.1, no longer used. */
655     public static final IntConfigParam CLEANER_MIN_FILES_TO_DELETE =
656         new IntConfigParam("je.cleaner.minFilesToDelete",
657                            new Integer JavaDoc(1), // min
658
new Integer JavaDoc(1000000), // max
659
new Integer JavaDoc(5), // default
660
false, // mutable
661
false, // forReplication
662
"# (deprecated, no longer used");
663
664     /* @deprecated As of 2.0, no longer used. */
665     public static final IntConfigParam CLEANER_RETRIES =
666         new IntConfigParam("je.cleaner.retries",
667                            new Integer JavaDoc(0), // min
668
new Integer JavaDoc(1000), // max
669
new Integer JavaDoc(10), // default
670
false, // mutable
671
false, // forReplication
672
"# (deprecated, no longer used");
673
674     /* @deprecated As of 2.0, no longer used. */
675     public static final IntConfigParam CLEANER_RESTART_RETRIES =
676         new IntConfigParam("je.cleaner.restartRetries",
677                            new Integer JavaDoc(0), // min
678
new Integer JavaDoc(1000), // max
679
new Integer JavaDoc(5), // default
680
false, // mutable
681
false, // forReplication
682
"# (deprecated, no longer used");
683
684     public static final IntConfigParam CLEANER_MIN_AGE =
685         new IntConfigParam("je.cleaner.minAge",
686                            new Integer JavaDoc(1), // min
687
new Integer JavaDoc(1000), // max
688
new Integer JavaDoc(2), // default
689
true, // mutable
690
false, // forReplication
691
"# The minimum age of a file (number of files between it and the\n" +
692      "# active file) to qualify it for cleaning under any conditions.\n" +
693      "# The default is set to 2.");
694       
695     public static final BooleanConfigParam CLEANER_CLUSTER =
696         new BooleanConfigParam("je.cleaner.cluster",
697                                false, // default
698
true, // mutable
699
false, // forReplication
700
"# *** Experimental and may be removed in a future release. ***\n" +
701      "# If true, eviction and checkpointing will cluster records by key\n" +
702      "# value, migrating them from low utilization files if they are\n" +
703      "# resident.\n" +
704      "# The cluster and clusterAll properties may not both be set to true.");
705       
706     public static final BooleanConfigParam CLEANER_CLUSTER_ALL =
707         new BooleanConfigParam("je.cleaner.clusterAll",
708                                false, // default
709
true, // mutable
710
false, // forReplication
711
"# *** Experimental and may be removed in a future release. ***\n" +
712      "# If true, eviction and checkpointing will cluster records by key\n" +
713      "# value, migrating them from low utilization files whether or not\n" +
714      "# they are resident.\n" +
715      "# The cluster and clusterAll properties may not both be set to true.");
716       
717     public static final IntConfigParam CLEANER_MAX_BATCH_FILES =
718         new IntConfigParam("je.cleaner.maxBatchFiles",
719                            new Integer JavaDoc(0), // min
720
new Integer JavaDoc(100000), // max
721
new Integer JavaDoc(0), // default
722
true, // mutable
723
false, // forReplication
724
"# The maximum number of log files in the cleaner's backlog, or\n" +
725      "# zero if there is no limit. Changing this property can impact the\n" +
726      "# performance of some out-of-memory applications.");
727
728     public static final IntConfigParam CLEANER_READ_SIZE =
729         new IntConfigParam("je.cleaner.readSize",
730                            new Integer JavaDoc(128), // min
731
null, // max
732
new Integer JavaDoc(0), // default
733
true, // mutable
734
false, // forReplication
735
"# The read buffer size for cleaning. If zero (the default), then\n" +
736      "# je.log.iteratorReadSize value is used.");
737       
738     public static final BooleanConfigParam CLEANER_TRACK_DETAIL =
739         new BooleanConfigParam("je.cleaner.trackDetail",
740                                true, // default
741
false, // mutable
742
false, // forReplication
743
"# If true, the cleaner tracks and stores detailed information that\n" +
744      "# is used to decrease the cost of cleaning.");
745
746     public static final IntConfigParam CLEANER_DETAIL_MAX_MEMORY_PERCENTAGE =
747         new IntConfigParam("je.cleaner.detailMaxMemoryPercentage",
748                            new Integer JavaDoc(1), // min
749
new Integer JavaDoc(90), // max
750
new Integer JavaDoc(2), // default
751
true, // mutable
752
false, // forReplication
753
"# Tracking of detailed cleaning information will use no more than\n" +
754      "# this percentage of the cache. The default value is two percent.\n" +
755      "# This setting is only used if je.cleaner.trackDetail=true.");
756       
757     public static final BooleanConfigParam CLEANER_RMW_FIX =
758         new BooleanConfigParam("je.cleaner.rmwFix",
759                                true, // default
760
false, // mutable
761
false, // forReplication
762
"# If true, detail information is discarded that was added by earlier\n" +
763      "# versions of JE if it may be invalid. This may be set to false\n" +
764      "# for increased performance, but only if LockMode.RMW was never used.");
765       
766     public static final ConfigParam CLEANER_FORCE_CLEAN_FILES =
767         new ConfigParam("je.cleaner.forceCleanFiles",
768                         "", // default
769
false, // mutable
770
false, // forReplication
771
"# Specifies a list of files or file ranges to force clean. This is\n" +
772      "# intended for use in forcing the cleaning of a large number of log\n" +
773      "# files. File numbers are in hex and are comma separated or hyphen\n" +
774      "# separated to specify ranges, e.g.: '9,a,b-d' will clean 5 files.");
775
776     public static final IntConfigParam CLEANER_THREADS =
777         new IntConfigParam("je.cleaner.threads",
778                            new Integer JavaDoc(1), // min
779
null, // max
780
new Integer JavaDoc(1), // default
781
true, // mutable
782
false, // forReplication
783
"# The number of threads allocated by the cleaner for log file\n" +
784      "# processing. If the cleaner backlog becomes large, increase this\n" +
785      "# value. The default is set to 1.");
786
787     public static final IntConfigParam CLEANER_LOOK_AHEAD_CACHE_SIZE =
788         new IntConfigParam("je.cleaner.lookAheadCacheSize",
789                            new Integer JavaDoc(0), // min
790
null, // max
791
new Integer JavaDoc(8192), // default
792
true, // mutable
793
false, // forReplication
794
"# The look ahead cache size for cleaning in bytes. Increasing this\n" +
795      "# value can reduce the number of Btree lookups.");
796
797     /*
798      * Transactions
799      */

800     public static final IntConfigParam N_LOCK_TABLES =
801         new IntConfigParam("je.lock.nLockTables",
802                            new Integer JavaDoc(1), // min
803
new Integer JavaDoc(32767),// max
804
new Integer JavaDoc(1), // default
805
false, // mutable
806
false, // forReplication
807
"# Number of Lock Tables. Set this to a value other than 1 when\n" +
808      "# an application has multiple threads performing concurrent JE\n" +
809      "# operations. It should be set to a prime number, and in general\n" +
810      "# not higher than the number of application threads performing JE\n" +
811      "# operations.");
812
813     public static final LongConfigParam LOCK_TIMEOUT =
814         new LongConfigParam("je.lock.timeout",
815                             new Long JavaDoc(0), // min
816
new Long JavaDoc(4294967296L), // max
817
new Long JavaDoc(500000L), // default
818
false, // mutable
819
false, // forReplication
820
"# The lock timeout in microseconds.");
821
822     public static final LongConfigParam TXN_TIMEOUT =
823         new LongConfigParam("je.txn.timeout",
824                             new Long JavaDoc(0), // min
825
new Long JavaDoc(4294967296L), // max_value
826
new Long JavaDoc(0), // default
827
false, // mutable
828
false, // forReplication
829
"# The transaction timeout, in microseconds. A value of 0 means no limit.");
830
831     public static final BooleanConfigParam TXN_SERIALIZABLE_ISOLATION =
832         new BooleanConfigParam("je.txn.serializableIsolation",
833                                false, // default
834
false, // mutable
835
false, // forReplication
836
"# Transactions have the Serializable (Degree 3) isolation level. The\n" +
837    "# default is false, which implies the Repeatable Read isolation level.");
838
839     public static final BooleanConfigParam TXN_DEADLOCK_STACK_TRACE =
840         new BooleanConfigParam("je.txn.deadlockStackTrace",
841                                false, // default
842
true, // mutable
843
false, // forReplication
844
"# Set this parameter to true to add stacktrace information to deadlock\n" +
845    "# (lock timeout) exception messages. The stack trace will show where\n" +
846    "# each lock was taken. The default is false, and true should only be\n" +
847    "# used during debugging because of the added memory/processing cost.\n" +
848    "# This parameter is 'static' across all environments.");
849
850     public static final BooleanConfigParam TXN_DUMPLOCKS =
851         new BooleanConfigParam("je.txn.dumpLocks",
852                                false, // default
853
true, // mutable
854
false, // forReplication
855
"# Dump the lock table when a lock timeout is encountered, for\n" +
856    "# debugging assistance.");
857
858     /*
859      * Debug tracing system
860      */

861     public static final BooleanConfigParam JE_LOGGING_FILE =
862         new BooleanConfigParam("java.util.logging.FileHandler.on",
863                                false, // default
864
false, // mutable
865
false, // forReplication
866
"# Use FileHandler in logging system.");
867
868     public static final BooleanConfigParam JE_LOGGING_CONSOLE =
869         new BooleanConfigParam("java.util.logging.ConsoleHandler.on",
870                                false, // default
871
false, // mutable
872
false, // forReplication
873
"# Use ConsoleHandler in logging system.");
874
875     public static final BooleanConfigParam JE_LOGGING_DBLOG =
876         new BooleanConfigParam("java.util.logging.DbLogHandler.on",
877                                true, // default
878
false, // mutable
879
false, // forReplication
880
"# Use DbLogHandler in logging system.");
881
882     public static final IntConfigParam JE_LOGGING_FILE_LIMIT =
883         new IntConfigParam("java.util.logging.FileHandler.limit",
884                            new Integer JavaDoc(1000), // min
885
new Integer JavaDoc(1000000000), // max
886
new Integer JavaDoc(10000000), // default
887
false, // mutable
888
false, // forReplication
889
"# Log file limit for FileHandler.");
890
891     public static final IntConfigParam JE_LOGGING_FILE_COUNT =
892         new IntConfigParam("java.util.logging.FileHandler.count",
893                            new Integer JavaDoc(1), // min
894
null, // max
895
new Integer JavaDoc(10), // default
896
false, // mutable
897
false, // forReplication
898
"# Log file count for FileHandler.");
899
900     public static final ConfigParam JE_LOGGING_LEVEL =
901         new ConfigParam("java.util.logging.level",
902                         "INFO",
903                         false, // mutable
904
false, // forReplication
905
"# Trace messages equal and above this level will be logged.\n" +
906      "# Value should be one of the predefined java.util.logging.Level values");
907
908     public static final ConfigParam JE_LOGGING_LEVEL_LOCKMGR =
909         new ConfigParam("java.util.logging.level.lockMgr",
910                         "FINE",
911                         false, // mutable
912
false, // forReplication
913
"# Lock manager specific trace messages will be issued at this level.\n"+
914      "# Value should be one of the predefined java.util.logging.Level values");
915
916     public static final ConfigParam JE_LOGGING_LEVEL_RECOVERY =
917         new ConfigParam("java.util.logging.level.recovery",
918                         "FINE",
919                          false, // mutable
920
false, // forReplication
921
"# Recovery specific trace messages will be issued at this level.\n"+
922      "# Value should be one of the predefined java.util.logging.Level values");
923
924     public static final ConfigParam JE_LOGGING_LEVEL_EVICTOR =
925         new ConfigParam("java.util.logging.level.evictor",
926                         "FINE",
927                          false, // mutable
928
false, // forReplication
929
"# Evictor specific trace messages will be issued at this level.\n"+
930      "# Value should be one of the predefined java.util.logging.Level values");
931
932     public static final ConfigParam JE_LOGGING_LEVEL_CLEANER =
933         new ConfigParam("java.util.logging.level.cleaner",
934                         "FINE",
935                          true, // mutable
936
false, // forReplication
937
"# Cleaner specific detailed trace messages will be issued at this\n" +
938      "# level. The Value should be one of the predefined \n" +
939      "# java.util.logging.Level values");
940
941     /*
942      * Replication params are in com.sleepycat.je.rep.impl.ReplicatorParams
943      */

944
945     
946     /*
947      * Create a sample je.properties file.
948      */

949     public static void main(String JavaDoc argv[]) {
950         if (argv.length != 2) {
951             throw new IllegalArgumentException JavaDoc("Usage: EnvironmentParams " +
952                           "<includeReplicationParams, true|false> " +
953                           "<samplePropertyFile>");
954         }
955
956         try {
957             boolean includeRepParams = Boolean.valueOf(argv[0]).booleanValue();
958             FileWriter JavaDoc exampleFile = new FileWriter JavaDoc(new File JavaDoc(argv[1]));
959             TreeSet JavaDoc paramNames = new TreeSet JavaDoc(SUPPORTED_PARAMS.keySet());
960             Iterator JavaDoc iter = paramNames.iterator();
961             exampleFile.write
962                 ("####################################################\n" +
963                  "# Example Berkeley DB, Java Edition property file\n" +
964                  "# Each parameter is set to its default value\n" +
965                  "####################################################\n\n");
966             
967             while (iter.hasNext()) {
968                 String JavaDoc paramName =(String JavaDoc) iter.next();
969                 ConfigParam param =
970                     (ConfigParam) SUPPORTED_PARAMS.get(paramName);
971
972                 /*
973                  * If we're not showing replication params, skip
974                  * the appropriate ones.
975                  */

976                 if (!includeRepParams &&
977                     param.isForReplication()) {
978                     continue;
979                 }
980
981                 exampleFile.write(param.getDescription() + "\n");
982                 String JavaDoc extraDesc = param.getExtraDescription();
983                 if (extraDesc != null) {
984                     exampleFile.write(extraDesc + "\n");
985                 }
986                 exampleFile.write("# " + param.getName() + "=" +
987                                   param.getDefault() +
988                                   "\n# (mutable at run time: " +
989                                   param.isMutable() +
990                                   ")\n\n");
991             }
992             exampleFile.close();
993         } catch (Exception JavaDoc e) {
994             e.printStackTrace();
995             System.exit(-1);
996         }
997     }
998     
999     /*
1000     * Add a configuration parameter to the set supported by an
1001     * environment.
1002     */

1003    public static void addSupportedParam(ConfigParam param) {
1004        SUPPORTED_PARAMS.put(param.getName(), param);
1005    }
1006}
1007
Popular Tags