Drizzled Public API Documentation

read0read.h File Reference
#include "univ.i"
#include "ut0byte.h"
#include "ut0lst.h"
#include "trx0trx.h"
#include "read0types.h"

Go to the source code of this file.

Classes

struct  read_view_struct
struct  cursor_view_struct

Macros

#define read0read_h
#define VIEW_NORMAL   1
#define VIEW_HIGH_GRANULARITY   2

Functions

UNIV_INTERN read_view_tread_view_open_now (trx_id_t cr_trx_id, mem_heap_t *heap)
UNIV_INTERN read_view_tread_view_oldest_copy_or_open_new (trx_id_t cr_trx_id, mem_heap_t *heap)
UNIV_INTERN void read_view_close (read_view_t *view)
UNIV_INTERN void read_view_close_for_mysql (trx_t *trx)
UNIV_INLINE ibool read_view_sees_trx_id (const read_view_t *view, trx_id_t trx_id)
UNIV_INTERN void read_view_print (const read_view_t *view)
UNIV_INTERN cursor_view_tread_cursor_view_create_for_mysql (trx_t *cr_trx)
UNIV_INTERN void read_cursor_view_close_for_mysql (trx_t *trx, cursor_view_t *curview)
UNIV_INTERN void read_cursor_set_for_mysql (trx_t *trx, cursor_view_t *curview)

Detailed Description

Cursor read

Created 2/16/1997 Heikki Tuuri

Definition in file read0read.h.


Macro Definition Documentation

#define VIEW_HIGH_GRANULARITY   2

High-granularity read view where transaction does not see changes made by active transactions and own changes after a point in time when this read view was created.

Definition at line 168 of file read0read.h.

Referenced by read_cursor_view_create_for_mysql(), read_view_print(), and row_vers_build_for_consistent_read().

#define VIEW_NORMAL   1

Read view types Normal consistent read view where transaction does not see changes made by active transactions except creating transaction.

Definition at line 164 of file read0read.h.

Referenced by read_view_open_now().


Function Documentation

UNIV_INTERN void read_cursor_set_for_mysql ( trx_t trx,
cursor_view_t curview 
)

This function sets a given consistent cursor view to a transaction read view if given consistent cursor view is not NULL. Otherwise, function restores a global read view to a transaction read view. in: consistent cursor view to be set

This function sets a given consistent cursor view to a transaction read view if given consistent cursor view is not NULL. Otherwise, function restores a global read view to a transaction read view.

Parameters:
trxin: transaction where cursor is set
curviewin: consistent cursor view to be set

Definition at line 512 of file read0read.cc.

References read_cursor_set_for_mysql(), cursor_view_struct::read_view, trx_struct::read_view, and ut_a.

Referenced by read_cursor_set_for_mysql().

UNIV_INTERN void read_cursor_view_close_for_mysql ( trx_t trx,
cursor_view_t curview 
)

Close a given consistent cursor view for mysql and restore global read view back to a transaction read view. in: cursor view to be closed

Close a given consistent cursor view for mysql and restore global read view back to a transaction read view.

Parameters:
trxin: trx
curviewin: cursor view to be closed

Definition at line 484 of file read0read.cc.

References cursor_view_struct::heap, mem_heap_free, read_cursor_view_close_for_mysql(), cursor_view_struct::read_view, trx_struct::read_view, read_view_close(), and ut_a.

Referenced by read_cursor_view_close_for_mysql().

UNIV_INTERN cursor_view_t* read_cursor_view_create_for_mysql ( trx_t cr_trx)

Create a consistent cursor view for mysql to be used in cursors. In this consistent read view modifications done by the creating transaction or future transactions are not visible. in: trx where cursor view is created

Create a high-granularity consistent cursor view for mysql to be used in cursors. In this consistent read view modifications done by the creating transaction after the cursor is created or future transactions are not visible.

Parameters:
cr_trxin: trx where cursor view is created

Definition at line 399 of file read0read.cc.

References trx_struct::conc_state, read_view_struct::creator_trx_id, cursor_view_struct::heap, trx_struct::id, read_view_struct::low_limit_id, read_view_struct::low_limit_no, trx_sys_struct::max_trx_id, mem_heap_alloc(), mem_heap_create, read_view_struct::n_trx_ids, trx_struct::no, read_cursor_view_create_for_mysql(), cursor_view_struct::read_view, trx_sys, read_view_struct::type, read_view_struct::undo_no, trx_struct::undo_no, read_view_struct::up_limit_id, ut_a, UT_LIST_ADD_FIRST, UT_LIST_GET_FIRST, UT_LIST_GET_LEN, UT_LIST_GET_NEXT, and VIEW_HIGH_GRANULARITY.

