summaryrefslogtreecommitdiff
path: root/myisam/mi_write.c
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2006-05-31 10:22:44 +0200
committerunknown <ingo@mysql.com>2006-05-31 10:22:44 +0200
commit4a1d076342fff6e6afe6054d48f33453c9ec5bb8 (patch)
treef67511920e1e2be1d9e959bf82d1dc47b4792b90 /myisam/mi_write.c
parent47302570e639927b258e10a7c009e6d585ba8adf (diff)
downloadmariadb-git-4a1d076342fff6e6afe6054d48f33453c9ec5bb8.tar.gz
Bug#19604 - CHECK TABLE with concurrent INSERT can reset auto_increment
CHECK TABLE did temporarily clear the auto_increment value. It runs with a read lock, allowing other readers and conurrent INSERTs. The latter could grab the wrong value in this moment. CHECK TABLE does no longer modify the auto_increment value. Not even for a short moment. myisam/mi_check.c: Bug#19604 - CHECK TABLE with concurrent INSERT can reset auto_increment In chk_key() and update_auto_increment_key() in the repair_only case, do not touch info->s->state.auto_increment. Especially chk_key() can be called from CHECK TABLE with a read lock. Concurrent inserts could grab a temporarily changed value. Added minor style fixes. myisam/mi_key.c: Bug#19604 - CHECK TABLE with concurrent INSERT can reset auto_increment Changed update_auto_increment() to retrieve_auto_increment() to reflect that it does not change the auto_increment by itself any more. This must now be done externally if needed. myisam/mi_update.c: Bug#19604 - CHECK TABLE with concurrent INSERT can reset auto_increment Added explicit update of info->s->state.auto_increment after the change from update_auto_increment() to retrieve_auto_increment(). myisam/mi_write.c: Bug#19604 - CHECK TABLE with concurrent INSERT can reset auto_increment Added explicit update of info->s->state.auto_increment after the change from update_auto_increment() to retrieve_auto_increment(). myisam/myisamdef.h: Bug#19604 - CHECK TABLE with concurrent INSERT can reset auto_increment Changed update_auto_increment() to retrieve_auto_increment() to reflect that it does not change the auto_increment by itself any more. This must now be done externally if needed.
Diffstat (limited to 'myisam/mi_write.c')
-rw-r--r--myisam/mi_write.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/myisam/mi_write.c b/myisam/mi_write.c
index 5e79b2937cc..9ab8753f6d7 100644
--- a/myisam/mi_write.c
+++ b/myisam/mi_write.c
@@ -149,7 +149,8 @@ int mi_write(MI_INFO *info, byte *record)
info->state->checksum+=info->checksum;
}
if (share->base.auto_key)
- update_auto_increment(info,record);
+ set_if_bigger(info->s->state.auto_increment,
+ retrieve_auto_increment(info, record));
info->update= (HA_STATE_CHANGED | HA_STATE_AKTIV | HA_STATE_WRITTEN |
HA_STATE_ROW_CHANGED);
info->state->records++;