CUBRID Engine  latest
transaction_cl.c File Reference
#include "config.h"
#include <unistd.h>
#include <stdio.h>
#include <sys/param.h>
#include "dbi.h"
#include "misc_string.h"
#include "transaction_cl.h"
#include "memory_alloc.h"
#include "locator_cl.h"
#include "work_space.h"
#include "server_interface.h"
#include "log_comm.h"
#include "log_lsa.hpp"
#include "db_query.h"
#include "boot_cl.h"
#include "virtual_object.h"
#include "schema_manager.h"
#include "trigger_manager.h"
#include "system_parameter.h"
#include "db.h"
#include "porting.h"
#include "network_interface_cl.h"
#include "tcp.h"

Go to the source code of this file.

Enumerations

enum  LATEST_QUERY_STATUS {
  NONE = 0, ABORTED = 0x1000, QUERY_ENDED = 0x100, COMMITTED = 0x10,
  RESET_REQUIRED = 0x1
}
 

Functions

static int tran_add_savepoint (const char *savept_name)
 
static void tran_free_list_upto_savepoint (const char *savept_name)
 
void tran_cache_tran_settings (int tran_index, int lock_timeout, TRAN_ISOLATION tran_isolation)
 
void tran_get_tran_settings (int *lock_wait_in_msecs, TRAN_ISOLATION *tran_isolation, bool *async_ws)
 
int tran_reset_wait_times (int wait_in_msecs)
 
int tran_reset_isolation (TRAN_ISOLATION isolation, bool async_ws)
 
int tran_flush_to_commit (void)
 
int tran_commit (bool retain_lock)
 
int tran_abort (void)
 
int tran_unilaterally_abort (void)
 
int tran_abort_only_client (bool is_server_down)
 
bool tran_has_updated (void)
 
bool tran_is_active_and_has_updated (void)
 
int tran_set_global_tran_info (int gtrid, void *info, int size)
 
int tran_get_global_tran_info (int gtrid, void *buffer, int size)
 
int tran_2pc_start (void)
 
int tran_2pc_prepare (void)
 
int tran_2pc_recovery_prepared (int gtrids[], int size)
 
int tran_2pc_attach_global_tran (int gtrid)
 
int tran_2pc_prepare_global_tran (int gtrid)
 
void tran_free_savepoint_list (void)
 
int tran_system_savepoint (const char *savept_name)
 
int tran_savepoint_internal (const char *savept_name, SAVEPOINT_TYPE savepoint_type)
 
int tran_abort_upto_system_savepoint (const char *savepoint_name)
 
int tran_abort_upto_user_savepoint (const char *savepoint_name)
 
int tran_internal_abort_upto_savepoint (const char *savepoint_name, SAVEPOINT_TYPE savepoint_type, bool client_decache_all_but_norealclasses)
 
static UINT64 tran_current_timemillis (void)
 
void tran_set_query_timeout (int query_timeout)
 
int tran_get_query_timeout (void)
 
void tran_begin_libcas_function (void)
 
void tran_end_libcas_function (void)
 
bool tran_is_in_libcas (void)
 
bool tran_set_check_interrupt (bool flag)
 
bool tran_get_check_interrupt (void)
 
void tran_set_latest_query_status (int end_query_result, int tran_state, int should_conn_reset)
 
void tran_reset_latest_query_status (void)
 
bool tran_was_latest_query_ended (void)
 
bool tran_was_latest_query_committed (void)
 
bool tran_was_latest_query_aborted (void)
 
bool tran_is_reset_required (void)
 

Variables

int tm_Tran_index = NULL_TRAN_INDEX
 
TRAN_ISOLATION tm_Tran_isolation = TRAN_UNKNOWN_ISOLATION
 
bool tm_Tran_async_ws = false
 
int tm_Tran_wait_msecs = TRAN_LOCK_INFINITE_WAIT
 
bool tm_Tran_check_interrupt = false
 
int tm_Tran_ID = -1
 
int tm_Tran_invalidate_snapshot = 1
 
LOCK tm_Tran_rep_read_lock = NULL_LOCK
 
LC_FETCH_VERSION_TYPE tm_Tran_read_fetch_instance_version = LC_FETCH_MVCC_VERSION
 
int tm_Tran_latest_query_status
 
static UINT64 tm_Query_begin = 0
 
static int tm_Query_timeout = 0
 
static bool tm_Is_libcas = false
 
static DB_NAMELISTuser_savepoint_list = NULL
 
bool tm_Use_OID_preflush = true
 

Enumeration Type Documentation

Enumerator
NONE 
ABORTED 
QUERY_ENDED 
COMMITTED 
RESET_REQUIRED 

Definition at line 1366 of file transaction_cl.c.

Function Documentation

