Commit be4dfd21 authored by sasha@mysql.sashanet.com's avatar sasha@mysql.sashanet.com
Browse files

cleanup

removal of duplicate code in mf_iocache.cc 
work on failsafe replication
work on SEQ_READ_APPEND io cache
parent 0d3ffcf4
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -243,7 +243,10 @@ typedef struct st_typelib { /* Different types saved here */
  const char **type_names;
} TYPELIB;

enum cache_type {READ_CACHE,WRITE_CACHE,READ_FIFO,READ_NET,WRITE_NET};
enum cache_type {READ_CACHE,WRITE_CACHE,
		 SEQ_READ_APPEND /* sequential read or append */,
		 READ_FIFO,
		 READ_NET,WRITE_NET};
enum flush_type { FLUSH_KEEP, FLUSH_RELEASE, FLUSH_IGNORE_CHANGED,
		  FLUSH_FORCE_WRITE};

@@ -294,6 +297,16 @@ typedef struct st_io_cache /* Used when cacheing files */
{
  my_off_t pos_in_file,end_of_file;
  byte	*rc_pos,*rc_end,*buffer,*rc_request_pos;
  my_bool alloced_buffer; /* currented READ_NET is the only one
			     that will use a buffer allocated somewhere
			     else
			   */
  byte *append_buffer, *append_pos, *append_end;
/* for append buffer used in READ_APPEND cache */
#ifdef THREAD
  pthread_mutex_t append_buffer_lock;
  /* need mutex copying from append buffer to read buffer */
#endif  
  int (*read_function)(struct st_io_cache *,byte *,uint);
  /* callbacks when the actual read I/O happens */
  IO_CACHE_CALLBACK pre_read;
@@ -546,6 +559,7 @@ extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type,
			       my_off_t seek_offset,pbool use_async_io,
			       pbool clear_cache);
extern int _my_b_read(IO_CACHE *info,byte *Buffer,uint Count);
extern int _my_b_seq_read(IO_CACHE *info,byte *Buffer,uint Count);
extern int _my_b_net_read(IO_CACHE *info,byte *Buffer,uint Count);
extern int _my_b_get(IO_CACHE *info);
extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count);
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
# This file is public domain and comes with NO WARRANTY of any kind

target = libmysqlclient.la
target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID
target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID -DMYSQL_CLIENT
LIBS   = @CLIENT_LIBS@
INCLUDES =	-I$(srcdir)/../include -I../include \
		-I$(srcdir)/.. -I$(top_srcdir) -I.. $(openssl_includes)
+13 −5
Original line number Diff line number Diff line
@@ -1147,6 +1147,8 @@ static inline int get_slaves_from_master(MYSQL* mysql)
  MYSQL_ROW row;
  int error = 1;
  int has_auth_info;
  int port_ind;
  
  if (!mysql->net.vio && !mysql_real_connect(mysql,0,0,0,0,0,0,0))
  {
    expand_error(mysql, CR_PROBE_MASTER_CONNECT);
@@ -1162,8 +1164,14 @@ static inline int get_slaves_from_master(MYSQL* mysql)

  switch (mysql_num_fields(res))
  {
  case 3: has_auth_info = 0; break;
  case 5: has_auth_info = 1; break;
  case 5:
    has_auth_info = 0;
    port_ind=2;
    break;
  case 7:
    has_auth_info = 1;
    port_ind=4;
    break;
  default:
    goto err;
  }
@@ -1175,8 +1183,8 @@ static inline int get_slaves_from_master(MYSQL* mysql)

    if (has_auth_info)
    {
      tmp_user = row[3];
      tmp_pass = row[4];
      tmp_user = row[2];
      tmp_pass = row[3];
    }
    else
    {
@@ -1184,7 +1192,7 @@ static inline int get_slaves_from_master(MYSQL* mysql)
      tmp_pass = mysql->passwd;
    }

    if (!(slave = spawn_init(mysql, row[1], atoi(row[2]),
    if (!(slave = spawn_init(mysql, row[1], atoi(row[port_ind]),
			    tmp_user, tmp_pass)))
      goto err;
      
+24 −1
Original line number Diff line number Diff line
@@ -7,6 +7,29 @@ use test;
drop table if exists t1,t3;
create table t1 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t1;
 load data local infile '/home/sasha/bk/mysql-4.0/mysql-test/std_data/words.dat' into table t1;
select * from t1;
word
Aarhus
Aaron
Ababa
aback
abaft
abandon
abandoned
abandoning
abandonment
abandons
Aarhus
Aaron
Ababa
aback
abaft
abandon
abandoned
abandoning
abandonment
abandons
set password = password('foo');
set password = password('');
create table t3(n int);
@@ -18,7 +41,7 @@ n
2
select sum(length(word)) from t1;
sum(length(word))
71
141
drop table t1,t3;
reset master;
reset slave;
+2 −2
Original line number Diff line number Diff line
@@ -15,8 +15,8 @@ n
2001
2002
show slave hosts;
Server_id	Host	Port
2	127.0.0.1	$SLAVE_MYPORT
Server_id	Host	Port	Rpl_recovery_rank	Master_id
2	127.0.0.1	9307	2	1
drop table t1;
slave stop;
drop table if exists t2;
Loading