summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authortulin@build.mysql.com <>2005-01-08 00:34:08 +0100
committertulin@build.mysql.com <>2005-01-08 00:34:08 +0100
commit3d773f79ea54ad07ca58f3b0a6f3cee4721b236a (patch)
treea63480a6b1b22f6c0c4597abcfff92f3d221346d /sql
parent7043c9d4aae0cfcf7011127a8869f90eb5d7bf00 (diff)
parent52ebc04fc5629eb1173287c7b37b1c34cbcd24d2 (diff)
downloadmariadb-git-3d773f79ea54ad07ca58f3b0a6f3cee4721b236a.tar.gz
Merge bk-internal:/home/bk/mysql-5.0
into build.mysql.com:/users/tulin/mysql-5.0-ndb
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_innodb.cc2
-rw-r--r--sql/handler.cc2
-rw-r--r--sql/handler.h3
-rw-r--r--sql/lex.h2
-rw-r--r--sql/log.cc22
-rw-r--r--sql/mysqld.cc6
-rw-r--r--sql/sql_base.cc4
-rw-r--r--sql/sql_yacc.yy8
8 files changed, 37 insertions, 12 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 31b15f89806..0bca8c21715 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -3907,7 +3907,7 @@ ha_innobase::create(
error = create_table_def(trx, form, norm_name,
create_info->options & HA_LEX_CREATE_TMP_TABLE ? name2 : NULL,
- !(form->s->db_options_in_use & HA_OPTION_PACK_RECORD));
+ form->s->row_type != ROW_TYPE_REDUNDANT);
if (error) {
innobase_commit_low(trx);
diff --git a/sql/handler.cc b/sql/handler.cc
index bbe01dd93d5..b1b741dfee9 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -101,7 +101,7 @@ struct show_table_type_st sys_table_types[]=
};
const char *ha_row_type[] = {
- "", "FIXED", "DYNAMIC", "COMPRESSED","?","?","?"
+ "", "FIXED", "DYNAMIC", "COMPRESSED", "REDUNDANT", "COMPACT", "?","?","?"
};
const char *tx_isolation_names[] =
diff --git a/sql/handler.h b/sql/handler.h
index b10e6bfe88c..e5a794ca1b2 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -167,7 +167,8 @@ struct show_table_type_st {
};
enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
- ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED};
+ ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED,
+ ROW_TYPE_REDUNDANT, ROW_TYPE_COMPACT };
/* struct to hold information about the table that should be created */
diff --git a/sql/lex.h b/sql/lex.h
index 56d824b7bb8..871d1d99750 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -116,6 +116,7 @@ static SYMBOL symbols[] = {
{ "COMMENT", SYM(COMMENT_SYM)},
{ "COMMIT", SYM(COMMIT_SYM)},
{ "COMMITTED", SYM(COMMITTED_SYM)},
+ { "COMPACT", SYM(COMPACT_SYM)},
{ "COMPRESSED", SYM(COMPRESSED_SYM)},
{ "CONCURRENT", SYM(CONCURRENT)},
{ "CONDITION", SYM(CONDITION_SYM)},
@@ -378,6 +379,7 @@ static SYMBOL symbols[] = {
{ "READ", SYM(READ_SYM)},
{ "READS", SYM(READS_SYM)},
{ "REAL", SYM(REAL)},
+ { "REDUNDANT", SYM(REDUNDANT_SYM)},
{ "REFERENCES", SYM(REFERENCES)},
{ "REGEXP", SYM(REGEXP)},
{ "RELAY_LOG_FILE", SYM(RELAY_LOG_FILE_SYM)},
diff --git a/sql/log.cc b/sql/log.cc
index 00c39acec09..d57a6b49762 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -259,7 +259,9 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
if ((file=my_open(log_file_name,open_flags,
MYF(MY_WME | ME_WAITTANG))) < 0 ||
init_io_cache(&log_file, file, IO_SIZE, io_cache_type,
- my_tell(file,MYF(MY_WME)), 0, MYF(MY_WME | MY_NABP)))
+ my_tell(file,MYF(MY_WME)), 0,
+ MYF(MY_WME | MY_NABP |
+ ((log_type == LOG_BIN) ? MY_WAIT_IF_FULL : 0))))
goto err;
switch (log_type) {
@@ -337,6 +339,8 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
First open of this class instance
Create an index file that will hold all file names uses for logging.
Add new entries to the end of it.
+ Index file (and binlog) are so critical for recovery/replication
+ that we create them with MY_WAIT_IF_FULL.
*/
fn_format(index_file_name, index_file_name_arg, mysql_data_home,
".index", opt);
@@ -347,7 +351,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
init_io_cache(&index_file, index_file_nr,
IO_SIZE, WRITE_CACHE,
my_seek(index_file_nr,0L,MY_SEEK_END,MYF(0)),
- 0, MYF(MY_WME)))
+ 0, MYF(MY_WME | MY_WAIT_IF_FULL)))
goto err;
}
else
@@ -1587,6 +1591,7 @@ uint MYSQL_LOG::next_file_id()
bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback)
{
+ bool should_rotate= 0, error= 0;
VOID(pthread_mutex_lock(&LOCK_log));
DBUG_ENTER("MYSQL_LOG::write(cache");
@@ -1682,7 +1687,7 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback)
goto err;
signal_update();
DBUG_PRINT("info",("max_size: %lu",max_size));
- if (my_b_tell(&log_file) >= (my_off_t) max_size)
+ if (should_rotate= (my_b_tell(&log_file) >= (my_off_t) max_size))
{
pthread_mutex_lock(&LOCK_index);
new_file(0); // inside mutex
@@ -1698,7 +1703,16 @@ bool MYSQL_LOG::write(THD *thd, IO_CACHE *cache, bool commit_or_rollback)
ha_commit_complete(thd);
- DBUG_RETURN(0);
+#ifdef HAVE_REPLICATION
+ if (should_rotate && expire_logs_days)
+ {
+ long purge_time= time(0) - expire_logs_days*24*60*60;
+ if (purge_time >= 0)
+ error= purge_logs_before_date(purge_time);
+ }
+#endif
+
+ DBUG_RETURN(error);
err:
if (!write_error)
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index e9d4a088d16..dd7fd98158a 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2681,8 +2681,10 @@ with --log-bin instead.");
if (opt_bin_log)
{
- open_log(&mysql_bin_log, glob_hostname, opt_bin_logname, "-bin",
- opt_binlog_index_name, LOG_BIN, 0, 0, max_binlog_size);
+ /* If we fail to open binlog, it's going to hinder our recovery, so die */
+ if (open_log(&mysql_bin_log, glob_hostname, opt_bin_logname, "-bin",
+ opt_binlog_index_name, LOG_BIN, 0, 0, max_binlog_size))
+ unireg_abort(1);
using_update_log=1;
#ifdef HAVE_REPLICATION
if (expire_logs_days)
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 405d95bf456..48855892567 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -715,8 +715,8 @@ bool rename_temporary_table(THD* thd, TABLE *table, const char *db,
(uint) strlen(table_name)+6+4)))
return 1; /* purecov: inspected */
share->key_length= (uint)
- (strmov(((char*) share->table_name= strmov(share->table_cache_key= key,
- db)+1),
+ (strmov((char*) (share->table_name= strmov(share->table_cache_key= key,
+ db)+1),
table_name) - share->table_cache_key)+1;
share->db= share->table_cache_key;
int4store(key+share->key_length, thd->server_id);
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index fa23502ea93..6b1456dfbd3 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -227,6 +227,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token COLLATION_SYM
%token COLUMNS
%token COLUMN_SYM
+%token COMPACT_SYM
%token CONCURRENT
%token CONDITION_SYM
%token CONNECTION_SYM
@@ -381,6 +382,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token READ_SYM
%token READS_SYM
%token REAL_NUM
+%token REDUNDANT_SYM
%token REFERENCES
%token REGEXP
%token RELOAD
@@ -2628,7 +2630,9 @@ row_types:
DEFAULT { $$= ROW_TYPE_DEFAULT; }
| FIXED_SYM { $$= ROW_TYPE_FIXED; }
| DYNAMIC_SYM { $$= ROW_TYPE_DYNAMIC; }
- | COMPRESSED_SYM { $$= ROW_TYPE_COMPRESSED; };
+ | COMPRESSED_SYM { $$= ROW_TYPE_COMPRESSED; }
+ | REDUNDANT_SYM { $$= ROW_TYPE_REDUNDANT; }
+ | COMPACT_SYM { $$= ROW_TYPE_COMPACT; };
raid_types:
RAID_STRIPED_SYM { $$= RAID_TYPE_0; }
@@ -6915,6 +6919,7 @@ keyword:
| COMMENT_SYM {}
| COMMITTED_SYM {}
| COMMIT_SYM {}
+ | COMPACT_SYM {}
| COMPRESSED_SYM {}
| CONCURRENT {}
| CONSISTENT_SYM {}
@@ -7046,6 +7051,7 @@ keyword:
| RAID_CHUNKSIZE {}
| RAID_STRIPED_SYM {}
| RAID_TYPE {}
+ | REDUNDANT_SYM {}
| RELAY_LOG_FILE_SYM {}
| RELAY_LOG_POS_SYM {}
| RELOAD {}