summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-06-28 15:06:04 +0300
committerunknown <monty@hundin.mysql.fi>2002-06-28 15:06:04 +0300
commit86d5987694ed0067f89ca4ba21fecbe8744b3cd4 (patch)
tree50f891adc2032af8c95592f9869e2a78f3cc778f
parentcaff05523cbc4ac7bfada244a829171c12f313c5 (diff)
downloadmariadb-git-86d5987694ed0067f89ca4ba21fecbe8744b3cd4.tar.gz
Fixed bug in REPAIR table.
Portability fix in safemalloc.c libmysqld/lib_sql.cc: Removed not needed define myisam/sort.c: Fixed core dump crash in repair table. mysql-test/r/myisam.result: Test for repair table mysql-test/t/myisam.test: Test for repair table mysys/safemalloc.c: Portability fix
-rw-r--r--libmysqld/lib_sql.cc2
-rw-r--r--myisam/sort.c2
-rw-r--r--mysql-test/r/myisam.result22
-rw-r--r--mysql-test/t/myisam.test27
-rw-r--r--mysys/safemalloc.c6
5 files changed, 54 insertions, 5 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index 1ef84607155..ec3b91914df 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -24,10 +24,8 @@
#define main main1
#define mysql_unix_port mysql_inix_port1
#define mysql_port mysql_port1
-#if !defined(__WIN__)
#define net_read_timeout net_read_timeout1
#define net_write_timeout net_write_timeout1
-#endif
#define changeable_vars changeable_vars1
extern "C"
diff --git a/myisam/sort.c b/myisam/sort.c
index 323983b05f8..65b606f7a68 100644
--- a/myisam/sort.c
+++ b/myisam/sort.c
@@ -701,7 +701,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
if (init_queue(&queue,(uint) (Tb-Fb)+1,offsetof(BUFFPEK,key),0,
(int (*)(void*, byte *,byte*)) info->key_cmp,
- (void*) info->sort_info))
+ (void*) info))
DBUG_RETURN(1); /* purecov: inspected */
for (buffpek= Fb ; buffpek <= Tb ; buffpek++)
diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
index c5c69c1ba7b..ac9665ad906 100644
--- a/mysql-test/r/myisam.result
+++ b/mysql-test/r/myisam.result
@@ -75,3 +75,25 @@ explain select a,b,c from t1;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 4
drop table t1;
+CREATE TABLE `t1` (
+`post_id` mediumint(8) unsigned NOT NULL auto_increment,
+`topic_id` mediumint(8) unsigned NOT NULL default '0',
+`post_time` datetime NOT NULL default '0000-00-00 00:00:00',
+`post_text` text NOT NULL,
+`icon_url` varchar(10) NOT NULL default '',
+`sign` tinyint(1) unsigned NOT NULL default '0',
+`post_edit` varchar(150) NOT NULL default '',
+`poster_login` varchar(35) NOT NULL default '',
+`ip` varchar(15) NOT NULL default '',
+PRIMARY KEY (`post_id`),
+KEY `post_time` (`post_time`),
+KEY `ip` (`ip`),
+KEY `poster_login` (`poster_login`),
+KEY `topic_id` (`topic_id`),
+FULLTEXT KEY `post_text` (`post_text`)
+) TYPE=MyISAM;
+INSERT INTO t1 (post_text) VALUES ('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test');
+REPAIR TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+drop table t1;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 861bc807323..8a65ffcc72f 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -66,3 +66,30 @@ explain select a,b from t1 order by b;
explain select a,b from t1;
explain select a,b,c from t1;
drop table t1;
+
+#
+# Test of REPAIR that once failed
+#
+CREATE TABLE `t1` (
+ `post_id` mediumint(8) unsigned NOT NULL auto_increment,
+ `topic_id` mediumint(8) unsigned NOT NULL default '0',
+ `post_time` datetime NOT NULL default '0000-00-00 00:00:00',
+ `post_text` text NOT NULL,
+ `icon_url` varchar(10) NOT NULL default '',
+ `sign` tinyint(1) unsigned NOT NULL default '0',
+ `post_edit` varchar(150) NOT NULL default '',
+ `poster_login` varchar(35) NOT NULL default '',
+ `ip` varchar(15) NOT NULL default '',
+ PRIMARY KEY (`post_id`),
+ KEY `post_time` (`post_time`),
+ KEY `ip` (`ip`),
+ KEY `poster_login` (`poster_login`),
+ KEY `topic_id` (`topic_id`),
+ FULLTEXT KEY `post_text` (`post_text`)
+) TYPE=MyISAM;
+
+INSERT INTO t1 (post_text) VALUES ('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test'),('ceci est un test');
+
+REPAIR TABLE t1;
+drop table t1;
+
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index 768edc9f11e..07a19504604 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -379,8 +379,10 @@ static int check_ptr(const char *where, byte *ptr, const char *sFile,
static int legal_leak(struct remember* pPtr)
{
/* TODO: This code needs to be made more general */
- return (pthread_self() == pPtr->thread_id || main_th == pPtr->thread_id ||
- shutdown_th == pPtr->thread_id || signal_th == pPtr->thread_id);
+ return (pthread_equal(pthread_self(), pPtr->thread_id) ||
+ pthread_equal(main_th, pPtr->thread_id) ||
+ pthread_equal(shutdown_th,pPtr->thread_id) ||
+ pthread_equal(signal_th,pPtr->thread_id));
}
#endif /* THREAD */