int tran_2pc_attach_global_tran ( int  gtrid)

Definition at line 840 of file transaction_cl.c.

References assert, er_errid(), NO_ERROR, NULL_TRAN_INDEX, tm_Tran_index, and tran_server_2pc_attach_global_tran().

Referenced by db_2pc_attach_transaction().

Here is the caller graph for this function:

int tran_2pc_recovery_prepared ( int  gtrids[],
int  size 
)

Definition at line 819 of file transaction_cl.c.

References tran_server_2pc_recovery_prepared().

Referenced by db_2pc_prepared_transactions().

Here is the caller graph for this function:

int tran_2pc_start ( void  )

Definition at line 697 of file transaction_cl.c.

References tran_server_2pc_start().

Referenced by db_2pc_start_transaction().

Here is the caller graph for this function:

int tran_abort_upto_user_savepoint ( const char *  savepoint_name)

Definition at line 1161 of file transaction_cl.c.

References tran_free_list_upto_savepoint(), tran_internal_abort_upto_savepoint(), and USER_SAVEPOINT.

Referenced by db_abort_to_savepoint_internal().

Here is the caller graph for this function:

static int tran_add_savepoint ( const char *  savept_name)
static

Definition at line 973 of file transaction_cl.c.

References assert, db_ws_alloc(), db_ws_free(), er_errid(), db_namelist::name, db_namelist::next, NO_ERROR, NULL, user_savepoint_list, and ws_copy_string().

Referenced by tran_savepoint_internal().

Here is the caller graph for this function:

void tran_begin_libcas_function ( void  )

Definition at line 1315 of file transaction_cl.c.

References tm_Is_libcas.

Referenced by jsp_receive_response(), and jsp_send_destroy_request().

Here is the caller graph for this function:

void tran_cache_tran_settings ( int  tran_index,
int  lock_timeout,
TRAN_ISOLATION  tran_isolation 
)

Definition at line 121 of file transaction_cl.c.

References db_Connect_status, DB_CONNECTION_STATUS_NOT_CONNECTED, NULL_TRAN_INDEX, tm_Tran_index, tm_Tran_isolation, and tm_Tran_wait_msecs.

Referenced by boot_client(), and logpb_fatal_error_internal().

Here is the caller graph for this function:

static UINT64 tran_current_timemillis ( void  )
static

Definition at line 1261 of file transaction_cl.c.

References NULL.

Referenced by tran_get_query_timeout(), and tran_set_query_timeout().

Here is the caller graph for this function:

void tran_end_libcas_function ( void  )

Definition at line 1325 of file transaction_cl.c.

References tm_Is_libcas.

Referenced by jsp_receive_response(), and jsp_send_destroy_request().

Here is the caller graph for this function:

int tran_flush_to_commit ( void  )
static void tran_free_list_upto_savepoint ( const char *  savept_name)
static

Definition at line 1024 of file transaction_cl.c.

References db_ws_free(), intl_mbs_casecmp(), db_namelist::name, and db_namelist::next.

Referenced by tran_abort_upto_user_savepoint().

Here is the caller graph for this function:

void tran_free_savepoint_list ( void  )

Definition at line 1007 of file transaction_cl.c.

References nlist_free(), and NULL.

Referenced by boot_client_all_finalize(), boot_initialize_client(), boot_restart_client(), tran_abort(), and tran_commit().

Here is the caller graph for this function:

bool tran_get_check_interrupt ( void  )

Definition at line 1361 of file transaction_cl.c.

References tm_Tran_check_interrupt.

Referenced by logtb_get_check_interrupt().

Here is the caller graph for this function:

int tran_get_global_tran_info ( int  gtrid,
void *  buffer,
int  size 
)

Definition at line 669 of file transaction_cl.c.

References assert, er_errid(), NO_ERROR, and tran_server_get_global_tran_info().

Referenced by db_get_global_transaction_info().

Here is the caller graph for this function:

int tran_get_query_timeout ( void  )

Definition at line 1290 of file transaction_cl.c.

References tm_Query_begin, tm_Query_timeout, and tran_current_timemillis().

Referenced by execute_query(), and prepare_and_execute_query().

Here is the caller graph for this function:

void tran_get_tran_settings ( int *  lock_wait_in_msecs,
TRAN_ISOLATION tran_isolation,
bool async_ws 
)

Definition at line 148 of file transaction_cl.c.

References TM_TRAN_ASYNC_WS, TM_TRAN_ISOLATION, and TM_TRAN_WAIT_MSECS.

Referenced by ci_conn_get_option_impl(), db_get_tran_settings(), do_get_xaction(), set_iso_level(), and ux_get_tran_setting().

Here is the caller graph for this function:

bool tran_has_updated ( void  )

