List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:March 30 2007 10:00am
Subject:bk commit into 5.0 tree (svoj:1.2426) BUG#26138
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of svoj. When svoj does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-03-30 13:00:21+05:00, svoj@stripped +6 -0
  BUG#26138 - REPAIR TABLE with option USE_FRM erases all records in
              ARCHIVE table
  ARCHIVE table was truncated by REPAIR TABLE ... USE_FRM statement.
  The table handler returned its file name extensions in a wrong order.
  REPAIR TABLE believed it has to use the meta file to create a new table
  from it.
  
  With the fixed order, REPAIR TABLE does now use the data file to create
  a new table. So REPAIR TABLE ... USE_FRM works well with ARCHIVE engine
  now.
  
  This issue affects 5.0 only, since in 5.1 ARCHIVE engine stores meta
  information and data in the same file.

  mysql-test/r/archive.result@stripped, 2007-03-30 13:00:19+05:00, svoj@stripped +9 -0
    A test case for bug#26138.

  mysql-test/t/archive.test@stripped, 2007-03-30 13:00:20+05:00, svoj@stripped +10 -0
    A test case for bug#26138.

  sql/examples/ha_example.cc@stripped, 2007-03-30 13:00:20+05:00, svoj@stripped +6 -0
    Added a comment.

  sql/ha_archive.cc@stripped, 2007-03-30 13:00:20+05:00, svoj@stripped +1 -1
    First element of engine file name extentions array should be meta/index
    file extention. Second element - data file extention. This is true
    for engines that have separate meta/index file and data file.
    
    Reoder ha_archive_exts elements to meet described above requirement.

  sql/handler.h@stripped, 2007-03-30 13:00:20+05:00, svoj@stripped +11 -0
    Added a comment.

  sql/sql_table.cc@stripped, 2007-03-30 13:00:20+05:00, svoj@stripped +3 -1
    Added a comment.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	svoj
# Host:	june.mysql.com
# Root:	/home/svoj/devel/mysql/BUG26138/mysql-5.0-engines

--- 1.182/sql/handler.h	2006-12-31 00:02:06 +04:00
+++ 1.183/sql/handler.h	2007-03-30 13:00:20 +05:00
@@ -780,6 +780,17 @@ public:
   virtual void free_foreign_key_create_info(char* str) {}
   /* The following can be called without an open handler */
   virtual const char *table_type() const =0;
+  /*
+    If frm_error() is called then we will use this to find out what file
+    extentions exist for the storage engine. This is also used by the default
+    rename_table and delete_table method in handler.cc.
+
+    For engines that have two file name extentions (separate meta/index file
+    and data file), the order of elements is relevant. First element of engine
+    file name extentions array should be meta/index file extention. Second
+    element - data file extention. This order is assumed by
+    prepare_for_repair() when REPAIR TABLE ... USE_FRM is issued.
+  */
   virtual const char **bas_ext() const =0;
   virtual ulong table_flags(void) const =0;
   virtual ulong index_flags(uint idx, uint part, bool all_parts) const =0;

--- 1.335/sql/sql_table.cc	2007-03-20 00:59:22 +04:00
+++ 1.336/sql/sql_table.cc	2007-03-30 13:00:20 +05:00
@@ -2068,7 +2068,9 @@ static int prepare_for_repair(THD* thd, 
 
   /*
     Check if this is a table type that stores index and data separately,
-    like ISAM or MyISAM
+    like ISAM or MyISAM. We assume fixed order of engine file name
+    extentions array. First element of engine file name extentions array
+    is meta/index file extention. Second element - data file extention. 
   */
   if (!ext[0] || !ext[1])
     goto end;					// No data file

--- 1.16/mysql-test/r/archive.result	2006-12-11 19:43:18 +04:00
+++ 1.17/mysql-test/r/archive.result	2007-03-30 13:00:19 +05:00
@@ -12355,3 +12355,12 @@ auto	fld1	companynr	fld3	fld4	fld5
 4	011403	37	intercepted	audiology	tinily
 4	011403	37	intercepted	audiology	tinily
 drop table t1, t2, t4;
+create table t1 (i int) engine=archive;
+insert into t1 values (1);
+repair table t1 use_frm;
+Table	Op	Msg_type	Msg_text
+test.t1	repair	status	OK
+select * from t1;
+i
+1
+drop table t1;

--- 1.17/mysql-test/t/archive.test	2006-12-11 19:43:18 +04:00
+++ 1.18/mysql-test/t/archive.test	2007-03-30 13:00:20 +05:00
@@ -1364,3 +1364,13 @@ SELECT * from t2;
 
 
 drop table t1, t2, t4;
+
+#
+# BUG#26138 - REPAIR TABLE with option USE_FRM erases all records in ARCHIVE
+#             table
+#
+create table t1 (i int) engine=archive;
+insert into t1 values (1);
+repair table t1 use_frm;
+select * from t1;
+drop table t1;

--- 1.83/sql/ha_archive.cc	2007-03-01 12:52:22 +04:00
+++ 1.84/sql/ha_archive.cc	2007-03-30 13:00:20 +05:00
@@ -503,8 +503,8 @@ int ha_archive::init_archive_writer()
   We just implement one additional file extension.
 */
 static const char *ha_archive_exts[] = {
-  ARZ,
   ARM,
+  ARZ,
   NullS
 };
 

--- 1.22/sql/examples/ha_example.cc	2006-12-23 23:04:28 +04:00
+++ 1.23/sql/examples/ha_example.cc	2007-03-30 13:00:20 +05:00
@@ -211,6 +211,12 @@ ha_example::ha_example(TABLE *table_arg)
   If frm_error() is called then we will use this to to find out what file extentions
   exist for the storage engine. This is also used by the default rename_table and
   delete_table method in handler.cc.
+
+  For engines that have two file name extentions (separate meta/index file
+  and data file), the order of elements is relevant. First element of engine
+  file name extentions array should be meta/index file extention. Second
+  element - data file extention. This order is assumed by
+  prepare_for_repair() when REPAIR TABLE ... USE_FRM is issued.
 */
 static const char *ha_example_exts[] = {
   NullS
Thread
bk commit into 5.0 tree (svoj:1.2426) BUG#26138Sergey Vojtovich30 Mar