Commit b7269f4e authored by unknown's avatar unknown

bug#5389 merge.test fails on qnx - uninitalized variable in myrg_open()


myisammrg/myrg_open.c:
  backport from 4.1
mysql-test/r/union.result:
  after merge fix
mysql-test/t/union.test:
  after merge fix
sql/log.cc:
  backward compatibility: inhibit severity labels in error log
parent 3362cd8e
...@@ -34,14 +34,17 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) ...@@ -34,14 +34,17 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
{ {
int save_errno,errpos=0; int save_errno,errpos=0;
uint files=0,i,dir_length,length,key_parts; uint files=0,i,dir_length,length,key_parts;
ulonglong file_offset; ulonglong file_offset=0;
char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end; char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end;
MYRG_INFO *m_info=0; MYRG_INFO *m_info=0;
File fd; File fd;
IO_CACHE file; IO_CACHE file;
MI_INFO *isam=0; MI_INFO *isam=0;
uint found_merge_insert_method= 0;
DBUG_ENTER("myrg_open"); DBUG_ENTER("myrg_open");
LINT_INIT(key_parts);
bzero((char*) &file,sizeof(file)); bzero((char*) &file,sizeof(file));
if ((fd=my_open(fn_format(name_buff,name,"",MYRG_NAME_EXT,4), if ((fd=my_open(fn_format(name_buff,name,"",MYRG_NAME_EXT,4),
O_RDONLY | O_SHARE,MYF(0))) < 0) O_RDONLY | O_SHARE,MYF(0))) < 0)
...@@ -69,10 +72,10 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) ...@@ -69,10 +72,10 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
continue; /* Skip empty lines */ continue; /* Skip empty lines */
if (buff[0] == '#') if (buff[0] == '#')
{ {
if( !strncmp(buff+1,"INSERT_METHOD=",14)) if (!strncmp(buff+1,"INSERT_METHOD=",14))
{ /* Lookup insert method */ { /* Lookup insert method */
int tmp=find_type(buff+15,&merge_insert_method,2); int tmp=find_type(buff+15,&merge_insert_method,2);
m_info->merge_insert_method = (uint) (tmp >= 0 ? tmp : 0); found_merge_insert_method = (uint) (tmp >= 0 ? tmp : 0);
} }
continue; /* Skip comments */ continue; /* Skip comments */
} }
...@@ -84,8 +87,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) ...@@ -84,8 +87,8 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
VOID(cleanup_dirname(buff,name_buff)); VOID(cleanup_dirname(buff,name_buff));
} }
if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0)))) if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0))))
goto err; goto err;
if (!m_info) if (!m_info) /* First file */
{ {
key_parts=isam->s->base.key_parts; key_parts=isam->s->base.key_parts;
if (!(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO) + if (!(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO) +
...@@ -97,15 +100,10 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) ...@@ -97,15 +100,10 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
{ {
m_info->open_tables=(MYRG_TABLE *) (m_info+1); m_info->open_tables=(MYRG_TABLE *) (m_info+1);
m_info->rec_per_key_part=(ulong *) (m_info->open_tables+files); m_info->rec_per_key_part=(ulong *) (m_info->open_tables+files);
m_info->tables= files;
files= 0;
} }
else
{
m_info->open_tables=0;
m_info->rec_per_key_part=0;
}
m_info->tables=files;
m_info->reclength=isam->s->base.reclength; m_info->reclength=isam->s->base.reclength;
file_offset=files=0;
errpos=3; errpos=3;
} }
m_info->open_tables[files].table= isam; m_info->open_tables[files].table= isam;
...@@ -122,14 +120,16 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking) ...@@ -122,14 +120,16 @@ MYRG_INFO *myrg_open(const char *name, int mode, int handle_locking)
m_info->del+= isam->state->del; m_info->del+= isam->state->del;
m_info->data_file_length+= isam->state->data_file_length; m_info->data_file_length+= isam->state->data_file_length;
for (i=0; i < key_parts; i++) for (i=0; i < key_parts; i++)
m_info->rec_per_key_part[i]+=isam->s->state.rec_per_key_part[i] / m_info->tables; m_info->rec_per_key_part[i]+= (isam->s->state.rec_per_key_part[i] /
m_info->tables);
} }
if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO), if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO),
MYF(MY_WME|MY_ZEROFILL)))) MYF(MY_WME | MY_ZEROFILL))))
goto err; goto err;
/* Don't mark table readonly, for ALTER TABLE ... UNION=(...) to work */ /* Don't mark table readonly, for ALTER TABLE ... UNION=(...) to work */
m_info->options&= ~(HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA); m_info->options&= ~(HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA);
m_info->merge_insert_method= found_merge_insert_method;
if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L) if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L)
{ {
......
...@@ -424,7 +424,6 @@ create table t1 select a from t1 union select a from t2; ...@@ -424,7 +424,6 @@ create table t1 select a from t1 union select a from t2;
INSERT TABLE 't1' isn't allowed in FROM table list INSERT TABLE 't1' isn't allowed in FROM table list
select a from t1 union select a from t2 order by t2.a; select a from t1 union select a from t2 order by t2.a;
Unknown column 't2.a' in 'ORDER BY' Unknown column 't2.a' in 'ORDER BY'
drop table t1;
drop table t1,t2; drop table t1,t2;
select length(version()) > 1 as `*` UNION select 2; select length(version()) > 1 as `*` UNION select 2;
* *
......
...@@ -229,7 +229,6 @@ drop table t1; ...@@ -229,7 +229,6 @@ drop table t1;
create table t1 select a from t1 union select a from t2; create table t1 select a from t1 union select a from t2;
--error 1054 --error 1054
select a from t1 union select a from t2 order by t2.a; select a from t1 union select a from t2 order by t2.a;
drop table t1; # Drop temporary table
drop table t1,t2; drop table t1,t2;
# #
......
...@@ -1221,7 +1221,7 @@ bool MYSQL_LOG::write(Log_event* event_info) ...@@ -1221,7 +1221,7 @@ bool MYSQL_LOG::write(Log_event* event_info)
if (e.write(file)) if (e.write(file))
goto err; goto err;
} }
#if MYSQL_VERSION_ID < 40100 #if MYSQL_VERSION_ID < 40100
if (thd->variables.convert_set) if (thd->variables.convert_set)
{ {
Query_log_event e(thd, "SET CHARACTER SET DEFAULT", 25, 0); Query_log_event e(thd, "SET CHARACTER SET DEFAULT", 25, 0);
...@@ -1761,15 +1761,21 @@ void print_buffer_to_file(enum loglevel level, const char *buffer) ...@@ -1761,15 +1761,21 @@ void print_buffer_to_file(enum loglevel level, const char *buffer)
skr=time(NULL); skr=time(NULL);
localtime_r(&skr, &tm_tmp); localtime_r(&skr, &tm_tmp);
start=&tm_tmp; start=&tm_tmp;
#if MYSQL_VERSION_ID > 40100
fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %s\n", fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %s\n",
start->tm_year % 100, #else
start->tm_mon+1, fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d %s\n",
start->tm_mday, #endif
start->tm_hour, start->tm_year % 100,
start->tm_min, start->tm_mon+1,
start->tm_sec, start->tm_mday,
start->tm_hour,
start->tm_min,
start->tm_sec,
#if MYSQL_VERSION_ID > 40100
(level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ? (level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
"WARNING" : "INFORMATION"), "WARNING" : "INFORMATION"),
#endif
buffer); buffer);
fflush(stderr); fflush(stderr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment