Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
c016a86f
Commit
c016a86f
authored
Mar 02, 2006
by
jan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove trailing whitespaces and fix style on function comments.
parent
d98d98e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
68 additions
and
61 deletions
+68
-61
include/read0read.h
include/read0read.h
+14
-10
read/read0read.c
read/read0read.c
+54
-51
No files found.
include/read0read.h
View file @
c016a86f
...
...
@@ -24,10 +24,12 @@ point in time are seen in the view. */
read_view_t
*
read_view_open_now
(
/*===============*/
/* out, own: read view struct */
dulint
cr_trx_id
,
/* in: trx_id of creating transaction,
or (0, 0) used in purge */
mem_heap_t
*
heap
);
/* in: memory heap from which allocated */
/* out, own: read view struct */
dulint
cr_trx_id
,
/* in: trx_id of creating
transaction, or (0, 0) used in
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
must be closed with ..._close. */
...
...
@@ -35,10 +37,12 @@ must be closed with ..._close. */
read_view_t
*
read_view_oldest_copy_or_open_new
(
/*==============================*/
/* out, own: read view struct */
dulint
cr_trx_id
,
/* in: trx_id of creating transaction,
or (0, 0) used in purge */
mem_heap_t
*
heap
);
/* in: memory heap from which allocated */
/* out, own: read view struct */
dulint
cr_trx_id
,
/* in: trx_id of creating
transaction, or (0, 0) used in
purge */
mem_heap_t
*
heap
);
/* in: memory heap from which
allocated */
/*************************************************************************
Closes a read view. */
...
...
@@ -62,7 +66,7 @@ read_view_sees_trx_id(
/*==================*/
/* out: TRUE if sees */
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. */
...
...
@@ -155,7 +159,7 @@ struct cursor_view_struct{
/* Consistent read view of the cursor*/
ulint
n_mysql_tables_in_use
;
/* number of Innobase tables used in the
processing of this cursor */
processing of this cursor */
};
#ifndef UNIV_NONINL
...
...
read/read0read.c
View file @
c016a86f
...
...
@@ -19,9 +19,9 @@ Created 2/16/1997 Heikki Tuuri
-------------------------------------------------------------------------------
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
by transaction which created a cursor before cursor was created even
if transaction which created the cursor has changed that clustered index page.
of the records in the secondary index or those versions of rows created
by transaction which created a cursor before cursor was created even
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
to see that record is visible in the cursor read view. Consider e.g.
...
...
@@ -46,19 +46,19 @@ see record (2,2).
We also should show that if we have delete t1 where b = 5; we still
can see record (2,2).
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.
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
transaction is stored when this view was created to the list of
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.
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
transaction is stored when this view was created to the list of
trx_ids not seen by this read view previous version of the
record is requested to be built. This is build using clustered record.
If the secondary key record is delete marked it's corresponding
clustered record can be already be purged only if records
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
may have a deleted secondary key record but no clustered record. But,
this is not a problem because this case is handled in
If the secondary key record is delete marked it's corresponding
clustered record can be already be purged only if records
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
may have a deleted secondary key record but no clustered record. But,
this is not a problem because this case is handled in
row_sel_get_clust_rec() function which is called
whenever we note that this read view does not see trx_id in the
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
-------
of the records in the clustered index or those versions of rows created
by transaction which created a cursor before cursor was created even
if transaction which created the cursor has changed that clustered index page.
of the records in the clustered index or those versions of rows created
by transaction which created a cursor before cursor was created even
if transaction which created the cursor has changed that clustered index page.
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
the cursor is opened we still can see record (2).
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
if record trx_id >= low_limit_id i.e. change was made transaction
which started after transaction which created the cursor. If row
was changed by the future transaction a previous version of the
clustered record is created. Thus we see only committed version in
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,
we already see correct version of the record. We don't see any changes
made by active transaction except creating transaction. We have stored
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
which started after transaction which created the cursor. If row
was changed by the future transaction a previous version of the
clustered record is created. Thus we see only committed version in
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,
we already see correct version of the record. We don't see any changes
made by active transaction except creating transaction. We have stored
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
creating transaction. Because we already have clustered record we can
created. Thus we can easily see if this record was changed by the
creating transaction. Because we already have clustered record we can
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
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
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
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
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
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
-------
-------
to cursor view.
TODO: proof this
...
...
@@ -149,10 +149,11 @@ with ..._close. This is used in purge. */
read_view_t
*
read_view_oldest_copy_or_open_new
(
/*==============================*/
/* out, own: read view struct */
dulint
cr_trx_id
,
/* in: trx_id of creating transaction, or
(0, 0) used in purge*/
mem_heap_t
*
heap
)
/* in: memory heap from which allocated */
/* out, own: read view struct */
dulint
cr_trx_id
,
/* in: trx_id of creating
transaction, or (0, 0) used in purge*/
mem_heap_t
*
heap
)
/* in: memory heap from which
allocated */
{
read_view_t
*
old_view
;
read_view_t
*
view_copy
;
...
...
@@ -173,7 +174,7 @@ read_view_oldest_copy_or_open_new(
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
)
{
n
++
;
}
else
{
...
...
@@ -233,10 +234,12 @@ point in time are seen in the view. */
read_view_t
*
read_view_open_now
(
/*===============*/
/* out, own: read view struct */
dulint
cr_trx_id
,
/* in: trx_id of creating transaction,
or (0, 0) used in purge */
mem_heap_t
*
heap
)
/* in: memory heap from which allocated */
/* out, own: read view struct */
dulint
cr_trx_id
,
/* in: trx_id of creating
transaction, or (0, 0) used in
purge */
mem_heap_t
*
heap
)
/* in: memory heap from which
allocated */
{
read_view_t
*
view
;
trx_t
*
trx
;
...
...
@@ -264,7 +267,7 @@ read_view_open_now(
while
(
trx
)
{
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
))
{
read_view_set_nth_trx_id
(
view
,
n
,
trx
->
id
);
...
...
@@ -295,7 +298,7 @@ read_view_open_now(
view
->
up_limit_id
=
view
->
low_limit_id
;
}
UT_LIST_ADD_FIRST
(
view_list
,
trx_sys
->
view_list
,
view
);
return
(
view
);
...
...
@@ -348,10 +351,10 @@ read_view_print(
{
ulint
n_ids
;
ulint
i
;
if
(
view
->
type
==
VIEW_HIGH_GRANULARITY
)
{
fprintf
(
stderr
,
"High-granularity read view undo_n:o %lu %lu
\n
"
,
fprintf
(
stderr
,
"High-granularity read view undo_n:o %lu %lu
\n
"
,
(
ulong
)
ut_dulint_get_high
(
view
->
undo_no
),
(
ulong
)
ut_dulint_get_low
(
view
->
undo_no
));
}
else
{
...
...
@@ -382,9 +385,9 @@ read_view_print(
}
/*************************************************************************
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
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. */
cursor_view_t
*
...
...
@@ -438,7 +441,7 @@ read_cursor_view_create_for_mysql(
while
(
trx
)
{
if
(
trx
->
conc_state
==
TRX_ACTIVE
if
(
trx
->
conc_state
==
TRX_ACTIVE
||
trx
->
conc_state
==
TRX_PREPARED
)
{
read_view_set_nth_trx_id
(
view
,
n
,
trx
->
id
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment