CUBRID Engine  latest
log_comm.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef _LOG_COMM_H_
20 #define _LOG_COMM_H_
21 
22 #ident "$Id$"
23 
24 #include "dbtran_def.h"
25 #include "storage_common.h"
26 
27 #include <stdio.h>
28 
29 #define TRAN_LOCK_INFINITE_WAIT (-1)
30 
31 #define TIME_SIZE_OF_DUMP_LOG_INFO 30
32 
33 /*
34  * STATES OF TRANSACTIONS
35  */
36 typedef enum
37 {
38  TRAN_RECOVERY, /* State of a system transaction which is used for recovery purposes. For example , set
39  * lock for damaged pages. */
40  TRAN_ACTIVE, /* Active transaction */
41  TRAN_UNACTIVE_COMMITTED, /* Transaction is in the commit process or has been committed */
42  TRAN_UNACTIVE_WILL_COMMIT, /* Transaction will be committed */
43  TRAN_UNACTIVE_COMMITTED_WITH_POSTPONE, /* Transaction has been committed, but it is still executing postpone
44  * operations */
45  TRAN_UNACTIVE_TOPOPE_COMMITTED_WITH_POSTPONE, /* In the process of executing postpone top system operations */
46  TRAN_UNACTIVE_ABORTED, /* Transaction is in the abort process or has been aborted */
47  TRAN_UNACTIVE_UNILATERALLY_ABORTED, /* Transaction was active a the time of a system crash. The transaction is
48  * unilaterally aborted by the system */
49  TRAN_UNACTIVE_2PC_PREPARE, /* Local part of the distributed transaction is ready to commit. (It will not be
50  * unilaterally aborted by the system) */
51 
52  TRAN_UNACTIVE_2PC_COLLECTING_PARTICIPANT_VOTES, /* First phase of 2PC protocol. Transaction is collecting votes
53  * from participants */
54 
55  TRAN_UNACTIVE_2PC_ABORT_DECISION, /* Second phase of 2PC protocol. Transaction needs to be aborted both locally
56  * and globally. */
57 
58  TRAN_UNACTIVE_2PC_COMMIT_DECISION, /* Second phase of 2PC protocol. Transaction needs to be committed both locally
59  * and globally. */
60 
61  TRAN_UNACTIVE_COMMITTED_INFORMING_PARTICIPANTS, /* Transaction has been committed, and it is informing
62  * participants about the decision. */
63  TRAN_UNACTIVE_ABORTED_INFORMING_PARTICIPANTS, /* Transaction has been aborted, and it is informing participants about
64  * the decision. */
65 
66  TRAN_UNACTIVE_UNKNOWN /* Unknown state. */
67 } TRAN_STATE;
68 
69 /*
70  * RESULT OF NESTED TOP OPERATION
71  */
72 
73 typedef enum
74 {
79 
80 /* name used by the internal modules */
82 
83 extern const int LOG_MIN_NBUFFERS;
84 
85 extern const char *log_state_string (TRAN_STATE state);
86 extern const char *log_state_short_string (TRAN_STATE state);
87 extern const char *log_isolation_string (TRAN_ISOLATION isolation);
88 extern int log_dump_log_info (const char *logname_info, bool also_stdout, const char *fmt, ...);
89 extern bool log_does_allow_replication (void);
90 
91 #endif /* _LOG_COMM_H_ */
const char * log_state_short_string(TRAN_STATE state)
Definition: log_comm.c:152
DB_TRAN_ISOLATION TRAN_ISOLATION
Definition: log_comm.h:81
const char * log_state_string(TRAN_STATE state)
Definition: log_comm.c:125
DB_TRAN_ISOLATION
Definition: dbtran_def.h:26
int log_dump_log_info(const char *logname_info, bool also_stdout, const char *fmt,...)
Definition: log_comm.c:205
bool log_does_allow_replication(void)
Definition: log_comm.c:270
const int LOG_MIN_NBUFFERS
Definition: log_comm.c:113
const char * log_isolation_string(TRAN_ISOLATION isolation)
Definition: log_comm.c:176
TRAN_STATE
Definition: log_comm.h:36
LOG_RESULT_TOPOP
Definition: log_comm.h:73