diff options
author | unknown <ingo@mysql.com> | 2004-09-18 20:33:39 +0200 |
---|---|---|
committer | unknown <ingo@mysql.com> | 2004-09-18 20:33:39 +0200 |
commit | a7919a11fcb3a52246158aba3193d0128baff344 (patch) | |
tree | f3658d5151d0eec668e2a6a6702b3ad26c908d15 /myisam/mi_close.c | |
parent | c36356b6a4ac740f61f2a82a04f87213b06f40f5 (diff) | |
download | mariadb-git-a7919a11fcb3a52246158aba3193d0128baff344.tar.gz |
bug#2831 - --extenral-locking does not fully work with --myisam-recover.
Changed the semantics of open_count so that it is decremented
at every unlock (if it was incremented due to data changes).
So it indicates a crash, if it is non-zero after a lock.
The table will then be repaired.
myisam/mi_close.c:
bug#2831 - --extenral-locking does not fully work with --myisam-recover.
To avoid flushing the open_count at every unlock,
we need to do so at close at least.
myisam/mi_locking.c:
bug#2831 - --extenral-locking does not fully work with --myisam-recover.
open_count is now decremented at unlock (from a writelock) with
mi_unlock_open_count(). After every new lock the state is read
from the index file and the open_count checked. If not zero,
another server must have crashed, so the table is marked as crashed.
In certain situations the decremented open_count mut be flushed to
the index file. I tried to keep these extra flushes as seldom as possible.
sql/ha_myisam.cc:
bug#2831 - --extenral-locking does not fully work with --myisam-recover.
Added code to repair the table, if it is marked crashed after
successful locking and the --myisam-recover option is set.
sql/sql_table.cc:
This does not really belong to the bugfix for #2831.
But it was detected during fixing the external locking.
Diffstat (limited to 'myisam/mi_close.c')
-rw-r--r-- | myisam/mi_close.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/myisam/mi_close.c b/myisam/mi_close.c index dbaaebb1143..47308a5e9eb 100644 --- a/myisam/mi_close.c +++ b/myisam/mi_close.c @@ -70,7 +70,8 @@ int mi_close(register MI_INFO *info) error=my_errno; if (share->kfile >= 0) { - if (share->mode != O_RDONLY && mi_is_crashed(info)) + /* We must always flush the state with the current open_count. */ + if (share->mode != O_RDONLY) mi_state_info_write(share->kfile, &share->state, 1); if (my_close(share->kfile,MYF(0))) error = my_errno; |