Below is the list of changes that have just been committed into a
4.0 repository of sasha. When sasha does a push, they will be propogated 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://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet@stripped, 2001-07-20 16:22:54-06:00, sasha@stripped
added pre/post read callbacks to IO_CACHE
#ifdefed out code not used in the server from log events
started on new LOAD DATA INFILE events
include/my_sys.h
1.47 01/07/20 16:22:54 sasha@stripped +5 -0
added pre/post read callbacks to IO_CACHe
mysys/mf_iocache.c
1.8 01/07/20 16:22:54 sasha@stripped +6 -0
pre/post read callbacks
sql/log_event.cc
1.45 01/07/20 16:22:54 sasha@stripped +56 -1
cleanup to #ifdef out unneeded code in the server
started work on new Load data infile events
sql/log_event.h
1.48 01/07/20 16:22:54 sasha@stripped +56 -6
clean-up plus start of new LOAD DATA INFILE events work
sql/mf_iocache.cc
1.16 01/07/20 16:22:54 sasha@stripped +6 -0
pre/post read callbacks
sql/sql_class.cc
1.57 01/07/20 16:22:54 sasha@stripped +1 -0
file_id
sql/sql_class.h
1.84 01/07/20 16:22:54 sasha@stripped +1 -0
file_id
# 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: sasha
# Host: mysql.sashanet.com
# Root: /home/sasha/src/bk/mysql-4.0
--- 1.46/include/my_sys.h Fri Jun 1 15:05:55 2001
+++ 1.47/include/my_sys.h Fri Jul 20 16:22:54 2001
@@ -270,12 +270,17 @@
uint length,max_length,alloc_increment;
} DYNAMIC_STRING;
+struct st_io_cache;
+typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*);
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;
int (*read_function)(struct st_io_cache *,byte *,uint);
+ /* callbacks when the actual read I/O happens */
+ IO_CACHE_CALLBACK pre_read;
+ IO_CACHE_CALLBACK post_read;
char *file_name; /* if used with 'open_cached_file' */
char *dir,*prefix;
File file;
--- 1.7/mysys/mf_iocache.c Wed Nov 15 13:59:52 2000
+++ 1.8/mysys/mf_iocache.c Fri Jul 20 16:22:54 2001
@@ -56,6 +56,7 @@
DBUG_PRINT("enter",("type: %d pos: %ld",(int) type, (ulong) seek_offset));
info->file=file;
+ info->pre_read = info->post_read = 0;
if (!cachesize)
if (! (cachesize= my_default_record_cache_size))
DBUG_RETURN(1); /* No cache requested */
@@ -467,8 +468,13 @@
int _my_b_get(IO_CACHE *info)
{
byte buff;
+ IO_CACHE_CALLBACK pre_read,post_read;
+ if ((pre_read = info->pre_read))
+ (*pre_read)(info);
if ((*(info)->read_function)(info,&buff,1))
return my_b_EOF;
+ if ((post_read = info->post_read))
+ (*post_read)(info);
return (int) (uchar) buff;
}
--- 1.44/sql/log_event.cc Tue Jun 26 17:02:32 2001
+++ 1.45/sql/log_event.cc Fri Jul 20 16:22:54 2001
@@ -23,7 +23,7 @@
#include "slave.h"
#endif /* MYSQL_CLIENT */
-
+#ifdef MYSQL_CLIENT
static void pretty_print_char(FILE* file, int c)
{
fputc('\'', file);
@@ -41,6 +41,7 @@
}
fputc('\'', file);
}
+#endif
#ifndef MYSQL_CLIENT
@@ -444,6 +445,7 @@
return NULL; // default value
}
+#ifdef MYSQL_CLIENT
void Log_event::print_header(FILE* file)
{
fputc('#', file);
@@ -508,6 +510,8 @@
fflush(file);
}
+#endif /* #ifdef MYSQL_CLIENT */
+
Start_log_event::Start_log_event(const char* buf) :Log_event(buf)
{
binlog_version = uint2korr(buf + LOG_EVENT_HEADER_LEN +
@@ -576,6 +580,8 @@
*((char*)query+q_len) = 0;
}
+#ifdef MYSQL_CLIENT
+
void Query_log_event::print(FILE* file, bool short_form, char* last_db)
{
char buff[40],*end; // Enough for SET TIMESTAMP
@@ -604,6 +610,8 @@
fprintf(file, ";\n");
}
+#endif
+
int Query_log_event::write_data(IO_CACHE* file)
{
if (!query) return -1;
@@ -644,6 +652,7 @@
return my_b_write(file, (byte*) buf, sizeof(buf));
}
+#ifdef MYSQL_CLIENT
void Intvar_log_event::print(FILE* file, bool short_form, char* last_db)
{
char llbuff[22];
@@ -667,6 +676,7 @@
fflush(file);
}
+#endif
int Load_log_event::write_data(IO_CACHE* file)
{
@@ -742,6 +752,7 @@
field_block_len;
}
+#ifdef MYSQL_CLIENT
void Load_log_event::print(FILE* file, bool short_form, char* last_db)
{
@@ -825,6 +836,8 @@
fprintf(file, ";\n");
}
+#endif /* #ifdef MYSQL_CLIENT */
+
#ifndef MYSQL_CLIENT
void Log_event::set_log_seq(THD* thd, MYSQL_LOG* log)
@@ -879,6 +892,8 @@
my_free(mem_pool, MYF(MY_ALLOW_ZERO_PTR));
}
+#ifdef MYSQL_CLIENT
+
void Slave_log_event::print(FILE* file, bool short_form = 0,
char* last_db = 0)
{
@@ -892,6 +907,8 @@
llstr(master_pos, llbuff));
}
+#endif
+
int Slave_log_event::get_data_size()
{
return master_host_len + master_log_len + 1 + SL_MASTER_HOST_OFFSET;
@@ -934,3 +951,41 @@
mem_pool[event_len] = 0;
init_from_mem_pool(event_len);
}
+
+#ifndef MYSQL_CLIENT
+Create_file_log_event::Create_file_log_event(THD* thd, TABLE_LIST * table,
+ char* block_arg,
+ uint block_len_arg) :
+ Log_event(thd->start_time), db(table->db),tbl_name(table->real_name),
+ db_len(strlen(table->db)),tbl_name_len(strlen(table->real_name)),
+ block(block_arg),block_len(block_len_arg),
+ file_id(thd->file_id = thd->query_id)
+{
+ set_log_seq(thd, &mysql_bin_log);
+}
+#endif
+
+int Create_file_log_event::write_data(IO_CACHE* file)
+{
+ return 0;
+}
+
+#ifdef MYSQL_CLIENT
+void Create_file_log_event::print(FILE* file, bool short_form = 0,
+ char* last_db = 0)
+{
+}
+#endif
+
+#ifndef MYSQL_CLIENT
+void Create_file_log_event::pack_info(String* packet)
+{
+}
+#endif
+
+
+
+
+
+
+
--- 1.47/sql/log_event.h Tue Jul 10 06:52:33 2001
+++ 1.48/sql/log_event.h Fri Jul 20 16:22:54 2001
@@ -55,6 +55,7 @@
#define LOAD_HEADER_LEN (4 + 4 + 4 + 1 +1 + 4)
#define START_HEADER_LEN (2 + ST_SERVER_VER_LEN + 4)
#define ROTATE_HEADER_LEN 8
+#define CREATE_FILE_HEADER_LEN 6
/* event header offsets */
@@ -108,6 +109,7 @@
#define QUERY_DATA_OFFSET (LOG_EVENT_HEADER_LEN+QUERY_HEADER_LEN)
#define ROTATE_EVENT_OVERHEAD (LOG_EVENT_HEADER_LEN+ROTATE_HEADER_LEN)
#define LOAD_EVENT_OVERHEAD (LOG_EVENT_HEADER_LEN+LOAD_HEADER_LEN+sizeof(sql_ex_info))
+#define CREATE_FILE_EVENT_OVERHEAD (LOG_EVENT_HEADER_LEN+CREATE_FILE_HEADER_LEN)
#define BINLOG_MAGIC "\xfe\x62\x69\x6e"
@@ -116,7 +118,8 @@
enum Log_event_type { START_EVENT = 1, QUERY_EVENT =2,
STOP_EVENT=3, ROTATE_EVENT = 4, INTVAR_EVENT=5,
- LOAD_EVENT=6, SLAVE_EVENT=7, FILE_EVENT=8};
+ LOAD_EVENT=6, SLAVE_EVENT=7, CREATE_FILE_EVENT=8,
+ APPEND_TO_FILE_EVENT=9, EXEC_LOAD_EVENT=10, DELETE_FILE_EVENT=11};
enum Int_event_type { INVALID_INT_EVENT = 0, LAST_INSERT_ID_EVENT = 1, INSERT_ID_EVENT = 2
};
@@ -175,10 +178,11 @@
virtual ~Log_event() {}
virtual int get_data_size() { return 0;}
+#ifdef MYSQL_CLIENT
virtual void print(FILE* file, bool short_form = 0, char* last_db = 0) = 0;
-
void print_timestamp(FILE* file, time_t *ts = 0);
void print_header(FILE* file);
+#endif
// if mutex is 0, the read will proceed without mutex
static Log_event* read_log_event(IO_CACHE* file, pthread_mutex_t* log_lock);
@@ -250,8 +254,9 @@
+ 2 // error_code
;
}
-
+#ifdef MYSQL_CLIENT
void print(FILE* file, bool short_form = 0, char* last_db = 0);
+#endif
};
class Slave_log_event: public Log_event
@@ -276,7 +281,9 @@
~Slave_log_event();
int get_data_size();
Log_event_type get_type_code() { return SLAVE_EVENT; }
+#ifdef MYSQL_CLIENT
void print(FILE* file, bool short_form = 0, char* last_db = 0);
+#endif
int write_data(IO_CACHE* file );
};
@@ -419,8 +426,9 @@
+ sizeof(sql_ex) + field_block_len + num_fields*sizeof(uchar) ;
;
}
-
+#ifdef MYSQL_CLIENT
void print(FILE* file, bool short_form = 0, char* last_db = 0);
+#endif
};
extern char server_version[SERVER_VERSION_LENGTH];
@@ -448,8 +456,10 @@
}
#ifndef MYSQL_CLIENT
void pack_info(String* packet);
-#endif
+#endif
+#ifdef MYSQL_CLIENT
void print(FILE* file, bool short_form = 0, char* last_db = 0);
+#endif
};
class Intvar_log_event: public Log_event
@@ -470,8 +480,9 @@
void pack_info(String* packet);
#endif
-
+#ifdef MYSQL_CLIENT
void print(FILE* file, bool short_form = 0, char* last_db = 0);
+#endif
};
class Stop_log_event: public Log_event
@@ -484,7 +495,9 @@
}
~Stop_log_event() {}
Log_event_type get_type_code() { return STOP_EVENT;}
+#ifdef MYSQL_CLIENT
void print(FILE* file, bool short_form = 0, char* last_db = 0);
+#endif
};
class Rotate_log_event: public Log_event
@@ -513,12 +526,49 @@
Log_event_type get_type_code() { return ROTATE_EVENT;}
int get_data_size() { return ident_len + ROTATE_HEADER_LEN;}
int write_data(IO_CACHE* file);
+#ifdef MYSQL_CLIENT
+ void print(FILE* file, bool short_form = 0, char* last_db = 0);
+#endif
+#ifndef MYSQL_CLIENT
+ void pack_info(String* packet);
+#endif
+};
+
+/* the classes below are for the new LOAD DATA INFILE logging */
+
+class Create_file_log_event: public Log_event
+{
+public:
+ char* db;
+ char* tbl_name;
+ uint db_len;
+ uint tbl_name_len;
+ char* block;
+ uint block_len;
+ uint file_id;
+
+#ifndef MYSQL_CLIENT
+ Create_file_log_event(THD* thd, TABLE_LIST * table, char* block_arg,
+ uint block_len_arg);
+#endif
+ Create_file_log_event(const char* buf, int event_len);
+ ~Create_file_log_event()
+ {
+ }
+ Log_event_type get_type_code() { return CREATE_FILE_EVENT;}
+ int get_data_size() { return tbl_name_len + block_len +
+ CREATE_FILE_HEADER_LEN ;}
+ int write_data(IO_CACHE* file);
+
+#ifdef MYSQL_CLIENT
void print(FILE* file, bool short_form = 0, char* last_db = 0);
+#endif
#ifndef MYSQL_CLIENT
void pack_info(String* packet);
#endif
};
+
#endif
--- 1.15/sql/mf_iocache.cc Thu Dec 7 05:08:45 2000
+++ 1.16/sql/mf_iocache.cc Fri Jul 20 16:22:54 2001
@@ -57,6 +57,7 @@
/* There is no file in net_reading */
info->file= file;
+ info->pre_read = info->post_read = 0;
if (!cachesize)
if (! (cachesize= my_default_record_cache_size))
DBUG_RETURN(1); /* No cache requested */
@@ -535,8 +536,13 @@
int _my_b_get(IO_CACHE *info)
{
byte buff;
+ IO_CACHE_CALLBACK pre_read,post_read;
+ if ((pre_read = info->pre_read))
+ (*pre_read)(info);
if ((*(info)->read_function)(info,&buff,1))
return my_b_EOF;
+ if ((post_read = info->post_read))
+ (*post_read)(info);
return (int) (uchar) buff;
}
--- 1.56/sql/sql_class.cc Thu Jun 28 01:49:15 2001
+++ 1.57/sql/sql_class.cc Fri Jul 20 16:22:54 2001
@@ -99,6 +99,7 @@
slave_thread = 0;
slave_proxy_id = 0;
log_seq = 0;
+ file_id = 0;
cond_count=0;
convert_set=0;
mysys_var=0;
--- 1.83/sql/sql_class.h Thu Jul 12 06:58:19 2001
+++ 1.84/sql/sql_class.h Fri Jul 20 16:22:54 2001
@@ -248,6 +248,7 @@
enum enum_server_command command;
uint32 server_id;
uint32 log_seq;
+ uint32 file_id; // for LOAD DATA INFILE
const char *where;
time_t start_time,time_after_lock,user_time;
time_t connect_time,thr_create_time; // track down slow pthread_create
| Thread |
|---|
| • bk commit into 4.0 tree | sasha | 21 Jul |