Enum Class DurabilityMode

java.lang.Object
java.lang.Enum<DurabilityMode>
org.cojen.tupl.DurabilityMode
All Implemented Interfaces:
Serializable, Comparable<DurabilityMode>, Constable

public enum DurabilityMode extends Enum<DurabilityMode>
Various transaction durability modes, which control the durability strength of committed transactions. Strong modes offer safety, but they are also relatively slow. Weak modes are faster, but transactions committed in one of these modes can get lost.

Modes ordered from strongest to weakest:

Note: When replication is enabled, the NO_SYNC mode is no stronger than the NO_FLUSH mode.

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Durability mode which writes modifications to the file system when the in-process buffer is full, or by automatic checkpoints.
    Weakest durability mode, which doesn't write anything to the redo log or replication manager.
    Durability mode which permits the operating system to lazily persist modifications to non-volatile storage.
    Strongest durability mode, which ensures all modifications are unlikely to be lost in the event of a sudden power failure or crash.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • SYNC

      public static final DurabilityMode SYNC
      Strongest durability mode, which ensures all modifications are unlikely to be lost in the event of a sudden power failure or crash. Typically this requires that all data be persisted to non-volatile storage. If the database is replicated, it might only guarantee that enough replicas have committed modifications to volatile memory, and so the sync method would also need to be called to achieve stronger durability.
    • NO_SYNC

      public static final DurabilityMode NO_SYNC
      Durability mode which permits the operating system to lazily persist modifications to non-volatile storage. This mode is vulnerable to power failures, operating system crashes, and replication failures. Any of these events can cause recently committed transactions to get lost.
    • NO_FLUSH

      public static final DurabilityMode NO_FLUSH
      Durability mode which writes modifications to the file system when the in-process buffer is full, or by automatic checkpoints. In addition to the vulnerabilities of NO_SYNC mode, NO_FLUSH mode can lose recently committed transactions when the process crashes. When the process exits cleanly, a shutdown hook switches this mode to behave like NO_SYNC and flushes the log.
    • NO_REDO

      public static final DurabilityMode NO_REDO
      Weakest durability mode, which doesn't write anything to the redo log or replication manager. An unlogged transaction does not become durable until a checkpoint is performed. In addition to the vulnerabilities of NO_FLUSH mode, NO_REDO mode can lose recently committed transactions when the process exits.
  • Method Details

    • values

      public static DurabilityMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DurabilityMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null