Definition at line 603 of file transaction_cl.c.

References tran_server_has_updated(), and ws_has_updated().

Referenced by db_commit_is_needed(), and tran_internal_abort_upto_savepoint().

Here is the caller graph for this function:

bool tran_is_active_and_has_updated ( void  )

Definition at line 618 of file transaction_cl.c.

References tran_server_is_active_and_has_updated(), and ws_has_updated().

Referenced by boot_shutdown_client().

Here is the caller graph for this function:

bool tran_is_in_libcas ( void  )

Definition at line 1335 of file transaction_cl.c.

References tm_Is_libcas.

Referenced by set_query_timeout().

Here is the caller graph for this function:

bool tran_is_reset_required ( void  )

Definition at line 1467 of file transaction_cl.c.

References RESET_REQUIRED, and tm_Tran_latest_query_status.

Referenced by tran_commit().

Here is the caller graph for this function:

int tran_reset_isolation ( TRAN_ISOLATION  isolation,
bool  async_ws 
)
void tran_reset_latest_query_status ( void  )

Definition at line 1427 of file transaction_cl.c.

References NONE, and tm_Tran_latest_query_status.

Referenced by db_reset_latest_query_status(), tran_abort(), tran_commit(), and tran_set_latest_query_status().

Here is the caller graph for this function:

int tran_savepoint_internal ( const char *  savept_name,
SAVEPOINT_TYPE  savepoint_type 
)
bool tran_set_check_interrupt ( bool  flag)

Definition at line 1346 of file transaction_cl.c.

References tm_Tran_check_interrupt.

Referenced by logtb_set_check_interrupt().

Here is the caller graph for this function:

int tran_set_global_tran_info ( int  gtrid,
void *  info,
int  size 
)

Definition at line 639 of file transaction_cl.c.

References assert, er_errid(), NO_ERROR, and tran_server_set_global_tran_info().

Referenced by db_set_global_transaction_info().

Here is the caller graph for this function:

void tran_set_latest_query_status ( int  end_query_result,
int  tran_state,
int  should_conn_reset 
)
void tran_set_query_timeout ( int  query_timeout)

Definition at line 1279 of file transaction_cl.c.

References query_timeout, tm_Query_begin, tm_Query_timeout, and tran_current_timemillis().

Referenced by chksum_start(), and set_query_timeout().

Here is the caller graph for this function:

bool tran_was_latest_query_aborted ( void  )

Definition at line 1457 of file transaction_cl.c.

References ABORTED, and tm_Tran_latest_query_status.

Referenced by do_commit_after_execute(), do_execute_statement(), do_statement(), tran_abort(), tran_commit(), and ux_auto_commit().

Here is the caller graph for this function:

bool tran_was_latest_query_ended ( void  )

Definition at line 1437 of file transaction_cl.c.

References QUERY_ENDED, and tm_Tran_latest_query_status.

Referenced by db_query_end(), do_execute_merge(), do_merge(), pt_end_query(), tran_abort(), and tran_commit().

Here is the caller graph for this function:

Variable Documentation

bool tm_Is_libcas = false
static
UINT64 tm_Query_begin = 0
static

Definition at line 91 of file transaction_cl.c.

Referenced by tran_get_query_timeout(), and tran_set_query_timeout().

int tm_Query_timeout = 0
static

Definition at line 92 of file transaction_cl.c.

Referenced by tran_get_query_timeout(), and tran_set_query_timeout().

bool tm_Tran_async_ws = false

Definition at line 68 of file transaction_cl.c.

Referenced by tran_reset_isolation().

bool tm_Tran_check_interrupt = false

Definition at line 70 of file transaction_cl.c.

Referenced by tran_get_check_interrupt(), and tran_set_check_interrupt().

int tm_Tran_ID = -1

Definition at line 71 of file transaction_cl.c.

Definition at line 67 of file transaction_cl.c.

Referenced by tran_cache_tran_settings(), and tran_reset_isolation().

LC_FETCH_VERSION_TYPE tm_Tran_read_fetch_instance_version = LC_FETCH_MVCC_VERSION

Definition at line 78 of file transaction_cl.c.

Referenced by db_set_read_fetch_instance_version().

int tm_Tran_wait_msecs = TRAN_LOCK_INFINITE_WAIT

Definition at line 69 of file transaction_cl.c.

Referenced by tran_cache_tran_settings(), and tran_reset_wait_times().

bool tm_Use_OID_preflush = true

Definition at line 226 of file transaction_cl.c.

Referenced by do_execute_select(), ldr_init_loader(), and tran_flush_to_commit().

DB_NAMELIST* user_savepoint_list = NULL
static

Definition at line 102 of file transaction_cl.c.

Referenced by tran_add_savepoint().