Commit c016a86f authored by jan's avatar jan

Remove trailing whitespaces and fix style on function comments.

parent d98d98e2
...@@ -24,10 +24,12 @@ point in time are seen in the view. */ ...@@ -24,10 +24,12 @@ point in time are seen in the view. */
read_view_t* read_view_t*
read_view_open_now( read_view_open_now(
/*===============*/ /*===============*/
/* out, own: read view struct */ /* out, own: read view struct */
dulint cr_trx_id,/* in: trx_id of creating transaction, dulint cr_trx_id, /* in: trx_id of creating
or (0, 0) used in purge */ transaction, or (0, 0) used in
mem_heap_t* heap); /* in: memory heap from which allocated */ purge */
mem_heap_t* heap); /* in: memory heap from which
allocated */
/************************************************************************* /*************************************************************************
Makes a copy of the oldest existing read view, or opens a new. The view Makes a copy of the oldest existing read view, or opens a new. The view
must be closed with ..._close. */ must be closed with ..._close. */
...@@ -35,10 +37,12 @@ must be closed with ..._close. */ ...@@ -35,10 +37,12 @@ must be closed with ..._close. */
read_view_t* read_view_t*
read_view_oldest_copy_or_open_new( read_view_oldest_copy_or_open_new(
/*==============================*/ /*==============================*/
/* out, own: read view struct */ /* out, own: read view struct */
dulint cr_trx_id,/* in: trx_id of creating transaction, dulint cr_trx_id, /* in: trx_id of creating
or (0, 0) used in purge */ transaction, or (0, 0) used in
mem_heap_t* heap); /* in: memory heap from which allocated */ purge */
mem_heap_t* heap); /* in: memory heap from which
allocated */
/************************************************************************* /*************************************************************************
Closes a read view. */ Closes a read view. */
...@@ -62,7 +66,7 @@ read_view_sees_trx_id( ...@@ -62,7 +66,7 @@ read_view_sees_trx_id(
/*==================*/ /*==================*/
/* out: TRUE if sees */ /* out: TRUE if sees */
read_view_t* view, /* in: read view */ read_view_t* view, /* in: read view */
dulint trx_id); /* in: trx id */ dulint trx_id);/* in: trx id */
/************************************************************************* /*************************************************************************
Prints a read view to stderr. */ Prints a read view to stderr. */
...@@ -155,7 +159,7 @@ struct cursor_view_struct{ ...@@ -155,7 +159,7 @@ struct cursor_view_struct{
/* Consistent read view of the cursor*/ /* Consistent read view of the cursor*/
ulint n_mysql_tables_in_use; ulint n_mysql_tables_in_use;
/* number of Innobase tables used in the /* number of Innobase tables used in the
processing of this cursor */ processing of this cursor */
}; };
#ifndef UNIV_NONINL #ifndef UNIV_NONINL
......
...@@ -19,9 +19,9 @@ Created 2/16/1997 Heikki Tuuri ...@@ -19,9 +19,9 @@ Created 2/16/1997 Heikki Tuuri
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
FACT A: Cursor read view on a secondary index sees only committed versions FACT A: Cursor read view on a secondary index sees only committed versions
------- -------
of the records in the secondary index or those versions of rows created of the records in the secondary index or those versions of rows created
by transaction which created a cursor before cursor was created even by transaction which created a cursor before cursor was created even
if transaction which created the cursor has changed that clustered index page. if transaction which created the cursor has changed that clustered index page.
PROOF: We must show that read goes always to the clustered index record PROOF: We must show that read goes always to the clustered index record
to see that record is visible in the cursor read view. Consider e.g. to see that record is visible in the cursor read view. Consider e.g.
...@@ -46,19 +46,19 @@ see record (2,2). ...@@ -46,19 +46,19 @@ see record (2,2).
We also should show that if we have delete t1 where b = 5; we still We also should show that if we have delete t1 where b = 5; we still
can see record (2,2). can see record (2,2).
When we access a secondary key record maximum transaction id is fetched When we access a secondary key record maximum transaction id is fetched
from this record and this trx_id is compared to up_limit_id in the view. from this record and this trx_id is compared to up_limit_id in the view.
If trx_id in the record is greater or equal than up_limit_id in the view If trx_id in the record is greater or equal than up_limit_id in the view
cluster record is accessed. Because trx_id of the creating cluster record is accessed. Because trx_id of the creating
transaction is stored when this view was created to the list of transaction is stored when this view was created to the list of
trx_ids not seen by this read view previous version of the trx_ids not seen by this read view previous version of the
record is requested to be built. This is build using clustered record. record is requested to be built. This is build using clustered record.
If the secondary key record is delete marked it's corresponding If the secondary key record is delete marked it's corresponding
clustered record can be already be purged only if records clustered record can be already be purged only if records
trx_id < low_limit_no. Purge can't remove any record deleted by a trx_id < low_limit_no. Purge can't remove any record deleted by a
transaction which was active when cursor was created. But, we still transaction which was active when cursor was created. But, we still
may have a deleted secondary key record but no clustered record. But, may have a deleted secondary key record but no clustered record. But,
this is not a problem because this case is handled in this is not a problem because this case is handled in
row_sel_get_clust_rec() function which is called row_sel_get_clust_rec() function which is called
whenever we note that this read view does not see trx_id in the whenever we note that this read view does not see trx_id in the
record. Thus, we see correct version. Q. E. D. record. Thus, we see correct version. Q. E. D.
...@@ -66,9 +66,9 @@ record. Thus, we see correct version. Q. E. D. ...@@ -66,9 +66,9 @@ record. Thus, we see correct version. Q. E. D.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
FACT B: Cursor read view on a clustered index sees only committed versions FACT B: Cursor read view on a clustered index sees only committed versions
------- -------
of the records in the clustered index or those versions of rows created of the records in the clustered index or those versions of rows created
by transaction which created a cursor before cursor was created even by transaction which created a cursor before cursor was created even
if transaction which created the cursor has changed that clustered index page. if transaction which created the cursor has changed that clustered index page.
PROOF: Consider e.g.following table and SQL-clauses: PROOF: Consider e.g.following table and SQL-clauses:
...@@ -92,28 +92,28 @@ We also should show that if we have execute delete t1 where a = 5; after ...@@ -92,28 +92,28 @@ We also should show that if we have execute delete t1 where a = 5; after
the cursor is opened we still can see record (2). the cursor is opened we still can see record (2).
When accessing clustered record we always check if this read view sees When accessing clustered record we always check if this read view sees
trx_id stored to clustered record. By default we don't see any changes trx_id stored to clustered record. By default we don't see any changes
if record trx_id >= low_limit_id i.e. change was made transaction if record trx_id >= low_limit_id i.e. change was made transaction
which started after transaction which created the cursor. If row which started after transaction which created the cursor. If row
was changed by the future transaction a previous version of the was changed by the future transaction a previous version of the
clustered record is created. Thus we see only committed version in clustered record is created. Thus we see only committed version in
this case. We see all changes made by committed transactions i.e. this case. We see all changes made by committed transactions i.e.
record trx_id < up_limit_id. In this case we don't need to do anything, record trx_id < up_limit_id. In this case we don't need to do anything,
we already see correct version of the record. We don't see any changes we already see correct version of the record. We don't see any changes
made by active transaction except creating transaction. We have stored made by active transaction except creating transaction. We have stored
trx_id of creating transaction to list of trx_ids when this view was trx_id of creating transaction to list of trx_ids when this view was
created. Thus we can easily see if this record was changed by the created. Thus we can easily see if this record was changed by the
creating transaction. Because we already have clustered record we can creating transaction. Because we already have clustered record we can
access roll_ptr. Using this roll_ptr we can fetch undo record. access roll_ptr. Using this roll_ptr we can fetch undo record.
We can now check that undo_no of the undo record is less than undo_no of the We can now check that undo_no of the undo record is less than undo_no of the
trancaction which created a view when cursor was created. We see this trancaction which created a view when cursor was created. We see this
clustered record only in case when record undo_no is less than undo_no clustered record only in case when record undo_no is less than undo_no
in the view. If this is not true we build based on undo_rec previous in the view. If this is not true we build based on undo_rec previous
version of the record. This record is found because purge can't remove version of the record. This record is found because purge can't remove
records accessed by active transaction. Thus we see correct version. Q. E. D. records accessed by active transaction. Thus we see correct version. Q. E. D.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
FACT C: Purge does not remove any delete marked row that is visible FACT C: Purge does not remove any delete marked row that is visible
------- -------
to cursor view. to cursor view.
TODO: proof this TODO: proof this
...@@ -149,10 +149,11 @@ with ..._close. This is used in purge. */ ...@@ -149,10 +149,11 @@ with ..._close. This is used in purge. */
read_view_t* read_view_t*
read_view_oldest_copy_or_open_new( read_view_oldest_copy_or_open_new(
/*==============================*/ /*==============================*/
/* out, own: read view struct */ /* out, own: read view struct */
dulint cr_trx_id,/* in: trx_id of creating transaction, or dulint cr_trx_id, /* in: trx_id of creating
(0, 0) used in purge*/ transaction, or (0, 0) used in purge*/
mem_heap_t* heap) /* in: memory heap from which allocated */ mem_heap_t* heap) /* in: memory heap from which
allocated */
{ {
read_view_t* old_view; read_view_t* old_view;
read_view_t* view_copy; read_view_t* view_copy;
...@@ -173,7 +174,7 @@ read_view_oldest_copy_or_open_new( ...@@ -173,7 +174,7 @@ read_view_oldest_copy_or_open_new(
n = old_view->n_trx_ids; n = old_view->n_trx_ids;
if (ut_dulint_cmp(old_view->creator_trx_id, if (ut_dulint_cmp(old_view->creator_trx_id,
ut_dulint_create(0,0)) != 0) { ut_dulint_create(0,0)) != 0) {
n++; n++;
} else { } else {
...@@ -233,10 +234,12 @@ point in time are seen in the view. */ ...@@ -233,10 +234,12 @@ point in time are seen in the view. */
read_view_t* read_view_t*
read_view_open_now( read_view_open_now(
/*===============*/ /*===============*/
/* out, own: read view struct */ /* out, own: read view struct */
dulint cr_trx_id,/* in: trx_id of creating transaction, dulint cr_trx_id, /* in: trx_id of creating
or (0, 0) used in purge */ transaction, or (0, 0) used in
mem_heap_t* heap) /* in: memory heap from which allocated */ purge */
mem_heap_t* heap) /* in: memory heap from which
allocated */
{ {
read_view_t* view; read_view_t* view;
trx_t* trx; trx_t* trx;
...@@ -264,7 +267,7 @@ read_view_open_now( ...@@ -264,7 +267,7 @@ read_view_open_now(
while (trx) { while (trx) {
if (ut_dulint_cmp(trx->id, cr_trx_id) != 0 if (ut_dulint_cmp(trx->id, cr_trx_id) != 0
&& (trx->conc_state == TRX_ACTIVE && (trx->conc_state == TRX_ACTIVE
|| trx->conc_state == TRX_PREPARED)) { || trx->conc_state == TRX_PREPARED)) {
read_view_set_nth_trx_id(view, n, trx->id); read_view_set_nth_trx_id(view, n, trx->id);
...@@ -295,7 +298,7 @@ read_view_open_now( ...@@ -295,7 +298,7 @@ read_view_open_now(
view->up_limit_id = view->low_limit_id; view->up_limit_id = view->low_limit_id;
} }
UT_LIST_ADD_FIRST(view_list, trx_sys->view_list, view); UT_LIST_ADD_FIRST(view_list, trx_sys->view_list, view);
return(view); return(view);
...@@ -348,10 +351,10 @@ read_view_print( ...@@ -348,10 +351,10 @@ read_view_print(
{ {
ulint n_ids; ulint n_ids;
ulint i; ulint i;
if (view->type == VIEW_HIGH_GRANULARITY) { if (view->type == VIEW_HIGH_GRANULARITY) {
fprintf(stderr, fprintf(stderr,
"High-granularity read view undo_n:o %lu %lu\n", "High-granularity read view undo_n:o %lu %lu\n",
(ulong) ut_dulint_get_high(view->undo_no), (ulong) ut_dulint_get_high(view->undo_no),
(ulong) ut_dulint_get_low(view->undo_no)); (ulong) ut_dulint_get_low(view->undo_no));
} else { } else {
...@@ -382,9 +385,9 @@ read_view_print( ...@@ -382,9 +385,9 @@ read_view_print(
} }
/************************************************************************* /*************************************************************************
Create a high-granularity consistent cursor view for mysql to be used Create a high-granularity consistent cursor view for mysql to be used
in cursors. In this consistent read view modifications done by the in cursors. In this consistent read view modifications done by the
creating transaction after the cursor is created or future transactions creating transaction after the cursor is created or future transactions
are not visible. */ are not visible. */
cursor_view_t* cursor_view_t*
...@@ -438,7 +441,7 @@ read_cursor_view_create_for_mysql( ...@@ -438,7 +441,7 @@ read_cursor_view_create_for_mysql(
while (trx) { while (trx) {
if (trx->conc_state == TRX_ACTIVE if (trx->conc_state == TRX_ACTIVE
|| trx->conc_state == TRX_PREPARED) { || trx->conc_state == TRX_PREPARED) {
read_view_set_nth_trx_id(view, n, trx->id); read_view_set_nth_trx_id(view, n, trx->id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment