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
c5a1a487
Commit
c5a1a487
authored
Nov 07, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use transaction-aware DB->stat() call when doing 'ANALYZE TABLE' on
a table using the BDB storage engine. (Bug #14671)
parent
2e13e29a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
37 deletions
+3
-37
mysql-test/r/bdb-crash.result
mysql-test/r/bdb-crash.result
+1
-1
sql/ha_berkeley.cc
sql/ha_berkeley.cc
+2
-36
No files found.
mysql-test/r/bdb-crash.result
View file @
c5a1a487
...
...
@@ -35,5 +35,5 @@ set autocommit=0;
insert into t1 values(1);
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status O
peration need committed state
test.t1 analyze status O
K
drop table t1;
sql/ha_berkeley.cc
View file @
c5a1a487
...
...
@@ -2286,40 +2286,6 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
berkeley_trx_data
*
trx
=
(
berkeley_trx_data
*
)
thd
->
ha_data
[
berkeley_hton
.
slot
];
DBUG_ASSERT
(
trx
);
/*
Original bdb documentation says:
"The DB->stat method cannot be transaction-protected.
For this reason, it should be called in a thread of
control that has no open cursors or active transactions."
So, let's check if there are any changes have been done since
the beginning of the transaction..
*/
if
(
!
db_env
->
txn_stat
(
db_env
,
&
txn_stat_ptr
,
0
)
&&
txn_stat_ptr
&&
txn_stat_ptr
->
st_nactive
>=
2
)
{
DB_TXN_ACTIVE
*
atxn_stmt
=
0
,
*
atxn_all
=
0
;
u_int32_t
all_id
=
trx
->
all
->
id
(
trx
->
all
);
u_int32_t
stmt_id
=
trx
->
stmt
->
id
(
trx
->
stmt
);
DB_TXN_ACTIVE
*
cur
=
txn_stat_ptr
->
st_txnarray
;
DB_TXN_ACTIVE
*
end
=
cur
+
txn_stat_ptr
->
st_nactive
;
for
(;
cur
!=
end
&&
(
!
atxn_stmt
||
!
atxn_all
);
cur
++
)
{
if
(
cur
->
txnid
==
all_id
)
atxn_all
=
cur
;
if
(
cur
->
txnid
==
stmt_id
)
atxn_stmt
=
cur
;
}
if
(
atxn_stmt
&&
atxn_all
&&
log_compare
(
&
atxn_stmt
->
lsn
,
&
atxn_all
->
lsn
))
{
free
(
txn_stat_ptr
);
return
HA_ADMIN_REJECT
;
}
free
(
txn_stat_ptr
);
}
for
(
i
=
0
;
i
<
table
->
s
->
keys
;
i
++
)
{
if
(
stat
)
...
...
@@ -2327,7 +2293,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
free
(
stat
);
stat
=
0
;
}
if
((
key_file
[
i
]
->
stat
)(
key_file
[
i
],
NULL
,
(
void
*
)
&
stat
,
0
))
if
((
key_file
[
i
]
->
stat
)(
key_file
[
i
],
trx
->
all
,
(
void
*
)
&
stat
,
0
))
goto
err
;
/* purecov: inspected */
share
->
rec_per_key
[
i
]
=
(
stat
->
bt_ndata
/
(
stat
->
bt_nkeys
?
stat
->
bt_nkeys
:
1
));
...
...
@@ -2340,7 +2306,7 @@ int ha_berkeley::analyze(THD* thd, HA_CHECK_OPT* check_opt)
free
(
stat
);
stat
=
0
;
}
if
((
file
->
stat
)(
file
,
NULL
,
(
void
*
)
&
stat
,
0
))
if
((
file
->
stat
)(
file
,
trx
->
all
,
(
void
*
)
&
stat
,
0
))
goto
err
;
/* purecov: inspected */
}
pthread_mutex_lock
(
&
share
->
mutex
);
...
...
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