Commit 5fedd2dd authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi
Browse files

Fix for IO_CACHE.

Portability fixes.
parent 3c057478
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
/bin/rm -f */.deps/*.P */*.o
make -k clean
/bin/rm -f */.deps/*.P
/bin/rm -f config.cache
/bin/rm -f */.deps/*.P */*.o
/bin/rm -f */.deps/*.P config.cache innobase/config.cache bdb/build_unix/config.cache mysql-*.tar.gz
aclocal; autoheader; aclocal; automake; autoconf

CFLAGS=-O6 CXX=gcc CXXFLAGS="-O6 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-debug --with-extra-charsets=complex
CFLAGS=-O1 CC=gcc CXX=gcc CXXFLAGS="-O1 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-debug --with-extra-charsets=complex  --without-extra-tools
make
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ int vio_read(Vio * vio, gptr buf, int size)
  vio->reading = 1;
  if (vio->where_in_packet >= vio->end_of_packet)
  {
    dbug_assert(vio->packets);
    DBUG_ASSERT(vio->packets);
    vio->where_in_packet = vio->packets + sizeof(char *) + 4;
    vio->end_of_packet = vio->where_in_packet +
      			 uint4korr(vio->packets + sizeof(char *));
+5 −13
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ insert into t1 (b) select b from t2;
insert into t2 (b) select b from t1;
insert into t1 (b) select b from t2;
drop table t2;
 create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="/home/sasha/bk/mysql-4.0/mysql-test/var/tmp" index directory="/home/sasha/bk/mysql-4.0/mysql-test/var/run";
insert into t9 select * from t1;
check table t9;
Table	Op	Msg_type	Msg_text
@@ -45,18 +44,11 @@ alter table t9 rename t8, add column d int not null;
alter table t8 rename t7;
rename table t7 to t9;
drop table t1;
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="tmp";
Incorrect table name 'tmp'
drop database if exists test_mysqltest;
create database test_mysqltest;
create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="/this-dir-does-not-exist";
Can't create/write to file '/this-dir-does-not-exist/t9.MYI' (Errcode: 2)
create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="not-hard-path";
Incorrect table name 'not-hard-path'
 create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="/home/sasha/bk/mysql-4.0/mysql-test/var/run";
Can't create/write to file '/home/sasha/bk/mysql-4.0/mysql-test/var/run/t9.MYI' (Errcode: 17)
 create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="/home/sasha/bk/mysql-4.0/mysql-test/var/tmp";
Can't create/write to file '/home/sasha/bk/mysql-4.0/mysql-test/var/tmp/t9.MYD' (Errcode: 17)
Got one of the listed errors
Got one of the listed errors
Got one of the listed errors
Got one of the listed errors
Got one of the listed errors
alter table t9 rename test_mysqltest.t9;
select count(*) from test_mysqltest.t9;
count(*)
+12 −5
Original line number Diff line number Diff line
-- require r/have_symlink.require
disable_query_log;
show variables like "have_symlink";
enable_query_log;

#
# First create little data to play with
@@ -33,7 +35,10 @@ drop table t2;
# We use t9 here to not crash with tables generated by the backup test
# 

disable_query_log;
eval create table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="$MYSQL_TEST_DIR/var/tmp" index directory="$MYSQL_TEST_DIR/var/run";
enable_query_log;

insert into t9 select * from t1;
check table t9;
optimize table t9;
@@ -53,7 +58,8 @@ drop table t1;
# Note that we are using the above table t9 here!
#

--error 1103
disable_query_log;
--error 1103,1103
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="tmp";

# Check that we cannot link over a table from another database.
@@ -61,17 +67,18 @@ create table t1 (a int not null auto_increment, b char(16) not null, primary key
drop database if exists test_mysqltest;
create database test_mysqltest;

--error 1
--error 1,1
create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="/this-dir-does-not-exist";

--error 1103
--error 1103,1103
create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="not-hard-path";

--error 1
--error 1,1
eval create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="$MYSQL_TEST_DIR/var/run";

--error 1
--error 1,1
eval create table test_mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="$MYSQL_TEST_DIR/var/tmp";
enable_query_log;

# Check moving table t9 from default database to test_mysqltest;
# In this case the symlinks should be removed.
+8 −12
Original line number Diff line number Diff line
@@ -32,17 +32,16 @@

void my_b_seek(IO_CACHE *info,my_off_t pos)
{
  my_off_t offset = (pos - info->pos_in_file);
  DBUG_ENTER("my_b_seek");
  DBUG_PRINT("enter",("pos: %lu", (ulong) pos));

  if (info->type == READ_CACHE)
  {
    byte* try_pos=info->read_pos + (pos - info->pos_in_file);
    if (try_pos >= info->buffer &&
	try_pos <= info->read_end)
    if ((ulonglong) offset < (ulonglong) (info->read_end - info->buffer))
    {
      /* The position is in the current buffer; Reuse it */
      info->read_pos = try_pos;
      /* The read is in the current buffer; Reuse it */
      info->read_pos = info->buffer + offset;
      DBUG_VOID_RETURN;
    }
    else
@@ -53,16 +52,13 @@ void my_b_seek(IO_CACHE *info,my_off_t pos)
  }
  else if (info->type == WRITE_CACHE)
  {
    byte* try_pos;
    /* If write is in current buffer, reuse it */
    try_pos = info->write_pos + (pos - info->pos_in_file);
    if (try_pos >= info->write_buffer &&
	try_pos <= info->write_end)
    if ((ulonglong) offset <
	(ulonglong) (info->write_end - info->write_buffer))
    {
      info->write_pos = try_pos;
      info->write_pos = info->write_buffer + offset;
      DBUG_VOID_RETURN;
    }
    else
    flush_io_cache(info);
  }
  info->pos_in_file=pos;
Loading