Referenced by read_cursor_view_create_for_mysql().

UNIV_INTERN void read_view_close ( read_view_t view)

Closes a read view. in: read view

Closes a read view.

Parameters:
viewin: read view

Definition at line 322 of file read0read.cc.

References read_view_close(), trx_sys, ut_ad, and UT_LIST_REMOVE.

Referenced by read_cursor_view_close_for_mysql(), read_view_close(), read_view_close_for_mysql(), trx_commit_off_kernel(), trx_purge(), and trx_purge_sys_close().

UNIV_INTERN void read_view_close_for_mysql ( trx_t trx)

Closes a consistent read view for MySQL. This function is called at an SQL statement end if the trx isolation level is <= TRX_ISO_READ_COMMITTED. in: trx which has a read view

Closes a consistent read view for MySQL. This function is called at an SQL statement end if the trx isolation level is <= TRX_ISO_READ_COMMITTED.

Parameters:
trxin: trx which has a read view

Definition at line 336 of file read0read.cc.

References mem_heap_empty(), trx_struct::read_view, read_view_close(), read_view_close_for_mysql(), and ut_a.

Referenced by InnobaseEngine::doCommit(), InnobaseEngine::doRollback(), and read_view_close_for_mysql().

UNIV_INTERN read_view_t* read_view_oldest_copy_or_open_new ( trx_id_t  cr_trx_id,
mem_heap_t heap 
)

Makes a copy of the oldest existing read view, or opens a new. The view must be closed with ..._close.

Returns:
own: read view struct in: memory heap from which allocated

Makes a copy of the oldest existing read view, with the exception that also the creating trx of the oldest view is set as not visible in the 'copied' view. Opens a new view if no views currently exist. The view must be closed with ..._close. This is used in purge.

Returns:
own: read view struct
Parameters:
cr_trx_idin: trx_id of creating transaction, or 0 used in purge
heapin: memory heap from which allocated

Definition at line 168 of file read0read.cc.

References read_view_struct::creator_trx_id, read_view_struct::low_limit_id, read_view_struct::low_limit_no, read_view_struct::n_trx_ids, read_view_oldest_copy_or_open_new(), read_view_open_now(), trx_sys, read_view_struct::up_limit_id, ut_ad, UT_LIST_ADD_LAST, and UT_LIST_GET_LAST.

Referenced by read_view_oldest_copy_or_open_new(), trx_purge(), and trx_purge_sys_create().

UNIV_INTERN read_view_t* read_view_open_now ( trx_id_t  cr_trx_id,
mem_heap_t heap 
)

Opens a read view where exactly the transactions serialized before this point in time are seen in the view.

Returns:
own: read view struct in: memory heap from which allocated

Opens a read view where exactly the transactions serialized before this point in time are seen in the view.

Returns:
own: read view struct
Parameters:
cr_trx_idin: trx_id of creating transaction, or 0 used in purge
heapin: memory heap from which allocated

Definition at line 250 of file read0read.cc.

References trx_struct::conc_state, read_view_struct::creator_trx_id, trx_struct::id, read_view_struct::low_limit_id, read_view_struct::low_limit_no, trx_sys_struct::max_trx_id, read_view_struct::n_trx_ids, trx_struct::no, read_view_open_now(), trx_sys, read_view_struct::type, read_view_struct::undo_no, read_view_struct::up_limit_id, ut_ad, UT_LIST_ADD_FIRST, UT_LIST_GET_FIRST, UT_LIST_GET_LEN, UT_LIST_GET_NEXT, and VIEW_NORMAL.

Referenced by read_view_oldest_copy_or_open_new(), read_view_open_now(), row_search_check_if_query_cache_permitted(), and trx_assign_read_view().

UNIV_INTERN void read_view_print ( const read_view_t view)

Prints a read view to stderr. in: read view

Prints a read view to stderr.

Parameters:
viewin: read view

Definition at line 358 of file read0read.cc.

References read_view_struct::low_limit_id, read_view_struct::low_limit_no, read_view_struct::n_trx_ids, read_view_print(), TRX_ID_FMT, read_view_struct::type, read_view_struct::undo_no, read_view_struct::up_limit_id, and VIEW_HIGH_GRANULARITY.

Referenced by read_view_print(), and trx_purge_sys_print().

UNIV_INLINE ibool read_view_sees_trx_id ( const read_view_t view,
trx_id_t  trx_id 
)

Checks if a read view sees the specified transaction.

Returns:
TRUE if sees in: trx id
Parameters:
viewin: read view

Referenced by lock_clust_rec_cons_read_sees(), row_vers_build_for_consistent_read(), and trx_purge_update_undo_must_exist().