summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <svoj@mysql.com/april.(none)>2006-12-05 18:44:14 +0400
committerunknown <svoj@mysql.com/april.(none)>2006-12-05 18:44:14 +0400
commit2b0c4476835c31f37b93aa96a905cdf1917766cd (patch)
tree9bfaf90b766af893236c8c1d47c5bc549205eab2 /mysys
parentd337e90e8c9422a98e502e71d73326a428ed8cfa (diff)
downloadmariadb-git-2b0c4476835c31f37b93aa96a905cdf1917766cd.tar.gz
BUG#23526 - show table status reports incorrect values for MyISAM tables
This problem could happen when show table status get outdated copy of TABLE object from table cache. MyISAM updates state info when external_lock() method is called. Though I_S does not lock a table to avoid deadlocks. If I_S opens a table which is in a table cache it will likely get outdated state info copy. In this case shared state copy is more recent than local copy. This problem is fixed by correctly restoring myisam state info pointer back to original value, that is to shared state. Affects MyISAM only. No good deterministic test case for this fix. include/thr_lock.h: Added restore_status, that will be called prior to release a read lock. myisam/mi_locking.c: Added mi_restore_status, that will be called prior to release a read lock. This function is intended to set myisam state pointer back to original value, that is to shared state. myisam/mi_open.c: Added restore_status, that will be called prior to release a read lock. myisam/myisamdef.h: Added mi_restore_status, that will be called prior to release a read lock. mysys/thr_lock.c: Call restore_status if we have lock with priority lower than TL_WRITE_CONCURRENT_INSERT.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/thr_lock.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c
index 66848b94651..58b55583c5f 100644
--- a/mysys/thr_lock.c
+++ b/mysys/thr_lock.c
@@ -758,8 +758,16 @@ void thr_unlock(THR_LOCK_DATA *data)
}
else
lock->write.last=data->prev;
- if (lock_type >= TL_WRITE_CONCURRENT_INSERT && lock->update_status)
- (*lock->update_status)(data->status_param);
+ if (lock_type >= TL_WRITE_CONCURRENT_INSERT)
+ {
+ if (lock->update_status)
+ (*lock->update_status)(data->status_param);
+ }
+ else
+ {
+ if (lock->restore_status)
+ (*lock->restore_status)(data->status_param);
+ }
if (lock_type == TL_READ_NO_INSERT)
lock->read_no_write_count--;
data->type=TL_UNLOCK; /* Mark unlocked */