Bug #4407 | mysql-4.1.3 assertion in ha_myisam.cc | ||
---|---|---|---|
Submitted: | 5 Jul 2004 9:18 | Modified: | 6 Jul 2004 17:52 |
Reporter: | Alexander Y. Fomichev | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | OS: | ||
Assigned to: | Antony Curtis | CPU Architecture: | Any |
[5 Jul 2004 9:18]
Alexander Y. Fomichev
[5 Jul 2004 22:29]
Antony Curtis
Hi, Are you able to provide an example of queries which can trigger the assertion that you reported? It would help us a lot when trying to trace this bug. I think it is possible for this bug to occur when using subqueries. To test this, in item_subselect.cc near line 1271, can you try the following patch: --- item_subselect.cc.orig Mon Jul 5 21:26:12 2004 +++ item_subselect.cc Mon Jul 5 21:27:14 2004 @@ -1268,7 +1268,8 @@ subselect_uniquesubquery_engine::~subselect_uniquesubquery_engine() { /* Tell handler we don't need the index anymore */ - tab->table->file->ha_index_end(); + if (tab->table->file->inited) + tab->table->file->ha_index_end(); }
[6 Jul 2004 8:52]
Sergey Kostyliov
Hello Antony! Unfortunately the patch you provide doesn't change anything. I believe that the problem itself has nothing to do with user queries and it seems for me that the bug is somewhere in the grant sybsystem (If I understand mysqld correctly). I could not provide simple `mysql test < tc.sql' but the following sequence is enough to reproduce this problem for me: 1) Create fresh mysql grant db (via mysql_install_db). 2) Load mysql grant db dump (obtained from within mysql-4.1.2): `bzcat bug4407.sql.bz2 | mysql --socket=/var/lib/mysq/2/mysql.sock mysql' 3) Restart mysql: `mysqladmin --socket=/var/lib/mysq/2/mysql.sock shutdown && /usr/local/src/mysql-4.1.3-beta/sql/mysqld `my_print_defaults mysqld2` --debug' InnoDB: Warning: we did not need to do crash recovery, but log scan InnoDB: progressed past the checkpoint lsn 144 558394761 up to lsn 144 558394808 040706 10:24:33 InnoDB: Started; log sequence number 144 558394761 mysqld: ha_myisam.cc:1094: virtual int ha_myisam::index_next(byte*): Assertion `inited==INDEX' failed. ... Thank you!
[6 Jul 2004 9:01]
Alexander Y. Fomichev
mysql grant db has been attached (see file: bug4407.sql.bz2) Thank you!
[6 Jul 2004 14:08]
Antony Curtis
Problem occurs when index_read_idx() is called, followed by index_next(). index_read_idx() does not set inited and active_index . This occurs in GRANT_TABLE::GRANT_TABLE(TABLE *, TABLE *)
[6 Jul 2004 14:25]
Antony Curtis
The following patch fixes it for me.... --- sql_acl.cc.orig Tue Jul 6 13:22:38 2004 +++ sql_acl.cc Tue Jul 6 13:23:36 2004 @@ -1790,11 +1790,13 @@ col_privs->field[3]->pack_length()); key_copy(key,col_privs,0,key_len); col_privs->field[4]->store("",0, &my_charset_latin1); - if (col_privs->file->index_read_idx(col_privs->record[0],0, + col_privs->file->ha_index_init(0); + if (col_privs->file->index_read(col_privs->record[0], (byte*) col_privs->field[0]->ptr, key_len, HA_READ_KEY_EXACT)) { cols = 0; /* purecov: deadcode */ + col_privs->file->ha_index_end(); return; } do @@ -1814,6 +1816,7 @@ my_hash_insert(&hash_columns, (byte *) mem_check); } while (!col_privs->file->index_next(col_privs->record[0]) && !key_cmp_if_same(col_privs,key,0,key_len)); + col_privs->file->ha_index_end(); } }
[6 Jul 2004 17:52]
Antony Curtis
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bugfix, yourself. More information about accessing the source trees is available at http://www.mysql.com/doc/en/Installing_source_tree.html