Below is the list of changes that have just been committed into a local
5.1 repository of mikron. When mikron does a push these changes will
be propagated 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://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2110 06/02/07 16:26:34 mikron@stripped +2 -0
WL 2826: Step 12
More table log code
sql/sql_table.cc
1.304 06/02/07 16:26:23 mikron@stripped +112 -9
New table log code
sql/mysql_priv.h
1.383 06/02/07 16:26:23 mikron@stripped +1 -0
Added new call
# 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: mikron
# Host: mikael-ronstr-ms-dator.local
# Root: /Users/mikron/wl2826
--- 1.382/sql/mysql_priv.h 2006-02-07 10:44:55 +01:00
+++ 1.383/sql/mysql_priv.h 2006-02-07 16:26:23 +01:00
@@ -1182,6 +1182,7 @@
bool execute_table_log_action(TABLE_LOG_ENTRY *table_log_entry);
void lock_global_table_log();
void unlock_global_table_log();
+bool sync_table_log();
bool write_log_shadow_frm(ALTER_PARTITION_PARAM_TYPE *lpt, bool install_flag);
bool write_log_drop_partition(ALTER_PARTITION_PARAM_TYPE *lpt);
--- 1.303/sql/sql_table.cc 2006-02-07 10:44:55 +01:00
+++ 1.304/sql/sql_table.cc 2006-02-07 16:26:23 +01:00
@@ -281,6 +281,7 @@
char *file_name;
List<TABLE_LOG_MEMORY_ENTRY> free_entries;
List<TABLE_LOG_MEMORY_ENTRY> log_entries;
+ uint no_entries;
File file_id;
uint name_len;
uint handler_type_len;
@@ -292,6 +293,52 @@
/*
+ Sync table log file
+ SYNOPSIS
+ sync_table_log()
+ RETURN VALUES
+ TRUE Error
+ FALSE Success
+*/
+
+bool
+sync_table_log()
+{
+ bool error= FALSE;
+ DBUG_ENTER("sync_table_log");
+
+ if (my_sync(global_table_log.file_id, MYF(0)))
+ error= TRUE;
+ DBUG_RETURN(error);
+}
+
+
+/*
+ Write one entry from table log file
+ SYNOPSIS
+ write_table_log_file_entry()
+ file_id File identifier
+ file_entry Memory area to read entry into
+ entry_no Entry number to read
+ RETURN VALUES
+ TRUE Error
+ FALSE Success
+*/
+
+static
+bool
+write_table_log_file_entry(File file_id, byte *file_entry, uint entry_no)
+{
+ bool error= FALSE;
+ DBUG_ENTER("read_table_log_file_entry");
+
+ if (my_pwrite(file_id, file_entry, IO_SIZE, IO_SIZE * entry_no, MYF(0)))
+ error= TRUE;
+ DBUG_RETURN(error);
+}
+
+
+/*
SYNOPSIS
write_table_log_entry()
table_log_entry Information about log entry
@@ -308,10 +355,67 @@
bool
write_table_log_entry(TABLE_LOG_ENTRY *table_log_entry,
- uint next_entry,
uint *entry_written)
{
+ bool write_header, error;
DBUG_ENTER("write_table_log_entry");
+
+ global_table_log.file_entry[0]= 'i';
+ global_table_log.file_entry[1]= table_log_entry->action_type;
+ int4store(&global_table_log.file_entry[2],
+ table_log_entry->next_entry);
+ strcpy(&global_table_log.file_entry[6], table_log_entry->name);
+ if (table_log_entry.action_type == 'r')
+ global_table_log.file_entry[6 + NAMELEN]= 0;
+ else
+ strcpy(&global_table_log.file_entry[6 + NAMELEN],
+ table_log_entry->from_name);
+ strcpy(&global_table_log.file_entry[6 + (2*NAMELEN)],
+ table_log_entry->handler_type);
+ if (global_table_log.free_entries.is_empty())
+ {
+ global_table_log.no_entries++;
+ entry_no= global_table_log.no_entries;
+ write_header= TRUE;
+ }
+ else
+ {
+ TABLE_LOG_MEMORY *tmp= global_table_log.free_entries.pop();
+ global_table_log.log_entries.push_back(tmp);
+ entry_no= tmp->entry_pos;
+ write_header= FALSE;
+ }
+ error= FALSE;
+ if (write_table_log_entry(global_table_log.file_id,
+ global_table_log.file_entry,
+ entry_no))
+ error= TRUE;
+ else if (write_header || !(write_table_log_header()))
+ error= TRUE;
+ DBUG_RETURN(error);
+}
+
+
+/*
+ Write table log header
+ SYNOPSIS
+ write_table_log_header()
+ RETURN VALUES
+ TRUE Error
+ FALSE Success
+*/
+
+bool
+write_table_log_header()
+{
+ uint16 const_var;
+ DBUG_ENTER("write_table_log_header");
+
+ int4store(&global_table_log.file_entry[0], global_table_log.no_entries);
+ const_var= NAMELEN;
+ int2store(&global_table_log.file_entry[4], const_var);
+ const_var= 32;
+ int2store(&global_table_log.file_entry[6], const_var);
DBUG_RETURN(FALSE);
}
@@ -398,6 +502,8 @@
global_table_log.name_len= uint2korr(&file_entry[4]);
global_table_log.handler_type_len= uint2korr(&file_entry[6]);
global_table_log.free_entries.clear();
+ global_table_log.log_entries.clear();
+ global_table_log.no_entries= 0;
VOID(pthread_mutex_init(&LOCK_gtl, MY_MUTEX_INIT_FAST));
DBUG_RETURN(entry_no);
}
@@ -439,18 +545,15 @@
bool
init_table_log()
{
- uint no_entries= 0;
- uint16 const_var;
+ bool error= FALSE;
DBUG_ENTER("init_table_log");
+
VOID(my_delete(global_table_log.file_name));
global_table_log.file_id= my_open(global_table_log.file_name,
0, 0, MYF(0));
- int4store(&global_table_log.file_entry[0], &no_entries);
- const_var= NAMELEN;
- int2store(&global_table_log.file_entry[4], &const_var);
- const_var= 32;
- int2store(&global_table_log.file_entry[6], &const_var);
- DBUG_RETURN(FALSE);
+ if (write_table_log_header())
+ error= TRUE;
+ DBUG_RETURN(error);
}
| Thread |
|---|
| • bk commit into 5.1 tree (mikron:1.2110) | mikael | 7 Feb |