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
b44b4854
Commit
b44b4854
authored
Jun 17, 2002
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that share->tot_locks s updated correctly
This fixes that mysamchk --sort-records works on windows.
parent
6d69e120
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
7 deletions
+18
-7
myisam/mi_check.c
myisam/mi_check.c
+6
-3
myisam/mi_close.c
myisam/mi_close.c
+4
-2
myisam/mi_dynrec.c
myisam/mi_dynrec.c
+1
-1
myisam/mi_open.c
myisam/mi_open.c
+2
-0
myisam/mi_statrec.c
myisam/mi_statrec.c
+1
-1
myisam/myisamchk.c
myisam/myisamchk.c
+4
-0
No files found.
myisam/mi_check.c
View file @
b44b4854
...
@@ -1551,7 +1551,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
...
@@ -1551,7 +1551,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
old_state
=
share
->
state
;
/* save state if not stored */
old_state
=
share
->
state
;
/* save state if not stored */
r_locks
=
share
->
r_locks
;
w_locks
=
share
->
w_locks
;
r_locks
=
share
->
r_locks
;
w_locks
=
share
->
w_locks
;
/* Put same locks as old file */
/* Put same locks as old file */
share
->
r_locks
=
share
->
w_locks
=
0
;
share
->
r_locks
=
share
->
w_locks
=
share
->
tot_locks
=
0
;
(
void
)
_mi_writeinfo
(
info
,
WRITEINFO_UPDATE_KEYFILE
);
(
void
)
_mi_writeinfo
(
info
,
WRITEINFO_UPDATE_KEYFILE
);
VOID
(
my_close
(
share
->
kfile
,
MYF
(
MY_WME
)));
VOID
(
my_close
(
share
->
kfile
,
MYF
(
MY_WME
)));
share
->
kfile
=
-
1
;
share
->
kfile
=
-
1
;
...
@@ -1564,6 +1564,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
...
@@ -1564,6 +1564,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
_mi_readinfo
(
info
,
F_WRLCK
,
0
);
/* Will lock the table */
_mi_readinfo
(
info
,
F_WRLCK
,
0
);
/* Will lock the table */
info
->
lock_type
=
F_WRLCK
;
info
->
lock_type
=
F_WRLCK
;
share
->
r_locks
=
r_locks
;
share
->
w_locks
=
w_locks
;
share
->
r_locks
=
r_locks
;
share
->
w_locks
=
w_locks
;
share
->
tot_locks
=
r_locks
+
w_locks
;
share
->
state
=
old_state
;
/* Restore old state */
share
->
state
=
old_state
;
/* Restore old state */
info
->
state
->
key_file_length
=
param
->
new_file_pos
;
info
->
state
->
key_file_length
=
param
->
new_file_pos
;
...
@@ -3139,9 +3140,11 @@ int update_state_info(MI_CHECK *param, MI_INFO *info,uint update)
...
@@ -3139,9 +3140,11 @@ int update_state_info(MI_CHECK *param, MI_INFO *info,uint update)
{
/* Force update of status */
{
/* Force update of status */
int
error
;
int
error
;
uint
r_locks
=
share
->
r_locks
,
w_locks
=
share
->
w_locks
;
uint
r_locks
=
share
->
r_locks
,
w_locks
=
share
->
w_locks
;
share
->
r_locks
=
share
->
w_locks
=
0
;
share
->
r_locks
=
share
->
w_locks
=
share
->
tot_locks
=
0
;
error
=
_mi_writeinfo
(
info
,
WRITEINFO_NO_UNLOCK
);
error
=
_mi_writeinfo
(
info
,
WRITEINFO_NO_UNLOCK
);
share
->
r_locks
=
r_locks
;
share
->
w_locks
=
w_locks
;
share
->
r_locks
=
r_locks
;
share
->
w_locks
=
w_locks
;
share
->
tot_locks
=
r_locks
+
w_locks
;
if
(
!
error
)
if
(
!
error
)
return
0
;
return
0
;
}
}
...
...
myisam/mi_close.c
View file @
b44b4854
...
@@ -29,8 +29,7 @@ int mi_close(register MI_INFO *info)
...
@@ -29,8 +29,7 @@ int mi_close(register MI_INFO *info)
MYISAM_SHARE
*
share
=
info
->
s
;
MYISAM_SHARE
*
share
=
info
->
s
;
DBUG_ENTER
(
"mi_close"
);
DBUG_ENTER
(
"mi_close"
);
DBUG_PRINT
(
"enter"
,(
"base: %lx reopen: %u locks: %u"
,
DBUG_PRINT
(
"enter"
,(
"base: %lx reopen: %u locks: %u"
,
info
,(
uint
)
share
->
reopen
,
info
,(
uint
)
share
->
reopen
,
(
uint
)
share
->
tot_locks
));
(
uint
)
(
share
->
w_locks
+
share
->
r_locks
)));
pthread_mutex_lock
(
&
THR_LOCK_myisam
);
pthread_mutex_lock
(
&
THR_LOCK_myisam
);
if
(
info
->
lock_type
==
F_EXTRA_LCK
)
if
(
info
->
lock_type
==
F_EXTRA_LCK
)
...
@@ -47,7 +46,10 @@ int mi_close(register MI_INFO *info)
...
@@ -47,7 +46,10 @@ int mi_close(register MI_INFO *info)
pthread_mutex_lock
(
&
share
->
intern_lock
);
pthread_mutex_lock
(
&
share
->
intern_lock
);
if
(
share
->
options
&
HA_OPTION_READ_ONLY_DATA
)
if
(
share
->
options
&
HA_OPTION_READ_ONLY_DATA
)
{
share
->
r_locks
--
;
share
->
r_locks
--
;
share
->
tot_locks
--
;
}
if
(
info
->
opt_flag
&
(
READ_CACHE_USED
|
WRITE_CACHE_USED
))
if
(
info
->
opt_flag
&
(
READ_CACHE_USED
|
WRITE_CACHE_USED
))
{
{
if
(
end_io_cache
(
&
info
->
rec_cache
))
if
(
end_io_cache
(
&
info
->
rec_cache
))
...
...
myisam/mi_dynrec.c
View file @
b44b4854
...
@@ -1275,7 +1275,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
...
@@ -1275,7 +1275,7 @@ int _mi_read_rnd_dynamic_record(MI_INFO *info, byte *buf,
if
(
info
->
lock_type
==
F_UNLCK
)
if
(
info
->
lock_type
==
F_UNLCK
)
{
{
#ifndef UNSAFE_LOCKING
#ifndef UNSAFE_LOCKING
if
(
share
->
r_locks
==
0
&&
share
->
w
_locks
==
0
)
if
(
share
->
tot
_locks
==
0
)
{
{
if
(
my_lock
(
share
->
kfile
,
F_RDLCK
,
0L
,
F_TO_EOF
,
if
(
my_lock
(
share
->
kfile
,
F_RDLCK
,
0L
,
F_TO_EOF
,
MYF
(
MY_SEEK_NOT_DONE
)
|
info
->
lock_wait
))
MYF
(
MY_SEEK_NOT_DONE
)
|
info
->
lock_wait
))
...
...
myisam/mi_open.c
View file @
b44b4854
...
@@ -486,6 +486,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
...
@@ -486,6 +486,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
{
{
info
.
lock_type
=
F_RDLCK
;
info
.
lock_type
=
F_RDLCK
;
share
->
r_locks
++
;
share
->
r_locks
++
;
share
->
tot_locks
++
;
}
}
if
((
open_flags
&
HA_OPEN_TMP_TABLE
)
||
if
((
open_flags
&
HA_OPEN_TMP_TABLE
)
||
(
share
->
options
&
HA_OPTION_TMP_TABLE
))
(
share
->
options
&
HA_OPTION_TMP_TABLE
))
...
@@ -493,6 +494,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
...
@@ -493,6 +494,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
share
->
temporary
=
share
->
delay_key_write
=
1
;
share
->
temporary
=
share
->
delay_key_write
=
1
;
share
->
write_flag
=
MYF
(
MY_NABP
);
share
->
write_flag
=
MYF
(
MY_NABP
);
share
->
w_locks
++
;
/* We don't have to update status */
share
->
w_locks
++
;
/* We don't have to update status */
share
->
tot_locks
++
;
info
.
lock_type
=
F_WRLCK
;
info
.
lock_type
=
F_WRLCK
;
}
}
if
(((
open_flags
&
HA_OPEN_DELAY_KEY_WRITE
)
||
if
(((
open_flags
&
HA_OPEN_DELAY_KEY_WRITE
)
||
...
...
myisam/mi_statrec.c
View file @
b44b4854
...
@@ -239,7 +239,7 @@ int _mi_read_rnd_static_record(MI_INFO *info, byte *buf,
...
@@ -239,7 +239,7 @@ int _mi_read_rnd_static_record(MI_INFO *info, byte *buf,
{
/* We don't nead new info */
{
/* We don't nead new info */
#ifndef UNSAFE_LOCKING
#ifndef UNSAFE_LOCKING
if
((
!
cache_read
||
share
->
base
.
reclength
>
cache_length
)
&&
if
((
!
cache_read
||
share
->
base
.
reclength
>
cache_length
)
&&
share
->
r_locks
==
0
&&
share
->
w
_locks
==
0
)
share
->
tot
_locks
==
0
)
{
/* record not in cache */
{
/* record not in cache */
if
(
my_lock
(
share
->
kfile
,
F_RDLCK
,
0L
,
F_TO_EOF
,
if
(
my_lock
(
share
->
kfile
,
F_RDLCK
,
0L
,
F_TO_EOF
,
MYF
(
MY_SEEK_NOT_DONE
)
|
info
->
lock_wait
))
MYF
(
MY_SEEK_NOT_DONE
)
|
info
->
lock_wait
))
...
...
myisam/myisamchk.c
View file @
b44b4854
...
@@ -729,6 +729,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
...
@@ -729,6 +729,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
}
}
share
=
info
->
s
;
share
=
info
->
s
;
share
->
options
&=
~
HA_OPTION_READ_ONLY_DATA
;
/* We are modifing it */
share
->
options
&=
~
HA_OPTION_READ_ONLY_DATA
;
/* We are modifing it */
share
->
tot_locks
-=
share
->
r_locks
;
share
->
r_locks
=
0
;
share
->
r_locks
=
0
;
raid_chunks
=
share
->
base
.
raid_chunks
;
raid_chunks
=
share
->
base
.
raid_chunks
;
...
@@ -806,6 +807,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
...
@@ -806,6 +807,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
rep_quick
|=
T_QUICK
;
rep_quick
|=
T_QUICK
;
}
}
share
=
info
->
s
;
share
=
info
->
s
;
share
->
tot_locks
-=
share
->
r_locks
;
share
->
r_locks
=
0
;
share
->
r_locks
=
0
;
}
}
...
@@ -835,6 +837,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
...
@@ -835,6 +837,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
goto
end2
;
goto
end2
;
}
}
share
->
w_locks
++
;
/* Mark for writeinfo */
share
->
w_locks
++
;
/* Mark for writeinfo */
share
->
tot_locks
++
;
info
->
lock_type
=
F_EXTRA_LCK
;
/* Simulate as locked */
info
->
lock_type
=
F_EXTRA_LCK
;
/* Simulate as locked */
info
->
tmp_lock_type
=
lock_type
;
info
->
tmp_lock_type
=
lock_type
;
datafile
=
info
->
dfile
;
datafile
=
info
->
dfile
;
...
@@ -1011,6 +1014,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
...
@@ -1011,6 +1014,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
info
->
update
&=
~
HA_STATE_CHANGED
;
info
->
update
&=
~
HA_STATE_CHANGED
;
}
}
share
->
w_locks
--
;
share
->
w_locks
--
;
share
->
tot_locks
--
;
end2:
end2:
if
(
mi_close
(
info
))
if
(
mi_close
(
info
))
{
{
...
...
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