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.dbi;
9 
10 /**
11  * @see com.sleepycat.je.EnvironmentFailureException
12  */
13 public enum EnvironmentFailureReason {
14 
15     ENV_LOCKED
16         (false /*invalidates*/,
17          "The je.lck file could not be locked."),
18     ENV_NOT_FOUND
19         (false /*invalidates*/,
20          "EnvironmentConfig.setAllowCreate is false so environment " +
21          "creation is not permitted, but there are no log files in the " +
22          "environment directory."),
23     FOUND_COMMITTED_TXN
24         (true /*invalidates*/,
25          "One committed transaction has been found after a corrupted " +
26          "log entry. The recovery process has been stopped, and the user " +
27          "may need to run DbTruncateLog to truncate the log. Some valid " +
28          "data may be lost if the log file is truncated for recovery."),
29     HANDSHAKE_ERROR
30         (true /*invalidates*/,
31          "Error during the handshake between two nodes. " +
32          "Some validity or compatibility check failed, " +
33          "preventing further communication between the nodes."),
34     HARD_RECOVERY
35         (true /*invalidates*/,
36          "Rolled back past transaction commit or abort. Must run recovery by" +
37          " re-opening Environment handles"),
38     JAVA_ERROR
39         (true /*invalidates*/,
40          "Java Error occurred, recovery may not be possible."),
41     LATCH_ALREADY_HELD
42         (false /*invalidates*/,
43          "Attempt to acquire a latch that is already held, " +
44          "may cause a hard deadlock."),
45     LATCH_NOT_HELD
46         (false /*invalidates*/,
47          "Attempt to release a latch that is not currently not held, " +
48          "may indicate a thread safety problem."),
49     LISTENER_EXCEPTION
50         (true, /* invalidates. */
51          "An exception was thrown from an application supplied Listener."),
52     LOG_CHECKSUM
53         (true /*invalidates*/,
54          "Checksum invalid on read, log is likely invalid."),
55     LOG_FILE_NOT_FOUND
56         (true /*invalidates*/,
57          "Log file missing, log is likely invalid."),
58     LOG_INCOMPLETE
59         (true /*invalidates*/,
60          "Transaction logging is incomplete, replica is invalid."),
61     LOG_INTEGRITY
62         (false /*invalidates*/,
63          "Log information is incorrect, problem is likely persistent."),
64     LOG_READ
65         (true /*invalidates*/,
66          "IOException on read, log is likely invalid."),
67     INSUFFICIENT_LOG
68         (true /*invalidates*/,
69          "Log files at this node are obsolete."),
70     LOG_WRITE
71         (true /*invalidates*/,
72          "IOException on write, log is likely incomplete."),
73     MASTER_TO_REPLICA_TRANSITION
74         (true /*invalidates*/,
75          "This node was a master and must reinitialize internal state to " +
76          "become a replica. The application must close and reopen all " +
77          "Environment handles."),
78     MONITOR_REGISTRATION
79         (false /*invalidates*/,
80          "JMX JE monitor could not be registered."),
81     PROGRESS_LISTENER_HALT
82         (true /* invalidates */,
83          "A ProgressListener registered with this environment returned " +
84          "false from a call to ProgressListener.progress(), indicating that " +
85          "the environment should be closed"),
86     PROTOCOL_VERSION_MISMATCH
87         (true /*invalidates*/,
88          "Two communicating nodes could not agree on a common protocol " +
89          "version."),
90     ROLLBACK_PROHIBITED
91         (true /*invalidates*/,
92          "Node would like to roll back past committed transactions, but " +
93          "would exceed the limit specified by je.rep.txnRollbackLimit. " +
94          "Manual intervention required."),
95     SHUTDOWN_REQUESTED
96         (true /*invalidates*/,
97         "The Replica was shutdown via a remote shutdown request."),
98     TEST_INVALIDATE
99         (true /*invalidates*/,
100          "Test program invalidated the environment."),
101     THREAD_INTERRUPTED
102         (true /*invalidates*/,
103          "InterruptedException may cause incorrect internal state, " +
104          "unable to continue."),
105     UNCAUGHT_EXCEPTION
106         (true /*invalidates*/,
107          "Uncaught Exception in internal thread, unable to continue."),
108     UNEXPECTED_EXCEPTION
109         (false /*invalidates*/,
110          "Unexpected internal Exception, may have side effects."),
111     UNEXPECTED_EXCEPTION_FATAL
112         (true /*invalidates*/,
113          "Unexpected internal Exception, unable to continue."),
114     UNEXPECTED_STATE
115         (false /*invalidates*/,
116          "Unexpected internal state, may have side effects."),
117     UNEXPECTED_STATE_FATAL
118         (true /*invalidates*/,
119          "Unexpected internal state, unable to continue."),
120     VERSION_MISMATCH
121         (false /*invalidates*/,
122          "The existing log was written with a version of JE that is " +
123          "later than the running version of JE, the log cannot be read.");
124 
125     private final boolean invalidates;
126     private final String description;
127 
EnvironmentFailureReason(boolean invalidates, String description)128     private EnvironmentFailureReason(boolean invalidates, String description) {
129         this.invalidates = invalidates;
130         this.description = description;
131     }
132 
invalidatesEnvironment()133     public boolean invalidatesEnvironment() {
134         return invalidates;
135     }
136 
137     @Override
toString()138     public String toString() {
139         return super.toString() + ": " + description;
140     }
141 }
142