| 1 8 9 package com.sleepycat.je.config; 10 11 import java.io.File ; 12 import java.io.FileWriter ; 13 import java.util.HashMap ; 14 import java.util.Iterator ; 15 import java.util.Map ; 16 import java.util.TreeSet ; 17 18 22 public class EnvironmentParams { 23 24 29 public final static Map SUPPORTED_PARAMS = new HashMap (); 30 31 34 public static final LongConfigParam MAX_MEMORY = 35 new LongConfigParam("je.maxMemory", 36 null, null, new Long (0), true, false, "# 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 (1), new Integer (90), new Integer (60), true, false, "# 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, false, false, "# 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, false, false, "# 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, true, false, "# If true, starts up the INCompressor.\n" + 84 "# This parameter is true by default"); 85 86 87 public static final BooleanConfigParam ENV_RUN_EVICTOR = 88 new BooleanConfigParam("je.env.runEvictor", 89 false, true, false, "# 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, true, false, "# 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, true, false, "# 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 (0), new Integer (Integer.MAX_VALUE), new Integer (0), true, false, "# 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 (0), new Integer (Integer.MAX_VALUE), new Integer (0), true, false, "# 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 (1000), new Long (Long.MAX_VALUE), new Long (1000), true, false, "# 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, false, false, "# 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, false, false, "# 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, false, false, "# If true, create the environment w/ transactions."); 171 172 public static final BooleanConfigParam ENV_INIT_LOCKING = 173 new BooleanConfigParam("je.env.isLocking", 174 true, false, false, "# If true, create the environment with locking."); 178 179 public static final BooleanConfigParam ENV_RDONLY = 180 new BooleanConfigParam("je.env.isReadOnly", 181 false, false, false, "# If true, create the environment read only."); 185 186 public static final BooleanConfigParam ENV_FAIR_LATCHES = 187 new BooleanConfigParam("je.env.fairLatches", 188 false, false, false, "# 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, false, false, "# 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 (0), new Integer (1 << 20), new Integer (0), true, false, "# 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 228 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 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 (LOG_MEM_SIZE_MIN), null, new Long (0), false, false, "# 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 (2), null, new Integer (NUM_LOG_BUFFERS_DEFAULT), false, false, "# 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 (1<<10), null, new Integer (1<<20), false, false, "# 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 (32), null, new Integer (2048), false, false, "# 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 (128), null, new Integer (8192), false, false, "# 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 (128), null, new Integer (16777216), false, false, "# 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 (1000000), new Long (4294967296L), new Long (10000000), false, false, "# 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, false, false, "# 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, false, false, "# 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 (3), null, new Integer (100), false, false, "# 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 (10000L), null, new Long (500000L), false, false, "# 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, false, false, "# 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, false, false, "# 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 (0L), new Long (1 << 26), new Long (0L), false, false, "# 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, false, false, "# 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 382 public static final IntConfigParam NODE_MAX = 383 new IntConfigParam("je.nodeMaxEntries", 384 new Integer (4), new Integer (32767), new Integer (128), false, false, "# 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 (4), new Integer (32767), new Integer (128), false, false, "# 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 (0), new Integer (100), new Integer (10), false, false, "# 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 (0), new Integer (75), new Integer (25), false, false, "# If less than this percentage of entries are changed on a BIN,\n" + 419 "# logs a delta instead of a full version."); 420 421 424 public static final LongConfigParam COMPRESSOR_WAKEUP_INTERVAL = 425 new LongConfigParam("je.compressor.wakeupInterval", 426 new Long (1000000), new Long (4294967296L), new Long (5000000), false, false, "# The compressor wakeup interval in microseconds."); 432 433 public static final IntConfigParam COMPRESSOR_RETRY = 434 new IntConfigParam("je.compressor.deadlockRetry", 435 new Integer (0), new Integer (Integer.MAX_VALUE), new Integer (3), false, false, "# 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 (0), new Long (4294967296L), new Long (500000L), false, false, "# 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, false, false, "# If true, when the compressor encounters an empty tree, the root\n" + 457 "# node of the tree is deleted."); 458 459 462 public static final LongConfigParam EVICTOR_EVICT_BYTES = 463 new LongConfigParam("je.evictor.evictBytes", 464 new Long (1024), null, new Long (524288), false, false, "# 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 474 public static final IntConfigParam EVICTOR_USEMEM_FLOOR = 475 new IntConfigParam("je.evictor.useMemoryFloor", 476 new Integer (50), new Integer (100), new Integer (95), false, false, "# 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 486 public static final IntConfigParam EVICTOR_NODE_SCAN_PERCENTAGE = 487 new IntConfigParam("je.evictor.nodeScanPercentage", 488 new Integer (1), new Integer (100), new Integer (10), false, false, "# The evictor percentage of total nodes to scan per wakeup.\n" + 494 "# (deprecated in favor of je.evictor.nodesPerScan"); 495 496 497 public static final 498 IntConfigParam EVICTOR_EVICTION_BATCH_PERCENTAGE = 499 new IntConfigParam("je.evictor.evictionBatchPercentage", 500 new Integer (1), new Integer (100), new Integer (10), false, false, "# 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 (1), new Integer (1000), new Integer (10), false, false, "# The number of nodes in one evictor scan"); 516 517 518 public static final 519 IntConfigParam EVICTOR_CRITICAL_PERCENTAGE = 520 new IntConfigParam("je.evictor.criticalPercentage", 521 new Integer (0), new Integer (1000), new Integer (0), false, false, "# 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 (0), new Integer (Integer.MAX_VALUE), new Integer (3), false, false, "# 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, false, false, "# 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 550 public static final LongConfigParam CHECKPOINTER_BYTES_INTERVAL = 551 new LongConfigParam("je.checkpointer.bytesInterval", 552 new Long (0), new Long (Long.MAX_VALUE), new Long (20000000), false, false, "# 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 (1000000), new Long (4294967296L), new Long (0), false, false, "# 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 (0), new Integer (Integer.MAX_VALUE), new Integer (3), false, false, "# The number of times to retry a checkpoint if it runs into a deadlock."); 580 583 public static final IntConfigParam CLEANER_MIN_UTILIZATION = 584 new IntConfigParam("je.cleaner.minUtilization", 585 new Integer (0), new Integer (90), new Integer (50), true, false, "# 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 (0), new Integer (50), new Integer (5),
|