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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
2a3c66a6
Commit
2a3c66a6
authored
Dec 28, 2017
by
Eugene Kosov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IB: move methods to proper place
parent
d72462a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
69 deletions
+70
-69
storage/innobase/dict/dict0mem.cc
storage/innobase/dict/dict0mem.cc
+70
-0
storage/innobase/row/row0ins.cc
storage/innobase/row/row0ins.cc
+0
-69
No files found.
storage/innobase/dict/dict0mem.cc
View file @
2a3c66a6
...
...
@@ -1474,3 +1474,73 @@ void dict_table_t::rollback_instant(unsigned n)
field
->
name
=
sys
+
sizeof
"DB_ROW_ID
\0
DB_TRX_ID"
;
field
->
col
=
dict_table_get_sys_col
(
this
,
DATA_ROLL_PTR
);
}
/** Check if record in clustered index is historical row.
@param[in] rec clustered row
@param[in] offsets offsets
@return true if row is historical */
bool
dict_index_t
::
vers_history_row
(
const
rec_t
*
rec
,
const
ulint
*
offsets
)
{
ut_a
(
is_clust
());
ulint
len
;
dict_col_t
&
col
=
table
->
cols
[
table
->
vers_end
];
ut_ad
(
col
.
vers_sys_end
());
ulint
nfield
=
dict_col_get_clust_pos
(
&
col
,
this
);
const
byte
*
data
=
rec_get_nth_field
(
rec
,
offsets
,
nfield
,
&
len
);
if
(
col
.
mtype
==
DATA_FIXBINARY
)
{
ut_ad
(
len
==
sizeof
timestamp_max_bytes
);
return
0
!=
memcmp
(
data
,
timestamp_max_bytes
,
len
);
}
else
{
ut_ad
(
col
.
mtype
==
DATA_INT
);
ut_ad
(
len
==
sizeof
trx_id_max_bytes
);
return
0
!=
memcmp
(
data
,
trx_id_max_bytes
,
len
);
}
ut_ad
(
0
);
return
false
;
}
/** Check if record in secondary index is historical row.
@param[in] rec record in a secondary index
@param[out] history_row true if row is historical
@return true on error */
bool
dict_index_t
::
vers_history_row
(
const
rec_t
*
rec
,
bool
&
history_row
)
{
ut_ad
(
!
is_clust
());
bool
error
=
false
;
mem_heap_t
*
heap
=
NULL
;
dict_index_t
*
clust_index
=
NULL
;
ulint
offsets_
[
REC_OFFS_NORMAL_SIZE
];
ulint
*
offsets
=
offsets_
;
rec_offs_init
(
offsets_
);
mtr_t
mtr
;
mtr
.
start
();
rec_t
*
clust_rec
=
row_get_clust_rec
(
BTR_SEARCH_LEAF
,
rec
,
this
,
&
clust_index
,
&
mtr
);
if
(
clust_rec
)
{
offsets
=
rec_get_offsets
(
clust_rec
,
clust_index
,
offsets
,
true
,
ULINT_UNDEFINED
,
&
heap
);
history_row
=
clust_index
->
vers_history_row
(
clust_rec
,
offsets
);
}
else
{
ib
::
error
()
<<
"foreign constraints: secondary index is out of "
"sync"
;
ut_ad
(
!
"secondary index is out of sync"
);
error
=
true
;
}
mtr
.
commit
();
if
(
heap
)
{
mem_heap_free
(
heap
);
}
return
(
error
);
}
storage/innobase/row/row0ins.cc
View file @
2a3c66a6
...
...
@@ -1568,75 +1568,6 @@ class ib_dec_in_dtor {
ulint
&
counter
;
};
/** Check if record in clustered index is historical row.
@param[in] rec clustered row
@param[in] offsets offsets
@return true if row is historical */
bool
dict_index_t
::
vers_history_row
(
const
rec_t
*
rec
,
const
ulint
*
offsets
)
{
ut_a
(
is_clust
());
ulint
len
;
dict_col_t
&
col
=
table
->
cols
[
table
->
vers_end
];
ut_ad
(
col
.
vers_sys_end
());
ulint
nfield
=
dict_col_get_clust_pos
(
&
col
,
this
);
const
byte
*
data
=
rec_get_nth_field
(
rec
,
offsets
,
nfield
,
&
len
);
if
(
col
.
mtype
==
DATA_FIXBINARY
)
{
ut_ad
(
len
==
sizeof
timestamp_max_bytes
);
return
0
!=
memcmp
(
data
,
timestamp_max_bytes
,
len
);
}
else
{
ut_ad
(
col
.
mtype
==
DATA_INT
);
ut_ad
(
len
==
sizeof
trx_id_max_bytes
);
return
0
!=
memcmp
(
data
,
trx_id_max_bytes
,
len
);
}
ut_ad
(
0
);
return
false
;
}
/** Check if record in secondary index is historical row.
@param[in] rec record in a secondary index
@param[out] history_row true if row is historical
@return true on error */
bool
dict_index_t
::
vers_history_row
(
const
rec_t
*
rec
,
bool
&
history_row
)
{
ut_ad
(
!
is_clust
());
bool
error
=
false
;
mem_heap_t
*
heap
=
NULL
;
dict_index_t
*
clust_index
=
NULL
;
ulint
offsets_
[
REC_OFFS_NORMAL_SIZE
];
ulint
*
offsets
=
offsets_
;
rec_offs_init
(
offsets_
);
mtr_t
mtr
;
mtr
.
start
();
rec_t
*
clust_rec
=
row_get_clust_rec
(
BTR_SEARCH_LEAF
,
rec
,
this
,
&
clust_index
,
&
mtr
);
if
(
clust_rec
)
{
offsets
=
rec_get_offsets
(
clust_rec
,
clust_index
,
offsets
,
true
,
ULINT_UNDEFINED
,
&
heap
);
history_row
=
clust_index
->
vers_history_row
(
clust_rec
,
offsets
);
}
else
{
ib
::
error
()
<<
"foreign constraints: secondary index is out of "
"sync"
;
ut_ad
(
!
"secondary index is out of sync"
);
error
=
true
;
}
mtr
.
commit
();
if
(
heap
)
{
mem_heap_free
(
heap
);
}
return
(
error
);
}
/***************************************************************//**
Checks if foreign key constraint fails for an index entry. Sets shared locks
which lock either the success or the failure of the constraint. NOTE that
...
...
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