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
ccf4b282
Commit
ccf4b282
authored
Dec 28, 2000
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/my/mysql into donna.mysql.com:/home/my/bk/mysql
parents
5d25961f
c16a006f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
49 deletions
+84
-49
sql/ha_berkeley.cc
sql/ha_berkeley.cc
+80
-45
sql/ha_berkeley.h
sql/ha_berkeley.h
+1
-1
sql/ha_myisam.cc
sql/ha_myisam.cc
+1
-1
sql/log_event.cc
sql/log_event.cc
+1
-1
support-files/mysql.server.sh
support-files/mysql.server.sh
+1
-1
No files found.
sql/ha_berkeley.cc
View file @
ccf4b282
...
...
@@ -99,7 +99,7 @@ static void berkeley_print_error(const char *db_errpfx, char *buffer);
static
byte
*
bdb_get_key
(
BDB_SHARE
*
share
,
uint
*
length
,
my_bool
not_used
__attribute__
((
unused
)));
static
BDB_SHARE
*
get_share
(
const
char
*
table_name
,
TABLE
*
table
);
static
int
free_share
(
BDB_SHARE
*
share
,
TABLE
*
table
);
static
int
free_share
(
BDB_SHARE
*
share
,
TABLE
*
table
,
uint
hidden_primary_key
);
static
int
write_status
(
DB
*
status_block
,
char
*
buff
,
uint
length
);
static
void
update_status
(
BDB_SHARE
*
share
,
TABLE
*
table
);
static
void
berkeley_noticecall
(
DB_ENV
*
db_env
,
db_notices
notice
);
...
...
@@ -465,7 +465,7 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
{
if
((
error
=
db_create
(
&
file
,
db_env
,
0
)))
{
free_share
(
share
,
table
);
free_share
(
share
,
table
,
hidden_primary_key
);
my_free
(
rec_buff
,
MYF
(
0
));
my_free
(
alloc_ptr
,
MYF
(
0
));
my_errno
=
error
;
...
...
@@ -482,7 +482,7 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
2
|
4
),
"main"
,
DB_BTREE
,
open_mode
,
0
))))
{
free_share
(
share
,
table
);
free_share
(
share
,
table
,
hidden_primary_key
);
my_free
(
rec_buff
,
MYF
(
0
));
my_free
(
alloc_ptr
,
MYF
(
0
));
my_errno
=
error
;
...
...
@@ -550,12 +550,11 @@ int ha_berkeley::open(const char *name, int mode, uint test_if_locked)
int
ha_berkeley
::
close
(
void
)
{
uint
keys
=
table
->
keys
+
test
(
hidden_primary_key
);
DBUG_ENTER
(
"ha_berkeley::close"
);
my_free
(
rec_buff
,
MYF
(
MY_ALLOW_ZERO_PTR
));
my_free
(
alloc_ptr
,
MYF
(
MY_ALLOW_ZERO_PTR
));
DBUG_RETURN
(
free_share
(
share
,
table
));
DBUG_RETURN
(
free_share
(
share
,
table
,
hidden_primary_key
));
}
...
...
@@ -796,18 +795,23 @@ int ha_berkeley::write_row(byte * record)
}
else
{
DB_TXN
*
sub_trans
=
transaction
;
ulong
thd_options
=
table
->
in_use
->
options
;
for
(
uint
retry
=
0
;
retry
<
berkeley_trans_retry
;
retry
++
)
{
uint
keynr
;
DB_TXN
*
sub_trans
;
if
((
error
=
txn_begin
(
db_env
,
transaction
,
&
sub_trans
,
0
)))
break
;
DBUG_PRINT
(
"trans"
,(
"starting subtransaction"
));
key_map
changed_keys
=
0
;
if
(
using_ignore
&&
(
thd_options
&
OPTION_INTERNAL_SUBTRANSACTIONS
))
{
if
((
error
=
txn_begin
(
db_env
,
transaction
,
&
sub_trans
,
0
)))
break
;
DBUG_PRINT
(
"trans"
,(
"starting subtransaction"
));
}
if
(
!
(
error
=
file
->
put
(
file
,
sub_trans
,
create_key
(
&
prim_key
,
primary_key
,
key_buff
,
record
),
&
row
,
key_type
[
primary_key
])))
{
for
(
keynr
=
0
;
keynr
<
table
->
keys
;
keynr
++
)
changed_keys
|=
(
key_map
)
1
<<
primary_key
;
for
(
uint
keynr
=
0
;
keynr
<
table
->
keys
;
keynr
++
)
{
if
(
keynr
==
primary_key
)
continue
;
...
...
@@ -819,27 +823,48 @@ int ha_berkeley::write_row(byte * record)
last_dup_key
=
keynr
;
break
;
}
changed_keys
|=
(
key_map
)
1
<<
keynr
;
}
}
else
last_dup_key
=
primary_key
;
if
(
!
error
)
{
DBUG_PRINT
(
"trans"
,(
"committing subtransaction"
));
error
=
txn_commit
(
sub_trans
,
0
);
}
else
if
(
error
)
{
/* Remove inserted row */
int
new_error
;
DBUG_PRINT
(
"error"
,(
"Got error %d"
,
error
));
DBUG_PRINT
(
"trans"
,(
"aborting subtransaction"
));
if
((
new_error
=
txn_abort
(
sub_trans
)))
if
(
using_ignore
)
{
error
=
new_error
;
// This shouldn't happen
break
;
int
new_error
=
0
;
if
(
thd_options
&
OPTION_INTERNAL_SUBTRANSACTIONS
)
{
DBUG_PRINT
(
"trans"
,(
"aborting subtransaction"
));
new_error
=
txn_abort
(
sub_trans
);
}
else
if
(
changed_keys
)
{
new_error
=
0
;
for
(
uint
keynr
=
0
;
changed_keys
;
keynr
++
,
changed_keys
>>=
1
)
{
if
(
changed_keys
&
1
)
{
if
((
new_error
=
remove_key
(
sub_trans
,
keynr
,
record
,
(
DBT
*
)
0
,
&
prim_key
)))
break
;
}
}
}
if
(
new_error
)
{
error
=
new_error
;
// This shouldn't happen
break
;
}
}
}
else
if
(
using_ignore
&&
(
thd_options
&
OPTION_INTERNAL_SUBTRANSACTIONS
))
{
DBUG_PRINT
(
"trans"
,(
"committing subtransaction"
));
error
=
txn_commit
(
sub_trans
,
0
);
}
if
(
error
!=
DB_LOCK_DEADLOCK
)
break
;
}
...
...
@@ -1126,7 +1151,7 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
packed_record may be NULL if the key is unique
*/
int
ha_berkeley
::
remove_key
(
DB_TXN
*
sub_
trans
,
uint
keynr
,
const
byte
*
record
,
int
ha_berkeley
::
remove_key
(
DB_TXN
*
trans
,
uint
keynr
,
const
byte
*
record
,
DBT
*
packed_record
,
DBT
*
prim_key
)
{
...
...
@@ -1139,7 +1164,7 @@ int ha_berkeley::remove_key(DB_TXN *sub_trans, uint keynr, const byte *record,
HA_NOSAME
||
keynr
==
primary_key
)
{
// Unique key
dbug_assert
(
keynr
==
primary_key
||
prim_key
->
data
!=
key_buff2
);
error
=
key_file
[
keynr
]
->
del
(
key_file
[
keynr
],
sub_
trans
,
error
=
key_file
[
keynr
]
->
del
(
key_file
[
keynr
],
trans
,
keynr
==
primary_key
?
prim_key
:
create_key
(
&
key
,
keynr
,
key_buff2
,
record
),
...
...
@@ -1154,7 +1179,7 @@ int ha_berkeley::remove_key(DB_TXN *sub_trans, uint keynr, const byte *record,
*/
dbug_assert
(
keynr
!=
primary_key
&&
prim_key
->
data
!=
key_buff2
);
DBC
*
tmp_cursor
;
if
(
!
(
error
=
file
->
cursor
(
key_file
[
keynr
],
sub_
trans
,
&
tmp_cursor
,
0
)))
if
(
!
(
error
=
file
->
cursor
(
key_file
[
keynr
],
trans
,
&
tmp_cursor
,
0
)))
{
if
(
!
(
error
=
cursor
->
c_get
(
tmp_cursor
,
(
keynr
==
primary_key
?
...
...
@@ -1178,10 +1203,10 @@ int ha_berkeley::remove_key(DB_TXN *sub_trans, uint keynr, const byte *record,
/* Delete all keys for new_record */
int
ha_berkeley
::
remove_keys
(
DB_TXN
*
trans
,
const
byte
*
record
,
DBT
*
new_record
,
DBT
*
prim_key
,
key_map
keys
,
int
result
)
DBT
*
new_record
,
DBT
*
prim_key
,
key_map
keys
)
{
for
(
uint
keynr
=
0
;
keys
;
keynr
++
,
keys
>>=
1
)
int
result
=
0
;
for
(
uint
keynr
=
0
;
keys
;
keynr
++
,
keys
>>=
1
)
{
if
(
keys
&
1
)
{
...
...
@@ -1189,8 +1214,7 @@ int ha_berkeley::remove_keys(DB_TXN *trans, const byte *record,
if
(
new_error
)
{
result
=
new_error
;
// Return last error
if
(
trans
)
break
;
// Let rollback correct things
break
;
// Let rollback correct things
}
}
}
...
...
@@ -1203,6 +1227,7 @@ int ha_berkeley::delete_row(const byte * record)
int
error
;
DBT
row
,
prim_key
;
key_map
keys
=
table
->
keys_in_use
;
ulong
thd_options
=
table
->
in_use
->
options
;
DBUG_ENTER
(
"delete_row"
);
statistic_increment
(
ha_delete_count
,
&
LOCK_status
);
...
...
@@ -1212,30 +1237,39 @@ int ha_berkeley::delete_row(const byte * record)
if
(
hidden_primary_key
)
keys
|=
(
key_map
)
1
<<
primary_key
;
/* Subtransactions may be used in order to retry the delete in
case we get a DB_LOCK_DEADLOCK error. */
DB_TXN
*
sub_trans
=
transaction
;
for
(
uint
retry
=
0
;
retry
<
berkeley_trans_retry
;
retry
++
)
{
DB_TXN
*
sub_trans
;
if
((
error
=
txn_begin
(
db_env
,
transaction
,
&
sub_trans
,
0
)))
break
;
DBUG_PRINT
(
"trans"
,(
"starting sub transaction"
));
if
(
!
error
)
error
=
remove_keys
(
sub_trans
,
record
,
&
row
,
&
prim_key
,
keys
,
0
);
if
(
!
error
)
if
(
thd_options
&
OPTION_INTERNAL_SUBTRANSACTIONS
)
{
if
((
error
=
txn_begin
(
db_env
,
transaction
,
&
sub_trans
,
0
)))
break
;
DBUG_PRINT
(
"trans"
,(
"starting sub transaction"
));
}
error
=
remove_keys
(
sub_trans
,
record
,
&
row
,
&
prim_key
,
keys
);
if
(
!
error
&&
(
thd_options
&
OPTION_INTERNAL_SUBTRANSACTIONS
))
{
DBUG_PRINT
(
"trans"
,(
"ending sub transaction"
));
error
=
txn_commit
(
sub_trans
,
0
);
}
if
(
error
)
{
/* retry */
int
new_error
;
DBUG_PRINT
(
"error"
,(
"Got error %d"
,
error
));
DBUG_PRINT
(
"trans"
,(
"aborting subtransaction"
));
if
((
new_error
=
txn_abort
(
sub_trans
)))
if
(
thd_options
&
OPTION_INTERNAL_SUBTRANSACTIONS
)
{
error
=
new_error
;
// This shouldn't happen
break
;
/* retry */
int
new_error
;
DBUG_PRINT
(
"trans"
,(
"aborting subtransaction"
));
if
((
new_error
=
txn_abort
(
sub_trans
)))
{
error
=
new_error
;
// This shouldn't happen
break
;
}
}
else
break
;
// No retry - return error
}
if
(
error
!=
DB_LOCK_DEADLOCK
)
break
;
...
...
@@ -2058,16 +2092,17 @@ static BDB_SHARE *get_share(const char *table_name, TABLE *table)
return
share
;
}
static
int
free_share
(
BDB_SHARE
*
share
,
TABLE
*
table
)
static
int
free_share
(
BDB_SHARE
*
share
,
TABLE
*
table
,
uint
hidden_primary_key
)
{
int
error
,
result
=
0
;
uint
keys
=
table
->
keys
+
test
(
hidden_primary_key
);
pthread_mutex_lock
(
&
bdb_mutex
);
if
(
!--
share
->
use_count
)
{
DB
**
key_file
=
share
->
key_file
;
update_status
(
share
,
table
);
/* this does share->file->close() implicitly */
for
(
uint
i
=
0
;
i
<
table
->
keys
;
i
++
)
for
(
uint
i
=
0
;
i
<
keys
;
i
++
)
{
if
(
key_file
[
i
]
&&
(
error
=
key_file
[
i
]
->
close
(
key_file
[
i
],
0
)))
result
=
error
;
...
...
sql/ha_berkeley.h
View file @
ccf4b282
...
...
@@ -70,7 +70,7 @@ class ha_berkeley: public handler
int
remove_key
(
DB_TXN
*
trans
,
uint
keynr
,
const
byte
*
record
,
DBT
*
packed_record
,
DBT
*
prim_key
);
int
remove_keys
(
DB_TXN
*
trans
,
const
byte
*
record
,
DBT
*
new_record
,
DBT
*
prim_key
,
key_map
keys
,
int
result
);
DBT
*
prim_key
,
key_map
keys
);
int
restore_keys
(
DB_TXN
*
trans
,
key_map
changed_keys
,
uint
primary_key
,
const
byte
*
old_row
,
DBT
*
old_key
,
const
byte
*
new_row
,
DBT
*
new_key
,
...
...
sql/ha_myisam.cc
View file @
ccf4b282
...
...
@@ -1103,7 +1103,7 @@ int ha_myisam::ft_read(byte * buf)
thread_safe_increment
(
ha_read_next_count
,
&
LOCK_status
);
// why ?
if
(
error
=
ft_read_next
((
FT_DOCLIST
*
)
ft_handler
,(
char
*
)
buf
))
if
(
(
error
=
ft_read_next
((
FT_DOCLIST
*
)
ft_handler
,(
char
*
)
buf
)
))
ft_handler
=
NULL
;
// Magic here ! See Item_func_match::val()
// and ha_myisam::index_init()
table
->
status
=
error
?
STATUS_NOT_FOUND
:
0
;
...
...
sql/log_event.cc
View file @
ccf4b282
...
...
@@ -624,7 +624,7 @@ void Load_log_event::print(FILE* file, bool short_form)
if
(
!
short_form
)
{
print_header
(
file
);
fprintf
(
file
,
"
\t
Query
\t
thread_id=%d
\t
exec_time=%ld
\n
"
,
fprintf
(
file
,
"
\t
Query
\t
thread_id=%
l
d
\t
exec_time=%ld
\n
"
,
thread_id
,
exec_time
);
}
...
...
support-files/mysql.server.sh
View file @
ccf4b282
...
...
@@ -137,7 +137,7 @@ case "$mode" in
then
echo
" done"
fi
# delete lock for RedHat / SuSE
if
test
-
e
/var/lock/subsys/mysql
if
test
-
f
/var/lock/subsys/mysql
then
rm
/var/lock/subsys/mysql
fi
...
...
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