diff options
Diffstat (limited to 'storage')
410 files changed, 41472 insertions, 15828 deletions
diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index b5b222d88d1..e3151d35e23 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -355,6 +355,9 @@ ARCHIVE_SHARE *ha_archive::get_share(const char *table_name, int *rc) */ if (!(azopen(&archive_tmp, share->data_file_name, O_RDONLY|O_BINARY))) { + *rc= my_errno ? my_errno : -1; + pthread_mutex_unlock(&archive_mutex); + my_free(share, MYF(0)); DBUG_RETURN(NULL); } stats.auto_increment_value= archive_tmp.auto_increment + 1; @@ -504,16 +507,18 @@ int ha_archive::open(const char *name, int mode, uint open_options) For now we have to refuse to open such table to avoid potential data loss. */ - if ((rc == HA_ERR_CRASHED_ON_USAGE && !(open_options & HA_OPEN_FOR_REPAIR)) - || rc == HA_ERR_TABLE_NEEDS_UPGRADE) + switch (rc) { - /* purecov: begin inspected */ + case 0: + break; + case HA_ERR_CRASHED_ON_USAGE: + if (open_options & HA_OPEN_FOR_REPAIR) + break; + /* fall through */ + case HA_ERR_TABLE_NEEDS_UPGRADE: free_share(); - DBUG_RETURN(rc); - /* purecov: end */ - } - else if (rc == HA_ERR_OUT_OF_MEM) - { + /* fall through */ + default: DBUG_RETURN(rc); } @@ -1264,13 +1269,12 @@ int ha_archive::rnd_pos(uchar * buf, uchar *pos) /* This method repairs the meta file. It does this by walking the datafile and - rewriting the meta file. Currently it does this by calling optimize with - the extended flag. + rewriting the meta file. If EXTENDED repair is requested, we attempt to + recover as much data as possible. */ int ha_archive::repair(THD* thd, HA_CHECK_OPT* check_opt) { DBUG_ENTER("ha_archive::repair"); - check_opt->flags= T_EXTEND; int rc= optimize(thd, check_opt); if (rc) @@ -1364,7 +1368,14 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt) DBUG_PRINT("ha_archive", ("recovered %llu archive rows", (unsigned long long)share->rows_recorded)); - if (rc && rc != HA_ERR_END_OF_FILE) + /* + If REPAIR ... EXTENDED is requested, try to recover as much data + from data file as possible. In this case if we failed to read a + record, we assume EOF. This allows massive data loss, but we can + hardly do more with broken zlib stream. And this is the only way + to restore at least what is still recoverable. + */ + if (rc && rc != HA_ERR_END_OF_FILE && !(check_opt->flags & T_EXTEND)) goto error; } diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index 162793b0222..ffc59140629 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -679,9 +679,21 @@ int ha_tina::find_current_row(uchar *buf) if (read_all || bitmap_is_set(table->read_set, (*field)->field_index)) { + bool is_enum= ((*field)->real_type() == MYSQL_TYPE_ENUM); + /* + Here CHECK_FIELD_WARN checks that all values in the csv file are valid + which is normally the case, if they were written by + INSERT -> ha_tina::write_row. '0' values on ENUM fields are considered + invalid by Field_enum::store() but it can store them on INSERT anyway. + Thus, for enums we silence the warning, as it doesn't really mean + an invalid value. + */ if ((*field)->store(buffer.ptr(), buffer.length(), buffer.charset(), - CHECK_FIELD_WARN)) - goto err; + is_enum ? CHECK_FIELD_IGNORE : CHECK_FIELD_WARN)) + { + if (!is_enum) + goto err; + } if ((*field)->flags & BLOB_FLAG) { Field_blob *blob= *(Field_blob**) field; diff --git a/storage/example/ha_example.h b/storage/example/ha_example.h index 4ca7714b34f..dc47fac1f17 100644 --- a/storage/example/ha_example.h +++ b/storage/example/ha_example.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003 MySQL AB +/* Copyright (c) 2003, 2010 Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -155,8 +155,8 @@ public: /** @brief This method will never be called if you do not implement indexes. */ - virtual double read_time(uint index, uint ranges, ha_rows rows) - { return (double) rows / 20.0+1; } + virtual double read_time(uint, uint, ha_rows rows) + { return (double) rows / 20.0+1; } /* Everything below are methods that we implement in ha_example.cc. diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 08dd36a8537..2dbac485fbc 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2004 MySQL AB +/* Copyright (c) 2004, 2010 Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1253,7 +1253,7 @@ bool ha_federated::create_where_from_key(String *to, const key_range *start_key, const key_range *end_key, bool from_records_in_range, - bool eq_range) + bool eq_range_arg) { bool both_not_null= (start_key != NULL && end_key != NULL) ? TRUE : FALSE; @@ -1360,7 +1360,7 @@ bool ha_federated::create_where_from_key(String *to, } break; case HA_READ_AFTER_KEY: - if (eq_range) + if (eq_range_arg) { if (tmp.append("1=1")) // Dummy goto err; @@ -1621,11 +1621,10 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked) DBUG_ASSERT(mysql == NULL); - ref_length= (table->s->primary_key != MAX_KEY ? - table->key_info[table->s->primary_key].key_length : - table->s->reclength); + ref_length= sizeof(MYSQL_RES *) + sizeof(MYSQL_ROW_OFFSET); DBUG_PRINT("info", ("ref_length: %u", ref_length)); + my_init_dynamic_array(&results, sizeof(MYSQL_RES *), 4, 4); reset(); DBUG_RETURN(0); @@ -1645,21 +1644,17 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked) int ha_federated::close(void) { - int retval; DBUG_ENTER("ha_federated::close"); - /* free the result set */ - if (stored_result) - { - mysql_free_result(stored_result); - stored_result= 0; - } + free_result(); + + delete_dynamic(&results); + /* Disconnect from mysql */ mysql_close(mysql); mysql= NULL; - retval= free_share(share); - DBUG_RETURN(retval); + DBUG_RETURN(free_share(share)); } /* @@ -2326,8 +2321,7 @@ int ha_federated::index_read(uchar *buf, const uchar *key, { DBUG_ENTER("ha_federated::index_read"); - if (stored_result) - mysql_free_result(stored_result); + free_result(); DBUG_RETURN(index_read_idx_with_result_set(buf, active_index, key, key_len, find_flag, &stored_result)); @@ -2359,7 +2353,8 @@ int ha_federated::index_read_idx(uchar *buf, uint index, const uchar *key, &mysql_result))) DBUG_RETURN(retval); mysql_free_result(mysql_result); - DBUG_RETURN(retval); + results.elements--; + DBUG_RETURN(0); } @@ -2415,18 +2410,20 @@ int ha_federated::index_read_idx_with_result_set(uchar *buf, uint index, retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE; goto error; } - if (!(*result= mysql_store_result(mysql))) + if (!(*result= store_result(mysql))) { retval= HA_ERR_END_OF_FILE; goto error; } - if (!(retval= read_next(buf, *result))) + if ((retval= read_next(buf, *result))) + { + mysql_free_result(*result); + results.elements--; + *result= 0; + table->status= STATUS_NOT_FOUND; DBUG_RETURN(retval); - - mysql_free_result(*result); - *result= 0; - table->status= STATUS_NOT_FOUND; - DBUG_RETURN(retval); + } + DBUG_RETURN(0); error: table->status= STATUS_NOT_FOUND; @@ -2486,12 +2483,6 @@ int ha_federated::read_range_first(const key_range *start_key, create_where_from_key(&sql_query, &table->key_info[active_index], start_key, end_key, 0, eq_range_arg); - - if (stored_result) - { - mysql_free_result(stored_result); - stored_result= 0; - } if (real_query(sql_query.ptr(), sql_query.length())) { retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE; @@ -2499,14 +2490,13 @@ int ha_federated::read_range_first(const key_range *start_key, } sql_query.length(0); - if (!(stored_result= mysql_store_result(mysql))) + if (!(stored_result= store_result(mysql))) { retval= HA_ERR_END_OF_FILE; goto error; } - - retval= read_next(table->record[0], stored_result); - DBUG_RETURN(retval); + + DBUG_RETURN(read_next(table->record[0], stored_result)); error: table->status= STATUS_NOT_FOUND; @@ -2516,10 +2506,8 @@ error: int ha_federated::read_range_next() { - int retval; DBUG_ENTER("ha_federated::read_range_next"); - retval= rnd_next(table->record[0]); - DBUG_RETURN(retval); + DBUG_RETURN(rnd_next(table->record[0])); } @@ -2585,23 +2573,11 @@ int ha_federated::rnd_init(bool scan) if (scan) { - if (stored_result) - { - mysql_free_result(stored_result); - stored_result= 0; - } - - if (real_query(share->select_query, strlen(share->select_query))) - goto error; - - stored_result= mysql_store_result(mysql); - if (!stored_result) - goto error; + if (real_query(share->select_query, strlen(share->select_query)) || + !(stored_result= store_result(mysql))) + DBUG_RETURN(stash_remote_error()); } DBUG_RETURN(0); - -error: - DBUG_RETURN(stash_remote_error()); } @@ -2615,11 +2591,7 @@ int ha_federated::rnd_end() int ha_federated::index_end(void) { DBUG_ENTER("ha_federated::index_end"); - if (stored_result) - { - mysql_free_result(stored_result); - stored_result= 0; - } + free_result(); active_index= MAX_KEY; DBUG_RETURN(0); } @@ -2679,6 +2651,9 @@ int ha_federated::read_next(uchar *buf, MYSQL_RES *result) DBUG_ENTER("ha_federated::read_next"); table->status= STATUS_NOT_FOUND; // For easier return + + /* Save current data cursor position. */ + current_position= result->data_cursor; /* Fetch a row, insert it back in a row format. */ if (!(row= mysql_fetch_row(result))) @@ -2691,24 +2666,38 @@ int ha_federated::read_next(uchar *buf, MYSQL_RES *result) } -/* - store reference to current row so that we can later find it for - a re-read, update or delete. - - In case of federated, a reference is either a primary key or - the whole record. - - Called from filesort.cc, sql_select.cc, sql_delete.cc and sql_update.cc. +/** + @brief Store a reference to current row. + + @details During a query execution we may have different result sets (RS), + e.g. for different ranges. All the RS's used are stored in + memory and placed in @c results dynamic array. At the end of + execution all stored RS's are freed at once in the + @c ha_federated::reset(). + So, in case of federated, a reference to current row is a + stored result address and current data cursor position. + As we keep all RS in memory during a query execution, + we can get any record using the reference any time until + @c ha_federated::reset() is called. + TODO: we don't have to store all RS's rows but only those + we call @c ha_federated::position() for, so we can free memory + where we store other rows in the @c ha_federated::index_end(). + + @param[in] record record data (unused) */ -void ha_federated::position(const uchar *record) +void ha_federated::position(const uchar *record __attribute__ ((unused))) { DBUG_ENTER("ha_federated::position"); - if (table->s->primary_key != MAX_KEY) - key_copy(ref, (uchar *)record, table->key_info + table->s->primary_key, - ref_length); - else - memcpy(ref, record, ref_length); + + DBUG_ASSERT(stored_result); + + position_called= TRUE; + /* Store result set address. */ + memcpy_fixed(ref, &stored_result, sizeof(MYSQL_RES *)); + /* Store data cursor position. */ + memcpy_fixed(ref + sizeof(MYSQL_RES *), ¤t_position, + sizeof(MYSQL_ROW_OFFSET)); DBUG_VOID_RETURN; } @@ -2724,23 +2713,19 @@ void ha_federated::position(const uchar *record) int ha_federated::rnd_pos(uchar *buf, uchar *pos) { - int result; + MYSQL_RES *result; DBUG_ENTER("ha_federated::rnd_pos"); + ha_statistic_increment(&SSV::ha_read_rnd_count); - if (table->s->primary_key != MAX_KEY) - { - /* We have a primary key, so use index_read_idx to find row */ - result= index_read_idx(buf, table->s->primary_key, pos, - ref_length, HA_READ_KEY_EXACT); - } - else - { - /* otherwise, get the old record ref as obtained in ::position */ - memcpy(buf, pos, ref_length); - result= 0; - } - table->status= result ? STATUS_NOT_FOUND : 0; - DBUG_RETURN(result); + + /* Get stored result set. */ + memcpy_fixed(&result, pos, sizeof(MYSQL_RES *)); + DBUG_ASSERT(result); + /* Set data cursor position. */ + memcpy_fixed(&result->data_cursor, pos + sizeof(MYSQL_RES *), + sizeof(MYSQL_ROW_OFFSET)); + /* Read a row. */ + DBUG_RETURN(read_next(buf, result)); } @@ -2943,6 +2928,16 @@ int ha_federated::reset(void) insert_dup_update= FALSE; ignore_duplicates= FALSE; replace_duplicates= FALSE; + + /* Free stored result sets. */ + for (uint i= 0; i < results.elements; i++) + { + MYSQL_RES *result; + get_dynamic(&results, (uchar *) &result, i); + mysql_free_result(result); + } + reset_dynamic(&results); + return 0; } @@ -3206,6 +3201,45 @@ bool ha_federated::get_error_message(int error, String* buf) DBUG_RETURN(FALSE); } + +/** + @brief Store a result set. + + @details Call @c mysql_store_result() to save a result set then + append it to the stored results array. + + @param[in] mysql_arg MySLQ connection structure. + + @return Stored result set (MYSQL_RES object). +*/ + +MYSQL_RES *ha_federated::store_result(MYSQL *mysql_arg) +{ + MYSQL_RES *result= mysql_store_result(mysql_arg); + DBUG_ENTER("ha_federated::store_result"); + if (result) + { + (void) insert_dynamic(&results, (uchar*) &result); + } + position_called= FALSE; + DBUG_RETURN(result); +} + + +void ha_federated::free_result() +{ + DBUG_ENTER("ha_federated::free_result"); + if (stored_result && !position_called) + { + mysql_free_result(stored_result); + stored_result= 0; + if (results.elements > 0) + results.elements--; + } + DBUG_VOID_RETURN; +} + + int ha_federated::external_lock(THD *thd, int lock_type) { int error= 0; diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h index c0e8ff3bc31..ab31e3c1680 100644 --- a/storage/federated/ha_federated.h +++ b/storage/federated/ha_federated.h @@ -84,6 +84,11 @@ class ha_federated: public handler FEDERATED_SHARE *share; /* Shared lock info */ MYSQL *mysql; /* MySQL connection */ MYSQL_RES *stored_result; + /** + Array of all stored results we get during a query execution. + */ + DYNAMIC_ARRAY results; + bool position_called; uint fetch_num; // stores the fetch num MYSQL_ROW_OFFSET current_position; // Current position used by ::position() int remote_error_number; @@ -251,6 +256,10 @@ public: THR_LOCK_DATA **store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type); //required bool get_error_message(int error, String *buf); + + MYSQL_RES *store_result(MYSQL *mysql); + void free_result(); + int external_lock(THD *thd, int lock_type); int connection_commit(); int connection_rollback(); diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 5cc62c63507..5918db7ab11 100755..100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -63,5 +63,5 @@ SET(INNOBASE_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea.c usr/usr0sess.c ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rnd.c ut/ut0ut.c ut/ut0vec.c ut/ut0list.c ut/ut0wqueue.c) - ## psergey: MYSQL_STORAGE_ENGINE(INNOBASE) +MYSQL_STORAGE_ENGINE(INNOBASE) diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c index 16ed9c9da3c..45867388a61 100644 --- a/storage/innobase/buf/buf0buf.c +++ b/storage/innobase/buf/buf0buf.c @@ -224,6 +224,9 @@ in the free list to the frames. /* Value in microseconds */ static const int WAIT_FOR_READ = 20000; +/* Number of attemtps made to read in a page in the buffer pool */ +static const ulint BUF_PAGE_READ_MAX_RETRIES = 100; + buf_pool_t* buf_pool = NULL; /* The buffer buf_pool of the database */ #ifdef UNIV_DEBUG @@ -756,7 +759,7 @@ buf_pool_init( /* Wipe contents of frame to eliminate a Purify warning */ -#ifdef HAVE_valgrind +#ifdef HAVE_purify memset(block->frame, '\0', UNIV_PAGE_SIZE); #endif if (srv_use_awe) { @@ -1160,6 +1163,7 @@ buf_page_get_gen( ulint fix_type; ibool success; ibool must_read; + ulint retries = 0; ut_ad(mtr); ut_ad((rw_latch == RW_S_LATCH) @@ -1200,7 +1204,29 @@ loop: return(NULL); } - buf_read_page(space, offset); + if (buf_read_page(space, offset)) { + retries = 0; + } else if (retries < BUF_PAGE_READ_MAX_RETRIES) { + ++retries; + } else { + fprintf(stderr, "InnoDB: Error: Unable" + " to read tablespace %lu page no" + " %lu into the buffer pool after" + " %lu attempts\n" + "InnoDB: The most probable cause" + " of this error may be that the" + " table has been corrupted.\n" + "InnoDB: You can try to fix this" + " problem by using" + " innodb_force_recovery.\n" + "InnoDB: Please see reference manual" + " for more details.\n" + "InnoDB: Aborting...\n", + space, offset, + BUF_PAGE_READ_MAX_RETRIES); + + ut_error; + } #ifdef UNIV_DEBUG buf_dbg_counter++; diff --git a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c index fdec0206990..451436ef75b 100644 --- a/storage/innobase/buf/buf0rea.c +++ b/storage/innobase/buf/buf0rea.c @@ -299,30 +299,27 @@ buffer buf_pool if it is not already there. Sets the io_fix flag and sets an exclusive lock on the buffer frame. The flag is cleared and the x-lock released by the i/o-handler thread. Does a random read-ahead if it seems sensible. */ - -ulint +ibool buf_read_page( /*==========*/ - /* out: number of page read requests issued: this can - be > 1 if read-ahead occurred */ + /* out: TRUE if success, FALSE otherwise */ ulint space, /* in: space id */ ulint offset) /* in: page number */ { ib_longlong tablespace_version; ulint count; - ulint count2; ulint err; tablespace_version = fil_space_get_version(space); - count = buf_read_ahead_random(space, offset); + buf_read_ahead_random(space, offset); /* We do the i/o in the synchronous aio mode to save thread switches: hence TRUE */ - count2 = buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space, + count = buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space, tablespace_version, offset); - srv_buf_pool_reads+= count2; + srv_buf_pool_reads+= count; if (err == DB_TABLESPACE_DELETED) { ut_print_timestamp(stderr); fprintf(stderr, @@ -336,7 +333,7 @@ buf_read_page( /* Flush pages from the end of the LRU list if necessary */ buf_flush_free_margin(); - return(count + count2); + return(count > 0); } /************************************************************************ diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 8c63f5ad090..ebf01fbc296 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -238,7 +238,7 @@ static MYSQL_THDVAR_BOOL(table_locks, PLUGIN_VAR_OPCMDARG, /* default */ TRUE); static handler *innobase_create_handler(handlerton *hton, - TABLE_SHARE *table, + TABLE_SHARE *table, MEM_ROOT *mem_root) { return new (mem_root) ha_innobase(hton, table); @@ -350,7 +350,7 @@ int innobase_start_trx_and_assign_read_view( /*====================================*/ /* out: 0 */ - handlerton* hton, /* in: Innodb handlerton */ + handlerton* hton, /* in: Innodb handlerton */ THD* thd); /* in: MySQL thread handle of the user for whom the transaction should be committed */ /******************************************************************** @@ -1714,9 +1714,6 @@ innobase_init( int err; bool ret; char *default_path; -#ifdef SAFE_MUTEX - my_bool old_safe_mutex_deadlock_detector; -#endif DBUG_ENTER("innobase_init"); handlerton *innobase_hton= (handlerton *)p; @@ -1971,15 +1968,8 @@ innobase_init( srv_sizeof_trx_t_in_ha_innodb_cc = sizeof(trx_t); -#ifdef SAFE_MUTEX - /* Disable deadlock detection as it's very slow for the buffer pool */ - old_safe_mutex_deadlock_detector= safe_mutex_deadlock_detector; - safe_mutex_deadlock_detector= 0; -#endif err = innobase_start_or_create_for_mysql(); -#ifdef SAFE_MUTEX - safe_mutex_deadlock_detector= old_safe_mutex_deadlock_detector; -#endif + if (err != DB_SUCCESS) { my_free(internal_innobase_data_file_path, MYF(MY_ALLOW_ZERO_PTR)); @@ -2662,9 +2652,9 @@ ha_innobase::innobase_initialize_autoinc() auto_inc = innobase_get_int_col_max_value(field); } else { /* We have no idea what's been passed in to us as the - autoinc column. We set it to the MAX_INT of our table - autoinc type. */ - auto_inc = 0xFFFFFFFFFFFFFFFFULL; + autoinc column. We set it to the 0, effectively disabling + updates to the table. */ + auto_inc = 0; ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Unable to determine the AUTOINC " @@ -2673,7 +2663,7 @@ ha_innobase::innobase_initialize_autoinc() if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { /* If the recovery level is set so high that writes - are disabled we force the AUTOINC counter to the MAX + are disabled we force the AUTOINC counter to 0 value effectively disabling writes to the table. Secondly, we avoid reading the table in case the read results in failure due to a corrupted table/index. @@ -2682,7 +2672,10 @@ ha_innobase::innobase_initialize_autoinc() tables can be dumped with minimal hassle. If an error were returned in this case, the first attempt to read the table would fail and subsequent SELECTs would succeed. */ + auto_inc = 0; } else if (field == NULL) { + /* This is a far more serious error, best to avoid + opening the table and return failure. */ my_error(ER_AUTOINC_READ_FAILED, MYF(0)); } else { dict_index_t* index; @@ -2711,7 +2704,7 @@ ha_innobase::innobase_initialize_autoinc() "InnoDB: Unable to find the AUTOINC column " "%s in the InnoDB table %s.\n" "InnoDB: We set the next AUTOINC column " - "value to the maximum possible value,\n" + "value to 0,\n" "InnoDB: in effect disabling the AUTOINC " "next value generation.\n" "InnoDB: You can either set the next " @@ -2720,7 +2713,13 @@ ha_innobase::innobase_initialize_autoinc() "recreating the table.\n", col_name, index->table->name); - my_error(ER_AUTOINC_READ_FAILED, MYF(0)); + /* This will disable the AUTOINC generation. */ + auto_inc = 0; + + /* We want the open to succeed, so that the user can + take corrective action. ie. reads should succeed but + updates should fail. */ + err = DB_SUCCESS; break; default: /* row_search_max_autoinc() should only return @@ -2774,12 +2773,12 @@ ha_innobase::open( } /* Create buffers for packing the fields of a record. Why - table->stored_rec_length did not work here? Obviously, because char + table->reclength did not work here? Obviously, because char fields when packed actually became 1 byte longer, when we also stored the string length as the first byte. */ upd_and_key_val_buff_len = - table->s->stored_rec_length + table->s->max_key_length + table->s->reclength + table->s->max_key_length + MAX_REF_PARTS * 3; if (!(uchar*) my_multi_malloc(MYF(MY_WME), &upd_buff, upd_and_key_val_buff_len, @@ -2854,7 +2853,7 @@ retry: prebuilt = row_create_prebuilt(ib_table); - prebuilt->mysql_row_len = table->s->stored_rec_length;; + prebuilt->mysql_row_len = table->s->reclength; prebuilt->default_rec = table->s->default_values; ut_ad(prebuilt->default_rec); @@ -3556,11 +3555,11 @@ build_template( dict_index_t* clust_index; mysql_row_templ_t* templ; Field* field; - ulint n_fields, n_stored_fields; + ulint n_fields; ulint n_requested_fields = 0; ibool fetch_all_in_key = FALSE; ibool fetch_primary_key_cols = FALSE; - ulint i, sql_idx, innodb_idx=0; + ulint i; /* byte offset of the end of last requested column */ ulint mysql_prefix_len = 0; @@ -3621,12 +3620,11 @@ build_template( } n_fields = (ulint)table->s->fields; /* number of columns */ - n_stored_fields= (ulint)table->s->stored_fields; /* number of stored columns */ if (!prebuilt->mysql_template) { prebuilt->mysql_template = (mysql_row_templ_t*) mem_alloc_noninline( - n_stored_fields * sizeof(mysql_row_templ_t)); + n_fields * sizeof(mysql_row_templ_t)); } prebuilt->template_type = templ_type; @@ -3636,17 +3634,15 @@ build_template( /* Note that in InnoDB, i is the column number. MySQL calls columns 'fields'. */ - for (sql_idx = 0; sql_idx < n_fields; sql_idx++) { + for (i = 0; i < n_fields; i++) { templ = prebuilt->mysql_template + n_requested_fields; - field = table->field[sql_idx]; - if (!field->stored_in_db) - goto skip_field; + field = table->field[i]; if (UNIV_LIKELY(templ_type == ROW_MYSQL_REC_FIELDS)) { /* Decide which columns we should fetch and which we can skip. */ register const ibool index_contains_field = - dict_index_contains_col_or_prefix(index, innodb_idx); + dict_index_contains_col_or_prefix(index, i); if (!index_contains_field && prebuilt->read_just_key) { /* If this is a 'key read', we do not need @@ -3661,8 +3657,8 @@ build_template( goto include_field; } - if (bitmap_is_set(table->read_set, sql_idx) || - bitmap_is_set(table->write_set, sql_idx)) { + if (bitmap_is_set(table->read_set, i) || + bitmap_is_set(table->write_set, i)) { /* This field is needed in the query */ goto include_field; @@ -3670,7 +3666,7 @@ build_template( if (fetch_primary_key_cols && dict_table_col_in_clustered_key( - index->table, innodb_idx)) { + index->table, i)) { /* This field is needed in the query */ goto include_field; @@ -3683,14 +3679,14 @@ build_template( include_field: n_requested_fields++; - templ->col_no = innodb_idx; + templ->col_no = i; if (index == clust_index) { templ->rec_field_no = dict_col_get_clust_pos_noninline( - &index->table->cols[innodb_idx], index); + &index->table->cols[i], index); } else { templ->rec_field_no = dict_index_get_nth_col_pos( - index, innodb_idx); + index, i); } if (templ->rec_field_no == ULINT_UNDEFINED) { @@ -3716,7 +3712,7 @@ include_field: mysql_prefix_len = templ->mysql_col_offset + templ->mysql_col_len; } - templ->type = index->table->cols[innodb_idx].mtype; + templ->type = index->table->cols[i].mtype; templ->mysql_type = (ulint)field->type(); if (templ->mysql_type == DATA_MYSQL_TRUE_VARCHAR) { @@ -3725,18 +3721,16 @@ include_field: } templ->charset = dtype_get_charset_coll_noninline( - index->table->cols[innodb_idx].prtype); - templ->mbminlen = index->table->cols[innodb_idx].mbminlen; - templ->mbmaxlen = index->table->cols[innodb_idx].mbmaxlen; - templ->is_unsigned = index->table->cols[innodb_idx].prtype + index->table->cols[i].prtype); + templ->mbminlen = index->table->cols[i].mbminlen; + templ->mbmaxlen = index->table->cols[i].mbmaxlen; + templ->is_unsigned = index->table->cols[i].prtype & DATA_UNSIGNED; if (templ->type == DATA_BLOB) { prebuilt->templ_contains_blob = TRUE; } skip_field: - if (field->stored_in_db) { - innodb_idx++; - } + ; } prebuilt->n_template = n_requested_fields; @@ -3983,11 +3977,17 @@ no_commit: prebuilt->autoinc_error = DB_SUCCESS; if ((error = update_auto_increment())) { - /* We don't want to mask autoinc overflow errors. */ - if (prebuilt->autoinc_error != DB_SUCCESS) { - error = (int) prebuilt->autoinc_error; + /* Handle the case where the AUTOINC sub-system + failed during initialization. */ + if (prebuilt->autoinc_error == DB_UNSUPPORTED) { + error_result = ER_AUTOINC_READ_FAILED; + /* Set the error message to report too. */ + my_error(ER_AUTOINC_READ_FAILED, MYF(0)); + goto func_exit; + } else if (prebuilt->autoinc_error != DB_SUCCESS) { + error = (int) prebuilt->autoinc_error; goto report_error; } @@ -4143,7 +4143,7 @@ calc_row_difference( ulint n_changed = 0; dfield_t dfield; dict_index_t* clust_index; - uint sql_idx, innodb_idx= 0; + uint i; n_fields = table->s->fields; clust_index = dict_table_get_first_index_noninline(prebuilt->table); @@ -4151,10 +4151,8 @@ calc_row_difference( /* We use upd_buff to convert changed fields */ buf = (byte*) upd_buff; - for (sql_idx = 0; sql_idx < n_fields; sql_idx++) { - field = table->field[sql_idx]; - if (!field->stored_in_db) - continue; + for (i = 0; i < n_fields; i++) { + field = table->field[i]; o_ptr = (byte*) old_row + get_field_offset(table, field); n_ptr = (byte*) new_row + get_field_offset(table, field); @@ -4172,7 +4170,7 @@ calc_row_difference( field_mysql_type = field->type(); - col_type = prebuilt->table->cols[innodb_idx].mtype; + col_type = prebuilt->table->cols[i].mtype; switch (col_type) { @@ -4227,7 +4225,7 @@ calc_row_difference( /* Let us use a dummy dfield to make the conversion from the MySQL column format to the InnoDB format */ - dict_col_copy_type_noninline(prebuilt->table->cols + innodb_idx, + dict_col_copy_type_noninline(prebuilt->table->cols + i, &dfield.type); if (n_len != UNIV_SQL_NULL) { @@ -4248,11 +4246,9 @@ calc_row_difference( ufield->exp = NULL; ufield->field_no = dict_col_get_clust_pos_noninline( - &prebuilt->table->cols[innodb_idx], clust_index); + &prebuilt->table->cols[i], clust_index); n_changed++; } - if (field->stored_in_db) - innodb_idx++; } uvect->n_fields = n_changed; @@ -4439,7 +4435,7 @@ ha_innobase::unlock_row(void) case ROW_READ_WITH_LOCKS: if (!srv_locks_unsafe_for_binlog && prebuilt->trx->isolation_level - != TRX_ISO_READ_COMMITTED) { + > TRX_ISO_READ_COMMITTED) { break; } /* fall through */ @@ -4476,7 +4472,7 @@ ha_innobase::try_semi_consistent_read(bool yes) if (yes && (srv_locks_unsafe_for_binlog - || prebuilt->trx->isolation_level == TRX_ISO_READ_COMMITTED)) { + || prebuilt->trx->isolation_level <= TRX_ISO_READ_COMMITTED)) { prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT; } else { prebuilt->row_read_type = ROW_READ_WITH_LOCKS; @@ -5237,7 +5233,7 @@ create_table_def( /* We pass 0 as the space id, and determine at a lower level the space id where to store the table */ - table = dict_mem_table_create(table_name, 0, form->s->stored_fields, flags); + table = dict_mem_table_create(table_name, 0, n_cols, flags); if (path_of_temp_table) { table->dir_path_of_temp_table = @@ -5246,8 +5242,6 @@ create_table_def( for (i = 0; i < n_cols; i++) { field = form->field[i]; - if (!field->stored_in_db) - continue; col_type = get_innobase_type_from_mysql_type(&unsigned_type, field); @@ -5564,7 +5558,7 @@ ha_innobase::create( } #endif - if (form->s->stored_fields > 1000) { + if (form->s->fields > 1000) { /* The limit probably should be REC_MAX_N_FIELDS - 3 = 1020, but we play safe here */ @@ -6104,10 +6098,10 @@ ha_innobase::records_in_range( KEY* key; dict_index_t* index; uchar* key_val_buff2 = (uchar*) my_malloc( - table->s->stored_rec_length + table->s->reclength + table->s->max_key_length + 100, MYF(MY_FAE)); - ulint buff2_len = table->s->stored_rec_length + ulint buff2_len = table->s->reclength + table->s->max_key_length + 100; dtuple_t* range_start; dtuple_t* range_end; @@ -7774,7 +7768,7 @@ ha_innobase::store_lock( isolation_level = trx->isolation_level; if ((srv_locks_unsafe_for_binlog - || isolation_level == TRX_ISO_READ_COMMITTED) + || isolation_level <= TRX_ISO_READ_COMMITTED) && isolation_level != TRX_ISO_SERIALIZABLE && (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT) && (sql_command == SQLCOM_INSERT_SELECT @@ -7904,7 +7898,10 @@ ha_innobase::innobase_get_autoinc( *value = dict_table_autoinc_read(prebuilt->table); /* It should have been initialized during open. */ - ut_a(*value != 0); + if (*value == 0) { + prebuilt->autoinc_error = DB_UNSUPPORTED; + dict_table_autoinc_unlock(prebuilt->table); + } } return(ulong(prebuilt->autoinc_error)); @@ -7984,6 +7981,11 @@ ha_innobase::get_auto_increment( invoking this method. So we are not sure if it's guaranteed to be 0 or not. */ + /* We need the upper limit of the col type to check for + whether we update the table autoinc counter or not. */ + ulonglong col_max_value = innobase_get_int_col_max_value( + table->next_number_field); + /* Called for the first time ? */ if (trx->n_autoinc_rows == 0) { @@ -8000,6 +8002,11 @@ ha_innobase::get_auto_increment( /* Not in the middle of a mult-row INSERT. */ } else if (prebuilt->autoinc_last_value == 0) { set_if_bigger(*first_value, autoinc); + /* Check for -ve values. */ + } else if (*first_value > col_max_value && trx->n_autoinc_rows > 0) { + /* Set to next logical value. */ + ut_a(autoinc > trx->n_autoinc_rows); + *first_value = (autoinc - trx->n_autoinc_rows) - 1; } *nb_reserved_values = trx->n_autoinc_rows; @@ -8010,12 +8017,6 @@ ha_innobase::get_auto_increment( ulonglong need; ulonglong current; ulonglong next_value; - ulonglong col_max_value; - - /* We need the upper limit of the col type to check for - whether we update the table autoinc counter or not. */ - col_max_value = innobase_get_int_col_max_value( - table->next_number_field); current = *first_value > col_max_value ? autoinc : *first_value; need = *nb_reserved_values * increment; @@ -8488,6 +8489,44 @@ innobase_set_cursor_view( (cursor_view_t*) curview); } +/*********************************************************************** +If col_name is not NULL, check whether the named column is being +renamed in the table. If col_name is not provided, check +whether any one of columns in the table is being renamed. */ +static +bool +check_column_being_renamed( +/*=======================*/ + /* out: true if find the column + being renamed */ + const TABLE* table, /* in: MySQL table */ + const char* col_name) /* in: name of the column */ +{ + uint k; + Field* field; + + for (k = 0; k < table->s->fields; k++) { + field = table->field[k]; + + if (field->flags & FIELD_IS_RENAMED) { + + /* If col_name is not provided, return + if the field is marked as being renamed. */ + if (!col_name) { + return(true); + } + + /* If col_name is provided, return only + if names match */ + if (innobase_strcasecmp(field->field_name, + col_name) == 0) { + return(true); + } + } + } + + return(false); +} /*********************************************************************** Check whether any of the given columns is being renamed in the table. */ @@ -8502,19 +8541,10 @@ column_is_being_renamed( const char** col_names) /* in: names of the columns */ { uint j; - uint k; - Field* field; - const char* col_name; for (j = 0; j < n_cols; j++) { - col_name = col_names[j]; - for (k = 0; k < table->s->fields; k++) { - field = table->field[k]; - if ((field->flags & FIELD_IS_RENAMED) - && innobase_strcasecmp(field->field_name, - col_name) == 0) { - return(true); - } + if (check_column_being_renamed(table, col_names[j])) { + return(true); } } @@ -8596,6 +8626,15 @@ bool ha_innobase::check_if_incompatible_data( return COMPATIBLE_DATA_NO; } + /* For column rename operation, MySQL does not supply enough + information (new column name etc.) for InnoDB to make appropriate + system metadata change. To avoid system metadata inconsistency, + currently we can just request a table rebuild/copy by returning + COMPATIBLE_DATA_NO */ + if (check_column_being_renamed(table, NULL)) { + return COMPATIBLE_DATA_NO; + } + /* Check if a column participating in a foreign key is being renamed. There is no mechanism for updating InnoDB foreign key definitions. */ if (foreign_key_column_is_being_renamed(prebuilt, table)) { @@ -8930,23 +8969,6 @@ mysql_declare_plugin(innobase) NULL /* reserved */ } mysql_declare_plugin_end; -maria_declare_plugin(innobase) -{ - MYSQL_STORAGE_ENGINE_PLUGIN, - &innobase_storage_engine, - innobase_hton_name, - "Innobase OY", - "Supports transactions, row-level locking, and foreign keys", - PLUGIN_LICENSE_GPL, - innobase_init, /* Plugin Init */ - NULL, /* Plugin Deinit */ - 0x0100 /* 1.0 */, - innodb_status_variables_export, /* status variables */ - innobase_system_variables, /* system variables */ - "1.0", /* string version */ - MariaDB_PLUGIN_MATURITY_STABLE, /* maturity */ -} -maria_declare_plugin_end; /** @brief Initialize the default value of innodb_commit_concurrency. diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index bed064d9d84..5b3df16875a 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -198,7 +198,6 @@ class ha_innobase: public handler int cmp_ref(const uchar *ref1, const uchar *ref2); bool check_if_incompatible_data(HA_CREATE_INFO *info, uint table_changes); - bool check_if_supported_virtual_columns(void) { return TRUE;} }; /* Some accessor functions which the InnoDB plugin needs, but which diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h index e4620172860..015f30fe6c2 100644 --- a/storage/innobase/include/buf0rea.h +++ b/storage/innobase/include/buf0rea.h @@ -18,12 +18,10 @@ buffer buf_pool if it is not already there. Sets the io_fix flag and sets an exclusive lock on the buffer frame. The flag is cleared and the x-lock released by the i/o-handler thread. Does a random read-ahead if it seems sensible. */ - -ulint +ibool buf_read_page( /*==========*/ - /* out: number of page read requests issued: this can - be > 1 if read-ahead occurred */ + /* out: TRUE if success, FALSE otherwise */ ulint space, /* in: space id */ ulint offset);/* in: page number */ /************************************************************************ diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h index 2d5fd1db6c3..ce99a680418 100644 --- a/storage/innobase/include/mem0mem.h +++ b/storage/innobase/include/mem0mem.h @@ -138,6 +138,17 @@ mem_heap_free_func( mem_heap_t* heap, /* in, own: heap to be freed */ const char* file_name, /* in: file name where freed */ ulint line); /* in: line where freed */ +/***************************************************************//** +Allocates and zero-fills n bytes of memory from a memory heap. +@return allocated, zero-filled storage */ +UNIV_INLINE +void* +mem_heap_zalloc( +/*============*/ + mem_heap_t* heap, /*!< in: memory heap */ + ulint n); /*!< in: number of bytes; if the heap is allowed + to grow into the buffer pool, this must be + <= MEM_MAX_ALLOC_IN_BUF */ /******************************************************************* Allocates n bytes of memory from a memory heap. */ UNIV_INLINE diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic index 6227a27f277..782672dbc18 100644 --- a/storage/innobase/include/mem0mem.ic +++ b/storage/innobase/include/mem0mem.ic @@ -122,6 +122,23 @@ mem_block_get_start(mem_block_t* block) return(block->start); } +/***************************************************************//** +Allocates and zero-fills n bytes of memory from a memory heap. +@return allocated, zero-filled storage */ +UNIV_INLINE +void* +mem_heap_zalloc( +/*============*/ + mem_heap_t* heap, /*!< in: memory heap */ + ulint n) /*!< in: number of bytes; if the heap is allowed + to grow into the buffer pool, this must be + <= MEM_MAX_ALLOC_IN_BUF */ +{ + ut_ad(heap); + ut_ad(!(heap->type & MEM_HEAP_BTR_SEARCH)); + return(memset(mem_heap_alloc(heap, n), 0, n)); +} + /******************************************************************* Allocates n bytes of memory from a memory heap. */ UNIV_INLINE diff --git a/storage/innobase/include/trx0sys.ic b/storage/innobase/include/trx0sys.ic index 55bcc12a414..1142fb60398 100644 --- a/storage/innobase/include/trx0sys.ic +++ b/storage/innobase/include/trx0sys.ic @@ -19,7 +19,7 @@ typedef byte trx_sysf_rseg_t; #define TRX_SYS_RSEG_SPACE 0 /* space where the the segment header is placed; starting with MySQL/InnoDB 5.1.7, this is - UNIV_UNDEFINED if the slot is unused */ + ULINT_UNDEFINED for unused slots */ #define TRX_SYS_RSEG_PAGE_NO 4 /* page number where the the segment header is placed; this is FIL_NULL if the slot is unused */ diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index e5e3577b4e6..ee3a0b27b20 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -55,10 +55,10 @@ of the 32-bit x86 assembler in mutex operations. */ # define UNIV_CAN_USE_X86_ASSEMBLER # endif -/* Enable explicit inlining of functions only for compilers known to -support it. */ +/* We only try to do explicit inlining of functions with gcc and +Microsoft Visual C++ */ -# if !defined(__GNUC__) && !defined(__SUNPRO_C) +# if !defined(__GNUC__) # undef UNIV_MUST_NOT_INLINE /* Remove compiler warning */ # define UNIV_MUST_NOT_INLINE # endif @@ -82,6 +82,9 @@ memory is read outside the allocated blocks. */ /* Make a non-inline debug version */ +#ifdef HAVE_purify +# define UNIV_DEBUG_VALGRIND +#endif /* HAVE_purify */ #if 0 #define UNIV_DEBUG_VALGRIND /* Enable extra Valgrind instrumentation */ @@ -107,7 +110,7 @@ operations (very slow); also UNIV_DEBUG must be defined */ #define UNIV_BTR_DEBUG /* check B-tree links */ #define UNIV_LIGHT_MEM_DEBUG /* light memory debugging */ -#ifdef HAVE_valgrind +#ifdef HAVE_purify /* The following sets all new allocated memory to zero before use: this can be used to eliminate unnecessary Purify warnings, but note that it also masks many bugs Purify could detect. For detailed Purify analysis it diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c index 4cc10931060..7df8ea50887 100644 --- a/storage/innobase/lock/lock0lock.c +++ b/storage/innobase/lock/lock0lock.c @@ -306,6 +306,7 @@ FILE* lock_latest_err_file; /* Flags for recursive deadlock search */ #define LOCK_VICTIM_IS_START 1 #define LOCK_VICTIM_IS_OTHER 2 +#define LOCK_EXCEED_MAX_DEPTH 3 /************************************************************************ Checks if a lock request results in a deadlock. */ @@ -332,16 +333,18 @@ lock_deadlock_recursive( was found and we chose some other trx as a victim: we must do the search again in this last case because there may be another - deadlock! */ + deadlock! + LOCK_EXCEED_MAX_DEPTH if the lock search + exceeds max steps and/or max depth. */ trx_t* start, /* in: recursion starting point */ trx_t* trx, /* in: a transaction waiting for a lock */ lock_t* wait_lock, /* in: the lock trx is waiting to be granted */ ulint* cost, /* in/out: number of calculation steps thus far: if this exceeds LOCK_MAX_N_STEPS_... - we return LOCK_VICTIM_IS_START */ + we return LOCK_EXCEED_MAX_DEPTH */ ulint depth); /* in: recursion depth: if this exceeds LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we - return LOCK_VICTIM_IS_START */ + return LOCK_EXCEED_MAX_DEPTH */ /************************************************************************* Gets the nth bit of a record lock. */ @@ -2359,7 +2362,7 @@ lock_rec_inherit_to_gap( if (!lock_rec_get_insert_intention(lock) && !((srv_locks_unsafe_for_binlog || lock->trx->isolation_level - == TRX_ISO_READ_COMMITTED) + <= TRX_ISO_READ_COMMITTED) && lock_get_mode(lock) == LOCK_X)) { lock_rec_add_to_queue(LOCK_REC | lock_get_mode(lock) @@ -3084,8 +3087,6 @@ lock_deadlock_occurs( lock_t* lock, /* in: lock the transaction is requesting */ trx_t* trx) /* in: transaction */ { - dict_table_t* table; - dict_index_t* index; trx_t* mark_trx; ulint ret; ulint cost = 0; @@ -3107,31 +3108,50 @@ retry: ret = lock_deadlock_recursive(trx, trx, lock, &cost, 0); - if (ret == LOCK_VICTIM_IS_OTHER) { + switch (ret) { + case LOCK_VICTIM_IS_OTHER: /* We chose some other trx as a victim: retry if there still is a deadlock */ - goto retry; - } - if (ret == LOCK_VICTIM_IS_START) { - if (lock_get_type(lock) & LOCK_TABLE) { - table = lock->un_member.tab_lock.table; - index = NULL; + case LOCK_EXCEED_MAX_DEPTH: + /* If the lock search exceeds the max step + or the max depth, the current trx will be + the victim. Print its information. */ + rewind(lock_latest_err_file); + ut_print_timestamp(lock_latest_err_file); + + fputs("TOO DEEP OR LONG SEARCH IN THE LOCK TABLE" + " WAITS-FOR GRAPH, WE WILL ROLL BACK" + " FOLLOWING TRANSACTION \n", + lock_latest_err_file); + + fputs("\n*** TRANSACTION:\n", lock_latest_err_file); + trx_print(lock_latest_err_file, trx, 3000); + + fputs("*** WAITING FOR THIS LOCK TO BE GRANTED:\n", + lock_latest_err_file); + + if (lock_get_type(lock) == LOCK_REC) { + lock_rec_print(lock_latest_err_file, lock); } else { - index = lock->index; - table = index->table; + lock_table_print(lock_latest_err_file, lock); } + break; - lock_deadlock_found = TRUE; - + case LOCK_VICTIM_IS_START: fputs("*** WE ROLL BACK TRANSACTION (2)\n", lock_latest_err_file); + break; - return(TRUE); + default: + /* No deadlock detected*/ + return(FALSE); } - return(FALSE); + lock_deadlock_found = TRUE; + + return(TRUE); } /************************************************************************ @@ -3147,16 +3167,18 @@ lock_deadlock_recursive( was found and we chose some other trx as a victim: we must do the search again in this last case because there may be another - deadlock! */ + deadlock! + LOCK_EXCEED_MAX_DEPTH if the lock search + exceeds max steps and/or max depth. */ trx_t* start, /* in: recursion starting point */ trx_t* trx, /* in: a transaction waiting for a lock */ lock_t* wait_lock, /* in: the lock trx is waiting to be granted */ ulint* cost, /* in/out: number of calculation steps thus far: if this exceeds LOCK_MAX_N_STEPS_... - we return LOCK_VICTIM_IS_START */ + we return LOCK_EXCEED_MAX_DEPTH */ ulint depth) /* in: recursion depth: if this exceeds LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we - return LOCK_VICTIM_IS_START */ + return LOCK_EXCEED_MAX_DEPTH */ { lock_t* lock; ulint bit_no = ULINT_UNDEFINED; @@ -3215,7 +3237,7 @@ lock_deadlock_recursive( lock_trx = lock->trx; - if (lock_trx == start || too_far) { + if (lock_trx == start) { /* We came back to the recursion starting point: a deadlock detected; or we have @@ -3262,19 +3284,10 @@ lock_deadlock_recursive( } #ifdef UNIV_DEBUG if (lock_print_waits) { - fputs("Deadlock detected" - " or too long search\n", + fputs("Deadlock detected\n", stderr); } #endif /* UNIV_DEBUG */ - if (too_far) { - - fputs("TOO DEEP OR LONG SEARCH" - " IN THE LOCK TABLE" - " WAITS-FOR GRAPH\n", ef); - - return(LOCK_VICTIM_IS_START); - } if (trx_weight_cmp(wait_lock->trx, start) >= 0) { @@ -3310,6 +3323,21 @@ lock_deadlock_recursive( return(LOCK_VICTIM_IS_OTHER); } + if (too_far) { + +#ifdef UNIV_DEBUG + if (lock_print_waits) { + fputs("Deadlock search exceeds" + " max steps or depth.\n", + stderr); + } +#endif /* UNIV_DEBUG */ + /* The information about transaction/lock + to be rolled back is available in the top + level. Do not print anything here. */ + return(LOCK_EXCEED_MAX_DEPTH); + } + if (lock_trx->que_state == TRX_QUE_LOCK_WAIT) { /* Another trx ahead has requested lock in an @@ -4510,13 +4538,34 @@ lock_rec_queue_validate( rec, impl_trx)); } } - +#if 0 if (index && !(index->type & DICT_CLUSTERED)) { /* The kernel mutex may get released temporarily in the next function call: we have to release lock table mutex to obey the latching order */ + /* NOTE: This is a bogus check that would fail in the + following case: Our transaction is updating a + row. After it has updated the clustered index record, + it goes to a secondary index record and finds someone + else holding an explicit S- or X-lock on that + secondary index record, presumably from a locking + read. Our transaction cannot update the secondary + index immediately, but places a waiting X-lock request + on the secondary index record. There is nothing + illegal in this. The assertion is simply too strong. */ + + /* From the locking point of view, each secondary + index is a separate table. A lock that is held on + secondary index rec does not give any rights to modify + or read the clustered index rec. Therefore, we can + think of the sec index as a separate 'table' from the + clust index 'table'. Conversely, a transaction that + has acquired a lock on and modified a clustered index + record may need to wait for a lock on the + corresponding record in a secondary index. */ + impl_trx = lock_sec_rec_some_has_impl_off_kernel( rec, index, offsets); @@ -4527,7 +4576,7 @@ lock_rec_queue_validate( rec, impl_trx)); } } - +#endif lock = lock_rec_get_first(rec); while (lock) { diff --git a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c index 5d309768064..e6524eeefbf 100644 --- a/storage/innobase/log/log0recv.c +++ b/storage/innobase/log/log0recv.c @@ -167,7 +167,7 @@ recv_sys_init( recv_sys->len = 0; recv_sys->recovered_offset = 0; - recv_sys->addr_hash = hash_create(available_memory / 64); + recv_sys->addr_hash = hash_create(available_memory / 512); recv_sys->n_addrs = 0; recv_sys->apply_log_recs = FALSE; @@ -207,7 +207,7 @@ recv_sys_empty_hash(void) hash_table_free(recv_sys->addr_hash); mem_heap_empty(recv_sys->heap); - recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 256); + recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 512); } #ifndef UNIV_LOG_DEBUG diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index 085f62daacc..7373a97cfb0 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -759,7 +759,15 @@ next_file: #ifdef HAVE_READDIR_R ret = readdir_r(dir, (struct dirent*)dirent_buf, &ent); - if (ret != 0) { + if (ret != 0 +#ifdef UNIV_AIX + /* On AIX, only if we got non-NULL 'ent' (result) value and + a non-zero 'ret' (return) value, it indicates a failed + readdir_r() call. An NULL 'ent' with an non-zero 'ret' + would indicate the "end of the directory" is reached. */ + && ent != NULL +#endif + ) { fprintf(stderr, "InnoDB: cannot read directory %s, error %lu\n", dirname, (ulong)ret); diff --git a/storage/innobase/plug.in.disabled b/storage/innobase/plug.in.disabled index f7d2abed751..de7302dd6cc 100644 --- a/storage/innobase/plug.in.disabled +++ b/storage/innobase/plug.in.disabled @@ -1,4 +1,4 @@ -MYSQL_STORAGE_ENGINE(innobase, innodb, [InnoDB Storage Engine], +MYSQL_STORAGE_ENGINE(innobase, innodb, [InnoDB Storage Engine], [Transactional Tables using InnoDB], [max,max-no-ndb]) MYSQL_PLUGIN_DIRECTORY(innobase, [storage/innobase]) MYSQL_PLUGIN_STATIC(innobase, [libinnobase.a]) diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c index ad14b927170..51c295b5098 100644 --- a/storage/innobase/row/row0ins.c +++ b/storage/innobase/row/row0ins.c @@ -140,7 +140,7 @@ row_ins_alloc_sys_fields( dfield = dtuple_get_nth_field(row, dict_col_get_no(col)); - ptr = mem_heap_alloc(heap, DATA_ROW_ID_LEN); + ptr = mem_heap_zalloc(heap, DATA_ROW_ID_LEN); dfield_set_data(dfield, ptr, DATA_ROW_ID_LEN); @@ -151,7 +151,7 @@ row_ins_alloc_sys_fields( col = dict_table_get_sys_col(table, DATA_TRX_ID); dfield = dtuple_get_nth_field(row, dict_col_get_no(col)); - ptr = mem_heap_alloc(heap, DATA_TRX_ID_LEN); + ptr = mem_heap_zalloc(heap, DATA_TRX_ID_LEN); dfield_set_data(dfield, ptr, DATA_TRX_ID_LEN); @@ -162,7 +162,7 @@ row_ins_alloc_sys_fields( col = dict_table_get_sys_col(table, DATA_ROLL_PTR); dfield = dtuple_get_nth_field(row, dict_col_get_no(col)); - ptr = mem_heap_alloc(heap, DATA_ROLL_PTR_LEN); + ptr = mem_heap_zalloc(heap, DATA_ROLL_PTR_LEN); dfield_set_data(dfield, ptr, DATA_ROLL_PTR_LEN); } diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index f7156403247..a0e0ee99775 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -1485,7 +1485,7 @@ row_unlock_for_mysql( if (UNIV_UNLIKELY (!srv_locks_unsafe_for_binlog - && trx->isolation_level != TRX_ISO_READ_COMMITTED)) { + && trx->isolation_level > TRX_ISO_READ_COMMITTED)) { fprintf(stderr, "InnoDB: Error: calling row_unlock_for_mysql though\n" diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 38902bca905..1d30249c53e 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -744,7 +744,7 @@ row_sel_get_clust_rec( trx = thr_get_trx(thr); if (srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) { + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) { lock_type = LOCK_REC_NOT_GAP; } else { lock_type = LOCK_ORDINARY; @@ -1358,7 +1358,7 @@ rec_loop: if (srv_locks_unsafe_for_binlog || trx->isolation_level - == TRX_ISO_READ_COMMITTED) { + <= TRX_ISO_READ_COMMITTED) { if (page_rec_is_supremum(next_rec)) { @@ -1414,7 +1414,7 @@ skip_lock: trx = thr_get_trx(thr); if (srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) { + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) { if (page_rec_is_supremum(rec)) { @@ -3596,7 +3596,7 @@ shortcut_fails_too_big_rec: && !page_rec_is_supremum(rec) && set_also_gap_locks && !(srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) && prebuilt->select_lock_type != LOCK_NONE) { /* Try to place a gap lock on the next index record @@ -3692,7 +3692,7 @@ rec_loop: if (set_also_gap_locks && !(srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) && prebuilt->select_lock_type != LOCK_NONE) { /* Try to place a lock on the index record */ @@ -3827,7 +3827,7 @@ wrong_offs: if (set_also_gap_locks && !(srv_locks_unsafe_for_binlog || trx->isolation_level - == TRX_ISO_READ_COMMITTED) + <= TRX_ISO_READ_COMMITTED) && prebuilt->select_lock_type != LOCK_NONE) { /* Try to place a gap lock on the index @@ -3862,7 +3862,7 @@ wrong_offs: if (set_also_gap_locks && !(srv_locks_unsafe_for_binlog || trx->isolation_level - == TRX_ISO_READ_COMMITTED) + <= TRX_ISO_READ_COMMITTED) && prebuilt->select_lock_type != LOCK_NONE) { /* Try to place a gap lock on the index @@ -3909,7 +3909,7 @@ wrong_offs: if (!set_also_gap_locks || srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED + || trx->isolation_level <= TRX_ISO_READ_COMMITTED || (unique_search && !UNIV_UNLIKELY(rec_get_deleted_flag(rec, comp)))) { @@ -3947,7 +3947,7 @@ no_gap_lock: rec_t* old_vers; case DB_SUCCESS: if (srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) { + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) { /* Note that a record of prebuilt->index was locked. */ prebuilt->new_rec_locks = 1; @@ -3956,6 +3956,7 @@ no_gap_lock: case DB_LOCK_WAIT: if (UNIV_LIKELY(prebuilt->row_read_type != ROW_READ_TRY_SEMI_CONSISTENT) + || unique_search || index != clust_index) { goto lock_wait_or_error; @@ -4080,7 +4081,7 @@ no_gap_lock: /* The record is delete-marked: we can skip it */ if ((srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) && prebuilt->select_lock_type != LOCK_NONE && !did_semi_consistent_read) { @@ -4147,7 +4148,7 @@ requires_clust_rec: } if ((srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) && prebuilt->select_lock_type != LOCK_NONE) { /* Note that both the secondary index record and the clustered index record were locked. */ @@ -4160,7 +4161,7 @@ requires_clust_rec: /* The record is delete marked: we can skip it */ if ((srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) && prebuilt->select_lock_type != LOCK_NONE) { /* No need to keep a lock on a delete-marked @@ -4367,7 +4368,7 @@ lock_wait_or_error: moves_up, &mtr); if ((srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) && !same_user_rec) { /* Since we were not able to restore the cursor @@ -4545,12 +4546,12 @@ row_search_autoinc_read_column( case DATA_FLOAT: ut_a(len == sizeof(float)); - value = mach_float_read(data); + value = (ib_ulonglong) mach_float_read(data); break; case DATA_DOUBLE: ut_a(len == sizeof(double)); - value = mach_double_read(data); + value = (ib_ulonglong) mach_double_read(data); break; default: diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index 26ea7958d0d..a2eed3f171c 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -1554,8 +1554,9 @@ srv_suspend_mysql_thread( mutex_exit(&kernel_mutex); - if (srv_lock_wait_timeout < 100000000 - && wait_time > (double)srv_lock_wait_timeout) { + if (trx_is_interrupted(trx) + || (srv_lock_wait_timeout < 100000000 + && wait_time > (double)srv_lock_wait_timeout)) { trx->error_state = DB_LOCK_WAIT_TIMEOUT; } @@ -2104,9 +2105,10 @@ loop: wait_time = ut_difftime(ut_time(), slot->suspend_time); - if (srv_lock_wait_timeout < 100000000 - && (wait_time > (double) srv_lock_wait_timeout - || wait_time < 0)) { + if (trx_is_interrupted(thr_get_trx(slot->thr)) + || (srv_lock_wait_timeout < 100000000 + && (wait_time > (double) srv_lock_wait_timeout + || wait_time < 0))) { /* Timeout exceeded or a wrap-around in system time counter: cancel the lock request queued diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c index d117ff16608..a7950473a17 100644 --- a/storage/innobase/srv/srv0start.c +++ b/storage/innobase/srv/srv0start.c @@ -104,7 +104,7 @@ static char* srv_monitor_file_name; /* Avoid warnings when using purify */ -#ifdef HAVE_valgrind +#ifdef HAVE_purify static int inno_bcmp(register const char *s1, register const char *s2, register uint len) { diff --git a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c index 19c5159e15f..f732aca93f5 100644 --- a/storage/innobase/trx/trx0sys.c +++ b/storage/innobase/trx/trx0sys.c @@ -507,8 +507,8 @@ trx_sys_doublewrite_init_or_restore_pages( " recover the database" " with the my.cnf\n" "InnoDB: option:\n" - "InnoDB: set-variable=" - "innodb_force_recovery=6\n"); + "InnoDB:" + " innodb_force_recovery=6\n"); exit(1); } diff --git a/storage/innodb_plugin/CMakeLists.txt b/storage/innodb_plugin/CMakeLists.txt index 36e157ae736..87318ceec78 100644 --- a/storage/innodb_plugin/CMakeLists.txt +++ b/storage/innodb_plugin/CMakeLists.txt @@ -78,9 +78,11 @@ SET(INNODB_PLUGIN_SOURCES btr/btr0btr.c btr/btr0cur.c btr/btr0pcur.c btr/btr0sea trx/trx0i_s.c trx/trx0purge.c trx/trx0rec.c trx/trx0roll.c trx/trx0rseg.c trx/trx0sys.c trx/trx0trx.c trx/trx0undo.c usr/usr0sess.c - ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rnd.c ut/ut0ut.c ut/ut0vec.c + ut/ut0byte.c ut/ut0dbg.c ut/ut0mem.c ut/ut0rbt.c ut/ut0rnd.c ut/ut0ut.c ut/ut0vec.c ut/ut0list.c ut/ut0wqueue.c) -ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS -DIB_HAVE_PAUSE_INSTRUCTION) +# Windows atomics do not perform well. Disable Windows atomics by default. +# See bug#52102 for details. +#ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS -DINNODB_RW_LOCKS_USE_ATOMICS -DHAVE_IB_PAUSE_INSTRUCTION) +ADD_DEFINITIONS(-DHAVE_IB_PAUSE_INSTRUCTION) -#Disable storage engine, as we are using XtraDB -#MYSQL_STORAGE_ENGINE(INNODB_PLUGIN) +MYSQL_STORAGE_ENGINE(INNODB_PLUGIN) diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 1a6e07fd147..bc69aaca96a 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,262 @@ +2010-05-03 The InnoDB Team + + * buf0buf.c: + Fix Bug#53248 compressed tables page checksum mismatch after + re-enabling innodb_checksums + +2010-04-28 The InnoDB Team + + * log/log0recv.h, log/log0recv.c: + Fix Bug#53122 InnoDB recovery uses too big a hash table for redo + log records + +2010-04-27 The InnoDB Team + + * handler/ha_innodb.cc, lock/lock0lock.c, row/row0mysql.c, + row/row0sel.c: + Fix Bug#48607 READ UNCOMMITTED uses more locks than READ COMMITTED + in InnoDB 5.1+ + +2010-04-26 The InnoDB Team + + * row/row0sel.c: + Fix Bug#52663 Lost update incrementing column value under + READ COMMITTED isolation level + +2010-04-22 The InnoDB Team + + * include/dict0boot.h, dict/dict0boot.c: + Fix a bug that prevented the crash recovery of fast CREATE INDEX + from dropping partially created indexes. + +2010-04-21 The InnoDB Team + + * btr/btr0btr.c: + Fix Bug#52964 Infinite loop in btr_page_split_and_insert() + in ROW_FORMAT=COMPRESSED + +2010-04-21 The InnoDB Team + + * data/data0data.c: + Fix Bug#52745 Failing assertion: blob_no < page_zip->n_blobs + +2010-04-20 The InnoDB Team + + * dict/dict0crea.c, handler/ha_innodb.cc, include/trx0trx.h: + Fix Bug#50495 'Row size too large' for plugin, but works for + built-in InnoDB + Only check the record size at index creation time when + innodb_strict_mode is set or when ROW_FORMAT is DYNAMIC or COMPRESSED. + +2010-04-20 The InnoDB Team + + * btr/btr0btr.c, include/univ.i: + Implement UNIV_BTR_AVOID_COPY, for avoiding writes when a B-tree + node is split at the first or last record. + +2010-04-15 The InnoDB Team + + * trx/trx0rec.c: + Fix Bug#52746 InnoDB purge thread crashed with table containing + prefix indexed blobs + +2010-03-31 The InnoDB Team + + * mysql-test/innodb_bug51920.test, mysql-test/innodb_bug51920.result, + srv/srv0srv.c: + Fix Bug#51920 InnoDB connections in row lock wait ignore KILL + until lock wait timeout + +2010-03-31 The InnoDB Team + + * mysql-test/innodb_bug38231.test: + Remove non-determinism in the test case. + +2010-03-18 The InnoDB Team + + * CMakeLists.txt: + Fix Bug#52102 InnoDB Plugin shows performance drop compared to + InnoDB (Windows) + +2010-03-18 The InnoDB Team + + * buf0buf.ic: + When comparing the time of the first access to a block against + innodb_old_blocks_time, use 32-bit arithmetics. The comparison was + incorrect on 64-bit systems. + +2010-03-11 The InnoDB Team + + * buf0buf.h, buf0buf.ic: + Fix and clarify the latching of some buf_block_t members. + Note that check_index_page_at_flush is not protected by any mutex. + Note and assert that lock_hash_val is protected by the rw-latch. + +2010-03-10 The InnoDB Team + + * trx/trx0sys.c: + Fix Bug#51653 outdated reference to set-variable + +2010-03-10 The InnoDB Team + + * handler/ha_innodb.cc, mysql-test/innodb_bug21704.result, + mysql-test/innodb_bug47621.result, mysql-test/innodb_bug47621.test: + Fix Bug#47621 MySQL and InnoDB data dictionaries will become out of + sync when renaming columns + +2010-03-10 The InnoDB Team + + * handler/ha_innodb.cc: + Fix Bug#51356 Many Valgrind errors in error messages + with concurrent DDL + +2010-03-10 The InnoDB Team + + * handler/ha_innodb.cc, handler/handler0alter.cc, + mysql-test/innodb_bug51378.result, mysql-test/innodb_bug51378.test: + Fix Bug#51378 Init 'ref_length' to correct value, in case an out + of bound MySQL primary_key + +2010-03-10 The InnoDB Team + + * log/log0recv.c: + Remove a bogus assertion about page numbers exceeding 0x90000000 + in the redo log. Abort when encountering a corrupted redo log + record, unless innodb_force_recovery is set. + +2010-03-09 The InnoDB Team + + * handler/ha_innodb.cc: + Make SHOW ENGINE INNODB MUTEX STATUS display SUM(os_waits) + for the buffer pool block mutexes and locks. + +2010-03-08 The InnoDB Team + + * fil/fil0fil.c: + Fix ALTER TABLE ... IMPORT TABLESPACE of compressed tables. + +2010-03-03 The InnoDB Team + + * handler/handler0alter.cc, innodb-index.result, innodb-index.test, + innodb.result, innodb.test: + Disallow a duplicate index name when creating an index. + +2010-02-11 The InnoDB Team + + * include/mem0mem.h, include/mem0mem.ic, mem/mem0mem.c: + Fix Bug#49535 Available memory check slows down crash + recovery tens of times + +2010-02-09 The InnoDB Team + + * buf/buf0buf.c: + Fix Bug#38901 InnoDB logs error repeatedly when trying to load + page into buffer pool + +2010-02-09 The InnoDB Team + + * srv/srv0srv.c: + Let the master thread sleep if the amount of work to be done is + calibrated as taking less than a second. + +2010-02-04 The InnoDB Team + + * btr/btr0btr.c, btr/btr0cur.c, btr/btr0pcur.c, buf/buf0buf.c, + include/btr0btr.h, include/btr0cur.h, include/btr0pcur.h, + include/btr0pcur.ic, include/buf0buf.h, row/row0ins.c, row/row0sel.c: + Pass the file name and line number of the caller of the + b-tree cursor functions to the buffer pool requests, in order + to make the latch diagnostics more accurate. + +2010-02-03 The InnoDB Team + + * lock/lock0lock.c: + Fix Bug#49001 SHOW INNODB STATUS deadlock info incorrect + when deadlock detection aborts + +2010-02-03 The InnoDB Team + + * buf/buf0lru.c: + Fix Bug#35077 Very slow DROP TABLE (ALTER TABLE, OPTIMIZE TABLE) + on compressed tables + +2010-02-03 The InnoDB Team + + * handler/ha_innodb.cc, include/row0mysql.h, row/row0mysql.c: + Clean up CHECK TABLE error handling. + +2010-02-01 The InnoDB Team + + * handler/ha_innodb.cc, mysql-test/innodb-autoinc.test, + mysql-test/innodb-autoinc.result, + mysql-test/innodb-autoinc-44030.test, + mysql-test/innodb-autoinc-44030.result: + Fix Bug#49497 Error 1467 (ER_AUTOINC_READ_FAILED) on inserting + a negative value + +2010-01-27 The InnoDB Team + + * include/row0mysql.h, log/log0recv.c, row/row0mysql.c: + Drop temporary tables at startup. + This addresses the third aspect of + Bug#41609 Crash recovery does not work for InnoDB temporary tables. + +2010-01-21 The InnoDB Team + + * buf/buf0buf.c: + Do not merge buffered inserts to compressed pages before + the redo log has been applied in crash recovery. + +2010-01-13 The InnoDB Team + + * row/row0sel.c: + On the READ UNCOMMITTED isolation level, do not attempt to access + a clustered index record that has been marked for deletion. The + built-in InnoDB in MySQL 5.1 and earlier would attempt to retrieve + a previous version of the record in this case. + +2010-01-13 The InnoDB Team + + * buf/buf0buf.c: + When disabling the adaptive hash index, check the block state + before checking block->is_hashed, because the latter may be + uninitialized right after server startup. + +2010-01-12 The InnoDB Team + + * handler/ha_innodb.cc, handler/ha_innodb.h: + Fix Bug#46193 crash when accessing tables after enabling + innodb_force_recovery option + +2010-01-12 The InnoDB Team + + * row/row0mysql.c: + Fix Bug#49238 Creating/Dropping a temporary table while at 1023 + transactions will cause assert. + +2009-12-02 The InnoDB Team + + * srv/srv0start.c: + Display the zlib version number at startup. + InnoDB compressed tables use zlib, and the implementation depends + on the zlib function compressBound(), whose definition was slightly + changed in zlib version 1.2.3.1 in 2006. MySQL bundles zlib 1.2.3 + from 2005, but some installations use a more recent zlib. + +2009-11-30 The InnoDB Team + + * dict/dict0crea.c, dict/dict0mem.c, dict/dict0load.c, + dict/dict0boot.c, fil/fil0fil.c, handler/ha_innodb.cc, + include/dict0mem.h, row/row0mysql.c: + Fix the bogus warning messages for non-existing temporary + tables that were reported in + Bug#41609 Crash recovery does not work for InnoDB temporary tables. + The actual crash recovery bug was corrected on 2009-04-29. + +2009-11-27 The InnoDB Team + + InnoDB Plugin 1.0.6 released + 2009-11-20 The InnoDB Team * handler/ha_innodb.cc: @@ -79,8 +338,8 @@ sync/sync0arr.c, sync/sync0sync.c, thr/thr0loc.c, trx/trx0i_s.c, trx/trx0purge.c, trx/trx0rseg.c, trx/trx0sys.c, trx/trx0undo.c, usr/usr0sess.c, ut/ut0mem.c: - Fix Bug #45992 innodb memory not freed after shutdown - Fix Bug #46656 InnoDB plugin: memory leaks (Valgrind) + Fix Bug#45992 innodb memory not freed after shutdown + Fix Bug#46656 InnoDB plugin: memory leaks (Valgrind) 2009-10-29 The InnoDB Team @@ -422,7 +681,7 @@ * dict/dict0dict.c: When an index column cannot be found in the table during index creation, display additional diagnostic before an assertion failure. - This does NOT fix Bug #44571 InnoDB Plugin crashes on ADD INDEX, + This does NOT fix Bug#44571 InnoDB Plugin crashes on ADD INDEX, but it helps understand the reason of the crash. 2009-06-17 The InnoDB Team @@ -535,6 +794,12 @@ Fix Bug#44320 InnoDB: missing DB_ROLL_PTR in Table Monitor COLUMNS output +2009-04-29 The InnoDB Team + + * fil/fil0fil.c, include/fil0fil.h, include/mtr0mtr.h, + log/log0recv.c: + Fix Bug#41609 Crash recovery does not work for InnoDB temporary tables + 2009-04-23 The InnoDB Team * row/row0mysql.c: diff --git a/storage/innodb_plugin/Makefile.am b/storage/innodb_plugin/Makefile.am index 5c71fe18d14..1d0dd936895 100644 --- a/storage/innodb_plugin/Makefile.am +++ b/storage/innodb_plugin/Makefile.am @@ -217,6 +217,7 @@ noinst_HEADERS= \ include/ut0lst.h \ include/ut0mem.h \ include/ut0mem.ic \ + include/ut0rbt.h \ include/ut0rnd.h \ include/ut0rnd.ic \ include/ut0sort.h \ @@ -318,6 +319,7 @@ libinnobase_a_SOURCES= \ ut/ut0dbg.c \ ut/ut0list.c \ ut/ut0mem.c \ + ut/ut0rbt.c \ ut/ut0rnd.c \ ut/ut0ut.c \ ut/ut0vec.c \ diff --git a/storage/innodb_plugin/btr/btr0btr.c b/storage/innodb_plugin/btr/btr0btr.c index 086b3a0a599..96fcc2ed821 100644 --- a/storage/innodb_plugin/btr/btr0btr.c +++ b/storage/innodb_plugin/btr/btr0btr.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -592,13 +592,15 @@ an x-latch on the tree. @return rec_get_offsets() of the node pointer record */ static ulint* -btr_page_get_father_node_ptr( -/*=========================*/ +btr_page_get_father_node_ptr_func( +/*==============================*/ ulint* offsets,/*!< in: work area for the return value */ mem_heap_t* heap, /*!< in: memory heap to use */ btr_cur_t* cursor, /*!< in: cursor pointing to user record, out: cursor on node pointer record, its page x-latched */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { dtuple_t* tuple; @@ -622,7 +624,8 @@ btr_page_get_father_node_ptr( tuple = dict_index_build_node_ptr(index, user_rec, 0, heap, level); btr_cur_search_to_nth_level(index, level + 1, tuple, PAGE_CUR_LE, - BTR_CONT_MODIFY_TREE, cursor, 0, mtr); + BTR_CONT_MODIFY_TREE, cursor, 0, + file, line, mtr); node_ptr = btr_cur_get_rec(cursor); ut_ad(!page_rec_is_comp(node_ptr) @@ -670,6 +673,9 @@ btr_page_get_father_node_ptr( return(offsets); } +#define btr_page_get_father_node_ptr(of,heap,cur,mtr) \ + btr_page_get_father_node_ptr_func(of,heap,cur,__FILE__,__LINE__,mtr) + /************************************************************//** Returns the upper level node pointer to a page. It is assumed that mtr holds an x-latch on the tree. @@ -1445,11 +1451,11 @@ Calculates a split record such that the tuple will certainly fit on its half-page when the split is performed. We assume in this function only that the cursor page has at least one user record. @return split record, or NULL if tuple will be the first record on -upper half-page */ +the lower or upper half-page (determined by btr_page_tuple_smaller()) */ static rec_t* -btr_page_get_sure_split_rec( -/*========================*/ +btr_page_get_split_rec( +/*===================*/ btr_cur_t* cursor, /*!< in: cursor at which insert should be made */ const dtuple_t* tuple, /*!< in: tuple to insert */ ulint n_ext) /*!< in: number of externally stored columns */ @@ -1662,11 +1668,13 @@ Inserts a data tuple to a tree on a non-leaf level. It is assumed that mtr holds an x-latch on the tree. */ UNIV_INTERN void -btr_insert_on_non_leaf_level( -/*=========================*/ +btr_insert_on_non_leaf_level_func( +/*==============================*/ dict_index_t* index, /*!< in: index */ ulint level, /*!< in: level, must be > 0 */ dtuple_t* tuple, /*!< in: the record to be inserted */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { big_rec_t* dummy_big_rec; @@ -1678,7 +1686,7 @@ btr_insert_on_non_leaf_level( btr_cur_search_to_nth_level(index, level, tuple, PAGE_CUR_LE, BTR_CONT_MODIFY_TREE, - &cursor, 0, mtr); + &cursor, 0, file, line, mtr); err = btr_cur_pessimistic_insert(BTR_NO_LOCKING_FLAG | BTR_KEEP_SYS_FLAG @@ -1824,6 +1832,37 @@ btr_attach_half_pages( } /*************************************************************//** +Determine if a tuple is smaller than any record on the page. +@return TRUE if smaller */ +static +ibool +btr_page_tuple_smaller( +/*===================*/ + btr_cur_t* cursor, /*!< in: b-tree cursor */ + const dtuple_t* tuple, /*!< in: tuple to consider */ + ulint* offsets,/*!< in/out: temporary storage */ + ulint n_uniq, /*!< in: number of unique fields + in the index page records */ + mem_heap_t** heap) /*!< in/out: heap for offsets */ +{ + buf_block_t* block; + const rec_t* first_rec; + page_cur_t pcur; + + /* Read the first user record in the page. */ + block = btr_cur_get_block(cursor); + page_cur_set_before_first(block, &pcur); + page_cur_move_to_next(&pcur); + first_rec = page_cur_get_rec(&pcur); + + offsets = rec_get_offsets( + first_rec, cursor->index, offsets, + n_uniq, heap); + + return(cmp_dtuple_rec(tuple, first_rec, offsets) < 0); +} + +/*************************************************************//** Splits an index page to halves and inserts the tuple. It is assumed that mtr holds an x-latch to the index tree. NOTE: the tree x-latch is released within this function! NOTE that the operation of this @@ -1893,12 +1932,17 @@ func_start: /* 1. Decide the split record; split_rec == NULL means that the tuple to be inserted should be the first record on the upper half-page */ + insert_left = FALSE; if (n_iterations > 0) { direction = FSP_UP; hint_page_no = page_no + 1; - split_rec = btr_page_get_sure_split_rec(cursor, tuple, n_ext); + split_rec = btr_page_get_split_rec(cursor, tuple, n_ext); + if (UNIV_UNLIKELY(split_rec == NULL)) { + insert_left = btr_page_tuple_smaller( + cursor, tuple, offsets, n_uniq, &heap); + } } else if (btr_page_get_split_rec_to_right(cursor, &split_rec)) { direction = FSP_UP; hint_page_no = page_no + 1; @@ -1906,37 +1950,24 @@ func_start: } else if (btr_page_get_split_rec_to_left(cursor, &split_rec)) { direction = FSP_DOWN; hint_page_no = page_no - 1; + ut_ad(split_rec); } else { direction = FSP_UP; hint_page_no = page_no + 1; - if (page_get_n_recs(page) == 1) { - page_cur_t pcur; - - /* There is only one record in the index page - therefore we can't split the node in the middle - by default. We need to determine whether the - new record will be inserted to the left or right. */ - - /* Read the first (and only) record in the page. */ - page_cur_set_before_first(block, &pcur); - page_cur_move_to_next(&pcur); - first_rec = page_cur_get_rec(&pcur); + /* If there is only one record in the index page, we + can't split the node in the middle by default. We need + to determine whether the new record will be inserted + to the left or right. */ - offsets = rec_get_offsets( - first_rec, cursor->index, offsets, - n_uniq, &heap); - - /* If the new record is less than the existing record - the split in the middle will copy the existing - record to the new node. */ - if (cmp_dtuple_rec(tuple, first_rec, offsets) < 0) { - split_rec = page_get_middle_rec(page); - } else { - split_rec = NULL; - } - } else { + if (page_get_n_recs(page) > 1) { split_rec = page_get_middle_rec(page); + } else if (btr_page_tuple_smaller(cursor, tuple, + offsets, n_uniq, &heap)) { + split_rec = page_rec_get_next( + page_get_infimum_rec(page)); + } else { + split_rec = NULL; } } @@ -1966,11 +1997,15 @@ func_start: avoid further splits by inserting the record to an empty page. */ split_rec = NULL; - goto insert_right; + goto insert_empty; } + } else if (UNIV_UNLIKELY(insert_left)) { + first_rec = page_rec_get_next(page_get_infimum_rec(page)); + move_limit = page_rec_get_next(btr_cur_get_rec(cursor)); } else { -insert_right: - insert_left = FALSE; +insert_empty: + ut_ad(!split_rec); + ut_ad(!insert_left); buf = mem_alloc(rec_get_converted_size(cursor->index, tuple, n_ext)); @@ -1994,7 +2029,11 @@ insert_right: && btr_page_insert_fits(cursor, split_rec, offsets, tuple, n_ext, heap); } else { - mem_free(buf); + if (!insert_left) { + mem_free(buf); + buf = NULL; + } + insert_will_fit = !new_page_zip && btr_page_insert_fits(cursor, NULL, NULL, tuple, n_ext, heap); @@ -2007,7 +2046,17 @@ insert_right: } /* 5. Move then the records to the new page */ - if (direction == FSP_DOWN) { + if (direction == FSP_DOWN +#ifdef UNIV_BTR_AVOID_COPY + && page_rec_is_supremum(move_limit)) { + /* Instead of moving all records, make the new page + the empty page. */ + + left_block = block; + right_block = new_block; + } else if (direction == FSP_DOWN +#endif /* UNIV_BTR_AVOID_COPY */ + ) { /* fputs("Split left\n", stderr); */ if (0 @@ -2050,6 +2099,14 @@ insert_right: right_block = block; lock_update_split_left(right_block, left_block); +#ifdef UNIV_BTR_AVOID_COPY + } else if (!split_rec) { + /* Instead of moving all records, make the new page + the empty page. */ + + left_block = new_block; + right_block = block; +#endif /* UNIV_BTR_AVOID_COPY */ } else { /* fputs("Split right\n", stderr); */ diff --git a/storage/innodb_plugin/btr/btr0cur.c b/storage/innodb_plugin/btr/btr0cur.c index 46dfb5d1a46..0e603fdca8f 100644 --- a/storage/innodb_plugin/btr/btr0cur.c +++ b/storage/innodb_plugin/btr/btr0cur.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -342,6 +342,8 @@ btr_cur_search_to_nth_level( ulint has_search_latch,/*!< in: info on the latch mode the caller currently has on btr_search_latch: RW_S_LATCH, or 0 */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { page_cur_t* page_cursor; @@ -520,7 +522,7 @@ btr_cur_search_to_nth_level( retry_page_get: block = buf_page_get_gen(space, zip_size, page_no, rw_latch, guess, buf_mode, - __FILE__, __LINE__, mtr); + file, line, mtr); if (block == NULL) { /* This must be a search to perform an insert; try insert to the insert buffer */ @@ -677,13 +679,15 @@ func_exit: Opens a cursor at either end of an index. */ UNIV_INTERN void -btr_cur_open_at_index_side( -/*=======================*/ +btr_cur_open_at_index_side_func( +/*============================*/ ibool from_left, /*!< in: TRUE if open to the low end, FALSE if to the high end */ dict_index_t* index, /*!< in: index */ ulint latch_mode, /*!< in: latch mode */ btr_cur_t* cursor, /*!< in: cursor */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { page_cur_t* page_cursor; @@ -728,7 +732,7 @@ btr_cur_open_at_index_side( page_t* page; block = buf_page_get_gen(space, zip_size, page_no, RW_NO_LATCH, NULL, BUF_GET, - __FILE__, __LINE__, mtr); + file, line, mtr); page = buf_block_get_frame(block); ut_ad(0 == ut_dulint_cmp(index->id, btr_page_get_index_id(page))); @@ -808,11 +812,13 @@ btr_cur_open_at_index_side( Positions a cursor at a randomly chosen position within a B-tree. */ UNIV_INTERN void -btr_cur_open_at_rnd_pos( -/*====================*/ +btr_cur_open_at_rnd_pos_func( +/*=========================*/ dict_index_t* index, /*!< in: index */ ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ btr_cur_t* cursor, /*!< in/out: B-tree cursor */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { page_cur_t* page_cursor; @@ -847,7 +853,7 @@ btr_cur_open_at_rnd_pos( block = buf_page_get_gen(space, zip_size, page_no, RW_NO_LATCH, NULL, BUF_GET, - __FILE__, __LINE__, mtr); + file, line, mtr); page = buf_block_get_frame(block); ut_ad(0 == ut_dulint_cmp(index->id, btr_page_get_index_id(page))); @@ -1058,7 +1064,6 @@ btr_cur_optimistic_insert( ibool inherit; ulint zip_size; ulint rec_size; - mem_heap_t* heap = NULL; ulint err; *big_rec = NULL; @@ -1138,10 +1143,6 @@ btr_cur_optimistic_insert( index, entry, big_rec_vec); } - if (heap) { - mem_heap_free(heap); - } - return(DB_TOO_BIG_RECORD); } } @@ -1164,15 +1165,11 @@ fail_err: dtuple_convert_back_big_rec(index, entry, big_rec_vec); } - if (UNIV_LIKELY_NULL(heap)) { - mem_heap_free(heap); - } - return(err); } if (UNIV_UNLIKELY(max_size < BTR_CUR_PAGE_REORGANIZE_LIMIT - || max_size < rec_size) + || max_size < rec_size) && UNIV_LIKELY(page_get_n_recs(page) > 1) && page_get_max_insert_size(page, 1) < rec_size) { @@ -1238,10 +1235,6 @@ fail_err: } } - if (UNIV_LIKELY_NULL(heap)) { - mem_heap_free(heap); - } - #ifdef BTR_CUR_HASH_ADAPT if (!reorg && leaf && (cursor->flag == BTR_CUR_HASH)) { btr_search_update_hash_node_on_insert(cursor); @@ -3100,7 +3093,8 @@ btr_estimate_n_rows_in_range( btr_cur_search_to_nth_level(index, 0, tuple1, mode1, BTR_SEARCH_LEAF | BTR_ESTIMATE, - &cursor, 0, &mtr); + &cursor, 0, + __FILE__, __LINE__, &mtr); } else { btr_cur_open_at_index_side(TRUE, index, BTR_SEARCH_LEAF | BTR_ESTIMATE, @@ -3117,7 +3111,8 @@ btr_estimate_n_rows_in_range( btr_cur_search_to_nth_level(index, 0, tuple2, mode2, BTR_SEARCH_LEAF | BTR_ESTIMATE, - &cursor, 0, &mtr); + &cursor, 0, + __FILE__, __LINE__, &mtr); } else { btr_cur_open_at_index_side(FALSE, index, BTR_SEARCH_LEAF | BTR_ESTIMATE, @@ -3361,6 +3356,8 @@ btr_estimate_number_of_different_key_vals( also the pages used for external storage of fields (those pages are included in index->stat_n_leaf_pages) */ + dict_index_stat_mutex_enter(index); + for (j = 0; j <= n_cols; j++) { index->stat_n_diff_key_vals[j] = ((n_diff[j] @@ -3390,6 +3387,8 @@ btr_estimate_number_of_different_key_vals( index->stat_n_diff_key_vals[j] += add_on; } + dict_index_stat_mutex_exit(index); + mem_free(n_diff); if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); @@ -4252,7 +4251,7 @@ btr_free_externally_stored_field( /* In the rollback of uncommitted transactions, we may encounter a clustered index record whose BLOBs have not been written. There is nothing to free then. */ - ut_a(rb_ctx == RB_RECOVERY); + ut_a(rb_ctx == RB_RECOVERY || rb_ctx == RB_RECOVERY_PURGE_REC); return; } @@ -4298,7 +4297,7 @@ btr_free_externally_stored_field( || (mach_read_from_1(field_ref + BTR_EXTERN_LEN) & BTR_EXTERN_OWNER_FLAG) /* Rollback and inherited field */ - || (rb_ctx != RB_NONE + || ((rb_ctx == RB_NORMAL || rb_ctx == RB_RECOVERY) && (mach_read_from_1(field_ref + BTR_EXTERN_LEN) & BTR_EXTERN_INHERITED_FLAG))) { diff --git a/storage/innodb_plugin/btr/btr0pcur.c b/storage/innodb_plugin/btr/btr0pcur.c index ec98692c35b..658901208ef 100644 --- a/storage/innodb_plugin/btr/btr0pcur.c +++ b/storage/innodb_plugin/btr/btr0pcur.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -205,10 +205,12 @@ record and it can be restored on a user record whose ordering fields are identical to the ones of the original user record */ UNIV_INTERN ibool -btr_pcur_restore_position( -/*======================*/ +btr_pcur_restore_position_func( +/*===========================*/ ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in: detached persistent cursor */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { dict_index_t* index; @@ -217,6 +219,9 @@ btr_pcur_restore_position( ulint old_mode; mem_heap_t* heap; + ut_ad(mtr); + ut_ad(mtr->state == MTR_ACTIVE); + index = btr_cur_get_index(btr_pcur_get_btr_cur(cursor)); if (UNIV_UNLIKELY(cursor->old_stored != BTR_PCUR_OLD_STORED) @@ -257,7 +262,8 @@ btr_pcur_restore_position( if (UNIV_LIKELY(buf_page_optimistic_get( latch_mode, cursor->block_when_stored, - cursor->modify_clock, mtr))) { + cursor->modify_clock, + file, line, mtr))) { cursor->pos_state = BTR_PCUR_IS_POSITIONED; buf_block_dbg_add_level(btr_pcur_get_block(cursor), @@ -312,8 +318,8 @@ btr_pcur_restore_position( mode = PAGE_CUR_L; } - btr_pcur_open_with_no_init(index, tuple, mode, latch_mode, - cursor, 0, mtr); + btr_pcur_open_with_no_init_func(index, tuple, mode, latch_mode, + cursor, 0, file, line, mtr); /* Restore the old search mode */ cursor->search_mode = old_mode; @@ -553,8 +559,8 @@ before first in tree. The latching mode must be BTR_SEARCH_LEAF or BTR_MODIFY_LEAF. */ UNIV_INTERN void -btr_pcur_open_on_user_rec( -/*======================*/ +btr_pcur_open_on_user_rec_func( +/*===========================*/ dict_index_t* index, /*!< in: index */ const dtuple_t* tuple, /*!< in: tuple on which search done */ ulint mode, /*!< in: PAGE_CUR_L, ... */ @@ -562,9 +568,12 @@ btr_pcur_open_on_user_rec( BTR_MODIFY_LEAF */ btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { - btr_pcur_open(index, tuple, mode, latch_mode, cursor, mtr); + btr_pcur_open_func(index, tuple, mode, latch_mode, cursor, + file, line, mtr); if ((mode == PAGE_CUR_GE) || (mode == PAGE_CUR_G)) { diff --git a/storage/innodb_plugin/buf/buf0buddy.c b/storage/innodb_plugin/buf/buf0buddy.c index f0e1395c307..66d802f8a36 100644 --- a/storage/innodb_plugin/buf/buf0buddy.c +++ b/storage/innodb_plugin/buf/buf0buddy.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 2006, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -391,6 +391,8 @@ buf_buddy_relocate_block( UT_LIST_ADD_FIRST(list, buf_pool->zip_clean, dpage); } + UNIV_MEM_INVALID(bpage, sizeof *bpage); + mutex_exit(&buf_pool_zip_mutex); return(TRUE); } diff --git a/storage/innodb_plugin/buf/buf0buf.c b/storage/innodb_plugin/buf/buf0buf.c index 111d396fbc5..f299c2df969 100644 --- a/storage/innodb_plugin/buf/buf0buf.c +++ b/storage/innodb_plugin/buf/buf0buf.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -242,6 +242,8 @@ the read requests for the whole area. #ifndef UNIV_HOTBACKUP /** Value in microseconds */ static const int WAIT_FOR_READ = 5000; +/** Number of attemtps made to read in a page in the buffer pool */ +static const ulint BUF_PAGE_READ_MAX_RETRIES = 100; /** The buffer buf_pool of the database */ UNIV_INTERN buf_pool_t* buf_pool = NULL; @@ -1058,7 +1060,9 @@ buf_pool_drop_hash_index(void) when we have an x-latch on btr_search_latch; see the comment in buf0buf.h */ - if (!block->is_hashed) { + if (buf_block_get_state(block) + != BUF_BLOCK_FILE_PAGE + || !block->is_hashed) { continue; } @@ -1187,8 +1191,6 @@ buf_relocate( HASH_DELETE(buf_page_t, hash, buf_pool->page_hash, fold, bpage); HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, fold, dpage); - - UNIV_MEM_INVALID(bpage, sizeof *bpage); } /********************************************************************//** @@ -1818,14 +1820,14 @@ buf_zip_decompress( buf_block_t* block, /*!< in/out: block */ ibool check) /*!< in: TRUE=verify the page checksum */ { - const byte* frame = block->page.zip.data; + const byte* frame = block->page.zip.data; + ulint stamp_checksum = mach_read_from_4( + frame + FIL_PAGE_SPACE_OR_CHKSUM); ut_ad(buf_block_get_zip_size(block)); ut_a(buf_block_get_space(block) != 0); - if (UNIV_LIKELY(check)) { - ulint stamp_checksum = mach_read_from_4( - frame + FIL_PAGE_SPACE_OR_CHKSUM); + if (UNIV_LIKELY(check && stamp_checksum != BUF_NO_CHECKSUM_MAGIC)) { ulint calc_checksum = page_zip_calc_checksum( frame, page_zip_get_size(&block->page.zip)); @@ -2034,8 +2036,10 @@ buf_page_get_gen( unsigned access_time; ulint fix_type; ibool must_read; + ulint retries = 0; ut_ad(mtr); + ut_ad(mtr->state == MTR_ACTIVE); ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH) || (rw_latch == RW_NO_LATCH)); @@ -2088,7 +2092,29 @@ loop2: return(NULL); } - buf_read_page(space, zip_size, offset); + if (buf_read_page(space, zip_size, offset)) { + retries = 0; + } else if (retries < BUF_PAGE_READ_MAX_RETRIES) { + ++retries; + } else { + fprintf(stderr, "InnoDB: Error: Unable" + " to read tablespace %lu page no" + " %lu into the buffer pool after" + " %lu attempts\n" + "InnoDB: The most probable cause" + " of this error may be that the" + " table has been corrupted.\n" + "InnoDB: You can try to fix this" + " problem by using" + " innodb_force_recovery.\n" + "InnoDB: Please see reference manual" + " for more details.\n" + "InnoDB: Aborting...\n", + space, offset, + BUF_PAGE_READ_MAX_RETRIES); + + ut_error; + } #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG ut_a(++buf_dbg_counter % 37 || buf_validate()); @@ -2196,22 +2222,8 @@ wait_until_unfixed: ut_ad(!block->page.in_flush_list); } else { /* Relocate buf_pool->flush_list. */ - buf_page_t* b; - - b = UT_LIST_GET_PREV(list, &block->page); - ut_ad(block->page.in_flush_list); - UT_LIST_REMOVE(list, buf_pool->flush_list, - &block->page); - - if (b) { - UT_LIST_INSERT_AFTER( - list, buf_pool->flush_list, b, - &block->page); - } else { - UT_LIST_ADD_FIRST( - list, buf_pool->flush_list, - &block->page); - } + buf_flush_relocate_on_flush_list(bpage, + &block->page); } /* Buffer-fix, I/O-fix, and X-latch the block @@ -2225,6 +2237,9 @@ wait_until_unfixed: block->page.buf_fix_count = 1; buf_block_set_io_fix(block, BUF_IO_READ); rw_lock_x_lock(&block->lock); + + UNIV_MEM_INVALID(bpage, sizeof *bpage); + mutex_exit(&block->mutex); mutex_exit(&buf_pool_zip_mutex); buf_pool->n_pend_unzip++; @@ -2236,8 +2251,9 @@ wait_until_unfixed: /* Decompress the page and apply buffered operations while not holding buf_pool_mutex or block->mutex. */ success = buf_zip_decompress(block, srv_use_checksums); + ut_a(success); - if (UNIV_LIKELY(success)) { + if (UNIV_LIKELY(!recv_no_ibuf_operations)) { ibuf_merge_or_delete_for_page(block, space, offset, zip_size, TRUE); } @@ -2250,13 +2266,6 @@ wait_until_unfixed: mutex_exit(&block->mutex); buf_pool->n_pend_unzip--; rw_lock_x_unlock(&block->lock); - - if (UNIV_UNLIKELY(!success)) { - - buf_pool_mutex_exit(); - return(NULL); - } - break; case BUF_BLOCK_ZIP_FREE: @@ -2356,8 +2365,8 @@ page. @return TRUE if success */ UNIV_INTERN ibool -buf_page_optimistic_get_func( -/*=========================*/ +buf_page_optimistic_get( +/*====================*/ ulint rw_latch,/*!< in: RW_S_LATCH, RW_X_LATCH */ buf_block_t* block, /*!< in: guessed buffer block */ ib_uint64_t modify_clock,/*!< in: modify clock value if mode is @@ -2370,7 +2379,9 @@ buf_page_optimistic_get_func( ibool success; ulint fix_type; - ut_ad(mtr && block); + ut_ad(block); + ut_ad(mtr); + ut_ad(mtr->state == MTR_ACTIVE); ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH)); mutex_enter(&block->mutex); @@ -2482,6 +2493,7 @@ buf_page_get_known_nowait( ulint fix_type; ut_ad(mtr); + ut_ad(mtr->state == MTR_ACTIVE); ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH)); mutex_enter(&block->mutex); @@ -2581,6 +2593,9 @@ buf_page_try_get_func( ibool success; ulint fix_type; + ut_ad(mtr); + ut_ad(mtr->state == MTR_ACTIVE); + buf_pool_mutex_enter(); block = buf_block_hash_get(space_id, page_no); @@ -2954,6 +2969,7 @@ buf_page_create( ulint time_ms = ut_time_ms(); ut_ad(mtr); + ut_ad(mtr->state == MTR_ACTIVE); ut_ad(space || !zip_size); free_block = buf_LRU_get_free_block(0); diff --git a/storage/innodb_plugin/buf/buf0flu.c b/storage/innodb_plugin/buf/buf0flu.c index 8b614ce90e5..f2b07492470 100644 --- a/storage/innodb_plugin/buf/buf0flu.c +++ b/storage/innodb_plugin/buf/buf0flu.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -88,6 +88,140 @@ buf_flush_validate_low(void); #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ /********************************************************************//** +Insert a block in the flush_rbt and returns a pointer to its +predecessor or NULL if no predecessor. The ordering is maintained +on the basis of the <oldest_modification, space, offset> key. +@return pointer to the predecessor or NULL if no predecessor. */ +static +buf_page_t* +buf_flush_insert_in_flush_rbt( +/*==========================*/ + buf_page_t* bpage) /*!< in: bpage to be inserted. */ +{ + buf_page_t* prev = NULL; + const ib_rbt_node_t* c_node; + const ib_rbt_node_t* p_node; + + ut_ad(buf_pool_mutex_own()); + + /* Insert this buffer into the rbt. */ + c_node = rbt_insert(buf_pool->flush_rbt, &bpage, &bpage); + ut_a(c_node != NULL); + + /* Get the predecessor. */ + p_node = rbt_prev(buf_pool->flush_rbt, c_node); + + if (p_node != NULL) { + prev = *rbt_value(buf_page_t*, p_node); + ut_a(prev != NULL); + } + + return(prev); +} + +/********************************************************************//** +Delete a bpage from the flush_rbt. */ +static +void +buf_flush_delete_from_flush_rbt( +/*============================*/ + buf_page_t* bpage) /*!< in: bpage to be removed. */ +{ + + ibool ret = FALSE; + + ut_ad(buf_pool_mutex_own()); + ret = rbt_delete(buf_pool->flush_rbt, &bpage); + ut_ad(ret); +} + +/********************************************************************//** +Compare two modified blocks in the buffer pool. The key for comparison +is: +key = <oldest_modification, space, offset> +This comparison is used to maintian ordering of blocks in the +buf_pool->flush_rbt. +Note that for the purpose of flush_rbt, we only need to order blocks +on the oldest_modification. The other two fields are used to uniquely +identify the blocks. +@return < 0 if b2 < b1, 0 if b2 == b1, > 0 if b2 > b1 */ +static +int +buf_flush_block_cmp( +/*================*/ + const void* p1, /*!< in: block1 */ + const void* p2) /*!< in: block2 */ +{ + int ret; + const buf_page_t* b1; + const buf_page_t* b2; + + ut_ad(p1 != NULL); + ut_ad(p2 != NULL); + + b1 = *(const buf_page_t**) p1; + b2 = *(const buf_page_t**) p2; + + ut_ad(b1 != NULL); + ut_ad(b2 != NULL); + + ut_ad(b1->in_flush_list); + ut_ad(b2->in_flush_list); + + if (b2->oldest_modification + > b1->oldest_modification) { + return(1); + } + + if (b2->oldest_modification + < b1->oldest_modification) { + return(-1); + } + + /* If oldest_modification is same then decide on the space. */ + ret = (int)(b2->space - b1->space); + + /* Or else decide ordering on the offset field. */ + return(ret ? ret : (int)(b2->offset - b1->offset)); +} + +/********************************************************************//** +Initialize the red-black tree to speed up insertions into the flush_list +during recovery process. Should be called at the start of recovery +process before any page has been read/written. */ +UNIV_INTERN +void +buf_flush_init_flush_rbt(void) +/*==========================*/ +{ + buf_pool_mutex_enter(); + + /* Create red black tree for speedy insertions in flush list. */ + buf_pool->flush_rbt = rbt_create(sizeof(buf_page_t*), + buf_flush_block_cmp); + buf_pool_mutex_exit(); +} + +/********************************************************************//** +Frees up the red-black tree. */ +UNIV_INTERN +void +buf_flush_free_flush_rbt(void) +/*==========================*/ +{ + buf_pool_mutex_enter(); + +#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG + ut_a(buf_flush_validate_low()); +#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ + + rbt_free(buf_pool->flush_rbt); + buf_pool->flush_rbt = NULL; + + buf_pool_mutex_exit(); +} + +/********************************************************************//** Inserts a modified block into the flush list. */ UNIV_INTERN void @@ -100,6 +234,13 @@ buf_flush_insert_into_flush_list( || (UT_LIST_GET_FIRST(buf_pool->flush_list)->oldest_modification <= block->page.oldest_modification)); + /* If we are in the recovery then we need to update the flush + red-black tree as well. */ + if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) { + buf_flush_insert_sorted_into_flush_list(block); + return; + } + ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); ut_ad(block->page.in_LRU_list); ut_ad(block->page.in_page_hash); @@ -136,12 +277,27 @@ buf_flush_insert_sorted_into_flush_list( ut_d(block->page.in_flush_list = TRUE); prev_b = NULL; - b = UT_LIST_GET_FIRST(buf_pool->flush_list); - while (b && b->oldest_modification > block->page.oldest_modification) { - ut_ad(b->in_flush_list); - prev_b = b; - b = UT_LIST_GET_NEXT(list, b); + /* For the most part when this function is called the flush_rbt + should not be NULL. In a very rare boundary case it is possible + that the flush_rbt has already been freed by the recovery thread + before the last page was hooked up in the flush_list by the + io-handler thread. In that case we'll just do a simple + linear search in the else block. */ + if (buf_pool->flush_rbt) { + + prev_b = buf_flush_insert_in_flush_rbt(&block->page); + + } else { + + b = UT_LIST_GET_FIRST(buf_pool->flush_list); + + while (b && b->oldest_modification + > block->page.oldest_modification) { + ut_ad(b->in_flush_list); + prev_b = b; + b = UT_LIST_GET_NEXT(list, b); + } } if (prev_b == NULL) { @@ -237,7 +393,6 @@ buf_flush_remove( ut_ad(buf_pool_mutex_own()); ut_ad(mutex_own(buf_page_get_mutex(bpage))); ut_ad(bpage->in_flush_list); - ut_d(bpage->in_flush_list = FALSE); switch (buf_page_get_state(bpage)) { case BUF_BLOCK_ZIP_PAGE: @@ -259,6 +414,15 @@ buf_flush_remove( break; } + /* If the flush_rbt is active then delete from it as well. */ + if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) { + buf_flush_delete_from_flush_rbt(bpage); + } + + /* Must be done after we have removed it from the flush_rbt + because we assert on in_flush_list in comparison function. */ + ut_d(bpage->in_flush_list = FALSE); + bpage->oldest_modification = 0; ut_d(UT_LIST_VALIDATE(list, buf_page_t, buf_pool->flush_list, @@ -266,6 +430,63 @@ buf_flush_remove( } /********************************************************************//** +Relocates a buffer control block on the flush_list. +Note that it is assumed that the contents of bpage has already been +copied to dpage. */ +UNIV_INTERN +void +buf_flush_relocate_on_flush_list( +/*=============================*/ + buf_page_t* bpage, /*!< in/out: control block being moved */ + buf_page_t* dpage) /*!< in/out: destination block */ +{ + buf_page_t* prev; + buf_page_t* prev_b = NULL; + + ut_ad(buf_pool_mutex_own()); + + ut_ad(mutex_own(buf_page_get_mutex(bpage))); + + ut_ad(bpage->in_flush_list); + ut_ad(dpage->in_flush_list); + + /* If recovery is active we must swap the control blocks in + the flush_rbt as well. */ + if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) { + buf_flush_delete_from_flush_rbt(bpage); + prev_b = buf_flush_insert_in_flush_rbt(dpage); + } + + /* Must be done after we have removed it from the flush_rbt + because we assert on in_flush_list in comparison function. */ + ut_d(bpage->in_flush_list = FALSE); + + prev = UT_LIST_GET_PREV(list, bpage); + UT_LIST_REMOVE(list, buf_pool->flush_list, bpage); + + if (prev) { + ut_ad(prev->in_flush_list); + UT_LIST_INSERT_AFTER( + list, + buf_pool->flush_list, + prev, dpage); + } else { + UT_LIST_ADD_FIRST( + list, + buf_pool->flush_list, + dpage); + } + + /* Just an extra check. Previous in flush_list + should be the same control block as in flush_rbt. */ + ut_a(!buf_pool->flush_rbt || prev_b == prev); + +#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG + ut_a(buf_flush_validate_low()); +#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ +} + +/********************************************************************//** Updates the flush system data structures when a write is completed. */ UNIV_INTERN void @@ -1367,24 +1588,45 @@ ibool buf_flush_validate_low(void) /*========================*/ { - buf_page_t* bpage; + buf_page_t* bpage; + const ib_rbt_node_t* rnode = NULL; UT_LIST_VALIDATE(list, buf_page_t, buf_pool->flush_list, ut_ad(ut_list_node_313->in_flush_list)); bpage = UT_LIST_GET_FIRST(buf_pool->flush_list); + /* If we are in recovery mode i.e.: flush_rbt != NULL + then each block in the flush_list must also be present + in the flush_rbt. */ + if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) { + rnode = rbt_first(buf_pool->flush_rbt); + } + while (bpage != NULL) { const ib_uint64_t om = bpage->oldest_modification; ut_ad(bpage->in_flush_list); ut_a(buf_page_in_file(bpage)); ut_a(om > 0); + if (UNIV_LIKELY_NULL(buf_pool->flush_rbt)) { + ut_a(rnode); + buf_page_t* rpage = *rbt_value(buf_page_t*, + rnode); + ut_a(rpage); + ut_a(rpage == bpage); + rnode = rbt_next(buf_pool->flush_rbt, rnode); + } + bpage = UT_LIST_GET_NEXT(list, bpage); ut_a(!bpage || om >= bpage->oldest_modification); } + /* By this time we must have exhausted the traversal of + flush_rbt (if active) as well. */ + ut_a(rnode == NULL); + return(TRUE); } diff --git a/storage/innodb_plugin/buf/buf0lru.c b/storage/innodb_plugin/buf/buf0lru.c index 4f19fd13fa5..9cfa02ba3ac 100644 --- a/storage/innodb_plugin/buf/buf0lru.c +++ b/storage/innodb_plugin/buf/buf0lru.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -350,17 +350,31 @@ scan_again: bpage = UT_LIST_GET_LAST(buf_pool->LRU); while (bpage != NULL) { - mutex_t* block_mutex = buf_page_get_mutex(bpage); buf_page_t* prev_bpage; + ibool prev_bpage_buf_fix = FALSE; ut_a(buf_page_in_file(bpage)); - mutex_enter(block_mutex); prev_bpage = UT_LIST_GET_PREV(LRU, bpage); - if (buf_page_get_space(bpage) == id) { - if (bpage->buf_fix_count > 0 - || buf_page_get_io_fix(bpage) != BUF_IO_NONE) { + /* bpage->space and bpage->io_fix are protected by + buf_pool_mutex and block_mutex. It is safe to check + them while holding buf_pool_mutex only. */ + + if (buf_page_get_space(bpage) != id) { + /* Skip this block, as it does not belong to + the space that is being invalidated. */ + } else if (buf_page_get_io_fix(bpage) != BUF_IO_NONE) { + /* We cannot remove this page during this scan + yet; maybe the system is currently reading it + in, or flushing the modifications to the file */ + + all_freed = FALSE; + } else { + mutex_t* block_mutex = buf_page_get_mutex(bpage); + mutex_enter(block_mutex); + + if (bpage->buf_fix_count > 0) { /* We cannot remove this page during this scan yet; maybe the system is @@ -380,8 +394,40 @@ scan_again: (ulong) buf_page_get_page_no(bpage)); } #endif - if (buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE - && ((buf_block_t*) bpage)->is_hashed) { + if (buf_page_get_state(bpage) != BUF_BLOCK_FILE_PAGE) { + /* This is a compressed-only block + descriptor. Ensure that prev_bpage + cannot be relocated when bpage is freed. */ + if (UNIV_LIKELY(prev_bpage != NULL)) { + switch (buf_page_get_state( + prev_bpage)) { + case BUF_BLOCK_FILE_PAGE: + /* Descriptors of uncompressed + blocks will not be relocated, + because we are holding the + buf_pool_mutex. */ + break; + case BUF_BLOCK_ZIP_PAGE: + case BUF_BLOCK_ZIP_DIRTY: + /* Descriptors of compressed- + only blocks can be relocated, + unless they are buffer-fixed. + Because both bpage and + prev_bpage are protected by + buf_pool_zip_mutex, it is + not necessary to acquire + further mutexes. */ + ut_ad(&buf_pool_zip_mutex + == block_mutex); + ut_ad(mutex_own(block_mutex)); + prev_bpage_buf_fix = TRUE; + prev_bpage->buf_fix_count++; + break; + default: + ut_error; + } + } + } else if (((buf_block_t*) bpage)->is_hashed) { ulint page_no; ulint zip_size; @@ -405,7 +451,8 @@ scan_again: buf_flush_remove(bpage); } - /* Remove from the LRU list */ + /* Remove from the LRU list. */ + if (buf_LRU_block_remove_hashed_page(bpage, TRUE) != BUF_BLOCK_ZIP_FREE) { buf_LRU_block_free_hashed_page((buf_block_t*) @@ -417,18 +464,27 @@ scan_again: ut_ad(block_mutex == &buf_pool_zip_mutex); ut_ad(!mutex_own(block_mutex)); - /* The compressed block descriptor - (bpage) has been deallocated and - block_mutex released. Also, - buf_buddy_free() may have relocated - prev_bpage. Rescan the LRU list. */ + if (prev_bpage_buf_fix) { + /* We temporarily buffer-fixed + prev_bpage, so that + buf_buddy_free() could not + relocate it, in case it was a + compressed-only block + descriptor. */ + + mutex_enter(block_mutex); + ut_ad(prev_bpage->buf_fix_count > 0); + prev_bpage->buf_fix_count--; + mutex_exit(block_mutex); + } - bpage = UT_LIST_GET_LAST(buf_pool->LRU); - continue; + goto next_page_no_mutex; } - } next_page: - mutex_exit(block_mutex); + mutex_exit(block_mutex); + } + +next_page_no_mutex: bpage = prev_bpage; } @@ -1474,26 +1530,8 @@ alloc: if (b->state == BUF_BLOCK_ZIP_PAGE) { buf_LRU_insert_zip_clean(b); } else { - buf_page_t* prev; - - ut_ad(b->in_flush_list); - ut_d(bpage->in_flush_list = FALSE); - - prev = UT_LIST_GET_PREV(list, b); - UT_LIST_REMOVE(list, buf_pool->flush_list, b); - - if (prev) { - ut_ad(prev->in_flush_list); - UT_LIST_INSERT_AFTER( - list, - buf_pool->flush_list, - prev, b); - } else { - UT_LIST_ADD_FIRST( - list, - buf_pool->flush_list, - b); - } + /* Relocate on buf_pool->flush_list. */ + buf_flush_relocate_on_flush_list(bpage, b); } bpage->zip.data = NULL; diff --git a/storage/innodb_plugin/buf/buf0rea.c b/storage/innodb_plugin/buf/buf0rea.c index dd98ea17eb5..81f788baac2 100644 --- a/storage/innodb_plugin/buf/buf0rea.c +++ b/storage/innodb_plugin/buf/buf0rea.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -608,14 +608,14 @@ buf_read_recv_pages( while (buf_pool->n_pend_reads >= recv_n_pool_free_frames / 2) { os_aio_simulated_wake_handler_threads(); - os_thread_sleep(500000); + os_thread_sleep(10000); count++; - if (count > 100) { + if (count > 1000) { fprintf(stderr, "InnoDB: Error: InnoDB has waited for" - " 50 seconds for pending\n" + " 10 seconds for pending\n" "InnoDB: reads to the buffer pool to" " be finished.\n" "InnoDB: Number of pending reads %lu," diff --git a/storage/innodb_plugin/data/data0data.c b/storage/innodb_plugin/data/data0data.c index e3c1f1b4f23..0715b49bf9c 100644 --- a/storage/innodb_plugin/data/data0data.c +++ b/storage/innodb_plugin/data/data0data.c @@ -666,6 +666,21 @@ dtuple_convert_big_rec( goto skip_field; } + /* In DYNAMIC and COMPRESSED format, store + locally any non-BLOB columns whose maximum + length does not exceed 256 bytes. This is + because there is no room for the "external + storage" flag when the maximum length is 255 + bytes or less. This restriction trivially + holds in REDUNDANT and COMPACT format, because + there we always store locally columns whose + length is up to local_len == 788 bytes. + @see rec_init_offsets_comp_ordinary */ + if (ifield->col->mtype != DATA_BLOB + && ifield->col->len < 256) { + goto skip_field; + } + longest_i = i; longest = savings; diff --git a/storage/innodb_plugin/dict/dict0boot.c b/storage/innodb_plugin/dict/dict0boot.c index e55de30481b..45d57b8c619 100644 --- a/storage/innodb_plugin/dict/dict0boot.c +++ b/storage/innodb_plugin/dict/dict0boot.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -274,6 +274,9 @@ dict_boot(void) and (TYPE & DICT_TF_FORMAT_MASK) are nonzero and TYPE = table->flags */ dict_mem_table_add_col(table, heap, "TYPE", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "MIX_ID", DATA_BINARY, 0, 0); + /* MIX_LEN may contain additional table flags when + ROW_FORMAT!=REDUNDANT. Currently, these flags include + DICT_TF2_TEMPORARY. */ dict_mem_table_add_col(table, heap, "MIX_LEN", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "CLUSTER_NAME", DATA_BINARY, 0, 0); dict_mem_table_add_col(table, heap, "SPACE", DATA_INT, 0, 4); @@ -355,7 +358,7 @@ dict_boot(void) dict_mem_table_add_col(table, heap, "SPACE", DATA_INT, 0, 4); dict_mem_table_add_col(table, heap, "PAGE_NO", DATA_INT, 0, 4); - /* The '+ 2' below comes from the 2 system fields */ + /* The '+ 2' below comes from the fields DB_TRX_ID, DB_ROLL_PTR */ #if DICT_SYS_INDEXES_PAGE_NO_FIELD != 6 + 2 #error "DICT_SYS_INDEXES_PAGE_NO_FIELD != 6 + 2" #endif @@ -365,6 +368,9 @@ dict_boot(void) #if DICT_SYS_INDEXES_TYPE_FIELD != 4 + 2 #error "DICT_SYS_INDEXES_TYPE_FIELD != 4 + 2" #endif +#if DICT_SYS_INDEXES_NAME_FIELD != 2 + 2 +#error "DICT_SYS_INDEXES_NAME_FIELD != 2 + 2" +#endif table->id = DICT_INDEXES_ID; dict_table_add_to_cache(table, heap); diff --git a/storage/innodb_plugin/dict/dict0crea.c b/storage/innodb_plugin/dict/dict0crea.c index 96a9bd8152e..653bff4bef6 100644 --- a/storage/innodb_plugin/dict/dict0crea.c +++ b/storage/innodb_plugin/dict/dict0crea.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -51,16 +51,18 @@ static dtuple_t* dict_create_sys_tables_tuple( /*=========================*/ - dict_table_t* table, /*!< in: table */ - mem_heap_t* heap) /*!< in: memory heap from which the memory for - the built tuple is allocated */ + const dict_table_t* table, /*!< in: table */ + mem_heap_t* heap) /*!< in: memory heap from + which the memory for the built + tuple is allocated */ { dict_table_t* sys_tables; dtuple_t* entry; dfield_t* dfield; byte* ptr; - ut_ad(table && heap); + ut_ad(table); + ut_ad(heap); sys_tables = dict_sys->sys_tables; @@ -69,18 +71,18 @@ dict_create_sys_tables_tuple( dict_table_copy_types(entry, sys_tables); /* 0: NAME -----------------------------*/ - dfield = dtuple_get_nth_field(entry, 0); + dfield = dtuple_get_nth_field(entry, 0/*NAME*/); dfield_set_data(dfield, table->name, ut_strlen(table->name)); /* 3: ID -------------------------------*/ - dfield = dtuple_get_nth_field(entry, 1); + dfield = dtuple_get_nth_field(entry, 1/*ID*/); ptr = mem_heap_alloc(heap, 8); mach_write_to_8(ptr, table->id); dfield_set_data(dfield, ptr, 8); /* 4: N_COLS ---------------------------*/ - dfield = dtuple_get_nth_field(entry, 2); + dfield = dtuple_get_nth_field(entry, 2/*N_COLS*/); #if DICT_TF_COMPACT != 1 #error @@ -91,40 +93,41 @@ dict_create_sys_tables_tuple( | ((table->flags & DICT_TF_COMPACT) << 31)); dfield_set_data(dfield, ptr, 4); /* 5: TYPE -----------------------------*/ - dfield = dtuple_get_nth_field(entry, 3); + dfield = dtuple_get_nth_field(entry, 3/*TYPE*/); ptr = mem_heap_alloc(heap, 4); - if (table->flags & ~DICT_TF_COMPACT) { + if (table->flags & (~DICT_TF_COMPACT & ~(~0 << DICT_TF_BITS))) { ut_a(table->flags & DICT_TF_COMPACT); ut_a(dict_table_get_format(table) >= DICT_TF_FORMAT_ZIP); ut_a((table->flags & DICT_TF_ZSSIZE_MASK) <= (DICT_TF_ZSSIZE_MAX << DICT_TF_ZSSIZE_SHIFT)); - ut_a(!(table->flags & (~0 << DICT_TF_BITS))); - mach_write_to_4(ptr, table->flags); + ut_a(!(table->flags & (~0 << DICT_TF2_BITS))); + mach_write_to_4(ptr, table->flags & ~(~0 << DICT_TF_BITS)); } else { mach_write_to_4(ptr, DICT_TABLE_ORDINARY); } dfield_set_data(dfield, ptr, 4); /* 6: MIX_ID (obsolete) ---------------------------*/ - dfield = dtuple_get_nth_field(entry, 4); + dfield = dtuple_get_nth_field(entry, 4/*MIX_ID*/); ptr = mem_heap_zalloc(heap, 8); dfield_set_data(dfield, ptr, 8); - /* 7: MIX_LEN (obsolete) --------------------------*/ + /* 7: MIX_LEN (additional flags) --------------------------*/ - dfield = dtuple_get_nth_field(entry, 5); + dfield = dtuple_get_nth_field(entry, 5/*MIX_LEN*/); - ptr = mem_heap_zalloc(heap, 4); + ptr = mem_heap_alloc(heap, 4); + mach_write_to_4(ptr, table->flags >> DICT_TF2_SHIFT); dfield_set_data(dfield, ptr, 4); /* 8: CLUSTER_NAME ---------------------*/ - dfield = dtuple_get_nth_field(entry, 6); + dfield = dtuple_get_nth_field(entry, 6/*CLUSTER_NAME*/); dfield_set_null(dfield); /* not supported */ /* 9: SPACE ----------------------------*/ - dfield = dtuple_get_nth_field(entry, 7); + dfield = dtuple_get_nth_field(entry, 7/*SPACE*/); ptr = mem_heap_alloc(heap, 4); mach_write_to_4(ptr, table->space); @@ -143,19 +146,21 @@ static dtuple_t* dict_create_sys_columns_tuple( /*==========================*/ - dict_table_t* table, /*!< in: table */ - ulint i, /*!< in: column number */ - mem_heap_t* heap) /*!< in: memory heap from which the memory for - the built tuple is allocated */ + const dict_table_t* table, /*!< in: table */ + ulint i, /*!< in: column number */ + mem_heap_t* heap) /*!< in: memory heap from + which the memory for the built + tuple is allocated */ { dict_table_t* sys_columns; dtuple_t* entry; const dict_col_t* column; dfield_t* dfield; byte* ptr; - const char* col_name; + const char* col_name; - ut_ad(table && heap); + ut_ad(table); + ut_ad(heap); column = dict_table_get_nth_col(table, i); @@ -166,47 +171,47 @@ dict_create_sys_columns_tuple( dict_table_copy_types(entry, sys_columns); /* 0: TABLE_ID -----------------------*/ - dfield = dtuple_get_nth_field(entry, 0); + dfield = dtuple_get_nth_field(entry, 0/*TABLE_ID*/); ptr = mem_heap_alloc(heap, 8); mach_write_to_8(ptr, table->id); dfield_set_data(dfield, ptr, 8); /* 1: POS ----------------------------*/ - dfield = dtuple_get_nth_field(entry, 1); + dfield = dtuple_get_nth_field(entry, 1/*POS*/); ptr = mem_heap_alloc(heap, 4); mach_write_to_4(ptr, i); dfield_set_data(dfield, ptr, 4); /* 4: NAME ---------------------------*/ - dfield = dtuple_get_nth_field(entry, 2); + dfield = dtuple_get_nth_field(entry, 2/*NAME*/); col_name = dict_table_get_col_name(table, i); dfield_set_data(dfield, col_name, ut_strlen(col_name)); /* 5: MTYPE --------------------------*/ - dfield = dtuple_get_nth_field(entry, 3); + dfield = dtuple_get_nth_field(entry, 3/*MTYPE*/); ptr = mem_heap_alloc(heap, 4); mach_write_to_4(ptr, column->mtype); dfield_set_data(dfield, ptr, 4); /* 6: PRTYPE -------------------------*/ - dfield = dtuple_get_nth_field(entry, 4); + dfield = dtuple_get_nth_field(entry, 4/*PRTYPE*/); ptr = mem_heap_alloc(heap, 4); mach_write_to_4(ptr, column->prtype); dfield_set_data(dfield, ptr, 4); /* 7: LEN ----------------------------*/ - dfield = dtuple_get_nth_field(entry, 5); + dfield = dtuple_get_nth_field(entry, 5/*LEN*/); ptr = mem_heap_alloc(heap, 4); mach_write_to_4(ptr, column->len); dfield_set_data(dfield, ptr, 4); /* 8: PREC ---------------------------*/ - dfield = dtuple_get_nth_field(entry, 6); + dfield = dtuple_get_nth_field(entry, 6/*PREC*/); ptr = mem_heap_alloc(heap, 4); mach_write_to_4(ptr, 0/* unused */); @@ -230,6 +235,7 @@ dict_build_table_def_step( dict_table_t* table; dtuple_t* row; ulint error; + ulint flags; const char* path_or_name; ibool is_path; mtr_t mtr; @@ -268,9 +274,10 @@ dict_build_table_def_step( ut_ad(!dict_table_zip_size(table) || dict_table_get_format(table) >= DICT_TF_FORMAT_ZIP); + flags = table->flags & ~(~0 << DICT_TF_BITS); error = fil_create_new_single_table_tablespace( &space, path_or_name, is_path, - table->flags == DICT_TF_COMPACT ? 0 : table->flags, + flags == DICT_TF_COMPACT ? 0 : flags, FIL_IBD_FILE_INITIAL_SIZE); table->space = (unsigned int) space; @@ -286,7 +293,7 @@ dict_build_table_def_step( mtr_commit(&mtr); } else { /* Create in the system tablespace: disallow new features */ - table->flags &= DICT_TF_COMPACT; + table->flags &= (~0 << DICT_TF_BITS) | DICT_TF_COMPACT; } row = dict_create_sys_tables_tuple(table, node->heap); @@ -322,9 +329,10 @@ static dtuple_t* dict_create_sys_indexes_tuple( /*==========================*/ - dict_index_t* index, /*!< in: index */ - mem_heap_t* heap) /*!< in: memory heap from which the memory for - the built tuple is allocated */ + const dict_index_t* index, /*!< in: index */ + mem_heap_t* heap) /*!< in: memory heap from + which the memory for the built + tuple is allocated */ { dict_table_t* sys_indexes; dict_table_t* table; @@ -333,7 +341,8 @@ dict_create_sys_indexes_tuple( byte* ptr; ut_ad(mutex_own(&(dict_sys->mutex))); - ut_ad(index && heap); + ut_ad(index); + ut_ad(heap); sys_indexes = dict_sys->sys_indexes; @@ -344,32 +353,32 @@ dict_create_sys_indexes_tuple( dict_table_copy_types(entry, sys_indexes); /* 0: TABLE_ID -----------------------*/ - dfield = dtuple_get_nth_field(entry, 0); + dfield = dtuple_get_nth_field(entry, 0/*TABLE_ID*/); ptr = mem_heap_alloc(heap, 8); mach_write_to_8(ptr, table->id); dfield_set_data(dfield, ptr, 8); /* 1: ID ----------------------------*/ - dfield = dtuple_get_nth_field(entry, 1); + dfield = dtuple_get_nth_field(entry, 1/*ID*/); ptr = mem_heap_alloc(heap, 8); mach_write_to_8(ptr, index->id); dfield_set_data(dfield, ptr, 8); /* 4: NAME --------------------------*/ - dfield = dtuple_get_nth_field(entry, 2); + dfield = dtuple_get_nth_field(entry, 2/*NAME*/); dfield_set_data(dfield, index->name, ut_strlen(index->name)); /* 5: N_FIELDS ----------------------*/ - dfield = dtuple_get_nth_field(entry, 3); + dfield = dtuple_get_nth_field(entry, 3/*N_FIELDS*/); ptr = mem_heap_alloc(heap, 4); mach_write_to_4(ptr, index->n_fields); dfield_set_data(dfield, ptr, 4); /* 6: TYPE --------------------------*/ - dfield = dtuple_get_nth_field(entry, 4); + dfield = dtuple_get_nth_field(entry, 4/*TYPE*/); ptr = mem_heap_alloc(heap, 4); mach_write_to_4(ptr, index->type); @@ -381,7 +390,7 @@ dict_create_sys_indexes_tuple( #error "DICT_SYS_INDEXES_SPACE_NO_FIELD != 7" #endif - dfield = dtuple_get_nth_field(entry, 5); + dfield = dtuple_get_nth_field(entry, 5/*SPACE*/); ptr = mem_heap_alloc(heap, 4); mach_write_to_4(ptr, index->space); @@ -393,7 +402,7 @@ dict_create_sys_indexes_tuple( #error "DICT_SYS_INDEXES_PAGE_NO_FIELD != 8" #endif - dfield = dtuple_get_nth_field(entry, 6); + dfield = dtuple_get_nth_field(entry, 6/*PAGE_NO*/); ptr = mem_heap_alloc(heap, 4); mach_write_to_4(ptr, FIL_NULL); @@ -412,10 +421,11 @@ static dtuple_t* dict_create_sys_fields_tuple( /*=========================*/ - dict_index_t* index, /*!< in: index */ - ulint i, /*!< in: field number */ - mem_heap_t* heap) /*!< in: memory heap from which the memory for - the built tuple is allocated */ + const dict_index_t* index, /*!< in: index */ + ulint i, /*!< in: field number */ + mem_heap_t* heap) /*!< in: memory heap from + which the memory for the built + tuple is allocated */ { dict_table_t* sys_fields; dtuple_t* entry; @@ -425,7 +435,8 @@ dict_create_sys_fields_tuple( ibool index_contains_column_prefix_field = FALSE; ulint j; - ut_ad(index && heap); + ut_ad(index); + ut_ad(heap); for (j = 0; j < index->n_fields; j++) { if (dict_index_get_nth_field(index, j)->prefix_len > 0) { @@ -443,7 +454,7 @@ dict_create_sys_fields_tuple( dict_table_copy_types(entry, sys_fields); /* 0: INDEX_ID -----------------------*/ - dfield = dtuple_get_nth_field(entry, 0); + dfield = dtuple_get_nth_field(entry, 0/*INDEX_ID*/); ptr = mem_heap_alloc(heap, 8); mach_write_to_8(ptr, index->id); @@ -451,7 +462,7 @@ dict_create_sys_fields_tuple( dfield_set_data(dfield, ptr, 8); /* 1: POS + PREFIX LENGTH ----------------------------*/ - dfield = dtuple_get_nth_field(entry, 1); + dfield = dtuple_get_nth_field(entry, 1/*POS*/); ptr = mem_heap_alloc(heap, 4); @@ -471,7 +482,7 @@ dict_create_sys_fields_tuple( dfield_set_data(dfield, ptr, 4); /* 4: COL_NAME -------------------------*/ - dfield = dtuple_get_nth_field(entry, 2); + dfield = dtuple_get_nth_field(entry, 2/*COL_NAME*/); dfield_set_data(dfield, field->name, ut_strlen(field->name)); @@ -602,6 +613,7 @@ dict_create_index_tree_step( dict_table_t* sys_indexes; dict_table_t* table; dtuple_t* search_tuple; + ulint zip_size; btr_pcur_t pcur; mtr_t mtr; @@ -626,8 +638,9 @@ dict_create_index_tree_step( btr_pcur_move_to_next_user_rec(&pcur, &mtr); - node->page_no = btr_create(index->type, index->space, - dict_table_zip_size(index->table), + zip_size = dict_table_zip_size(index->table); + + node->page_no = btr_create(index->type, index->space, zip_size, index->id, index, &mtr); /* printf("Created a new index tree in space %lu root page %lu\n", index->space, index->page_no); */ @@ -1092,8 +1105,11 @@ dict_create_index_step( dulint index_id = node->index->id; - err = dict_index_add_to_cache(node->table, node->index, - FIL_NULL, TRUE); + err = dict_index_add_to_cache( + node->table, node->index, FIL_NULL, + trx_is_strict(trx) + || dict_table_get_format(node->table) + >= DICT_TF_FORMAT_ZIP); node->index = dict_index_get_if_in_cache_low(index_id); ut_a(!node->index == (err != DB_SUCCESS)); diff --git a/storage/innodb_plugin/dict/dict0dict.c b/storage/innodb_plugin/dict/dict0dict.c index 2e524a5a2e3..83438231689 100644 --- a/storage/innodb_plugin/dict/dict0dict.c +++ b/storage/innodb_plugin/dict/dict0dict.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -80,6 +80,10 @@ UNIV_INTERN rw_lock_t dict_operation_lock; /** Identifies generated InnoDB foreign key names */ static char dict_ibfk[] = "_ibfk_"; +/** array of mutexes protecting dict_index_t::stat_n_diff_key_vals[] */ +#define DICT_INDEX_STAT_MUTEX_SIZE 32 +mutex_t dict_index_stat_mutex[DICT_INDEX_STAT_MUTEX_SIZE]; + /*******************************************************************//** Tries to find column names for the index and sets the col field of the index. @@ -140,7 +144,7 @@ static void dict_field_print_low( /*=================*/ - dict_field_t* field); /*!< in: field */ + const dict_field_t* field); /*!< in: field */ /*********************************************************************//** Frees a foreign key struct. */ static @@ -239,6 +243,45 @@ dict_mutex_exit_for_mysql(void) mutex_exit(&(dict_sys->mutex)); } +/** Get the mutex that protects index->stat_n_diff_key_vals[] */ +#define GET_INDEX_STAT_MUTEX(index) \ + (&dict_index_stat_mutex[ut_fold_dulint(index->id) \ + % DICT_INDEX_STAT_MUTEX_SIZE]) + +/**********************************************************************//** +Lock the appropriate mutex to protect index->stat_n_diff_key_vals[]. +index->id is used to pick the right mutex and it should not change +before dict_index_stat_mutex_exit() is called on this index. */ +UNIV_INTERN +void +dict_index_stat_mutex_enter( +/*========================*/ + const dict_index_t* index) /*!< in: index */ +{ + ut_ad(index != NULL); + ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); + ut_ad(index->cached); + ut_ad(!index->to_be_dropped); + + mutex_enter(GET_INDEX_STAT_MUTEX(index)); +} + +/**********************************************************************//** +Unlock the appropriate mutex that protects index->stat_n_diff_key_vals[]. */ +UNIV_INTERN +void +dict_index_stat_mutex_exit( +/*=======================*/ + const dict_index_t* index) /*!< in: index */ +{ + ut_ad(index != NULL); + ut_ad(index->magic_n == DICT_INDEX_MAGIC_N); + ut_ad(index->cached); + ut_ad(!index->to_be_dropped); + + mutex_exit(GET_INDEX_STAT_MUTEX(index)); +} + /********************************************************************//** Decrements the count of open MySQL handles to a table. */ UNIV_INTERN @@ -605,6 +648,8 @@ void dict_init(void) /*===========*/ { + int i; + dict_sys = mem_alloc(sizeof(dict_sys_t)); mutex_create(&dict_sys->mutex, SYNC_DICT); @@ -625,6 +670,10 @@ dict_init(void) ut_a(dict_foreign_err_file); mutex_create(&dict_foreign_err_mutex, SYNC_ANY_LATCH); + + for (i = 0; i < DICT_INDEX_STAT_MUTEX_SIZE; i++) { + mutex_create(&dict_index_stat_mutex[i], SYNC_INDEX_TREE); + } } /**********************************************************************//** @@ -1460,6 +1509,7 @@ dict_index_add_to_cache( if (!dict_index_find_cols(table, index)) { + dict_mem_index_free(index); return(DB_CORRUPTION); } @@ -4170,9 +4220,13 @@ dict_update_statistics_low( index = dict_table_get_first_index(table); + dict_index_stat_mutex_enter(index); + table->stat_n_rows = index->stat_n_diff_key_vals[ dict_index_get_n_unique(index)]; + dict_index_stat_mutex_exit(index); + table->stat_clustered_index_size = index->stat_index_size; table->stat_sum_of_other_index_sizes = sum_of_index_sizes @@ -4350,6 +4404,8 @@ dict_index_print_low( ut_ad(mutex_own(&(dict_sys->mutex))); + dict_index_stat_mutex_enter(index); + if (index->n_user_defined_cols > 0) { n_vals = index->stat_n_diff_key_vals[ index->n_user_defined_cols]; @@ -4357,6 +4413,8 @@ dict_index_print_low( n_vals = index->stat_n_diff_key_vals[1]; } + dict_index_stat_mutex_exit(index); + if (dict_index_is_clust(index)) { type_string = "clustered index"; } else if (dict_index_is_unique(index)) { @@ -4402,7 +4460,7 @@ static void dict_field_print_low( /*=================*/ - dict_field_t* field) /*!< in: field */ + const dict_field_t* field) /*!< in: field */ { ut_ad(mutex_own(&(dict_sys->mutex))); @@ -4766,8 +4824,10 @@ UNIV_INTERN void dict_table_check_for_dup_indexes( /*=============================*/ - const dict_table_t* table) /*!< in: Check for dup indexes + const dict_table_t* table, /*!< in: Check for dup indexes in this table */ + ibool tmp_ok) /*!< in: TRUE=allow temporary + index names */ { /* Check for duplicates, ignoring indexes that are marked as to be dropped */ @@ -4775,13 +4835,17 @@ dict_table_check_for_dup_indexes( const dict_index_t* index1; const dict_index_t* index2; + ut_ad(mutex_own(&dict_sys->mutex)); + /* The primary index _must_ exist */ ut_a(UT_LIST_GET_LEN(table->indexes) > 0); index1 = UT_LIST_GET_FIRST(table->indexes); - index2 = UT_LIST_GET_NEXT(indexes, index1); - while (index1 && index2) { + do { + ut_ad(tmp_ok || *index1->name != TEMP_INDEX_PREFIX); + + index2 = UT_LIST_GET_NEXT(indexes, index1); while (index2) { @@ -4793,8 +4857,7 @@ dict_table_check_for_dup_indexes( } index1 = UT_LIST_GET_NEXT(indexes, index1); - index2 = UT_LIST_GET_NEXT(indexes, index1); - } + } while (index1); } #endif /* UNIV_DEBUG */ @@ -4847,5 +4910,9 @@ dict_close(void) mem_free(dict_sys); dict_sys = NULL; + + for (i = 0; i < DICT_INDEX_STAT_MUTEX_SIZE; i++) { + mutex_free(&dict_index_stat_mutex[i]); + } } #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innodb_plugin/dict/dict0load.c b/storage/innodb_plugin/dict/dict0load.c index 842a129c1a6..377818308c5 100644 --- a/storage/innodb_plugin/dict/dict0load.c +++ b/storage/innodb_plugin/dict/dict0load.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -260,7 +260,7 @@ dict_sys_tables_get_flags( return(0); } - field = rec_get_nth_field_old(rec, 4, &len); + field = rec_get_nth_field_old(rec, 4/*N_COLS*/, &len); n_cols = mach_read_from_4(field); if (UNIV_UNLIKELY(!(n_cols & 0x80000000UL))) { @@ -390,15 +390,35 @@ loop: mtr_commit(&mtr); - if (space_id != 0 && in_crash_recovery) { + if (space_id == 0) { + /* The system tablespace always exists. */ + } else if (in_crash_recovery) { /* Check that the tablespace (the .ibd file) really - exists; print a warning to the .err log if not */ - - fil_space_for_table_exists_in_mem(space_id, name, - FALSE, TRUE, TRUE); - } + exists; print a warning to the .err log if not. + Do not print warnings for temporary tables. */ + ibool is_temp; + + field = rec_get_nth_field_old(rec, 4, &len); + if (0x80000000UL & mach_read_from_4(field)) { + /* ROW_FORMAT=COMPACT: read the is_temp + flag from SYS_TABLES.MIX_LEN. */ + field = rec_get_nth_field_old(rec, 7, &len); + is_temp = mach_read_from_4(field) + & DICT_TF2_TEMPORARY; + } else { + /* For tables created with old versions + of InnoDB, SYS_TABLES.MIX_LEN may contain + garbage. Such tables would always be + in ROW_FORMAT=REDUNDANT. Pretend that + all such tables are non-temporary. That is, + do not suppress error printouts about + temporary tables not being found. */ + is_temp = FALSE; + } - if (space_id != 0 && !in_crash_recovery) { + fil_space_for_table_exists_in_mem( + space_id, name, is_temp, TRUE, !is_temp); + } else { /* It is a normal database startup: create the space object and check that the .ibd file exists. */ @@ -894,43 +914,72 @@ err_exit: (ulong) flags); goto err_exit; } + } else { + flags = 0; + } - if (fil_space_for_table_exists_in_mem(space, name, FALSE, - FALSE, FALSE)) { - /* Ok; (if we did a crash recovery then the tablespace - can already be in the memory cache) */ - } else { - /* In >= 4.1.9, InnoDB scans the data dictionary also - at a normal mysqld startup. It is an error if the - space object does not exist in memory. */ + ut_a(name_of_col_is(sys_tables, sys_index, 4, "N_COLS")); + field = rec_get_nth_field_old(rec, 4, &len); + n_cols = mach_read_from_4(field); + + /* The high-order bit of N_COLS is the "compact format" flag. + For tables in that format, MIX_LEN may hold additional flags. */ + if (n_cols & 0x80000000UL) { + ulint flags2; + + flags |= DICT_TF_COMPACT; + + ut_a(name_of_col_is(sys_tables, sys_index, 7, "MIX_LEN")); + field = rec_get_nth_field_old(rec, 7, &len); + + flags2 = mach_read_from_4(field); + + if (flags2 & (~0 << (DICT_TF2_BITS - DICT_TF2_SHIFT))) { + ut_print_timestamp(stderr); + fputs(" InnoDB: Warning: table ", stderr); + ut_print_filename(stderr, name); + fprintf(stderr, "\n" + "InnoDB: in InnoDB data dictionary" + " has unknown flags %lx.\n", + (ulong) flags2); + + flags2 &= ~(~0 << (DICT_TF2_BITS - DICT_TF2_SHIFT)); + } + + flags |= flags2 << DICT_TF2_SHIFT; + } + + /* See if the tablespace is available. */ + if (space == 0) { + /* The system tablespace is always available. */ + } else if (!fil_space_for_table_exists_in_mem( + space, name, + (flags >> DICT_TF2_SHIFT) & DICT_TF2_TEMPORARY, + FALSE, FALSE)) { + + if ((flags >> DICT_TF2_SHIFT) & DICT_TF2_TEMPORARY) { + /* Do not bother to retry opening temporary tables. */ + ibd_file_missing = TRUE; + } else { ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB: error: space object of table %s,\n" + " InnoDB: error: space object of table"); + ut_print_filename(stderr, name); + fprintf(stderr, ",\n" "InnoDB: space id %lu did not exist in memory." " Retrying an open.\n", - name, (ulong)space); + (ulong) space); /* Try to open the tablespace */ if (!fil_open_single_table_tablespace( - TRUE, space, flags, name)) { - /* We failed to find a sensible tablespace - file */ + TRUE, space, + flags & ~(~0 << DICT_TF_BITS), name)) { + /* We failed to find a sensible + tablespace file */ ibd_file_missing = TRUE; } } - } else { - flags = 0; - } - - ut_a(name_of_col_is(sys_tables, sys_index, 4, "N_COLS")); - - field = rec_get_nth_field_old(rec, 4, &len); - n_cols = mach_read_from_4(field); - - /* The high-order bit of N_COLS is the "compact format" flag. */ - if (n_cols & 0x80000000UL) { - flags |= DICT_TF_COMPACT; } table = dict_mem_table_create(name, space, n_cols & ~0x80000000UL, diff --git a/storage/innodb_plugin/dict/dict0mem.c b/storage/innodb_plugin/dict/dict0mem.c index 6458cbab92d..66b4b43f296 100644 --- a/storage/innodb_plugin/dict/dict0mem.c +++ b/storage/innodb_plugin/dict/dict0mem.c @@ -59,7 +59,7 @@ dict_mem_table_create( mem_heap_t* heap; ut_ad(name); - ut_a(!(flags & (~0 << DICT_TF_BITS))); + ut_a(!(flags & (~0 << DICT_TF2_BITS))); heap = mem_heap_create(DICT_HEAP_SIZE); diff --git a/storage/innodb_plugin/fil/fil0fil.c b/storage/innodb_plugin/fil/fil0fil.c index 112a0e27d50..963e306c00c 100644 --- a/storage/innodb_plugin/fil/fil0fil.c +++ b/storage/innodb_plugin/fil/fil0fil.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -38,6 +38,7 @@ Created 10/25/1995 Heikki Tuuri #include "mtr0mtr.h" #include "mtr0log.h" #include "dict0dict.h" +#include "page0page.h" #include "page0zip.h" #ifndef UNIV_HOTBACKUP # include "buf0lru.h" @@ -1097,10 +1098,13 @@ fil_space_create( fil_space_t* space; /* The tablespace flags (FSP_SPACE_FLAGS) should be 0 for - ROW_FORMAT=COMPACT (table->flags == DICT_TF_COMPACT) and + ROW_FORMAT=COMPACT + ((table->flags & ~(~0 << DICT_TF_BITS)) == DICT_TF_COMPACT) and ROW_FORMAT=REDUNDANT (table->flags == 0). For any other - format, the tablespace flags should equal table->flags. */ + format, the tablespace flags should equal + (table->flags & ~(~0 << DICT_TF_BITS)). */ ut_a(flags != DICT_TF_COMPACT); + ut_a(!(flags & (~0UL << DICT_TF_BITS))); try_again: /*printf( @@ -2582,10 +2586,13 @@ fil_create_new_single_table_tablespace( ut_a(size >= FIL_IBD_FILE_INITIAL_SIZE); /* The tablespace flags (FSP_SPACE_FLAGS) should be 0 for - ROW_FORMAT=COMPACT (table->flags == DICT_TF_COMPACT) and + ROW_FORMAT=COMPACT + ((table->flags & ~(~0 << DICT_TF_BITS)) == DICT_TF_COMPACT) and ROW_FORMAT=REDUNDANT (table->flags == 0). For any other - format, the tablespace flags should equal table->flags. */ + format, the tablespace flags should equal + (table->flags & ~(~0 << DICT_TF_BITS)). */ ut_a(flags != DICT_TF_COMPACT); + ut_a(!(flags & (~0UL << DICT_TF_BITS))); path = fil_make_ibd_name(tablename, is_temp); @@ -2786,6 +2793,7 @@ fil_reset_too_high_lsns( ib_int64_t offset; ulint zip_size; ibool success; + page_zip_des_t page_zip; filepath = fil_make_ibd_name(name, FALSE); @@ -2833,6 +2841,12 @@ fil_reset_too_high_lsns( space_id = fsp_header_get_space_id(page); zip_size = fsp_header_get_zip_size(page); + page_zip_des_init(&page_zip); + page_zip_set_size(&page_zip, zip_size); + if (zip_size) { + page_zip.data = page + UNIV_PAGE_SIZE; + } + ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Flush lsn in the tablespace file %lu" @@ -2867,20 +2881,23 @@ fil_reset_too_high_lsns( /* We have to reset the lsn */ if (zip_size) { - memcpy(page + UNIV_PAGE_SIZE, page, zip_size); + memcpy(page_zip.data, page, zip_size); buf_flush_init_for_writing( - page, page + UNIV_PAGE_SIZE, - current_lsn); + page, &page_zip, current_lsn); + success = os_file_write( + filepath, file, page_zip.data, + (ulint) offset & 0xFFFFFFFFUL, + (ulint) (offset >> 32), zip_size); } else { buf_flush_init_for_writing( page, NULL, current_lsn); + success = os_file_write( + filepath, file, page, + (ulint)(offset & 0xFFFFFFFFUL), + (ulint)(offset >> 32), + UNIV_PAGE_SIZE); } - success = os_file_write(filepath, file, page, - (ulint)(offset & 0xFFFFFFFFUL), - (ulint)(offset >> 32), - zip_size - ? zip_size - : UNIV_PAGE_SIZE); + if (!success) { goto func_exit; @@ -2956,10 +2973,13 @@ fil_open_single_table_tablespace( filepath = fil_make_ibd_name(name, FALSE); /* The tablespace flags (FSP_SPACE_FLAGS) should be 0 for - ROW_FORMAT=COMPACT (table->flags == DICT_TF_COMPACT) and + ROW_FORMAT=COMPACT + ((table->flags & ~(~0 << DICT_TF_BITS)) == DICT_TF_COMPACT) and ROW_FORMAT=REDUNDANT (table->flags == 0). For any other - format, the tablespace flags should equal table->flags. */ + format, the tablespace flags should equal + (table->flags & ~(~0 << DICT_TF_BITS)). */ ut_a(flags != DICT_TF_COMPACT); + ut_a(!(flags & (~0UL << DICT_TF_BITS))); file = os_file_create_simple_no_error_handling( filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success); @@ -3011,7 +3031,8 @@ fil_open_single_table_tablespace( ut_free(buf2); - if (UNIV_UNLIKELY(space_id != id || space_flags != flags)) { + if (UNIV_UNLIKELY(space_id != id + || space_flags != (flags & ~(~0 << DICT_TF_BITS)))) { ut_print_timestamp(stderr); fputs(" InnoDB: Error: tablespace id and flags in file ", @@ -4781,8 +4802,10 @@ void fil_close(void) /*===========*/ { +#ifndef UNIV_HOTBACKUP /* The mutex should already have been freed. */ ut_ad(fil_system->mutex.magic_n == 0); +#endif /* !UNIV_HOTBACKUP */ hash_table_free(fil_system->spaces); diff --git a/storage/innodb_plugin/fsp/fsp0fsp.c b/storage/innodb_plugin/fsp/fsp0fsp.c index 3cc4318fc06..c7f1a299d8a 100644 --- a/storage/innodb_plugin/fsp/fsp0fsp.c +++ b/storage/innodb_plugin/fsp/fsp0fsp.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -386,11 +386,11 @@ UNIV_INLINE ibool xdes_get_bit( /*=========*/ - xdes_t* descr, /*!< in: descriptor */ - ulint bit, /*!< in: XDES_FREE_BIT or XDES_CLEAN_BIT */ - ulint offset, /*!< in: page offset within extent: - 0 ... FSP_EXTENT_SIZE - 1 */ - mtr_t* mtr) /*!< in: mtr */ + const xdes_t* descr, /*!< in: descriptor */ + ulint bit, /*!< in: XDES_FREE_BIT or XDES_CLEAN_BIT */ + ulint offset, /*!< in: page offset within extent: + 0 ... FSP_EXTENT_SIZE - 1 */ + mtr_t* mtr) /*!< in: mtr */ { ulint index; ulint byte_index; @@ -527,8 +527,8 @@ UNIV_INLINE ulint xdes_get_n_used( /*============*/ - xdes_t* descr, /*!< in: descriptor */ - mtr_t* mtr) /*!< in: mtr */ + const xdes_t* descr, /*!< in: descriptor */ + mtr_t* mtr) /*!< in: mtr */ { ulint i; ulint count = 0; @@ -551,8 +551,8 @@ UNIV_INLINE ibool xdes_is_free( /*=========*/ - xdes_t* descr, /*!< in: descriptor */ - mtr_t* mtr) /*!< in: mtr */ + const xdes_t* descr, /*!< in: descriptor */ + mtr_t* mtr) /*!< in: mtr */ { if (0 == xdes_get_n_used(descr, mtr)) { @@ -569,8 +569,8 @@ UNIV_INLINE ibool xdes_is_full( /*=========*/ - xdes_t* descr, /*!< in: descriptor */ - mtr_t* mtr) /*!< in: mtr */ + const xdes_t* descr, /*!< in: descriptor */ + mtr_t* mtr) /*!< in: mtr */ { if (FSP_EXTENT_SIZE == xdes_get_n_used(descr, mtr)) { @@ -586,7 +586,7 @@ UNIV_INLINE void xdes_set_state( /*===========*/ - xdes_t* descr, /*!< in: descriptor */ + xdes_t* descr, /*!< in/out: descriptor */ ulint state, /*!< in: state to set */ mtr_t* mtr) /*!< in: mtr handle */ { @@ -605,8 +605,8 @@ UNIV_INLINE ulint xdes_get_state( /*===========*/ - xdes_t* descr, /*!< in: descriptor */ - mtr_t* mtr) /*!< in: mtr handle */ + const xdes_t* descr, /*!< in: descriptor */ + mtr_t* mtr) /*!< in: mtr handle */ { ulint state; @@ -705,7 +705,7 @@ UNIV_INLINE xdes_t* xdes_get_descriptor_with_space_hdr( /*===============================*/ - fsp_header_t* sp_header,/*!< in: space header, x-latched */ + fsp_header_t* sp_header,/*!< in/out: space header, x-latched */ ulint space, /*!< in: space id */ ulint offset, /*!< in: page offset; if equal to the free limit, @@ -869,9 +869,7 @@ fsp_init_file_page_low( return; } -#ifdef UNIV_BASIC_LOG_DEBUG - memset(page, 0xff, UNIV_PAGE_SIZE); -#endif + UNIV_MEM_INVALID(page, UNIV_PAGE_SIZE); mach_write_to_4(page + FIL_PAGE_OFFSET, buf_block_get_page_no(block)); memset(page + FIL_PAGE_LSN, 0, 8); mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, @@ -1342,7 +1340,7 @@ fsp_fill_free_list( descriptor page and ibuf bitmap page; then we do not allocate more extents */ ulint space, /*!< in: space */ - fsp_header_t* header, /*!< in: space header */ + fsp_header_t* header, /*!< in/out: space header */ mtr_t* mtr) /*!< in: mtr */ { ulint limit; diff --git a/storage/innodb_plugin/ha/ha0ha.c b/storage/innodb_plugin/ha/ha0ha.c index cb5e541b55d..9d9d341ad39 100644 --- a/storage/innodb_plugin/ha/ha0ha.c +++ b/storage/innodb_plugin/ha/ha0ha.c @@ -101,6 +101,8 @@ ha_clear( ulint i; ulint n; + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); #ifdef UNIV_SYNC_DEBUG ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EXCLUSIVE)); #endif /* UNIV_SYNC_DEBUG */ @@ -146,7 +148,9 @@ ha_insert_for_fold_func( ha_node_t* prev_node; ulint hash; - ut_ad(table && data); + ut_ad(data); + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG ut_a(block->frame == page_align(data)); #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ @@ -237,6 +241,8 @@ ha_delete_hash_node( hash_table_t* table, /*!< in: hash table */ ha_node_t* del_node) /*!< in: node to be deleted */ { + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG # ifndef UNIV_HOTBACKUP if (table->adaptive) { @@ -267,6 +273,8 @@ ha_search_and_update_if_found_func( { ha_node_t* node; + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); ASSERT_HASH_MUTEX_OWN(table, fold); #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG ut_a(new_block->frame == page_align(new_data)); @@ -304,6 +312,8 @@ ha_remove_all_nodes_to_page( { ha_node_t* node; + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); ASSERT_HASH_MUTEX_OWN(table, fold); node = ha_chain_get_first(table, fold); @@ -353,6 +363,8 @@ ha_validate( ibool ok = TRUE; ulint i; + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); ut_a(start_index <= end_index); ut_a(start_index < hash_get_n_cells(table)); ut_a(end_index < hash_get_n_cells(table)); @@ -404,6 +416,8 @@ builds, see http://bugs.mysql.com/36941 */ #endif /* PRINT_USED_CELLS */ ulint n_bufs; + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); #ifdef PRINT_USED_CELLS for (i = 0; i < hash_get_n_cells(table); i++) { diff --git a/storage/innodb_plugin/ha/hash0hash.c b/storage/innodb_plugin/ha/hash0hash.c index 2800d7793f8..30c304dafcd 100644 --- a/storage/innodb_plugin/ha/hash0hash.c +++ b/storage/innodb_plugin/ha/hash0hash.c @@ -119,7 +119,7 @@ hash_create( table->heaps = NULL; #endif /* !UNIV_HOTBACKUP */ table->heap = NULL; - table->magic_n = HASH_TABLE_MAGIC_N; + ut_d(table->magic_n = HASH_TABLE_MAGIC_N); /* Initialize the cell array */ hash_table_clear(table); @@ -135,6 +135,8 @@ hash_table_free( /*============*/ hash_table_t* table) /*!< in, own: hash table */ { + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); #ifndef UNIV_HOTBACKUP ut_a(table->mutexes == NULL); #endif /* !UNIV_HOTBACKUP */ @@ -160,6 +162,8 @@ hash_create_mutexes_func( { ulint i; + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); ut_a(n_mutexes > 0); ut_a(ut_is_2pow(n_mutexes)); diff --git a/storage/innodb_plugin/handler/ha_innodb.cc b/storage/innodb_plugin/handler/ha_innodb.cc index 47b8203091c..0fc6e786f4c 100644 --- a/storage/innodb_plugin/handler/ha_innodb.cc +++ b/storage/innodb_plugin/handler/ha_innodb.cc @@ -1,7 +1,8 @@ /***************************************************************************** -Copyright (c) 2000, 2009, MySQL AB & Innobase Oy. All Rights Reserved. +Copyright (c) 2000, 2010, MySQL AB & Innobase Oy. All Rights Reserved. Copyright (c) 2008, 2009 Google Inc. +Copyright (c) 2009, Percona Inc. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -9,6 +10,13 @@ briefly in the InnoDB documentation. The contributions by Google are incorporated with their permission, and subject to the conditions contained in the file COPYING.Google. +Portions of this file contain modifications contributed and copyrighted +by Percona Inc.. Those modifications are +gratefully acknowledged and are described briefly in the InnoDB +documentation. The contributions by Percona Inc. are incorporated with +their permission, and subject to the conditions contained in the file +COPYING.Percona. + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. @@ -22,32 +30,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ -/*********************************************************************** - -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. -Copyright (c) 2009, Percona Inc. - -Portions of this file contain modifications contributed and copyrighted -by Percona Inc.. Those modifications are -gratefully acknowledged and are described briefly in the InnoDB -documentation. The contributions by Percona Inc. are incorporated with -their permission, and subject to the conditions contained in the file -COPYING.Percona. - -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -***********************************************************************/ /* TODO list for the InnoDB handler in 5.0: - Remove the flag trx->active_trans and look at trx->conc_state @@ -126,7 +108,6 @@ static ulong commit_threads = 0; static pthread_mutex_t commit_threads_m; static pthread_cond_t commit_cond; static pthread_mutex_t commit_cond_m; -static pthread_mutex_t analyze_mutex; static bool innodb_inited = 0; #define INSIDE_HA_INNOBASE_CC @@ -334,7 +315,7 @@ static MYSQL_THDVAR_ULONG(lock_wait_timeout, PLUGIN_VAR_RQCMDARG, static handler *innobase_create_handler(handlerton *hton, - TABLE_SHARE *table, + TABLE_SHARE *table, MEM_ROOT *mem_root) { return new (mem_root) ha_innobase(hton, table); @@ -447,8 +428,9 @@ static int innobase_start_trx_and_assign_read_view( /*====================================*/ - handlerton* hton, /*!< in: Innodb handlerton */ - THD* thd); /*!< in: MySQL thread handle of the user for whom + /* out: 0 */ + handlerton* hton, /* in: Innodb handlerton */ + THD* thd); /* in: MySQL thread handle of the user for whom the transaction should be committed */ /****************************************************************//** Flushes InnoDB logs to disk and makes a checkpoint. Really, a commit flushes @@ -1833,6 +1815,19 @@ trx_is_interrupted( return(trx && trx->mysql_thd && thd_killed((THD*) trx->mysql_thd)); } +/**********************************************************************//** +Determines if the currently running transaction is in strict mode. +@return TRUE if strict */ +extern "C" UNIV_INTERN +ibool +trx_is_strict( +/*==========*/ + trx_t* trx) /*!< in: transaction */ +{ + return(trx && trx->mysql_thd + && THDVAR((THD*) trx->mysql_thd, strict_mode)); +} + /**************************************************************//** Resets some fields of a prebuilt struct. The template is used in fast retrieval of just those column values MySQL needs in its processing. */ @@ -2152,7 +2147,7 @@ mem_free_and_error: } sql_print_error("InnoDB: invalid value " - "innodb_file_format_check=%s", + "innodb_change_buffering=%s", innobase_change_buffering); goto mem_free_and_error; } @@ -2241,7 +2236,6 @@ innobase_change_buffering_inited_ok: pthread_mutex_init(&prepare_commit_mutex, MY_MUTEX_INIT_FAST); pthread_mutex_init(&commit_threads_m, MY_MUTEX_INIT_FAST); pthread_mutex_init(&commit_cond_m, MY_MUTEX_INIT_FAST); - pthread_mutex_init(&analyze_mutex, MY_MUTEX_INIT_FAST); pthread_cond_init(&commit_cond, NULL); innodb_inited= 1; #ifdef MYSQL_DYNAMIC_PLUGIN @@ -2296,7 +2290,6 @@ innobase_end( pthread_mutex_destroy(&prepare_commit_mutex); pthread_mutex_destroy(&commit_threads_m); pthread_mutex_destroy(&commit_cond_m); - pthread_mutex_destroy(&analyze_mutex); pthread_cond_destroy(&commit_cond); } @@ -3006,59 +2999,370 @@ normalize_table_name( } /********************************************************************//** +Get the upper limit of the MySQL integral and floating-point type. +@return maximum allowed value for the field */ +static +ulonglong +innobase_get_int_col_max_value( +/*===========================*/ + const Field* field) /*!< in: MySQL field */ +{ + ulonglong max_value = 0; + + switch(field->key_type()) { + /* TINY */ + case HA_KEYTYPE_BINARY: + max_value = 0xFFULL; + break; + case HA_KEYTYPE_INT8: + max_value = 0x7FULL; + break; + /* SHORT */ + case HA_KEYTYPE_USHORT_INT: + max_value = 0xFFFFULL; + break; + case HA_KEYTYPE_SHORT_INT: + max_value = 0x7FFFULL; + break; + /* MEDIUM */ + case HA_KEYTYPE_UINT24: + max_value = 0xFFFFFFULL; + break; + case HA_KEYTYPE_INT24: + max_value = 0x7FFFFFULL; + break; + /* LONG */ + case HA_KEYTYPE_ULONG_INT: + max_value = 0xFFFFFFFFULL; + break; + case HA_KEYTYPE_LONG_INT: + max_value = 0x7FFFFFFFULL; + break; + /* BIG */ + case HA_KEYTYPE_ULONGLONG: + max_value = 0xFFFFFFFFFFFFFFFFULL; + break; + case HA_KEYTYPE_LONGLONG: + max_value = 0x7FFFFFFFFFFFFFFFULL; + break; + case HA_KEYTYPE_FLOAT: + /* We use the maximum as per IEEE754-2008 standard, 2^24 */ + max_value = 0x1000000ULL; + break; + case HA_KEYTYPE_DOUBLE: + /* We use the maximum as per IEEE754-2008 standard, 2^53 */ + max_value = 0x20000000000000ULL; + break; + default: + ut_error; + } + + return(max_value); +} + +/*******************************************************************//** +This function checks whether the index column information +is consistent between KEY info from mysql and that from innodb index. +@return TRUE if all column types match. */ +static +ibool +innobase_match_index_columns( +/*=========================*/ + const KEY* key_info, /*!< in: Index info + from mysql */ + const dict_index_t* index_info) /*!< in: Index info + from Innodb */ +{ + const KEY_PART_INFO* key_part; + const KEY_PART_INFO* key_end; + const dict_field_t* innodb_idx_fld; + const dict_field_t* innodb_idx_fld_end; + + DBUG_ENTER("innobase_match_index_columns"); + + /* Check whether user defined index column count matches */ + if (key_info->key_parts != index_info->n_user_defined_cols) { + DBUG_RETURN(FALSE); + } + + key_part = key_info->key_part; + key_end = key_part + key_info->key_parts; + innodb_idx_fld = index_info->fields; + innodb_idx_fld_end = index_info->fields + index_info->n_fields; + + /* Check each index column's datatype. We do not check + column name because there exists case that index + column name got modified in mysql but such change does not + propagate to InnoDB. + One hidden assumption here is that the index column sequences + are matched up between those in mysql and Innodb. */ + for (; key_part != key_end; ++key_part) { + ulint col_type; + ibool is_unsigned; + ulint mtype = innodb_idx_fld->col->mtype; + + /* Need to translate to InnoDB column type before + comparison. */ + col_type = get_innobase_type_from_mysql_type(&is_unsigned, + key_part->field); + + /* Ignore Innodb specific system columns. */ + while (mtype == DATA_SYS) { + innodb_idx_fld++; + + if (innodb_idx_fld >= innodb_idx_fld_end) { + DBUG_RETURN(FALSE); + } + } + + if (col_type != mtype) { + /* Column Type mismatches */ + DBUG_RETURN(FALSE); + } + + innodb_idx_fld++; + } + + DBUG_RETURN(TRUE); +} + +/*******************************************************************//** +This function builds a translation table in INNOBASE_SHARE +structure for fast index location with mysql array number from its +table->key_info structure. This also provides the necessary translation +between the key order in mysql key_info and Innodb ib_table->indexes if +they are not fully matched with each other. +Note we do not have any mutex protecting the translation table +building based on the assumption that there is no concurrent +index creation/drop and DMLs that requires index lookup. All table +handle will be closed before the index creation/drop. +@return TRUE if index translation table built successfully */ +static +ibool +innobase_build_index_translation( +/*=============================*/ + const TABLE* table, /*!< in: table in MySQL data + dictionary */ + dict_table_t* ib_table, /*!< in: table in Innodb data + dictionary */ + INNOBASE_SHARE* share) /*!< in/out: share structure + where index translation table + will be constructed in. */ +{ + ulint mysql_num_index; + ulint ib_num_index; + dict_index_t** index_mapping; + ibool ret = TRUE; + + DBUG_ENTER("innobase_build_index_translation"); + + mysql_num_index = table->s->keys; + ib_num_index = UT_LIST_GET_LEN(ib_table->indexes); + + index_mapping = share->idx_trans_tbl.index_mapping; + + /* If there exists inconsistency between MySQL and InnoDB dictionary + (metadata) information, the number of index defined in MySQL + could exceed that in InnoDB, do not build index translation + table in such case */ + if (UNIV_UNLIKELY(ib_num_index < mysql_num_index)) { + ret = FALSE; + goto func_exit; + } + + /* If index entry count is non-zero, nothing has + changed since last update, directly return TRUE */ + if (share->idx_trans_tbl.index_count) { + /* Index entry count should still match mysql_num_index */ + ut_a(share->idx_trans_tbl.index_count == mysql_num_index); + goto func_exit; + } + + /* The number of index increased, rebuild the mapping table */ + if (mysql_num_index > share->idx_trans_tbl.array_size) { + index_mapping = (dict_index_t**) my_realloc(index_mapping, + mysql_num_index * + sizeof(*index_mapping), + MYF(MY_ALLOW_ZERO_PTR)); + + if (!index_mapping) { + ret = FALSE; + goto func_exit; + } + + share->idx_trans_tbl.array_size = mysql_num_index; + } + + + /* For each index in the mysql key_info array, fetch its + corresponding InnoDB index pointer into index_mapping + array. */ + for (ulint count = 0; count < mysql_num_index; count++) { + + /* Fetch index pointers into index_mapping according to mysql + index sequence */ + index_mapping[count] = dict_table_get_index_on_name( + ib_table, table->key_info[count].name); + + if (!index_mapping[count]) { + sql_print_error("Cannot find index %s in InnoDB " + "index dictionary.", + table->key_info[count].name); + ret = FALSE; + goto func_exit; + } + + /* Double check fetched index has the same + column info as those in mysql key_info. */ + if (!innobase_match_index_columns(&table->key_info[count], + index_mapping[count])) { + sql_print_error("Found index %s whose column info " + "does not match that of MySQL.", + table->key_info[count].name); + ret = FALSE; + goto func_exit; + } + } + + /* Successfully built the translation table */ + share->idx_trans_tbl.index_count = mysql_num_index; + +func_exit: + if (!ret) { + /* Build translation table failed. */ + my_free(index_mapping, MYF(MY_ALLOW_ZERO_PTR)); + + share->idx_trans_tbl.array_size = 0; + share->idx_trans_tbl.index_count = 0; + index_mapping = NULL; + } + + share->idx_trans_tbl.index_mapping = index_mapping; + + DBUG_RETURN(ret); +} + +/*******************************************************************//** +This function uses index translation table to quickly locate the +requested index structure. +Note we do not have mutex protection for the index translatoin table +access, it is based on the assumption that there is no concurrent +translation table rebuild (fter create/drop index) and DMLs that +require index lookup. +@return dict_index_t structure for requested index. NULL if +fail to locate the index structure. */ +static +dict_index_t* +innobase_index_lookup( +/*==================*/ + INNOBASE_SHARE* share, /*!< in: share structure for index + translation table. */ + uint keynr) /*!< in: index number for the requested + index */ +{ + if (!share->idx_trans_tbl.index_mapping + || keynr >= share->idx_trans_tbl.index_count) { + return(NULL); + } + + return(share->idx_trans_tbl.index_mapping[keynr]); +} + +/************************************************************************ Set the autoinc column max value. This should only be called once from -ha_innobase::open(). Therefore there's no need for a covering lock. -@return DB_SUCCESS or error code */ +ha_innobase::open(). Therefore there's no need for a covering lock. */ UNIV_INTERN -ulint +void ha_innobase::innobase_initialize_autoinc() /*======================================*/ { - dict_index_t* index; ulonglong auto_inc; - const char* col_name; - ulint error; + const Field* field = table->found_next_number_field; - col_name = table->found_next_number_field->field_name; - index = innobase_get_index(table->s->next_number_index); + if (field != NULL) { + auto_inc = innobase_get_int_col_max_value(field); + } else { + /* We have no idea what's been passed in to us as the + autoinc column. We set it to the 0, effectively disabling + updates to the table. */ + auto_inc = 0; - /* Execute SELECT MAX(col_name) FROM TABLE; */ - error = row_search_max_autoinc(index, col_name, &auto_inc); + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: Unable to determine the AUTOINC " + "column name\n"); + } - switch (error) { - case DB_SUCCESS: + if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) { + /* If the recovery level is set so high that writes + are disabled we force the AUTOINC counter to 0 + value effectively disabling writes to the table. + Secondly, we avoid reading the table in case the read + results in failure due to a corrupted table/index. + + We will not return an error to the client, so that the + tables can be dumped with minimal hassle. If an error + were returned in this case, the first attempt to read + the table would fail and subsequent SELECTs would succeed. */ + auto_inc = 0; + } else if (field == NULL) { + /* This is a far more serious error, best to avoid + opening the table and return failure. */ + my_error(ER_AUTOINC_READ_FAILED, MYF(0)); + } else { + dict_index_t* index; + const char* col_name; + ulonglong read_auto_inc; + ulint err; - /* At the this stage we don't know the increment - or the offset, so use default inrement of 1. */ - ++auto_inc; - break; + update_thd(ha_thd()); - case DB_RECORD_NOT_FOUND: - ut_print_timestamp(stderr); - fprintf(stderr, " InnoDB: MySQL and InnoDB data " - "dictionaries are out of sync.\n" - "InnoDB: Unable to find the AUTOINC column %s in the " - "InnoDB table %s.\n" - "InnoDB: We set the next AUTOINC column value to the " - "maximum possible value,\n" - "InnoDB: in effect disabling the AUTOINC next value " - "generation.\n" - "InnoDB: You can either set the next AUTOINC value " - "explicitly using ALTER TABLE\n" - "InnoDB: or fix the data dictionary by recreating " - "the table.\n", - col_name, index->table->name); - - auto_inc = 0xFFFFFFFFFFFFFFFFULL; - break; + ut_a(prebuilt->trx == thd_to_trx(user_thd)); - default: - return(error); + col_name = field->field_name; + index = innobase_get_index(table->s->next_number_index); + + /* Execute SELECT MAX(col_name) FROM TABLE; */ + err = row_search_max_autoinc(index, col_name, &read_auto_inc); + + switch (err) { + case DB_SUCCESS: + /* At the this stage we do not know the increment + or the offset, so use a default increment of 1. */ + auto_inc = read_auto_inc + 1; + break; + + case DB_RECORD_NOT_FOUND: + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: MySQL and InnoDB data " + "dictionaries are out of sync.\n" + "InnoDB: Unable to find the AUTOINC column " + "%s in the InnoDB table %s.\n" + "InnoDB: We set the next AUTOINC column " + "value to 0,\n" + "InnoDB: in effect disabling the AUTOINC " + "next value generation.\n" + "InnoDB: You can either set the next " + "AUTOINC value explicitly using ALTER TABLE\n" + "InnoDB: or fix the data dictionary by " + "recreating the table.\n", + col_name, index->table->name); + + /* This will disable the AUTOINC generation. */ + auto_inc = 0; + + /* We want the open to succeed, so that the user can + take corrective action. ie. reads should succeed but + updates should fail. */ + err = DB_SUCCESS; + break; + default: + /* row_search_max_autoinc() should only return + one of DB_SUCCESS or DB_RECORD_NOT_FOUND. */ + ut_error; + } } dict_table_autoinc_initialize(prebuilt->table, auto_inc); - - return(DB_SUCCESS); } /*****************************************************************//** @@ -3192,6 +3496,11 @@ retry: primary_key = table->s->primary_key; key_used_on_scan = primary_key; + if (!innobase_build_index_translation(table, ib_table, share)) { + sql_print_error("Build InnoDB index translation table for" + " Table %s failed", name); + } + /* Allocate a buffer for a 'row reference'. A row reference is a string of bytes of length ref_length which uniquely specifies a row in our table. Note that MySQL may also compare two row @@ -3199,31 +3508,86 @@ retry: of length ref_length! */ if (!row_table_got_default_clust_index(ib_table)) { - if (primary_key >= MAX_KEY) { - sql_print_error("Table %s has a primary key in InnoDB data " - "dictionary, but not in MySQL!", name); - } prebuilt->clust_index_was_generated = FALSE; - /* MySQL allocates the buffer for ref. key_info->key_length - includes space for all key columns + one byte for each column - that may be NULL. ref_length must be as exact as possible to - save space, because all row reference buffers are allocated - based on ref_length. */ + if (UNIV_UNLIKELY(primary_key >= MAX_KEY)) { + sql_print_error("Table %s has a primary key in " + "InnoDB data dictionary, but not " + "in MySQL!", name); - ref_length = table->key_info[primary_key].key_length; + /* This mismatch could cause further problems + if not attended, bring this to the user's attention + by printing a warning in addition to log a message + in the errorlog */ + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_NO_SUCH_INDEX, + "InnoDB: Table %s has a " + "primary key in InnoDB data " + "dictionary, but not in " + "MySQL!", name); + + /* If primary_key >= MAX_KEY, its (primary_key) + value could be out of bound if continue to index + into key_info[] array. Find InnoDB primary index, + and assign its key_length to ref_length. + In addition, since MySQL indexes are sorted starting + with primary index, unique index etc., initialize + ref_length to the first index key length in + case we fail to find InnoDB cluster index. + + Please note, this will not resolve the primary + index mismatch problem, other side effects are + possible if users continue to use the table. + However, we allow this table to be opened so + that user can adopt necessary measures for the + mismatch while still being accessible to the table + date. */ + ref_length = table->key_info[0].key_length; + + /* Find correspoinding cluster index + key length in MySQL's key_info[] array */ + for (ulint i = 0; i < table->s->keys; i++) { + dict_index_t* index; + index = innobase_get_index(i); + if (dict_index_is_clust(index)) { + ref_length = + table->key_info[i].key_length; + } + } + } else { + /* MySQL allocates the buffer for ref. + key_info->key_length includes space for all key + columns + one byte for each column that may be + NULL. ref_length must be as exact as possible to + save space, because all row reference buffers are + allocated based on ref_length. */ + + ref_length = table->key_info[primary_key].key_length; + } } else { if (primary_key != MAX_KEY) { - sql_print_error("Table %s has no primary key in InnoDB data " - "dictionary, but has one in MySQL! If you " - "created the table with a MySQL version < " - "3.23.54 and did not define a primary key, " - "but defined a unique key with all non-NULL " - "columns, then MySQL internally treats that " - "key as the primary key. You can fix this " - "error by dump + DROP + CREATE + reimport " - "of the table.", name); + sql_print_error( + "Table %s has no primary key in InnoDB data " + "dictionary, but has one in MySQL! If you " + "created the table with a MySQL version < " + "3.23.54 and did not define a primary key, " + "but defined a unique key with all non-NULL " + "columns, then MySQL internally treats that " + "key as the primary key. You can fix this " + "error by dump + DROP + CREATE + reimport " + "of the table.", name); + + /* This mismatch could cause further problems + if not attended, bring this to the user attention + by printing a warning in addition to log a message + in the errorlog */ + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_NO_SUCH_INDEX, + "InnoDB: Table %s has no " + "primary key in InnoDB data " + "dictionary, but has one in " + "MySQL!", name); } prebuilt->clust_index_was_generated = TRUE; @@ -3265,8 +3629,6 @@ retry: /* Only if the table has an AUTOINC column. */ if (prebuilt->table != NULL && table->found_next_number_field != NULL) { - ulint error; - dict_table_autoinc_lock(prebuilt->table); /* Since a table can already be "open" in InnoDB's internal @@ -3275,8 +3637,7 @@ retry: autoinc value from a previous MySQL open. */ if (dict_table_autoinc_read(prebuilt->table) == 0) { - error = innobase_initialize_autoinc(); - ut_a(error == DB_SUCCESS); + innobase_initialize_autoinc(); } dict_table_autoinc_unlock(prebuilt->table); @@ -4093,67 +4454,6 @@ skip_field: } /********************************************************************//** -Get the upper limit of the MySQL integral and floating-point type. */ -UNIV_INTERN -ulonglong -ha_innobase::innobase_get_int_col_max_value( -/*========================================*/ - const Field* field) -{ - ulonglong max_value = 0; - - switch(field->key_type()) { - /* TINY */ - case HA_KEYTYPE_BINARY: - max_value = 0xFFULL; - break; - case HA_KEYTYPE_INT8: - max_value = 0x7FULL; - break; - /* SHORT */ - case HA_KEYTYPE_USHORT_INT: - max_value = 0xFFFFULL; - break; - case HA_KEYTYPE_SHORT_INT: - max_value = 0x7FFFULL; - break; - /* MEDIUM */ - case HA_KEYTYPE_UINT24: - max_value = 0xFFFFFFULL; - break; - case HA_KEYTYPE_INT24: - max_value = 0x7FFFFFULL; - break; - /* LONG */ - case HA_KEYTYPE_ULONG_INT: - max_value = 0xFFFFFFFFULL; - break; - case HA_KEYTYPE_LONG_INT: - max_value = 0x7FFFFFFFULL; - break; - /* BIG */ - case HA_KEYTYPE_ULONGLONG: - max_value = 0xFFFFFFFFFFFFFFFFULL; - break; - case HA_KEYTYPE_LONGLONG: - max_value = 0x7FFFFFFFFFFFFFFFULL; - break; - case HA_KEYTYPE_FLOAT: - /* We use the maximum as per IEEE754-2008 standard, 2^24 */ - max_value = 0x1000000ULL; - break; - case HA_KEYTYPE_DOUBLE: - /* We use the maximum as per IEEE754-2008 standard, 2^53 */ - max_value = 0x20000000000000ULL; - break; - default: - ut_error; - } - - return(max_value); -} - -/********************************************************************//** This special handling is really to overcome the limitations of MySQL's binlogging. We need to eliminate the non-determinism that will arise in INSERT ... SELECT type of statements, since MySQL binlog only stores the @@ -4378,11 +4678,17 @@ no_commit: prebuilt->autoinc_error = DB_SUCCESS; if ((error = update_auto_increment())) { - /* We don't want to mask autoinc overflow errors. */ - if (prebuilt->autoinc_error != DB_SUCCESS) { - error = (int) prebuilt->autoinc_error; + /* Handle the case where the AUTOINC sub-system + failed during initialization. */ + if (prebuilt->autoinc_error == DB_UNSUPPORTED) { + error_result = ER_AUTOINC_READ_FAILED; + /* Set the error message to report too. */ + my_error(ER_AUTOINC_READ_FAILED, MYF(0)); + goto func_exit; + } else if (prebuilt->autoinc_error != DB_SUCCESS) { + error = (int) prebuilt->autoinc_error; goto report_error; } @@ -4463,24 +4769,29 @@ no_commit: update the table upper limit. Note: last_value will be 0 if get_auto_increment() was not called.*/ - if (auto_inc <= col_max_value - && auto_inc >= prebuilt->autoinc_last_value) { + if (auto_inc >= prebuilt->autoinc_last_value) { set_max_autoinc: - ut_a(prebuilt->autoinc_increment > 0); + /* This should filter out the negative + values set explicitly by the user. */ + if (auto_inc <= col_max_value) { + ut_a(prebuilt->autoinc_increment > 0); - ulonglong need; - ulonglong offset; + ulonglong need; + ulonglong offset; - offset = prebuilt->autoinc_offset; - need = prebuilt->autoinc_increment; + offset = prebuilt->autoinc_offset; + need = prebuilt->autoinc_increment; - auto_inc = innobase_next_autoinc( - auto_inc, need, offset, col_max_value); + auto_inc = innobase_next_autoinc( + auto_inc, + need, offset, col_max_value); - err = innobase_set_max_autoinc(auto_inc); + err = innobase_set_max_autoinc( + auto_inc); - if (err != DB_SUCCESS) { - error = err; + if (err != DB_SUCCESS) { + error = err; + } } } break; @@ -4826,7 +5137,7 @@ ha_innobase::unlock_row(void) case ROW_READ_WITH_LOCKS: if (!srv_locks_unsafe_for_binlog && prebuilt->trx->isolation_level - != TRX_ISO_READ_COMMITTED) { + > TRX_ISO_READ_COMMITTED) { break; } /* fall through */ @@ -4865,7 +5176,7 @@ ha_innobase::try_semi_consistent_read(bool yes) if (yes && (srv_locks_unsafe_for_binlog - || prebuilt->trx->isolation_level == TRX_ISO_READ_COMMITTED)) { + || prebuilt->trx->isolation_level <= TRX_ISO_READ_COMMITTED)) { prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT; } else { prebuilt->row_read_type = ROW_READ_WITH_LOCKS; @@ -5160,14 +5471,30 @@ ha_innobase::innobase_get_index( DBUG_ENTER("innobase_get_index"); ha_statistic_increment(&SSV::ha_read_key_count); - ut_ad(user_thd == ha_thd()); - ut_a(prebuilt->trx == thd_to_trx(user_thd)); - if (keynr != MAX_KEY && table->s->keys > 0) { key = table->key_info + keynr; - index = dict_table_get_index_on_name(prebuilt->table, - key->name); + index = innobase_index_lookup(share, keynr); + + if (index) { + ut_a(ut_strcmp(index->name, key->name) == 0); + } else { + /* Can't find index with keynr in the translation + table. Only print message if the index translation + table exists */ + if (share->idx_trans_tbl.index_mapping) { + sql_print_error("InnoDB could not find " + "index %s key no %u for " + "table %s through its " + "index translation table", + key ? key->name : "NULL", + keynr, + prebuilt->table->name); + } + + index = dict_table_get_index_on_name(prebuilt->table, + key->name); + } } else { index = dict_table_get_first_index(prebuilt->table); } @@ -5228,7 +5555,7 @@ ha_innobase::change_active_index( dtuple_set_n_fields(prebuilt->search_tuple, prebuilt->index->n_fields); dict_index_copy_types(prebuilt->search_tuple, prebuilt->index, - prebuilt->index->n_fields); + prebuilt->index->n_fields); /* MySQL changes the active index for a handle also during some queries, for example SELECT MAX(a), SUM(a) first retrieves the MAX() @@ -5729,9 +6056,11 @@ create_table_def( if (error == DB_DUPLICATE_KEY) { char buf[100]; - innobase_convert_identifier(buf, sizeof buf, - table_name, strlen(table_name), - trx->mysql_thd, TRUE); + char* buf_end = innobase_convert_identifier( + buf, sizeof buf - 1, table_name, strlen(table_name), + trx->mysql_thd, TRUE); + + *buf_end = '\0'; my_error(ER_TABLE_EXISTS_ERROR, MYF(0), buf); } @@ -6333,6 +6662,10 @@ ha_innobase::create( goto cleanup; } + if (create_info->options & HA_LEX_CREATE_TMP_TABLE) { + flags |= DICT_TF2_TEMPORARY << DICT_TF2_SHIFT; + } + error = create_table_def(trx, form, norm_name, create_info->options & HA_LEX_CREATE_TMP_TABLE ? name2 : NULL, flags); @@ -6854,10 +7187,15 @@ ha_innobase::records_in_range( key = table->key_info + active_index; - index = dict_table_get_index_on_name(prebuilt->table, key->name); + index = innobase_get_index(keynr); - /* MySQL knows about this index and so we must be able to find it.*/ - ut_a(index); + /* There exists possibility of not being able to find requested + index due to inconsistency between MySQL and InoDB dictionary info. + Necessary message should have been printed in innobase_get_index() */ + if (UNIV_UNLIKELY(!index)) { + n_rows = HA_POS_ERROR; + goto func_exit; + } heap = mem_heap_create(2 * (key->key_parts * sizeof(dfield_t) + sizeof(dtuple_t))); @@ -6902,6 +7240,7 @@ ha_innobase::records_in_range( mem_heap_free(heap); +func_exit: my_free(key_val_buff2, MYF(0)); prebuilt->trx->op_info = (char*)""; @@ -7043,6 +7382,7 @@ ha_innobase::info( char path[FN_REFLEN]; os_file_stat_t stat_info; + DBUG_ENTER("info"); /* If we are forcing recovery at a high level, we will suppress @@ -7203,13 +7543,29 @@ ha_innobase::info( } if (flag & HA_STATUS_CONST) { - index = dict_table_get_first_index(ib_table); - - if (prebuilt->clust_index_was_generated) { - index = dict_table_get_next_index(index); + /* Verify the number of index in InnoDB and MySQL + matches up. If prebuilt->clust_index_was_generated + holds, InnoDB defines GEN_CLUST_INDEX internally */ + ulint num_innodb_index = UT_LIST_GET_LEN(ib_table->indexes) + - prebuilt->clust_index_was_generated; + + if (table->s->keys != num_innodb_index) { + sql_print_error("Table %s contains %lu " + "indexes inside InnoDB, which " + "is different from the number of " + "indexes %u defined in the MySQL ", + ib_table->name, num_innodb_index, + table->s->keys); } for (i = 0; i < table->s->keys; i++) { + /* We could get index quickly through internal + index mapping with the index translation table. + The identity of index (match up index name with + that of table->key_info[i]) is already verified in + innobase_get_index(). */ + index = innobase_get_index(i); + if (index == NULL) { sql_print_error("Table %s contains fewer " "indexes inside InnoDB than " @@ -7238,6 +7594,8 @@ ha_innobase::info( break; } + dict_index_stat_mutex_enter(index); + if (index->stat_n_diff_key_vals[j + 1] == 0) { rec_per_key = stats.records; @@ -7246,6 +7604,8 @@ ha_innobase::info( index->stat_n_diff_key_vals[j + 1]); } + dict_index_stat_mutex_exit(index); + /* Since MySQL seems to favor table scans too much over index searches, we pretend index selectivity is 2 times better than @@ -7261,8 +7621,6 @@ ha_innobase::info( rec_per_key >= ~(ulong) 0 ? ~(ulong) 0 : (ulong) rec_per_key; } - - index = dict_table_get_next_index(index); } } @@ -7302,15 +7660,9 @@ ha_innobase::analyze( THD* thd, /*!< in: connection thread handle */ HA_CHECK_OPT* check_opt) /*!< in: currently ignored */ { - /* Serialize ANALYZE TABLE inside InnoDB, see - Bug#38996 Race condition in ANALYZE TABLE */ - pthread_mutex_lock(&analyze_mutex); - /* Simply call ::info() with all the flags */ info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE); - pthread_mutex_unlock(&analyze_mutex); - return(0); } @@ -7340,8 +7692,13 @@ ha_innobase::check( HA_CHECK_OPT* check_opt) /*!< in: check options, currently ignored */ { - ulint ret; + dict_index_t* index; + ulint n_rows; + ulint n_rows_in_table = ULINT_UNDEFINED; + ibool is_ok = TRUE; + ulint old_isolation_level; + DBUG_ENTER("ha_innobase::check"); DBUG_ASSERT(thd == ha_thd()); ut_a(prebuilt->trx); ut_a(prebuilt->trx->magic_n == TRX_MAGIC_N); @@ -7354,17 +7711,140 @@ ha_innobase::check( build_template(prebuilt, NULL, table, ROW_MYSQL_WHOLE_ROW); } - ret = row_check_table_for_mysql(prebuilt); + if (prebuilt->table->ibd_file_missing) { + sql_print_error("InnoDB: Error:\n" + "InnoDB: MySQL is trying to use a table handle" + " but the .ibd file for\n" + "InnoDB: table %s does not exist.\n" + "InnoDB: Have you deleted the .ibd file" + " from the database directory under\n" + "InnoDB: the MySQL datadir, or have you" + " used DISCARD TABLESPACE?\n" + "InnoDB: Please refer to\n" + "InnoDB: " REFMAN "innodb-troubleshooting.html\n" + "InnoDB: how you can resolve the problem.\n", + prebuilt->table->name); + DBUG_RETURN(HA_ADMIN_CORRUPT); + } + + prebuilt->trx->op_info = "checking table"; - switch (ret) { - case DB_SUCCESS: - return(HA_ADMIN_OK); - case DB_INTERRUPTED: + old_isolation_level = prebuilt->trx->isolation_level; + + /* We must run the index record counts at an isolation level + >= READ COMMITTED, because a dirty read can see a wrong number + of records in some index; to play safe, we use always + REPEATABLE READ here */ + + prebuilt->trx->isolation_level = TRX_ISO_REPEATABLE_READ; + + /* Enlarge the fatal lock wait timeout during CHECK TABLE. */ + mutex_enter(&kernel_mutex); + srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */ + mutex_exit(&kernel_mutex); + + for (index = dict_table_get_first_index(prebuilt->table); + index != NULL; + index = dict_table_get_next_index(index)) { +#if 0 + fputs("Validating index ", stderr); + ut_print_name(stderr, trx, FALSE, index->name); + putc('\n', stderr); +#endif + + if (!btr_validate_index(index, prebuilt->trx)) { + is_ok = FALSE; + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_NOT_KEYFILE, + "InnoDB: The B-tree of" + " index '%-.200s' is corrupted.", + index->name); + continue; + } + + /* Instead of invoking change_active_index(), set up + a dummy template for non-locking reads, disabling + access to the clustered index. */ + prebuilt->index = index; + + prebuilt->index_usable = row_merge_is_index_usable( + prebuilt->trx, prebuilt->index); + + if (UNIV_UNLIKELY(!prebuilt->index_usable)) { + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + HA_ERR_TABLE_DEF_CHANGED, + "InnoDB: Insufficient history for" + " index '%-.200s'", + index->name); + continue; + } + + prebuilt->sql_stat_start = TRUE; + prebuilt->template_type = ROW_MYSQL_DUMMY_TEMPLATE; + prebuilt->n_template = 0; + prebuilt->need_to_access_clustered = FALSE; + + dtuple_set_n_fields(prebuilt->search_tuple, 0); + + prebuilt->select_lock_type = LOCK_NONE; + + if (!row_check_index_for_mysql(prebuilt, index, &n_rows)) { + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_NOT_KEYFILE, + "InnoDB: The B-tree of" + " index '%-.200s' is corrupted.", + index->name); + is_ok = FALSE; + } + + if (thd_killed(user_thd)) { + break; + } + +#if 0 + fprintf(stderr, "%lu entries in index %s\n", n_rows, + index->name); +#endif + + if (index == dict_table_get_first_index(prebuilt->table)) { + n_rows_in_table = n_rows; + } else if (n_rows != n_rows_in_table) { + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_NOT_KEYFILE, + "InnoDB: Index '%-.200s'" + " contains %lu entries," + " should be %lu.", + index->name, + (ulong) n_rows, + (ulong) n_rows_in_table); + is_ok = FALSE; + } + } + + /* Restore the original isolation level */ + prebuilt->trx->isolation_level = old_isolation_level; + + /* We validate also the whole adaptive hash index for all tables + at every CHECK TABLE */ + + if (!btr_search_validate()) { + push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_NOT_KEYFILE, + "InnoDB: The adaptive hash index is corrupted."); + is_ok = FALSE; + } + + /* Restore the fatal lock wait timeout after CHECK TABLE. */ + mutex_enter(&kernel_mutex); + srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */ + mutex_exit(&kernel_mutex); + + prebuilt->trx->op_info = ""; + if (thd_killed(user_thd)) { my_error(ER_QUERY_INTERRUPTED, MYF(0)); - return(-1); - default: - return(HA_ADMIN_CORRUPT); } + + DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT); } /*************************************************************//** @@ -8187,8 +8667,8 @@ innodb_show_status( mutex_enter(&srv_monitor_file_mutex); rewind(srv_monitor_file); - srv_printf_innodb_monitor(srv_monitor_file, - &trx_list_start, &trx_list_end); + srv_printf_innodb_monitor(srv_monitor_file, FALSE, + &trx_list_start, &trx_list_end); flen = ftell(srv_monitor_file); os_file_set_eof(srv_monitor_file); @@ -8245,19 +8725,25 @@ innodb_show_status( } /************************************************************************//** -Implements the SHOW MUTEX STATUS command. . */ +Implements the SHOW MUTEX STATUS command. +@return TRUE on failure, FALSE on success. */ static bool innodb_mutex_show_status( /*=====================*/ - handlerton* hton, /*!< in: the innodb handlerton */ + handlerton* hton, /*!< in: the innodb handlerton */ THD* thd, /*!< in: the MySQL query thread of the caller */ - stat_print_fn* stat_print) + stat_print_fn* stat_print) /*!< in: function for printing + statistics */ { char buf1[IO_SIZE], buf2[IO_SIZE]; mutex_t* mutex; rw_lock_t* lock; + ulint block_mutex_oswait_count = 0; + ulint block_lock_oswait_count = 0; + mutex_t* block_mutex = NULL; + rw_lock_t* block_lock = NULL; #ifdef UNIV_DEBUG ulint rw_lock_count= 0; ulint rw_lock_count_spin_loop= 0; @@ -8272,12 +8758,16 @@ innodb_mutex_show_status( mutex_enter(&mutex_list_mutex); - mutex = UT_LIST_GET_FIRST(mutex_list); + for (mutex = UT_LIST_GET_FIRST(mutex_list); mutex != NULL; + mutex = UT_LIST_GET_NEXT(list, mutex)) { + if (mutex->count_os_wait == 0) { + continue; + } - while (mutex != NULL) { - if (mutex->count_os_wait == 0 - || buf_pool_is_block_mutex(mutex)) { - goto next_mutex; + if (buf_pool_is_block_mutex(mutex)) { + block_mutex = mutex; + block_mutex_oswait_count += mutex->count_os_wait; + continue; } #ifdef UNIV_DEBUG if (mutex->mutex_type != 1) { @@ -8304,8 +8794,7 @@ innodb_mutex_show_status( DBUG_RETURN(1); } } - } - else { + } else { rw_lock_count += mutex->count_using; rw_lock_count_spin_loop += mutex->count_spin_loop; rw_lock_count_spin_rounds += mutex->count_spin_rounds; @@ -8317,7 +8806,7 @@ innodb_mutex_show_status( buf1len= (uint) my_snprintf(buf1, sizeof(buf1), "%s:%lu", mutex->cfile_name, (ulong) mutex->cline); buf2len= (uint) my_snprintf(buf2, sizeof(buf2), "os_waits=%lu", - mutex->count_os_wait); + (ulong) mutex->count_os_wait); if (stat_print(thd, innobase_hton_name, hton_name_len, buf1, buf1len, @@ -8326,45 +8815,83 @@ innodb_mutex_show_status( DBUG_RETURN(1); } #endif /* UNIV_DEBUG */ + } + + if (block_mutex) { + buf1len = (uint) my_snprintf(buf1, sizeof buf1, + "combined %s:%lu", + block_mutex->cfile_name, + (ulong) block_mutex->cline); + buf2len = (uint) my_snprintf(buf2, sizeof buf2, + "os_waits=%lu", + (ulong) block_mutex_oswait_count); -next_mutex: - mutex = UT_LIST_GET_NEXT(list, mutex); + if (stat_print(thd, innobase_hton_name, + hton_name_len, buf1, buf1len, + buf2, buf2len)) { + mutex_exit(&mutex_list_mutex); + DBUG_RETURN(1); + } } mutex_exit(&mutex_list_mutex); mutex_enter(&rw_lock_list_mutex); - lock = UT_LIST_GET_FIRST(rw_lock_list); - - while (lock != NULL) { - if (lock->count_os_wait - && !buf_pool_is_block_lock(lock)) { - buf1len= my_snprintf(buf1, sizeof(buf1), "%s:%lu", - lock->cfile_name, (ulong) lock->cline); - buf2len= my_snprintf(buf2, sizeof(buf2), - "os_waits=%lu", lock->count_os_wait); - - if (stat_print(thd, innobase_hton_name, - hton_name_len, buf1, buf1len, - buf2, buf2len)) { - mutex_exit(&rw_lock_list_mutex); - DBUG_RETURN(1); - } + for (lock = UT_LIST_GET_FIRST(rw_lock_list); lock != NULL; + lock = UT_LIST_GET_NEXT(list, lock)) { + if (lock->count_os_wait == 0) { + continue; + } + + if (buf_pool_is_block_lock(lock)) { + block_lock = lock; + block_lock_oswait_count += lock->count_os_wait; + continue; + } + + buf1len = my_snprintf(buf1, sizeof buf1, "%s:%lu", + lock->cfile_name, (ulong) lock->cline); + buf2len = my_snprintf(buf2, sizeof buf2, "os_waits=%lu", + (ulong) lock->count_os_wait); + + if (stat_print(thd, innobase_hton_name, + hton_name_len, buf1, buf1len, + buf2, buf2len)) { + mutex_exit(&rw_lock_list_mutex); + DBUG_RETURN(1); + } + } + + if (block_lock) { + buf1len = (uint) my_snprintf(buf1, sizeof buf1, + "combined %s:%lu", + block_lock->cfile_name, + (ulong) block_lock->cline); + buf2len = (uint) my_snprintf(buf2, sizeof buf2, + "os_waits=%lu", + (ulong) block_lock_oswait_count); + + if (stat_print(thd, innobase_hton_name, + hton_name_len, buf1, buf1len, + buf2, buf2len)) { + mutex_exit(&rw_lock_list_mutex); + DBUG_RETURN(1); } - lock = UT_LIST_GET_NEXT(list, lock); } mutex_exit(&rw_lock_list_mutex); #ifdef UNIV_DEBUG - buf2len= my_snprintf(buf2, sizeof(buf2), - "count=%lu, spin_waits=%lu, spin_rounds=%lu, " - "os_waits=%lu, os_yields=%lu, os_wait_times=%lu", - rw_lock_count, rw_lock_count_spin_loop, - rw_lock_count_spin_rounds, - rw_lock_count_os_wait, rw_lock_count_os_yield, - (ulong) (rw_lock_wait_time/1000)); + buf2len = my_snprintf(buf2, sizeof buf2, + "count=%lu, spin_waits=%lu, spin_rounds=%lu, " + "os_waits=%lu, os_yields=%lu, os_wait_times=%lu", + (ulong) rw_lock_count, + (ulong) rw_lock_count_spin_loop, + (ulong) rw_lock_count_spin_rounds, + (ulong) rw_lock_count_os_wait, + (ulong) rw_lock_count_os_yield, + (ulong) (rw_lock_wait_time / 1000)); if (stat_print(thd, innobase_hton_name, hton_name_len, STRING_WITH_LEN("rw_lock_mutexes"), buf2, buf2len)) { @@ -8426,6 +8953,11 @@ static INNOBASE_SHARE* get_share(const char* table_name) innobase_open_tables, fold, share); thr_lock_init(&share->lock); + + /* Index translation table initialization */ + share->idx_trans_tbl.index_mapping = NULL; + share->idx_trans_tbl.index_count = 0; + share->idx_trans_tbl.array_size = 0; } share->use_count++; @@ -8456,6 +8988,11 @@ static void free_share(INNOBASE_SHARE* share) HASH_DELETE(INNOBASE_SHARE, table_name_hash, innobase_open_tables, fold, share); thr_lock_delete(&share->lock); + + /* Free any memory from index translation table */ + my_free(share->idx_trans_tbl.index_mapping, + MYF(MY_ALLOW_ZERO_PTR)); + my_free(share, MYF(0)); /* TODO: invoke HASH_MIGRATE if innobase_open_tables @@ -8558,7 +9095,7 @@ ha_innobase::store_lock( isolation_level = trx->isolation_level; if ((srv_locks_unsafe_for_binlog - || isolation_level == TRX_ISO_READ_COMMITTED) + || isolation_level <= TRX_ISO_READ_COMMITTED) && isolation_level != TRX_ISO_SERIALIZABLE && (lock_type == TL_READ || lock_type == TL_READ_NO_INSERT) && (sql_command == SQLCOM_INSERT_SELECT @@ -8690,7 +9227,10 @@ ha_innobase::innobase_get_autoinc( *value = dict_table_autoinc_read(prebuilt->table); /* It should have been initialized during open. */ - ut_a(*value != 0); + if (*value == 0) { + prebuilt->autoinc_error = DB_UNSUPPORTED; + dict_table_autoinc_unlock(prebuilt->table); + } } return(prebuilt->autoinc_error); @@ -8770,6 +9310,11 @@ ha_innobase::get_auto_increment( invoking this method. So we are not sure if it's guaranteed to be 0 or not. */ + /* We need the upper limit of the col type to check for + whether we update the table autoinc counter or not. */ + ulonglong col_max_value = innobase_get_int_col_max_value( + table->next_number_field); + /* Called for the first time ? */ if (trx->n_autoinc_rows == 0) { @@ -8786,6 +9331,11 @@ ha_innobase::get_auto_increment( /* Not in the middle of a mult-row INSERT. */ } else if (prebuilt->autoinc_last_value == 0) { set_if_bigger(*first_value, autoinc); + /* Check for -ve values. */ + } else if (*first_value > col_max_value && trx->n_autoinc_rows > 0) { + /* Set to next logical value. */ + ut_a(autoinc > trx->n_autoinc_rows); + *first_value = (autoinc - trx->n_autoinc_rows) - 1; } *nb_reserved_values = trx->n_autoinc_rows; @@ -8796,12 +9346,6 @@ ha_innobase::get_auto_increment( ulonglong need; ulonglong current; ulonglong next_value; - ulonglong col_max_value; - - /* We need the upper limit of the col type to check for - whether we update the table autoinc counter or not. */ - col_max_value = innobase_get_int_col_max_value( - table->next_number_field); current = *first_value > col_max_value ? autoinc : *first_value; need = *nb_reserved_values * increment; @@ -9298,33 +9842,60 @@ innobase_set_cursor_view( (cursor_view_t*) curview); } +/*******************************************************************//** +If col_name is not NULL, check whether the named column is being +renamed in the table. If col_name is not provided, check +whether any one of columns in the table is being renamed. +@return true if the column is being renamed */ +static +bool +check_column_being_renamed( +/*=======================*/ + const TABLE* table, /*!< in: MySQL table */ + const char* col_name) /*!< in: name of the column */ +{ + uint k; + Field* field; + + for (k = 0; k < table->s->fields; k++) { + field = table->field[k]; -/*********************************************************************** -Check whether any of the given columns is being renamed in the table. */ + if (field->flags & FIELD_IS_RENAMED) { + + /* If col_name is not provided, return + if the field is marked as being renamed. */ + if (!col_name) { + return(true); + } + + /* If col_name is provided, return only + if names match */ + if (innobase_strcasecmp(field->field_name, + col_name) == 0) { + return(true); + } + } + } + + return(false); +} + +/*******************************************************************//** +Check whether any of the given columns is being renamed in the table. +@return true if any of col_names is being renamed in table */ static bool column_is_being_renamed( /*====================*/ - /* out: true if any of col_names is - being renamed in table */ - TABLE* table, /* in: MySQL table */ - uint n_cols, /* in: number of columns */ - const char** col_names) /* in: names of the columns */ + TABLE* table, /*!< in: MySQL table */ + uint n_cols, /*!< in: number of columns */ + const char** col_names) /*!< in: names of the columns */ { uint j; - uint k; - Field* field; - const char* col_name; for (j = 0; j < n_cols; j++) { - col_name = col_names[j]; - for (k = 0; k < table->s->fields; k++) { - field = table->field[k]; - if ((field->flags & FIELD_IS_RENAMED) - && innobase_strcasecmp(field->field_name, - col_name) == 0) { - return(true); - } + if (check_column_being_renamed(table, col_names[j])) { + return(true); } } @@ -9408,6 +9979,15 @@ ha_innobase::check_if_incompatible_data( return(COMPATIBLE_DATA_NO); } + /* For column rename operation, MySQL does not supply enough + information (new column name etc.) for InnoDB to make appropriate + system metadata change. To avoid system metadata inconsistency, + currently we can just request a table rebuild/copy by returning + COMPATIBLE_DATA_NO */ + if (check_column_being_renamed(table, NULL)) { + return COMPATIBLE_DATA_NO; + } + /* Check if a column participating in a foreign key is being renamed. There is no mechanism for updating InnoDB foreign key definitions. */ if (foreign_key_column_is_being_renamed(prebuilt, table)) { @@ -10153,13 +10733,13 @@ static MYSQL_SYSVAR_BOOL(use_sys_malloc, srv_use_sys_malloc, static MYSQL_SYSVAR_STR(change_buffering, innobase_change_buffering, PLUGIN_VAR_RQCMDARG, "Buffer changes to reduce random access: " - "OFF, ON, inserting, deleting, changing, or purging.", + "OFF, ON, none, inserts.", innodb_change_buffering_validate, innodb_change_buffering_update, NULL); static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold, PLUGIN_VAR_RQCMDARG, - "Number of pages that must be accessed sequentially for InnoDB to" + "Number of pages that must be accessed sequentially for InnoDB to " "trigger a readahead.", NULL, NULL, 56, 0, 64, 0); diff --git a/storage/innodb_plugin/handler/ha_innodb.h b/storage/innodb_plugin/handler/ha_innodb.h index 31e88ed8530..8a3e1ccff82 100644 --- a/storage/innodb_plugin/handler/ha_innodb.h +++ b/storage/innodb_plugin/handler/ha_innodb.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2000, 2009, MySQL AB & Innobase Oy. All Rights Reserved. +Copyright (c) 2000, 2010, MySQL AB & Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -27,15 +27,31 @@ Place, Suite 330, Boston, MA 02111-1307 USA #pragma interface /* gcc class implementation */ #endif +/* Structure defines translation table between mysql index and innodb +index structures */ +typedef struct innodb_idx_translate_struct { + ulint index_count; /*!< number of valid index entries + in the index_mapping array */ + ulint array_size; /*!< array size of index_mapping */ + dict_index_t** index_mapping; /*!< index pointer array directly + maps to index in Innodb from MySQL + array index */ +} innodb_idx_translate_t; + + /** InnoDB table share */ typedef struct st_innobase_share { - THR_LOCK lock; /*!< MySQL lock protecting - this structure */ - const char* table_name; /*!< InnoDB table name */ - uint use_count; /*!< reference count, - incremented in get_share() - and decremented in free_share() */ - void* table_name_hash;/*!< hash table chain node */ + THR_LOCK lock; /*!< MySQL lock protecting + this structure */ + const char* table_name; /*!< InnoDB table name */ + uint use_count; /*!< reference count, + incremented in get_share() + and decremented in + free_share() */ + void* table_name_hash;/*!< hash table chain node */ + innodb_idx_translate_t idx_trans_tbl; /*!< index translation + table between MySQL and + Innodb */ } INNOBASE_SHARE; @@ -91,9 +107,8 @@ class ha_innobase: public handler ulint innobase_reset_autoinc(ulonglong auto_inc); ulint innobase_get_autoinc(ulonglong* value); ulint innobase_update_autoinc(ulonglong auto_inc); - ulint innobase_initialize_autoinc(); + void innobase_initialize_autoinc(); dict_index_t* innobase_get_index(uint keynr); - ulonglong innobase_get_int_col_max_value(const Field* field); /* Init values for the class: */ public: diff --git a/storage/innodb_plugin/handler/handler0alter.cc b/storage/innodb_plugin/handler/handler0alter.cc index a5008991400..e474c318c58 100644 --- a/storage/innodb_plugin/handler/handler0alter.cc +++ b/storage/innodb_plugin/handler/handler0alter.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2005, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 2005, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -229,9 +229,11 @@ static int innobase_check_index_keys( /*======================*/ - const KEY* key_info, /*!< in: Indexes to be created */ - ulint num_of_keys) /*!< in: Number of indexes to - be created */ + const KEY* key_info, /*!< in: Indexes to be + created */ + ulint num_of_keys, /*!< in: Number of + indexes to be created */ + const dict_table_t* table) /*!< in: Existing indexes */ { ulint key_num; @@ -248,9 +250,22 @@ innobase_check_index_keys( const KEY& key2 = key_info[i]; if (0 == strcmp(key.name, key2.name)) { - sql_print_error("InnoDB: key name `%s` appears" - " twice in CREATE INDEX\n", - key.name); + my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), + key.name); + + return(ER_WRONG_NAME_FOR_INDEX); + } + } + + /* Check that the same index name does not already exist. */ + + for (const dict_index_t* index + = dict_table_get_first_index(table); + index; index = dict_table_get_next_index(index)) { + + if (0 == strcmp(key.name, index->name)) { + my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), + key.name); return(ER_WRONG_NAME_FOR_INDEX); } @@ -258,7 +273,7 @@ innobase_check_index_keys( /* Check that MySQL does not try to create a column prefix index field on an inappropriate data type and - that the same colum does not appear twice in the index. */ + that the same column does not appear twice in the index. */ for (ulint i = 0; i < key.key_parts; i++) { const KEY_PART_INFO& key_part1 @@ -289,14 +304,8 @@ innobase_check_index_keys( } } - sql_print_error("InnoDB: MySQL is trying to" - " create a column prefix" - " index field on an" - " inappropriate data type." - " column `%s`," - " index `%s`.\n", - field->field_name, - key.name); + my_error(ER_WRONG_KEY_COLUMN, MYF(0), + field->field_name); return(ER_WRONG_KEY_COLUMN); } @@ -309,11 +318,8 @@ innobase_check_index_keys( continue; } - sql_print_error("InnoDB: column `%s`" - " is not allowed to occur" - " twice in index `%s`.\n", - key_part1.field->field_name, - key.name); + my_error(ER_WRONG_KEY_COLUMN, MYF(0), + key_part1.field->field_name); return(ER_WRONG_KEY_COLUMN); } } @@ -522,12 +528,14 @@ innobase_create_key_def( key_info->name, "PRIMARY"); /* If there is a UNIQUE INDEX consisting entirely of NOT NULL - columns, MySQL will treat it as a PRIMARY KEY unless the - table already has one. */ + columns and if the index does not contain column prefix(es) + (only prefix/part of the column is indexed), MySQL will treat the + index as a PRIMARY KEY unless the table already has one. */ if (!new_primary && (key_info->flags & HA_NOSAME) + && (!(key_info->flags & HA_KEY_HAS_PART_KEY_SEG)) && row_table_got_default_clust_index(table)) { - uint key_part = key_info->key_parts; + uint key_part = key_info->key_parts; new_primary = TRUE; @@ -656,12 +664,18 @@ ha_innobase::add_index( innodb_table = indexed_table = dict_table_get(prebuilt->table->name, FALSE); + if (UNIV_UNLIKELY(!innodb_table)) { + error = HA_ERR_NO_SUCH_TABLE; + goto err_exit; + } + /* Check if the index name is reserved. */ if (innobase_index_name_is_reserved(trx, key_info, num_of_keys)) { error = -1; } else { /* Check that index keys are sensible */ - error = innobase_check_index_keys(key_info, num_of_keys); + error = innobase_check_index_keys(key_info, num_of_keys, + innodb_table); } if (UNIV_UNLIKELY(error)) { @@ -708,6 +722,8 @@ err_exit: row_mysql_lock_data_dictionary(trx); dict_locked = TRUE; + ut_d(dict_table_check_for_dup_indexes(innodb_table, FALSE)); + /* If a new primary key is defined for the table we need to drop the original table and rebuild all indexes. */ @@ -740,6 +756,8 @@ err_exit: user_thd); } + ut_d(dict_table_check_for_dup_indexes(innodb_table, + FALSE)); row_mysql_unlock_data_dictionary(trx); goto err_exit; } @@ -764,6 +782,10 @@ err_exit: ut_ad(error == DB_SUCCESS); + /* We will need to rebuild index translation table. Set + valid index entry count in the translation table to zero */ + share->idx_trans_tbl.index_count = 0; + /* Commit the data dictionary transaction in order to release the table locks on the system tables. This means that if MySQL crashes while creating a new primary key inside @@ -799,18 +821,6 @@ err_exit: index, num_of_idx, table); error_handling: -#ifdef UNIV_DEBUG - /* TODO: At the moment we can't handle the following statement - in our debugging code below: - - alter table t drop index b, add index (b); - - The fix will have to parse the SQL and note that the index - being added has the same name as the one being dropped and - ignore that in the dup index check.*/ - //dict_table_check_for_dup_indexes(prebuilt->table); -#endif - /* After an error, remove all those index definitions from the dictionary which were defined. */ @@ -822,6 +832,8 @@ error_handling: row_mysql_lock_data_dictionary(trx); dict_locked = TRUE; + ut_d(dict_table_check_for_dup_indexes(prebuilt->table, TRUE)); + if (!new_primary) { error = row_merge_rename_indexes(trx, indexed_table); @@ -909,6 +921,7 @@ convert_error: } if (dict_locked) { + ut_d(dict_table_check_for_dup_indexes(innodb_table, FALSE)); row_mysql_unlock_data_dictionary(trx); } @@ -951,6 +964,7 @@ ha_innobase::prepare_drop_index( /* Test and mark all the indexes to be dropped */ row_mysql_lock_data_dictionary(trx); + ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE)); /* Check that none of the indexes have previously been flagged for deletion. */ @@ -1116,6 +1130,7 @@ func_exit: } while (index); } + ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE)); row_mysql_unlock_data_dictionary(trx); DBUG_RETURN(err); @@ -1162,6 +1177,7 @@ ha_innobase::final_drop_index( prebuilt->table->flags, user_thd); row_mysql_lock_data_dictionary(trx); + ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE)); if (UNIV_UNLIKELY(err)) { @@ -1198,11 +1214,12 @@ ha_innobase::final_drop_index( ut_a(!index->to_be_dropped); } -#ifdef UNIV_DEBUG - dict_table_check_for_dup_indexes(prebuilt->table); -#endif + /* We will need to rebuild index translation table. Set + valid index entry count in the translation table to zero */ + share->idx_trans_tbl.index_count = 0; func_exit: + ut_d(dict_table_check_for_dup_indexes(prebuilt->table, FALSE)); trx_commit_for_mysql(trx); trx_commit_for_mysql(prebuilt->trx); row_mysql_unlock_data_dictionary(trx); diff --git a/storage/innodb_plugin/handler/i_s.cc b/storage/innodb_plugin/handler/i_s.cc index 6ae1d09a7d2..524fe696de2 100644 --- a/storage/innodb_plugin/handler/i_s.cc +++ b/storage/innodb_plugin/handler/i_s.cc @@ -455,59 +455,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_trx = STRUCT_FLD(__reserved1, NULL) }; -UNIV_INTERN struct st_maria_plugin i_s_innodb_trx_maria = -{ - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - /* int */ - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), - - /* pointer to type-specific plugin descriptor */ - /* void* */ - STRUCT_FLD(info, &i_s_info), - - /* plugin name */ - /* const char* */ - STRUCT_FLD(name, "INNODB_TRX"), - - /* plugin author (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(author, plugin_author), - - /* general descriptive text (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(descr, "InnoDB transactions"), - - /* the plugin license (PLUGIN_LICENSE_XXX) */ - /* int */ - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), - - /* the function to invoke when plugin is loaded */ - /* int (*)(void*); */ - STRUCT_FLD(init, innodb_trx_init), - - /* the function to invoke when plugin is unloaded */ - /* int (*)(void*); */ - STRUCT_FLD(deinit, i_s_common_deinit), - - /* plugin version (for SHOW PLUGINS) */ - /* unsigned int */ - STRUCT_FLD(version, INNODB_VERSION_SHORT), - - /* struct st_mysql_show_var* */ - STRUCT_FLD(status_vars, NULL), - - /* struct st_mysql_sys_var** */ - STRUCT_FLD(system_vars, NULL), - - /* string version */ - /* const char * */ - STRUCT_FLD(version_info, "1.0"), - - /* Maturity */ - /* int */ - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE) -}; - /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */ static ST_FIELD_INFO innodb_locks_fields_info[] = { @@ -783,59 +730,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_locks = STRUCT_FLD(__reserved1, NULL) }; -UNIV_INTERN struct st_maria_plugin i_s_innodb_locks_maria = -{ - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - /* int */ - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), - - /* pointer to type-specific plugin descriptor */ - /* void* */ - STRUCT_FLD(info, &i_s_info), - - /* plugin name */ - /* const char* */ - STRUCT_FLD(name, "INNODB_LOCKS"), - - /* plugin author (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(author, plugin_author), - - /* general descriptive text (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(descr, "InnoDB conflicting locks"), - - /* the plugin license (PLUGIN_LICENSE_XXX) */ - /* int */ - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), - - /* the function to invoke when plugin is loaded */ - /* int (*)(void*); */ - STRUCT_FLD(init, innodb_locks_init), - - /* the function to invoke when plugin is unloaded */ - /* int (*)(void*); */ - STRUCT_FLD(deinit, i_s_common_deinit), - - /* plugin version (for SHOW PLUGINS) */ - /* unsigned int */ - STRUCT_FLD(version, INNODB_VERSION_SHORT), - - /* struct st_mysql_show_var* */ - STRUCT_FLD(status_vars, NULL), - - /* struct st_mysql_sys_var** */ - STRUCT_FLD(system_vars, NULL), - - /* string version */ - /* const char * */ - STRUCT_FLD(version_info, "1.0"), - - /* Maturity */ - /* int */ - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE) -}; - /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */ static ST_FIELD_INFO innodb_lock_waits_fields_info[] = { @@ -1019,59 +913,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_lock_waits = STRUCT_FLD(__reserved1, NULL) }; -UNIV_INTERN struct st_maria_plugin i_s_innodb_lock_waits_maria = -{ - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - /* int */ - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), - - /* pointer to type-specific plugin descriptor */ - /* void* */ - STRUCT_FLD(info, &i_s_info), - - /* plugin name */ - /* const char* */ - STRUCT_FLD(name, "INNODB_LOCK_WAITS"), - - /* plugin author (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(author, "Innobase Oy"), - - /* general descriptive text (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(descr, "InnoDB which lock is blocking which"), - - /* the plugin license (PLUGIN_LICENSE_XXX) */ - /* int */ - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), - - /* the function to invoke when plugin is loaded */ - /* int (*)(void*); */ - STRUCT_FLD(init, innodb_lock_waits_init), - - /* the function to invoke when plugin is unloaded */ - /* int (*)(void*); */ - STRUCT_FLD(deinit, i_s_common_deinit), - - /* plugin version (for SHOW PLUGINS) */ - /* unsigned int */ - STRUCT_FLD(version, INNODB_VERSION_SHORT), - - /* struct st_mysql_show_var* */ - STRUCT_FLD(status_vars, NULL), - - /* struct st_mysql_sys_var** */ - STRUCT_FLD(system_vars, NULL), - - /* string version */ - /* const char * */ - STRUCT_FLD(version_info, "1.0"), - - /* Maturity */ - /* int */ - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE) -}; - /*******************************************************************//** Common function to fill any of the dynamic tables: INFORMATION_SCHEMA.innodb_trx @@ -1404,59 +1245,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp = STRUCT_FLD(__reserved1, NULL) }; -UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_maria = -{ - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - /* int */ - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), - - /* pointer to type-specific plugin descriptor */ - /* void* */ - STRUCT_FLD(info, &i_s_info), - - /* plugin name */ - /* const char* */ - STRUCT_FLD(name, "INNODB_CMP"), - - /* plugin author (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(author, plugin_author), - - /* general descriptive text (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(descr, "Statistics for the InnoDB compression"), - - /* the plugin license (PLUGIN_LICENSE_XXX) */ - /* int */ - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), - - /* the function to invoke when plugin is loaded */ - /* int (*)(void*); */ - STRUCT_FLD(init, i_s_cmp_init), - - /* the function to invoke when plugin is unloaded */ - /* int (*)(void*); */ - STRUCT_FLD(deinit, i_s_common_deinit), - - /* plugin version (for SHOW PLUGINS) */ - /* unsigned int */ - STRUCT_FLD(version, INNODB_VERSION_SHORT), - - /* struct st_mysql_show_var* */ - STRUCT_FLD(status_vars, NULL), - - /* struct st_mysql_sys_var** */ - STRUCT_FLD(system_vars, NULL), - - /* string version */ - /* const char * */ - STRUCT_FLD(version_info, "1.0"), - - /* Maturity */ - /* int */ - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE) -}; - UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_reset = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ @@ -1507,60 +1295,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_reset = STRUCT_FLD(__reserved1, NULL) }; -UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset_maria = -{ - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - /* int */ - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), - - /* pointer to type-specific plugin descriptor */ - /* void* */ - STRUCT_FLD(info, &i_s_info), - - /* plugin name */ - /* const char* */ - STRUCT_FLD(name, "INNODB_CMP_RESET"), - - /* plugin author (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(author, plugin_author), - - /* general descriptive text (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(descr, "Statistics for the InnoDB compression;" - " reset cumulated counts"), - - /* the plugin license (PLUGIN_LICENSE_XXX) */ - /* int */ - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), - - /* the function to invoke when plugin is loaded */ - /* int (*)(void*); */ - STRUCT_FLD(init, i_s_cmp_reset_init), - - /* the function to invoke when plugin is unloaded */ - /* int (*)(void*); */ - STRUCT_FLD(deinit, i_s_common_deinit), - - /* plugin version (for SHOW PLUGINS) */ - /* unsigned int */ - STRUCT_FLD(version, INNODB_VERSION_SHORT), - - /* struct st_mysql_show_var* */ - STRUCT_FLD(status_vars, NULL), - - /* struct st_mysql_sys_var** */ - STRUCT_FLD(system_vars, NULL), - - /* string version */ - /* const char * */ - STRUCT_FLD(version_info, "1.0"), - - /* Maturity */ - /* int */ - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE) -}; - /* Fields of the dynamic table information_schema.innodb_cmpmem. */ static ST_FIELD_INFO i_s_cmpmem_fields_info[] = { @@ -1777,59 +1511,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem = STRUCT_FLD(__reserved1, NULL) }; -UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_maria = -{ - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - /* int */ - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), - - /* pointer to type-specific plugin descriptor */ - /* void* */ - STRUCT_FLD(info, &i_s_info), - - /* plugin name */ - /* const char* */ - STRUCT_FLD(name, "INNODB_CMPMEM"), - - /* plugin author (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(author, plugin_author), - - /* general descriptive text (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(descr, "Statistics for the InnoDB compressed buffer pool"), - - /* the plugin license (PLUGIN_LICENSE_XXX) */ - /* int */ - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), - - /* the function to invoke when plugin is loaded */ - /* int (*)(void*); */ - STRUCT_FLD(init, i_s_cmpmem_init), - - /* the function to invoke when plugin is unloaded */ - /* int (*)(void*); */ - STRUCT_FLD(deinit, i_s_common_deinit), - - /* plugin version (for SHOW PLUGINS) */ - /* unsigned int */ - STRUCT_FLD(version, INNODB_VERSION_SHORT), - - /* struct st_mysql_show_var* */ - STRUCT_FLD(status_vars, NULL), - - /* struct st_mysql_sys_var** */ - STRUCT_FLD(system_vars, NULL), - - /* string version */ - /* const char * */ - STRUCT_FLD(version_info, "1.0"), - - /* Maturity */ - /* int */ - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE) -}; - UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem_reset = { /* the plugin type (a MYSQL_XXX_PLUGIN value) */ @@ -1880,60 +1561,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem_reset = STRUCT_FLD(__reserved1, NULL) }; -UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset_maria = -{ - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - /* int */ - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), - - /* pointer to type-specific plugin descriptor */ - /* void* */ - STRUCT_FLD(info, &i_s_info), - - /* plugin name */ - /* const char* */ - STRUCT_FLD(name, "INNODB_CMPMEM_RESET"), - - /* plugin author (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(author, plugin_author), - - /* general descriptive text (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(descr, "Statistics for the InnoDB compressed buffer pool;" - " reset cumulated counts"), - - /* the plugin license (PLUGIN_LICENSE_XXX) */ - /* int */ - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), - - /* the function to invoke when plugin is loaded */ - /* int (*)(void*); */ - STRUCT_FLD(init, i_s_cmpmem_reset_init), - - /* the function to invoke when plugin is unloaded */ - /* int (*)(void*); */ - STRUCT_FLD(deinit, i_s_common_deinit), - - /* plugin version (for SHOW PLUGINS) */ - /* unsigned int */ - STRUCT_FLD(version, INNODB_VERSION_SHORT), - - /* struct st_mysql_show_var* */ - STRUCT_FLD(status_vars, NULL), - - /* struct st_mysql_sys_var** */ - STRUCT_FLD(system_vars, NULL), - - /* string version */ - /* const char * */ - STRUCT_FLD(version_info, "1.0"), - - /* Maturity */ - /* int */ - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE) -}; - /*******************************************************************//** Unbind a dynamic INFORMATION_SCHEMA table. @return 0 on success */ diff --git a/storage/innodb_plugin/ibuf/ibuf0ibuf.c b/storage/innodb_plugin/ibuf/ibuf0ibuf.c index 08986fac0ef..5e9b4b27611 100644 --- a/storage/innodb_plugin/ibuf/ibuf0ibuf.c +++ b/storage/innodb_plugin/ibuf/ibuf0ibuf.c @@ -730,24 +730,41 @@ page containing the descriptor bits for the file page; the bitmap page is x-latched */ static page_t* -ibuf_bitmap_get_map_page( -/*=====================*/ - ulint space, /*!< in: space id of the file page */ - ulint page_no,/*!< in: page number of the file page */ - ulint zip_size,/*!< in: compressed page size in bytes; - 0 for uncompressed pages */ - mtr_t* mtr) /*!< in: mtr */ +ibuf_bitmap_get_map_page_func( +/*==========================*/ + ulint space, /*!< in: space id of the file page */ + ulint page_no,/*!< in: page number of the file page */ + ulint zip_size,/*!< in: compressed page size in bytes; + 0 for uncompressed pages */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ + mtr_t* mtr) /*!< in: mtr */ { buf_block_t* block; - block = buf_page_get(space, zip_size, - ibuf_bitmap_page_no_calc(zip_size, page_no), - RW_X_LATCH, mtr); + block = buf_page_get_gen(space, zip_size, + ibuf_bitmap_page_no_calc(zip_size, page_no), + RW_X_LATCH, NULL, BUF_GET, + file, line, mtr); buf_block_dbg_add_level(block, SYNC_IBUF_BITMAP); return(buf_block_get_frame(block)); } +/********************************************************************//** +Gets the ibuf bitmap page where the bits describing a given file page are +stored. +@return bitmap page where the file page is mapped, that is, the bitmap +page containing the descriptor bits for the file page; the bitmap page +is x-latched +@param space in: space id of the file page +@param page_no in: page number of the file page +@param zip_size in: compressed page size in bytes; 0 for uncompressed pages +@param mtr in: mini-transaction */ +#define ibuf_bitmap_get_map_page(space, page_no, zip_size, mtr) \ + ibuf_bitmap_get_map_page_func(space, page_no, zip_size, \ + __FILE__, __LINE__, mtr) + /************************************************************************//** Sets the free bits of the page in the ibuf bitmap. This is done in a separate mini-transaction, hence this operation does not restrict further work to only diff --git a/storage/innodb_plugin/include/btr0btr.h b/storage/innodb_plugin/include/btr0btr.h index d5c8258513c..5e6a76c7d21 100644 --- a/storage/innodb_plugin/include/btr0btr.h +++ b/storage/innodb_plugin/include/btr0btr.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -193,6 +193,10 @@ btr_leaf_page_release( mtr_t* mtr); /*!< in: mtr */ /**************************************************************//** Gets the child node file address in a node pointer. +NOTE: the offsets array must contain all offsets for the record since +we read the last field according to offsets and assume that it contains +the child page number. In other words offsets must have been retrieved +with rec_get_offsets(n_fields=ULINT_UNDEFINED). @return child node address */ UNIV_INLINE ulint @@ -317,12 +321,16 @@ Inserts a data tuple to a tree on a non-leaf level. It is assumed that mtr holds an x-latch on the tree. */ UNIV_INTERN void -btr_insert_on_non_leaf_level( -/*=========================*/ +btr_insert_on_non_leaf_level_func( +/*==============================*/ dict_index_t* index, /*!< in: index */ ulint level, /*!< in: level, must be > 0 */ dtuple_t* tuple, /*!< in: the record to be inserted */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ +# define btr_insert_on_non_leaf_level(i,l,t,m) \ + btr_insert_on_non_leaf_level_func(i,l,t,__FILE__,__LINE__,m) #endif /* !UNIV_HOTBACKUP */ /****************************************************************//** Sets a record as the predefined minimum record. */ diff --git a/storage/innodb_plugin/include/btr0btr.ic b/storage/innodb_plugin/include/btr0btr.ic index 2259d22c9a6..97944cc2e26 100644 --- a/storage/innodb_plugin/include/btr0btr.ic +++ b/storage/innodb_plugin/include/btr0btr.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -255,6 +255,10 @@ btr_page_set_prev( /**************************************************************//** Gets the child node file address in a node pointer. +NOTE: the offsets array must contain all offsets for the record since +we read the last field according to offsets and assume that it contains +the child page number. In other words offsets must have been retrieved +with rec_get_offsets(n_fields=ULINT_UNDEFINED). @return child node address */ UNIV_INLINE ulint diff --git a/storage/innodb_plugin/include/btr0cur.h b/storage/innodb_plugin/include/btr0cur.h index 480a3877e54..716f15c4267 100644 --- a/storage/innodb_plugin/include/btr0cur.h +++ b/storage/innodb_plugin/include/btr0cur.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -152,29 +152,39 @@ btr_cur_search_to_nth_level( ulint has_search_latch,/*!< in: latch mode the caller currently has on btr_search_latch: RW_S_LATCH, or 0 */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ /*****************************************************************//** Opens a cursor at either end of an index. */ UNIV_INTERN void -btr_cur_open_at_index_side( -/*=======================*/ +btr_cur_open_at_index_side_func( +/*============================*/ ibool from_left, /*!< in: TRUE if open to the low end, FALSE if to the high end */ dict_index_t* index, /*!< in: index */ ulint latch_mode, /*!< in: latch mode */ btr_cur_t* cursor, /*!< in: cursor */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ +#define btr_cur_open_at_index_side(f,i,l,c,m) \ + btr_cur_open_at_index_side_func(f,i,l,c,__FILE__,__LINE__,m) /**********************************************************************//** Positions a cursor at a randomly chosen position within a B-tree. */ UNIV_INTERN void -btr_cur_open_at_rnd_pos( -/*====================*/ +btr_cur_open_at_rnd_pos_func( +/*=========================*/ dict_index_t* index, /*!< in: index */ ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ btr_cur_t* cursor, /*!< in/out: B-tree cursor */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ +#define btr_cur_open_at_rnd_pos(i,l,c,m) \ + btr_cur_open_at_rnd_pos_func(i,l,c,__FILE__,__LINE__,m) /*************************************************************//** Tries to perform an insert to a page in an index tree, next to cursor. It is assumed that mtr holds an x-latch on the page. The operation does diff --git a/storage/innodb_plugin/include/btr0pcur.h b/storage/innodb_plugin/include/btr0pcur.h index 12b1375d8b7..2334a266280 100644 --- a/storage/innodb_plugin/include/btr0pcur.h +++ b/storage/innodb_plugin/include/btr0pcur.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -82,8 +82,8 @@ Initializes and opens a persistent cursor to an index tree. It should be closed with btr_pcur_close. */ UNIV_INLINE void -btr_pcur_open( -/*==========*/ +btr_pcur_open_func( +/*===============*/ dict_index_t* index, /*!< in: index */ const dtuple_t* tuple, /*!< in: tuple on which search done */ ulint mode, /*!< in: PAGE_CUR_L, ...; @@ -94,14 +94,18 @@ btr_pcur_open( record! */ ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ +#define btr_pcur_open(i,t,md,l,c,m) \ + btr_pcur_open_func(i,t,md,l,c,__FILE__,__LINE__,m) /**************************************************************//** Opens an persistent cursor to an index tree without initializing the cursor. */ UNIV_INLINE void -btr_pcur_open_with_no_init( -/*=======================*/ +btr_pcur_open_with_no_init_func( +/*============================*/ dict_index_t* index, /*!< in: index */ const dtuple_t* tuple, /*!< in: tuple on which search done */ ulint mode, /*!< in: PAGE_CUR_L, ...; @@ -119,7 +123,12 @@ btr_pcur_open_with_no_init( ulint has_search_latch,/*!< in: latch mode the caller currently has on btr_search_latch: RW_S_LATCH, or 0 */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ +#define btr_pcur_open_with_no_init(ix,t,md,l,cur,has,m) \ + btr_pcur_open_with_no_init_func(ix,t,md,l,cur,has,__FILE__,__LINE__,m) + /*****************************************************************//** Opens a persistent cursor at either end of an index. */ UNIV_INLINE @@ -160,8 +169,8 @@ before first in tree. The latching mode must be BTR_SEARCH_LEAF or BTR_MODIFY_LEAF. */ UNIV_INTERN void -btr_pcur_open_on_user_rec( -/*======================*/ +btr_pcur_open_on_user_rec_func( +/*===========================*/ dict_index_t* index, /*!< in: index */ const dtuple_t* tuple, /*!< in: tuple on which search done */ ulint mode, /*!< in: PAGE_CUR_L, ... */ @@ -169,17 +178,25 @@ btr_pcur_open_on_user_rec( BTR_MODIFY_LEAF */ btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ +#define btr_pcur_open_on_user_rec(i,t,md,l,c,m) \ + btr_pcur_open_on_user_rec_func(i,t,md,l,c,__FILE__,__LINE__,m) /**********************************************************************//** Positions a cursor at a randomly chosen position within a B-tree. */ UNIV_INLINE void -btr_pcur_open_at_rnd_pos( -/*=====================*/ +btr_pcur_open_at_rnd_pos_func( +/*==========================*/ dict_index_t* index, /*!< in: index */ ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in/out: B-tree pcur */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ +#define btr_pcur_open_at_rnd_pos(i,l,c,m) \ + btr_pcur_open_at_rnd_pos_func(i,l,c,__FILE__,__LINE__,m) /**************************************************************//** Frees the possible old_rec_buf buffer of a persistent cursor and sets the latch mode of the persistent cursor to BTR_NO_LATCHES. */ @@ -218,11 +235,15 @@ record and it can be restored on a user record whose ordering fields are identical to the ones of the original user record */ UNIV_INTERN ibool -btr_pcur_restore_position( -/*======================*/ +btr_pcur_restore_position_func( +/*===========================*/ ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in: detached persistent cursor */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr); /*!< in: mtr */ +#define btr_pcur_restore_position(l,cur,mtr) \ + btr_pcur_restore_position_func(l,cur,__FILE__,__LINE__,mtr) /**************************************************************//** If the latch mode of the cursor is BTR_LEAF_SEARCH or BTR_LEAF_MODIFY, releases the page latch and bufferfix reserved by the cursor. @@ -260,20 +281,13 @@ btr_pcur_get_mtr( /*=============*/ btr_pcur_t* cursor); /*!< in: persistent cursor */ /**************************************************************//** -Commits the pcur mtr and sets the pcur latch mode to BTR_NO_LATCHES, +Commits the mtr and sets the pcur latch mode to BTR_NO_LATCHES, that is, the cursor becomes detached. If there have been modifications to the page where pcur is positioned, this can be used instead of btr_pcur_release_leaf. Function btr_pcur_store_position should be used before calling this, if restoration of cursor is wanted later. */ UNIV_INLINE void -btr_pcur_commit( -/*============*/ - btr_pcur_t* pcur); /*!< in: persistent cursor */ -/**************************************************************//** -Differs from btr_pcur_commit in that we can specify the mtr to commit. */ -UNIV_INLINE -void btr_pcur_commit_specify_mtr( /*========================*/ btr_pcur_t* pcur, /*!< in: persistent cursor */ diff --git a/storage/innodb_plugin/include/btr0pcur.ic b/storage/innodb_plugin/include/btr0pcur.ic index 0ca7223f861..0c38797e6c5 100644 --- a/storage/innodb_plugin/include/btr0pcur.ic +++ b/storage/innodb_plugin/include/btr0pcur.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -395,30 +395,13 @@ btr_pcur_move_to_next( } /**************************************************************//** -Commits the pcur mtr and sets the pcur latch mode to BTR_NO_LATCHES, +Commits the mtr and sets the pcur latch mode to BTR_NO_LATCHES, that is, the cursor becomes detached. If there have been modifications to the page where pcur is positioned, this can be used instead of btr_pcur_release_leaf. Function btr_pcur_store_position should be used before calling this, if restoration of cursor is wanted later. */ UNIV_INLINE void -btr_pcur_commit( -/*============*/ - btr_pcur_t* pcur) /*!< in: persistent cursor */ -{ - ut_a(pcur->pos_state == BTR_PCUR_IS_POSITIONED); - - pcur->latch_mode = BTR_NO_LATCHES; - - mtr_commit(pcur->mtr); - - pcur->pos_state = BTR_PCUR_WAS_POSITIONED; -} - -/**************************************************************//** -Differs from btr_pcur_commit in that we can specify the mtr to commit. */ -UNIV_INLINE -void btr_pcur_commit_specify_mtr( /*========================*/ btr_pcur_t* pcur, /*!< in: persistent cursor */ @@ -483,8 +466,8 @@ Initializes and opens a persistent cursor to an index tree. It should be closed with btr_pcur_close. */ UNIV_INLINE void -btr_pcur_open( -/*==========*/ +btr_pcur_open_func( +/*===============*/ dict_index_t* index, /*!< in: index */ const dtuple_t* tuple, /*!< in: tuple on which search done */ ulint mode, /*!< in: PAGE_CUR_L, ...; @@ -495,6 +478,8 @@ btr_pcur_open( record! */ ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { btr_cur_t* btr_cursor; @@ -511,7 +496,7 @@ btr_pcur_open( btr_cursor = btr_pcur_get_btr_cur(cursor); btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode, - btr_cursor, 0, mtr); + btr_cursor, 0, file, line, mtr); cursor->pos_state = BTR_PCUR_IS_POSITIONED; cursor->trx_if_known = NULL; @@ -522,8 +507,8 @@ Opens an persistent cursor to an index tree without initializing the cursor. */ UNIV_INLINE void -btr_pcur_open_with_no_init( -/*=======================*/ +btr_pcur_open_with_no_init_func( +/*============================*/ dict_index_t* index, /*!< in: index */ const dtuple_t* tuple, /*!< in: tuple on which search done */ ulint mode, /*!< in: PAGE_CUR_L, ...; @@ -541,6 +526,8 @@ btr_pcur_open_with_no_init( ulint has_search_latch,/*!< in: latch mode the caller currently has on btr_search_latch: RW_S_LATCH, or 0 */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { btr_cur_t* btr_cursor; @@ -553,7 +540,8 @@ btr_pcur_open_with_no_init( btr_cursor = btr_pcur_get_btr_cur(cursor); btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode, - btr_cursor, has_search_latch, mtr); + btr_cursor, has_search_latch, + file, line, mtr); cursor->pos_state = BTR_PCUR_IS_POSITIONED; cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; @@ -600,11 +588,13 @@ btr_pcur_open_at_index_side( Positions a cursor at a randomly chosen position within a B-tree. */ UNIV_INLINE void -btr_pcur_open_at_rnd_pos( -/*=====================*/ +btr_pcur_open_at_rnd_pos_func( +/*==========================*/ dict_index_t* index, /*!< in: index */ ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ btr_pcur_t* cursor, /*!< in/out: B-tree pcur */ + const char* file, /*!< in: file name */ + ulint line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ { /* Initialize the cursor */ @@ -614,8 +604,9 @@ btr_pcur_open_at_rnd_pos( btr_pcur_init(cursor); - btr_cur_open_at_rnd_pos(index, latch_mode, - btr_pcur_get_btr_cur(cursor), mtr); + btr_cur_open_at_rnd_pos_func(index, latch_mode, + btr_pcur_get_btr_cur(cursor), + file, line, mtr); cursor->pos_state = BTR_PCUR_IS_POSITIONED; cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; diff --git a/storage/innodb_plugin/include/buf0buf.h b/storage/innodb_plugin/include/buf0buf.h index 927ff893e39..cd4ee5906f0 100644 --- a/storage/innodb_plugin/include/buf0buf.h +++ b/storage/innodb_plugin/include/buf0buf.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -33,6 +33,7 @@ Created 11/5/1995 Heikki Tuuri #include "hash0hash.h" #include "ut0byte.h" #include "page0types.h" +#include "ut0rbt.h" #ifndef UNIV_HOTBACKUP #include "os0proc.h" @@ -202,20 +203,14 @@ with care. */ #define buf_page_get_with_no_latch(SP, ZS, OF, MTR) buf_page_get_gen(\ SP, ZS, OF, RW_NO_LATCH, NULL,\ BUF_GET_NO_LATCH, __FILE__, __LINE__, MTR) -/**************************************************************//** -NOTE! The following macros should be used instead of -buf_page_optimistic_get_func, to improve debugging. Only values RW_S_LATCH and -RW_X_LATCH are allowed as LA! */ -#define buf_page_optimistic_get(LA, BL, MC, MTR) \ - buf_page_optimistic_get_func(LA, BL, MC, __FILE__, __LINE__, MTR) /********************************************************************//** This is the general function used to get optimistic access to a database page. @return TRUE if success */ UNIV_INTERN ibool -buf_page_optimistic_get_func( -/*=========================*/ +buf_page_optimistic_get( +/*====================*/ ulint rw_latch,/*!< in: RW_S_LATCH, RW_X_LATCH */ buf_block_t* block, /*!< in: guessed block */ ib_uint64_t modify_clock,/*!< in: modify clock value if mode is @@ -1185,15 +1180,21 @@ struct buf_block_struct{ rw_lock_t lock; /*!< read-write lock of the buffer frame */ unsigned lock_hash_val:32;/*!< hashed value of the page address - in the record lock hash table */ - unsigned check_index_page_at_flush:1; + in the record lock hash table; + protected by buf_block_t::lock + (or buf_block_t::mutex, buf_pool_mutex + in buf_page_get_gen(), + buf_page_init_for_read() + and buf_page_create()) */ + ibool check_index_page_at_flush; /*!< TRUE if we know that this is an index page, and want the database to check its consistency before flush; note that there may be pages in the buffer pool which are index pages, but this flag is not set because - we do not keep track of all pages */ + we do not keep track of all pages; + NOT protected by any mutex */ /* @} */ /** @name Optimistic search field */ /* @{ */ @@ -1359,6 +1360,19 @@ struct buf_pool_struct{ /*!< this is in the set state when there is no flush batch of the given type running */ + ib_rbt_t* flush_rbt; /* !< a red-black tree is used + exclusively during recovery to + speed up insertions in the + flush_list. This tree contains + blocks in order of + oldest_modification LSN and is + kept in sync with the + flush_list. + Each member of the tree MUST + also be on the flush_list. + This tree is relevant only in + recovery and is set to NULL + once the recovery is over. */ ulint freed_page_clock;/*!< a sequence number used to count the number of buffer blocks removed from the end of diff --git a/storage/innodb_plugin/include/buf0buf.ic b/storage/innodb_plugin/include/buf0buf.ic index 0f92a59a1c7..378c3590181 100644 --- a/storage/innodb_plugin/include/buf0buf.ic +++ b/storage/innodb_plugin/include/buf0buf.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -81,7 +81,7 @@ buf_page_peek_if_too_old( unsigned access_time = buf_page_is_accessed(bpage); if (access_time > 0 - && (ut_time_ms() - access_time) + && ((ib_uint32_t) (ut_time_ms() - access_time)) >= buf_LRU_old_threshold_ms) { return(TRUE); } @@ -705,6 +705,12 @@ buf_block_get_lock_hash_val( /*========================*/ const buf_block_t* block) /*!< in: block */ { + ut_ad(block); + ut_ad(buf_page_in_file(&block->page)); +#ifdef UNIV_SYNC_DEBUG + ut_ad(rw_lock_own(&(((buf_block_t*) block)->lock), RW_LOCK_EXCLUSIVE) + || rw_lock_own(&(((buf_block_t*) block)->lock), RW_LOCK_SHARED)); +#endif /* UNIV_SYNC_DEBUG */ return(block->lock_hash_val); } diff --git a/storage/innodb_plugin/include/buf0flu.h b/storage/innodb_plugin/include/buf0flu.h index 6c751852f54..c996f6eaab4 100644 --- a/storage/innodb_plugin/include/buf0flu.h +++ b/storage/innodb_plugin/include/buf0flu.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -40,6 +40,16 @@ buf_flush_remove( /*=============*/ buf_page_t* bpage); /*!< in: pointer to the block in question */ /********************************************************************//** +Relocates a buffer control block on the flush_list. +Note that it is assumed that the contents of bpage has already been +copied to dpage. */ +UNIV_INTERN +void +buf_flush_relocate_on_flush_list( +/*=============================*/ + buf_page_t* bpage, /*!< in/out: control block being moved */ + buf_page_t* dpage); /*!< in/out: destination block */ +/********************************************************************//** Updates the flush system data structures when a write is completed. */ UNIV_INTERN void @@ -139,8 +149,8 @@ how much redo the workload is generating and at what rate. */ struct buf_flush_stat_struct { - ib_uint64_t redo; /**< amount of redo generated. */ - ulint n_flushed; /**< number of pages flushed. */ + ib_uint64_t redo; /*!< amount of redo generated. */ + ulint n_flushed; /*!< number of pages flushed. */ }; /** Statistics for selecting flush rate of dirty pages. */ @@ -175,6 +185,22 @@ buf_flush_validate(void); /*====================*/ #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ +/******************************************************************//** +Initialize the red-black tree to speed up insertions into the flush_list +during recovery process. Should be called at the start of recovery +process before any page has been read/written. */ +UNIV_INTERN +void +buf_flush_init_flush_rbt(void); +/*==========================*/ + +/******************************************************************//** +Frees up the red-black tree. */ +UNIV_INTERN +void +buf_flush_free_flush_rbt(void); +/*==========================*/ + /** When buf_flush_free_margin is called, it tries to make this many blocks available to replacement in the free list and at the end of the LRU list (to make sure that a read-ahead batch can be read efficiently in a single diff --git a/storage/innodb_plugin/include/data0type.ic b/storage/innodb_plugin/include/data0type.ic index 240b4288f39..2bf67a941bd 100644 --- a/storage/innodb_plugin/include/data0type.ic +++ b/storage/innodb_plugin/include/data0type.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -285,6 +285,10 @@ dtype_new_store_for_order_and_null_size( #endif ulint len; + ut_ad(type); + ut_ad(type->mtype >= DATA_VARCHAR); + ut_ad(type->mtype <= DATA_MYSQL); + buf[0] = (byte)(type->mtype & 0xFFUL); if (type->prtype & DATA_BINARY_TYPE) { diff --git a/storage/innodb_plugin/include/dict0boot.h b/storage/innodb_plugin/include/dict0boot.h index 51d37ee98d1..1a13bd1503a 100644 --- a/storage/innodb_plugin/include/dict0boot.h +++ b/storage/innodb_plugin/include/dict0boot.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -137,6 +137,7 @@ clustered index */ #define DICT_SYS_INDEXES_PAGE_NO_FIELD 8 #define DICT_SYS_INDEXES_SPACE_NO_FIELD 7 #define DICT_SYS_INDEXES_TYPE_FIELD 6 +#define DICT_SYS_INDEXES_NAME_FIELD 4 /* When a row id which is zero modulo this number (which must be a power of two) is assigned, the field DICT_HDR_ROW_ID on the dictionary header page is diff --git a/storage/innodb_plugin/include/dict0dict.h b/storage/innodb_plugin/include/dict0dict.h index 12396556c2d..79dcbb30de2 100644 --- a/storage/innodb_plugin/include/dict0dict.h +++ b/storage/innodb_plugin/include/dict0dict.h @@ -928,9 +928,10 @@ UNIV_INTERN void dict_table_check_for_dup_indexes( /*=============================*/ - const dict_table_t* table); /*!< in: Check for dup indexes + const dict_table_t* table, /*!< in: Check for dup indexes in this table */ - + ibool tmp_ok);/*!< in: TRUE=allow temporary + index names */ #endif /* UNIV_DEBUG */ /**********************************************************************//** Builds a node pointer out of a physical record and a page number. @@ -1060,6 +1061,22 @@ UNIV_INTERN void dict_mutex_exit_for_mysql(void); /*===========================*/ +/**********************************************************************//** +Lock the appropriate mutex to protect index->stat_n_diff_key_vals[]. +index->id is used to pick the right mutex and it should not change +before dict_index_stat_mutex_exit() is called on this index. */ +UNIV_INTERN +void +dict_index_stat_mutex_enter( +/*========================*/ + const dict_index_t* index); /*!< in: index */ +/**********************************************************************//** +Unlock the appropriate mutex that protects index->stat_n_diff_key_vals[]. */ +UNIV_INTERN +void +dict_index_stat_mutex_exit( +/*=======================*/ + const dict_index_t* index); /*!< in: index */ /********************************************************************//** Checks if the database name in two table names is the same. @return TRUE if same db name */ diff --git a/storage/innodb_plugin/include/dict0mem.h b/storage/innodb_plugin/include/dict0mem.h index 2d001111938..9996fb59a75 100644 --- a/storage/innodb_plugin/include/dict0mem.h +++ b/storage/innodb_plugin/include/dict0mem.h @@ -80,21 +80,39 @@ combination of types */ /** File format */ /* @{ */ #define DICT_TF_FORMAT_SHIFT 5 /* file format */ -#define DICT_TF_FORMAT_MASK (127 << DICT_TF_FORMAT_SHIFT) +#define DICT_TF_FORMAT_MASK \ +((~(~0 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT))) << DICT_TF_FORMAT_SHIFT) #define DICT_TF_FORMAT_51 0 /*!< InnoDB/MySQL up to 5.1 */ #define DICT_TF_FORMAT_ZIP 1 /*!< InnoDB plugin for 5.1: compressed tables, new BLOB treatment */ /** Maximum supported file format */ #define DICT_TF_FORMAT_MAX DICT_TF_FORMAT_ZIP - +/* @} */ #define DICT_TF_BITS 6 /*!< number of flag bits */ #if (1 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT)) <= DICT_TF_FORMAT_MAX # error "DICT_TF_BITS is insufficient for DICT_TF_FORMAT_MAX" #endif /* @} */ + +/** @brief Additional table flags. + +These flags will be stored in SYS_TABLES.MIX_LEN. All unused flags +will be written as 0. The column may contain garbage for tables +created with old versions of InnoDB that only implemented +ROW_FORMAT=REDUNDANT. */ +/* @{ */ +#define DICT_TF2_SHIFT DICT_TF_BITS + /*!< Shift value for + table->flags. */ +#define DICT_TF2_TEMPORARY 1 /*!< TRUE for tables from + CREATE TEMPORARY TABLE. */ +#define DICT_TF2_BITS (DICT_TF2_SHIFT + 1) + /*!< Total number of bits + in table->flags. */ /* @} */ + /**********************************************************************//** Creates a table memory object. @return own: table object */ @@ -374,7 +392,7 @@ struct dict_table_struct{ unsigned space:32; /*!< space where the clustered index of the table is placed */ - unsigned flags:DICT_TF_BITS;/*!< DICT_TF_COMPACT, ... */ + unsigned flags:DICT_TF2_BITS;/*!< DICT_TF_COMPACT, ... */ unsigned ibd_file_missing:1; /*!< TRUE if this is in a single-table tablespace and the .ibd file is missing; then diff --git a/storage/innodb_plugin/include/fil0fil.h b/storage/innodb_plugin/include/fil0fil.h index 74d0fbcdacd..de8ef9e9687 100644 --- a/storage/innodb_plugin/include/fil0fil.h +++ b/storage/innodb_plugin/include/fil0fil.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -110,9 +110,10 @@ extern fil_addr_t fil_addr_null; contents of this field is valid for all uncompressed pages. */ #define FIL_PAGE_FILE_FLUSH_LSN 26 /*!< this is only defined for the - first page in a data file: the file - has been flushed to disk at least up - to this lsn */ + first page in a system tablespace + data file (ibdata*, not *.ibd): + the file has been flushed to disk + at least up to this lsn */ #define FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID 34 /*!< starting from 4.1.x this contains the space id of the page */ #define FIL_PAGE_DATA 38 /*!< start of the data on the page */ diff --git a/storage/innodb_plugin/include/hash0hash.h b/storage/innodb_plugin/include/hash0hash.h index 977cb829f35..b17c21a45ef 100644 --- a/storage/innodb_plugin/include/hash0hash.h +++ b/storage/innodb_plugin/include/hash0hash.h @@ -434,11 +434,12 @@ struct hash_table_struct { these heaps */ #endif /* !UNIV_HOTBACKUP */ mem_heap_t* heap; +#ifdef UNIV_DEBUG ulint magic_n; +# define HASH_TABLE_MAGIC_N 76561114 +#endif /* UNIV_DEBUG */ }; -#define HASH_TABLE_MAGIC_N 76561114 - #ifndef UNIV_NONINL #include "hash0hash.ic" #endif diff --git a/storage/innodb_plugin/include/hash0hash.ic b/storage/innodb_plugin/include/hash0hash.ic index 19da2d50701..0b437894e2e 100644 --- a/storage/innodb_plugin/include/hash0hash.ic +++ b/storage/innodb_plugin/include/hash0hash.ic @@ -35,6 +35,8 @@ hash_get_nth_cell( hash_table_t* table, /*!< in: hash table */ ulint n) /*!< in: cell index */ { + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); ut_ad(n < table->n_cells); return(table->array + n); @@ -48,6 +50,8 @@ hash_table_clear( /*=============*/ hash_table_t* table) /*!< in/out: hash table */ { + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); memset(table->array, 0x0, table->n_cells * sizeof(*table->array)); } @@ -61,6 +65,8 @@ hash_get_n_cells( /*=============*/ hash_table_t* table) /*!< in: table */ { + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); return(table->n_cells); } @@ -74,6 +80,8 @@ hash_calc_hash( ulint fold, /*!< in: folded value */ hash_table_t* table) /*!< in: hash table */ { + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); return(ut_hash_ulint(fold, table->n_cells)); } @@ -88,6 +96,8 @@ hash_get_mutex_no( hash_table_t* table, /*!< in: hash table */ ulint fold) /*!< in: fold */ { + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); ut_ad(ut_is_2pow(table->n_mutexes)); return(ut_2pow_remainder(hash_calc_hash(fold, table), table->n_mutexes)); @@ -103,6 +113,8 @@ hash_get_nth_heap( hash_table_t* table, /*!< in: hash table */ ulint i) /*!< in: index of the heap */ { + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); ut_ad(i < table->n_mutexes); return(table->heaps[i]); @@ -120,6 +132,9 @@ hash_get_heap( { ulint i; + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); + if (table->heap) { return(table->heap); } @@ -139,6 +154,8 @@ hash_get_nth_mutex( hash_table_t* table, /*!< in: hash table */ ulint i) /*!< in: index of the mutex */ { + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); ut_ad(i < table->n_mutexes); return(table->mutexes + i); @@ -156,6 +173,9 @@ hash_get_mutex( { ulint i; + ut_ad(table); + ut_ad(table->magic_n == HASH_TABLE_MAGIC_N); + i = hash_get_mutex_no(table, fold); return(hash_get_nth_mutex(table, i)); diff --git a/storage/innodb_plugin/include/lock0lock.h b/storage/innodb_plugin/include/lock0lock.h index 82e4c9bd976..7d76cbe3c75 100644 --- a/storage/innodb_plugin/include/lock0lock.h +++ b/storage/innodb_plugin/include/lock0lock.h @@ -613,13 +613,16 @@ lock_rec_print( FILE* file, /*!< in: file where to print */ const lock_t* lock); /*!< in: record type lock */ /*********************************************************************//** -Prints info of locks for all transactions. */ +Prints info of locks for all transactions. +@return FALSE if not able to obtain kernel mutex +and exits without printing info */ UNIV_INTERN -void +ibool lock_print_info_summary( /*====================*/ - FILE* file); /*!< in: file where to print */ -/*********************************************************************//** + FILE* file, /*!< in: file where to print */ + ibool nowait);/*!< in: whether to wait for the kernel mutex */ +/************************************************************************* Prints info of locks for each transaction. */ UNIV_INTERN void diff --git a/storage/innodb_plugin/include/log0log.h b/storage/innodb_plugin/include/log0log.h index 135aeb69e2d..8fce4ef96bc 100644 --- a/storage/innodb_plugin/include/log0log.h +++ b/storage/innodb_plugin/include/log0log.h @@ -1,23 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA - -*****************************************************************************/ -/***************************************************************************** - -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2009, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -825,7 +808,17 @@ struct log_struct{ written to some log group; for this to be advanced, it is enough that the write i/o has been completed for all - log groups */ + log groups. + Note that since InnoDB currently + has only one log group therefore + this value is redundant. Also it + is possible that this value + falls behind the + flushed_to_disk_lsn transiently. + It is appropriate to use either + flushed_to_disk_lsn or + write_lsn which are always + up-to-date and accurate. */ ib_uint64_t write_lsn; /*!< end lsn for the current running write */ ulint write_end_offset;/*!< the data in buffer has diff --git a/storage/innodb_plugin/include/log0log.ic b/storage/innodb_plugin/include/log0log.ic index 36d151a3064..139f4041a36 100644 --- a/storage/innodb_plugin/include/log0log.ic +++ b/storage/innodb_plugin/include/log0log.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -314,12 +314,15 @@ log_reserve_and_write_fast( ulint data_len; #ifdef UNIV_LOG_LSN_DEBUG /* length of the LSN pseudo-record */ - ulint lsn_len = 1 - + mach_get_compressed_size(log_sys->lsn >> 32) - + mach_get_compressed_size(log_sys->lsn & 0xFFFFFFFFUL); + ulint lsn_len; #endif /* UNIV_LOG_LSN_DEBUG */ mutex_enter(&log_sys->mutex); +#ifdef UNIV_LOG_LSN_DEBUG + lsn_len = 1 + + mach_get_compressed_size(log_sys->lsn >> 32) + + mach_get_compressed_size(log_sys->lsn & 0xFFFFFFFFUL); +#endif /* UNIV_LOG_LSN_DEBUG */ data_len = len #ifdef UNIV_LOG_LSN_DEBUG diff --git a/storage/innodb_plugin/include/log0recv.h b/storage/innodb_plugin/include/log0recv.h index a3d2bd050f5..9f334a34b44 100644 --- a/storage/innodb_plugin/include/log0recv.h +++ b/storage/innodb_plugin/include/log0recv.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -176,6 +176,12 @@ UNIV_INTERN void recv_recovery_from_checkpoint_finish(void); /*======================================*/ +/********************************************************//** +Initiates the rollback of active transactions. */ +UNIV_INTERN +void +recv_recovery_rollback_active(void); +/*===============================*/ /*******************************************************//** Scans log from a buffer and stores new log data to the parsing buffer. Parses and hashes the log records if new data found. Unless @@ -258,12 +264,14 @@ void recv_sys_init( /*==========*/ ulint available_memory); /*!< in: available memory in bytes */ +#ifndef UNIV_HOTBACKUP /********************************************************//** Reset the state of the recovery system variables. */ UNIV_INTERN void recv_sys_var_init(void); /*===================*/ +#endif /* !UNIV_HOTBACKUP */ /*******************************************************************//** Empties the hash table of stored log records, applying them to appropriate pages. */ @@ -360,8 +368,8 @@ typedef struct recv_addr_struct recv_addr_t; struct recv_addr_struct{ enum recv_addr_state state; /*!< recovery state of the page */ - ulint space; /*!< space id */ - ulint page_no;/*!< page number */ + unsigned space:32;/*!< space id */ + unsigned page_no:32;/*!< page number */ UT_LIST_BASE_NODE_T(recv_t) rec_list;/*!< list of log records for this page */ hash_node_t addr_hash;/*!< hash node in the hash bucket chain */ diff --git a/storage/innodb_plugin/include/mem0dbg.h b/storage/innodb_plugin/include/mem0dbg.h index a064af5c678..d81e1418b2b 100644 --- a/storage/innodb_plugin/include/mem0dbg.h +++ b/storage/innodb_plugin/include/mem0dbg.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -28,6 +28,13 @@ Created 6/9/1994 Heikki Tuuri check fields whose sizes are given below */ #ifdef UNIV_MEM_DEBUG +# ifndef UNIV_HOTBACKUP +/* The mutex which protects in the debug version the hash table +containing the list of live memory heaps, and also the global +variables in mem0dbg.c. */ +extern mutex_t mem_hash_mutex; +# endif /* !UNIV_HOTBACKUP */ + #define MEM_FIELD_HEADER_SIZE ut_calc_align(2 * sizeof(ulint),\ UNIV_MEM_ALIGNMENT) #define MEM_FIELD_TRAILER_SIZE sizeof(ulint) diff --git a/storage/innodb_plugin/include/mem0dbg.ic b/storage/innodb_plugin/include/mem0dbg.ic index cb9245411dc..b0c8178a623 100644 --- a/storage/innodb_plugin/include/mem0dbg.ic +++ b/storage/innodb_plugin/include/mem0dbg.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -25,9 +25,6 @@ Created 6/8/1994 Heikki Tuuri *************************************************************************/ #ifdef UNIV_MEM_DEBUG -# ifndef UNIV_HOTBACKUP -extern mutex_t mem_hash_mutex; -# endif /* !UNIV_HOTBACKUP */ extern ulint mem_current_allocated_memory; /******************************************************************//** diff --git a/storage/innodb_plugin/include/mem0mem.h b/storage/innodb_plugin/include/mem0mem.h index 98f8748e529..ee28cf7b225 100644 --- a/storage/innodb_plugin/include/mem0mem.h +++ b/storage/innodb_plugin/include/mem0mem.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -359,6 +359,9 @@ struct mem_block_info_struct { to the heap is also the first block in this list, though it also contains the base node of the list. */ ulint len; /*!< physical length of this block in bytes */ + ulint total_size; /* physical length in bytes of all blocks + in the heap. This is defined only in the base + node and is set to ULINT_UNDEFINED in others. */ ulint type; /*!< type of heap: MEM_HEAP_DYNAMIC, or MEM_HEAP_BUF possibly ORed to MEM_HEAP_BTR_SEARCH */ ulint free; /*!< offset in bytes of the first free position for diff --git a/storage/innodb_plugin/include/mem0mem.ic b/storage/innodb_plugin/include/mem0mem.ic index e7080d8c508..cbce2edc661 100644 --- a/storage/innodb_plugin/include/mem0mem.ic +++ b/storage/innodb_plugin/include/mem0mem.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -579,18 +579,12 @@ mem_heap_get_size( /*==============*/ mem_heap_t* heap) /*!< in: heap */ { - mem_block_t* block; ulint size = 0; ut_ad(mem_heap_check(heap)); - block = heap; - - while (block != NULL) { + size = heap->total_size; - size += mem_block_get_len(block); - block = UT_LIST_GET_NEXT(list, block); - } #ifndef UNIV_HOTBACKUP if (heap->free_block) { size += UNIV_PAGE_SIZE; diff --git a/storage/innodb_plugin/include/mtr0mtr.ic b/storage/innodb_plugin/include/mtr0mtr.ic index 310c7c4117f..18f8e87b3cf 100644 --- a/storage/innodb_plugin/include/mtr0mtr.ic +++ b/storage/innodb_plugin/include/mtr0mtr.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -70,6 +70,7 @@ mtr_memo_push( ut_ad(type <= MTR_MEMO_X_LOCK); ut_ad(mtr); ut_ad(mtr->magic_n == MTR_MAGIC_N); + ut_ad(mtr->state == MTR_ACTIVE); memo = &(mtr->memo); @@ -92,6 +93,7 @@ mtr_set_savepoint( ut_ad(mtr); ut_ad(mtr->magic_n == MTR_MAGIC_N); + ut_ad(mtr->state == MTR_ACTIVE); memo = &(mtr->memo); @@ -149,6 +151,7 @@ mtr_memo_contains( ut_ad(mtr); ut_ad(mtr->magic_n == MTR_MAGIC_N); + ut_ad(mtr->state == MTR_ACTIVE || mtr->state == MTR_COMMITTING); memo = &(mtr->memo); diff --git a/storage/innodb_plugin/include/os0file.h b/storage/innodb_plugin/include/os0file.h index 16568579f31..d645cae38bb 100644 --- a/storage/innodb_plugin/include/os0file.h +++ b/storage/innodb_plugin/include/os0file.h @@ -1,23 +1,6 @@ -/***************************************************************************** - -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA - -*****************************************************************************/ /*********************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2009, Percona Inc. Portions of this file contain modifications contributed and copyrighted diff --git a/storage/innodb_plugin/include/que0que.h b/storage/innodb_plugin/include/que0que.h index 420f34550e2..39f8d07af89 100644 --- a/storage/innodb_plugin/include/que0que.h +++ b/storage/innodb_plugin/include/que0que.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -30,6 +30,7 @@ Created 5/27/1996 Heikki Tuuri #include "data0data.h" #include "dict0types.h" #include "trx0trx.h" +#include "trx0roll.h" #include "srv0srv.h" #include "usr0types.h" #include "que0types.h" @@ -215,6 +216,16 @@ trx_t* thr_get_trx( /*========*/ que_thr_t* thr); /*!< in: query thread */ +/*******************************************************************//** +Determines if this thread is rolling back an incomplete transaction +in crash recovery. +@return TRUE if thr is rolling back an incomplete transaction in crash +recovery */ +UNIV_INLINE +ibool +thr_is_recv( +/*========*/ + const que_thr_t* thr); /*!< in: query thread */ /***********************************************************************//** Gets the type of a graph node. */ UNIV_INLINE diff --git a/storage/innodb_plugin/include/que0que.ic b/storage/innodb_plugin/include/que0que.ic index a1c0dc1e77a..bd936670e1e 100644 --- a/storage/innodb_plugin/include/que0que.ic +++ b/storage/innodb_plugin/include/que0que.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -38,6 +38,20 @@ thr_get_trx( return(thr->graph->trx); } +/*******************************************************************//** +Determines if this thread is rolling back an incomplete transaction +in crash recovery. +@return TRUE if thr is rolling back an incomplete transaction in crash +recovery */ +UNIV_INLINE +ibool +thr_is_recv( +/*========*/ + const que_thr_t* thr) /*!< in: query thread */ +{ + return(trx_is_recv(thr->graph->trx)); +} + /***********************************************************************//** Gets the first thr in a fork. */ UNIV_INLINE diff --git a/storage/innodb_plugin/include/row0mysql.h b/storage/innodb_plugin/include/row0mysql.h index b05241f00f8..d2a8734c61f 100644 --- a/storage/innodb_plugin/include/row0mysql.h +++ b/storage/innodb_plugin/include/row0mysql.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2000, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 2000, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -451,6 +451,12 @@ row_drop_table_for_mysql( const char* name, /*!< in: table name */ trx_t* trx, /*!< in: transaction handle */ ibool drop_db);/*!< in: TRUE=dropping whole database */ +/*********************************************************************//** +Drop all temporary tables during crash recovery. */ +UNIV_INTERN +void +row_mysql_drop_temp_tables(void); +/*============================*/ /*********************************************************************//** Discards the tablespace of a table which stored in an .ibd file. Discarding @@ -494,14 +500,19 @@ row_rename_table_for_mysql( trx_t* trx, /*!< in: transaction handle */ ibool commit); /*!< in: if TRUE then commit trx */ /*********************************************************************//** -Checks a table for corruption. -@return DB_ERROR or DB_SUCCESS */ +Checks that the index contains entries in an ascending order, unique +constraint is not broken, and calculates the number of index entries +in the read view of the current transaction. +@return DB_SUCCESS if ok */ UNIV_INTERN ulint -row_check_table_for_mysql( +row_check_index_for_mysql( /*======================*/ - row_prebuilt_t* prebuilt); /*!< in: prebuilt struct in MySQL - handle */ + row_prebuilt_t* prebuilt, /*!< in: prebuilt struct + in MySQL handle */ + const dict_index_t* index, /*!< in: index */ + ulint* n_rows); /*!< out: number of entries + seen in the consistent read */ /*********************************************************************//** Determines if a table is a magic monitor table. diff --git a/storage/innodb_plugin/include/row0sel.h b/storage/innodb_plugin/include/row0sel.h index 01a5afaa23e..8544b9d08ba 100644 --- a/storage/innodb_plugin/include/row0sel.h +++ b/storage/innodb_plugin/include/row0sel.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -105,17 +105,6 @@ row_fetch_print( /*============*/ void* row, /*!< in: sel_node_t* */ void* user_arg); /*!< in: not used */ -/****************************************************************//** -Callback function for fetch that stores an unsigned 4 byte integer to the -location pointed. The column's type must be DATA_INT, DATA_UNSIGNED, length -= 4. -@return always returns NULL */ -UNIV_INTERN -void* -row_fetch_store_uint4( -/*==================*/ - void* row, /*!< in: sel_node_t* */ - void* user_arg); /*!< in: data pointer */ /***********************************************************//** Prints a row in a select result. @return query thread to run next or NULL */ diff --git a/storage/innodb_plugin/include/srv0srv.h b/storage/innodb_plugin/include/srv0srv.h index 228c9f6600a..7aa2ce74720 100644 --- a/storage/innodb_plugin/include/srv0srv.h +++ b/storage/innodb_plugin/include/srv0srv.h @@ -1,7 +1,8 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2008, 2009, Google Inc. +Copyright (c) 2009, Percona Inc. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -9,6 +10,13 @@ briefly in the InnoDB documentation. The contributions by Google are incorporated with their permission, and subject to the conditions contained in the file COPYING.Google. +Portions of this file contain modifications contributed and copyrighted +by Percona Inc.. Those modifications are +gratefully acknowledged and are described briefly in the InnoDB +documentation. The contributions by Percona Inc. are incorporated with +their permission, and subject to the conditions contained in the file +COPYING.Percona. + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. @@ -22,32 +30,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ -/*********************************************************************** - -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. -Copyright (c) 2009, Percona Inc. - -Portions of this file contain modifications contributed and copyrighted -by Percona Inc.. Those modifications are -gratefully acknowledged and are described briefly in the InnoDB -documentation. The contributions by Percona Inc. are incorporated with -their permission, and subject to the conditions contained in the file -COPYING.Percona. - -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -***********************************************************************/ /**************************************************//** @file include/srv0srv.h @@ -227,7 +209,8 @@ extern ibool srv_print_innodb_tablespace_monitor; extern ibool srv_print_verbose_log; extern ibool srv_print_innodb_table_monitor; -extern ibool srv_lock_timeout_and_monitor_active; +extern ibool srv_lock_timeout_active; +extern ibool srv_monitor_active; extern ibool srv_error_monitor_active; extern ulong srv_n_spin_wait_rounds; @@ -540,15 +523,23 @@ srv_release_mysql_thread_if_suspended( MySQL OS thread */ /*********************************************************************//** A thread which wakes up threads whose lock wait may have lasted too long. -This also prints the info output by various InnoDB monitors. @return a dummy parameter */ UNIV_INTERN os_thread_ret_t -srv_lock_timeout_and_monitor_thread( -/*================================*/ +srv_lock_timeout_thread( +/*====================*/ void* arg); /*!< in: a dummy parameter required by os_thread_create */ /*********************************************************************//** +A thread which prints the info output by various InnoDB monitors. +@return a dummy parameter */ +UNIV_INTERN +os_thread_ret_t +srv_monitor_thread( +/*===============*/ + void* arg); /*!< in: a dummy parameter required by + os_thread_create */ +/************************************************************************* A thread which prints warnings about semaphore waits which have lasted too long. These can be used to track bugs which cause hangs. @return a dummy parameter */ @@ -559,12 +550,15 @@ srv_error_monitor_thread( void* arg); /*!< in: a dummy parameter required by os_thread_create */ /******************************************************************//** -Outputs to a file the output of the InnoDB Monitor. */ +Outputs to a file the output of the InnoDB Monitor. +@return FALSE if not all information printed +due to failure to obtain necessary mutex */ UNIV_INTERN -void +ibool srv_printf_innodb_monitor( /*======================*/ FILE* file, /*!< in: output stream */ + ibool nowait, /*!< in: whether to wait for kernel mutex */ ulint* trx_start, /*!< out: file position of the start of the list of active transactions */ ulint* trx_end); /*!< out: file position of the end of diff --git a/storage/innodb_plugin/include/sync0rw.h b/storage/innodb_plugin/include/sync0rw.h index aedfd5f3f86..6f7e13220c1 100644 --- a/storage/innodb_plugin/include/sync0rw.h +++ b/storage/innodb_plugin/include/sync0rw.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -429,8 +429,9 @@ ibool rw_lock_own( /*========*/ rw_lock_t* lock, /*!< in: rw-lock */ - ulint lock_type); /*!< in: lock type: RW_LOCK_SHARED, + ulint lock_type) /*!< in: lock type: RW_LOCK_SHARED, RW_LOCK_EX */ + __attribute__((warn_unused_result)); #endif /* UNIV_SYNC_DEBUG */ /******************************************************************//** Checks if somebody has locked the rw-lock in the specified mode. */ diff --git a/storage/innodb_plugin/include/sync0sync.h b/storage/innodb_plugin/include/sync0sync.h index df990823cc4..d470b823fc3 100644 --- a/storage/innodb_plugin/include/sync0sync.h +++ b/storage/innodb_plugin/include/sync0sync.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -206,7 +206,8 @@ UNIV_INTERN ibool mutex_own( /*======*/ - const mutex_t* mutex); /*!< in: mutex */ + const mutex_t* mutex) /*!< in: mutex */ + __attribute__((warn_unused_result)); #endif /* UNIV_DEBUG */ #ifdef UNIV_SYNC_DEBUG /******************************************************************//** @@ -238,16 +239,27 @@ ibool sync_thread_levels_empty(void); /*==========================*/ /******************************************************************//** -Checks that the level array for the current thread is empty. -@return TRUE if empty except the exceptions specified below */ +Checks if the level array for the current thread contains a +mutex or rw-latch at the specified level. +@return a matching latch, or NULL if not found */ UNIV_INTERN -ibool -sync_thread_levels_empty_gen( -/*=========================*/ +void* +sync_thread_levels_contains( +/*========================*/ + ulint level); /*!< in: latching order level + (SYNC_DICT, ...)*/ +/******************************************************************//** +Checks if the level array for the current thread is empty. +@return a latch, or NULL if empty except the exceptions specified below */ +UNIV_INTERN +void* +sync_thread_levels_nonempty_gen( +/*============================*/ ibool dict_mutex_allowed); /*!< in: TRUE if dictionary mutex is allowed to be owned by the thread, also purge_is_running mutex is allowed */ +#define sync_thread_levels_empty_gen(d) (!sync_thread_levels_nonempty_gen(d)) /******************************************************************//** Gets the debug information for a reserved mutex. */ UNIV_INTERN diff --git a/storage/innodb_plugin/include/trx0rseg.h b/storage/innodb_plugin/include/trx0rseg.h index ba1fc88b6c4..a25d84f1e84 100644 --- a/storage/innodb_plugin/include/trx0rseg.h +++ b/storage/innodb_plugin/include/trx0rseg.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -114,17 +114,6 @@ trx_rseg_list_and_array_init( /*=========================*/ trx_sysf_t* sys_header, /*!< in: trx system header */ mtr_t* mtr); /*!< in: mtr */ -/****************************************************************//** -Creates a new rollback segment to the database. -@return the created segment object, NULL if fail */ -UNIV_INTERN -trx_rseg_t* -trx_rseg_create( -/*============*/ - ulint space, /*!< in: space id */ - ulint max_size, /*!< in: max size in pages */ - ulint* id, /*!< out: rseg id */ - mtr_t* mtr); /*!< in: mtr */ /*************************************************************************** Free's an instance of the rollback segment in memory. */ UNIV_INTERN diff --git a/storage/innodb_plugin/include/trx0sys.h b/storage/innodb_plugin/include/trx0sys.h index a53296a06d9..cbb89689748 100644 --- a/storage/innodb_plugin/include/trx0sys.h +++ b/storage/innodb_plugin/include/trx0sys.h @@ -333,12 +333,14 @@ UNIV_INTERN void trx_sys_file_format_tag_init(void); /*==============================*/ +#ifndef UNIV_HOTBACKUP /*****************************************************************//** Shutdown/Close the transaction system. */ UNIV_INTERN void trx_sys_close(void); /*===============*/ +#endif /* !UNIV_HOTBACKUP */ /*****************************************************************//** Get the name representation of the file format from its id. @return pointer to the name */ @@ -495,7 +497,6 @@ this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below */ within that file */ #define TRX_SYS_MYSQL_LOG_NAME 12 /*!< MySQL log file name */ -#ifndef UNIV_HOTBACKUP /** Doublewrite buffer */ /* @{ */ /** The offset of the doublewrite buffer header on the trx system header page */ @@ -547,6 +548,7 @@ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_NO. */ #define TRX_SYS_DOUBLEWRITE_BLOCK_SIZE FSP_EXTENT_SIZE /* @} */ +#ifndef UNIV_HOTBACKUP /** File format tag */ /* @{ */ /** The offset of the file format tag on the trx system header page diff --git a/storage/innodb_plugin/include/trx0trx.h b/storage/innodb_plugin/include/trx0trx.h index 5f2c1246f37..6872fb463c0 100644 --- a/storage/innodb_plugin/include/trx0trx.h +++ b/storage/innodb_plugin/include/trx0trx.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -349,7 +349,7 @@ trx_print( use the default max length */ /** Type of data dictionary operation */ -enum trx_dict_op { +typedef enum trx_dict_op { /** The transaction is not modifying the data dictionary. */ TRX_DICT_OP_NONE = 0, /** The transaction is creating a table or an index, or @@ -361,7 +361,7 @@ enum trx_dict_op { existing table. In crash recovery, the data dictionary must be locked, but the table must not be dropped. */ TRX_DICT_OP_INDEX = 2 -}; +} trx_dict_op_t; /**********************************************************************//** Determine if a transaction is a dictionary operation. @@ -391,6 +391,14 @@ ibool trx_is_interrupted( /*===============*/ trx_t* trx); /*!< in: transaction */ +/**********************************************************************//** +Determines if the currently running transaction is in strict mode. +@return TRUE if strict */ +UNIV_INTERN +ibool +trx_is_strict( +/*==========*/ + trx_t* trx); /*!< in: transaction */ #else /* !UNIV_HOTBACKUP */ #define trx_is_interrupted(trx) FALSE #endif /* !UNIV_HOTBACKUP */ @@ -463,69 +471,79 @@ rolling back after a database recovery */ struct trx_struct{ ulint magic_n; - /* All the next fields are protected by the kernel mutex, except the - undo logs which are protected by undo_mutex */ + + /* These fields are not protected by any mutex. */ const char* op_info; /*!< English text describing the current operation, or an empty string */ - unsigned is_purge:1; /*!< 0=user transaction, 1=purge */ - unsigned is_recovered:1; /*!< 0=normal transaction, - 1=recovered, must be rolled back */ - unsigned conc_state:2; /*!< state of the trx from the point + ulint conc_state; /*!< state of the trx from the point of view of concurrency control: TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY, ... */ - unsigned que_state:2; /*!< valid when conc_state == TRX_ACTIVE: - TRX_QUE_RUNNING, TRX_QUE_LOCK_WAIT, - ... */ - unsigned isolation_level:2;/* TRX_ISO_REPEATABLE_READ, ... */ - unsigned check_foreigns:1;/* normally TRUE, but if the user + ulint isolation_level;/* TRX_ISO_REPEATABLE_READ, ... */ + ulint check_foreigns; /* normally TRUE, but if the user wants to suppress foreign key checks, (in table imports, for example) we set this FALSE */ - unsigned check_unique_secondary:1; + ulint check_unique_secondary; /* normally TRUE, but if the user wants to speed up inserts by suppressing unique key checks for secondary indexes when we decide if we can use the insert buffer for them, we set this FALSE */ - unsigned support_xa:1; /*!< normally we do the XA two-phase + ulint support_xa; /*!< normally we do the XA two-phase commit steps, but by setting this to FALSE, one can save CPU time and about 150 bytes in the undo log size as then we skip XA steps */ - unsigned flush_log_later:1;/* In 2PC, we hold the + ulint flush_log_later;/* In 2PC, we hold the prepare_commit mutex across both phases. In that case, we defer flush of the logs to disk until after we release the mutex. */ - unsigned must_flush_log_later:1;/* this flag is set to TRUE in + ulint must_flush_log_later;/* this flag is set to TRUE in trx_commit_off_kernel() if flush_log_later was TRUE, and there were modifications by the transaction; in that case we must flush the log in trx_commit_complete_for_mysql() */ - unsigned dict_operation:2;/**< @see enum trx_dict_op */ - unsigned duplicates:2; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */ - unsigned active_trans:2; /*!< 1 - if a transaction in MySQL + ulint duplicates; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */ + ulint active_trans; /*!< 1 - if a transaction in MySQL is active. 2 - if prepare_commit_mutex was taken */ - unsigned has_search_latch:1; + ulint has_search_latch; /* TRUE if this trx has latched the search system latch in S-mode */ - unsigned declared_to_be_inside_innodb:1; + ulint deadlock_mark; /*!< a mark field used in deadlock + checking algorithm. */ + trx_dict_op_t dict_operation; /**< @see enum trx_dict_op */ + + /* Fields protected by the srv_conc_mutex. */ + ulint declared_to_be_inside_innodb; /* this is TRUE if we have declared this transaction in srv_conc_enter_innodb to be inside the InnoDB engine */ - unsigned handling_signals:1;/* this is TRUE as long as the trx - is handling signals */ - unsigned dict_operation_lock_mode:2; - /* 0, RW_S_LATCH, or RW_X_LATCH: + + /* Fields protected by dict_operation_lock. The very latch + it is used to track. */ + ulint dict_operation_lock_mode; + /*!< 0, RW_S_LATCH, or RW_X_LATCH: the latch mode trx currently holds on dict_operation_lock */ + + /* All the next fields are protected by the kernel mutex, except the + undo logs which are protected by undo_mutex */ + ulint is_purge; /*!< 0=user transaction, 1=purge */ + ulint is_recovered; /*!< 0=normal transaction, + 1=recovered, must be rolled back */ + ulint que_state; /*!< valid when conc_state + == TRX_ACTIVE: TRX_QUE_RUNNING, + TRX_QUE_LOCK_WAIT, ... */ + ulint handling_signals;/* this is TRUE as long as the trx + is handling signals */ time_t start_time; /*!< time the trx object was created or the state last time became TRX_ACTIVE */ @@ -640,11 +658,6 @@ struct trx_struct{ wait_thrs; /*!< query threads belonging to this trx that are in the QUE_THR_LOCK_WAIT state */ - ulint deadlock_mark; /*!< a mark field used in deadlock - checking algorithm. This must be - in its own machine word, because - it can be changed by other - threads while holding kernel_mutex. */ /*------------------------------*/ mem_heap_t* lock_heap; /*!< memory heap for the locks of the transaction */ diff --git a/storage/innodb_plugin/include/trx0types.h b/storage/innodb_plugin/include/trx0types.h index 24cf57d53d5..40a7256cbfd 100644 --- a/storage/innodb_plugin/include/trx0types.h +++ b/storage/innodb_plugin/include/trx0types.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -70,6 +70,13 @@ typedef struct trx_named_savept_struct trx_named_savept_t; enum trx_rb_ctx { RB_NONE = 0, /*!< no rollback */ RB_NORMAL, /*!< normal rollback */ + RB_RECOVERY_PURGE_REC, + /*!< rolling back an incomplete transaction, + in crash recovery, rolling back an + INSERT that was performed by updating a + delete-marked record; if the delete-marked record + no longer exists in an active read view, it will + be purged */ RB_RECOVERY /*!< rolling back an incomplete transaction, in crash recovery */ }; diff --git a/storage/innodb_plugin/include/univ.i b/storage/innodb_plugin/include/univ.i index 2081e136590..49717760456 100644 --- a/storage/innodb_plugin/include/univ.i +++ b/storage/innodb_plugin/include/univ.i @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2009, Sun Microsystems, Inc. @@ -46,7 +46,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 1 #define INNODB_VERSION_MINOR 0 -#define INNODB_VERSION_BUGFIX 6 +#define INNODB_VERSION_BUGFIX 8 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; @@ -115,7 +115,7 @@ if we are compiling on Windows. */ /* Include <sys/stat.h> to get S_I... macros defined for os0file.c */ # include <sys/stat.h> -# if !defined(__NETWARE__) && !defined(__WIN__) +# if !defined(__NETWARE__) && !defined(__WIN__) # include <sys/mman.h> /* mmap() for os0proc.c */ # endif @@ -165,6 +165,9 @@ command. Not tested on Windows. */ #define UNIV_COMPILE_TEST_FUNCS */ +#ifdef HAVE_purify +# define UNIV_DEBUG_VALGRIND +#endif /* HAVE_purify */ #if 0 #define UNIV_DEBUG_VALGRIND /* Enable extra Valgrind instrumentation */ @@ -202,6 +205,10 @@ operations (very slow); also UNIV_DEBUG must be defined */ adaptive hash index */ #define UNIV_SRV_PRINT_LATCH_WAITS /* enable diagnostic output in sync0sync.c */ +#define UNIV_BTR_AVOID_COPY /* when splitting B-tree nodes, + do not move any records when + all the records would + be moved */ #define UNIV_BTR_PRINT /* enable functions for printing B-trees */ #define UNIV_ZIP_DEBUG /* extensive consistency checks @@ -229,11 +236,6 @@ by one. */ /* the above option prevents forcing of log to disk at a buffer page write: it should be tested with this option off; also some ibuf tests are suppressed */ -/* -#define UNIV_BASIC_LOG_DEBUG -*/ - /* the above option enables basic recovery debugging: - new allocated file pages are reset */ /* Linkage specifier for non-static InnoDB symbols (variables and functions) that are only referenced from within InnoDB, not from MySQL */ diff --git a/storage/innodb_plugin/include/ut0rbt.h b/storage/innodb_plugin/include/ut0rbt.h new file mode 100644 index 00000000000..6fd050acfe7 --- /dev/null +++ b/storage/innodb_plugin/include/ut0rbt.h @@ -0,0 +1,309 @@ +/***************************************************************************** +Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA + +*****************************************************************************/ + +/*******************************************************************//** +@file include/ut0rbt.h +Red-Black tree implementation. + +Created 2007-03-20 Sunny Bains +************************************************************************/ + +#ifndef INNOBASE_UT0RBT_H +#define INNOBASE_UT0RBT_H + +#if !defined(IB_RBT_TESTING) +#include "univ.i" +#include "ut0mem.h" +#else +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#define ut_malloc malloc +#define ut_free free +#define ulint unsigned long +#define ut_a(c) assert(c) +#define ut_error assert(0) +#define ibool unsigned int +#define TRUE 1 +#define FALSE 0 +#endif + +/* Red black tree typedefs */ +typedef struct ib_rbt_struct ib_rbt_t; +typedef struct ib_rbt_node_struct ib_rbt_node_t; +/* FIXME: Iterator is a better name than _bound_ */ +typedef struct ib_rbt_bound_struct ib_rbt_bound_t; +typedef void (*ib_rbt_print_node)(const ib_rbt_node_t* node); +typedef int (*ib_rbt_compare)(const void* p1, const void* p2); + +/* Red black tree color types */ +enum ib_rbt_color_enum { + IB_RBT_RED, + IB_RBT_BLACK +}; + +typedef enum ib_rbt_color_enum ib_rbt_color_t; + +/* Red black tree node */ +struct ib_rbt_node_struct { + ib_rbt_color_t color; /* color of this node */ + + ib_rbt_node_t* left; /* points left child */ + ib_rbt_node_t* right; /* points right child */ + ib_rbt_node_t* parent; /* points parent node */ + + char value[1]; /* Data value */ +}; + +/* Red black tree instance.*/ +struct ib_rbt_struct { + ib_rbt_node_t* nil; /* Black colored node that is + used as a sentinel. This is + pre-allocated too.*/ + + ib_rbt_node_t* root; /* Root of the tree, this is + pre-allocated and the first + data node is the left child.*/ + + ulint n_nodes; /* Total number of data nodes */ + + ib_rbt_compare compare; /* Fn. to use for comparison */ + ulint sizeof_value; /* Sizeof the item in bytes */ +}; + +/* The result of searching for a key in the tree, this is useful for +a speedy lookup and insert if key doesn't exist.*/ +struct ib_rbt_bound_struct { + const ib_rbt_node_t* + last; /* Last node visited */ + + int result; /* Result of comparing with + the last non-nil node that + was visited */ +}; + +/* Size in elements (t is an rb tree instance) */ +#define rbt_size(t) (t->n_nodes) + +/* Check whether the rb tree is empty (t is an rb tree instance) */ +#define rbt_empty(t) (rbt_size(t) == 0) + +/* Get data value (t is the data type, n is an rb tree node instance) */ +#define rbt_value(t, n) ((t*) &n->value[0]) + +/* Compare a key with the node value (t is tree, k is key, n is node)*/ +#define rbt_compare(t, k, n) (t->compare(k, n->value)) + +/****************************************************************//** +Free an instance of a red black tree */ +UNIV_INTERN +void +rbt_free( +/*=====*/ + ib_rbt_t* tree); /*!< in: rb tree to free */ +/****************************************************************//** +Create an instance of a red black tree +@return rb tree instance */ +UNIV_INTERN +ib_rbt_t* +rbt_create( +/*=======*/ + size_t sizeof_value, /*!< in: size in bytes */ + ib_rbt_compare compare); /*!< in: comparator */ +/****************************************************************//** +Delete a node from the red black tree, identified by key. +@return TRUE if success FALSE if not found */ +UNIV_INTERN +ibool +rbt_delete( +/*=======*/ + ib_rbt_t* tree, /*!< in: rb tree */ + const void* key); /*!< in: key to delete */ +/****************************************************************//** +Remove a node from the rb tree, the node is not free'd, that is the +callers responsibility. +@return the deleted node with the const. */ +UNIV_INTERN +ib_rbt_node_t* +rbt_remove_node( +/*============*/ + ib_rbt_t* tree, /*!< in: rb tree */ + const ib_rbt_node_t* + node); /*!< in: node to delete, this + is a fudge and declared const + because the caller has access + only to const nodes.*/ +/****************************************************************//** +Find a matching node in the rb tree. +@return node if found else return NULL */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_lookup( +/*=======*/ + const ib_rbt_t* tree, /*!< in: rb tree to search */ + const void* key); /*!< in: key to lookup */ +/****************************************************************//** +Generic insert of a value in the rb tree. +@return inserted node */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_insert( +/*=======*/ + ib_rbt_t* tree, /*!< in: rb tree */ + const void* key, /*!< in: key for ordering */ + const void* value); /*!< in: data that will be + copied to the node.*/ +/****************************************************************//** +Add a new node to the tree, useful for data that is pre-sorted. +@return appended node */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_add_node( +/*=========*/ + ib_rbt_t* tree, /*!< in: rb tree */ + ib_rbt_bound_t* parent, /*!< in: parent */ + const void* value); /*!< in: this value is copied + to the node */ +/****************************************************************//** +Return the left most data node in the tree +@return left most node */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_first( +/*======*/ + const ib_rbt_t* tree); /*!< in: rb tree */ +/****************************************************************//** +Return the right most data node in the tree +@return right most node */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_last( +/*=====*/ + const ib_rbt_t* tree); /*!< in: rb tree */ +/****************************************************************//** +Return the next node from current. +@return successor node to current that is passed in. */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_next( +/*=====*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + const ib_rbt_node_t* /*!< in: current node */ + current); +/****************************************************************//** +Return the prev node from current. +@return precedessor node to current that is passed in */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_prev( +/*=====*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + const ib_rbt_node_t* /*!< in: current node */ + current); +/****************************************************************//** +Find the node that has the lowest key that is >= key. +@return node that satisfies the lower bound constraint or NULL */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_lower_bound( +/*============*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + const void* key); /*!< in: key to search */ +/****************************************************************//** +Find the node that has the greatest key that is <= key. +@return node that satisifies the upper bound constraint or NULL */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_upper_bound( +/*============*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + const void* key); /*!< in: key to search */ +/****************************************************************//** +Search for the key, a node will be retuned in parent.last, whether it +was found or not. If not found then parent.last will contain the +parent node for the possibly new key otherwise the matching node. +@return result of last comparison */ +UNIV_INTERN +int +rbt_search( +/*=======*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + ib_rbt_bound_t* parent, /*!< in: search bounds */ + const void* key); /*!< in: key to search */ +/****************************************************************//** +Search for the key, a node will be retuned in parent.last, whether it +was found or not. If not found then parent.last will contain the +parent node for the possibly new key otherwise the matching node. +@return result of last comparison */ +UNIV_INTERN +int +rbt_search_cmp( +/*===========*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + ib_rbt_bound_t* parent, /*!< in: search bounds */ + const void* key, /*!< in: key to search */ + ib_rbt_compare compare); /*!< in: comparator */ +/****************************************************************//** +Clear the tree, deletes (and free's) all the nodes. */ +UNIV_INTERN +void +rbt_clear( +/*======*/ + ib_rbt_t* tree); /*!< in: rb tree */ +/****************************************************************//** +Merge the node from dst into src. Return the number of nodes merged. +@return no. of recs merged */ +UNIV_INTERN +ulint +rbt_merge_uniq( +/*===========*/ + ib_rbt_t* dst, /*!< in: dst rb tree */ + const ib_rbt_t* src); /*!< in: src rb tree */ +/****************************************************************//** +Merge the node from dst into src. Return the number of nodes merged. +Delete the nodes from src after copying node to dst. As a side effect +the duplicates will be left untouched in the src, since we don't support +duplicates (yet). NOTE: src and dst must be similar, the function doesn't +check for this condition (yet). +@return no. of recs merged */ +UNIV_INTERN +ulint +rbt_merge_uniq_destructive( +/*=======================*/ + ib_rbt_t* dst, /*!< in: dst rb tree */ + ib_rbt_t* src); /*!< in: src rb tree */ +/****************************************************************//** +Verify the integrity of the RB tree. For debugging. 0 failure else height +of tree (in count of black nodes). +@return TRUE if OK FALSE if tree invalid. */ +UNIV_INTERN +ibool +rbt_validate( +/*=========*/ + const ib_rbt_t* tree); /*!< in: tree to validate */ +/****************************************************************//** +Iterate over the tree in depth first order. */ +UNIV_INTERN +void +rbt_print( +/*======*/ + const ib_rbt_t* tree, /*!< in: tree to traverse */ + ib_rbt_print_node print); /*!< in: print function */ + +#endif /* INNOBASE_UT0RBT_H */ diff --git a/storage/innodb_plugin/include/ut0rnd.ic b/storage/innodb_plugin/include/ut0rnd.ic index 763469142ec..c3dbd86923c 100644 --- a/storage/innodb_plugin/include/ut0rnd.ic +++ b/storage/innodb_plugin/include/ut0rnd.ic @@ -152,6 +152,7 @@ ut_hash_ulint( ulint key, /*!< in: value to be hashed */ ulint table_size) /*!< in: hash table size */ { + ut_ad(table_size); key = key ^ UT_HASH_RANDOM_MASK2; return(key % table_size); diff --git a/storage/innodb_plugin/lock/lock0lock.c b/storage/innodb_plugin/lock/lock0lock.c index 1fce8002bdf..04e5fe1a65a 100644 --- a/storage/innodb_plugin/lock/lock0lock.c +++ b/storage/innodb_plugin/lock/lock0lock.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -376,6 +376,7 @@ UNIV_INTERN FILE* lock_latest_err_file; /* Flags for recursive deadlock search */ #define LOCK_VICTIM_IS_START 1 #define LOCK_VICTIM_IS_OTHER 2 +#define LOCK_EXCEED_MAX_DEPTH 3 /********************************************************************//** Checks if a lock request results in a deadlock. @@ -394,24 +395,25 @@ Looks recursively for a deadlock. deadlock and we chose 'start' as the victim, LOCK_VICTIM_IS_OTHER if a deadlock was found and we chose some other trx as a victim: we must do the search again in this last case because there may be another -deadlock! */ +deadlock! +LOCK_EXCEED_MAX_DEPTH if the lock search exceeds max steps or max depth. */ static ulint lock_deadlock_recursive( /*====================*/ trx_t* start, /*!< in: recursion starting point */ trx_t* trx, /*!< in: a transaction waiting for a lock */ - lock_t* wait_lock, /*!< in: the lock trx is waiting to be granted */ + lock_t* wait_lock, /*!< in: lock that is waiting to be granted */ ulint* cost, /*!< in/out: number of calculation steps thus far: if this exceeds LOCK_MAX_N_STEPS_... - we return LOCK_VICTIM_IS_START */ + we return LOCK_EXCEED_MAX_DEPTH */ ulint depth); /*!< in: recursion depth: if this exceeds LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we - return LOCK_VICTIM_IS_START */ + return LOCK_EXCEED_MAX_DEPTH */ /*********************************************************************//** Gets the nth bit of a record lock. -@return TRUE if bit set */ +@return TRUE if bit set also if i == ULINT_UNDEFINED return FALSE*/ UNIV_INLINE ibool lock_rec_get_nth_bit( @@ -1222,7 +1224,7 @@ lock_rec_get_first_on_page( /*********************************************************************//** Gets the next explicit lock request on a record. -@return next lock, NULL if none exists */ +@return next lock, NULL if none exists or if heap_no == ULINT_UNDEFINED */ UNIV_INLINE lock_t* lock_rec_get_next( @@ -2398,7 +2400,7 @@ lock_rec_inherit_to_gap( if (!lock_rec_get_insert_intention(lock) && !((srv_locks_unsafe_for_binlog || lock->trx->isolation_level - == TRX_ISO_READ_COMMITTED) + <= TRX_ISO_READ_COMMITTED) && lock_get_mode(lock) == LOCK_X)) { lock_rec_add_to_queue(LOCK_REC | LOCK_GAP @@ -3261,8 +3263,6 @@ lock_deadlock_occurs( lock_t* lock, /*!< in: lock the transaction is requesting */ trx_t* trx) /*!< in: transaction */ { - dict_table_t* table; - dict_index_t* index; trx_t* mark_trx; ulint ret; ulint cost = 0; @@ -3284,31 +3284,50 @@ retry: ret = lock_deadlock_recursive(trx, trx, lock, &cost, 0); - if (ret == LOCK_VICTIM_IS_OTHER) { + switch (ret) { + case LOCK_VICTIM_IS_OTHER: /* We chose some other trx as a victim: retry if there still is a deadlock */ - goto retry; - } - if (UNIV_UNLIKELY(ret == LOCK_VICTIM_IS_START)) { - if (lock_get_type_low(lock) & LOCK_TABLE) { - table = lock->un_member.tab_lock.table; - index = NULL; + case LOCK_EXCEED_MAX_DEPTH: + /* If the lock search exceeds the max step + or the max depth, the current trx will be + the victim. Print its information. */ + rewind(lock_latest_err_file); + ut_print_timestamp(lock_latest_err_file); + + fputs("TOO DEEP OR LONG SEARCH IN THE LOCK TABLE" + " WAITS-FOR GRAPH, WE WILL ROLL BACK" + " FOLLOWING TRANSACTION \n", + lock_latest_err_file); + + fputs("\n*** TRANSACTION:\n", lock_latest_err_file); + trx_print(lock_latest_err_file, trx, 3000); + + fputs("*** WAITING FOR THIS LOCK TO BE GRANTED:\n", + lock_latest_err_file); + + if (lock_get_type(lock) == LOCK_REC) { + lock_rec_print(lock_latest_err_file, lock); } else { - index = lock->index; - table = index->table; + lock_table_print(lock_latest_err_file, lock); } + break; - lock_deadlock_found = TRUE; - + case LOCK_VICTIM_IS_START: fputs("*** WE ROLL BACK TRANSACTION (2)\n", lock_latest_err_file); + break; - return(TRUE); + default: + /* No deadlock detected*/ + return(FALSE); } - return(FALSE); + lock_deadlock_found = TRUE; + + return(TRUE); } /********************************************************************//** @@ -3317,25 +3336,26 @@ Looks recursively for a deadlock. deadlock and we chose 'start' as the victim, LOCK_VICTIM_IS_OTHER if a deadlock was found and we chose some other trx as a victim: we must do the search again in this last case because there may be another -deadlock! */ +deadlock! +LOCK_EXCEED_MAX_DEPTH if the lock search exceeds max steps or max depth. */ static ulint lock_deadlock_recursive( /*====================*/ trx_t* start, /*!< in: recursion starting point */ trx_t* trx, /*!< in: a transaction waiting for a lock */ - lock_t* wait_lock, /*!< in: the lock trx is waiting to be granted */ + lock_t* wait_lock, /*!< in: lock that is waiting to be granted */ ulint* cost, /*!< in/out: number of calculation steps thus far: if this exceeds LOCK_MAX_N_STEPS_... - we return LOCK_VICTIM_IS_START */ + we return LOCK_EXCEED_MAX_DEPTH */ ulint depth) /*!< in: recursion depth: if this exceeds LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK, we - return LOCK_VICTIM_IS_START */ + return LOCK_EXCEED_MAX_DEPTH */ { + ulint ret; lock_t* lock; - ulint bit_no = ULINT_UNDEFINED; trx_t* lock_trx; - ulint ret; + ulint heap_no = ULINT_UNDEFINED; ut_a(trx); ut_a(start); @@ -3351,27 +3371,44 @@ lock_deadlock_recursive( *cost = *cost + 1; - lock = wait_lock; - if (lock_get_type_low(wait_lock) == LOCK_REC) { + ulint space; + ulint page_no; + + heap_no = lock_rec_find_set_bit(wait_lock); + ut_a(heap_no != ULINT_UNDEFINED); + + space = wait_lock->un_member.rec_lock.space; + page_no = wait_lock->un_member.rec_lock.page_no; + + lock = lock_rec_get_first_on_page_addr(space, page_no); + + /* Position the iterator on the first matching record lock. */ + while (lock != NULL + && lock != wait_lock + && !lock_rec_get_nth_bit(lock, heap_no)) { + + lock = lock_rec_get_next_on_page(lock); + } - bit_no = lock_rec_find_set_bit(wait_lock); + if (lock == wait_lock) { + lock = NULL; + } + + ut_ad(lock == NULL || lock_rec_get_nth_bit(lock, heap_no)); - ut_a(bit_no != ULINT_UNDEFINED); + } else { + lock = wait_lock; } /* Look at the locks ahead of wait_lock in the lock queue */ for (;;) { - if (lock_get_type_low(lock) & LOCK_TABLE) { - - lock = UT_LIST_GET_PREV(un_member.tab_lock.locks, - lock); - } else { - ut_ad(lock_get_type_low(lock) == LOCK_REC); - ut_a(bit_no != ULINT_UNDEFINED); + /* Get previous table lock. */ + if (heap_no == ULINT_UNDEFINED) { - lock = (lock_t*) lock_rec_get_prev(lock, bit_no); + lock = UT_LIST_GET_PREV( + un_member.tab_lock.locks, lock); } if (lock == NULL) { @@ -3389,7 +3426,7 @@ lock_deadlock_recursive( lock_trx = lock->trx; - if (lock_trx == start || too_far) { + if (lock_trx == start) { /* We came back to the recursion starting point: a deadlock detected; or we have @@ -3436,19 +3473,10 @@ lock_deadlock_recursive( } #ifdef UNIV_DEBUG if (lock_print_waits) { - fputs("Deadlock detected" - " or too long search\n", + fputs("Deadlock detected\n", stderr); } #endif /* UNIV_DEBUG */ - if (too_far) { - - fputs("TOO DEEP OR LONG SEARCH" - " IN THE LOCK TABLE" - " WAITS-FOR GRAPH\n", ef); - - return(LOCK_VICTIM_IS_START); - } if (trx_weight_cmp(wait_lock->trx, start) >= 0) { @@ -3484,6 +3512,21 @@ lock_deadlock_recursive( return(LOCK_VICTIM_IS_OTHER); } + if (too_far) { + +#ifdef UNIV_DEBUG + if (lock_print_waits) { + fputs("Deadlock search exceeds" + " max steps or depth.\n", + stderr); + } +#endif /* UNIV_DEBUG */ + /* The information about transaction/lock + to be rolled back is available in the top + level. Do not print anything here. */ + return(LOCK_EXCEED_MAX_DEPTH); + } + if (lock_trx->que_state == TRX_QUE_LOCK_WAIT) { /* Another trx ahead has requested lock in an @@ -3493,12 +3536,28 @@ lock_deadlock_recursive( ret = lock_deadlock_recursive( start, lock_trx, lock_trx->wait_lock, cost, depth + 1); + if (ret != 0) { return(ret); } } } + /* Get the next record lock to check. */ + if (heap_no != ULINT_UNDEFINED) { + + ut_a(lock != NULL); + + do { + lock = lock_rec_get_next_on_page(lock); + } while (lock != NULL + && lock != wait_lock + && !lock_rec_get_nth_bit(lock, heap_no)); + + if (lock == wait_lock) { + lock = NULL; + } + } }/* end of the 'for (;;)'-loop */ } @@ -3694,9 +3753,10 @@ lock_table_enqueue_waiting( /*********************************************************************//** Checks if other transactions have an incompatible mode lock request in -the lock queue. */ +the lock queue. +@return lock or NULL */ UNIV_INLINE -ibool +lock_t* lock_table_other_has_incompatible( /*==============================*/ trx_t* trx, /*!< in: transaction, or NULL if all @@ -3718,13 +3778,13 @@ lock_table_other_has_incompatible( && (!lock_mode_compatible(lock_get_mode(lock), mode)) && (wait || !(lock_get_wait(lock)))) { - return(TRUE); + return(lock); } lock = UT_LIST_GET_PREV(un_member.tab_lock.locks, lock); } - return(FALSE); + return(NULL); } /*********************************************************************//** @@ -4249,28 +4309,29 @@ lock_rec_print( block = buf_page_try_get(space, page_no, &mtr); - if (block) { - for (i = 0; i < lock_rec_get_n_bits(lock); i++) { + for (i = 0; i < lock_rec_get_n_bits(lock); ++i) { - if (lock_rec_get_nth_bit(lock, i)) { + if (!lock_rec_get_nth_bit(lock, i)) { + continue; + } - const rec_t* rec - = page_find_rec_with_heap_no( - buf_block_get_frame(block), i); - offsets = rec_get_offsets( - rec, lock->index, offsets, - ULINT_UNDEFINED, &heap); + fprintf(file, "Record lock, heap no %lu", (ulong) i); - fprintf(file, "Record lock, heap no %lu ", - (ulong) i); - rec_print_new(file, rec, offsets); - putc('\n', file); - } - } - } else { - for (i = 0; i < lock_rec_get_n_bits(lock); i++) { - fprintf(file, "Record lock, heap no %lu\n", (ulong) i); + if (block) { + const rec_t* rec; + + rec = page_find_rec_with_heap_no( + buf_block_get_frame(block), i); + + offsets = rec_get_offsets( + rec, lock->index, offsets, + ULINT_UNDEFINED, &heap); + + putc(' ', file); + rec_print_new(file, rec, offsets); } + + putc('\n', file); } mtr_commit(&mtr); @@ -4317,14 +4378,26 @@ lock_get_n_rec_locks(void) #endif /* PRINT_NUM_OF_LOCK_STRUCTS */ /*********************************************************************//** -Prints info of locks for all transactions. */ +Prints info of locks for all transactions. +@return FALSE if not able to obtain kernel mutex +and exits without printing info */ UNIV_INTERN -void +ibool lock_print_info_summary( /*====================*/ - FILE* file) /*!< in: file where to print */ + FILE* file, /*!< in: file where to print */ + ibool nowait) /*!< in: whether to wait for the kernel mutex */ { - lock_mutex_enter_kernel(); + /* if nowait is FALSE, wait on the kernel mutex, + otherwise return immediately if fail to obtain the + mutex. */ + if (!nowait) { + lock_mutex_enter_kernel(); + } else if (mutex_enter_nowait(&kernel_mutex)) { + fputs("FAIL TO OBTAIN KERNEL MUTEX, " + "SKIP LOCK INFO PRINTING\n", file); + return(FALSE); + } if (lock_deadlock_found) { fputs("------------------------\n" @@ -4356,6 +4429,7 @@ lock_print_info_summary( "Total number of lock structs in row lock hash table %lu\n", (ulong) lock_get_n_rec_locks()); #endif /* PRINT_NUM_OF_LOCK_STRUCTS */ + return(TRUE); } /*********************************************************************//** @@ -4636,6 +4710,7 @@ lock_rec_queue_validate( ut_a(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP, block, heap_no, impl_trx)); } +#if 0 } else { /* The kernel mutex may get released temporarily in the @@ -4646,6 +4721,27 @@ lock_rec_queue_validate( (fil_space_t::latch), the following check WILL break latching order and may cause a deadlock of threads. */ + /* NOTE: This is a bogus check that would fail in the + following case: Our transaction is updating a + row. After it has updated the clustered index record, + it goes to a secondary index record and finds someone + else holding an explicit S- or X-lock on that + secondary index record, presumably from a locking + read. Our transaction cannot update the secondary + index immediately, but places a waiting X-lock request + on the secondary index record. There is nothing + illegal in this. The assertion is simply too strong. */ + + /* From the locking point of view, each secondary + index is a separate table. A lock that is held on + secondary index rec does not give any rights to modify + or read the clustered index rec. Therefore, we can + think of the sec index as a separate 'table' from the + clust index 'table'. Conversely, a transaction that + has acquired a lock on and modified a clustered index + record may need to wait for a lock on the + corresponding record in a secondary index. */ + impl_trx = lock_sec_rec_some_has_impl_off_kernel( rec, index, offsets); @@ -4656,6 +4752,7 @@ lock_rec_queue_validate( ut_a(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP, block, heap_no, impl_trx)); } +#endif } lock = lock_rec_get_first(block, heap_no); @@ -4753,6 +4850,13 @@ loop: || lock->trx->conc_state == TRX_PREPARED || lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY); +# ifdef UNIV_SYNC_DEBUG + /* Only validate the record queues when this thread is not + holding a space->latch. Deadlocks are possible due to + latching order violation when UNIV_DEBUG is defined while + UNIV_SYNC_DEBUG is not. */ + if (!sync_thread_levels_contains(SYNC_FSP)) +# endif /* UNIV_SYNC_DEBUG */ for (i = nth_bit; i < lock_rec_get_n_bits(lock); i++) { if (i == 1 || lock_rec_get_nth_bit(lock, i)) { @@ -4918,7 +5022,7 @@ lock_rec_insert_check_and_lock( } trx = thr_get_trx(thr); - next_rec = page_rec_get_next((rec_t*) rec); + next_rec = page_rec_get_next_const(rec); next_rec_heap_no = page_rec_get_heap_no(next_rec); lock_mutex_enter_kernel(); diff --git a/storage/innodb_plugin/log/log0log.c b/storage/innodb_plugin/log/log0log.c index d5b696074b3..183c24d2147 100644 --- a/storage/innodb_plugin/log/log0log.c +++ b/storage/innodb_plugin/log/log0log.c @@ -1,23 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA - -*****************************************************************************/ -/***************************************************************************** - -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2009, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -2013,7 +1996,7 @@ log_checkpoint( return(TRUE); } - ut_ad(log_sys->written_to_all_lsn >= oldest_lsn); + ut_ad(log_sys->flushed_to_disk_lsn >= oldest_lsn); if (log_sys->n_pending_checkpoint_writes > 0) { /* A checkpoint write is running */ @@ -3095,7 +3078,7 @@ loop: if (srv_fast_shutdown < 2 && (srv_error_monitor_active - || srv_lock_timeout_and_monitor_active)) { + || srv_lock_timeout_active || srv_monitor_active)) { mutex_exit(&kernel_mutex); diff --git a/storage/innodb_plugin/log/log0recv.c b/storage/innodb_plugin/log/log0recv.c index ddbc71d4b71..a727d6be768 100644 --- a/storage/innodb_plugin/log/log0recv.c +++ b/storage/innodb_plugin/log/log0recv.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -138,7 +138,9 @@ UNIV_INTERN ulint recv_max_parsed_page_no; /** This many frames must be left free in the buffer pool when we scan the log and store the scanned log records in the buffer pool: we will use these free frames to read in pages when we start applying the -log records to the database. */ +log records to the database. +This is the default value. If the actual size of the buffer pool is +larger than 10 MB we'll set this value to 512. */ UNIV_INTERN ulint recv_n_pool_free_frames; /** The maximum lsn we see for a page during the recovery process. If this @@ -239,6 +241,7 @@ recv_sys_mem_free(void) } } +#ifndef UNIV_HOTBACKUP /************************************************************ Reset the state of the recovery system variables. */ UNIV_INTERN @@ -278,6 +281,7 @@ recv_sys_var_init(void) recv_max_page_lsn = 0; } +#endif /* !UNIV_HOTBACKUP */ /************************************************************ Inits the recovery system for a recovery operation. */ @@ -292,20 +296,32 @@ recv_sys_init( return; } + /* Initialize red-black tree for fast insertions into the + flush_list during recovery process. + As this initialization is done while holding the buffer pool + mutex we perform it before acquiring recv_sys->mutex. */ +#ifndef UNIV_HOTBACKUP + buf_flush_init_flush_rbt(); + mutex_enter(&(recv_sys->mutex)); -#ifndef UNIV_HOTBACKUP recv_sys->heap = mem_heap_create_in_buffer(256); #else /* !UNIV_HOTBACKUP */ recv_sys->heap = mem_heap_create(256); recv_is_from_backup = TRUE; #endif /* !UNIV_HOTBACKUP */ + /* Set appropriate value of recv_n_pool_free_frames. */ + if (buf_pool_get_curr_size() >= (10 * 1024 * 1024)) { + /* Buffer pool of size greater than 10 MB. */ + recv_n_pool_free_frames = 512; + } + recv_sys->buf = ut_malloc(RECV_PARSING_BUF_SIZE); recv_sys->len = 0; recv_sys->recovered_offset = 0; - recv_sys->addr_hash = hash_create(available_memory / 64); + recv_sys->addr_hash = hash_create(available_memory / 512); recv_sys->n_addrs = 0; recv_sys->apply_log_recs = FALSE; @@ -345,7 +361,7 @@ recv_sys_empty_hash(void) hash_table_free(recv_sys->addr_hash); mem_heap_empty(recv_sys->heap); - recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 256); + recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 512); } #ifndef UNIV_HOTBACKUP @@ -370,6 +386,9 @@ recv_sys_debug_free(void) recv_sys->last_block_buf_start = NULL; mutex_exit(&(recv_sys->mutex)); + + /* Free up the flush_rbt. */ + buf_flush_free_flush_rbt(); } # endif /* UNIV_LOG_DEBUG */ @@ -2050,15 +2069,6 @@ recv_parse_log_rec( } #endif /* UNIV_LOG_LSN_DEBUG */ - /* Check that page_no is sensible */ - - if (UNIV_UNLIKELY(*page_no > 0x8FFFFFFFUL)) { - - recv_sys->found_corrupt_log = TRUE; - - return(0); - } - new_ptr = recv_parse_or_apply_log_rec_body(*type, new_ptr, end_ptr, NULL, NULL); if (UNIV_UNLIKELY(new_ptr == NULL)) { @@ -2167,6 +2177,14 @@ recv_report_corrupt_log( putc('\n', stderr); } +#ifndef UNIV_HOTBACKUP + if (!srv_force_recovery) { + fputs("InnoDB: Set innodb_force_recovery" + " to ignore this error.\n", stderr); + ut_error; + } +#endif /* !UNIV_HOTBACKUP */ + fputs("InnoDB: WARNING: the log file may have been corrupt and it\n" "InnoDB: is possible that the log scan did not proceed\n" "InnoDB: far enough in recovery! Please run CHECK TABLE\n" @@ -2556,7 +2574,7 @@ recv_scan_log_recs( ut_ad(start_lsn % OS_FILE_LOG_BLOCK_SIZE == 0); ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0); - ut_ad(len > 0); + ut_ad(len >= OS_FILE_LOG_BLOCK_SIZE); ut_a(store_to_hash <= TRUE); finished = FALSE; @@ -2681,6 +2699,16 @@ recv_scan_log_recs( recv_sys->found_corrupt_log = TRUE; +#ifndef UNIV_HOTBACKUP + if (!srv_force_recovery) { + fputs("InnoDB: Set" + " innodb_force_recovery" + " to ignore this error.\n", + stderr); + ut_error; + } +#endif /* !UNIV_HOTBACKUP */ + } else if (!recv_sys->found_corrupt_log) { more_data = recv_sys_add_to_parsing_buf( log_block, scanned_lsn); @@ -3210,8 +3238,6 @@ void recv_recovery_from_checkpoint_finish(void) /*======================================*/ { - int i; - /* Apply the hashed log records to the respective file pages */ if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) { @@ -3259,9 +3285,16 @@ recv_recovery_from_checkpoint_finish(void) The data dictionary latch should guarantee that there is at most one data dictionary transaction active at a time. */ trx_rollback_or_clean_recovered(FALSE); +} - /* Drop partially created indexes. */ - row_merge_drop_temp_indexes(); +/********************************************************//** +Initiates the rollback of active transactions. */ +UNIV_INTERN +void +recv_recovery_rollback_active(void) +/*===============================*/ +{ + int i; #ifdef UNIV_SYNC_DEBUG /* Wait for a while so that created threads have time to suspend @@ -3271,6 +3304,11 @@ recv_recovery_from_checkpoint_finish(void) /* Switch latching order checks on in sync0sync.c */ sync_order_checks_on = TRUE; #endif + /* Drop partially created indexes. */ + row_merge_drop_temp_indexes(); + /* Drop temporary tables. */ + row_mysql_drop_temp_tables(); + if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO) { /* Rollback the uncommitted transactions which have no user session */ diff --git a/storage/innodb_plugin/mem/mem0dbg.c b/storage/innodb_plugin/mem/mem0dbg.c index 01eda20ec45..1cd2ff15bab 100644 --- a/storage/innodb_plugin/mem/mem0dbg.c +++ b/storage/innodb_plugin/mem/mem0dbg.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -180,6 +180,10 @@ mem_close(void) { mem_pool_free(mem_comm_pool); mem_comm_pool = NULL; +#ifdef UNIV_MEM_DEBUG + mutex_free(&mem_hash_mutex); + mem_hash_initialized = FALSE; +#endif /* UNIV_MEM_DEBUG */ } #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innodb_plugin/mem/mem0mem.c b/storage/innodb_plugin/mem/mem0mem.c index ccb2fd8a7b4..c0ce8a3e1ac 100644 --- a/storage/innodb_plugin/mem/mem0mem.c +++ b/storage/innodb_plugin/mem/mem0mem.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -383,6 +383,20 @@ mem_heap_create_block( mem_block_set_free(block, MEM_BLOCK_HEADER_SIZE); mem_block_set_start(block, MEM_BLOCK_HEADER_SIZE); + if (UNIV_UNLIKELY(heap == NULL)) { + /* This is the first block of the heap. The field + total_size should be initialized here */ + block->total_size = len; + } else { + /* Not the first allocation for the heap. This block's + total_length field should be set to undefined. */ + ut_d(block->total_size = ULINT_UNDEFINED); + UNIV_MEM_INVALID(&block->total_size, + sizeof block->total_size); + + heap->total_size += len; + } + ut_ad((ulint)MEM_BLOCK_HEADER_SIZE < len); return(block); @@ -471,6 +485,10 @@ mem_heap_block_free( mem_pool_mutex_exit(); #endif + + ut_ad(heap->total_size >= block->len); + heap->total_size -= block->len; + type = heap->type; len = block->len; block->magic_n = MEM_FREED_BLOCK_MAGIC_N; diff --git a/storage/innodb_plugin/mysql-test/ctype_innodb_like.inc b/storage/innodb_plugin/mysql-test/ctype_innodb_like.inc deleted file mode 100644 index ae43342885a..00000000000 --- a/storage/innodb_plugin/mysql-test/ctype_innodb_like.inc +++ /dev/null @@ -1,21 +0,0 @@ -# -# Bug#11650: LIKE pattern matching using prefix index -# doesn't return correct result -# ---disable_warnings -# -# This query creates a column using -# character_set_connection and -# collation_connection. -# -create table t1 engine=innodb select repeat('a',50) as c1; ---enable_warnings -alter table t1 add index(c1(5)); - -insert into t1 values ('abcdefg'),('abcde100'),('abcde110'),('abcde111'); -select collation(c1) from t1 limit 1; -select c1 from t1 where c1 like 'abcdef%' order by c1; -select c1 from t1 where c1 like 'abcde1%' order by c1; -select c1 from t1 where c1 like 'abcde11%' order by c1; -select c1 from t1 where c1 like 'abcde111%' order by c1; -drop table t1; diff --git a/storage/innodb_plugin/mysql-test/have_innodb.inc b/storage/innodb_plugin/mysql-test/have_innodb.inc deleted file mode 100644 index 8944cc46f3e..00000000000 --- a/storage/innodb_plugin/mysql-test/have_innodb.inc +++ /dev/null @@ -1,4 +0,0 @@ -disable_query_log; ---require r/true.require -select (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as `TRUE` from information_schema.engines where engine = 'innodb'; -enable_query_log; diff --git a/storage/innodb_plugin/mysql-test/innodb-analyze.result b/storage/innodb_plugin/mysql-test/innodb-analyze.result deleted file mode 100644 index 2aee004a2d6..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-analyze.result +++ /dev/null @@ -1,2 +0,0 @@ -Variable_name Value -innodb_stats_sample_pages 1 diff --git a/storage/innodb_plugin/mysql-test/innodb-analyze.test b/storage/innodb_plugin/mysql-test/innodb-analyze.test deleted file mode 100644 index 9bdb9db697c..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-analyze.test +++ /dev/null @@ -1,65 +0,0 @@ -# -# Test that mysqld does not crash when running ANALYZE TABLE with -# different values of the parameter innodb_stats_sample_pages. -# - --- source include/have_innodb.inc - -# we care only that the following SQL commands do not produce errors -# and do not crash the server --- disable_query_log --- disable_result_log --- enable_warnings - -let $sample_pages=`select @@innodb_stats_sample_pages`; -SET GLOBAL innodb_stats_sample_pages=0; - -# check that the value has been adjusted to 1 --- enable_result_log -SHOW VARIABLES LIKE 'innodb_stats_sample_pages'; --- disable_result_log - -CREATE TABLE innodb_analyze ( - a INT, - b INT, - KEY(a), - KEY(b,a) -) ENGINE=InnoDB; - -# test with empty table - -ANALYZE TABLE innodb_analyze; - -SET GLOBAL innodb_stats_sample_pages=2; -ANALYZE TABLE innodb_analyze; - -SET GLOBAL innodb_stats_sample_pages=4; -ANALYZE TABLE innodb_analyze; - -SET GLOBAL innodb_stats_sample_pages=8; -ANALYZE TABLE innodb_analyze; - -SET GLOBAL innodb_stats_sample_pages=16; -ANALYZE TABLE innodb_analyze; - -INSERT INTO innodb_analyze VALUES -(1,1), (1,1), (1,2), (1,3), (1,4), (1,5), -(8,1), (8,8), (8,2), (7,1), (1,4), (3,5); - -SET GLOBAL innodb_stats_sample_pages=1; -ANALYZE TABLE innodb_analyze; - -SET GLOBAL innodb_stats_sample_pages=2; -ANALYZE TABLE innodb_analyze; - -SET GLOBAL innodb_stats_sample_pages=4; -ANALYZE TABLE innodb_analyze; - -SET GLOBAL innodb_stats_sample_pages=8; -ANALYZE TABLE innodb_analyze; - -SET GLOBAL innodb_stats_sample_pages=16; -ANALYZE TABLE innodb_analyze; - -DROP TABLE innodb_analyze; -EVAL SET GLOBAL innodb_stats_sample_pages=$sample_pages; diff --git a/storage/innodb_plugin/mysql-test/innodb-autoinc.result b/storage/innodb_plugin/mysql-test/innodb-autoinc.result deleted file mode 100644 index d2e8eb19e0c..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-autoinc.result +++ /dev/null @@ -1,891 +0,0 @@ -drop table if exists t1; -CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (9223372036854775807, null); -INSERT INTO t1 (c2) VALUES ('innodb'); -Got one of the listed errors -SELECT * FROM t1; -c1 c2 -9223372036854775807 NULL -DROP TABLE t1; -CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (127, null); -INSERT INTO t1 (c2) VALUES ('innodb'); -Got one of the listed errors -SELECT * FROM t1; -c1 c2 -127 NULL -DROP TABLE t1; -CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (255, null); -INSERT INTO t1 (c2) VALUES ('innodb'); -Got one of the listed errors -SELECT * FROM t1; -c1 c2 -255 NULL -DROP TABLE t1; -CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (32767, null); -INSERT INTO t1 (c2) VALUES ('innodb'); -Got one of the listed errors -SELECT * FROM t1; -c1 c2 -32767 NULL -DROP TABLE t1; -CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (65535, null); -INSERT INTO t1 (c2) VALUES ('innodb'); -Got one of the listed errors -SELECT * FROM t1; -c1 c2 -65535 NULL -DROP TABLE t1; -CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (8388607, null); -INSERT INTO t1 (c2) VALUES ('innodb'); -Got one of the listed errors -SELECT * FROM t1; -c1 c2 -8388607 NULL -DROP TABLE t1; -CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (16777215, null); -INSERT INTO t1 (c2) VALUES ('innodb'); -Got one of the listed errors -SELECT * FROM t1; -c1 c2 -16777215 NULL -DROP TABLE t1; -CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (2147483647, null); -INSERT INTO t1 (c2) VALUES ('innodb'); -Got one of the listed errors -SELECT * FROM t1; -c1 c2 -2147483647 NULL -DROP TABLE t1; -CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (4294967295, null); -INSERT INTO t1 (c2) VALUES ('innodb'); -Got one of the listed errors -SELECT * FROM t1; -c1 c2 -4294967295 NULL -DROP TABLE t1; -CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (9223372036854775807, null); -INSERT INTO t1 (c2) VALUES ('innodb'); -Got one of the listed errors -SELECT * FROM t1; -c1 c2 -9223372036854775807 NULL -DROP TABLE t1; -CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (18446744073709551615, null); -INSERT INTO t1 (c2) VALUES ('innodb'); -Got one of the listed errors -SELECT * FROM t1; -c1 c2 -18446744073709551615 NULL -DROP TABLE t1; -CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -c1 -1 -2 -3 -4 -5 -6 -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 -TRUNCATE TABLE t1; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -c1 -1 -2 -3 -4 -5 -6 -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 -DROP TABLE t1; -CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -c1 -1 -2 -3 -4 -5 -6 -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 -DELETE FROM t1; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1 -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -c1 -1 -2 -3 -7 -8 -9 -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`c1`) -) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 -DROP TABLE t1; -DROP TABLE IF EXISTS t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL, 1); -DELETE FROM t1 WHERE c1 = 1; -INSERT INTO t1 VALUES (2,1); -INSERT INTO t1 VALUES (NULL,8); -SELECT * FROM t1; -c1 c2 -2 1 -3 8 -DROP TABLE t1; -DROP TABLE IF EXISTS t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL, 1); -DELETE FROM t1 WHERE c1 = 1; -INSERT INTO t1 VALUES (2,1), (NULL, 8); -INSERT INTO t1 VALUES (NULL,9); -SELECT * FROM t1; -c1 c2 -2 1 -3 8 -5 9 -DROP TABLE t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 100 -auto_increment_offset 10 -DROP TABLE IF EXISTS t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL),(5),(NULL); -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -c1 -5 -10 -110 -250 -310 -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -INSERT INTO t1 VALUES(NULL),(NULL); -SELECT * FROM t1; -c1 -5 -10 -110 -250 -310 -400 -410 -1000 -DROP TABLE t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 1 -auto_increment_offset 1 -DROP TABLE IF EXISTS t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(0); -SELECT * FROM t1; -c1 -1 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -INSERT INTO t1 VALUES (-1), (NULL),(2),(NULL); -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -c1 --1 -1 -2 -10 -110 -250 -410 -SET @@INSERT_ID=400; -INSERT INTO t1 VALUES(NULL),(NULL); -Got one of the listed errors -SELECT * FROM t1; -c1 --1 -1 -2 -10 -110 -250 -410 -DROP TABLE t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 1 -auto_increment_offset 1 -DROP TABLE IF EXISTS t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(-1); -SELECT * FROM t1; -c1 --1 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 100 -auto_increment_offset 10 -INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL); -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -c1 --2 --1 -1 -2 -10 -250 -310 -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -INSERT INTO t1 VALUES(NULL),(NULL); -SELECT * FROM t1; -c1 --2 --1 -1 -2 -10 -250 -310 -400 -410 -1000 -DROP TABLE t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 1 -auto_increment_offset 1 -DROP TABLE IF EXISTS t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(-1); -Warnings: -Warning 1264 Out of range value for column 'c1' at row 1 -SELECT * FROM t1; -c1 -1 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 100 -auto_increment_offset 10 -INSERT INTO t1 VALUES (-2); -Warnings: -Warning 1264 Out of range value for column 'c1' at row 1 -INSERT INTO t1 VALUES (NULL); -INSERT INTO t1 VALUES (2); -INSERT INTO t1 VALUES (NULL); -INSERT INTO t1 VALUES (250); -INSERT INTO t1 VALUES (NULL); -SELECT * FROM t1; -c1 -1 -2 -10 -110 -210 -250 -310 -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES(NULL); -SELECT * FROM t1; -c1 -1 -2 -10 -110 -210 -250 -310 -400 -1000 -1010 -DROP TABLE t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 1 -auto_increment_offset 1 -DROP TABLE IF EXISTS t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(-1); -Warnings: -Warning 1264 Out of range value for column 'c1' at row 1 -SELECT * FROM t1; -c1 -1 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 100 -auto_increment_offset 10 -INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL); -Warnings: -Warning 1264 Out of range value for column 'c1' at row 1 -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -c1 -1 -2 -10 -110 -210 -250 -410 -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -INSERT INTO t1 VALUES(NULL),(NULL); -Got one of the listed errors -SELECT * FROM t1; -c1 -1 -2 -10 -110 -210 -250 -410 -1000 -DROP TABLE t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 1 -auto_increment_offset 1 -DROP TABLE IF EXISTS t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (9223372036854775794); -SELECT * FROM t1; -c1 -1 -9223372036854775794 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 2 -auto_increment_offset 10 -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -SELECT * FROM t1; -c1 -1 -9223372036854775794 -9223372036854775796 -9223372036854775798 -9223372036854775800 -9223372036854775802 -9223372036854775804 -9223372036854775806 -DROP TABLE t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 1 -auto_increment_offset 1 -DROP TABLE IF EXISTS t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (18446744073709551603); -SELECT * FROM t1; -c1 -1 -18446744073709551603 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 2 -auto_increment_offset 10 -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -SELECT * FROM t1; -c1 -1 -18446744073709551603 -18446744073709551604 -18446744073709551606 -18446744073709551608 -18446744073709551610 -18446744073709551612 -18446744073709551614 -DROP TABLE t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 1 -auto_increment_offset 1 -DROP TABLE IF EXISTS t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (18446744073709551603); -SELECT * FROM t1; -c1 -1 -18446744073709551603 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 5 -auto_increment_offset 7 -INSERT INTO t1 VALUES (NULL),(NULL); -SELECT * FROM t1; -c1 -1 -18446744073709551603 -18446744073709551607 -18446744073709551612 -DROP TABLE t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 1 -auto_increment_offset 1 -DROP TABLE IF EXISTS t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES(-9223372036854775806); -INSERT INTO t1 VALUES(-9223372036854775807); -INSERT INTO t1 VALUES(-9223372036854775808); -SELECT * FROM t1; -c1 --9223372036854775808 --9223372036854775807 --9223372036854775806 -1 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 3 -auto_increment_offset 3 -INSERT INTO t1 VALUES (NULL),(NULL), (NULL); -SELECT * FROM t1; -c1 --9223372036854775808 --9223372036854775807 --9223372036854775806 -1 -3 -6 -9 -DROP TABLE t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 1 -auto_increment_offset 1 -DROP TABLE IF EXISTS t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (18446744073709551610); -SELECT * FROM t1; -c1 -1 -18446744073709551610 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976; -Warnings: -Warning 1292 Truncated incorrect auto_increment_increment value: '1152921504606846976' -Warning 1292 Truncated incorrect auto_increment_offset value: '1152921504606846976' -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 65535 -auto_increment_offset 65535 -INSERT INTO t1 VALUES (NULL); -SELECT * FROM t1; -c1 -1 -18446744073709551610 -18446744073709551615 -DROP TABLE t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -Variable_name Value -auto_increment_increment 1 -auto_increment_offset 1 -CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(NULL, 1); -INSERT INTO t1 VALUES(NULL, 2); -SELECT * FROM t1; -c1 c2 -1 1 -2 2 -ALTER TABLE t1 CHANGE c1 c1 SERIAL; -SELECT * FROM t1; -c1 c2 -1 1 -2 2 -INSERT INTO t1 VALUES(NULL, 3); -INSERT INTO t1 VALUES(NULL, 4); -SELECT * FROM t1; -c1 c2 -1 1 -2 2 -3 3 -4 4 -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 FLOAT NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(NULL, 1); -INSERT INTO t1 VALUES(NULL, 2); -SELECT * FROM t1; -c1 c2 -1 1 -2 2 -ALTER TABLE t1 CHANGE c1 c1 SERIAL; -SELECT * FROM t1; -c1 c2 -1 1 -2 2 -INSERT INTO t1 VALUES(NULL, 3); -INSERT INTO t1 VALUES(NULL, 4); -SELECT * FROM t1; -c1 c2 -1 1 -2 2 -3 3 -4 4 -DROP TABLE t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5; -DROP TABLE IF EXISTS t1; -Warnings: -Note 1051 Unknown table 't1' -DROP TABLE IF EXISTS t2; -Warnings: -Note 1051 Unknown table 't2' -CREATE TABLE t1 ( -a INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, -b INT(10) UNSIGNED NOT NULL, -c ENUM('FALSE','TRUE') DEFAULT NULL, -PRIMARY KEY (a)) ENGINE = InnoDB; -CREATE TABLE t2 ( -m INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, -n INT(10) UNSIGNED NOT NULL, -o enum('FALSE','TRUE') DEFAULT NULL, -PRIMARY KEY (m)) ENGINE = InnoDB; -INSERT INTO t2 (n,o) VALUES -(1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'), -(3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false'); -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `m` int(11) unsigned NOT NULL AUTO_INCREMENT, - `n` int(10) unsigned NOT NULL, - `o` enum('FALSE','TRUE') DEFAULT NULL, - PRIMARY KEY (`m`) -) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 -INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) unsigned NOT NULL AUTO_INCREMENT, - `b` int(10) unsigned NOT NULL, - `c` enum('FALSE','TRUE') DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=latin1 -INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; -SELECT * FROM t1; -a b c -1 1 TRUE -2 1 FALSE -3 2 TRUE -4 2 FALSE -5 3 TRUE -6 3 FALSE -7 4 TRUE -8 4 FALSE -9 5 TRUE -10 5 FALSE -13 1 TRUE -14 1 FALSE -15 2 TRUE -16 2 FALSE -17 3 TRUE -18 3 FALSE -19 4 TRUE -20 4 FALSE -21 5 TRUE -22 5 FALSE -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) unsigned NOT NULL AUTO_INCREMENT, - `b` int(10) unsigned NOT NULL, - `c` enum('FALSE','TRUE') DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1 -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SELECT * FROM t1; -a b c -1 1 TRUE -2 1 FALSE -3 2 TRUE -4 2 FALSE -5 3 TRUE -6 3 FALSE -7 4 TRUE -8 4 FALSE -9 5 TRUE -10 5 FALSE -13 1 TRUE -14 1 FALSE -15 2 TRUE -16 2 FALSE -17 3 TRUE -18 3 FALSE -19 4 TRUE -20 4 FALSE -21 5 TRUE -22 5 FALSE -23 1 FALSE -24 2 FALSE -25 3 FALSE -26 4 FALSE -27 5 FALSE -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) unsigned NOT NULL AUTO_INCREMENT, - `b` int(10) unsigned NOT NULL, - `c` enum('FALSE','TRUE') DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=latin1 -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SELECT * FROM t1; -a b c -1 1 TRUE -2 1 FALSE -3 2 TRUE -4 2 FALSE -5 3 TRUE -6 3 FALSE -7 4 TRUE -8 4 FALSE -9 5 TRUE -10 5 FALSE -13 1 TRUE -14 1 FALSE -15 2 TRUE -16 2 FALSE -17 3 TRUE -18 3 FALSE -19 4 TRUE -20 4 FALSE -21 5 TRUE -22 5 FALSE -23 1 FALSE -24 2 FALSE -25 3 FALSE -26 4 FALSE -27 5 FALSE -30 1 FALSE -31 2 FALSE -32 3 FALSE -33 4 FALSE -34 5 FALSE -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) unsigned NOT NULL AUTO_INCREMENT, - `b` int(10) unsigned NOT NULL, - `c` enum('FALSE','TRUE') DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=latin1 -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) unsigned NOT NULL AUTO_INCREMENT, - `b` int(10) unsigned NOT NULL, - `c` enum('FALSE','TRUE') DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=latin1 -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) unsigned NOT NULL AUTO_INCREMENT, - `b` int(10) unsigned NOT NULL, - `c` enum('FALSE','TRUE') DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=latin1 -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SELECT * FROM t1; -a b c -1 1 TRUE -2 1 FALSE -3 2 TRUE -4 2 FALSE -5 3 TRUE -6 3 FALSE -7 4 TRUE -8 4 FALSE -9 5 TRUE -10 5 FALSE -13 1 TRUE -14 1 FALSE -15 2 TRUE -16 2 FALSE -17 3 TRUE -18 3 FALSE -19 4 TRUE -20 4 FALSE -21 5 TRUE -22 5 FALSE -23 1 FALSE -24 2 FALSE -25 3 FALSE -26 4 FALSE -27 5 FALSE -30 1 FALSE -31 2 FALSE -32 3 FALSE -33 4 FALSE -34 5 FALSE -37 1 FALSE -38 2 FALSE -39 3 FALSE -40 4 FALSE -41 5 FALSE -44 1 FALSE -45 2 FALSE -46 3 FALSE -47 4 FALSE -48 5 FALSE -51 1 FALSE -52 2 FALSE -53 3 FALSE -54 4 FALSE -55 5 FALSE -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) unsigned NOT NULL AUTO_INCREMENT, - `b` int(10) unsigned NOT NULL, - `c` enum('FALSE','TRUE') DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=58 DEFAULT CHARSET=latin1 -DROP TABLE t1; -DROP TABLE t2; -DROP TABLE IF EXISTS t1; -Warnings: -Note 1051 Unknown table 't1' -DROP TABLE IF EXISTS t2; -Warnings: -Note 1051 Unknown table 't2' -CREATE TABLE t1( -c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT -PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -CREATE TABLE t2( -c1 TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT -PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t2 SELECT c1 FROM t1; -Got one of the listed errors -INSERT INTO t2 SELECT NULL FROM t1; -Got one of the listed errors -DROP TABLE t1; -DROP TABLE t2; -CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (null); -INSERT INTO t1 VALUES (null); -ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT; -SELECT * FROM t1; -d1 -1 -3 -SELECT * FROM t1; -d1 -1 -3 -INSERT INTO t1 VALUES(null); -Got one of the listed errors -ALTER TABLE t1 AUTO_INCREMENT = 3; -INSERT INTO t1 VALUES(null); -SELECT * FROM t1; -d1 -1 -3 -4 -DROP TABLE t1; diff --git a/storage/innodb_plugin/mysql-test/innodb-autoinc.test b/storage/innodb_plugin/mysql-test/innodb-autoinc.test deleted file mode 100644 index 61c42f45733..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-autoinc.test +++ /dev/null @@ -1,500 +0,0 @@ --- source include/have_innodb.inc -# embedded server ignores 'delayed', so skip this --- source include/not_embedded.inc - ---disable_warnings -drop table if exists t1; ---enable_warnings - -# -# Bug #34335 -# -CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (9223372036854775807, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; -# -## Test AUTOINC overflow -## - -# TINYINT -CREATE TABLE t1 (c1 TINYINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (127, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 TINYINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (255, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; -# -# SMALLINT -# -CREATE TABLE t1 (c1 SMALLINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (32767, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (65535, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; -# -# MEDIUMINT -# -CREATE TABLE t1 (c1 MEDIUMINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (8388607, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (16777215, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; -# -# INT -# -CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (2147483647, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 INT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (4294967295, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; -# -# BIGINT -# -CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (9223372036854775807, null); --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -CREATE TABLE t1 (c1 BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (18446744073709551615, null); --- error ER_AUTOINC_READ_FAILED,1467 -INSERT INTO t1 (c2) VALUES ('innodb'); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Bug 37531 -# After truncate, auto_increment behaves incorrectly for InnoDB -# -CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -SHOW CREATE TABLE t1; -TRUNCATE TABLE t1; -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; - -# -# Deleting all records should not reset the AUTOINC counter. -# -CREATE TABLE t1(c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -SHOW CREATE TABLE t1; -DELETE FROM t1; -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES (1), (2), (3); -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SELECT c1 FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; - -# -# Bug 38839 -# Reset the last value generated at end of statement -# -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL, 1); -DELETE FROM t1 WHERE c1 = 1; -INSERT INTO t1 VALUES (2,1); -INSERT INTO t1 VALUES (NULL,8); -SELECT * FROM t1; -DROP TABLE t1; -# Bug 38839 -- same as above but for multi value insert -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, c2 INT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL, 1); -DELETE FROM t1 WHERE c1 = 1; -INSERT INTO t1 VALUES (2,1), (NULL, 8); -INSERT INTO t1 VALUES (NULL,9); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Test changes to AUTOINC next value calculation -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL),(5),(NULL); -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -INSERT INTO t1 VALUES(NULL),(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# Test with SIGNED INT column, by inserting a 0 for the first column value -# 0 is treated in the same was NULL. -# Reset the AUTOINC session variables -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(0); -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -INSERT INTO t1 VALUES (-1), (NULL),(2),(NULL); -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -SET @@INSERT_ID=400; -# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 VALUES(NULL),(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# Test with SIGNED INT column -# Reset the AUTOINC session variables -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(-1); -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -INSERT INTO t1 VALUES (-2), (NULL),(2),(NULL); -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -INSERT INTO t1 VALUES(NULL),(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# Test with UNSIGNED INT column, single insert -# The sign in the value is ignored and a new column value is generated -# Reset the AUTOINC session variables -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(-1); -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -INSERT INTO t1 VALUES (-2); -INSERT INTO t1 VALUES (NULL); -INSERT INTO t1 VALUES (2); -INSERT INTO t1 VALUES (NULL); -INSERT INTO t1 VALUES (250); -INSERT INTO t1 VALUES (NULL); -SELECT * FROM t1; -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# Test with UNSIGNED INT column, multi-value inserts -# The sign in the value is ignored and a new column value is generated -# Reset the AUTOINC session variables -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 INT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(-1); -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=100, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -INSERT INTO t1 VALUES (-2),(NULL),(2),(NULL); -INSERT INTO t1 VALUES (250),(NULL); -SELECT * FROM t1; -INSERT INTO t1 VALUES (1000); -SET @@INSERT_ID=400; -# Duplicate error expected here for autoinc_lock_mode != TRADITIONAL --- error ER_DUP_ENTRY,1062 -INSERT INTO t1 VALUES(NULL),(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Check for overflow handling when increment is > 1 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -# TODO: Fix the autoinc init code -# We have to do this because of a bug in the AUTOINC init code. -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (9223372036854775794); #-- 2^63 - 14 -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -# This should just fit -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Check for overflow handling when increment and offser are > 1 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -# TODO: Fix the autoinc init code -# We have to do this because of a bug in the AUTOINC init code. -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13 -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=2, @@SESSION.AUTO_INCREMENT_OFFSET=10; -SHOW VARIABLES LIKE "%auto_inc%"; -# This should fail because of overflow but it doesn't, it seems to be -# a MySQL server bug. It wraps around to 0 for the last value. -# See MySQL Bug# 39828 -# -# Instead of wrapping around, it asserts when MySQL is compiled --with-debug -# (see sql/handler.cc:handler::update_auto_increment()). Don't test for -# overflow until Bug #39828 is fixed. -# -# Since this asserts when compiled --with-debug, we can't properly test this -# until Bug #39828 is fixed. For now, this test is meaningless. -#if Bug #39828 is fixed -#INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -#else -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -#endif -SELECT * FROM t1; -DROP TABLE t1; - -# -# Check for overflow handling when increment and offset are odd numbers -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -# TODO: Fix the autoinc init code -# We have to do this because of a bug in the AUTOINC init code. -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (18446744073709551603); #-- 2^64 - 13 -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=5, @@SESSION.AUTO_INCREMENT_OFFSET=7; -SHOW VARIABLES LIKE "%auto_inc%"; -# This should fail because of overflow but it doesn't. It fails with -# a duplicate entry message because of a MySQL server bug, it wraps -# around. See MySQL Bug# 39828, once MySQL fix the bug we can replace -# the ER_DUP_ENTRY, 1062 below with the appropriate error message -# -# Since this asserts when compiled --with-debug, we can't properly test this -# until Bug #39828 is fixed. For now, this test is meaningless. -#if Bug #39828 is fixed -# Still need to fix this error code, error should mention overflow -#-- error ER_DUP_ENTRY,1062 -#INSERT INTO t1 VALUES (NULL),(NULL), (NULL); -#else -INSERT INTO t1 VALUES (NULL),(NULL); -#endif -SELECT * FROM t1; -DROP TABLE t1; - -# Check for overflow handling when increment and offset are odd numbers -# and check for large -ve numbers -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 BIGINT AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -# TODO: Fix the autoinc init code -# We have to do this because of a bug in the AUTOINC init code. -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES(-9223372036854775806); #-- -2^63 + 2 -INSERT INTO t1 VALUES(-9223372036854775807); #-- -2^63 + 1 -INSERT INTO t1 VALUES(-9223372036854775808); #-- -2^63 -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=3, @@SESSION.AUTO_INCREMENT_OFFSET=3; -SHOW VARIABLES LIKE "%auto_inc%"; -INSERT INTO t1 VALUES (NULL),(NULL), (NULL); -SELECT * FROM t1; -DROP TABLE t1; -# -# Check for overflow handling when increment and offset are very -# large numbers 2^60 -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) ENGINE=InnoDB; -# TODO: Fix the autoinc init code -# We have to do this because of a bug in the AUTOINC init code. -INSERT INTO t1 VALUES(NULL); -INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2 -SELECT * FROM t1; -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976; -SHOW VARIABLES LIKE "%auto_inc%"; -# This should fail because of overflow but it doesn't. It wraps around -# and the autoinc values look bogus too. -# See MySQL Bug# 39828, once MySQL fix the bug we can enable the error -# code expected test. -# -- error ER_AUTOINC_READ_FAILED,1467 -# -# Since this asserts when compiled --with-debug, we can't properly test this -# until Bug #39828 is fixed. For now, this test is meaningless. -#if Bug #39828 is fixed -#-- error ER_AUTOINC_READ_FAILED,1467 -#INSERT INTO t1 VALUES (NULL),(NULL); -#else -INSERT INTO t1 VALUES (NULL); -#endif -SELECT * FROM t1; -DROP TABLE t1; - -# -# Check for floating point autoinc column handling -# -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1; -SET @@INSERT_ID=1; -SHOW VARIABLES LIKE "%auto_inc%"; -CREATE TABLE t1 (c1 DOUBLE NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(NULL, 1); -INSERT INTO t1 VALUES(NULL, 2); -SELECT * FROM t1; -ALTER TABLE t1 CHANGE c1 c1 SERIAL; -SELECT * FROM t1; -INSERT INTO t1 VALUES(NULL, 3); -INSERT INTO t1 VALUES(NULL, 4); -SELECT * FROM t1; -DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (c1 FLOAT NOT NULL AUTO_INCREMENT, c2 INT, PRIMARY KEY (c1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES(NULL, 1); -INSERT INTO t1 VALUES(NULL, 2); -SELECT * FROM t1; -ALTER TABLE t1 CHANGE c1 c1 SERIAL; -SELECT * FROM t1; -INSERT INTO t1 VALUES(NULL, 3); -INSERT INTO t1 VALUES(NULL, 4); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Bug# 42714: AUTOINC column calculated next value not greater than highest -# value stored in table. -# -SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5; -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; -CREATE TABLE t1 ( - a INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - b INT(10) UNSIGNED NOT NULL, - c ENUM('FALSE','TRUE') DEFAULT NULL, - PRIMARY KEY (a)) ENGINE = InnoDB; -CREATE TABLE t2 ( - m INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - n INT(10) UNSIGNED NOT NULL, - o enum('FALSE','TRUE') DEFAULT NULL, - PRIMARY KEY (m)) ENGINE = InnoDB; -INSERT INTO t2 (n,o) VALUES - (1 , 'true'), (1 , 'false'), (2 , 'true'), (2 , 'false'), (3 , 'true'), - (3 , 'false'), (4 , 'true'), (4 , 'false'), (5 , 'true'), (5 , 'false'); -SHOW CREATE TABLE t2; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 ; -SELECT * FROM t1; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SELECT * FROM t1; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SELECT * FROM t1; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SHOW CREATE TABLE t1; -INSERT INTO t1 (b,c) SELECT n,o FROM t2 WHERE o = 'false'; -SELECT * FROM t1; -SHOW CREATE TABLE t1; -DROP TABLE t1; -DROP TABLE t2; -# -# 43203: Overflow from auto incrementing causes server segv -# - -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; -CREATE TABLE t1( - c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT - PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL); -CREATE TABLE t2( - c1 TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT - PRIMARY KEY) ENGINE=InnoDB; --- error ER_DUP_ENTRY,1062 -INSERT INTO t2 SELECT c1 FROM t1; --- error ER_DUP_ENTRY,1467 -INSERT INTO t2 SELECT NULL FROM t1; -DROP TABLE t1; -DROP TABLE t2; -# -# 44030: Error: (1500) Couldn't read the MAX(ID) autoinc value from -# the index (PRIMARY) -# This test requires a restart of the server -CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; -INSERT INTO t1 VALUES (null); -INSERT INTO t1 VALUES (null); -ALTER TABLE t1 CHANGE c1 d1 INT NOT NULL AUTO_INCREMENT; -SELECT * FROM t1; -# Restart the server --- source include/restart_mysqld.inc -# The MySQL and InnoDB data dictionaries should now be out of sync. -# The select should print message to the error log -SELECT * FROM t1; --- error ER_AUTOINC_READ_FAILED,1467 -INSERT INTO t1 VALUES(null); -ALTER TABLE t1 AUTO_INCREMENT = 3; -INSERT INTO t1 VALUES(null); -SELECT * FROM t1; -DROP TABLE t1; diff --git a/storage/innodb_plugin/mysql-test/innodb-consistent-master.opt b/storage/innodb_plugin/mysql-test/innodb-consistent-master.opt deleted file mode 100644 index 8cca44767da..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-consistent-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_lock_wait_timeout=2
diff --git a/storage/innodb_plugin/mysql-test/innodb-consistent.result b/storage/innodb_plugin/mysql-test/innodb-consistent.result deleted file mode 100644 index 9115791b99c..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-consistent.result +++ /dev/null @@ -1,35 +0,0 @@ -drop table if exists t1; -set session transaction isolation level read committed; -create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; -create table t2 like t1; -insert into t2 values (1),(2),(3),(4),(5),(6),(7); -set autocommit=0; -begin; -replace into t1 select * from t2; -set session transaction isolation level read committed; -set autocommit=0; -delete from t2 where a=5; -commit; -delete from t2; -commit; -commit; -begin; -insert into t1 select * from t2; -set session transaction isolation level read committed; -set autocommit=0; -delete from t2 where a=5; -commit; -delete from t2; -commit; -commit; -select * from t1; -a -1 -2 -3 -4 -5 -6 -7 -drop table t1; -drop table t2; diff --git a/storage/innodb_plugin/mysql-test/innodb-consistent.test b/storage/innodb_plugin/mysql-test/innodb-consistent.test deleted file mode 100644 index 791600fc8a7..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-consistent.test +++ /dev/null @@ -1,58 +0,0 @@ --- source include/not_embedded.inc
--- source include/have_innodb.inc
-
---disable_warnings
-drop table if exists t1;
---enable_warnings
-
-# REPLACE INTO ... SELECT and INSERT INTO ... SELECT should do
-# a consistent read of the source table.
-
-connect (a,localhost,root,,);
-connect (b,localhost,root,,);
-connection a;
-set session transaction isolation level read committed;
-create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
-create table t2 like t1;
-insert into t2 values (1),(2),(3),(4),(5),(6),(7);
-set autocommit=0;
-
-# REPLACE INTO ... SELECT case
-begin;
-# this should not result in any locks on t2.
-replace into t1 select * from t2;
-
-connection b;
-set session transaction isolation level read committed;
-set autocommit=0;
-# should not cuase a lock wait.
-delete from t2 where a=5;
-commit;
-delete from t2;
-commit;
-connection a;
-commit;
-
-# INSERT INTO ... SELECT case
-begin;
-# this should not result in any locks on t2.
-insert into t1 select * from t2;
-
-connection b;
-set session transaction isolation level read committed;
-set autocommit=0;
-# should not cuase a lock wait.
-delete from t2 where a=5;
-commit;
-delete from t2;
-commit;
-connection a;
-commit;
-
-select * from t1;
-drop table t1;
-drop table t2;
-
-connection default;
-disconnect a;
-disconnect b;
diff --git a/storage/innodb_plugin/mysql-test/innodb-index.inc b/storage/innodb_plugin/mysql-test/innodb-index.inc deleted file mode 100644 index 37de3162abe..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-index.inc +++ /dev/null @@ -1,26 +0,0 @@ ---eval create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb default charset=$charset -insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe'); -commit; ---error ER_DUP_ENTRY -alter table t1 add unique index (b); -insert into t1 values(8,9,'fff','fff'); -select * from t1; -show create table t1; -alter table t1 add index (b); -insert into t1 values(10,10,'kkk','iii'); -select * from t1; -select * from t1 force index(b) order by b; -explain select * from t1 force index(b) order by b; -show create table t1; -alter table t1 add unique index (c), add index (d); -insert into t1 values(11,11,'aaa','mmm'); -select * from t1; -select * from t1 force index(b) order by b; -select * from t1 force index(c) order by c; -select * from t1 force index(d) order by d; -explain select * from t1 force index(b) order by b; -explain select * from t1 force index(c) order by c; -explain select * from t1 force index(d) order by d; -show create table t1; -check table t1; -drop table t1; diff --git a/storage/innodb_plugin/mysql-test/innodb-index.result b/storage/innodb_plugin/mysql-test/innodb-index.result deleted file mode 100644 index a7d66b15300..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-index.result +++ /dev/null @@ -1,1170 +0,0 @@ -create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb; -insert into t1 values (5,5,'oo','oo'),(4,4,'tr','tr'),(3,4,'ad','ad'),(2,3,'ak','ak'); -commit; -alter table t1 add index b (b), add index b (b); -ERROR 42000: Duplicate key name 'b' -alter table t1 add index (b,b); -ERROR 42S21: Duplicate column name 'b' -alter table t1 add index d2 (d); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) NOT NULL, - `d` varchar(20) DEFAULT NULL, - KEY `d2` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -explain select * from t1 force index(d2) order by d; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL d2 23 NULL 4 -select * from t1 force index (d2) order by d; -a b c d -3 4 ad ad -2 3 ak ak -5 5 oo oo -4 4 tr tr -alter table t1 add unique index (b); -ERROR 23000: Duplicate entry '4' for key 'b' -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) NOT NULL, - `d` varchar(20) DEFAULT NULL, - KEY `d2` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -alter table t1 add index (b); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) NOT NULL, - `d` varchar(20) DEFAULT NULL, - KEY `d2` (`d`), - KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB; -alter table t1 add unique index (c), add index (d); -ERROR HY000: Table 'test.t1#1' already exists -rename table `t1#1` to `t1#2`; -alter table t1 add unique index (c), add index (d); -ERROR HY000: Table 'test.t1#2' already exists -drop table `t1#2`; -alter table t1 add unique index (c), add index (d); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) NOT NULL, - `d` varchar(20) DEFAULT NULL, - UNIQUE KEY `c` (`c`), - KEY `d2` (`d`), - KEY `b` (`b`), - KEY `d` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -explain select * from t1 force index(c) order by c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL c 10 NULL 4 -alter table t1 add primary key (a), drop index c; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) NOT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - KEY `d2` (`d`), - KEY `b` (`b`), - KEY `d` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -alter table t1 add primary key (c); -ERROR 42000: Multiple primary key defined -alter table t1 drop primary key, add primary key (b); -ERROR 23000: Duplicate entry '4' for key 'PRIMARY' -create unique index c on t1 (c); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) NOT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - UNIQUE KEY `c` (`c`), - KEY `d2` (`d`), - KEY `b` (`b`), - KEY `d` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -explain select * from t1 force index(c) order by c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL c 10 NULL 4 -select * from t1 force index(c) order by c; -a b c d -3 4 ad ad -2 3 ak ak -5 5 oo oo -4 4 tr tr -alter table t1 drop index b, add index (b); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) NOT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - UNIQUE KEY `c` (`c`), - KEY `d2` (`d`), - KEY `d` (`d`), - KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -insert into t1 values(6,1,'ggg','ggg'); -select * from t1; -a b c d -2 3 ak ak -3 4 ad ad -4 4 tr tr -5 5 oo oo -6 1 ggg ggg -select * from t1 force index(b) order by b; -a b c d -6 1 ggg ggg -2 3 ak ak -3 4 ad ad -4 4 tr tr -5 5 oo oo -select * from t1 force index(c) order by c; -a b c d -3 4 ad ad -2 3 ak ak -6 1 ggg ggg -5 5 oo oo -4 4 tr tr -select * from t1 force index(d) order by d; -a b c d -3 4 ad ad -2 3 ak ak -6 1 ggg ggg -5 5 oo oo -4 4 tr tr -explain select * from t1 force index(b) order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 5 NULL 5 -explain select * from t1 force index(c) order by c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL c 10 NULL 5 -explain select * from t1 force index(d) order by d; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL d 23 NULL 5 -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) NOT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - UNIQUE KEY `c` (`c`), - KEY `d2` (`d`), - KEY `d` (`d`), - KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t1; -create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb; -insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ad','ad'),(4,4,'afe','afe'); -commit; -alter table t1 add index (c(2)); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - KEY `c` (`c`(2)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -alter table t1 add unique index (d(10)); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - UNIQUE KEY `d` (`d`(10)), - KEY `c` (`c`(2)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -insert into t1 values(5,1,'ggg','ggg'); -select * from t1; -a b c d -1 1 ab ab -2 2 ac ac -3 3 ad ad -4 4 afe afe -5 1 ggg ggg -select * from t1 force index(c) order by c; -a b c d -1 1 ab ab -2 2 ac ac -3 3 ad ad -4 4 afe afe -5 1 ggg ggg -select * from t1 force index(d) order by d; -a b c d -1 1 ab ab -2 2 ac ac -3 3 ad ad -4 4 afe afe -5 1 ggg ggg -explain select * from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort -explain select * from t1 force index(c) order by c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort -explain select * from t1 force index(d) order by d; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 5 Using filesort -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - UNIQUE KEY `d` (`d`(10)), - KEY `c` (`c`(2)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -alter table t1 drop index d; -insert into t1 values(8,9,'fff','fff'); -select * from t1; -a b c d -1 1 ab ab -2 2 ac ac -3 3 ad ad -4 4 afe afe -5 1 ggg ggg -8 9 fff fff -select * from t1 force index(c) order by c; -a b c d -1 1 ab ab -2 2 ac ac -3 3 ad ad -4 4 afe afe -8 9 fff fff -5 1 ggg ggg -explain select * from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort -explain select * from t1 force index(c) order by c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort -explain select * from t1 order by d; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using filesort -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - KEY `c` (`c`(2)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t1; -create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb; -insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe'); -commit; -alter table t1 add unique index (b,c); -insert into t1 values(8,9,'fff','fff'); -select * from t1; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -select * from t1 force index(b) order by b; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -explain select * from t1 force index(b) order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 16 NULL 5 -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - UNIQUE KEY `b` (`b`,`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -alter table t1 add index (b,c); -insert into t1 values(11,11,'kkk','kkk'); -select * from t1; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -11 11 kkk kkk -select * from t1 force index(b) order by b; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -11 11 kkk kkk -explain select * from t1 force index(b) order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 16 NULL 6 -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - UNIQUE KEY `b` (`b`,`c`), - KEY `b_2` (`b`,`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -alter table t1 add unique index (c,d); -insert into t1 values(13,13,'yyy','aaa'); -select * from t1; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -11 11 kkk kkk -13 13 yyy aaa -select * from t1 force index(b) order by b; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -11 11 kkk kkk -13 13 yyy aaa -select * from t1 force index(c) order by c; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -11 11 kkk kkk -13 13 yyy aaa -explain select * from t1 force index(b) order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 16 NULL 7 -explain select * from t1 force index(c) order by c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL c 34 NULL 7 -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - UNIQUE KEY `b` (`b`,`c`), - UNIQUE KEY `c` (`c`,`d`), - KEY `b_2` (`b`,`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t1; -create table t1(a int not null, b int not null, c int, primary key (a), key (b)) engine = innodb; -create table t3(a int not null, c int not null, d int, primary key (a), key (c)) engine = innodb; -create table t4(a int not null, d int not null, e int, primary key (a), key (d)) engine = innodb; -create table t2(a int not null, b int not null, c int not null, d int not null, e int, -foreign key (b) references t1(b) on delete cascade, -foreign key (c) references t3(c), foreign key (d) references t4(d)) -engine = innodb; -alter table t1 drop index b; -ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint -alter table t3 drop index c; -ERROR HY000: Cannot drop index 'c': needed in a foreign key constraint -alter table t4 drop index d; -ERROR HY000: Cannot drop index 'd': needed in a foreign key constraint -alter table t2 drop index b; -ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint -alter table t2 drop index b, drop index c, drop index d; -ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint -create unique index dc on t2 (d,c); -create index dc on t1 (b,c); -alter table t2 add primary key (a); -insert into t1 values (1,1,1); -insert into t3 values (1,1,1); -insert into t4 values (1,1,1); -insert into t2 values (1,1,1,1,1); -commit; -alter table t4 add constraint dc foreign key (a) references t1(a); -show create table t4; -Table Create Table -t4 CREATE TABLE `t4` ( - `a` int(11) NOT NULL, - `d` int(11) NOT NULL, - `e` int(11) DEFAULT NULL, - PRIMARY KEY (`a`), - KEY `d` (`d`), - CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -alter table t3 add constraint dc foreign key (a) references t1(a); -ERROR HY000: Can't create table '#sql-temporary' (errno: 121) -show create table t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `a` int(11) NOT NULL, - `c` int(11) NOT NULL, - `d` int(11) DEFAULT NULL, - PRIMARY KEY (`a`), - KEY `c` (`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -alter table t2 drop index b, add index (b); -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `a` int(11) NOT NULL, - `b` int(11) NOT NULL, - `c` int(11) NOT NULL, - `d` int(11) NOT NULL, - `e` int(11) DEFAULT NULL, - PRIMARY KEY (`a`), - UNIQUE KEY `dc` (`d`,`c`), - KEY `c` (`c`), - KEY `b` (`b`), - CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`b`) ON DELETE CASCADE, - CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`c`) REFERENCES `t3` (`c`), - CONSTRAINT `t2_ibfk_3` FOREIGN KEY (`d`) REFERENCES `t4` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -delete from t1; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) -drop index dc on t4; -ERROR 42000: Can't DROP 'dc'; check that column/key exists -alter table t3 drop foreign key dc; -ERROR HY000: Error on rename of './test/t3' to '#sql2-temporary' (errno: 152) -alter table t4 drop foreign key dc; -select * from t2; -a b c d e -1 1 1 1 1 -delete from t1; -select * from t2; -a b c d e -drop table t2,t4,t3,t1; -create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb default charset=utf8; -insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe'); -commit; -alter table t1 add unique index (b); -ERROR 23000: Duplicate entry '2' for key 'b' -insert into t1 values(8,9,'fff','fff'); -select * from t1; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 -alter table t1 add index (b); -insert into t1 values(10,10,'kkk','iii'); -select * from t1; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -select * from t1 force index(b) order by b; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -explain select * from t1 force index(b) order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 5 NULL 6 -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 -alter table t1 add unique index (c), add index (d); -insert into t1 values(11,11,'aaa','mmm'); -select * from t1; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -11 11 aaa mmm -select * from t1 force index(b) order by b; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -11 11 aaa mmm -select * from t1 force index(c) order by c; -a b c d -11 11 aaa mmm -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -select * from t1 force index(d) order by d; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -11 11 aaa mmm -explain select * from t1 force index(b) order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 5 NULL 7 -explain select * from t1 force index(c) order by c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL c 31 NULL 7 -explain select * from t1 force index(d) order by d; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL d 63 NULL 7 -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - UNIQUE KEY `c` (`c`), - KEY `b` (`b`), - KEY `d` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -drop table t1; -create table t1(a int not null, b int) engine = innodb; -insert into t1 values (1,1),(1,1),(1,1),(1,1); -alter table t1 add unique index (a); -ERROR 23000: Duplicate entry '1' for key 'a' -alter table t1 add unique index (b); -ERROR 23000: Duplicate entry '1' for key 'b' -alter table t1 add unique index (a), add unique index(b); -ERROR 23000: Duplicate entry '1' for key 'a' -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t1; -create table t1(a int not null, c int not null,b int, primary key(a), unique key(c), key(b)) engine = innodb; -alter table t1 drop index c, drop index b; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `c` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t1; -create table t1(a int not null, b int, primary key(a)) engine = innodb; -alter table t1 add index (b); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - PRIMARY KEY (`a`), - KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t1; -create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb; -insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe'); -alter table t1 add unique index (b), add unique index (c), add unique index (d); -ERROR 23000: Duplicate entry '4' for key 'b' -alter table t1 add unique index (c), add unique index (b), add index (d); -ERROR 23000: Duplicate entry 'ac' for key 'c' -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t1; -create table t1(a int not null, b int not null, c int, primary key (a), key(c)) engine=innodb; -insert into t1 values (5,1,5),(4,2,4),(3,3,3),(2,4,2),(1,5,1); -alter table t1 add unique index (b); -insert into t1 values (10,20,20),(11,19,19),(12,18,18),(13,17,17); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) NOT NULL, - `c` int(11) DEFAULT NULL, - PRIMARY KEY (`a`), - UNIQUE KEY `b` (`b`), - KEY `c` (`c`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -explain select * from t1 force index(c) order by c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL c 5 NULL 9 -explain select * from t1 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 9 -explain select * from t1 force index(b) order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 4 NULL 9 -select * from t1 order by a; -a b c -1 5 1 -2 4 2 -3 3 3 -4 2 4 -5 1 5 -10 20 20 -11 19 19 -12 18 18 -13 17 17 -select * from t1 force index(b) order by b; -a b c -5 1 5 -4 2 4 -3 3 3 -2 4 2 -1 5 1 -13 17 17 -12 18 18 -11 19 19 -10 20 20 -select * from t1 force index(c) order by c; -a b c -1 5 1 -2 4 2 -3 3 3 -4 2 4 -5 1 5 -13 17 17 -12 18 18 -11 19 19 -10 20 20 -drop table t1; -create table t1(a int not null, b int not null) engine=innodb; -insert into t1 values (1,1); -alter table t1 add primary key(b); -insert into t1 values (2,2); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) NOT NULL, - PRIMARY KEY (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -select * from t1; -a b -1 1 -2 2 -explain select * from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -explain select * from t1 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using filesort -explain select * from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 -checksum table t1; -Table Checksum -test.t1 582702641 -drop table t1; -create table t1(a int not null) engine=innodb; -insert into t1 values (1); -alter table t1 add primary key(a); -insert into t1 values (2); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -commit; -select * from t1; -a -1 -2 -explain select * from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index -explain select * from t1 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index -drop table t1; -create table t2(d varchar(17) primary key) engine=innodb default charset=utf8; -create table t3(a int primary key) engine=innodb; -insert into t3 values(22),(44),(33),(55),(66); -insert into t2 values ('jejdkrun87'),('adfd72nh9k'), -('adfdpplkeock'),('adfdijnmnb78k'),('adfdijn0loKNHJik'); -create table t1(a int, b blob, c text, d text not null) -engine=innodb default charset = utf8; -insert into t1 -select a,left(repeat(d,100*a),65535),repeat(d,20*a),d from t2,t3; -drop table t2, t3; -select count(*) from t1 where a=44; -count(*) -5 -select a, -length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a),d from t1; -a length(b) b=left(repeat(d,100*a),65535) length(c) c=repeat(d,20*a) d -22 22000 1 4400 1 adfd72nh9k -22 35200 1 7040 1 adfdijn0loKNHJik -22 28600 1 5720 1 adfdijnmnb78k -22 26400 1 5280 1 adfdpplkeock -22 22000 1 4400 1 jejdkrun87 -33 33000 1 6600 1 adfd72nh9k -33 52800 1 10560 1 adfdijn0loKNHJik -33 42900 1 8580 1 adfdijnmnb78k -33 39600 1 7920 1 adfdpplkeock -33 33000 1 6600 1 jejdkrun87 -44 44000 1 8800 1 adfd72nh9k -44 65535 1 14080 1 adfdijn0loKNHJik -44 57200 1 11440 1 adfdijnmnb78k -44 52800 1 10560 1 adfdpplkeock -44 44000 1 8800 1 jejdkrun87 -55 55000 1 11000 1 adfd72nh9k -55 65535 1 17600 1 adfdijn0loKNHJik -55 65535 1 14300 1 adfdijnmnb78k -55 65535 1 13200 1 adfdpplkeock -55 55000 1 11000 1 jejdkrun87 -66 65535 1 13200 1 adfd72nh9k -66 65535 1 21120 1 adfdijn0loKNHJik -66 65535 1 17160 1 adfdijnmnb78k -66 65535 1 15840 1 adfdpplkeock -66 65535 1 13200 1 jejdkrun87 -alter table t1 add primary key (a), add key (b(20)); -ERROR 23000: Duplicate entry '22' for key 'PRIMARY' -delete from t1 where a%2; -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -alter table t1 add primary key (a,b(255),c(255)), add key (b(767)); -select count(*) from t1 where a=44; -count(*) -5 -select a, -length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a),d from t1; -a length(b) b=left(repeat(d,100*a),65535) length(c) c=repeat(d,20*a) d -22 22000 1 4400 1 adfd72nh9k -22 35200 1 7040 1 adfdijn0loKNHJik -22 28600 1 5720 1 adfdijnmnb78k -22 26400 1 5280 1 adfdpplkeock -22 22000 1 4400 1 jejdkrun87 -44 44000 1 8800 1 adfd72nh9k -44 65535 1 14080 1 adfdijn0loKNHJik -44 57200 1 11440 1 adfdijnmnb78k -44 52800 1 10560 1 adfdpplkeock -44 44000 1 8800 1 jejdkrun87 -66 65535 1 13200 1 adfd72nh9k -66 65535 1 21120 1 adfdijn0loKNHJik -66 65535 1 17160 1 adfdijnmnb78k -66 65535 1 15840 1 adfdpplkeock -66 65535 1 13200 1 jejdkrun87 -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL DEFAULT '0', - `b` blob NOT NULL, - `c` text NOT NULL, - `d` text NOT NULL, - PRIMARY KEY (`a`,`b`(255),`c`(255)), - KEY `b` (`b`(767)) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -explain select * from t1 where b like 'adfd%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL b NULL NULL NULL 15 Using where -create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb; -insert into t2 select a,left(b,255) from t1; -drop table t1; -rename table t2 to t1; -set innodb_lock_wait_timeout=1; -begin; -select a from t1 limit 1 for update; -a -22 -set innodb_lock_wait_timeout=1; -create index t1ba on t1 (b,a); -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -commit; -begin; -select a from t1 limit 1 lock in share mode; -a -22 -create index t1ba on t1 (b,a); -drop index t1ba on t1; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -commit; -explain select a from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL t1ba 261 NULL 15 Using index -select a,sleep(2+a/100) from t1 order by b limit 3; -select sleep(1); -sleep(1) -0 -drop index t1ba on t1; -a sleep(2+a/100) -22 0 -44 0 -66 0 -explain select a from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 261 NULL 15 Using index; Using filesort -select a from t1 order by b limit 3; -a -22 -66 -44 -commit; -drop table t1; -set global innodb_file_per_table=on; -set global innodb_file_format='Barracuda'; -create table t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob, -i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob, -q blob,r blob,s blob,t blob,u blob) -engine=innodb row_format=dynamic; -create index t1a on t1 (a(1)); -create index t1b on t1 (b(1)); -create index t1c on t1 (c(1)); -create index t1d on t1 (d(1)); -create index t1e on t1 (e(1)); -create index t1f on t1 (f(1)); -create index t1g on t1 (g(1)); -create index t1h on t1 (h(1)); -create index t1i on t1 (i(1)); -create index t1j on t1 (j(1)); -create index t1k on t1 (k(1)); -create index t1l on t1 (l(1)); -create index t1m on t1 (m(1)); -create index t1n on t1 (n(1)); -create index t1o on t1 (o(1)); -create index t1p on t1 (p(1)); -create index t1q on t1 (q(1)); -create index t1r on t1 (r(1)); -create index t1s on t1 (s(1)); -create index t1t on t1 (t(1)); -create index t1u on t1 (u(1)); -ERROR HY000: Too big row -create index t1ut on t1 (u(1), t(1)); -ERROR HY000: Too big row -create index t1st on t1 (s(1), t(1)); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` blob, - `b` blob, - `c` blob, - `d` blob, - `e` blob, - `f` blob, - `g` blob, - `h` blob, - `i` blob, - `j` blob, - `k` blob, - `l` blob, - `m` blob, - `n` blob, - `o` blob, - `p` blob, - `q` blob, - `r` blob, - `s` blob, - `t` blob, - `u` blob, - KEY `t1a` (`a`(1)), - KEY `t1b` (`b`(1)), - KEY `t1c` (`c`(1)), - KEY `t1d` (`d`(1)), - KEY `t1e` (`e`(1)), - KEY `t1f` (`f`(1)), - KEY `t1g` (`g`(1)), - KEY `t1h` (`h`(1)), - KEY `t1i` (`i`(1)), - KEY `t1j` (`j`(1)), - KEY `t1k` (`k`(1)), - KEY `t1l` (`l`(1)), - KEY `t1m` (`m`(1)), - KEY `t1n` (`n`(1)), - KEY `t1o` (`o`(1)), - KEY `t1p` (`p`(1)), - KEY `t1q` (`q`(1)), - KEY `t1r` (`r`(1)), - KEY `t1s` (`s`(1)), - KEY `t1t` (`t`(1)), - KEY `t1st` (`s`(1),`t`(1)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC -create index t1u on t1 (u(1)); -ERROR HY000: Too big row -alter table t1 row_format=compact; -create index t1u on t1 (u(1)); -drop table t1; -set global innodb_file_per_table=0; -set global innodb_file_format=Antelope; -SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; -SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; -CREATE TABLE t1( -c1 BIGINT(12) NOT NULL, -PRIMARY KEY (c1) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -CREATE TABLE t2( -c1 BIGINT(16) NOT NULL, -c2 BIGINT(12) NOT NULL, -c3 BIGINT(12) NOT NULL, -PRIMARY KEY (c1) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca -FOREIGN KEY (c3) REFERENCES t1(c1); -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `c1` bigint(16) NOT NULL, - `c2` bigint(12) NOT NULL, - `c3` bigint(12) NOT NULL, - PRIMARY KEY (`c1`), - KEY `fk_t2_ca` (`c3`), - CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -CREATE INDEX i_t2_c3_c2 ON t2(c3, c2); -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `c1` bigint(16) NOT NULL, - `c2` bigint(12) NOT NULL, - `c3` bigint(12) NOT NULL, - PRIMARY KEY (`c1`), - KEY `i_t2_c3_c2` (`c3`,`c2`), - CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; -INSERT INTO t2 VALUES(0,0,0); -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`)) -INSERT INTO t1 VALUES(0); -INSERT INTO t2 VALUES(0,0,0); -DROP TABLE t2; -CREATE TABLE t2( -c1 BIGINT(16) NOT NULL, -c2 BIGINT(12) NOT NULL, -c3 BIGINT(12) NOT NULL, -PRIMARY KEY (c1,c2,c3) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca -FOREIGN KEY (c3) REFERENCES t1(c1); -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `c1` bigint(16) NOT NULL, - `c2` bigint(12) NOT NULL, - `c3` bigint(12) NOT NULL, - PRIMARY KEY (`c1`,`c2`,`c3`), - KEY `fk_t2_ca` (`c3`), - CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -CREATE INDEX i_t2_c3_c2 ON t2(c3, c2); -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `c1` bigint(16) NOT NULL, - `c2` bigint(12) NOT NULL, - `c3` bigint(12) NOT NULL, - PRIMARY KEY (`c1`,`c2`,`c3`), - KEY `i_t2_c3_c2` (`c3`,`c2`), - CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -INSERT INTO t2 VALUES(0,0,1); -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`)) -INSERT INTO t2 VALUES(0,0,0); -DELETE FROM t1; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`) REFERENCES `t1` (`c1`)) -DELETE FROM t2; -DROP TABLE t2; -DROP TABLE t1; -CREATE TABLE t1( -c1 BIGINT(12) NOT NULL, -c2 INT(4) NOT NULL, -PRIMARY KEY (c2,c1) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -CREATE TABLE t2( -c1 BIGINT(16) NOT NULL, -c2 BIGINT(12) NOT NULL, -c3 BIGINT(12) NOT NULL, -PRIMARY KEY (c1) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca -FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1); -ERROR HY000: Can't create table '#sql-temporary' (errno: 150) -ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca -FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2); -ERROR HY000: Can't create table '#sql-temporary' (errno: 150) -ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca -FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1); -ERROR HY000: Can't create table '#sql-temporary' (errno: 150) -ALTER TABLE t1 MODIFY COLUMN c2 BIGINT(12) NOT NULL; -ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca -FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2); -ERROR HY000: Can't create table '#sql-temporary' (errno: 150) -ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca -FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` bigint(12) NOT NULL, - `c2` bigint(12) NOT NULL, - PRIMARY KEY (`c2`,`c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `c1` bigint(16) NOT NULL, - `c2` bigint(12) NOT NULL, - `c3` bigint(12) NOT NULL, - PRIMARY KEY (`c1`), - KEY `fk_t2_ca` (`c3`,`c2`), - CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -CREATE INDEX i_t2_c2_c1 ON t2(c2, c1); -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `c1` bigint(16) NOT NULL, - `c2` bigint(12) NOT NULL, - `c3` bigint(12) NOT NULL, - PRIMARY KEY (`c1`), - KEY `fk_t2_ca` (`c3`,`c2`), - KEY `i_t2_c2_c1` (`c2`,`c1`), - CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -CREATE INDEX i_t2_c3_c1_c2 ON t2(c3, c1, c2); -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `c1` bigint(16) NOT NULL, - `c2` bigint(12) NOT NULL, - `c3` bigint(12) NOT NULL, - PRIMARY KEY (`c1`), - KEY `fk_t2_ca` (`c3`,`c2`), - KEY `i_t2_c2_c1` (`c2`,`c1`), - KEY `i_t2_c3_c1_c2` (`c3`,`c1`,`c2`), - CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -CREATE INDEX i_t2_c3_c2 ON t2(c3, c2); -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `c1` bigint(16) NOT NULL, - `c2` bigint(12) NOT NULL, - `c3` bigint(12) NOT NULL, - PRIMARY KEY (`c1`), - KEY `i_t2_c2_c1` (`c2`,`c1`), - KEY `i_t2_c3_c1_c2` (`c3`,`c1`,`c2`), - KEY `i_t2_c3_c2` (`c3`,`c2`), - CONSTRAINT `fk_t2_ca` FOREIGN KEY (`c3`, `c2`) REFERENCES `t1` (`c2`, `c1`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -DROP TABLE t2; -DROP TABLE t1; -CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e'); -BEGIN; -SELECT * FROM t1; -a b -3 a -3 b -1 c -0 d -1 e -CREATE INDEX t1a ON t1(a); -SELECT * FROM t1; -a b -3 a -3 b -1 c -0 d -1 e -SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a; -ERROR HY000: Table definition has changed, please retry transaction -SELECT * FROM t1; -a b -3 a -3 b -1 c -0 d -1 e -COMMIT; -SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a; -a b -0 d -1 c -1 e -3 a -3 b -DROP TABLE t1; diff --git a/storage/innodb_plugin/mysql-test/innodb-index.test b/storage/innodb_plugin/mysql-test/innodb-index.test deleted file mode 100644 index 42888ff3686..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-index.test +++ /dev/null @@ -1,534 +0,0 @@ --- source include/have_innodb.inc - -create table t1(a int not null, b int, c char(10) not null, d varchar(20)) engine = innodb; -insert into t1 values (5,5,'oo','oo'),(4,4,'tr','tr'),(3,4,'ad','ad'),(2,3,'ak','ak'); -commit; ---error ER_DUP_KEYNAME -alter table t1 add index b (b), add index b (b); ---error ER_DUP_FIELDNAME -alter table t1 add index (b,b); -alter table t1 add index d2 (d); -show create table t1; -explain select * from t1 force index(d2) order by d; -select * from t1 force index (d2) order by d; ---error ER_DUP_ENTRY -alter table t1 add unique index (b); -show create table t1; -alter table t1 add index (b); -show create table t1; - -# Check how existing tables interfere with temporary tables. -CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB; - ---error 156 -alter table t1 add unique index (c), add index (d); -rename table `t1#1` to `t1#2`; ---error 156 -alter table t1 add unique index (c), add index (d); -drop table `t1#2`; - -alter table t1 add unique index (c), add index (d); -show create table t1; -explain select * from t1 force index(c) order by c; -alter table t1 add primary key (a), drop index c; -show create table t1; ---error ER_MULTIPLE_PRI_KEY -alter table t1 add primary key (c); ---error ER_DUP_ENTRY -alter table t1 drop primary key, add primary key (b); -create unique index c on t1 (c); -show create table t1; -explain select * from t1 force index(c) order by c; -select * from t1 force index(c) order by c; -alter table t1 drop index b, add index (b); -show create table t1; -insert into t1 values(6,1,'ggg','ggg'); -select * from t1; -select * from t1 force index(b) order by b; -select * from t1 force index(c) order by c; -select * from t1 force index(d) order by d; -explain select * from t1 force index(b) order by b; -explain select * from t1 force index(c) order by c; -explain select * from t1 force index(d) order by d; -show create table t1; -drop table t1; - -create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb; -insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ad','ad'),(4,4,'afe','afe'); -commit; -alter table t1 add index (c(2)); -show create table t1; -alter table t1 add unique index (d(10)); -show create table t1; -insert into t1 values(5,1,'ggg','ggg'); -select * from t1; -select * from t1 force index(c) order by c; -select * from t1 force index(d) order by d; -explain select * from t1 order by b; -explain select * from t1 force index(c) order by c; -explain select * from t1 force index(d) order by d; -show create table t1; -alter table t1 drop index d; -insert into t1 values(8,9,'fff','fff'); -select * from t1; -select * from t1 force index(c) order by c; -explain select * from t1 order by b; -explain select * from t1 force index(c) order by c; -explain select * from t1 order by d; -show create table t1; -drop table t1; - -create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb; -insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe'); -commit; -alter table t1 add unique index (b,c); -insert into t1 values(8,9,'fff','fff'); -select * from t1; -select * from t1 force index(b) order by b; -explain select * from t1 force index(b) order by b; -show create table t1; -alter table t1 add index (b,c); -insert into t1 values(11,11,'kkk','kkk'); -select * from t1; -select * from t1 force index(b) order by b; -explain select * from t1 force index(b) order by b; -show create table t1; -alter table t1 add unique index (c,d); -insert into t1 values(13,13,'yyy','aaa'); -select * from t1; -select * from t1 force index(b) order by b; -select * from t1 force index(c) order by c; -explain select * from t1 force index(b) order by b; -explain select * from t1 force index(c) order by c; -show create table t1; -drop table t1; - -create table t1(a int not null, b int not null, c int, primary key (a), key (b)) engine = innodb; -create table t3(a int not null, c int not null, d int, primary key (a), key (c)) engine = innodb; -create table t4(a int not null, d int not null, e int, primary key (a), key (d)) engine = innodb; -create table t2(a int not null, b int not null, c int not null, d int not null, e int, -foreign key (b) references t1(b) on delete cascade, -foreign key (c) references t3(c), foreign key (d) references t4(d)) -engine = innodb; ---error ER_DROP_INDEX_FK -alter table t1 drop index b; ---error ER_DROP_INDEX_FK -alter table t3 drop index c; ---error ER_DROP_INDEX_FK -alter table t4 drop index d; ---error ER_DROP_INDEX_FK -alter table t2 drop index b; ---error ER_DROP_INDEX_FK -alter table t2 drop index b, drop index c, drop index d; -# Apparently, the following makes mysql_alter_table() drop index d. -create unique index dc on t2 (d,c); -create index dc on t1 (b,c); -# This should preserve the foreign key constraints. -alter table t2 add primary key (a); -insert into t1 values (1,1,1); -insert into t3 values (1,1,1); -insert into t4 values (1,1,1); -insert into t2 values (1,1,1,1,1); -commit; -alter table t4 add constraint dc foreign key (a) references t1(a); -show create table t4; ---replace_regex /'test\.#sql-[0-9a-f_]*'/'#sql-temporary'/ -# a foreign key 'test/dc' already exists ---error ER_CANT_CREATE_TABLE -alter table t3 add constraint dc foreign key (a) references t1(a); -show create table t3; -alter table t2 drop index b, add index (b); -show create table t2; ---error ER_ROW_IS_REFERENCED_2 -delete from t1; ---error ER_CANT_DROP_FIELD_OR_KEY -drop index dc on t4; -# there is no foreign key dc on t3 ---replace_regex /'\.\/test\/#sql2-[0-9a-f-]*'/'#sql2-temporary'/ ---error ER_ERROR_ON_RENAME -alter table t3 drop foreign key dc; -alter table t4 drop foreign key dc; -select * from t2; -delete from t1; -select * from t2; - -drop table t2,t4,t3,t1; - --- let charset = utf8 --- source include/innodb-index.inc - -create table t1(a int not null, b int) engine = innodb; -insert into t1 values (1,1),(1,1),(1,1),(1,1); ---error ER_DUP_ENTRY -alter table t1 add unique index (a); ---error ER_DUP_ENTRY -alter table t1 add unique index (b); ---error ER_DUP_ENTRY -alter table t1 add unique index (a), add unique index(b); -show create table t1; -drop table t1; - -create table t1(a int not null, c int not null,b int, primary key(a), unique key(c), key(b)) engine = innodb; -alter table t1 drop index c, drop index b; -show create table t1; -drop table t1; - -create table t1(a int not null, b int, primary key(a)) engine = innodb; -alter table t1 add index (b); -show create table t1; -drop table t1; - -create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb; -insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,3,'ac','ac'),(4,4,'afe','afe'),(5,4,'affe','affe'); ---error ER_DUP_ENTRY -alter table t1 add unique index (b), add unique index (c), add unique index (d); ---error ER_DUP_ENTRY -alter table t1 add unique index (c), add unique index (b), add index (d); -show create table t1; -drop table t1; - -create table t1(a int not null, b int not null, c int, primary key (a), key(c)) engine=innodb; -insert into t1 values (5,1,5),(4,2,4),(3,3,3),(2,4,2),(1,5,1); -alter table t1 add unique index (b); -insert into t1 values (10,20,20),(11,19,19),(12,18,18),(13,17,17); -show create table t1; -check table t1; -explain select * from t1 force index(c) order by c; -explain select * from t1 order by a; -explain select * from t1 force index(b) order by b; -select * from t1 order by a; -select * from t1 force index(b) order by b; -select * from t1 force index(c) order by c; -drop table t1; - -create table t1(a int not null, b int not null) engine=innodb; -insert into t1 values (1,1); -alter table t1 add primary key(b); -insert into t1 values (2,2); -show create table t1; -check table t1; -select * from t1; -explain select * from t1; -explain select * from t1 order by a; -explain select * from t1 order by b; -checksum table t1; -drop table t1; - -create table t1(a int not null) engine=innodb; -insert into t1 values (1); -alter table t1 add primary key(a); -insert into t1 values (2); -show create table t1; -check table t1; -commit; -select * from t1; -explain select * from t1; -explain select * from t1 order by a; -drop table t1; - -create table t2(d varchar(17) primary key) engine=innodb default charset=utf8; -create table t3(a int primary key) engine=innodb; - -insert into t3 values(22),(44),(33),(55),(66); - -insert into t2 values ('jejdkrun87'),('adfd72nh9k'), -('adfdpplkeock'),('adfdijnmnb78k'),('adfdijn0loKNHJik'); - -create table t1(a int, b blob, c text, d text not null) -engine=innodb default charset = utf8; - -# r2667 The following test is disabled because MySQL behavior changed. -# r2667 The test was added with this comment: -# r2667 -# r2667 ------------------------------------------------------------------------ -# r2667 r1699 | marko | 2007-08-10 19:53:19 +0300 (Fri, 10 Aug 2007) | 5 lines -# r2667 -# r2667 branches/zip: Add changes that accidentally omitted from r1698: -# r2667 -# r2667 innodb-index.test, innodb-index.result: Add a test for creating -# r2667 a PRIMARY KEY on a column that contains a NULL value. -# r2667 ------------------------------------------------------------------------ -# r2667 -# r2667 but in BZR-r2667: -# r2667 http://bazaar.launchpad.net/~mysql/mysql-server/mysql-5.1/revision/davi%40mysql.com-20080617141221-8yre8ys9j4uw3xx5?start_revid=joerg%40mysql.com-20080630105418-7qoe5ehomgrcdb89 -# r2667 MySQL changed the behavior to do full table copy when creating PRIMARY INDEX -# r2667 on a non-NULL column instead of calling ::add_index() which would fail (and -# r2667 this is what we were testing here). Before r2667 the code execution path was -# r2667 like this (when adding PRIMARY INDEX on a non-NULL column with ALTER TABLE): -# r2667 -# r2667 mysql_alter_table() -# r2667 compare_tables() // would return ALTER_TABLE_INDEX_CHANGED -# r2667 ::add_index() // would fail with "primary index cannot contain NULL" -# r2667 -# r2667 after r2667 the code execution path is the following: -# r2667 -# r2667 mysql_alter_table() -# r2667 compare_tables() // returns ALTER_TABLE_DATA_CHANGED -# r2667 full copy is done, without calling ::add_index() -# r2667 -# r2667 To enable, remove "# r2667: " below. -# r2667 -# r2667: insert into t1 values (null,null,null,'null'); -insert into t1 -select a,left(repeat(d,100*a),65535),repeat(d,20*a),d from t2,t3; -drop table t2, t3; -select count(*) from t1 where a=44; -select a, -length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a),d from t1; -# r2667: --error ER_PRIMARY_CANT_HAVE_NULL -# r2667: alter table t1 add primary key (a), add key (b(20)); -# r2667: delete from t1 where d='null'; ---error ER_DUP_ENTRY -alter table t1 add primary key (a), add key (b(20)); -delete from t1 where a%2; -check table t1; -alter table t1 add primary key (a,b(255),c(255)), add key (b(767)); -select count(*) from t1 where a=44; -select a, -length(b),b=left(repeat(d,100*a),65535),length(c),c=repeat(d,20*a),d from t1; -show create table t1; -check table t1; -explain select * from t1 where b like 'adfd%'; - -# -# Test locking -# - -create table t2(a int, b varchar(255), primary key(a,b)) engine=innodb; -insert into t2 select a,left(b,255) from t1; -drop table t1; -rename table t2 to t1; - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -set innodb_lock_wait_timeout=1; -begin; -# Obtain an IX lock on the table -select a from t1 limit 1 for update; -connection b; -set innodb_lock_wait_timeout=1; -# This would require an S lock on the table, conflicting with the IX lock. ---error ER_LOCK_WAIT_TIMEOUT -create index t1ba on t1 (b,a); -connection a; -commit; -begin; -# Obtain an IS lock on the table -select a from t1 limit 1 lock in share mode; -connection b; -# This will require an S lock on the table. No conflict with the IS lock. -create index t1ba on t1 (b,a); -# This would require an X lock on the table, conflicting with the IS lock. ---error ER_LOCK_WAIT_TIMEOUT -drop index t1ba on t1; -connection a; -commit; -explain select a from t1 order by b; ---send -select a,sleep(2+a/100) from t1 order by b limit 3; - -# The following DROP INDEX will succeed, altough the SELECT above has -# opened a read view. However, during the execution of the SELECT, -# MySQL should hold a table lock that should block the execution -# of the DROP INDEX below. - -connection b; -select sleep(1); -drop index t1ba on t1; - -# After the index was dropped, subsequent SELECTs will use the same -# read view, but they should not be accessing the dropped index any more. - -connection a; -reap; -explain select a from t1 order by b; -select a from t1 order by b limit 3; -commit; - -connection default; -disconnect a; -disconnect b; - -drop table t1; - -let $per_table=`select @@innodb_file_per_table`; -let $format=`select @@innodb_file_format`; -set global innodb_file_per_table=on; -set global innodb_file_format='Barracuda'; -# Test creating a table that could lead to undo log overflow. -# In the undo log, we write a 768-byte prefix (REC_MAX_INDEX_COL_LEN) -# of each externally stored column that appears as a column prefix in an index. -# For this test case, it would suffice to write 1 byte, though. -create table t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,h blob, - i blob,j blob,k blob,l blob,m blob,n blob,o blob,p blob, - q blob,r blob,s blob,t blob,u blob) - engine=innodb row_format=dynamic; -create index t1a on t1 (a(1)); -create index t1b on t1 (b(1)); -create index t1c on t1 (c(1)); -create index t1d on t1 (d(1)); -create index t1e on t1 (e(1)); -create index t1f on t1 (f(1)); -create index t1g on t1 (g(1)); -create index t1h on t1 (h(1)); -create index t1i on t1 (i(1)); -create index t1j on t1 (j(1)); -create index t1k on t1 (k(1)); -create index t1l on t1 (l(1)); -create index t1m on t1 (m(1)); -create index t1n on t1 (n(1)); -create index t1o on t1 (o(1)); -create index t1p on t1 (p(1)); -create index t1q on t1 (q(1)); -create index t1r on t1 (r(1)); -create index t1s on t1 (s(1)); -create index t1t on t1 (t(1)); ---error 139 -create index t1u on t1 (u(1)); ---error 139 -create index t1ut on t1 (u(1), t(1)); -create index t1st on t1 (s(1), t(1)); -show create table t1; ---error 139 -create index t1u on t1 (u(1)); -alter table t1 row_format=compact; -create index t1u on t1 (u(1)); - -drop table t1; -eval set global innodb_file_per_table=$per_table; -eval set global innodb_file_format=$format; - -# -# Test to check whether CREATE INDEX handles implicit foreign key -# constraint modifications (Issue #70, Bug #38786) -# -SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; -SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; - -CREATE TABLE t1( - c1 BIGINT(12) NOT NULL, - PRIMARY KEY (c1) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - -CREATE TABLE t2( - c1 BIGINT(16) NOT NULL, - c2 BIGINT(12) NOT NULL, - c3 BIGINT(12) NOT NULL, - PRIMARY KEY (c1) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - -ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca - FOREIGN KEY (c3) REFERENCES t1(c1); - -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; - -SHOW CREATE TABLE t2; - -CREATE INDEX i_t2_c3_c2 ON t2(c3, c2); - -SHOW CREATE TABLE t2; - -SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; -SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; - ---error ER_NO_REFERENCED_ROW_2 -INSERT INTO t2 VALUES(0,0,0); -INSERT INTO t1 VALUES(0); -INSERT INTO t2 VALUES(0,0,0); - -DROP TABLE t2; - -CREATE TABLE t2( - c1 BIGINT(16) NOT NULL, - c2 BIGINT(12) NOT NULL, - c3 BIGINT(12) NOT NULL, - PRIMARY KEY (c1,c2,c3) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - -ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca - FOREIGN KEY (c3) REFERENCES t1(c1); - -SHOW CREATE TABLE t2; - -CREATE INDEX i_t2_c3_c2 ON t2(c3, c2); - -SHOW CREATE TABLE t2; ---error ER_NO_REFERENCED_ROW_2 -INSERT INTO t2 VALUES(0,0,1); -INSERT INTO t2 VALUES(0,0,0); ---error ER_ROW_IS_REFERENCED_2 -DELETE FROM t1; -DELETE FROM t2; - -DROP TABLE t2; -DROP TABLE t1; - -CREATE TABLE t1( - c1 BIGINT(12) NOT NULL, - c2 INT(4) NOT NULL, - PRIMARY KEY (c2,c1) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - -CREATE TABLE t2( - c1 BIGINT(16) NOT NULL, - c2 BIGINT(12) NOT NULL, - c3 BIGINT(12) NOT NULL, - PRIMARY KEY (c1) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - ---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/ ---error ER_CANT_CREATE_TABLE -ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca - FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1); ---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/ ---error ER_CANT_CREATE_TABLE -ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca - FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2); ---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/ ---error ER_CANT_CREATE_TABLE -ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca - FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1); -ALTER TABLE t1 MODIFY COLUMN c2 BIGINT(12) NOT NULL; ---replace_regex /'test\.#sql-[0-9_a-f-]*'/'#sql-temporary'/ ---error ER_CANT_CREATE_TABLE -ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca - FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2); - -ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca - FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1); -SHOW CREATE TABLE t1; -SHOW CREATE TABLE t2; -CREATE INDEX i_t2_c2_c1 ON t2(c2, c1); -SHOW CREATE TABLE t2; -CREATE INDEX i_t2_c3_c1_c2 ON t2(c3, c1, c2); -SHOW CREATE TABLE t2; -CREATE INDEX i_t2_c3_c2 ON t2(c3, c2); -SHOW CREATE TABLE t2; - -DROP TABLE t2; -DROP TABLE t1; - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -CREATE TABLE t1 (a INT, b CHAR(1)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (3,'a'),(3,'b'),(1,'c'),(0,'d'),(1,'e'); -connection b; -BEGIN; -SELECT * FROM t1; -connection a; -CREATE INDEX t1a ON t1(a); -connection b; -SELECT * FROM t1; ---error ER_TABLE_DEF_CHANGED -SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a; -SELECT * FROM t1; -COMMIT; -SELECT * FROM t1 FORCE INDEX(t1a) ORDER BY a; -connection default; -disconnect a; -disconnect b; - -DROP TABLE t1; diff --git a/storage/innodb_plugin/mysql-test/innodb-index_ucs2.result b/storage/innodb_plugin/mysql-test/innodb-index_ucs2.result deleted file mode 100644 index c8a1e8c7da1..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-index_ucs2.result +++ /dev/null @@ -1,116 +0,0 @@ -create table t1(a int not null, b int, c char(10), d varchar(20), primary key (a)) engine = innodb default charset=ucs2; -insert into t1 values (1,1,'ab','ab'),(2,2,'ac','ac'),(3,2,'ad','ad'),(4,4,'afe','afe'); -commit; -alter table t1 add unique index (b); -ERROR 23000: Duplicate entry '2' for key 'b' -insert into t1 values(8,9,'fff','fff'); -select * from t1; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 -alter table t1 add index (b); -insert into t1 values(10,10,'kkk','iii'); -select * from t1; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -select * from t1 force index(b) order by b; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -explain select * from t1 force index(b) order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 5 NULL 6 -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - KEY `b` (`b`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 -alter table t1 add unique index (c), add index (d); -insert into t1 values(11,11,'aaa','mmm'); -select * from t1; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -11 11 aaa mmm -select * from t1 force index(b) order by b; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -11 11 aaa mmm -select * from t1 force index(c) order by c; -a b c d -11 11 aaa mmm -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -select * from t1 force index(d) order by d; -a b c d -1 1 ab ab -2 2 ac ac -3 2 ad ad -4 4 afe afe -8 9 fff fff -10 10 kkk iii -11 11 aaa mmm -explain select * from t1 force index(b) order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 5 NULL 7 -explain select * from t1 force index(c) order by c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL c 21 NULL 7 -explain select * from t1 force index(d) order by d; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL d 43 NULL 7 -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `d` varchar(20) DEFAULT NULL, - PRIMARY KEY (`a`), - UNIQUE KEY `c` (`c`), - KEY `b` (`b`), - KEY `d` (`d`) -) ENGINE=InnoDB DEFAULT CHARSET=ucs2 -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -drop table t1; diff --git a/storage/innodb_plugin/mysql-test/innodb-index_ucs2.test b/storage/innodb_plugin/mysql-test/innodb-index_ucs2.test deleted file mode 100644 index fff9a4da1a8..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-index_ucs2.test +++ /dev/null @@ -1,5 +0,0 @@ --- source include/have_innodb.inc --- source include/have_ucs2.inc - --- let charset = ucs2 --- source include/innodb-index.inc diff --git a/storage/innodb_plugin/mysql-test/innodb-lock.result b/storage/innodb_plugin/mysql-test/innodb-lock.result deleted file mode 100644 index 4ace4065c34..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-lock.result +++ /dev/null @@ -1,57 +0,0 @@ -set global innodb_table_locks=1; -select @@innodb_table_locks; -@@innodb_table_locks -1 -drop table if exists t1; -set @@innodb_table_locks=1; -create table t1 (id integer, x integer) engine=INNODB; -insert into t1 values(0, 0); -set autocommit=0; -SELECT * from t1 where id = 0 FOR UPDATE; -id x -0 0 -set autocommit=0; -lock table t1 write; -update t1 set x=1 where id = 0; -select * from t1; -id x -0 1 -commit; -update t1 set x=2 where id = 0; -commit; -unlock tables; -select * from t1; -id x -0 2 -commit; -drop table t1; -set @@innodb_table_locks=0; -create table t1 (id integer primary key, x integer) engine=INNODB; -insert into t1 values(0, 0),(1,1),(2,2); -commit; -SELECT * from t1 where id = 0 FOR UPDATE; -id x -0 0 -set autocommit=0; -set @@innodb_table_locks=0; -lock table t1 write; -update t1 set x=10 where id = 2; -SELECT * from t1 where id = 2; -id x -2 2 -UPDATE t1 set x=3 where id = 2; -commit; -SELECT * from t1; -id x -0 0 -1 1 -2 3 -commit; -unlock tables; -commit; -select * from t1; -id x -0 0 -1 1 -2 10 -drop table t1; diff --git a/storage/innodb_plugin/mysql-test/innodb-lock.test b/storage/innodb_plugin/mysql-test/innodb-lock.test deleted file mode 100644 index eacf7e562be..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-lock.test +++ /dev/null @@ -1,102 +0,0 @@ --- source include/have_innodb.inc - -# -# Check and select innodb lock type -# - -set global innodb_table_locks=1; - -select @@innodb_table_locks; - -# -# Testing of explicit table locks with enforced table locks -# - -connect (con1,localhost,root,,); -connect (con2,localhost,root,,); - ---disable_warnings -drop table if exists t1; ---enable_warnings - -# -# Testing of explicit table locks with enforced table locks -# - -set @@innodb_table_locks=1; - -connection con1; -create table t1 (id integer, x integer) engine=INNODB; -insert into t1 values(0, 0); -set autocommit=0; -SELECT * from t1 where id = 0 FOR UPDATE; - -connection con2; -set autocommit=0; - -# The following statement should hang because con1 is locking the page ---send -lock table t1 write; ---sleep 2 - -connection con1; -update t1 set x=1 where id = 0; -select * from t1; -commit; - -connection con2; -reap; -update t1 set x=2 where id = 0; -commit; -unlock tables; - -connection con1; -select * from t1; -commit; - -drop table t1; - -# -# Try with old lock method (where LOCK TABLE is ignored by InnoDB) -# - -set @@innodb_table_locks=0; - -create table t1 (id integer primary key, x integer) engine=INNODB; -insert into t1 values(0, 0),(1,1),(2,2); -commit; -SELECT * from t1 where id = 0 FOR UPDATE; - -connection con2; -set autocommit=0; -set @@innodb_table_locks=0; - -# The following statement should work becase innodb doesn't check table locks -lock table t1 write; - -connection con1; - -# This will be locked by MySQL ---send -update t1 set x=10 where id = 2; ---sleep 2 - -connection con2; - -# Note that we will get a deadlock if we try to select any rows marked -# for update by con1 ! - -SELECT * from t1 where id = 2; -UPDATE t1 set x=3 where id = 2; -commit; -SELECT * from t1; -commit; -unlock tables; - -connection con1; -reap; -commit; -select * from t1; -drop table t1; - -# End of 4.1 tests diff --git a/storage/innodb_plugin/mysql-test/innodb-master.opt b/storage/innodb_plugin/mysql-test/innodb-master.opt deleted file mode 100644 index 4901efb416c..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-master.opt +++ /dev/null @@ -1 +0,0 @@ ---binlog_cache_size=32768 --innodb_lock_wait_timeout=1 diff --git a/storage/innodb_plugin/mysql-test/innodb-replace.result b/storage/innodb_plugin/mysql-test/innodb-replace.result deleted file mode 100644 index c926bb89a2e..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-replace.result +++ /dev/null @@ -1,13 +0,0 @@ -drop table if exists t1; -create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb; -select * from t1; -c1 c2 stamp -replace delayed into t1 (c1, c2) values ( "text1","11"); -ERROR HY000: DELAYED option not supported for table 't1' -select * from t1; -c1 c2 stamp -replace delayed into t1 (c1, c2) values ( "text1","12"); -ERROR HY000: DELAYED option not supported for table 't1' -select * from t1; -c1 c2 stamp -drop table t1; diff --git a/storage/innodb_plugin/mysql-test/innodb-replace.test b/storage/innodb_plugin/mysql-test/innodb-replace.test deleted file mode 100644 index 8c3aacde5e8..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-replace.test +++ /dev/null @@ -1,22 +0,0 @@ --- source include/have_innodb.inc -# embedded server ignores 'delayed', so skip this --- source include/not_embedded.inc - ---disable_warnings -drop table if exists t1; ---enable_warnings - -# -# Bug #1078 -# -create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) engine=innodb; -select * from t1; ---error ER_DELAYED_NOT_SUPPORTED -replace delayed into t1 (c1, c2) values ( "text1","11"); -select * from t1; ---error ER_DELAYED_NOT_SUPPORTED -replace delayed into t1 (c1, c2) values ( "text1","12"); -select * from t1; -drop table t1; - -# End of 4.1 tests diff --git a/storage/innodb_plugin/mysql-test/innodb-semi-consistent-master.opt b/storage/innodb_plugin/mysql-test/innodb-semi-consistent-master.opt deleted file mode 100644 index e76299453d3..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-semi-consistent-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_lock_wait_timeout=2 diff --git a/storage/innodb_plugin/mysql-test/innodb-semi-consistent.result b/storage/innodb_plugin/mysql-test/innodb-semi-consistent.result deleted file mode 100644 index ca0e362ef80..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-semi-consistent.result +++ /dev/null @@ -1,47 +0,0 @@ -drop table if exists t1; -set binlog_format=mixed; -set session transaction isolation level repeatable read; -create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; -insert into t1 values (1),(2),(3),(4),(5),(6),(7); -set autocommit=0; -select * from t1 where a=3 lock in share mode; -a -3 -set binlog_format=mixed; -set session transaction isolation level repeatable read; -set autocommit=0; -update t1 set a=10 where a=5; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -commit; -set session transaction isolation level read committed; -update t1 set a=10 where a=5; -select * from t1 where a=2 for update; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -select * from t1 where a=2 limit 1 for update; -a -2 -update t1 set a=11 where a=6; -update t1 set a=12 where a=2; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -update t1 set a=13 where a=1; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -commit; -update t1 set a=14 where a=1; -commit; -select * from t1; -a -14 -2 -3 -4 -10 -11 -7 -drop table t1; -create table t1 (a int, b int) engine=myisam; -create table t2 (c int, d int, key (c)) engine=innodb; -insert into t1 values (1,1); -insert into t2 values (1,2); -set session transaction isolation level read committed; -delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1); -drop table t1, t2; diff --git a/storage/innodb_plugin/mysql-test/innodb-semi-consistent.test b/storage/innodb_plugin/mysql-test/innodb-semi-consistent.test deleted file mode 100644 index 61ad7815ca9..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-semi-consistent.test +++ /dev/null @@ -1,68 +0,0 @@ --- source include/not_embedded.inc --- source include/have_innodb.inc - ---disable_warnings -drop table if exists t1; ---enable_warnings - -# basic tests of semi-consistent reads - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -set binlog_format=mixed; -set session transaction isolation level repeatable read; -create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; -insert into t1 values (1),(2),(3),(4),(5),(6),(7); -set autocommit=0; -# this should lock the entire table -select * from t1 where a=3 lock in share mode; -connection b; -set binlog_format=mixed; -set session transaction isolation level repeatable read; -set autocommit=0; --- error ER_LOCK_WAIT_TIMEOUT -update t1 set a=10 where a=5; -connection a; -commit; -connection b; -# perform a semi-consisent read (and unlock non-matching rows) -set session transaction isolation level read committed; -update t1 set a=10 where a=5; -connection a; --- error ER_LOCK_WAIT_TIMEOUT -select * from t1 where a=2 for update; -# this should lock the records (1),(2) -select * from t1 where a=2 limit 1 for update; -connection b; -# semi-consistent read will skip non-matching locked rows a=1, a=2 -update t1 set a=11 where a=6; --- error ER_LOCK_WAIT_TIMEOUT -update t1 set a=12 where a=2; --- error ER_LOCK_WAIT_TIMEOUT -update t1 set a=13 where a=1; -connection a; -commit; -connection b; -update t1 set a=14 where a=1; -commit; -connection a; -select * from t1; -drop table t1; - -connection default; -disconnect a; -disconnect b; - -# Bug 39320 -create table t1 (a int, b int) engine=myisam; -create table t2 (c int, d int, key (c)) engine=innodb; -insert into t1 values (1,1); -insert into t2 values (1,2); -connect (a,localhost,root,,); -connection a; -set session transaction isolation level read committed; -delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1); -connection default; -disconnect a; -drop table t1, t2; diff --git a/storage/innodb_plugin/mysql-test/innodb-timeout.result b/storage/innodb_plugin/mysql-test/innodb-timeout.result deleted file mode 100644 index be9a688cd72..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-timeout.result +++ /dev/null @@ -1,38 +0,0 @@ -set global innodb_lock_wait_timeout=42; -select @@innodb_lock_wait_timeout; -@@innodb_lock_wait_timeout -42 -set innodb_lock_wait_timeout=1; -select @@innodb_lock_wait_timeout; -@@innodb_lock_wait_timeout -1 -select @@innodb_lock_wait_timeout; -@@innodb_lock_wait_timeout -42 -set global innodb_lock_wait_timeout=347; -select @@innodb_lock_wait_timeout; -@@innodb_lock_wait_timeout -42 -set innodb_lock_wait_timeout=1; -select @@innodb_lock_wait_timeout; -@@innodb_lock_wait_timeout -1 -select @@innodb_lock_wait_timeout; -@@innodb_lock_wait_timeout -347 -create table t1(a int primary key)engine=innodb; -begin; -insert into t1 values(1),(2),(3); -select * from t1 for update; -commit; -a -1 -2 -3 -begin; -insert into t1 values(4); -select * from t1 for update; -commit; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -drop table t1; -set global innodb_lock_wait_timeout=50; diff --git a/storage/innodb_plugin/mysql-test/innodb-timeout.test b/storage/innodb_plugin/mysql-test/innodb-timeout.test deleted file mode 100644 index f23fe3cff2d..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-timeout.test +++ /dev/null @@ -1,64 +0,0 @@ --- source include/have_innodb.inc - -let $timeout=`select @@innodb_lock_wait_timeout`; -set global innodb_lock_wait_timeout=42; - -connect (a,localhost,root,,); -connect (b,localhost,root,,); - -connection a; -select @@innodb_lock_wait_timeout; -set innodb_lock_wait_timeout=1; -select @@innodb_lock_wait_timeout; - -connection b; -select @@innodb_lock_wait_timeout; -set global innodb_lock_wait_timeout=347; -select @@innodb_lock_wait_timeout; -set innodb_lock_wait_timeout=1; -select @@innodb_lock_wait_timeout; - -connect (c,localhost,root,,); -connection c; -select @@innodb_lock_wait_timeout; -connection default; -disconnect c; - -connection a; -create table t1(a int primary key)engine=innodb; -begin; -insert into t1 values(1),(2),(3); - -connection b; ---send -select * from t1 for update; - -connection a; -commit; - -connection b; -reap; - -connection a; -begin; -insert into t1 values(4); - -connection b; ---send -select * from t1 for update; - -connection a; -sleep 2; -commit; - -connection b; ---error ER_LOCK_WAIT_TIMEOUT -reap; -drop table t1; - -connection default; - -disconnect a; -disconnect b; - -eval set global innodb_lock_wait_timeout=$timeout; diff --git a/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc-master.opt b/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc-master.opt deleted file mode 100644 index 889834add01..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc-master.opt +++ /dev/null @@ -1,2 +0,0 @@ ---innodb-use-sys-malloc=true ---innodb-use-sys-malloc=true diff --git a/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc.result b/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc.result deleted file mode 100644 index 2ec4c7c8130..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc.result +++ /dev/null @@ -1,48 +0,0 @@ -SELECT @@GLOBAL.innodb_use_sys_malloc; -@@GLOBAL.innodb_use_sys_malloc -1 -1 Expected -SET @@GLOBAL.innodb_use_sys_malloc=0; -ERROR HY000: Variable 'innodb_use_sys_malloc' is a read only variable -Expected error 'Read only variable' -SELECT @@GLOBAL.innodb_use_sys_malloc; -@@GLOBAL.innodb_use_sys_malloc -1 -1 Expected -drop table if exists t1; -create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; -insert into t1 values (1),(2),(3),(4),(5),(6),(7); -select * from t1; -a -1 -2 -3 -4 -5 -6 -7 -drop table t1; -SELECT @@GLOBAL.innodb_use_sys_malloc; -@@GLOBAL.innodb_use_sys_malloc -1 -1 Expected -SET @@GLOBAL.innodb_use_sys_malloc=0; -ERROR HY000: Variable 'innodb_use_sys_malloc' is a read only variable -Expected error 'Read only variable' -SELECT @@GLOBAL.innodb_use_sys_malloc; -@@GLOBAL.innodb_use_sys_malloc -1 -1 Expected -drop table if exists t1; -create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; -insert into t1 values (1),(2),(3),(4),(5),(6),(7); -select * from t1; -a -1 -2 -3 -4 -5 -6 -7 -drop table t1; diff --git a/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc.test b/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc.test deleted file mode 100644 index 325dd19d086..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-use-sys-malloc.test +++ /dev/null @@ -1,48 +0,0 @@ ---source include/have_innodb.inc - -#display current value of innodb_use_sys_malloc -SELECT @@GLOBAL.innodb_use_sys_malloc; ---echo 1 Expected - -#try changing it. Should fail. ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SET @@GLOBAL.innodb_use_sys_malloc=0; ---echo Expected error 'Read only variable' - -SELECT @@GLOBAL.innodb_use_sys_malloc; ---echo 1 Expected - - -#do some stuff to see if it works. ---disable_warnings -drop table if exists t1; ---enable_warnings - -create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; -insert into t1 values (1),(2),(3),(4),(5),(6),(7); -select * from t1; -drop table t1; ---source include/have_innodb.inc - -#display current value of innodb_use_sys_malloc -SELECT @@GLOBAL.innodb_use_sys_malloc; ---echo 1 Expected - -#try changing it. Should fail. ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SET @@GLOBAL.innodb_use_sys_malloc=0; ---echo Expected error 'Read only variable' - -SELECT @@GLOBAL.innodb_use_sys_malloc; ---echo 1 Expected - - -#do some stuff to see if it works. ---disable_warnings -drop table if exists t1; ---enable_warnings - -create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; -insert into t1 values (1),(2),(3),(4),(5),(6),(7); -select * from t1; -drop table t1; diff --git a/storage/innodb_plugin/mysql-test/innodb-zip.result b/storage/innodb_plugin/mysql-test/innodb-zip.result deleted file mode 100644 index b26c4112826..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-zip.result +++ /dev/null @@ -1,421 +0,0 @@ -set global innodb_file_per_table=off; -set global innodb_file_format=`0`; -create table t0(a int primary key) engine=innodb row_format=compressed; -Warnings: -Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. -Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. -create table t00(a int primary key) engine=innodb -key_block_size=4 row_format=compressed; -Warnings: -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=4. -Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. -Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. -create table t1(a int primary key) engine=innodb row_format=dynamic; -Warnings: -Warning 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. -Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. -create table t2(a int primary key) engine=innodb row_format=redundant; -create table t3(a int primary key) engine=innodb row_format=compact; -create table t4(a int primary key) engine=innodb key_block_size=9; -Warnings: -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=9. -create table t5(a int primary key) engine=innodb -key_block_size=1 row_format=redundant; -Warnings: -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1. -set global innodb_file_per_table=on; -create table t6(a int primary key) engine=innodb -key_block_size=1 row_format=redundant; -Warnings: -Warning 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1. -set global innodb_file_format=`1`; -create table t7(a int primary key) engine=innodb -key_block_size=1 row_format=redundant; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -create table t8(a int primary key) engine=innodb -key_block_size=1 row_format=fixed; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. -create table t9(a int primary key) engine=innodb -key_block_size=1 row_format=compact; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -create table t10(a int primary key) engine=innodb -key_block_size=1 row_format=dynamic; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=1 unless ROW_FORMAT=COMPRESSED. -create table t11(a int primary key) engine=innodb -key_block_size=1 row_format=compressed; -create table t12(a int primary key) engine=innodb -key_block_size=1; -create table t13(a int primary key) engine=innodb -row_format=compressed; -create table t14(a int primary key) engine=innodb key_block_size=9; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=9. -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t0 Compact -test t00 Compact -test t1 Compact -test t10 Dynamic -test t11 Compressed -test t12 Compressed -test t13 Compressed -test t14 Compact -test t2 Redundant -test t3 Compact -test t4 Compact -test t5 Redundant -test t6 Redundant -test t7 Redundant -test t8 Compact -test t9 Compact -drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14; -alter table t1 key_block_size=0; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=0. -alter table t1 row_format=dynamic; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t1 Dynamic -alter table t1 row_format=compact; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t1 Compact -alter table t1 row_format=redundant; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t1 Redundant -drop table t1; -create table t1(a int not null, b text, index(b(10))) engine=innodb -key_block_size=1; -create table t2(b text)engine=innodb; -insert into t2 values(concat('1abcdefghijklmnopqrstuvwxyz', repeat('A',5000))); -insert into t1 select 1, b from t2; -commit; -begin; -update t1 set b=repeat('B',100); -select a,left(b,40) from t1 natural join t2; -a left(b,40) -1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA -rollback; -select a,left(b,40) from t1 natural join t2; -a left(b,40) -1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t1 Compressed -test t2 Compact -drop table t1,t2; -SET SESSION innodb_strict_mode = off; -CREATE TABLE t1( -c TEXT NOT NULL, d TEXT NOT NULL, -PRIMARY KEY (c(767),d(767))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs -CREATE TABLE t1( -c TEXT NOT NULL, d TEXT NOT NULL, -PRIMARY KEY (c(767),d(767))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII; -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs -CREATE TABLE t1( -c TEXT NOT NULL, d TEXT NOT NULL, -PRIMARY KEY (c(767),d(767))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII; -drop table t1; -CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs -CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; -INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512)); -DROP TABLE t1; -create table t1( c1 int not null, c2 blob, c3 blob, c4 blob, -primary key(c1, c2(22), c3(22))) -engine = innodb row_format = dynamic; -begin; -insert into t1 values(1, repeat('A', 20000), repeat('B', 20000), -repeat('C', 20000)); -update t1 set c3 = repeat('D', 20000) where c1 = 1; -commit; -select count(*) from t1 where c2 = repeat('A', 20000); -count(*) -1 -select count(*) from t1 where c3 = repeat('D', 20000); -count(*) -1 -select count(*) from t1 where c4 = repeat('C', 20000); -count(*) -1 -update t1 set c3 = repeat('E', 20000) where c1 = 1; -drop table t1; -set global innodb_file_format=`0`; -select @@innodb_file_format; -@@innodb_file_format -Antelope -set global innodb_file_format=`1`; -select @@innodb_file_format; -@@innodb_file_format -Barracuda -set global innodb_file_format=`2`; -ERROR HY000: Incorrect arguments to SET -set global innodb_file_format=`-1`; -ERROR HY000: Incorrect arguments to SET -set global innodb_file_format=`Antelope`; -set global innodb_file_format=`Barracuda`; -set global innodb_file_format=`Cheetah`; -ERROR HY000: Incorrect arguments to SET -set global innodb_file_format=`abc`; -ERROR HY000: Incorrect arguments to SET -set global innodb_file_format=`1a`; -ERROR HY000: Incorrect arguments to SET -set global innodb_file_format=``; -ERROR HY000: Incorrect arguments to SET -set global innodb_file_per_table = on; -set global innodb_file_format = `1`; -set innodb_strict_mode = off; -create table t1 (id int primary key) engine = innodb key_block_size = 0; -Warnings: -Warning 1478 InnoDB: ignoring KEY_BLOCK_SIZE=0. -drop table t1; -set innodb_strict_mode = on; -create table t1 (id int primary key) engine = innodb key_block_size = 0; -ERROR HY000: Can't create table 'test.t1' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 0. Valid values are [1, 2, 4, 8, 16] -Error 1005 Can't create table 'test.t1' (errno: 1478) -create table t2 (id int primary key) engine = innodb key_block_size = 9; -ERROR HY000: Can't create table 'test.t2' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16] -Error 1005 Can't create table 'test.t2' (errno: 1478) -create table t3 (id int primary key) engine = innodb key_block_size = 1; -create table t4 (id int primary key) engine = innodb key_block_size = 2; -create table t5 (id int primary key) engine = innodb key_block_size = 4; -create table t6 (id int primary key) engine = innodb key_block_size = 8; -create table t7 (id int primary key) engine = innodb key_block_size = 16; -create table t8 (id int primary key) engine = innodb row_format = compressed; -create table t9 (id int primary key) engine = innodb row_format = dynamic; -create table t10(id int primary key) engine = innodb row_format = compact; -create table t11(id int primary key) engine = innodb row_format = redundant; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t10 Compact -test t11 Redundant -test t3 Compressed -test t4 Compressed -test t5 Compressed -test t6 Compressed -test t7 Compressed -test t8 Compressed -test t9 Dynamic -drop table t3, t4, t5, t6, t7, t8, t9, t10, t11; -create table t1 (id int primary key) engine = innodb -key_block_size = 8 row_format = compressed; -create table t2 (id int primary key) engine = innodb -key_block_size = 8 row_format = redundant; -ERROR HY000: Can't create table 'test.t2' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.t2' (errno: 1478) -create table t3 (id int primary key) engine = innodb -key_block_size = 8 row_format = compact; -ERROR HY000: Can't create table 'test.t3' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.t3' (errno: 1478) -create table t4 (id int primary key) engine = innodb -key_block_size = 8 row_format = dynamic; -ERROR HY000: Can't create table 'test.t4' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.t4' (errno: 1478) -create table t5 (id int primary key) engine = innodb -key_block_size = 8 row_format = default; -ERROR HY000: Can't create table 'test.t5' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.t5' (errno: 1478) -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t1 Compressed -drop table t1; -create table t1 (id int primary key) engine = innodb -key_block_size = 9 row_format = redundant; -ERROR HY000: Can't create table 'test.t1' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16] -Error 1478 InnoDB: cannot specify ROW_FORMAT = REDUNDANT with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.t1' (errno: 1478) -create table t2 (id int primary key) engine = innodb -key_block_size = 9 row_format = compact; -ERROR HY000: Can't create table 'test.t2' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16] -Error 1478 InnoDB: cannot specify ROW_FORMAT = COMPACT with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.t2' (errno: 1478) -create table t2 (id int primary key) engine = innodb -key_block_size = 9 row_format = dynamic; -ERROR HY000: Can't create table 'test.t2' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: invalid KEY_BLOCK_SIZE = 9. Valid values are [1, 2, 4, 8, 16] -Error 1478 InnoDB: cannot specify ROW_FORMAT = DYNAMIC with KEY_BLOCK_SIZE. -Error 1005 Can't create table 'test.t2' (errno: 1478) -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -set global innodb_file_per_table = off; -create table t1 (id int primary key) engine = innodb key_block_size = 1; -ERROR HY000: Can't create table 'test.t1' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Error 1005 Can't create table 'test.t1' (errno: 1478) -create table t2 (id int primary key) engine = innodb key_block_size = 2; -ERROR HY000: Can't create table 'test.t2' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Error 1005 Can't create table 'test.t2' (errno: 1478) -create table t3 (id int primary key) engine = innodb key_block_size = 4; -ERROR HY000: Can't create table 'test.t3' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Error 1005 Can't create table 'test.t3' (errno: 1478) -create table t4 (id int primary key) engine = innodb key_block_size = 8; -ERROR HY000: Can't create table 'test.t4' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Error 1005 Can't create table 'test.t4' (errno: 1478) -create table t5 (id int primary key) engine = innodb key_block_size = 16; -ERROR HY000: Can't create table 'test.t5' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_per_table. -Error 1005 Can't create table 'test.t5' (errno: 1478) -create table t6 (id int primary key) engine = innodb row_format = compressed; -ERROR HY000: Can't create table 'test.t6' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_per_table. -Error 1005 Can't create table 'test.t6' (errno: 1478) -create table t7 (id int primary key) engine = innodb row_format = dynamic; -ERROR HY000: Can't create table 'test.t7' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_per_table. -Error 1005 Can't create table 'test.t7' (errno: 1478) -create table t8 (id int primary key) engine = innodb row_format = compact; -create table t9 (id int primary key) engine = innodb row_format = redundant; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t8 Compact -test t9 Redundant -drop table t8, t9; -set global innodb_file_per_table = on; -set global innodb_file_format = `0`; -create table t1 (id int primary key) engine = innodb key_block_size = 1; -ERROR HY000: Can't create table 'test.t1' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Error 1005 Can't create table 'test.t1' (errno: 1478) -create table t2 (id int primary key) engine = innodb key_block_size = 2; -ERROR HY000: Can't create table 'test.t2' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Error 1005 Can't create table 'test.t2' (errno: 1478) -create table t3 (id int primary key) engine = innodb key_block_size = 4; -ERROR HY000: Can't create table 'test.t3' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Error 1005 Can't create table 'test.t3' (errno: 1478) -create table t4 (id int primary key) engine = innodb key_block_size = 8; -ERROR HY000: Can't create table 'test.t4' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Error 1005 Can't create table 'test.t4' (errno: 1478) -create table t5 (id int primary key) engine = innodb key_block_size = 16; -ERROR HY000: Can't create table 'test.t5' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: KEY_BLOCK_SIZE requires innodb_file_format > Antelope. -Error 1005 Can't create table 'test.t5' (errno: 1478) -create table t6 (id int primary key) engine = innodb row_format = compressed; -ERROR HY000: Can't create table 'test.t6' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope. -Error 1005 Can't create table 'test.t6' (errno: 1478) -create table t7 (id int primary key) engine = innodb row_format = dynamic; -ERROR HY000: Can't create table 'test.t7' (errno: 1478) -show errors; -Level Code Message -Error 1478 InnoDB: ROW_FORMAT=DYNAMIC requires innodb_file_format > Antelope. -Error 1005 Can't create table 'test.t7' (errno: 1478) -create table t8 (id int primary key) engine = innodb row_format = compact; -create table t9 (id int primary key) engine = innodb row_format = redundant; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -table_schema table_name row_format -test t8 Compact -test t9 Redundant -drop table t8, t9; -set global innodb_file_per_table=0; -set global innodb_file_format=Antelope; -set global innodb_file_per_table=on; -set global innodb_file_format=`Barracuda`; -set global innodb_file_format_check=`Antelope`; -create table normal_table ( -c1 int -) engine = innodb; -select @@innodb_file_format_check; -@@innodb_file_format_check -Antelope -create table zip_table ( -c1 int -) engine = innodb key_block_size = 8; -select @@innodb_file_format_check; -@@innodb_file_format_check -Barracuda -set global innodb_file_format_check=`Antelope`; -select @@innodb_file_format_check; -@@innodb_file_format_check -Antelope -show table status; -select @@innodb_file_format_check; -@@innodb_file_format_check -Barracuda -drop table normal_table, zip_table; diff --git a/storage/innodb_plugin/mysql-test/innodb-zip.test b/storage/innodb_plugin/mysql-test/innodb-zip.test deleted file mode 100644 index 5bcd0e3c824..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb-zip.test +++ /dev/null @@ -1,343 +0,0 @@ --- source include/have_innodb.inc - -let $per_table=`select @@innodb_file_per_table`; -let $format=`select @@innodb_file_format`; -let $innodb_file_format_check_orig=`select @@innodb_file_format_check`; -set global innodb_file_per_table=off; -set global innodb_file_format=`0`; - -create table t0(a int primary key) engine=innodb row_format=compressed; -create table t00(a int primary key) engine=innodb -key_block_size=4 row_format=compressed; -create table t1(a int primary key) engine=innodb row_format=dynamic; -create table t2(a int primary key) engine=innodb row_format=redundant; -create table t3(a int primary key) engine=innodb row_format=compact; -create table t4(a int primary key) engine=innodb key_block_size=9; -create table t5(a int primary key) engine=innodb -key_block_size=1 row_format=redundant; - -set global innodb_file_per_table=on; -create table t6(a int primary key) engine=innodb -key_block_size=1 row_format=redundant; -set global innodb_file_format=`1`; -create table t7(a int primary key) engine=innodb -key_block_size=1 row_format=redundant; -create table t8(a int primary key) engine=innodb -key_block_size=1 row_format=fixed; -create table t9(a int primary key) engine=innodb -key_block_size=1 row_format=compact; -create table t10(a int primary key) engine=innodb -key_block_size=1 row_format=dynamic; -create table t11(a int primary key) engine=innodb -key_block_size=1 row_format=compressed; -create table t12(a int primary key) engine=innodb -key_block_size=1; -create table t13(a int primary key) engine=innodb -row_format=compressed; -create table t14(a int primary key) engine=innodb key_block_size=9; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; - -drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14; -alter table t1 key_block_size=0; -alter table t1 row_format=dynamic; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -alter table t1 row_format=compact; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -alter table t1 row_format=redundant; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t1; - -create table t1(a int not null, b text, index(b(10))) engine=innodb -key_block_size=1; - -create table t2(b text)engine=innodb; -insert into t2 values(concat('1abcdefghijklmnopqrstuvwxyz', repeat('A',5000))); - -insert into t1 select 1, b from t2; -commit; - -connect (a,localhost,root,,); -connect (b,localhost,root,,); - -connection a; -begin; -update t1 set b=repeat('B',100); - -connection b; -select a,left(b,40) from t1 natural join t2; - -connection a; -rollback; - -connection b; -select a,left(b,40) from t1 natural join t2; - -connection default; -disconnect a; -disconnect b; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t1,t2; - -# The following should fail even in non-strict mode. -SET SESSION innodb_strict_mode = off; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE t1( - c TEXT NOT NULL, d TEXT NOT NULL, - PRIMARY KEY (c(767),d(767))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE t1( - c TEXT NOT NULL, d TEXT NOT NULL, - PRIMARY KEY (c(767),d(767))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII; -CREATE TABLE t1( - c TEXT NOT NULL, d TEXT NOT NULL, - PRIMARY KEY (c(767),d(767))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII; -drop table t1; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; -CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; -INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512)); -DROP TABLE t1; - -# -# Test blob column inheritance (mantis issue#36) -# - -create table t1( c1 int not null, c2 blob, c3 blob, c4 blob, - primary key(c1, c2(22), c3(22))) - engine = innodb row_format = dynamic; -begin; -insert into t1 values(1, repeat('A', 20000), repeat('B', 20000), - repeat('C', 20000)); - -update t1 set c3 = repeat('D', 20000) where c1 = 1; -commit; - -# one blob column which is unchanged in update and part of PK -# one blob column which is changed and part of of PK -# one blob column which is not part of PK and is unchanged -select count(*) from t1 where c2 = repeat('A', 20000); -select count(*) from t1 where c3 = repeat('D', 20000); -select count(*) from t1 where c4 = repeat('C', 20000); - -update t1 set c3 = repeat('E', 20000) where c1 = 1; -drop table t1; - -# -# -# Test innodb_file_format -# -set global innodb_file_format=`0`; -select @@innodb_file_format; -set global innodb_file_format=`1`; -select @@innodb_file_format; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=`2`; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=`-1`; -set global innodb_file_format=`Antelope`; -set global innodb_file_format=`Barracuda`; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=`Cheetah`; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=`abc`; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=`1a`; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=``; - -#test strict mode. -# this does not work anymore, has been removed from mysqltest -# -- enable_errors -set global innodb_file_per_table = on; -set global innodb_file_format = `1`; - -set innodb_strict_mode = off; -create table t1 (id int primary key) engine = innodb key_block_size = 0; -drop table t1; - -#set strict_mode -set innodb_strict_mode = on; - -#Test different values of KEY_BLOCK_SIZE - ---error ER_CANT_CREATE_TABLE -create table t1 (id int primary key) engine = innodb key_block_size = 0; -show errors; - ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb key_block_size = 9; -show errors; - - -create table t3 (id int primary key) engine = innodb key_block_size = 1; -create table t4 (id int primary key) engine = innodb key_block_size = 2; -create table t5 (id int primary key) engine = innodb key_block_size = 4; -create table t6 (id int primary key) engine = innodb key_block_size = 8; -create table t7 (id int primary key) engine = innodb key_block_size = 16; - -#check various ROW_FORMAT values. -create table t8 (id int primary key) engine = innodb row_format = compressed; -create table t9 (id int primary key) engine = innodb row_format = dynamic; -create table t10(id int primary key) engine = innodb row_format = compact; -create table t11(id int primary key) engine = innodb row_format = redundant; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t3, t4, t5, t6, t7, t8, t9, t10, t11; - -#test different values of ROW_FORMAT with KEY_BLOCK_SIZE -create table t1 (id int primary key) engine = innodb -key_block_size = 8 row_format = compressed; - ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb -key_block_size = 8 row_format = redundant; -show errors; - ---error ER_CANT_CREATE_TABLE -create table t3 (id int primary key) engine = innodb -key_block_size = 8 row_format = compact; -show errors; - ---error ER_CANT_CREATE_TABLE -create table t4 (id int primary key) engine = innodb -key_block_size = 8 row_format = dynamic; -show errors; - ---error ER_CANT_CREATE_TABLE -create table t5 (id int primary key) engine = innodb -key_block_size = 8 row_format = default; -show errors; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t1; - -#test multiple errors ---error ER_CANT_CREATE_TABLE -create table t1 (id int primary key) engine = innodb -key_block_size = 9 row_format = redundant; -show errors; - ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb -key_block_size = 9 row_format = compact; -show errors; - ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb -key_block_size = 9 row_format = dynamic; -show errors; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; - -#test valid values with innodb_file_per_table unset -set global innodb_file_per_table = off; - ---error ER_CANT_CREATE_TABLE -create table t1 (id int primary key) engine = innodb key_block_size = 1; -show errors; ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb key_block_size = 2; -show errors; ---error ER_CANT_CREATE_TABLE -create table t3 (id int primary key) engine = innodb key_block_size = 4; -show errors; ---error ER_CANT_CREATE_TABLE -create table t4 (id int primary key) engine = innodb key_block_size = 8; -show errors; ---error ER_CANT_CREATE_TABLE -create table t5 (id int primary key) engine = innodb key_block_size = 16; -show errors; ---error ER_CANT_CREATE_TABLE -create table t6 (id int primary key) engine = innodb row_format = compressed; -show errors; ---error ER_CANT_CREATE_TABLE -create table t7 (id int primary key) engine = innodb row_format = dynamic; -show errors; -create table t8 (id int primary key) engine = innodb row_format = compact; -create table t9 (id int primary key) engine = innodb row_format = redundant; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t8, t9; - -#test valid values with innodb_file_format unset -set global innodb_file_per_table = on; -set global innodb_file_format = `0`; - ---error ER_CANT_CREATE_TABLE -create table t1 (id int primary key) engine = innodb key_block_size = 1; -show errors; ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb key_block_size = 2; -show errors; ---error ER_CANT_CREATE_TABLE -create table t3 (id int primary key) engine = innodb key_block_size = 4; -show errors; ---error ER_CANT_CREATE_TABLE -create table t4 (id int primary key) engine = innodb key_block_size = 8; -show errors; ---error ER_CANT_CREATE_TABLE -create table t5 (id int primary key) engine = innodb key_block_size = 16; -show errors; ---error ER_CANT_CREATE_TABLE -create table t6 (id int primary key) engine = innodb row_format = compressed; -show errors; ---error ER_CANT_CREATE_TABLE -create table t7 (id int primary key) engine = innodb row_format = dynamic; -show errors; -create table t8 (id int primary key) engine = innodb row_format = compact; -create table t9 (id int primary key) engine = innodb row_format = redundant; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t8, t9; - -eval set global innodb_file_per_table=$per_table; -eval set global innodb_file_format=$format; -# -# Testing of tablespace tagging -# --- disable_info -set global innodb_file_per_table=on; -set global innodb_file_format=`Barracuda`; -set global innodb_file_format_check=`Antelope`; -create table normal_table ( - c1 int -) engine = innodb; -select @@innodb_file_format_check; -create table zip_table ( - c1 int -) engine = innodb key_block_size = 8; -select @@innodb_file_format_check; -set global innodb_file_format_check=`Antelope`; -select @@innodb_file_format_check; --- disable_result_log -show table status; --- enable_result_log -select @@innodb_file_format_check; -drop table normal_table, zip_table; --- disable_result_log - -# -# restore environment to the state it was before this test execution -# - --- disable_query_log -eval set global innodb_file_format=$format; -eval set global innodb_file_per_table=$per_table; -eval set global innodb_file_format_check=$innodb_file_format_check_orig; diff --git a/storage/innodb_plugin/mysql-test/innodb.result b/storage/innodb_plugin/mysql-test/innodb.result deleted file mode 100644 index bdae7633fd1..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb.result +++ /dev/null @@ -1,3310 +0,0 @@ -drop table if exists t1,t2,t3,t4; -drop database if exists mysqltest; -create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; -insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); -select id, code, name from t1 order by id; -id code name -1 1 Tim -2 1 Monty -3 2 David -4 2 Erik -5 3 Sasha -6 3 Jeremy -7 4 Matt -update ignore t1 set id = 8, name = 'Sinisa' where id < 3; -select id, code, name from t1 order by id; -id code name -2 1 Monty -3 2 David -4 2 Erik -5 3 Sasha -6 3 Jeremy -7 4 Matt -8 1 Sinisa -update ignore t1 set id = id + 10, name = 'Ralph' where id < 4; -select id, code, name from t1 order by id; -id code name -3 2 David -4 2 Erik -5 3 Sasha -6 3 Jeremy -7 4 Matt -8 1 Sinisa -12 1 Ralph -drop table t1; -CREATE TABLE t1 ( -id int(11) NOT NULL auto_increment, -parent_id int(11) DEFAULT '0' NOT NULL, -level tinyint(4) DEFAULT '0' NOT NULL, -PRIMARY KEY (id), -KEY parent_id (parent_id), -KEY level (level) -) engine=innodb; -INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2); -update t1 set parent_id=parent_id+100; -select * from t1 where parent_id=102; -id parent_id level -8 102 2 -9 102 2 -15 102 2 -update t1 set id=id+1000; -update t1 set id=1024 where id=1009; -Got one of the listed errors -select * from t1; -id parent_id level -1001 100 0 -1002 101 1 -1003 101 1 -1004 101 1 -1005 101 1 -1006 101 1 -1007 101 1 -1008 102 2 -1009 102 2 -1015 102 2 -1016 103 2 -1017 103 2 -1018 103 2 -1019 103 2 -1020 103 2 -1021 104 2 -1022 104 2 -1024 104 2 -1025 105 2 -1026 105 2 -1027 105 2 -1028 105 2 -1029 105 2 -1030 105 2 -1031 106 2 -1032 106 2 -1033 106 2 -1034 106 2 -1035 106 2 -1036 107 2 -1037 107 2 -1038 107 2 -1040 107 2 -1157 100 0 -1179 105 2 -1183 104 2 -1193 105 2 -1202 107 2 -1203 107 2 -update ignore t1 set id=id+1; -select * from t1; -id parent_id level -1001 100 0 -1002 101 1 -1003 101 1 -1004 101 1 -1005 101 1 -1006 101 1 -1007 101 1 -1008 102 2 -1010 102 2 -1015 102 2 -1016 103 2 -1017 103 2 -1018 103 2 -1019 103 2 -1020 103 2 -1021 104 2 -1023 104 2 -1024 104 2 -1025 105 2 -1026 105 2 -1027 105 2 -1028 105 2 -1029 105 2 -1030 105 2 -1031 106 2 -1032 106 2 -1033 106 2 -1034 106 2 -1035 106 2 -1036 107 2 -1037 107 2 -1039 107 2 -1041 107 2 -1158 100 0 -1180 105 2 -1184 104 2 -1194 105 2 -1202 107 2 -1204 107 2 -update ignore t1 set id=1023 where id=1010; -select * from t1 where parent_id=102; -id parent_id level -1008 102 2 -1010 102 2 -1015 102 2 -explain select level from t1 where level=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref level level 1 const # Using index -explain select level,id from t1 where level=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref level level 1 const # Using index -explain select level,id,parent_id from t1 where level=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref level level 1 const # -select level,id from t1 where level=1; -level id -1 1002 -1 1003 -1 1004 -1 1005 -1 1006 -1 1007 -select level,id,parent_id from t1 where level=1; -level id parent_id -1 1002 101 -1 1003 101 -1 1004 101 -1 1005 101 -1 1006 101 -1 1007 101 -optimize table t1; -Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead -test.t1 optimize status OK -show keys from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 id A # NULL NULL BTREE -t1 1 parent_id 1 parent_id A # NULL NULL BTREE -t1 1 level 1 level A # NULL NULL BTREE -drop table t1; -CREATE TABLE t1 ( -gesuchnr int(11) DEFAULT '0' NOT NULL, -benutzer_id int(11) DEFAULT '0' NOT NULL, -PRIMARY KEY (gesuchnr,benutzer_id) -) engine=innodb; -replace into t1 (gesuchnr,benutzer_id) values (2,1); -replace into t1 (gesuchnr,benutzer_id) values (1,1); -replace into t1 (gesuchnr,benutzer_id) values (1,1); -select * from t1; -gesuchnr benutzer_id -1 1 -2 1 -drop table t1; -create table t1 (a int) engine=innodb; -insert into t1 values (1), (2); -optimize table t1; -Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead -test.t1 optimize status OK -delete from t1 where a = 1; -select * from t1; -a -2 -check table t1; -Table Op Msg_type Msg_text -test.t1 check status OK -drop table t1; -create table t1 (a int,b varchar(20)) engine=innodb; -insert into t1 values (1,""), (2,"testing"); -delete from t1 where a = 1; -select * from t1; -a b -2 testing -create index skr on t1 (a); -insert into t1 values (3,""), (4,"testing"); -analyze table t1; -Table Op Msg_type Msg_text -test.t1 analyze status OK -show keys from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 1 skr 1 a A # NULL NULL YES BTREE -drop table t1; -create table t1 (a int,b varchar(20),key(a)) engine=innodb; -insert into t1 values (1,""), (2,"testing"); -select * from t1 where a = 1; -a b -1 -drop table t1; -create table t1 (n int not null primary key) engine=innodb; -set autocommit=0; -insert into t1 values (4); -rollback; -select n, "after rollback" from t1; -n after rollback -insert into t1 values (4); -commit; -select n, "after commit" from t1; -n after commit -4 after commit -commit; -insert into t1 values (5); -insert into t1 values (4); -ERROR 23000: Duplicate entry '4' for key 'PRIMARY' -commit; -select n, "after commit" from t1; -n after commit -4 after commit -5 after commit -set autocommit=1; -insert into t1 values (6); -insert into t1 values (4); -ERROR 23000: Duplicate entry '4' for key 'PRIMARY' -select n from t1; -n -4 -5 -6 -set autocommit=0; -begin; -savepoint `my_savepoint`; -insert into t1 values (7); -savepoint `savept2`; -insert into t1 values (3); -select n from t1; -n -3 -4 -5 -6 -7 -savepoint savept3; -rollback to savepoint savept2; -rollback to savepoint savept3; -ERROR 42000: SAVEPOINT savept3 does not exist -rollback to savepoint savept2; -release savepoint `my_savepoint`; -select n from t1; -n -4 -5 -6 -7 -rollback to savepoint `my_savepoint`; -ERROR 42000: SAVEPOINT my_savepoint does not exist -rollback to savepoint savept2; -ERROR 42000: SAVEPOINT savept2 does not exist -insert into t1 values (8); -savepoint sv; -commit; -savepoint sv; -set autocommit=1; -rollback; -drop table t1; -create table t1 (n int not null primary key) engine=innodb; -start transaction; -insert into t1 values (4); -flush tables with read lock; -commit; -unlock tables; -commit; -select * from t1; -n -4 -drop table t1; -create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=innodb; -begin; -insert into t1 values(1,'hamdouni'); -select id as afterbegin_id,nom as afterbegin_nom from t1; -afterbegin_id afterbegin_nom -1 hamdouni -rollback; -select id as afterrollback_id,nom as afterrollback_nom from t1; -afterrollback_id afterrollback_nom -set autocommit=0; -insert into t1 values(2,'mysql'); -select id as afterautocommit0_id,nom as afterautocommit0_nom from t1; -afterautocommit0_id afterautocommit0_nom -2 mysql -rollback; -select id as afterrollback_id,nom as afterrollback_nom from t1; -afterrollback_id afterrollback_nom -set autocommit=1; -drop table t1; -CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb; -insert into t1 values ('pippo', 12); -insert into t1 values ('pippo', 12); -ERROR 23000: Duplicate entry 'pippo' for key 'PRIMARY' -delete from t1; -delete from t1 where id = 'pippo'; -select * from t1; -id val -insert into t1 values ('pippo', 12); -set autocommit=0; -delete from t1; -rollback; -select * from t1; -id val -pippo 12 -delete from t1; -commit; -select * from t1; -id val -drop table t1; -create table t1 (a integer) engine=innodb; -start transaction; -rename table t1 to t2; -create table t1 (b integer) engine=innodb; -insert into t1 values (1); -rollback; -drop table t1; -rename table t2 to t1; -drop table t1; -set autocommit=1; -CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=innodb; -INSERT INTO t1 VALUES (1, 'Jochen'); -select * from t1; -ID NAME -1 Jochen -drop table t1; -CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=innodb; -set autocommit=0; -INSERT INTO t1 SET _userid='marc@anyware.co.uk'; -COMMIT; -SELECT * FROM t1; -_userid -marc@anyware.co.uk -SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk'; -_userid -marc@anyware.co.uk -drop table t1; -set autocommit=1; -CREATE TABLE t1 ( -user_id int(10) DEFAULT '0' NOT NULL, -name varchar(100), -phone varchar(100), -ref_email varchar(100) DEFAULT '' NOT NULL, -detail varchar(200), -PRIMARY KEY (user_id,ref_email) -)engine=innodb; -INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar'); -select * from t1 where user_id=10292; -user_id name phone ref_email detail -10292 sanjeev 29153373 sansh777@hotmail.com xxx -10292 shirish 2333604 shirish@yahoo.com ddsds -10292 sonali 323232 sonali@bolly.com filmstar -INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds'); -select * from t1 where user_id=10292; -user_id name phone ref_email detail -10292 sanjeev 29153373 sansh777@hotmail.com xxx -10292 shirish 2333604 shirish@yahoo.com ddsds -10292 sonali 323232 sonali@bolly.com filmstar -select * from t1 where user_id>=10292; -user_id name phone ref_email detail -10292 sanjeev 29153373 sansh777@hotmail.com xxx -10292 shirish 2333604 shirish@yahoo.com ddsds -10292 sonali 323232 sonali@bolly.com filmstar -10293 shirish 2333604 shirish@yahoo.com ddsds -select * from t1 where user_id>10292; -user_id name phone ref_email detail -10293 shirish 2333604 shirish@yahoo.com ddsds -select * from t1 where user_id<10292; -user_id name phone ref_email detail -10291 sanjeev 29153373 sansh777@hotmail.com xxx -drop table t1; -CREATE TABLE t1 (a int not null, b int not null,c int not null, -key(a),primary key(a,b), unique(c),key(a),unique(b)); -show index from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 a A # NULL NULL BTREE -t1 0 PRIMARY 2 b A # NULL NULL BTREE -t1 0 c 1 c A # NULL NULL BTREE -t1 0 b 1 b A # NULL NULL BTREE -t1 1 a 1 a A # NULL NULL BTREE -t1 1 a_2 1 a A # NULL NULL BTREE -drop table t1; -create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)); -alter table t1 engine=innodb; -insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4'); -select * from t1; -col1 col2 -1 1 -2 3 -3 4 -4 4 -5 2 -update t1 set col2='7' where col1='4'; -select * from t1; -col1 col2 -1 1 -2 3 -3 4 -4 7 -5 2 -alter table t1 add co3 int not null; -select * from t1; -col1 col2 co3 -1 1 0 -2 3 0 -3 4 0 -4 7 0 -5 2 0 -update t1 set col2='9' where col1='2'; -select * from t1; -col1 col2 co3 -1 1 0 -2 9 0 -3 4 0 -4 7 0 -5 2 0 -drop table t1; -create table t1 (a int not null , b int, primary key (a)) engine = innodb; -create table t2 (a int not null , b int, primary key (a)) engine = myisam; -insert into t1 VALUES (1,3) , (2,3), (3,3); -select * from t1; -a b -1 3 -2 3 -3 3 -insert into t2 select * from t1; -select * from t2; -a b -1 3 -2 3 -3 3 -delete from t1 where b = 3; -select * from t1; -a b -insert into t1 select * from t2; -select * from t1; -a b -1 3 -2 3 -3 3 -select * from t2; -a b -1 3 -2 3 -3 3 -drop table t1,t2; -CREATE TABLE t1 ( -user_name varchar(12), -password text, -subscribed char(1), -user_id int(11) DEFAULT '0' NOT NULL, -quota bigint(20), -weight double, -access_date date, -access_time time, -approved datetime, -dummy_primary_key int(11) NOT NULL auto_increment, -PRIMARY KEY (dummy_primary_key) -) ENGINE=innodb; -INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1); -INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2); -INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3); -INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4); -INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5); -select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name; -user_name password subscribed user_id quota weight access_date access_time approved dummy_primary_key -user_0 somepassword N 0 0 0 2000-09-07 23:06:59 2000-09-07 23:06:59 1 -user_1 somepassword Y 1 1 1 2000-09-07 23:06:59 2000-09-07 23:06:59 2 -user_2 somepassword N 2 2 1.4142135623731 2000-09-07 23:06:59 2000-09-07 23:06:59 3 -user_3 somepassword Y 3 3 1.7320508075689 2000-09-07 23:06:59 2000-09-07 23:06:59 4 -user_4 somepassword N 4 4 2 2000-09-07 23:06:59 2000-09-07 23:06:59 5 -drop table t1; -CREATE TABLE t1 ( -id int(11) NOT NULL auto_increment, -parent_id int(11) DEFAULT '0' NOT NULL, -level tinyint(4) DEFAULT '0' NOT NULL, -KEY (id), -KEY parent_id (parent_id), -KEY level (level) -) engine=innodb; -INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1); -INSERT INTO t1 values (179,5,2); -update t1 set parent_id=parent_id+100; -select * from t1 where parent_id=102; -id parent_id level -8 102 2 -9 102 2 -15 102 2 -update t1 set id=id+1000; -update t1 set id=1024 where id=1009; -select * from t1; -id parent_id level -1001 100 0 -1003 101 1 -1004 101 1 -1008 102 2 -1024 102 2 -1017 103 2 -1022 104 2 -1024 104 2 -1028 105 2 -1029 105 2 -1030 105 2 -1031 106 2 -1032 106 2 -1033 106 2 -1203 107 2 -1202 107 2 -1020 103 2 -1157 100 0 -1193 105 2 -1040 107 2 -1002 101 1 -1015 102 2 -1006 101 1 -1034 106 2 -1035 106 2 -1016 103 2 -1007 101 1 -1036 107 2 -1018 103 2 -1026 105 2 -1027 105 2 -1183 104 2 -1038 107 2 -1025 105 2 -1037 107 2 -1021 104 2 -1019 103 2 -1005 101 1 -1179 105 2 -update ignore t1 set id=id+1; -select * from t1; -id parent_id level -1002 100 0 -1004 101 1 -1005 101 1 -1009 102 2 -1025 102 2 -1018 103 2 -1023 104 2 -1025 104 2 -1029 105 2 -1030 105 2 -1031 105 2 -1032 106 2 -1033 106 2 -1034 106 2 -1204 107 2 -1203 107 2 -1021 103 2 -1158 100 0 -1194 105 2 -1041 107 2 -1003 101 1 -1016 102 2 -1007 101 1 -1035 106 2 -1036 106 2 -1017 103 2 -1008 101 1 -1037 107 2 -1019 103 2 -1027 105 2 -1028 105 2 -1184 104 2 -1039 107 2 -1026 105 2 -1038 107 2 -1022 104 2 -1020 103 2 -1006 101 1 -1180 105 2 -update ignore t1 set id=1023 where id=1010; -select * from t1 where parent_id=102; -id parent_id level -1009 102 2 -1025 102 2 -1016 102 2 -explain select level from t1 where level=1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref level level 1 const # Using index -select level,id from t1 where level=1; -level id -1 1004 -1 1005 -1 1003 -1 1007 -1 1008 -1 1006 -select level,id,parent_id from t1 where level=1; -level id parent_id -1 1004 101 -1 1005 101 -1 1003 101 -1 1007 101 -1 1008 101 -1 1006 101 -select level,id from t1 where level=1 order by id; -level id -1 1003 -1 1004 -1 1005 -1 1006 -1 1007 -1 1008 -delete from t1 where level=1; -select * from t1; -id parent_id level -1002 100 0 -1009 102 2 -1025 102 2 -1018 103 2 -1023 104 2 -1025 104 2 -1029 105 2 -1030 105 2 -1031 105 2 -1032 106 2 -1033 106 2 -1034 106 2 -1204 107 2 -1203 107 2 -1021 103 2 -1158 100 0 -1194 105 2 -1041 107 2 -1016 102 2 -1035 106 2 -1036 106 2 -1017 103 2 -1037 107 2 -1019 103 2 -1027 105 2 -1028 105 2 -1184 104 2 -1039 107 2 -1026 105 2 -1038 107 2 -1022 104 2 -1020 103 2 -1180 105 2 -drop table t1; -CREATE TABLE t1 ( -sca_code char(6) NOT NULL, -cat_code char(6) NOT NULL, -sca_desc varchar(50), -lan_code char(2) NOT NULL, -sca_pic varchar(100), -sca_sdesc varchar(50), -sca_sch_desc varchar(16), -PRIMARY KEY (sca_code, cat_code, lan_code), -INDEX sca_pic (sca_pic) -) engine = innodb ; -INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING'); -select count(*) from t1 where sca_code = 'PD'; -count(*) -1 -select count(*) from t1 where sca_code <= 'PD'; -count(*) -1 -select count(*) from t1 where sca_pic is null; -count(*) -2 -alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); -select count(*) from t1 where sca_code='PD' and sca_pic is null; -count(*) -1 -select count(*) from t1 where cat_code='E'; -count(*) -0 -alter table t1 drop index sca_pic, add index (sca_pic, cat_code); -select count(*) from t1 where sca_code='PD' and sca_pic is null; -count(*) -1 -select count(*) from t1 where sca_pic >= 'n'; -count(*) -1 -select sca_pic from t1 where sca_pic is null; -sca_pic -NULL -NULL -update t1 set sca_pic="test" where sca_pic is null; -delete from t1 where sca_code='pd'; -drop table t1; -set @a:=now(); -CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb; -insert into t1 (a) values(1),(2),(3); -select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a; -a -1 -2 -3 -select a from t1 natural join t1 as t2 where b >= @a order by a; -a -1 -2 -3 -update t1 set a=5 where a=1; -select a from t1; -a -2 -3 -5 -drop table t1; -create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb; -insert into t1 values("hello",1),("world",2); -select * from t1 order by b desc; -a b -world 2 -hello 1 -optimize table t1; -Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead -test.t1 optimize status OK -show keys from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment -t1 0 PRIMARY 1 a A # NULL NULL BTREE -drop table t1; -create table t1 (i int, j int ) ENGINE=innodb; -insert into t1 values (1,2); -select * from t1 where i=1 and j=2; -i j -1 2 -create index ax1 on t1 (i,j); -select * from t1 where i=1 and j=2; -i j -1 2 -drop table t1; -CREATE TABLE t1 ( -a int3 unsigned NOT NULL, -b int1 unsigned NOT NULL, -UNIQUE (a, b) -) ENGINE = innodb; -INSERT INTO t1 VALUES (1, 1); -SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1; -MIN(B) MAX(b) -1 1 -drop table t1; -CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1; -a -1 -DROP TABLE t1; -create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = innodb; -insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); -explain select * from t1 where a > 0 and a < 50; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where -drop table t1; -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb; -insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); -LOCK TABLES t1 WRITE; -insert into t1 values (99,1,2,'D'),(1,1,2,'D'); -ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY' -select id from t1; -id -0 -1 -2 -select id from t1; -id -0 -1 -2 -UNLOCK TABLES; -DROP TABLE t1; -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb; -insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); -LOCK TABLES t1 WRITE; -begin; -insert into t1 values (99,1,2,'D'),(1,1,2,'D'); -ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY' -select id from t1; -id -0 -1 -2 -insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D'); -commit; -select id,id3 from t1; -id id3 -0 0 -1 1 -2 2 -100 2 -UNLOCK TABLES; -DROP TABLE t1; -create table t1 (a char(20), unique (a(5))) engine=innodb; -drop table t1; -create table t1 (a char(20), index (a(5))) engine=innodb; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` char(20) DEFAULT NULL, - KEY `a` (`a`(5)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t1; -create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb; -insert into t1 values (NULL),(NULL),(NULL); -delete from t1 where a=3; -insert into t1 values (NULL); -select * from t1; -a -1 -2 -4 -alter table t1 add b int; -select * from t1; -a b -1 NULL -2 NULL -4 NULL -drop table t1; -create table t1 -( -id int auto_increment primary key, -name varchar(32) not null, -value text not null, -uid int not null, -unique key(name,uid) -) engine=innodb; -insert into t1 values (1,'one','one value',101), -(2,'two','two value',102),(3,'three','three value',103); -set insert_id=5; -replace into t1 (value,name,uid) values ('other value','two',102); -delete from t1 where uid=102; -set insert_id=5; -replace into t1 (value,name,uid) values ('other value','two',102); -set insert_id=6; -replace into t1 (value,name,uid) values ('other value','two',102); -select * from t1; -id name value uid -1 one one value 101 -3 three three value 103 -6 two other value 102 -drop table t1; -create database mysqltest; -create table mysqltest.t1 (a int not null) engine= innodb; -insert into mysqltest.t1 values(1); -create table mysqltest.t2 (a int not null) engine= myisam; -insert into mysqltest.t2 values(1); -create table mysqltest.t3 (a int not null) engine= heap; -insert into mysqltest.t3 values(1); -commit; -drop database mysqltest; -show tables from mysqltest; -ERROR 42000: Unknown database 'mysqltest' -set autocommit=0; -create table t1 (a int not null) engine= innodb; -insert into t1 values(1),(2); -truncate table t1; -commit; -truncate table t1; -truncate table t1; -select * from t1; -a -insert into t1 values(1),(2); -delete from t1; -select * from t1; -a -commit; -drop table t1; -set autocommit=1; -create table t1 (a int not null) engine= innodb; -insert into t1 values(1),(2); -truncate table t1; -insert into t1 values(1),(2); -select * from t1; -a -1 -2 -truncate table t1; -insert into t1 values(1),(2); -delete from t1; -select * from t1; -a -drop table t1; -create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=innodb; -insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); -explain select * from t1 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL # -explain select * from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort -explain select * from t1 order by c; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort -explain select a from t1 order by a; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL PRIMARY 4 NULL # Using index -explain select b from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 4 NULL # Using index -explain select a,b from t1 order by b; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 4 NULL # Using index -explain select a,b from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index NULL b 4 NULL # Using index -explain select a,b,c from t1; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL # -drop table t1; -create table t1 (t int not null default 1, key (t)) engine=innodb; -desc t1; -Field Type Null Key Default Extra -t int(11) NO MUL 1 -drop table t1; -CREATE TABLE t1 ( -number bigint(20) NOT NULL default '0', -cname char(15) NOT NULL default '', -carrier_id smallint(6) NOT NULL default '0', -privacy tinyint(4) NOT NULL default '0', -last_mod_date timestamp NOT NULL, -last_mod_id smallint(6) NOT NULL default '0', -last_app_date timestamp NOT NULL, -last_app_id smallint(6) default '-1', -version smallint(6) NOT NULL default '0', -assigned_scps int(11) default '0', -status tinyint(4) default '0' -) ENGINE=InnoDB; -INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1); -INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0); -INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1); -INSERT INTO t1 VALUES (302467,'Sue\'s Subshop',90,3,20020109113241,500,20020102115111,501,7,24,0); -INSERT INTO t1 VALUES (6014911113,'SudzCarwash',520,1,20020102115234,500,20020102115259,501,33,32768,0); -INSERT INTO t1 VALUES (333,'tubs',99,2,20020109113440,501,20020109113440,500,3,10,0); -CREATE TABLE t2 ( -number bigint(20) NOT NULL default '0', -cname char(15) NOT NULL default '', -carrier_id smallint(6) NOT NULL default '0', -privacy tinyint(4) NOT NULL default '0', -last_mod_date timestamp NOT NULL, -last_mod_id smallint(6) NOT NULL default '0', -last_app_date timestamp NOT NULL, -last_app_id smallint(6) default '-1', -version smallint(6) NOT NULL default '0', -assigned_scps int(11) default '0', -status tinyint(4) default '0' -) ENGINE=InnoDB; -INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1); -INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0); -INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1); -INSERT INTO t2 VALUES (333,'tubs',99,2,20020109113453,501,20020109113453,500,3,10,0); -select * from t1; -number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status -4077711111 SeanWheeler 90 2 2002-01-11 11:28:46 500 0000-00-00 00:00:00 -1 2 3 1 -9197722223 berry 90 3 2002-01-11 11:28:09 500 2002-01-02 11:45:32 501 4 10 0 -650 San Francisco 0 0 2001-12-27 11:13:36 342 0000-00-00 00:00:00 -1 1 24 1 -302467 Sue's Subshop 90 3 2002-01-09 11:32:41 500 2002-01-02 11:51:11 501 7 24 0 -6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0 -333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0 -select * from t2; -number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status -4077711111 SeanWheeler 0 2 2002-01-11 11:28:53 500 0000-00-00 00:00:00 -1 2 3 1 -9197722223 berry 90 3 2002-01-11 11:28:18 500 2002-01-02 11:45:32 501 4 10 0 -650 San Francisco 90 0 2002-01-09 11:31:58 342 0000-00-00 00:00:00 -1 1 24 1 -333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0 -delete t1, t2 from t1 left join t2 on t1.number=t2.number where (t1.carrier_id=90 and t1.number=t2.number) or (t2.carrier_id=90 and t1.number=t2.number) or (t1.carrier_id=90 and t2.number is null); -select * from t1; -number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status -6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0 -333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0 -select * from t2; -number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status -333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0 -select * from t2; -number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status -333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0 -drop table t1,t2; -create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; -BEGIN; -SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; -SELECT @@tx_isolation,@@global.tx_isolation; -@@tx_isolation @@global.tx_isolation -SERIALIZABLE REPEATABLE-READ -insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'); -select id, code, name from t1 order by id; -id code name -1 1 Tim -2 1 Monty -3 2 David -COMMIT; -BEGIN; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha'); -select id, code, name from t1 order by id; -id code name -1 1 Tim -2 1 Monty -3 2 David -4 2 Erik -5 3 Sasha -COMMIT; -SET binlog_format='MIXED'; -BEGIN; -SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt'); -select id, code, name from t1 order by id; -id code name -1 1 Tim -2 1 Monty -3 2 David -4 2 Erik -5 3 Sasha -6 3 Jeremy -7 4 Matt -COMMIT; -DROP TABLE t1; -create table t1 (n int(10), d int(10)) engine=innodb; -create table t2 (n int(10), d int(10)) engine=innodb; -insert into t1 values(1,1),(1,2); -insert into t2 values(1,10),(2,20); -UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; -select * from t1; -n d -1 10 -1 10 -select * from t2; -n d -1 30 -2 20 -drop table t1,t2; -drop table if exists t1, t2; -CREATE TABLE t1 (a int, PRIMARY KEY (a)); -CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; -create trigger trg_del_t2 after delete on t2 for each row -insert into t1 values (1); -insert into t1 values (1); -insert into t2 values (1),(2); -delete t2 from t2; -ERROR 23000: Duplicate entry '1' for key 'PRIMARY' -select count(*) from t2 /* must be 2 as restored after rollback caused by the error */; -count(*) -2 -drop table t1, t2; -drop table if exists t1, t2; -CREATE TABLE t1 (a int, PRIMARY KEY (a)); -CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; -create trigger trg_del_t2 after delete on t2 for each row -insert into t1 values (1); -insert into t1 values (1); -insert into t2 values (1),(2); -delete t2 from t2; -ERROR 23000: Duplicate entry '1' for key 'PRIMARY' -select count(*) from t2 /* must be 2 as restored after rollback caused by the error */; -count(*) -2 -drop table t1, t2; -create table t1 (a int, b int) engine=innodb; -insert into t1 values(20,null); -select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on -t2.b=t3.a; -b ifnull(t2.b,"this is null") -NULL this is null -select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on -t2.b=t3.a order by 1; -b ifnull(t2.b,"this is null") -NULL this is null -insert into t1 values(10,null); -select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on -t2.b=t3.a order by 1; -b ifnull(t2.b,"this is null") -NULL this is null -NULL this is null -drop table t1; -create table t1 (a varchar(10) not null) engine=myisam; -create table t2 (b varchar(10) not null unique) engine=innodb; -select t1.a from t1,t2 where t1.a=t2.b; -a -drop table t1,t2; -create table t1 (a int not null, b int, primary key (a)) engine = innodb; -create table t2 (a int not null, b int, primary key (a)) engine = innodb; -insert into t1 values (10, 20); -insert into t2 values (10, 20); -update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10; -drop table t1,t2; -CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; -CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=INNODB; -insert into t1 set id=1; -insert into t2 set id=1, t1_id=1; -delete t1,t2 from t1,t2 where t1.id=t2.t1_id; -select * from t1; -id -select * from t2; -id t1_id -drop table t2,t1; -CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; -CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=INNODB; -INSERT INTO t1 VALUES(1); -INSERT INTO t2 VALUES(1, 1); -SELECT * from t1; -id -1 -UPDATE t1,t2 SET t1.id=t1.id+1, t2.t1_id=t1.id+1; -SELECT * from t1; -id -2 -UPDATE t1,t2 SET t1.id=t1.id+1 where t1.id!=t2.id; -SELECT * from t1; -id -3 -DROP TABLE t1,t2; -set autocommit=0; -CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; -CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; -CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=InnoDB; -INSERT INTO t3 VALUES("my-test-1", "my-test-2"); -COMMIT; -INSERT INTO t1 VALUES("this-key", "will disappear"); -INSERT INTO t2 VALUES("this-key", "will also disappear"); -DELETE FROM t3 WHERE id1="my-test-1"; -SELECT * FROM t1; -id value -this-key will disappear -SELECT * FROM t2; -id value -this-key will also disappear -SELECT * FROM t3; -id1 id2 -ROLLBACK; -SELECT * FROM t1; -id value -SELECT * FROM t2; -id value -SELECT * FROM t3; -id1 id2 -my-test-1 my-test-2 -SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE; -id1 id2 -my-test-1 my-test-2 -COMMIT; -set autocommit=1; -DROP TABLE t1,t2,t3; -CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=innodb; -INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); -UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000; -SELECT * from t1; -a b -1 1 -102 2 -103 3 -4 4 -5 5 -6 6 -7 7 -8 8 -9 9 -drop table t1; -CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb; -CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb; -INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12); -INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); -update t1,t2 set t1.a=t1.a+100; -select * from t1; -a b -101 1 -102 2 -103 3 -104 4 -105 5 -106 6 -107 7 -108 8 -109 9 -110 10 -111 11 -112 12 -update t1,t2 set t1.a=t1.a+100 where t1.a=101; -select * from t1; -a b -201 1 -102 2 -103 3 -104 4 -105 5 -106 6 -107 7 -108 8 -109 9 -110 10 -111 11 -112 12 -update t1,t2 set t1.b=t1.b+10 where t1.b=2; -select * from t1; -a b -201 1 -103 3 -104 4 -105 5 -106 6 -107 7 -108 8 -109 9 -110 10 -111 11 -102 12 -112 12 -update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100; -select * from t1; -a b -201 1 -103 5 -104 6 -106 6 -105 7 -107 7 -108 8 -109 9 -110 10 -111 11 -102 12 -112 12 -select * from t2; -a b -1 1 -2 2 -6 6 -7 7 -8 8 -9 9 -3 13 -4 14 -5 15 -drop table t1,t2; -CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; -SET AUTOCOMMIT=0; -INSERT INTO t1 ( B_ID ) VALUES ( 1 ); -INSERT INTO t2 ( NEXT_T ) VALUES ( 1 ); -ROLLBACK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back -SELECT * FROM t1; -B_ID -drop table t1,t2; -create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = innodb; -insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2); -select distinct parent,child from t1 order by parent; -parent child -0 4 -1 2 -1 3 -2 1 -drop table t1; -create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb; -create table t2 (a int not null auto_increment primary key, b int); -insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null); -insert into t2 (a) select b from t1; -insert into t1 (b) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -select count(*) from t1; -count(*) -623 -explain select * from t1 where c between 1 and 2500; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range c c 5 NULL # Using where -update t1 set c=a; -explain select * from t1 where c between 1 and 2500; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL c NULL NULL NULL # Using where -drop table t1,t2; -create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb; -insert into t1 (id) values (null),(null),(null),(null),(null); -update t1 set fk=69 where fk is null order by id limit 1; -SELECT * from t1; -id fk -2 NULL -3 NULL -4 NULL -5 NULL -1 69 -drop table t1; -create table t1 (a int not null, b int not null, key (a)); -insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3); -SET @tmp=0; -update t1 set b=(@tmp:=@tmp+1) order by a; -update t1 set b=99 where a=1 order by b asc limit 1; -update t1 set b=100 where a=1 order by b desc limit 2; -update t1 set a=a+10+b where a=1 order by b; -select * from t1 order by a,b; -a b -2 4 -2 5 -2 6 -3 7 -3 8 -3 9 -3 10 -3 11 -3 12 -13 2 -111 100 -111 100 -drop table t1; -create table t1 ( c char(8) not null ) engine=innodb; -insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); -insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); -alter table t1 add b char(8) not null; -alter table t1 add a char(8) not null; -alter table t1 add primary key (a,b,c); -update t1 set a=c, b=c; -create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb; -insert into t2 select * from t1; -delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; -drop table t1,t2; -SET AUTOCOMMIT=1; -create table t1 (a integer auto_increment primary key) engine=innodb; -insert into t1 (a) values (NULL),(NULL); -truncate table t1; -insert into t1 (a) values (NULL),(NULL); -SELECT * from t1; -a -1 -2 -drop table t1; -CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=INNODB; -CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) ENGINE=INNODB; -drop table t2,t1; -create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) engine = innodb; -insert into `t1`values ( 1 ) ; -create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = innodb; -insert into `t2`values ( 1 ) ; -create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb; -insert into `t3`values ( 1 ) ; -delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)) -update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)) -update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; -ERROR 42S22: Unknown column 't1.id' in 'where clause' -drop table t3,t2,t1; -create table t1( -id int primary key, -pid int, -index(pid), -foreign key(pid) references t1(id) on delete cascade) engine=innodb; -insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6), -(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14); -delete from t1 where id=0; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `t1` (`id`) ON DELETE CASCADE) -delete from t1 where id=15; -delete from t1 where id=0; -drop table t1; -CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB; -CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx -(stamp))ENGINE=InnoDB; -insert into t1 values (1),(2),(3); -insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000); -Warnings: -Warning 1265 Data truncated for column 'stamp' at row 3 -SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp < -'20020204120000' GROUP BY col1; -col1 -1 -2 -3 -4 -drop table t1,t2; -CREATE TABLE t1 ( -`id` int(10) unsigned NOT NULL auto_increment, -`id_object` int(10) unsigned default '0', -`id_version` int(10) unsigned NOT NULL default '1', -`label` varchar(100) NOT NULL default '', -`description` text, -PRIMARY KEY (`id`), -KEY `id_object` (`id_object`), -KEY `id_version` (`id_version`) -) ENGINE=InnoDB; -INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL); -CREATE TABLE t2 ( -`id` int(10) unsigned NOT NULL auto_increment, -`id_version` int(10) unsigned NOT NULL default '1', -PRIMARY KEY (`id`), -KEY `id_version` (`id_version`) -) ENGINE=InnoDB; -INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9"); -SELECT t2.id, t1.`label` FROM t2 INNER JOIN -(SELECT t1.id_object as id_object FROM t1 WHERE t1.`label` LIKE '%test%') AS lbl -ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object); -id label -3382 Test -102 Le Pekin (Test) -1794 Test de resto -1822 Test 3 -3524 Societe Test -3525 Fournisseur Test -drop table t1,t2; -create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam; -create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb; -create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb; -insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, ""); -insert t2 select * from t1; -insert t3 select * from t1; -checksum table t1, t2, t3, t4 quick; -Table Checksum -test.t1 2948697075 -test.t2 NULL -test.t3 NULL -test.t4 NULL -Warnings: -Error 1146 Table 'test.t4' doesn't exist -checksum table t1, t2, t3, t4; -Table Checksum -test.t1 2948697075 -test.t2 2948697075 -test.t3 2948697075 -test.t4 NULL -Warnings: -Error 1146 Table 'test.t4' doesn't exist -checksum table t1, t2, t3, t4 extended; -Table Checksum -test.t1 2948697075 -test.t2 2948697075 -test.t3 2948697075 -test.t4 NULL -Warnings: -Error 1146 Table 'test.t4' doesn't exist -drop table t1,t2,t3; -create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb; -insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt'); -select trim(name2) from t1 union all select trim(name) from t1 union all select trim(id) from t1; -trim(name2) -fff -sss -ttt -first -second -third -1 -2 -3 -drop table t1; -create table t1 (a int) engine=innodb; -create table t2 like t1; -drop table t1,t2; -create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb; -create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int(11) NOT NULL, - `id2` int(11) NOT NULL, - UNIQUE KEY `id` (`id`,`id2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL, - KEY `t1_id_fk` (`id`), - CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -create index id on t2 (id); -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL, - KEY `id` (`id`), - CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -create index id2 on t2 (id); -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL, - KEY `id` (`id`), - KEY `id2` (`id`), - CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop index id2 on t2; -drop index id on t2; -ERROR HY000: Cannot drop index 'id': needed in a foreign key constraint -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL, - KEY `id` (`id`), - CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t2; -create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb; -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL, - `id2` int(11) NOT NULL, - KEY `t1_id_fk` (`id`,`id2`), - CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -create unique index id on t2 (id,id2); -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL, - `id2` int(11) NOT NULL, - UNIQUE KEY `id` (`id`,`id2`), - CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t2; -create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL, - `id2` int(11) NOT NULL, - UNIQUE KEY `id` (`id`,`id2`), - KEY `t1_id_fk` (`id2`,`id`), - CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t2; -create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb; -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL, - `id2` int(11) NOT NULL, - UNIQUE KEY `id` (`id`,`id2`), - CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t2; -create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL, - `id2` int(11) NOT NULL, - UNIQUE KEY `id` (`id`,`id2`), - KEY `t1_id_fk` (`id2`,`id`), - CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t2; -create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb; -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `id2` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `id` (`id`,`id2`), - CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t2; -create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb; -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `id2` int(11) NOT NULL, - KEY `t1_id_fk` (`id`), - CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -alter table t2 add index id_test (id), add index id_test2 (id,id2); -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `id2` int(11) NOT NULL, - KEY `id_test` (`id`), - KEY `id_test2` (`id`,`id2`), - CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t2; -create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb; -ERROR 42000: Incorrect foreign key definition for 't1_id_fk': Key reference and table reference don't match -create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb; -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `a` int(11) NOT NULL AUTO_INCREMENT, - `b` int(11) DEFAULT NULL, - PRIMARY KEY (`a`), - UNIQUE KEY `b_2` (`b`), - KEY `b` (`b`), - CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t2; -create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb; -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `a` int(11) NOT NULL AUTO_INCREMENT, - `b` int(11) DEFAULT NULL, - PRIMARY KEY (`a`), - UNIQUE KEY `b` (`b`), - CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`), - CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t2, t1; -create table t1 (c char(10), index (c,c)) engine=innodb; -ERROR 42S21: Duplicate column name 'c' -create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb; -ERROR 42S21: Duplicate column name 'c1' -create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb; -ERROR 42S21: Duplicate column name 'c1' -create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb; -ERROR 42S21: Duplicate column name 'c1' -create table t1 (c1 char(10), c2 char(10)) engine=innodb; -alter table t1 add key (c1,c1); -ERROR 42S21: Duplicate column name 'c1' -alter table t1 add key (c2,c1,c1); -ERROR 42S21: Duplicate column name 'c1' -alter table t1 add key (c1,c2,c1); -ERROR 42S21: Duplicate column name 'c1' -alter table t1 add key (c1,c1,c2); -ERROR 42S21: Duplicate column name 'c1' -drop table t1; -create table t1(a int(1) , b int(1)) engine=innodb; -insert into t1 values ('1111', '3333'); -select distinct concat(a, b) from t1; -concat(a, b) -11113333 -drop table t1; -CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB; -SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE); -ERROR HY000: The used table type doesn't support FULLTEXT indexes -DROP TABLE t1; -CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1; -INSERT INTO t1 VALUES (1),(2),(3); -CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a), -CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1; -INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2); -SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz; -a_id b_list -1 1,2,3 -2 4,5 -3 NULL -DROP TABLE t2; -DROP TABLE t1; -create temporary table t1 (a int) engine=innodb; -insert into t1 values (4711); -truncate t1; -insert into t1 values (42); -select * from t1; -a -42 -drop table t1; -create table t1 (a int) engine=innodb; -insert into t1 values (4711); -truncate t1; -insert into t1 values (42); -select * from t1; -a -42 -drop table t1; -create table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=innodb; -insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3); -select * from t1 order by a,b,c,d; -a b c d e -1 1 a 1 1 -2 2 b 2 2 -3 3 ab 3 3 -explain select * from t1 order by a,b,c,d; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort -drop table t1; -create table t1 (a char(1), b char(1), key(a, b)) engine=innodb; -insert into t1 values ('8', '6'), ('4', '7'); -select min(a) from t1; -min(a) -4 -select min(b) from t1 where a='8'; -min(b) -6 -drop table t1; -create table t1 (x bigint unsigned not null primary key) engine=innodb; -insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1); -select * from t1; -x -18446744073709551600 -18446744073709551601 -select count(*) from t1 where x>0; -count(*) -2 -select count(*) from t1 where x=0; -count(*) -0 -select count(*) from t1 where x<0; -count(*) -0 -select count(*) from t1 where x < -16; -count(*) -0 -select count(*) from t1 where x = -16; -count(*) -0 -explain select count(*) from t1 where x > -16; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 2 Using where; Using index -select count(*) from t1 where x > -16; -count(*) -2 -select * from t1 where x > -16; -x -18446744073709551600 -18446744073709551601 -select count(*) from t1 where x = 18446744073709551601; -count(*) -1 -drop table t1; -SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total'; -variable_value -8191 -SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'; -variable_value -16384 -SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted'; -variable_value - @innodb_rows_deleted_orig -71 -SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted'; -variable_value - @innodb_rows_inserted_orig -1084 -SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated'; -variable_value - @innodb_rows_updated_orig -885 -SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits'; -variable_value - @innodb_row_lock_waits_orig -0 -SELECT variable_value - @innodb_row_lock_current_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_current_waits'; -variable_value - @innodb_row_lock_current_waits_orig -0 -SELECT variable_value - @innodb_row_lock_time_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time'; -variable_value - @innodb_row_lock_time_orig -0 -SELECT variable_value - @innodb_row_lock_time_max_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max'; -variable_value - @innodb_row_lock_time_max_orig -0 -SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg'; -variable_value - @innodb_row_lock_time_avg_orig -0 -SET @innodb_sync_spin_loops_orig = @@innodb_sync_spin_loops; -show variables like "innodb_sync_spin_loops"; -Variable_name Value -innodb_sync_spin_loops 30 -set global innodb_sync_spin_loops=1000; -show variables like "innodb_sync_spin_loops"; -Variable_name Value -innodb_sync_spin_loops 1000 -set global innodb_sync_spin_loops=0; -show variables like "innodb_sync_spin_loops"; -Variable_name Value -innodb_sync_spin_loops 0 -set global innodb_sync_spin_loops=20; -show variables like "innodb_sync_spin_loops"; -Variable_name Value -innodb_sync_spin_loops 20 -set global innodb_sync_spin_loops=@innodb_sync_spin_loops_orig; -show variables like "innodb_thread_concurrency"; -Variable_name Value -innodb_thread_concurrency 0 -set global innodb_thread_concurrency=1001; -Warnings: -Warning 1292 Truncated incorrect thread_concurrency value: '1001' -show variables like "innodb_thread_concurrency"; -Variable_name Value -innodb_thread_concurrency 1000 -set global innodb_thread_concurrency=0; -show variables like "innodb_thread_concurrency"; -Variable_name Value -innodb_thread_concurrency 0 -set global innodb_thread_concurrency=16; -show variables like "innodb_thread_concurrency"; -Variable_name Value -innodb_thread_concurrency 16 -show variables like "innodb_concurrency_tickets"; -Variable_name Value -innodb_concurrency_tickets 500 -set global innodb_concurrency_tickets=1000; -show variables like "innodb_concurrency_tickets"; -Variable_name Value -innodb_concurrency_tickets 1000 -set global innodb_concurrency_tickets=0; -Warnings: -Warning 1292 Truncated incorrect concurrency_tickets value: '0' -show variables like "innodb_concurrency_tickets"; -Variable_name Value -innodb_concurrency_tickets 1 -set global innodb_concurrency_tickets=500; -show variables like "innodb_concurrency_tickets"; -Variable_name Value -innodb_concurrency_tickets 500 -show variables like "innodb_thread_sleep_delay"; -Variable_name Value -innodb_thread_sleep_delay 10000 -set global innodb_thread_sleep_delay=100000; -show variables like "innodb_thread_sleep_delay"; -Variable_name Value -innodb_thread_sleep_delay 100000 -set global innodb_thread_sleep_delay=0; -show variables like "innodb_thread_sleep_delay"; -Variable_name Value -innodb_thread_sleep_delay 0 -set global innodb_thread_sleep_delay=10000; -show variables like "innodb_thread_sleep_delay"; -Variable_name Value -innodb_thread_sleep_delay 10000 -set storage_engine=INNODB; -drop table if exists t1,t2,t3; ---- Testing varchar --- ---- Testing varchar --- -create table t1 (v varchar(10), c char(10), t text); -insert into t1 values('+ ', '+ ', '+ '); -set @a=repeat(' ',20); -insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a)); -Warnings: -Note 1265 Data truncated for column 'v' at row 1 -select concat('*',v,'*',c,'*',t,'*') from t1; -concat('*',v,'*',c,'*',t,'*') -*+ *+*+ * -*+ *+*+ * -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(10) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -create table t2 like t1; -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `v` varchar(10) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -create table t3 select * from t1; -show create table t3; -Table Create Table -t3 CREATE TABLE `t3` ( - `v` varchar(10) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -alter table t1 modify c varchar(10); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(10) DEFAULT NULL, - `c` varchar(10) DEFAULT NULL, - `t` text -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -alter table t1 modify v char(10); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` char(10) DEFAULT NULL, - `c` varchar(10) DEFAULT NULL, - `t` text -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -alter table t1 modify t varchar(10); -Warnings: -Note 1265 Data truncated for column 't' at row 2 -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` char(10) DEFAULT NULL, - `c` varchar(10) DEFAULT NULL, - `t` varchar(10) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -select concat('*',v,'*',c,'*',t,'*') from t1; -concat('*',v,'*',c,'*',t,'*') -*+*+*+ * -*+*+*+ * -drop table t1,t2,t3; -create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10))); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(10) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text, - KEY `v` (`v`), - KEY `c` (`c`), - KEY `t` (`t`(10)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -select count(*) from t1; -count(*) -270 -insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1))); -select count(*) from t1 where v='a'; -count(*) -10 -select count(*) from t1 where c='a'; -count(*) -10 -select count(*) from t1 where t='a'; -count(*) -10 -select count(*) from t1 where v='a '; -count(*) -10 -select count(*) from t1 where c='a '; -count(*) -10 -select count(*) from t1 where t='a '; -count(*) -10 -select count(*) from t1 where v between 'a' and 'a '; -count(*) -10 -select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -count(*) -10 -select count(*) from t1 where v like 'a%'; -count(*) -11 -select count(*) from t1 where c like 'a%'; -count(*) -11 -select count(*) from t1 where t like 'a%'; -count(*) -11 -select count(*) from t1 where v like 'a %'; -count(*) -9 -explain select count(*) from t1 where v='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const # Using where; Using index -explain select count(*) from t1 where c='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref c c 11 const # Using where; Using index -explain select count(*) from t1 where t='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref t t 13 const # Using where -explain select count(*) from t1 where v like 'a%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 13 NULL # Using where; Using index -explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const # Using where; Using index -explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 13 const # Using where; Using index -alter table t1 add unique(v); -ERROR 23000: Duplicate entry 'v' for key 'v_2' -alter table t1 add key(v); -select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a'; -qq -*a*a*a* -*a *a*a * -*a *a*a * -*a *a*a * -*a *a*a * -*a *a*a * -*a *a*a * -*a *a*a * -*a *a*a * -*a *a*a * -explain select * from t1 where v='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v,v_2 # 13 const # Using where -select v,count(*) from t1 group by v limit 10; -v count(*) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select v,count(c) from t1 group by v limit 10; -v count(c) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select sql_big_result v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select sql_big_result v,count(c) from t1 group by v limit 10; -v count(c) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select c,count(*) from t1 group by c limit 10; -c count(*) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select c,count(t) from t1 group by c limit 10; -c count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select sql_big_result c,count(t) from t1 group by c limit 10; -c count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select t,count(*) from t1 group by t limit 10; -t count(*) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select t,count(t) from t1 group by t limit 10; -t count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select sql_big_result t,count(t) from t1 group by t limit 10; -t count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(300) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text, - KEY `c` (`c`), - KEY `t` (`t`(10)), - KEY `v` (`v`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -select count(*) from t1 where v='a'; -count(*) -10 -select count(*) from t1 where v='a '; -count(*) -10 -select count(*) from t1 where v between 'a' and 'a '; -count(*) -10 -select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -count(*) -10 -select count(*) from t1 where v like 'a%'; -count(*) -11 -select count(*) from t1 where v like 'a %'; -count(*) -9 -explain select count(*) from t1 where v='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where; Using index -explain select count(*) from t1 where v like 'a%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 303 NULL # Using where; Using index -explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where; Using index -explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where; Using index -explain select * from t1 where v='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 303 const # Using where -select v,count(*) from t1 group by v limit 10; -v count(*) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select sql_big_result v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -alter table t1 drop key v, add key v (v(30)); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(300) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text, - KEY `c` (`c`), - KEY `t` (`t`(10)), - KEY `v` (`v`(30)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -select count(*) from t1 where v='a'; -count(*) -10 -select count(*) from t1 where v='a '; -count(*) -10 -select count(*) from t1 where v between 'a' and 'a '; -count(*) -10 -select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -count(*) -10 -select count(*) from t1 where v like 'a%'; -count(*) -11 -select count(*) from t1 where v like 'a %'; -count(*) -9 -explain select count(*) from t1 where v='a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where -explain select count(*) from t1 where v like 'a%'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range v v 33 NULL # Using where -explain select count(*) from t1 where v between 'a' and 'a '; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where -explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where -explain select * from t1 where v='a'; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref v v 33 const # Using where -select v,count(*) from t1 group by v limit 10; -v count(*) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select sql_big_result v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -alter table t1 modify v varchar(600), drop key v, add key v (v); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(600) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text, - KEY `c` (`c`), - KEY `t` (`t`(10)), - KEY `v` (`v`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -select v,count(*) from t1 group by v limit 10; -v count(*) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -select sql_big_result v,count(t) from t1 group by v limit 10; -v count(t) -a 1 -a 10 -b 10 -c 10 -d 10 -e 10 -f 10 -g 10 -h 10 -i 10 -drop table t1; -create table t1 (a char(10), unique (a)); -insert into t1 values ('a '); -insert into t1 values ('a '); -ERROR 23000: Duplicate entry 'a' for key 'a' -alter table t1 modify a varchar(10); -insert into t1 values ('a '),('a '),('a '),('a '); -ERROR 23000: Duplicate entry 'a ' for key 'a' -insert into t1 values ('a '); -ERROR 23000: Duplicate entry 'a ' for key 'a' -insert into t1 values ('a '); -ERROR 23000: Duplicate entry 'a ' for key 'a' -insert into t1 values ('a '); -ERROR 23000: Duplicate entry 'a ' for key 'a' -update t1 set a='a ' where a like 'a%'; -select concat(a,'.') from t1; -concat(a,'.') -a . -update t1 set a='abc ' where a like 'a '; -select concat(a,'.') from t1; -concat(a,'.') -a . -update t1 set a='a ' where a like 'a %'; -select concat(a,'.') from t1; -concat(a,'.') -a . -update t1 set a='a ' where a like 'a '; -select concat(a,'.') from t1; -concat(a,'.') -a . -drop table t1; -create table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(5))); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(10) DEFAULT NULL, - `c` char(10) DEFAULT NULL, - `t` text, - KEY `v` (`v`(5)), - KEY `c` (`c`(5)), - KEY `t` (`t`(5)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t1; -create table t1 (v char(10) character set utf8); -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` char(10) CHARACTER SET utf8 DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t1; -create table t1 (v varchar(10), c char(10)) row_format=fixed; -Warnings: -Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT. -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` varchar(10) DEFAULT NULL, - `c` char(10) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED -insert into t1 values('a','a'),('a ','a '); -select concat('*',v,'*',c,'*') from t1; -concat('*',v,'*',c,'*') -*a*a* -*a *a* -drop table t1; -create table t1 (v varchar(65530), key(v(10))); -insert into t1 values(repeat('a',65530)); -select length(v) from t1 where v=repeat('a',65530); -length(v) -65530 -drop table t1; -create table t1(a int, b varchar(12), key ba(b, a)); -insert into t1 values (1, 'A'), (20, NULL); -explain select * from t1 where a=20 and b is null; -id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ref ba ba 20 const,const 1 Using where; Using index -select * from t1 where a=20 and b is null; -a b -20 NULL -drop table t1; -create table t1 (v varchar(65530), key(v)); -Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes -drop table t1; -create table t1 (v varchar(65536)); -Warnings: -Note 1246 Converting column 'v' from VARCHAR to TEXT -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` mediumtext -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t1; -create table t1 (v varchar(65530) character set utf8); -Warnings: -Note 1246 Converting column 'v' from VARCHAR to TEXT -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `v` mediumtext CHARACTER SET utf8 -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t1; -set storage_engine=MyISAM; -create table t1 (v varchar(16384)) engine=innodb; -drop table t1; -create table t1 (a char(1), b char(1), key(a, b)) engine=innodb; -insert into t1 values ('8', '6'), ('4', '7'); -select min(a) from t1; -min(a) -4 -select min(b) from t1 where a='8'; -min(b) -6 -drop table t1; -CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb; -insert into t1 (b) values (1); -replace into t1 (b) values (2), (1), (3); -select * from t1; -a b -3 1 -2 2 -4 3 -truncate table t1; -insert into t1 (b) values (1); -replace into t1 (b) values (2); -replace into t1 (b) values (1); -replace into t1 (b) values (3); -select * from t1; -a b -3 1 -2 2 -4 3 -drop table t1; -create table t1 (rowid int not null auto_increment, val int not null,primary -key (rowid), unique(val)) engine=innodb; -replace into t1 (val) values ('1'),('2'); -replace into t1 (val) values ('1'),('2'); -insert into t1 (val) values ('1'),('2'); -ERROR 23000: Duplicate entry '1' for key 'val' -select * from t1; -rowid val -3 1 -4 2 -drop table t1; -create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB; -insert into t1 (val) values (1); -update t1 set a=2 where a=1; -insert into t1 (val) values (1); -ERROR 23000: Duplicate entry '2' for key 'PRIMARY' -select * from t1; -a val -2 1 -drop table t1; -CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=INNODB; -INSERT INTO t1 (GRADE) VALUES (151),(252),(343); -SELECT GRADE FROM t1 WHERE GRADE > 160 AND GRADE < 300; -GRADE -252 -SELECT GRADE FROM t1 WHERE GRADE= 151; -GRADE -151 -DROP TABLE t1; -create table t1 (f1 varchar(10), f2 varchar(10), primary key (f1,f2)) engine=innodb; -create table t2 (f3 varchar(10), f4 varchar(10), key (f4)) engine=innodb; -insert into t2 values ('aa','cc'); -insert into t1 values ('aa','bb'),('aa','cc'); -delete t1 from t1,t2 where f1=f3 and f4='cc'; -select * from t1; -f1 f2 -drop table t1,t2; -CREATE TABLE t1 ( -id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) -) ENGINE=InnoDB; -CREATE TABLE t2 ( -id INTEGER NOT NULL, -FOREIGN KEY (id) REFERENCES t1 (id) -) ENGINE=InnoDB; -INSERT INTO t1 (id) VALUES (NULL); -SELECT * FROM t1; -id -1 -TRUNCATE t1; -INSERT INTO t1 (id) VALUES (NULL); -SELECT * FROM t1; -id -1 -DELETE FROM t1; -TRUNCATE t1; -INSERT INTO t1 (id) VALUES (NULL); -SELECT * FROM t1; -id -1 -DROP TABLE t2, t1; -CREATE TABLE t1 -( -id INT PRIMARY KEY -) ENGINE=InnoDB; -CREATE TEMPORARY TABLE t2 -( -id INT NOT NULL PRIMARY KEY, -b INT, -FOREIGN KEY (b) REFERENCES test.t1(id) -) ENGINE=InnoDB; -Got one of the listed errors -DROP TABLE t1; -create table t1 (col1 varchar(2000), index (col1(767))) -character set = latin1 engine = innodb; -create table t2 (col1 char(255), index (col1)) -character set = latin1 engine = innodb; -create table t3 (col1 binary(255), index (col1)) -character set = latin1 engine = innodb; -create table t4 (col1 varchar(767), index (col1)) -character set = latin1 engine = innodb; -create table t5 (col1 varchar(767) primary key) -character set = latin1 engine = innodb; -create table t6 (col1 varbinary(767) primary key) -character set = latin1 engine = innodb; -create table t7 (col1 text, index(col1(767))) -character set = latin1 engine = innodb; -create table t8 (col1 blob, index(col1(767))) -character set = latin1 engine = innodb; -create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2)) -character set = latin1 engine = innodb; -show create table t9; -Table Create Table -t9 CREATE TABLE `t9` ( - `col1` varchar(512) DEFAULT NULL, - `col2` varchar(512) DEFAULT NULL, - KEY `col1` (`col1`,`col2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t1, t2, t3, t4, t5, t6, t7, t8, t9; -create table t1 (col1 varchar(768), index(col1)) -character set = latin1 engine = innodb; -Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes -create table t2 (col1 varbinary(768), index(col1)) -character set = latin1 engine = innodb; -Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes -create table t3 (col1 text, index(col1(768))) -character set = latin1 engine = innodb; -Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes -create table t4 (col1 blob, index(col1(768))) -character set = latin1 engine = innodb; -Warnings: -Warning 1071 Specified key was too long; max key length is 767 bytes -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `col1` varchar(768) DEFAULT NULL, - KEY `col1` (`col1`(767)) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t1, t2, t3, t4; -create table t1 (col1 varchar(768) primary key) -character set = latin1 engine = innodb; -ERROR 42000: Specified key was too long; max key length is 767 bytes -create table t2 (col1 varbinary(768) primary key) -character set = latin1 engine = innodb; -ERROR 42000: Specified key was too long; max key length is 767 bytes -create table t3 (col1 text, primary key(col1(768))) -character set = latin1 engine = innodb; -ERROR 42000: Specified key was too long; max key length is 767 bytes -create table t4 (col1 blob, primary key(col1(768))) -character set = latin1 engine = innodb; -ERROR 42000: Specified key was too long; max key length is 767 bytes -CREATE TABLE t1 -( -id INT PRIMARY KEY -) ENGINE=InnoDB; -CREATE TABLE t2 -( -v INT, -CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id) -) ENGINE=InnoDB; -INSERT INTO t2 VALUES(2); -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`)) -INSERT INTO t1 VALUES(1); -INSERT INTO t2 VALUES(1); -DELETE FROM t1 WHERE id = 1; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`)) -DROP TABLE t1; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails -SET FOREIGN_KEY_CHECKS=0; -DROP TABLE t1; -SET FOREIGN_KEY_CHECKS=1; -INSERT INTO t2 VALUES(3); -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`)) -DROP TABLE t2; -create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; -insert into t1 values (1),(2); -set autocommit=0; -checksum table t1; -Table Checksum -test.t1 1531596814 -insert into t1 values(3); -checksum table t1; -Table Checksum -test.t1 1531596814 -commit; -checksum table t1; -Table Checksum -test.t1 2050879373 -commit; -drop table t1; -create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; -insert into t1 values (1),(2); -set autocommit=1; -checksum table t1; -Table Checksum -test.t1 1531596814 -set autocommit=1; -insert into t1 values(3); -checksum table t1; -Table Checksum -test.t1 2050879373 -drop table t1; -set foreign_key_checks=0; -create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb; -create table t1(a char(10) primary key, b varchar(20)) engine = innodb; -ERROR HY000: Can't create table 'test.t1' (errno: 150) -set foreign_key_checks=1; -drop table t2; -set foreign_key_checks=0; -create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; -create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8; -ERROR HY000: Can't create table 'test.t2' (errno: 150) -set foreign_key_checks=1; -drop table t1; -set foreign_key_checks=0; -create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb; -create table t1(a varchar(10) primary key) engine = innodb; -alter table t1 modify column a int; -Got one of the listed errors -set foreign_key_checks=1; -drop table t2,t1; -set foreign_key_checks=0; -create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; -create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; -alter table t1 convert to character set utf8; -set foreign_key_checks=1; -drop table t2,t1; -set foreign_key_checks=0; -create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; -create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; -rename table t3 to t1; -ERROR HY000: Error on rename of './test/t3' to './test/t1' (errno: 150) -set foreign_key_checks=1; -drop table t2,t3; -create table t1(a int primary key) row_format=redundant engine=innodb; -create table t2(a int primary key,constraint foreign key(a)references t1(a)) row_format=compact engine=innodb; -create table t3(a int primary key) row_format=compact engine=innodb; -create table t4(a int primary key,constraint foreign key(a)references t3(a)) row_format=redundant engine=innodb; -insert into t1 values(1); -insert into t3 values(1); -insert into t2 values(2); -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) -insert into t4 values(2); -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`)) -insert into t2 values(1); -insert into t4 values(1); -update t1 set a=2; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) -update t2 set a=2; -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) -update t3 set a=2; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`)) -update t4 set a=2; -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`)) -truncate t1; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)) -truncate t3; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`)) -truncate t2; -truncate t4; -truncate t1; -truncate t3; -drop table t4,t3,t2,t1; -create table t1 (a varchar(255) character set utf8, -b varchar(255) character set utf8, -c varchar(255) character set utf8, -d varchar(255) character set utf8, -key (a,b,c,d)) engine=innodb; -drop table t1; -create table t1 (a varchar(255) character set utf8, -b varchar(255) character set utf8, -c varchar(255) character set utf8, -d varchar(255) character set utf8, -e varchar(255) character set utf8, -key (a,b,c,d,e)) engine=innodb; -ERROR 42000: Specified key was too long; max key length is 3072 bytes -create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb; -create table t2 (s1 binary(2),primary key (s1)) engine=innodb; -create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb; -create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb; -insert into t1 values (0x41),(0x4120),(0x4100); -insert into t2 values (0x41),(0x4120),(0x4100); -ERROR 23000: Duplicate entry 'A' for key 'PRIMARY' -insert into t2 values (0x41),(0x4120); -insert into t3 values (0x41),(0x4120),(0x4100); -ERROR 23000: Duplicate entry 'A ' for key 'PRIMARY' -insert into t3 values (0x41),(0x4100); -insert into t4 values (0x41),(0x4120),(0x4100); -ERROR 23000: Duplicate entry 'A' for key 'PRIMARY' -insert into t4 values (0x41),(0x4100); -select hex(s1) from t1; -hex(s1) -41 -4100 -4120 -select hex(s1) from t2; -hex(s1) -4100 -4120 -select hex(s1) from t3; -hex(s1) -4100 -41 -select hex(s1) from t4; -hex(s1) -4100 -41 -drop table t1,t2,t3,t4; -create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb; -create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb; -insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42); -insert into t2 values(0x42); -ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE) -insert into t2 values(0x41); -select hex(s1) from t2; -hex(s1) -4100 -update t1 set s1=0x123456 where a=2; -select hex(s1) from t2; -hex(s1) -4100 -update t1 set s1=0x12 where a=1; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE) -update t1 set s1=0x12345678 where a=1; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE) -update t1 set s1=0x123457 where a=1; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE) -update t1 set s1=0x1220 where a=1; -select hex(s1) from t2; -hex(s1) -1220 -update t1 set s1=0x1200 where a=1; -select hex(s1) from t2; -hex(s1) -1200 -update t1 set s1=0x4200 where a=1; -select hex(s1) from t2; -hex(s1) -4200 -delete from t1 where a=1; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE) -delete from t1 where a=2; -update t2 set s1=0x4120; -delete from t1; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE) -delete from t1 where a!=3; -select a,hex(s1) from t1; -a hex(s1) -3 4120 -select hex(s1) from t2; -hex(s1) -4120 -drop table t2,t1; -create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb; -create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb; -insert into t1 values(1,0x4100),(2,0x41); -insert into t2 values(0x41); -select hex(s1) from t2; -hex(s1) -41 -update t1 set s1=0x1234 where a=1; -select hex(s1) from t2; -hex(s1) -41 -update t1 set s1=0x12 where a=2; -select hex(s1) from t2; -hex(s1) -12 -delete from t1 where a=1; -delete from t1 where a=2; -ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE) -select a,hex(s1) from t1; -a hex(s1) -2 12 -select hex(s1) from t2; -hex(s1) -12 -drop table t2,t1; -CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB; -CREATE TABLE t2(a INT) ENGINE=InnoDB; -ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a); -ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1; -ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a); -ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0; -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `a` int(11) DEFAULT NULL, - KEY `t2_ibfk_0` (`a`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -DROP TABLE t2,t1; -create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -insert into t1(a) values (1),(2),(3); -commit; -set autocommit = 0; -update t1 set b = 5 where a = 2; -create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end | -set autocommit = 0; -insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100), -(11),(21),(31),(41),(51),(61),(71),(81),(91),(101), -(12),(22),(32),(42),(52),(62),(72),(82),(92),(102), -(13),(23),(33),(43),(53),(63),(73),(83),(93),(103), -(14),(24),(34),(44),(54),(64),(74),(84),(94),(104); -commit; -commit; -drop trigger t1t; -drop table t1; -create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -insert into t1(a) values (1),(2),(3); -insert into t2(a) values (1),(2),(3); -insert into t3(a) values (1),(2),(3); -insert into t4(a) values (1),(2),(3); -insert into t3(a) values (5),(7),(8); -insert into t4(a) values (5),(7),(8); -insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12); -create trigger t1t before insert on t1 for each row begin -INSERT INTO t2 SET a = NEW.a; -end | -create trigger t2t before insert on t2 for each row begin -DELETE FROM t3 WHERE a = NEW.a; -end | -create trigger t3t before delete on t3 for each row begin -UPDATE t4 SET b = b + 1 WHERE a = OLD.a; -end | -create trigger t4t before update on t4 for each row begin -UPDATE t5 SET b = b + 1 where a = NEW.a; -end | -commit; -set autocommit = 0; -update t1 set b = b + 5 where a = 1; -update t2 set b = b + 5 where a = 1; -update t3 set b = b + 5 where a = 1; -update t4 set b = b + 5 where a = 1; -insert into t5(a) values(20); -set autocommit = 0; -insert into t1(a) values(7); -insert into t2(a) values(8); -delete from t2 where a = 3; -update t4 set b = b + 1 where a = 3; -commit; -drop trigger t1t; -drop trigger t2t; -drop trigger t3t; -drop trigger t4t; -drop table t1, t2, t3, t4, t5; -CREATE TABLE t1 ( -field1 varchar(8) NOT NULL DEFAULT '', -field2 varchar(8) NOT NULL DEFAULT '', -PRIMARY KEY (field1, field2) -) ENGINE=InnoDB; -CREATE TABLE t2 ( -field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY, -FOREIGN KEY (field1) REFERENCES t1 (field1) -ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB; -INSERT INTO t1 VALUES ('old', 'somevalu'); -INSERT INTO t1 VALUES ('other', 'anyvalue'); -INSERT INTO t2 VALUES ('old'); -INSERT INTO t2 VALUES ('other'); -UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu'; -ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 1 would lead to a duplicate entry -DROP TABLE t2; -DROP TABLE t1; -create table t1 ( -c1 bigint not null, -c2 bigint not null, -primary key (c1), -unique key (c2) -) engine=innodb; -create table t2 ( -c1 bigint not null, -primary key (c1) -) engine=innodb; -alter table t1 add constraint c2_fk foreign key (c2) -references t2(c1) on delete cascade; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` bigint(20) NOT NULL, - `c2` bigint(20) NOT NULL, - PRIMARY KEY (`c1`), - UNIQUE KEY `c2` (`c2`), - CONSTRAINT `c2_fk` FOREIGN KEY (`c2`) REFERENCES `t2` (`c1`) ON DELETE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -alter table t1 drop foreign key c2_fk; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `c1` bigint(20) NOT NULL, - `c2` bigint(20) NOT NULL, - PRIMARY KEY (`c1`), - UNIQUE KEY `c2` (`c2`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -drop table t1, t2; -create table t1(a date) engine=innodb; -create table t2(a date, key(a)) engine=innodb; -insert into t1 values('2005-10-01'); -insert into t2 values('2005-10-01'); -select * from t1, t2 -where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; -a a -2005-10-01 2005-10-01 -drop table t1, t2; -create table t1 (id int not null, f_id int not null, f int not null, -primary key(f_id, id)) engine=innodb; -create table t2 (id int not null,s_id int not null,s varchar(200), -primary key(id)) engine=innodb; -INSERT INTO t1 VALUES (8, 1, 3); -INSERT INTO t1 VALUES (1, 2, 1); -INSERT INTO t2 VALUES (1, 0, ''); -INSERT INTO t2 VALUES (8, 1, ''); -commit; -DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id) -WHERE mm.id IS NULL; -select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id) -where mm.id is null lock in share mode; -id f_id f -drop table t1,t2; -create table t1(a int not null, b int, primary key(a)) engine=innodb; -insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); -commit; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -update t1 set b = 5 where b = 1; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -select * from t1 where a = 7 and b = 3 for update; -a b -7 3 -commit; -commit; -drop table t1; -create table t1(a int not null, b int, primary key(a)) engine=innodb; -insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2); -commit; -set autocommit = 0; -select * from t1 lock in share mode; -a b -1 1 -2 2 -3 1 -4 2 -5 1 -6 2 -update t1 set b = 5 where b = 1; -set autocommit = 0; -select * from t1 where a = 2 and b = 2 for update; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -commit; -commit; -drop table t1; -create table t1(a int not null, b int, primary key(a)) engine=innodb; -insert into t1 values (1,2),(5,3),(4,2); -create table t2(d int not null, e int, primary key(d)) engine=innodb; -insert into t2 values (8,6),(12,1),(3,1); -commit; -set autocommit = 0; -select * from t2 for update; -d e -3 1 -8 6 -12 1 -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -insert into t1 select * from t2; -update t1 set b = (select e from t2 where a = d); -create table t3(d int not null, e int, primary key(d)) engine=innodb -select * from t2; -commit; -commit; -drop table t1, t2, t3; -create table t1(a int not null, b int, primary key(a)) engine=innodb; -insert into t1 values (1,2),(5,3),(4,2); -create table t2(a int not null, b int, primary key(a)) engine=innodb; -insert into t2 values (8,6),(12,1),(3,1); -create table t3(d int not null, b int, primary key(d)) engine=innodb; -insert into t3 values (8,6),(12,1),(3,1); -create table t5(a int not null, b int, primary key(a)) engine=innodb; -insert into t5 values (1,2),(5,3),(4,2); -create table t6(d int not null, e int, primary key(d)) engine=innodb; -insert into t6 values (8,6),(12,1),(3,1); -create table t8(a int not null, b int, primary key(a)) engine=innodb; -insert into t8 values (1,2),(5,3),(4,2); -create table t9(d int not null, e int, primary key(d)) engine=innodb; -insert into t9 values (8,6),(12,1),(3,1); -commit; -set autocommit = 0; -select * from t2 for update; -a b -3 1 -8 6 -12 1 -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; -insert into t1 select * from t2; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; -update t3 set b = (select b from t2 where a = d); -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; -create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -insert into t5 (select * from t2 lock in share mode); -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -update t6 set e = (select b from t2 where a = d lock in share mode); -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -insert into t8 (select * from t2 for update); -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -update t9 set e = (select b from t2 where a = d for update); -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -ERROR HY000: Lock wait timeout exceeded; try restarting transaction -commit; -drop table t1, t2, t3, t5, t6, t8, t9; -CREATE TABLE t1 (DB_ROW_ID int) engine=innodb; -ERROR HY000: Can't create table 'test.t1' (errno: -1) -CREATE TABLE t1 ( -a BIGINT(20) NOT NULL, -PRIMARY KEY (a) -) ENGINE=INNODB DEFAULT CHARSET=UTF8; -CREATE TABLE t2 ( -a BIGINT(20) NOT NULL, -b VARCHAR(128) NOT NULL, -c TEXT NOT NULL, -PRIMARY KEY (a,b), -KEY idx_t2_b_c (b,c(200)), -CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a) -ON DELETE CASCADE -) ENGINE=INNODB DEFAULT CHARSET=UTF8; -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (1, 'bar', 'vbar'); -INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR'); -INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi'); -INSERT INTO t2 VALUES (1, 'customer_over', '1'); -SELECT * FROM t2 WHERE b = 'customer_over'; -a b c -1 customer_over 1 -SELECT * FROM t2 WHERE BINARY b = 'customer_over'; -a b c -1 customer_over 1 -SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over'; -a -1 -/* Bang: Empty result set, above was expected: */ -SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; -a -1 -SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; -a -1 -drop table t2, t1; -CREATE TABLE t1 ( a int ) ENGINE=innodb; -BEGIN; -INSERT INTO t1 VALUES (1); -OPTIMIZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 optimize note Table does not support optimize, doing recreate + analyze instead -test.t1 optimize status OK -DROP TABLE t1; -CREATE TABLE t1 (id int PRIMARY KEY, f int NOT NULL, INDEX(f)) ENGINE=InnoDB; -CREATE TABLE t2 (id int PRIMARY KEY, f INT NOT NULL, -CONSTRAINT t2_t1 FOREIGN KEY (id) REFERENCES t1 (id) -ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB; -ALTER TABLE t2 ADD FOREIGN KEY (f) REFERENCES t1 (f) ON -DELETE CASCADE ON UPDATE CASCADE; -SHOW CREATE TABLE t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `id` int(11) NOT NULL, - `f` int(11) NOT NULL, - PRIMARY KEY (`id`), - KEY `f` (`f`), - CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f`) REFERENCES `t1` (`f`) ON DELETE CASCADE ON UPDATE CASCADE, - CONSTRAINT `t2_t1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1 -DROP TABLE t2, t1; -CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB; -CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (1); -ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL; -ALTER TABLE t2 MODIFY a INT NOT NULL; -ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150) -DELETE FROM t1; -DROP TABLE t2,t1; -CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY) -ENGINE=InnoDB; -INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4); -DELETE FROM t1; -INSERT INTO t1 VALUES ('DDD'); -SELECT * FROM t1; -a -DDD -DROP TABLE t1; -CREATE TABLE t1 (id int PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB -AUTO_INCREMENT=42; -INSERT INTO t1 VALUES (0),(347),(0); -SELECT * FROM t1; -id -42 -347 -348 -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1 -CREATE TABLE t2 (id int PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t2 VALUES(42),(347),(348); -ALTER TABLE t1 ADD CONSTRAINT t1_t2 FOREIGN KEY (id) REFERENCES t2(id); -SHOW CREATE TABLE t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`id`), - CONSTRAINT `t1_t2` FOREIGN KEY (`id`) REFERENCES `t2` (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=latin1 -DROP TABLE t1,t2; -set innodb_strict_mode=on; -CREATE TABLE t1 ( -c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255), -c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255), -c09 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), -c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), -c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), -c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), -c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), -c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255) -) ENGINE = InnoDB; -ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs -DROP TABLE IF EXISTS t1; -Warnings: -Note 1051 Unknown table 't1' -CREATE TABLE t1( -id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY -) ENGINE=InnoDB; -INSERT INTO t1 VALUES(-10); -SELECT * FROM t1; -id --10 -INSERT INTO t1 VALUES(NULL); -SELECT * FROM t1; -id --10 -1 -DROP TABLE t1; -SET binlog_format='MIXED'; -SET TX_ISOLATION='read-committed'; -SET AUTOCOMMIT=0; -DROP TABLE IF EXISTS t1, t2; -Warnings: -Note 1051 Unknown table 't1' -Note 1051 Unknown table 't2' -CREATE TABLE t1 ( a int ) ENGINE=InnoDB; -CREATE TABLE t2 LIKE t1; -SELECT * FROM t2; -a -SET binlog_format='MIXED'; -SET TX_ISOLATION='read-committed'; -SET AUTOCOMMIT=0; -INSERT INTO t1 VALUES (1); -COMMIT; -SELECT * FROM t1 WHERE a=1; -a -1 -SET binlog_format='MIXED'; -SET TX_ISOLATION='read-committed'; -SET AUTOCOMMIT=0; -SELECT * FROM t2; -a -SET binlog_format='MIXED'; -SET TX_ISOLATION='read-committed'; -SET AUTOCOMMIT=0; -INSERT INTO t1 VALUES (2); -COMMIT; -SELECT * FROM t1 WHERE a=2; -a -2 -SELECT * FROM t1 WHERE a=2; -a -2 -DROP TABLE t1; -DROP TABLE t2; -create table t1 (i int, j int) engine=innodb; -insert into t1 (i, j) values (1, 1), (2, 2); -update t1 set j = 2; -affected rows: 1 -info: Rows matched: 2 Changed: 1 Warnings: 0 -drop table t1; -create table t1 (id int) comment='this is a comment' engine=innodb; -select table_comment, data_free > 0 as data_free_is_set -from information_schema.tables -where table_schema='test' and table_name = 't1'; -table_comment data_free_is_set -this is a comment 1 -drop table t1; -CREATE TABLE t1 ( -c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, -c2 VARCHAR(128) NOT NULL, -PRIMARY KEY(c1) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=100; -CREATE TABLE t2 ( -c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, -c2 INT(10) UNSIGNED DEFAULT NULL, -PRIMARY KEY(c1) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=200; -SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2'; -AUTO_INCREMENT -200 -ALTER TABLE t2 ADD CONSTRAINT t1_t2_1 FOREIGN KEY(c1) REFERENCES t1(c1); -SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2'; -AUTO_INCREMENT -200 -DROP TABLE t2; -DROP TABLE t1; -CREATE TABLE t1 (c1 int default NULL, -c2 int default NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -TRUNCATE TABLE t1; -affected rows: 0 -INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); -affected rows: 5 -info: Records: 5 Duplicates: 0 Warnings: 0 -TRUNCATE TABLE t1; -affected rows: 0 -DROP TABLE t1; -Variable_name Value -Handler_update 0 -Variable_name Value -Handler_delete 0 -Variable_name Value -Handler_update 1 -Variable_name Value -Handler_delete 1 diff --git a/storage/innodb_plugin/mysql-test/innodb.test b/storage/innodb_plugin/mysql-test/innodb.test deleted file mode 100644 index f46a3a70b56..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb.test +++ /dev/null @@ -1,2569 +0,0 @@ -####################################################################### -# # -# Please, DO NOT TOUCH this file as well as the innodb.result file. # -# These files are to be modified ONLY BY INNOBASE guys. # -# # -# Use innodb_mysql.[test|result] files instead. # -# # -# If nevertheless you need to make some changes here, please, forward # -# your commit message # -# To: innodb_dev_ww@oracle.com # -# Cc: dev-innodb@mysql.com # -# (otherwise your changes may be erased). # -# # -####################################################################### - --- source include/have_innodb.inc - -# Save the original values of some variables in order to be able to -# estimate how much they have changed during the tests. Previously this -# test assumed that e.g. rows_deleted is 0 here and after deleting 23 -# rows it expected that rows_deleted will be 23. Now we do not make -# assumptions about the values of the variables at the beginning, e.g. -# rows_deleted should be 23 + "rows_deleted before the test". This allows -# the test to be run multiple times without restarting the mysqld server. -# See Bug#43309 Test main.innodb can't be run twice --- disable_query_log -SET @innodb_thread_concurrency_orig = @@innodb_thread_concurrency; - -SET @innodb_rows_deleted_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted'); -SET @innodb_rows_inserted_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted'); -SET @innodb_rows_updated_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated'); -SET @innodb_row_lock_waits_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits'); -SET @innodb_row_lock_current_waits_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_current_waits'); -SET @innodb_row_lock_time_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time'); -SET @innodb_row_lock_time_max_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max'); -SET @innodb_row_lock_time_avg_orig = (SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg'); --- enable_query_log - ---disable_warnings -drop table if exists t1,t2,t3,t4; -drop database if exists mysqltest; ---enable_warnings - -# -# Small basic test with ignore -# - -create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; - -insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt'); -select id, code, name from t1 order by id; - -update ignore t1 set id = 8, name = 'Sinisa' where id < 3; -select id, code, name from t1 order by id; -update ignore t1 set id = id + 10, name = 'Ralph' where id < 4; -select id, code, name from t1 order by id; - -drop table t1; - -# -# A bit bigger test -# The 'replace_column' statements are needed because the cardinality calculated -# by innodb is not always the same between runs -# - -CREATE TABLE t1 ( - id int(11) NOT NULL auto_increment, - parent_id int(11) DEFAULT '0' NOT NULL, - level tinyint(4) DEFAULT '0' NOT NULL, - PRIMARY KEY (id), - KEY parent_id (parent_id), - KEY level (level) -) engine=innodb; -INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2); -update t1 set parent_id=parent_id+100; -select * from t1 where parent_id=102; -update t1 set id=id+1000; --- error ER_DUP_ENTRY,1022 -update t1 set id=1024 where id=1009; -select * from t1; -update ignore t1 set id=id+1; # This will change all rows -select * from t1; -update ignore t1 set id=1023 where id=1010; -select * from t1 where parent_id=102; ---replace_column 9 # -explain select level from t1 where level=1; ---replace_column 9 # -explain select level,id from t1 where level=1; ---replace_column 9 # -explain select level,id,parent_id from t1 where level=1; -select level,id from t1 where level=1; -select level,id,parent_id from t1 where level=1; -optimize table t1; ---replace_column 7 # -show keys from t1; -drop table t1; - -# -# Test replace -# - -CREATE TABLE t1 ( - gesuchnr int(11) DEFAULT '0' NOT NULL, - benutzer_id int(11) DEFAULT '0' NOT NULL, - PRIMARY KEY (gesuchnr,benutzer_id) -) engine=innodb; - -replace into t1 (gesuchnr,benutzer_id) values (2,1); -replace into t1 (gesuchnr,benutzer_id) values (1,1); -replace into t1 (gesuchnr,benutzer_id) values (1,1); -select * from t1; -drop table t1; - -# -# test delete using hidden_primary_key -# - -create table t1 (a int) engine=innodb; -insert into t1 values (1), (2); -optimize table t1; -delete from t1 where a = 1; -select * from t1; -check table t1; -drop table t1; - -create table t1 (a int,b varchar(20)) engine=innodb; -insert into t1 values (1,""), (2,"testing"); -delete from t1 where a = 1; -select * from t1; -create index skr on t1 (a); -insert into t1 values (3,""), (4,"testing"); -analyze table t1; ---replace_column 7 # -show keys from t1; -drop table t1; - - -# Test of reading on secondary key with may be null - -create table t1 (a int,b varchar(20),key(a)) engine=innodb; -insert into t1 values (1,""), (2,"testing"); -select * from t1 where a = 1; -drop table t1; - -# -# Test rollback -# - -create table t1 (n int not null primary key) engine=innodb; -set autocommit=0; -insert into t1 values (4); -rollback; -select n, "after rollback" from t1; -insert into t1 values (4); -commit; -select n, "after commit" from t1; -commit; -insert into t1 values (5); --- error ER_DUP_ENTRY -insert into t1 values (4); -commit; -select n, "after commit" from t1; -set autocommit=1; -insert into t1 values (6); --- error ER_DUP_ENTRY -insert into t1 values (4); -select n from t1; -set autocommit=0; -# -# savepoints -# -begin; -savepoint `my_savepoint`; -insert into t1 values (7); -savepoint `savept2`; -insert into t1 values (3); -select n from t1; -savepoint savept3; -rollback to savepoint savept2; ---error 1305 -rollback to savepoint savept3; -rollback to savepoint savept2; -release savepoint `my_savepoint`; -select n from t1; --- error 1305 -rollback to savepoint `my_savepoint`; ---error 1305 -rollback to savepoint savept2; -insert into t1 values (8); -savepoint sv; -commit; -savepoint sv; -set autocommit=1; -# nop -rollback; -drop table t1; - -# -# Test for commit and FLUSH TABLES WITH READ LOCK -# - -create table t1 (n int not null primary key) engine=innodb; -start transaction; -insert into t1 values (4); -flush tables with read lock; -# -# Current code can't handle a read lock in middle of transaction -#--error 1223; -commit; -unlock tables; -commit; -select * from t1; -drop table t1; - -# -# Testing transactions -# - -create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=innodb; -begin; -insert into t1 values(1,'hamdouni'); -select id as afterbegin_id,nom as afterbegin_nom from t1; -rollback; -select id as afterrollback_id,nom as afterrollback_nom from t1; -set autocommit=0; -insert into t1 values(2,'mysql'); -select id as afterautocommit0_id,nom as afterautocommit0_nom from t1; -rollback; -select id as afterrollback_id,nom as afterrollback_nom from t1; -set autocommit=1; -drop table t1; - -# -# Simple not autocommit test -# - -CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb; -insert into t1 values ('pippo', 12); --- error ER_DUP_ENTRY -insert into t1 values ('pippo', 12); # Gives error -delete from t1; -delete from t1 where id = 'pippo'; -select * from t1; - -insert into t1 values ('pippo', 12); -set autocommit=0; -delete from t1; -rollback; -select * from t1; -delete from t1; -commit; -select * from t1; -drop table t1; - -# -# Test of active transactions -# - -create table t1 (a integer) engine=innodb; -start transaction; -rename table t1 to t2; -create table t1 (b integer) engine=innodb; -insert into t1 values (1); -rollback; -drop table t1; -rename table t2 to t1; -drop table t1; -set autocommit=1; - -# -# The following simple tests failed at some point -# - -CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=innodb; -INSERT INTO t1 VALUES (1, 'Jochen'); -select * from t1; -drop table t1; - -CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=innodb; -set autocommit=0; -INSERT INTO t1 SET _userid='marc@anyware.co.uk'; -COMMIT; -SELECT * FROM t1; -SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk'; -drop table t1; -set autocommit=1; - -# -# Test when reading on part of unique key -# -CREATE TABLE t1 ( - user_id int(10) DEFAULT '0' NOT NULL, - name varchar(100), - phone varchar(100), - ref_email varchar(100) DEFAULT '' NOT NULL, - detail varchar(200), - PRIMARY KEY (user_id,ref_email) -)engine=innodb; - -INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar'); -select * from t1 where user_id=10292; -INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds'); -select * from t1 where user_id=10292; -select * from t1 where user_id>=10292; -select * from t1 where user_id>10292; -select * from t1 where user_id<10292; -drop table t1; - -# -# Test that keys are created in right order -# - -CREATE TABLE t1 (a int not null, b int not null,c int not null, -key(a),primary key(a,b), unique(c),key(a),unique(b)); ---replace_column 7 # -show index from t1; -drop table t1; - -# -# Test of ALTER TABLE and innodb tables -# - -create table t1 (col1 int not null, col2 char(4) not null, primary key(col1)); -alter table t1 engine=innodb; -insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4'); -select * from t1; -update t1 set col2='7' where col1='4'; -select * from t1; -alter table t1 add co3 int not null; -select * from t1; -update t1 set col2='9' where col1='2'; -select * from t1; -drop table t1; - -# -# INSERT INTO innodb tables -# - -create table t1 (a int not null , b int, primary key (a)) engine = innodb; -create table t2 (a int not null , b int, primary key (a)) engine = myisam; -insert into t1 VALUES (1,3) , (2,3), (3,3); -select * from t1; -insert into t2 select * from t1; -select * from t2; -delete from t1 where b = 3; -select * from t1; -insert into t1 select * from t2; -select * from t1; -select * from t2; -drop table t1,t2; - -# -# ORDER BY on not primary key -# - -CREATE TABLE t1 ( - user_name varchar(12), - password text, - subscribed char(1), - user_id int(11) DEFAULT '0' NOT NULL, - quota bigint(20), - weight double, - access_date date, - access_time time, - approved datetime, - dummy_primary_key int(11) NOT NULL auto_increment, - PRIMARY KEY (dummy_primary_key) -) ENGINE=innodb; -INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1); -INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2); -INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3); -INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4); -INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5); -select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name; -drop table t1; - -# -# Testing of tables without primary keys -# - -CREATE TABLE t1 ( - id int(11) NOT NULL auto_increment, - parent_id int(11) DEFAULT '0' NOT NULL, - level tinyint(4) DEFAULT '0' NOT NULL, - KEY (id), - KEY parent_id (parent_id), - KEY level (level) -) engine=innodb; -INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1); -INSERT INTO t1 values (179,5,2); -update t1 set parent_id=parent_id+100; -select * from t1 where parent_id=102; -update t1 set id=id+1000; -update t1 set id=1024 where id=1009; -select * from t1; -update ignore t1 set id=id+1; # This will change all rows -select * from t1; -update ignore t1 set id=1023 where id=1010; -select * from t1 where parent_id=102; ---replace_column 9 # -explain select level from t1 where level=1; -select level,id from t1 where level=1; -select level,id,parent_id from t1 where level=1; -select level,id from t1 where level=1 order by id; -delete from t1 where level=1; -select * from t1; -drop table t1; - -# -# Test of index only reads -# -CREATE TABLE t1 ( - sca_code char(6) NOT NULL, - cat_code char(6) NOT NULL, - sca_desc varchar(50), - lan_code char(2) NOT NULL, - sca_pic varchar(100), - sca_sdesc varchar(50), - sca_sch_desc varchar(16), - PRIMARY KEY (sca_code, cat_code, lan_code), - INDEX sca_pic (sca_pic) -) engine = innodb ; - -INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING'); -select count(*) from t1 where sca_code = 'PD'; -select count(*) from t1 where sca_code <= 'PD'; -select count(*) from t1 where sca_pic is null; -alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic); -select count(*) from t1 where sca_code='PD' and sca_pic is null; -select count(*) from t1 where cat_code='E'; - -alter table t1 drop index sca_pic, add index (sca_pic, cat_code); -select count(*) from t1 where sca_code='PD' and sca_pic is null; -select count(*) from t1 where sca_pic >= 'n'; -select sca_pic from t1 where sca_pic is null; -update t1 set sca_pic="test" where sca_pic is null; -delete from t1 where sca_code='pd'; -drop table t1; - -# -# Test of opening table twice and timestamps -# -set @a:=now(); -CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb; -insert into t1 (a) values(1),(2),(3); -select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a; -select a from t1 natural join t1 as t2 where b >= @a order by a; -update t1 set a=5 where a=1; -select a from t1; -drop table t1; - -# -# Test with variable length primary key -# -create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb; -insert into t1 values("hello",1),("world",2); -select * from t1 order by b desc; -optimize table t1; ---replace_column 7 # -show keys from t1; -drop table t1; - -# -# Test of create index with NULL columns -# -create table t1 (i int, j int ) ENGINE=innodb; -insert into t1 values (1,2); -select * from t1 where i=1 and j=2; -create index ax1 on t1 (i,j); -select * from t1 where i=1 and j=2; -drop table t1; - -# -# Test min-max optimization -# - -CREATE TABLE t1 ( - a int3 unsigned NOT NULL, - b int1 unsigned NOT NULL, - UNIQUE (a, b) -) ENGINE = innodb; - -INSERT INTO t1 VALUES (1, 1); -SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1; -drop table t1; - -# -# Test INSERT DELAYED -# - -CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb; -# Can't test this in 3.23 -# INSERT DELAYED INTO t1 VALUES (1); -INSERT INTO t1 VALUES (1); -SELECT * FROM t1; -DROP TABLE t1; - - -# -# Crash when using many tables (Test case by Jeremy D Zawodny) -# - -create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = innodb; -insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1); ---replace_column 9 # -explain select * from t1 where a > 0 and a < 50; -drop table t1; - -# -# Test lock tables -# - -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb; -insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); -LOCK TABLES t1 WRITE; ---error ER_DUP_ENTRY -insert into t1 values (99,1,2,'D'),(1,1,2,'D'); -select id from t1; -select id from t1; -UNLOCK TABLES; -DROP TABLE t1; - -create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb; -insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL'); -LOCK TABLES t1 WRITE; -begin; ---error ER_DUP_ENTRY -insert into t1 values (99,1,2,'D'),(1,1,2,'D'); -select id from t1; -insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D'); -commit; -select id,id3 from t1; -UNLOCK TABLES; -DROP TABLE t1; - -# -# Test prefix key -# -create table t1 (a char(20), unique (a(5))) engine=innodb; -drop table t1; -create table t1 (a char(20), index (a(5))) engine=innodb; -show create table t1; -drop table t1; - -# -# Test using temporary table and auto_increment -# - -create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb; -insert into t1 values (NULL),(NULL),(NULL); -delete from t1 where a=3; -insert into t1 values (NULL); -select * from t1; -alter table t1 add b int; -select * from t1; -drop table t1; - -#Slashdot bug -create table t1 - ( - id int auto_increment primary key, - name varchar(32) not null, - value text not null, - uid int not null, - unique key(name,uid) - ) engine=innodb; -insert into t1 values (1,'one','one value',101), - (2,'two','two value',102),(3,'three','three value',103); -set insert_id=5; -replace into t1 (value,name,uid) values ('other value','two',102); -delete from t1 where uid=102; -set insert_id=5; -replace into t1 (value,name,uid) values ('other value','two',102); -set insert_id=6; -replace into t1 (value,name,uid) values ('other value','two',102); -select * from t1; -drop table t1; - -# -# Test DROP DATABASE -# - -create database mysqltest; -create table mysqltest.t1 (a int not null) engine= innodb; -insert into mysqltest.t1 values(1); -create table mysqltest.t2 (a int not null) engine= myisam; -insert into mysqltest.t2 values(1); -create table mysqltest.t3 (a int not null) engine= heap; -insert into mysqltest.t3 values(1); -commit; -drop database mysqltest; -# Don't check error message ---error 1049 -show tables from mysqltest; - -# -# Test truncate table with and without auto_commit -# - -set autocommit=0; -create table t1 (a int not null) engine= innodb; -insert into t1 values(1),(2); -truncate table t1; -commit; -truncate table t1; -truncate table t1; -select * from t1; -insert into t1 values(1),(2); -delete from t1; -select * from t1; -commit; -drop table t1; -set autocommit=1; - -create table t1 (a int not null) engine= innodb; -insert into t1 values(1),(2); -truncate table t1; -insert into t1 values(1),(2); -select * from t1; -truncate table t1; -insert into t1 values(1),(2); -delete from t1; -select * from t1; -drop table t1; - -# -# Test of how ORDER BY works when doing it on the whole table -# - -create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=innodb; -insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4); ---replace_column 9 # -explain select * from t1 order by a; ---replace_column 9 # -explain select * from t1 order by b; ---replace_column 9 # -explain select * from t1 order by c; ---replace_column 9 # -explain select a from t1 order by a; ---replace_column 9 # -explain select b from t1 order by b; ---replace_column 9 # -explain select a,b from t1 order by b; ---replace_column 9 # -explain select a,b from t1; ---replace_column 9 # -explain select a,b,c from t1; -drop table t1; - -# -# Check describe -# - -create table t1 (t int not null default 1, key (t)) engine=innodb; -desc t1; -drop table t1; - -# -# Test of multi-table-delete -# - -CREATE TABLE t1 ( - number bigint(20) NOT NULL default '0', - cname char(15) NOT NULL default '', - carrier_id smallint(6) NOT NULL default '0', - privacy tinyint(4) NOT NULL default '0', - last_mod_date timestamp NOT NULL, - last_mod_id smallint(6) NOT NULL default '0', - last_app_date timestamp NOT NULL, - last_app_id smallint(6) default '-1', - version smallint(6) NOT NULL default '0', - assigned_scps int(11) default '0', - status tinyint(4) default '0' -) ENGINE=InnoDB; -INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1); -INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0); -INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1); -INSERT INTO t1 VALUES (302467,'Sue\'s Subshop',90,3,20020109113241,500,20020102115111,501,7,24,0); -INSERT INTO t1 VALUES (6014911113,'SudzCarwash',520,1,20020102115234,500,20020102115259,501,33,32768,0); -INSERT INTO t1 VALUES (333,'tubs',99,2,20020109113440,501,20020109113440,500,3,10,0); -CREATE TABLE t2 ( - number bigint(20) NOT NULL default '0', - cname char(15) NOT NULL default '', - carrier_id smallint(6) NOT NULL default '0', - privacy tinyint(4) NOT NULL default '0', - last_mod_date timestamp NOT NULL, - last_mod_id smallint(6) NOT NULL default '0', - last_app_date timestamp NOT NULL, - last_app_id smallint(6) default '-1', - version smallint(6) NOT NULL default '0', - assigned_scps int(11) default '0', - status tinyint(4) default '0' -) ENGINE=InnoDB; -INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1); -INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0); -INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1); -INSERT INTO t2 VALUES (333,'tubs',99,2,20020109113453,501,20020109113453,500,3,10,0); -select * from t1; -select * from t2; -delete t1, t2 from t1 left join t2 on t1.number=t2.number where (t1.carrier_id=90 and t1.number=t2.number) or (t2.carrier_id=90 and t1.number=t2.number) or (t1.carrier_id=90 and t2.number is null); -select * from t1; -select * from t2; -select * from t2; -drop table t1,t2; - -# -# A simple test with some isolation levels -# TODO: Make this into a test using replication to really test how -# this works. -# - -create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb; - -BEGIN; -SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; -SELECT @@tx_isolation,@@global.tx_isolation; -insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'); -select id, code, name from t1 order by id; -COMMIT; - -BEGIN; -SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; -insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha'); -select id, code, name from t1 order by id; -COMMIT; - -SET binlog_format='MIXED'; -BEGIN; -SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt'); -select id, code, name from t1 order by id; -COMMIT; -DROP TABLE t1; - -# -# Test of multi-table-update -# -create table t1 (n int(10), d int(10)) engine=innodb; -create table t2 (n int(10), d int(10)) engine=innodb; -insert into t1 values(1,1),(1,2); -insert into t2 values(1,10),(2,20); -UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n; -select * from t1; -select * from t2; -drop table t1,t2; - -# -# Bug #29136 erred multi-delete on trans table does not rollback -# - -# prepare ---disable_warnings -drop table if exists t1, t2; ---enable_warnings -CREATE TABLE t1 (a int, PRIMARY KEY (a)); -CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; -create trigger trg_del_t2 after delete on t2 for each row - insert into t1 values (1); -insert into t1 values (1); -insert into t2 values (1),(2); - - -# exec cases A, B - see multi_update.test - -# A. send_error() w/o send_eof() branch - ---error ER_DUP_ENTRY -delete t2 from t2; - -# check - -select count(*) from t2 /* must be 2 as restored after rollback caused by the error */; - -# cleanup bug#29136 - -drop table t1, t2; - - -# -# Bug #29136 erred multi-delete on trans table does not rollback -# - -# prepare ---disable_warnings -drop table if exists t1, t2; ---enable_warnings -CREATE TABLE t1 (a int, PRIMARY KEY (a)); -CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB; -create trigger trg_del_t2 after delete on t2 for each row - insert into t1 values (1); -insert into t1 values (1); -insert into t2 values (1),(2); - - -# exec cases A, B - see multi_update.test - -# A. send_error() w/o send_eof() branch - ---error ER_DUP_ENTRY -delete t2 from t2; - -# check - -select count(*) from t2 /* must be 2 as restored after rollback caused by the error */; - -# cleanup bug#29136 - -drop table t1, t2; - - -# -# Testing of IFNULL -# -create table t1 (a int, b int) engine=innodb; -insert into t1 values(20,null); -select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on -t2.b=t3.a; -select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on -t2.b=t3.a order by 1; -insert into t1 values(10,null); -select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on -t2.b=t3.a order by 1; -drop table t1; - -# -# Test of read_through not existing const_table -# - -create table t1 (a varchar(10) not null) engine=myisam; -create table t2 (b varchar(10) not null unique) engine=innodb; -select t1.a from t1,t2 where t1.a=t2.b; -drop table t1,t2; -create table t1 (a int not null, b int, primary key (a)) engine = innodb; -create table t2 (a int not null, b int, primary key (a)) engine = innodb; -insert into t1 values (10, 20); -insert into t2 values (10, 20); -update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10; -drop table t1,t2; - -# -# Test of multi-table-delete with foreign key constraints -# - -CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; -CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=INNODB; -insert into t1 set id=1; -insert into t2 set id=1, t1_id=1; -delete t1,t2 from t1,t2 where t1.id=t2.t1_id; -select * from t1; -select * from t2; -drop table t2,t1; -CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB; -CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=INNODB; -INSERT INTO t1 VALUES(1); -INSERT INTO t2 VALUES(1, 1); -SELECT * from t1; -UPDATE t1,t2 SET t1.id=t1.id+1, t2.t1_id=t1.id+1; -SELECT * from t1; -UPDATE t1,t2 SET t1.id=t1.id+1 where t1.id!=t2.id; -SELECT * from t1; -DROP TABLE t1,t2; - -# -# Test of range_optimizer -# - -set autocommit=0; - -CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; - -CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB; - -CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=InnoDB; - -INSERT INTO t3 VALUES("my-test-1", "my-test-2"); -COMMIT; - -INSERT INTO t1 VALUES("this-key", "will disappear"); -INSERT INTO t2 VALUES("this-key", "will also disappear"); -DELETE FROM t3 WHERE id1="my-test-1"; - -SELECT * FROM t1; -SELECT * FROM t2; -SELECT * FROM t3; -ROLLBACK; - -SELECT * FROM t1; -SELECT * FROM t2; -SELECT * FROM t3; -SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE; -COMMIT; -set autocommit=1; -DROP TABLE t1,t2,t3; - -# -# Check update with conflicting key -# - -CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=innodb; -INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); -# We need the a < 1000 test here to quard against the halloween problems -UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000; -SELECT * from t1; -drop table t1; - -# -# Test multi update with different join methods -# - -CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb; -CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb; -INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12); -INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); - -# Full join, without key -update t1,t2 set t1.a=t1.a+100; -select * from t1; - -# unique key -update t1,t2 set t1.a=t1.a+100 where t1.a=101; -select * from t1; - -# ref key -update t1,t2 set t1.b=t1.b+10 where t1.b=2; -select * from t1; - -# Range key (in t1) -update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100; -select * from t1; -select * from t2; - -drop table t1,t2; -CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM; -CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; -SET AUTOCOMMIT=0; -INSERT INTO t1 ( B_ID ) VALUES ( 1 ); -INSERT INTO t2 ( NEXT_T ) VALUES ( 1 ); -ROLLBACK; -SELECT * FROM t1; -drop table t1,t2; -create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = innodb; -insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2); -select distinct parent,child from t1 order by parent; -drop table t1; - -# -# Test that MySQL priorities clustered indexes -# -create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb; -create table t2 (a int not null auto_increment primary key, b int); -insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null); -insert into t2 (a) select b from t1; -insert into t1 (b) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -insert into t2 (a) select b from t1; -insert into t1 (a) select b from t2; -select count(*) from t1; ---replace_column 9 # -explain select * from t1 where c between 1 and 2500; -update t1 set c=a; ---replace_column 9 # -explain select * from t1 where c between 1 and 2500; -drop table t1,t2; - -# -# Test of UPDATE ... ORDER BY -# - -create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb; - -insert into t1 (id) values (null),(null),(null),(null),(null); -update t1 set fk=69 where fk is null order by id limit 1; -SELECT * from t1; -drop table t1; - -create table t1 (a int not null, b int not null, key (a)); -insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3); -SET @tmp=0; -update t1 set b=(@tmp:=@tmp+1) order by a; -update t1 set b=99 where a=1 order by b asc limit 1; -update t1 set b=100 where a=1 order by b desc limit 2; -update t1 set a=a+10+b where a=1 order by b; -select * from t1 order by a,b; -drop table t1; - -# -# Test of multi-table-updates (bug #1980). -# - -create table t1 ( c char(8) not null ) engine=innodb; -insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9'); -insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F'); - -alter table t1 add b char(8) not null; -alter table t1 add a char(8) not null; -alter table t1 add primary key (a,b,c); -update t1 set a=c, b=c; - -create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb; -insert into t2 select * from t1; - -delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b; -drop table t1,t2; - -# -# test autoincrement with TRUNCATE -# - -SET AUTOCOMMIT=1; -create table t1 (a integer auto_increment primary key) engine=innodb; -insert into t1 (a) values (NULL),(NULL); -truncate table t1; -insert into t1 (a) values (NULL),(NULL); -SELECT * from t1; -drop table t1; - -# -# Test dictionary handling with spaceand quoting -# - -CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=INNODB; -CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) ENGINE=INNODB; -#show create table t2; -drop table t2,t1; - -# -# Test of multi updated and foreign keys -# - -create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) engine = innodb; -insert into `t1`values ( 1 ) ; -create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = innodb; -insert into `t2`values ( 1 ) ; -create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb; -insert into `t3`values ( 1 ) ; ---error 1451 -delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; ---error 1451 -update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; ---error 1054 -update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; -drop table t3,t2,t1; - -# -# test for recursion depth limit -# -create table t1( - id int primary key, - pid int, - index(pid), - foreign key(pid) references t1(id) on delete cascade) engine=innodb; -insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6), - (8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14); --- error 1451 -delete from t1 where id=0; -delete from t1 where id=15; -delete from t1 where id=0; - -drop table t1; - -# -# Test timestamps -# - -CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB; -CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx -(stamp))ENGINE=InnoDB; -insert into t1 values (1),(2),(3); -# Note that timestamp 3 is wrong -insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000); -SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp < -'20020204120000' GROUP BY col1; -drop table t1,t2; - -# -# Test by Francois MASUREL -# - -CREATE TABLE t1 ( - `id` int(10) unsigned NOT NULL auto_increment, - `id_object` int(10) unsigned default '0', - `id_version` int(10) unsigned NOT NULL default '1', - `label` varchar(100) NOT NULL default '', - `description` text, - PRIMARY KEY (`id`), - KEY `id_object` (`id_object`), - KEY `id_version` (`id_version`) -) ENGINE=InnoDB; - -INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL); - -CREATE TABLE t2 ( - `id` int(10) unsigned NOT NULL auto_increment, - `id_version` int(10) unsigned NOT NULL default '1', - PRIMARY KEY (`id`), - KEY `id_version` (`id_version`) -) ENGINE=InnoDB; - -INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9"); - -SELECT t2.id, t1.`label` FROM t2 INNER JOIN -(SELECT t1.id_object as id_object FROM t1 WHERE t1.`label` LIKE '%test%') AS lbl -ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object); -drop table t1,t2; - -create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam; -create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb; -create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb; -insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, ""); -insert t2 select * from t1; -insert t3 select * from t1; -checksum table t1, t2, t3, t4 quick; -checksum table t1, t2, t3, t4; -checksum table t1, t2, t3, t4 extended; -#show table status; -drop table t1,t2,t3; - -# -# Test problem with refering to different fields in same table in UNION -# (Bug #2552) -# -create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb; -insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt'); -select trim(name2) from t1 union all select trim(name) from t1 union all select trim(id) from t1; -drop table t1; - -# -# Bug2160 -# -create table t1 (a int) engine=innodb; -create table t2 like t1; -drop table t1,t2; - -# -# Test of automaticly created foreign keys -# - -create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb; -create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb; -show create table t1; -show create table t2; -create index id on t2 (id); -show create table t2; -create index id2 on t2 (id); -show create table t2; -drop index id2 on t2; ---error ER_DROP_INDEX_FK -drop index id on t2; -show create table t2; -drop table t2; - -create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb; -show create table t2; -create unique index id on t2 (id,id2); -show create table t2; -drop table t2; - -# Check foreign key columns created in different order than key columns -create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; -show create table t2; -drop table t2; - -create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb; -show create table t2; -drop table t2; - -create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb; -show create table t2; -drop table t2; - -create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb; -show create table t2; -drop table t2; - -create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb; -show create table t2; -alter table t2 add index id_test (id), add index id_test2 (id,id2); -show create table t2; -drop table t2; - -# Test error handling - -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' ---error ER_WRONG_FK_DEF -create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb; - -# bug#3749 - -create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb; -show create table t2; -drop table t2; -create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb; -show create table t2; -drop table t2, t1; - - -# -# Bug #6126: Duplicate columns in keys gives misleading error message -# ---error 1060 -create table t1 (c char(10), index (c,c)) engine=innodb; ---error 1060 -create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb; ---error 1060 -create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb; ---error 1060 -create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb; -create table t1 (c1 char(10), c2 char(10)) engine=innodb; ---error 1060 -alter table t1 add key (c1,c1); ---error 1060 -alter table t1 add key (c2,c1,c1); ---error 1060 -alter table t1 add key (c1,c2,c1); ---error 1060 -alter table t1 add key (c1,c1,c2); -drop table t1; - -# -# Bug #4082: integer truncation -# - -create table t1(a int(1) , b int(1)) engine=innodb; -insert into t1 values ('1111', '3333'); -select distinct concat(a, b) from t1; -drop table t1; - -# -# BUG#7709 test case - Boolean fulltext query against unsupported -# engines does not fail -# - -CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB; ---error 1214 -SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE); -DROP TABLE t1; - -# -# check null values #1 -# - ---disable_warnings -CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1; -INSERT INTO t1 VALUES (1),(2),(3); -CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a), - CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1; ---enable_warnings -INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2); -SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz; -DROP TABLE t2; -DROP TABLE t1; - -# -# Bug#11816 - Truncate table doesn't work with temporary innodb tables -# This is not an innodb bug, but we test it using innodb. -# -create temporary table t1 (a int) engine=innodb; -insert into t1 values (4711); -truncate t1; -insert into t1 values (42); -select * from t1; -drop table t1; -# Show that it works with permanent tables too. -create table t1 (a int) engine=innodb; -insert into t1 values (4711); -truncate t1; -insert into t1 values (42); -select * from t1; -drop table t1; - -# -# Bug #13025 Server crash during filesort -# - -create table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=innodb; -insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3); -select * from t1 order by a,b,c,d; -explain select * from t1 order by a,b,c,d; -drop table t1; - -# -# BUG#11039,#13218 Wrong key length in min() -# - -create table t1 (a char(1), b char(1), key(a, b)) engine=innodb; -insert into t1 values ('8', '6'), ('4', '7'); -select min(a) from t1; -select min(b) from t1 where a='8'; -drop table t1; - -# End of 4.1 tests - -# -# range optimizer problem -# - -create table t1 (x bigint unsigned not null primary key) engine=innodb; -insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1); -select * from t1; -select count(*) from t1 where x>0; -select count(*) from t1 where x=0; -select count(*) from t1 where x<0; -select count(*) from t1 where x < -16; -select count(*) from t1 where x = -16; -explain select count(*) from t1 where x > -16; -select count(*) from t1 where x > -16; -select * from t1 where x > -16; -select count(*) from t1 where x = 18446744073709551601; -drop table t1; - - -# Test for testable InnoDB status variables. This test -# uses previous ones(pages_created, rows_deleted, ...). ---replace_result 8192 8191 -SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total'; -SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size'; -SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted'; -SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted'; -SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated'; - -# Test for row locks InnoDB status variables. -SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits'; -SELECT variable_value - @innodb_row_lock_current_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_current_waits'; -SELECT variable_value - @innodb_row_lock_time_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time'; -SELECT variable_value - @innodb_row_lock_time_max_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max'; -SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg'; - -# Test for innodb_sync_spin_loops variable -SET @innodb_sync_spin_loops_orig = @@innodb_sync_spin_loops; -show variables like "innodb_sync_spin_loops"; -set global innodb_sync_spin_loops=1000; -show variables like "innodb_sync_spin_loops"; -set global innodb_sync_spin_loops=0; -show variables like "innodb_sync_spin_loops"; -set global innodb_sync_spin_loops=20; -show variables like "innodb_sync_spin_loops"; -set global innodb_sync_spin_loops=@innodb_sync_spin_loops_orig; - -# Test for innodb_thread_concurrency variable -show variables like "innodb_thread_concurrency"; -set global innodb_thread_concurrency=1001; -show variables like "innodb_thread_concurrency"; -set global innodb_thread_concurrency=0; -show variables like "innodb_thread_concurrency"; -set global innodb_thread_concurrency=16; -show variables like "innodb_thread_concurrency"; - -# Test for innodb_concurrency_tickets variable -show variables like "innodb_concurrency_tickets"; -set global innodb_concurrency_tickets=1000; -show variables like "innodb_concurrency_tickets"; -set global innodb_concurrency_tickets=0; -show variables like "innodb_concurrency_tickets"; -set global innodb_concurrency_tickets=500; -show variables like "innodb_concurrency_tickets"; - -# Test for innodb_thread_sleep_delay variable -show variables like "innodb_thread_sleep_delay"; -set global innodb_thread_sleep_delay=100000; -show variables like "innodb_thread_sleep_delay"; -set global innodb_thread_sleep_delay=0; -show variables like "innodb_thread_sleep_delay"; -set global innodb_thread_sleep_delay=10000; -show variables like "innodb_thread_sleep_delay"; - -# -# Test varchar -# - -let $default=`select @@storage_engine`; -set storage_engine=INNODB; -source include/varchar.inc; - -# -# Some errors/warnings on create -# - -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' -create table t1 (v varchar(65530), key(v)); -drop table t1; -create table t1 (v varchar(65536)); -show create table t1; -drop table t1; -create table t1 (v varchar(65530) character set utf8); -show create table t1; -drop table t1; - -eval set storage_engine=$default; - -# InnoDB specific varchar tests -create table t1 (v varchar(16384)) engine=innodb; -drop table t1; - -# -# BUG#11039 Wrong key length in min() -# - -create table t1 (a char(1), b char(1), key(a, b)) engine=innodb; -insert into t1 values ('8', '6'), ('4', '7'); -select min(a) from t1; -select min(b) from t1 where a='8'; -drop table t1; - -# -# Bug #11080 & #11005 Multi-row REPLACE fails on a duplicate key error -# - -CREATE TABLE t1 ( `a` int(11) NOT NULL auto_increment, `b` int(11) default NULL,PRIMARY KEY (`a`),UNIQUE KEY `b` (`b`)) ENGINE=innodb; -insert into t1 (b) values (1); -replace into t1 (b) values (2), (1), (3); -select * from t1; -truncate table t1; -insert into t1 (b) values (1); -replace into t1 (b) values (2); -replace into t1 (b) values (1); -replace into t1 (b) values (3); -select * from t1; -drop table t1; - -create table t1 (rowid int not null auto_increment, val int not null,primary -key (rowid), unique(val)) engine=innodb; -replace into t1 (val) values ('1'),('2'); -replace into t1 (val) values ('1'),('2'); ---error ER_DUP_ENTRY -insert into t1 (val) values ('1'),('2'); -select * from t1; -drop table t1; - -# -# Test that update does not change internal auto-increment value -# - -create table t1 (a int not null auto_increment primary key, val int) engine=InnoDB; -insert into t1 (val) values (1); -update t1 set a=2 where a=1; -# We should get the following error because InnoDB does not update the counter ---error ER_DUP_ENTRY -insert into t1 (val) values (1); -select * from t1; -drop table t1; -# -# Bug #10465 -# - ---disable_warnings -CREATE TABLE t1 (GRADE DECIMAL(4) NOT NULL, PRIMARY KEY (GRADE)) ENGINE=INNODB; ---enable_warnings -INSERT INTO t1 (GRADE) VALUES (151),(252),(343); -SELECT GRADE FROM t1 WHERE GRADE > 160 AND GRADE < 300; -SELECT GRADE FROM t1 WHERE GRADE= 151; -DROP TABLE t1; - -# -# Bug #12340 multitable delete deletes only one record -# -create table t1 (f1 varchar(10), f2 varchar(10), primary key (f1,f2)) engine=innodb; -create table t2 (f3 varchar(10), f4 varchar(10), key (f4)) engine=innodb; -insert into t2 values ('aa','cc'); -insert into t1 values ('aa','bb'),('aa','cc'); -delete t1 from t1,t2 where f1=f3 and f4='cc'; -select * from t1; -drop table t1,t2; - -# -# Test that the slow TRUNCATE implementation resets autoincrement columns -# (bug #11946) -# - -CREATE TABLE t1 ( -id INTEGER NOT NULL AUTO_INCREMENT, PRIMARY KEY (id) -) ENGINE=InnoDB; - -CREATE TABLE t2 ( -id INTEGER NOT NULL, -FOREIGN KEY (id) REFERENCES t1 (id) -) ENGINE=InnoDB; - -INSERT INTO t1 (id) VALUES (NULL); -SELECT * FROM t1; -TRUNCATE t1; -INSERT INTO t1 (id) VALUES (NULL); -SELECT * FROM t1; - -# continued from above; test that doing a slow TRUNCATE on a table with 0 -# rows resets autoincrement columns -DELETE FROM t1; -TRUNCATE t1; -INSERT INTO t1 (id) VALUES (NULL); -SELECT * FROM t1; -DROP TABLE t2, t1; - -# Test that foreign keys in temporary tables are not accepted (bug #12084) -CREATE TABLE t1 -( - id INT PRIMARY KEY -) ENGINE=InnoDB; - ---error 1005,1005 -CREATE TEMPORARY TABLE t2 -( - id INT NOT NULL PRIMARY KEY, - b INT, - FOREIGN KEY (b) REFERENCES test.t1(id) -) ENGINE=InnoDB; -DROP TABLE t1; - -# -# Test that index column max sizes are honored (bug #13315) -# - -# prefix index -create table t1 (col1 varchar(2000), index (col1(767))) - character set = latin1 engine = innodb; - -# normal indexes -create table t2 (col1 char(255), index (col1)) - character set = latin1 engine = innodb; -create table t3 (col1 binary(255), index (col1)) - character set = latin1 engine = innodb; -create table t4 (col1 varchar(767), index (col1)) - character set = latin1 engine = innodb; -create table t5 (col1 varchar(767) primary key) - character set = latin1 engine = innodb; -create table t6 (col1 varbinary(767) primary key) - character set = latin1 engine = innodb; -create table t7 (col1 text, index(col1(767))) - character set = latin1 engine = innodb; -create table t8 (col1 blob, index(col1(767))) - character set = latin1 engine = innodb; - -# multi-column indexes are allowed to be longer -create table t9 (col1 varchar(512), col2 varchar(512), index(col1, col2)) - character set = latin1 engine = innodb; - -show create table t9; - -drop table t1, t2, t3, t4, t5, t6, t7, t8, t9; - -# these should have their index length trimmed -create table t1 (col1 varchar(768), index(col1)) - character set = latin1 engine = innodb; -create table t2 (col1 varbinary(768), index(col1)) - character set = latin1 engine = innodb; -create table t3 (col1 text, index(col1(768))) - character set = latin1 engine = innodb; -create table t4 (col1 blob, index(col1(768))) - character set = latin1 engine = innodb; - -show create table t1; - -drop table t1, t2, t3, t4; - -# these should be refused ---error 1071 -create table t1 (col1 varchar(768) primary key) - character set = latin1 engine = innodb; ---error 1071 -create table t2 (col1 varbinary(768) primary key) - character set = latin1 engine = innodb; ---error 1071 -create table t3 (col1 text, primary key(col1(768))) - character set = latin1 engine = innodb; ---error 1071 -create table t4 (col1 blob, primary key(col1(768))) - character set = latin1 engine = innodb; - -# -# Test improved foreign key error messages (bug #3443) -# - -CREATE TABLE t1 -( - id INT PRIMARY KEY -) ENGINE=InnoDB; - -CREATE TABLE t2 -( - v INT, - CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id) -) ENGINE=InnoDB; - ---error 1452 -INSERT INTO t2 VALUES(2); - -INSERT INTO t1 VALUES(1); -INSERT INTO t2 VALUES(1); - ---error 1451 -DELETE FROM t1 WHERE id = 1; - ---error 1217 -DROP TABLE t1; - -SET FOREIGN_KEY_CHECKS=0; -DROP TABLE t1; -SET FOREIGN_KEY_CHECKS=1; - ---error 1452 -INSERT INTO t2 VALUES(3); - -DROP TABLE t2; -# -# Test that checksum table uses a consistent read Bug #12669 -# -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; -insert into t1 values (1),(2); -set autocommit=0; -checksum table t1; -connection b; -insert into t1 values(3); -connection a; -# -# Here checksum should not see insert -# -checksum table t1; -connection a; -commit; -checksum table t1; -commit; -drop table t1; -# -# autocommit = 1 -# -connection a; -create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1; -insert into t1 values (1),(2); -set autocommit=1; -checksum table t1; -connection b; -set autocommit=1; -insert into t1 values(3); -connection a; -# -# Here checksum sees insert -# -checksum table t1; -drop table t1; - -connection default; -disconnect a; -disconnect b; - -# tests for bugs #9802 and #13778 - -# test that FKs between invalid types are not accepted - -set foreign_key_checks=0; -create table t2 (a int primary key, b int, foreign key (b) references t1(a)) engine = innodb; -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' --- error 1005 -create table t1(a char(10) primary key, b varchar(20)) engine = innodb; -set foreign_key_checks=1; -drop table t2; - -# test that FKs between different charsets are not accepted in CREATE even -# when f_k_c is 0 - -set foreign_key_checks=0; -create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' --- error 1005 -create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=utf8; -set foreign_key_checks=1; -drop table t1; - -# test that invalid datatype conversions with ALTER are not allowed - -set foreign_key_checks=0; -create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb; -create table t1(a varchar(10) primary key) engine = innodb; --- error 1025,1025 -alter table t1 modify column a int; -set foreign_key_checks=1; -drop table t2,t1; - -# test that charset conversions with ALTER are allowed when f_k_c is 0 - -set foreign_key_checks=0; -create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; -create table t1(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=latin1; -alter table t1 convert to character set utf8; -set foreign_key_checks=1; -drop table t2,t1; - -# test that RENAME does not allow invalid charsets when f_k_c is 0 - -set foreign_key_checks=0; -create table t2 (a varchar(10), foreign key (a) references t1(a)) engine = innodb DEFAULT CHARSET=latin1; -create table t3(a varchar(10) primary key) engine = innodb DEFAULT CHARSET=utf8; -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' --- error 1025 -rename table t3 to t1; -set foreign_key_checks=1; -drop table t2,t3; - -# test that foreign key errors are reported correctly (Bug #15550) - -create table t1(a int primary key) row_format=redundant engine=innodb; -create table t2(a int primary key,constraint foreign key(a)references t1(a)) row_format=compact engine=innodb; -create table t3(a int primary key) row_format=compact engine=innodb; -create table t4(a int primary key,constraint foreign key(a)references t3(a)) row_format=redundant engine=innodb; - -insert into t1 values(1); -insert into t3 values(1); --- error 1452 -insert into t2 values(2); --- error 1452 -insert into t4 values(2); -insert into t2 values(1); -insert into t4 values(1); --- error 1451 -update t1 set a=2; --- error 1452 -update t2 set a=2; --- error 1451 -update t3 set a=2; --- error 1452 -update t4 set a=2; --- error 1451 -truncate t1; --- error 1451 -truncate t3; -truncate t2; -truncate t4; -truncate t1; -truncate t3; - -drop table t4,t3,t2,t1; - - -# -# Test that we can create a large (>1K) key -# -create table t1 (a varchar(255) character set utf8, - b varchar(255) character set utf8, - c varchar(255) character set utf8, - d varchar(255) character set utf8, - key (a,b,c,d)) engine=innodb; -drop table t1; ---error ER_TOO_LONG_KEY -create table t1 (a varchar(255) character set utf8, - b varchar(255) character set utf8, - c varchar(255) character set utf8, - d varchar(255) character set utf8, - e varchar(255) character set utf8, - key (a,b,c,d,e)) engine=innodb; - - -# test the padding of BINARY types and collations (Bug #14189) - -create table t1 (s1 varbinary(2),primary key (s1)) engine=innodb; -create table t2 (s1 binary(2),primary key (s1)) engine=innodb; -create table t3 (s1 varchar(2) binary,primary key (s1)) engine=innodb; -create table t4 (s1 char(2) binary,primary key (s1)) engine=innodb; - -insert into t1 values (0x41),(0x4120),(0x4100); --- error ER_DUP_ENTRY -insert into t2 values (0x41),(0x4120),(0x4100); -insert into t2 values (0x41),(0x4120); --- error ER_DUP_ENTRY -insert into t3 values (0x41),(0x4120),(0x4100); -insert into t3 values (0x41),(0x4100); --- error ER_DUP_ENTRY -insert into t4 values (0x41),(0x4120),(0x4100); -insert into t4 values (0x41),(0x4100); -select hex(s1) from t1; -select hex(s1) from t2; -select hex(s1) from t3; -select hex(s1) from t4; -drop table t1,t2,t3,t4; - -create table t1 (a int primary key,s1 varbinary(3) not null unique) engine=innodb; -create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb; - -insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42); --- error 1452 -insert into t2 values(0x42); -insert into t2 values(0x41); -select hex(s1) from t2; -update t1 set s1=0x123456 where a=2; -select hex(s1) from t2; --- error 1451 -update t1 set s1=0x12 where a=1; --- error 1451 -update t1 set s1=0x12345678 where a=1; --- error 1451 -update t1 set s1=0x123457 where a=1; -update t1 set s1=0x1220 where a=1; -select hex(s1) from t2; -update t1 set s1=0x1200 where a=1; -select hex(s1) from t2; -update t1 set s1=0x4200 where a=1; -select hex(s1) from t2; --- error 1451 -delete from t1 where a=1; -delete from t1 where a=2; -update t2 set s1=0x4120; --- error 1451 -delete from t1; -delete from t1 where a!=3; -select a,hex(s1) from t1; -select hex(s1) from t2; - -drop table t2,t1; - -create table t1 (a int primary key,s1 varchar(2) binary not null unique) engine=innodb; -create table t2 (s1 char(2) binary not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb; - -insert into t1 values(1,0x4100),(2,0x41); -insert into t2 values(0x41); -select hex(s1) from t2; -update t1 set s1=0x1234 where a=1; -select hex(s1) from t2; -update t1 set s1=0x12 where a=2; -select hex(s1) from t2; -delete from t1 where a=1; --- error 1451 -delete from t1 where a=2; -select a,hex(s1) from t1; -select hex(s1) from t2; - -drop table t2,t1; -# Ensure that <tablename>_ibfk_0 is not mistreated as a -# generated foreign key identifier. (Bug #16387) - -CREATE TABLE t1(a INT, PRIMARY KEY(a)) ENGINE=InnoDB; -CREATE TABLE t2(a INT) ENGINE=InnoDB; -ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1(a); -ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_1; -ALTER TABLE t2 ADD CONSTRAINT t2_ibfk_0 FOREIGN KEY (a) REFERENCES t1(a); -ALTER TABLE t2 DROP FOREIGN KEY t2_ibfk_0; -SHOW CREATE TABLE t2; -DROP TABLE t2,t1; - -# -# Test case for bug #16229: MySQL/InnoDB uses full explicit table locks in trigger processing -# - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -insert into t1(a) values (1),(2),(3); -commit; -connection b; -set autocommit = 0; -update t1 set b = 5 where a = 2; -connection a; -delimiter |; -create trigger t1t before insert on t1 for each row begin set NEW.b = NEW.a * 10 + 5, NEW.c = NEW.a / 10; end | -delimiter ;| -set autocommit = 0; -connection a; -insert into t1(a) values (10),(20),(30),(40),(50),(60),(70),(80),(90),(100), -(11),(21),(31),(41),(51),(61),(71),(81),(91),(101), -(12),(22),(32),(42),(52),(62),(72),(82),(92),(102), -(13),(23),(33),(43),(53),(63),(73),(83),(93),(103), -(14),(24),(34),(44),(54),(64),(74),(84),(94),(104); -connection b; -commit; -connection a; -commit; -drop trigger t1t; -drop table t1; -disconnect a; -disconnect b; -# -# Another trigger test -# -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -create table t1(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t2(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t3(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t4(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -create table t5(a int not null, b int, c int, d int, primary key(a)) engine=innodb; -insert into t1(a) values (1),(2),(3); -insert into t2(a) values (1),(2),(3); -insert into t3(a) values (1),(2),(3); -insert into t4(a) values (1),(2),(3); -insert into t3(a) values (5),(7),(8); -insert into t4(a) values (5),(7),(8); -insert into t5(a) values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12); - -delimiter |; -create trigger t1t before insert on t1 for each row begin - INSERT INTO t2 SET a = NEW.a; -end | - -create trigger t2t before insert on t2 for each row begin - DELETE FROM t3 WHERE a = NEW.a; -end | - -create trigger t3t before delete on t3 for each row begin - UPDATE t4 SET b = b + 1 WHERE a = OLD.a; -end | - -create trigger t4t before update on t4 for each row begin - UPDATE t5 SET b = b + 1 where a = NEW.a; -end | -delimiter ;| -commit; -set autocommit = 0; -update t1 set b = b + 5 where a = 1; -update t2 set b = b + 5 where a = 1; -update t3 set b = b + 5 where a = 1; -update t4 set b = b + 5 where a = 1; -insert into t5(a) values(20); -connection b; -set autocommit = 0; -insert into t1(a) values(7); -insert into t2(a) values(8); -delete from t2 where a = 3; -update t4 set b = b + 1 where a = 3; -commit; -drop trigger t1t; -drop trigger t2t; -drop trigger t3t; -drop trigger t4t; -drop table t1, t2, t3, t4, t5; -connection default; -disconnect a; -disconnect b; - -# -# Test that cascading updates leading to duplicate keys give the correct -# error message (bug #9680) -# - -CREATE TABLE t1 ( - field1 varchar(8) NOT NULL DEFAULT '', - field2 varchar(8) NOT NULL DEFAULT '', - PRIMARY KEY (field1, field2) -) ENGINE=InnoDB; - -CREATE TABLE t2 ( - field1 varchar(8) NOT NULL DEFAULT '' PRIMARY KEY, - FOREIGN KEY (field1) REFERENCES t1 (field1) - ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB; - -INSERT INTO t1 VALUES ('old', 'somevalu'); -INSERT INTO t1 VALUES ('other', 'anyvalue'); - -INSERT INTO t2 VALUES ('old'); -INSERT INTO t2 VALUES ('other'); - ---error ER_FOREIGN_DUPLICATE_KEY -UPDATE t1 SET field1 = 'other' WHERE field2 = 'somevalu'; - -DROP TABLE t2; -DROP TABLE t1; - -# -# Bug#18477 - MySQL/InnoDB Ignoring Foreign Keys in ALTER TABLE -# -create table t1 ( - c1 bigint not null, - c2 bigint not null, - primary key (c1), - unique key (c2) -) engine=innodb; -# -create table t2 ( - c1 bigint not null, - primary key (c1) -) engine=innodb; -# -alter table t1 add constraint c2_fk foreign key (c2) - references t2(c1) on delete cascade; -show create table t1; -# -alter table t1 drop foreign key c2_fk; -show create table t1; -# -drop table t1, t2; - -# -# Bug #14360: problem with intervals -# - -create table t1(a date) engine=innodb; -create table t2(a date, key(a)) engine=innodb; -insert into t1 values('2005-10-01'); -insert into t2 values('2005-10-01'); -select * from t1, t2 - where t2.a between t1.a - interval 2 day and t1.a + interval 2 day; -drop table t1, t2; - -create table t1 (id int not null, f_id int not null, f int not null, -primary key(f_id, id)) engine=innodb; -create table t2 (id int not null,s_id int not null,s varchar(200), -primary key(id)) engine=innodb; -INSERT INTO t1 VALUES (8, 1, 3); -INSERT INTO t1 VALUES (1, 2, 1); -INSERT INTO t2 VALUES (1, 0, ''); -INSERT INTO t2 VALUES (8, 1, ''); -commit; -DELETE ml.* FROM t1 AS ml LEFT JOIN t2 AS mm ON (mm.id=ml.id) -WHERE mm.id IS NULL; -select ml.* from t1 as ml left join t2 as mm on (mm.id=ml.id) -where mm.id is null lock in share mode; -drop table t1,t2; - -# -# Test case where X-locks on unused rows should be released in a -# update (because READ COMMITTED isolation level) -# - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -create table t1(a int not null, b int, primary key(a)) engine=innodb; -insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2),(7,3); -commit; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -update t1 set b = 5 where b = 1; -connection b; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -# -# X-lock to record (7,3) should be released in a update -# -select * from t1 where a = 7 and b = 3 for update; -connection a; -commit; -connection b; -commit; -drop table t1; -connection default; -disconnect a; -disconnect b; - -# -# Test case where no locks should be released (because we are not -# using READ COMMITTED isolation level) -# - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -create table t1(a int not null, b int, primary key(a)) engine=innodb; -insert into t1 values(1,1),(2,2),(3,1),(4,2),(5,1),(6,2); -commit; -set autocommit = 0; -select * from t1 lock in share mode; -update t1 set b = 5 where b = 1; -connection b; -set autocommit = 0; -# -# S-lock to records (2,2),(4,2), and (6,2) should not be released in a update -# ---error 1205 -select * from t1 where a = 2 and b = 2 for update; -# -# X-lock to record (1,1),(3,1),(5,1) should not be released in a update -# ---error 1205 -connection a; -commit; -connection b; -commit; -connection default; -disconnect a; -disconnect b; -drop table t1; - -# -# Consistent read should be used in following selects -# -# 1) INSERT INTO ... SELECT -# 2) UPDATE ... = ( SELECT ...) -# 3) CREATE ... SELECT - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connection a; -create table t1(a int not null, b int, primary key(a)) engine=innodb; -insert into t1 values (1,2),(5,3),(4,2); -create table t2(d int not null, e int, primary key(d)) engine=innodb; -insert into t2 values (8,6),(12,1),(3,1); -commit; -set autocommit = 0; -select * from t2 for update; -connection b; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; -insert into t1 select * from t2; -update t1 set b = (select e from t2 where a = d); -create table t3(d int not null, e int, primary key(d)) engine=innodb -select * from t2; -commit; -connection a; -commit; -connection default; -disconnect a; -disconnect b; -drop table t1, t2, t3; - -# -# Consistent read should not be used if -# -# (a) isolation level is serializable OR -# (b) select ... lock in share mode OR -# (c) select ... for update -# -# in following queries: -# -# 1) INSERT INTO ... SELECT -# 2) UPDATE ... = ( SELECT ...) -# 3) CREATE ... SELECT - -connect (a,localhost,root,,); -connect (b,localhost,root,,); -connect (c,localhost,root,,); -connect (d,localhost,root,,); -connect (e,localhost,root,,); -connect (f,localhost,root,,); -connect (g,localhost,root,,); -connect (h,localhost,root,,); -connect (i,localhost,root,,); -connect (j,localhost,root,,); -connection a; -create table t1(a int not null, b int, primary key(a)) engine=innodb; -insert into t1 values (1,2),(5,3),(4,2); -create table t2(a int not null, b int, primary key(a)) engine=innodb; -insert into t2 values (8,6),(12,1),(3,1); -create table t3(d int not null, b int, primary key(d)) engine=innodb; -insert into t3 values (8,6),(12,1),(3,1); -create table t5(a int not null, b int, primary key(a)) engine=innodb; -insert into t5 values (1,2),(5,3),(4,2); -create table t6(d int not null, e int, primary key(d)) engine=innodb; -insert into t6 values (8,6),(12,1),(3,1); -create table t8(a int not null, b int, primary key(a)) engine=innodb; -insert into t8 values (1,2),(5,3),(4,2); -create table t9(d int not null, e int, primary key(d)) engine=innodb; -insert into t9 values (8,6),(12,1),(3,1); -commit; -set autocommit = 0; -select * from t2 for update; -connection b; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; ---send -insert into t1 select * from t2; -connection c; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; ---send -update t3 set b = (select b from t2 where a = d); -connection d; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; ---send -create table t4(a int not null, b int, primary key(a)) engine=innodb select * from t2; -connection e; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ---send -insert into t5 (select * from t2 lock in share mode); -connection f; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ---send -update t6 set e = (select b from t2 where a = d lock in share mode); -connection g; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ---send -create table t7(a int not null, b int, primary key(a)) engine=innodb select * from t2 lock in share mode; -connection h; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ---send -insert into t8 (select * from t2 for update); -connection i; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ---send -update t9 set e = (select b from t2 where a = d for update); -connection j; -SET binlog_format='MIXED'; -set autocommit = 0; -SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; ---send -create table t10(a int not null, b int, primary key(a)) engine=innodb select * from t2 for update; - -connection b; ---error 1205 -reap; - -connection c; ---error 1205 -reap; - -connection d; ---error 1205 -reap; - -connection e; ---error 1205 -reap; - -connection f; ---error 1205 -reap; - -connection g; ---error 1205 -reap; - -connection h; ---error 1205 -reap; - -connection i; ---error 1205 -reap; - -connection j; ---error 1205 -reap; - -connection a; -commit; - -connection default; -disconnect a; -disconnect b; -disconnect c; -disconnect d; -disconnect e; -disconnect f; -disconnect g; -disconnect h; -disconnect i; -disconnect j; -drop table t1, t2, t3, t5, t6, t8, t9; - -# bug 18934, "InnoDB crashes when table uses column names like DB_ROW_ID" ---error 1005 -CREATE TABLE t1 (DB_ROW_ID int) engine=innodb; - -# -# Bug #17152: Wrong result with BINARY comparison on aliased column -# - -CREATE TABLE t1 ( - a BIGINT(20) NOT NULL, - PRIMARY KEY (a) - ) ENGINE=INNODB DEFAULT CHARSET=UTF8; - -CREATE TABLE t2 ( - a BIGINT(20) NOT NULL, - b VARCHAR(128) NOT NULL, - c TEXT NOT NULL, - PRIMARY KEY (a,b), - KEY idx_t2_b_c (b,c(200)), - CONSTRAINT t_fk FOREIGN KEY (a) REFERENCES t1 (a) - ON DELETE CASCADE - ) ENGINE=INNODB DEFAULT CHARSET=UTF8; - -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (1, 'bar', 'vbar'); -INSERT INTO t2 VALUES (1, 'BAR2', 'VBAR'); -INSERT INTO t2 VALUES (1, 'bar_bar', 'bibi'); -INSERT INTO t2 VALUES (1, 'customer_over', '1'); - -SELECT * FROM t2 WHERE b = 'customer_over'; -SELECT * FROM t2 WHERE BINARY b = 'customer_over'; -SELECT DISTINCT p0.a FROM t2 p0 WHERE p0.b = 'customer_over'; -/* Bang: Empty result set, above was expected: */ -SELECT DISTINCT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; -SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over'; - -drop table t2, t1; - -# -# Test optimize on table with open transaction -# - -CREATE TABLE t1 ( a int ) ENGINE=innodb; -BEGIN; -INSERT INTO t1 VALUES (1); -OPTIMIZE TABLE t1; -DROP TABLE t1; - -# -# Bug #24741 (existing cascade clauses disappear when adding foreign keys) -# - -CREATE TABLE t1 (id int PRIMARY KEY, f int NOT NULL, INDEX(f)) ENGINE=InnoDB; - -CREATE TABLE t2 (id int PRIMARY KEY, f INT NOT NULL, - CONSTRAINT t2_t1 FOREIGN KEY (id) REFERENCES t1 (id) - ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB; - -ALTER TABLE t2 ADD FOREIGN KEY (f) REFERENCES t1 (f) ON -DELETE CASCADE ON UPDATE CASCADE; - -SHOW CREATE TABLE t2; -DROP TABLE t2, t1; - -# -# Bug #25927: Prevent ALTER TABLE ... MODIFY ... NOT NULL on columns -# for which there is a foreign key constraint ON ... SET NULL. -# - -CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB; -CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (1); -ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL; -# mysqltest first does replace_regex, then replace_result ---replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/ -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . master-data/ '' ---error 1025 -ALTER TABLE t2 MODIFY a INT NOT NULL; -DELETE FROM t1; -DROP TABLE t2,t1; - -# -# Bug #26835: table corruption after delete+insert -# - -CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY) -ENGINE=InnoDB; -INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4); -DELETE FROM t1; -INSERT INTO t1 VALUES ('DDD'); -SELECT * FROM t1; -DROP TABLE t1; - -# -# Bug #23313 (AUTO_INCREMENT=# not reported back for InnoDB tables) -# Bug #21404 (AUTO_INCREMENT value reset when Adding FKEY (or ALTER?)) -# - -CREATE TABLE t1 (id int PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB -AUTO_INCREMENT=42; - -INSERT INTO t1 VALUES (0),(347),(0); -SELECT * FROM t1; - -SHOW CREATE TABLE t1; - -CREATE TABLE t2 (id int PRIMARY KEY) ENGINE=InnoDB; -INSERT INTO t2 VALUES(42),(347),(348); -ALTER TABLE t1 ADD CONSTRAINT t1_t2 FOREIGN KEY (id) REFERENCES t2(id); -SHOW CREATE TABLE t1; - -DROP TABLE t1,t2; - -# -# Bug #21101 (Prints wrong error message if max row size is too large) -# -set innodb_strict_mode=on; ---error 1118 -CREATE TABLE t1 ( - c01 CHAR(255), c02 CHAR(255), c03 CHAR(255), c04 CHAR(255), - c05 CHAR(255), c06 CHAR(255), c07 CHAR(255), c08 CHAR(255), - c09 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), - c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255), - c17 CHAR(255), c18 CHAR(255), c19 CHAR(255), c20 CHAR(255), - c21 CHAR(255), c22 CHAR(255), c23 CHAR(255), c24 CHAR(255), - c25 CHAR(255), c26 CHAR(255), c27 CHAR(255), c28 CHAR(255), - c29 CHAR(255), c30 CHAR(255), c31 CHAR(255), c32 CHAR(255) - ) ENGINE = InnoDB; - -# -# Bug #31860 InnoDB assumes AUTOINC values can only be positive. -# -DROP TABLE IF EXISTS t1; -CREATE TABLE t1( - id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY - ) ENGINE=InnoDB; -INSERT INTO t1 VALUES(-10); -SELECT * FROM t1; -# -# NOTE: The server really needs to be restarted at this point -# for the test to be useful. -# -# Without the fix InnoDB would trip over an assertion here. -INSERT INTO t1 VALUES(NULL); -# The next value should be 1 and not -9 or a -ve number -SELECT * FROM t1; -DROP TABLE t1; - -# -# Bug #21409 Incorrect result returned when in READ-COMMITTED with -# query_cache ON -# -CONNECT (c1,localhost,root,,); -CONNECT (c2,localhost,root,,); -CONNECTION c1; -SET binlog_format='MIXED'; -SET TX_ISOLATION='read-committed'; -SET AUTOCOMMIT=0; -DROP TABLE IF EXISTS t1, t2; -CREATE TABLE t1 ( a int ) ENGINE=InnoDB; -CREATE TABLE t2 LIKE t1; -SELECT * FROM t2; -CONNECTION c2; -SET binlog_format='MIXED'; -SET TX_ISOLATION='read-committed'; -SET AUTOCOMMIT=0; -INSERT INTO t1 VALUES (1); -COMMIT; -CONNECTION c1; -SELECT * FROM t1 WHERE a=1; -DISCONNECT c1; -DISCONNECT c2; -CONNECT (c1,localhost,root,,); -CONNECT (c2,localhost,root,,); -CONNECTION c1; -SET binlog_format='MIXED'; -SET TX_ISOLATION='read-committed'; -SET AUTOCOMMIT=0; -SELECT * FROM t2; -CONNECTION c2; -SET binlog_format='MIXED'; -SET TX_ISOLATION='read-committed'; -SET AUTOCOMMIT=0; -INSERT INTO t1 VALUES (2); -COMMIT; -CONNECTION c1; -# The result set below should be the same for both selects -SELECT * FROM t1 WHERE a=2; -SELECT * FROM t1 WHERE a=2; -DROP TABLE t1; -DROP TABLE t2; -DISCONNECT c1; -DISCONNECT c2; -CONNECTION default; - -# -# Bug #29157 UPDATE, changed rows incorrect -# -create table t1 (i int, j int) engine=innodb; -insert into t1 (i, j) values (1, 1), (2, 2); ---enable_info -update t1 set j = 2; ---disable_info -drop table t1; - -# -# Bug #32440 InnoDB free space info does not appear in SHOW TABLE STATUS or -# I_S -# -create table t1 (id int) comment='this is a comment' engine=innodb; -select table_comment, data_free > 0 as data_free_is_set - from information_schema.tables - where table_schema='test' and table_name = 't1'; -drop table t1; - -# -# Bug 34920 test -# -CONNECTION default; -CREATE TABLE t1 ( - c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, - c2 VARCHAR(128) NOT NULL, - PRIMARY KEY(c1) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=100; - -CREATE TABLE t2 ( - c1 INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, - c2 INT(10) UNSIGNED DEFAULT NULL, - PRIMARY KEY(c1) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=200; - -SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2'; -ALTER TABLE t2 ADD CONSTRAINT t1_t2_1 FOREIGN KEY(c1) REFERENCES t1(c1); -SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't2'; -DROP TABLE t2; -DROP TABLE t1; -# End 34920 test -# -# Bug #29507 TRUNCATE shows to many rows effected -# -CONNECTION default; -CREATE TABLE t1 (c1 int default NULL, - c2 int default NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - ---enable_info -TRUNCATE TABLE t1; - -INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5); -TRUNCATE TABLE t1; - ---disable_info -DROP TABLE t1; -# -# Bug#35537 Innodb doesn't increment handler_update and handler_delete. -# --- disable_query_log --- disable_result_log - -CONNECT (c1,localhost,root,,); - -DROP TABLE IF EXISTS bug35537; -CREATE TABLE bug35537 ( - c1 int -) ENGINE=InnoDB; - -INSERT INTO bug35537 VALUES (1); - --- enable_result_log - -SHOW SESSION STATUS LIKE 'Handler_update%'; -SHOW SESSION STATUS LIKE 'Handler_delete%'; - -UPDATE bug35537 SET c1 = 2 WHERE c1 = 1; -DELETE FROM bug35537 WHERE c1 = 2; - -SHOW SESSION STATUS LIKE 'Handler_update%'; -SHOW SESSION STATUS LIKE 'Handler_delete%'; - -DROP TABLE bug35537; - -DISCONNECT c1; -CONNECTION default; - -SET GLOBAL innodb_thread_concurrency = @innodb_thread_concurrency_orig; - --- enable_query_log - -####################################################################### -# # -# Please, DO NOT TOUCH this file as well as the innodb.result file. # -# These files are to be modified ONLY BY INNOBASE guys. # -# # -# Use innodb_mysql.[test|result] files instead. # -# # -# If nevertheless you need to make some changes here, please, forward # -# your commit message # -# To: innodb_dev_ww@oracle.com # -# Cc: dev-innodb@mysql.com # -# (otherwise your changes may be erased). # -# # -####################################################################### diff --git a/storage/innodb_plugin/mysql-test/innodb_bug21704.result b/storage/innodb_plugin/mysql-test/innodb_bug21704.result deleted file mode 100644 index b8e0b15d50d..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug21704.result +++ /dev/null @@ -1,55 +0,0 @@ -# -# Bug#21704: Renaming column does not update FK definition. -# - -# Test that it's not possible to rename columns participating in a -# foreign key (either in the referencing or referenced table). - -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; -DROP TABLE IF EXISTS t3; -CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT ENGINE=INNODB; -CREATE TABLE t2 (a INT PRIMARY KEY, b INT, -CONSTRAINT fk1 FOREIGN KEY (a) REFERENCES t1(a)) -ROW_FORMAT=COMPACT ENGINE=INNODB; -CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY(b), C INT, -CONSTRAINT fk2 FOREIGN KEY (b) REFERENCES t3 (a)) -ROW_FORMAT=COMPACT ENGINE=INNODB; -INSERT INTO t1 VALUES (1,1),(2,2),(3,3); -INSERT INTO t2 VALUES (1,1),(2,2),(3,3); -INSERT INTO t3 VALUES (1,1,1),(2,2,2),(3,3,3); - -# Test renaming the column in the referenced table. - -ALTER TABLE t1 CHANGE a c INT; -ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150) -# Ensure that online column rename works. -ALTER TABLE t1 CHANGE b c INT; -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 0 - -# Test renaming the column in the referencing table - -ALTER TABLE t2 CHANGE a c INT; -ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150) -# Ensure that online column rename works. -ALTER TABLE t2 CHANGE b c INT; -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 0 - -# Test with self-referential constraints - -ALTER TABLE t3 CHANGE a d INT; -ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150) -ALTER TABLE t3 CHANGE b d INT; -ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150) -# Ensure that online column rename works. -ALTER TABLE t3 CHANGE c d INT; -affected rows: 0 -info: Records: 0 Duplicates: 0 Warnings: 0 - -# Cleanup. - -DROP TABLE t3; -DROP TABLE t2; -DROP TABLE t1; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug21704.test b/storage/innodb_plugin/mysql-test/innodb_bug21704.test deleted file mode 100644 index c649b61034c..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug21704.test +++ /dev/null @@ -1,96 +0,0 @@ --- source include/have_innodb.inc - ---echo # ---echo # Bug#21704: Renaming column does not update FK definition. ---echo # - ---echo ---echo # Test that it's not possible to rename columns participating in a ---echo # foreign key (either in the referencing or referenced table). ---echo - ---disable_warnings -DROP TABLE IF EXISTS t1; -DROP TABLE IF EXISTS t2; -DROP TABLE IF EXISTS t3; ---enable_warnings - -CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ROW_FORMAT=COMPACT ENGINE=INNODB; - -CREATE TABLE t2 (a INT PRIMARY KEY, b INT, - CONSTRAINT fk1 FOREIGN KEY (a) REFERENCES t1(a)) -ROW_FORMAT=COMPACT ENGINE=INNODB; - -CREATE TABLE t3 (a INT PRIMARY KEY, b INT, KEY(b), C INT, - CONSTRAINT fk2 FOREIGN KEY (b) REFERENCES t3 (a)) -ROW_FORMAT=COMPACT ENGINE=INNODB; - -INSERT INTO t1 VALUES (1,1),(2,2),(3,3); -INSERT INTO t2 VALUES (1,1),(2,2),(3,3); -INSERT INTO t3 VALUES (1,1,1),(2,2,2),(3,3,3); - ---echo ---echo # Test renaming the column in the referenced table. ---echo - -# mysqltest first does replace_regex, then replace_result ---replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/ -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' ---error ER_ERROR_ON_RENAME -ALTER TABLE t1 CHANGE a c INT; - ---echo # Ensure that online column rename works. - ---enable_info -ALTER TABLE t1 CHANGE b c INT; ---disable_info - ---echo ---echo # Test renaming the column in the referencing table ---echo - -# mysqltest first does replace_regex, then replace_result ---replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/ -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' ---error ER_ERROR_ON_RENAME -ALTER TABLE t2 CHANGE a c INT; - ---echo # Ensure that online column rename works. - ---enable_info -ALTER TABLE t2 CHANGE b c INT; ---disable_info - ---echo ---echo # Test with self-referential constraints ---echo - -# mysqltest first does replace_regex, then replace_result ---replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/ -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' ---error ER_ERROR_ON_RENAME -ALTER TABLE t3 CHANGE a d INT; - -# mysqltest first does replace_regex, then replace_result ---replace_regex /'[^']*test\/#sql-[0-9a-f_]*'/'#sql-temporary'/ -# Embedded server doesn't chdir to data directory ---replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' ---error ER_ERROR_ON_RENAME -ALTER TABLE t3 CHANGE b d INT; - ---echo # Ensure that online column rename works. - ---enable_info -ALTER TABLE t3 CHANGE c d INT; ---disable_info - ---echo ---echo # Cleanup. ---echo - -DROP TABLE t3; -DROP TABLE t2; -DROP TABLE t1; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug34053.result b/storage/innodb_plugin/mysql-test/innodb_bug34053.result deleted file mode 100644 index 195775f74c8..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug34053.result +++ /dev/null @@ -1 +0,0 @@ -SET storage_engine=InnoDB; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug34053.test b/storage/innodb_plugin/mysql-test/innodb_bug34053.test deleted file mode 100644 index b935e45c06d..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug34053.test +++ /dev/null @@ -1,50 +0,0 @@ -# -# Make sure http://bugs.mysql.com/34053 remains fixed. -# - --- source include/not_embedded.inc --- source include/have_innodb.inc - -SET storage_engine=InnoDB; - -# we do not really care about what gets printed, we are only -# interested in getting success or failure according to our -# expectations --- disable_query_log --- disable_result_log - -GRANT USAGE ON *.* TO 'shane'@'localhost' IDENTIFIED BY '12345'; -FLUSH PRIVILEGES; - --- connect (con1,localhost,shane,12345,) - --- connection con1 --- error ER_SPECIFIC_ACCESS_DENIED_ERROR -CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB; --- error ER_SPECIFIC_ACCESS_DENIED_ERROR -CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB; -CREATE TABLE innodb_monitorx (a INT) ENGINE=INNODB; -DROP TABLE innodb_monitorx; -CREATE TABLE innodb_monito (a INT) ENGINE=INNODB; -DROP TABLE innodb_monito; -CREATE TABLE xinnodb_monitor (a INT) ENGINE=INNODB; -DROP TABLE xinnodb_monitor; -CREATE TABLE nnodb_monitor (a INT) ENGINE=INNODB; -DROP TABLE nnodb_monitor; - --- connection default -CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB; -CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB; - --- connection con1 --- error ER_SPECIFIC_ACCESS_DENIED_ERROR -DROP TABLE innodb_monitor; --- error ER_SPECIFIC_ACCESS_DENIED_ERROR -DROP TABLE innodb_mem_validate; - --- connection default -DROP TABLE innodb_monitor; -DROP TABLE innodb_mem_validate; -DROP USER 'shane'@'localhost'; - --- disconnect con1 diff --git a/storage/innodb_plugin/mysql-test/innodb_bug34300.result b/storage/innodb_plugin/mysql-test/innodb_bug34300.result deleted file mode 100644 index ae9fee81ad7..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug34300.result +++ /dev/null @@ -1,4 +0,0 @@ -f4 f8 -xxx zzz -f4 f8 -xxx zzz diff --git a/storage/innodb_plugin/mysql-test/innodb_bug34300.test b/storage/innodb_plugin/mysql-test/innodb_bug34300.test deleted file mode 100644 index 68c385fd72a..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug34300.test +++ /dev/null @@ -1,34 +0,0 @@ -# -# Bug#34300 Tinyblob & tinytext fields currupted after export/import and alter in 5.1 -# http://bugs.mysql.com/34300 -# - --- source include/have_innodb.inc - --- disable_query_log --- disable_result_log - -# set packet size and reconnect -let $max_packet=`select @@global.max_allowed_packet`; -SET @@global.max_allowed_packet=16777216; ---connect (newconn, localhost, root,,) - -DROP TABLE IF EXISTS bug34300; -CREATE TABLE bug34300 ( - f4 TINYTEXT, - f6 MEDIUMTEXT, - f8 TINYBLOB -) ENGINE=InnoDB; - -INSERT INTO bug34300 VALUES ('xxx', repeat('a', 8459264), 'zzz'); - --- enable_result_log - -SELECT f4, f8 FROM bug34300; - -ALTER TABLE bug34300 ADD COLUMN (f10 INT); - -SELECT f4, f8 FROM bug34300; - -DROP TABLE bug34300; -EVAL SET @@global.max_allowed_packet=$max_packet; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug35220.result b/storage/innodb_plugin/mysql-test/innodb_bug35220.result deleted file mode 100644 index 195775f74c8..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug35220.result +++ /dev/null @@ -1 +0,0 @@ -SET storage_engine=InnoDB; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug35220.test b/storage/innodb_plugin/mysql-test/innodb_bug35220.test deleted file mode 100644 index 26f7d6b1ddd..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug35220.test +++ /dev/null @@ -1,16 +0,0 @@ -# -# Bug#35220 ALTER TABLE too picky on reserved word "foreign" -# http://bugs.mysql.com/35220 -# - --- source include/have_innodb.inc - -SET storage_engine=InnoDB; - -# we care only that the following SQL commands do not produce errors --- disable_query_log --- disable_result_log - -CREATE TABLE bug35220 (foreign_col INT, dummy_cant_delete_all_columns INT); -ALTER TABLE bug35220 DROP foreign_col; -DROP TABLE bug35220; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug36169.result b/storage/innodb_plugin/mysql-test/innodb_bug36169.result deleted file mode 100644 index aa80e4d7aa4..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug36169.result +++ /dev/null @@ -1,2 +0,0 @@ -SET GLOBAL innodb_file_format='Barracuda'; -SET GLOBAL innodb_file_per_table=ON; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug36169.test b/storage/innodb_plugin/mysql-test/innodb_bug36169.test deleted file mode 100644 index 5bf55193b5c..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug36169.test +++ /dev/null @@ -1,1159 +0,0 @@ -# -# Bug#36169 create innodb compressed table with too large row size crashed -# http://bugs.mysql.com/36169 -# - --- source include/have_innodb.inc - -let $file_format=`select @@innodb_file_format`; -let $file_per_table=`select @@innodb_file_per_table`; -SET GLOBAL innodb_file_format='Barracuda'; -SET GLOBAL innodb_file_per_table=ON; - -# -# The following is copied from http://bugs.mysql.com/36169 -# (http://bugs.mysql.com/file.php?id=9121) -# Probably it can be simplified but that is not obvious. -# - -# we care only that the following SQL commands do produce errors -# as expected and do not crash the server --- disable_query_log --- disable_result_log - -# Generating 10 tables -# Creating a table with 94 columns and 24 indexes -DROP TABLE IF EXISTS `table0`; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE IF NOT EXISTS `table0` -(`col0` BOOL, -`col1` BOOL, -`col2` TINYINT, -`col3` DATE, -`col4` TIME, -`col5` SET ('test1','test2','test3'), -`col6` TIME, -`col7` TEXT, -`col8` DECIMAL, -`col9` SET ('test1','test2','test3'), -`col10` FLOAT, -`col11` DOUBLE PRECISION, -`col12` ENUM ('test1','test2','test3'), -`col13` TINYBLOB, -`col14` YEAR, -`col15` SET ('test1','test2','test3'), -`col16` NUMERIC, -`col17` NUMERIC, -`col18` BLOB, -`col19` DATETIME, -`col20` DOUBLE PRECISION, -`col21` DECIMAL, -`col22` DATETIME, -`col23` NUMERIC, -`col24` NUMERIC, -`col25` LONGTEXT, -`col26` TINYBLOB, -`col27` TIME, -`col28` TINYBLOB, -`col29` ENUM ('test1','test2','test3'), -`col30` SMALLINT, -`col31` REAL, -`col32` FLOAT, -`col33` CHAR (175), -`col34` TINYTEXT, -`col35` TINYTEXT, -`col36` TINYBLOB, -`col37` TINYBLOB, -`col38` TINYTEXT, -`col39` MEDIUMBLOB, -`col40` TIMESTAMP, -`col41` DOUBLE, -`col42` SMALLINT, -`col43` LONGBLOB, -`col44` VARCHAR (80), -`col45` MEDIUMTEXT, -`col46` NUMERIC, -`col47` BIGINT, -`col48` DATE, -`col49` TINYBLOB, -`col50` DATE, -`col51` BOOL, -`col52` MEDIUMINT, -`col53` FLOAT, -`col54` TINYBLOB, -`col55` LONGTEXT, -`col56` SMALLINT, -`col57` ENUM ('test1','test2','test3'), -`col58` DATETIME, -`col59` MEDIUMTEXT, -`col60` VARCHAR (232), -`col61` NUMERIC, -`col62` YEAR, -`col63` SMALLINT, -`col64` TIMESTAMP, -`col65` BLOB, -`col66` LONGBLOB, -`col67` INT, -`col68` LONGTEXT, -`col69` ENUM ('test1','test2','test3'), -`col70` INT, -`col71` TIME, -`col72` TIMESTAMP, -`col73` TIMESTAMP, -`col74` VARCHAR (170), -`col75` SET ('test1','test2','test3'), -`col76` TINYBLOB, -`col77` BIGINT, -`col78` NUMERIC, -`col79` DATETIME, -`col80` YEAR, -`col81` NUMERIC, -`col82` LONGBLOB, -`col83` TEXT, -`col84` CHAR (83), -`col85` DECIMAL, -`col86` FLOAT, -`col87` INT, -`col88` VARCHAR (145), -`col89` DATE, -`col90` DECIMAL, -`col91` DECIMAL, -`col92` MEDIUMBLOB, -`col93` TIME, -KEY `idx0` (`col69`,`col90`,`col8`), -KEY `idx1` (`col60`), -KEY `idx2` (`col60`,`col70`,`col74`), -KEY `idx3` (`col22`,`col32`,`col72`,`col30`), -KEY `idx4` (`col29`), -KEY `idx5` (`col19`,`col45`(143)), -KEY `idx6` (`col46`,`col48`,`col5`,`col39`(118)), -KEY `idx7` (`col48`,`col61`), -KEY `idx8` (`col93`), -KEY `idx9` (`col31`), -KEY `idx10` (`col30`,`col21`), -KEY `idx11` (`col67`), -KEY `idx12` (`col44`,`col6`,`col8`,`col38`(226)), -KEY `idx13` (`col71`,`col41`,`col15`,`col49`(88)), -KEY `idx14` (`col78`), -KEY `idx15` (`col63`,`col67`,`col64`), -KEY `idx16` (`col17`,`col86`), -KEY `idx17` (`col77`,`col56`,`col10`,`col55`(24)), -KEY `idx18` (`col62`), -KEY `idx19` (`col31`,`col57`,`col56`,`col53`), -KEY `idx20` (`col46`), -KEY `idx21` (`col83`(54)), -KEY `idx22` (`col51`,`col7`(120)), -KEY `idx23` (`col7`(163),`col31`,`col71`,`col14`) -)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -# Creating a table with 10 columns and 32 indexes -DROP TABLE IF EXISTS `table1`; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE IF NOT EXISTS `table1` -(`col0` CHAR (113), -`col1` FLOAT, -`col2` BIGINT, -`col3` DECIMAL, -`col4` BLOB, -`col5` LONGTEXT, -`col6` SET ('test1','test2','test3'), -`col7` BIGINT, -`col8` BIGINT, -`col9` TINYBLOB, -KEY `idx0` (`col5`(101),`col7`,`col8`), -KEY `idx1` (`col8`), -KEY `idx2` (`col4`(177),`col9`(126),`col6`,`col3`), -KEY `idx3` (`col5`(160)), -KEY `idx4` (`col9`(242)), -KEY `idx5` (`col4`(139),`col2`,`col3`), -KEY `idx6` (`col7`), -KEY `idx7` (`col6`,`col2`,`col0`,`col3`), -KEY `idx8` (`col9`(66)), -KEY `idx9` (`col5`(253)), -KEY `idx10` (`col1`,`col7`,`col2`), -KEY `idx11` (`col9`(242),`col0`,`col8`,`col5`(163)), -KEY `idx12` (`col8`), -KEY `idx13` (`col0`,`col9`(37)), -KEY `idx14` (`col0`), -KEY `idx15` (`col5`(111)), -KEY `idx16` (`col8`,`col0`,`col5`(13)), -KEY `idx17` (`col4`(139)), -KEY `idx18` (`col5`(189),`col2`,`col3`,`col9`(136)), -KEY `idx19` (`col0`,`col3`,`col1`,`col8`), -KEY `idx20` (`col8`), -KEY `idx21` (`col0`,`col7`,`col9`(227),`col3`), -KEY `idx22` (`col0`), -KEY `idx23` (`col2`), -KEY `idx24` (`col3`), -KEY `idx25` (`col2`,`col3`), -KEY `idx26` (`col0`), -KEY `idx27` (`col5`(254)), -KEY `idx28` (`col3`), -KEY `idx29` (`col3`), -KEY `idx30` (`col7`,`col3`,`col0`,`col4`(220)), -KEY `idx31` (`col4`(1),`col0`) -)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -# Creating a table with 141 columns and 18 indexes -DROP TABLE IF EXISTS `table2`; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE IF NOT EXISTS `table2` -(`col0` BOOL, -`col1` MEDIUMINT, -`col2` VARCHAR (209), -`col3` MEDIUMBLOB, -`col4` CHAR (13), -`col5` DOUBLE, -`col6` TINYTEXT, -`col7` REAL, -`col8` SMALLINT, -`col9` BLOB, -`col10` TINYINT, -`col11` DECIMAL, -`col12` BLOB, -`col13` DECIMAL, -`col14` LONGBLOB, -`col15` SMALLINT, -`col16` LONGBLOB, -`col17` TINYTEXT, -`col18` FLOAT, -`col19` CHAR (78), -`col20` MEDIUMTEXT, -`col21` SET ('test1','test2','test3'), -`col22` MEDIUMINT, -`col23` INT, -`col24` MEDIUMBLOB, -`col25` ENUM ('test1','test2','test3'), -`col26` TINYBLOB, -`col27` VARCHAR (116), -`col28` TIMESTAMP, -`col29` BLOB, -`col30` SMALLINT, -`col31` DOUBLE PRECISION, -`col32` DECIMAL, -`col33` DECIMAL, -`col34` TEXT, -`col35` MEDIUMINT, -`col36` MEDIUMINT, -`col37` BIGINT, -`col38` VARCHAR (253), -`col39` TINYBLOB, -`col40` MEDIUMBLOB, -`col41` BIGINT, -`col42` DOUBLE, -`col43` TEXT, -`col44` BLOB, -`col45` TIME, -`col46` MEDIUMINT, -`col47` DOUBLE PRECISION, -`col48` SET ('test1','test2','test3'), -`col49` DOUBLE PRECISION, -`col50` VARCHAR (97), -`col51` TEXT, -`col52` NUMERIC, -`col53` ENUM ('test1','test2','test3'), -`col54` MEDIUMTEXT, -`col55` MEDIUMINT, -`col56` DATETIME, -`col57` DATETIME, -`col58` MEDIUMTEXT, -`col59` CHAR (244), -`col60` LONGBLOB, -`col61` MEDIUMBLOB, -`col62` DOUBLE, -`col63` SMALLINT, -`col64` BOOL, -`col65` SMALLINT, -`col66` VARCHAR (212), -`col67` TIME, -`col68` REAL, -`col69` BOOL, -`col70` BIGINT, -`col71` DATE, -`col72` TINYINT, -`col73` ENUM ('test1','test2','test3'), -`col74` DATE, -`col75` TIME, -`col76` DATETIME, -`col77` BOOL, -`col78` TINYTEXT, -`col79` MEDIUMINT, -`col80` NUMERIC, -`col81` LONGTEXT, -`col82` SET ('test1','test2','test3'), -`col83` DOUBLE PRECISION, -`col84` NUMERIC, -`col85` VARCHAR (184), -`col86` DOUBLE PRECISION, -`col87` MEDIUMTEXT, -`col88` MEDIUMBLOB, -`col89` BOOL, -`col90` SMALLINT, -`col91` TINYINT, -`col92` ENUM ('test1','test2','test3'), -`col93` BOOL, -`col94` TIMESTAMP, -`col95` BOOL, -`col96` MEDIUMTEXT, -`col97` DECIMAL, -`col98` BOOL, -`col99` DECIMAL, -`col100` MEDIUMINT, -`col101` DOUBLE PRECISION, -`col102` TINYINT, -`col103` BOOL, -`col104` MEDIUMINT, -`col105` DECIMAL, -`col106` NUMERIC, -`col107` TIMESTAMP, -`col108` MEDIUMBLOB, -`col109` TINYBLOB, -`col110` SET ('test1','test2','test3'), -`col111` YEAR, -`col112` TIMESTAMP, -`col113` CHAR (201), -`col114` BOOL, -`col115` TINYINT, -`col116` DOUBLE, -`col117` TINYINT, -`col118` TIMESTAMP, -`col119` SET ('test1','test2','test3'), -`col120` SMALLINT, -`col121` TINYBLOB, -`col122` TIMESTAMP, -`col123` BLOB, -`col124` DATE, -`col125` SMALLINT, -`col126` ENUM ('test1','test2','test3'), -`col127` MEDIUMBLOB, -`col128` DOUBLE PRECISION, -`col129` REAL, -`col130` VARCHAR (159), -`col131` MEDIUMBLOB, -`col132` BIGINT, -`col133` INT, -`col134` SET ('test1','test2','test3'), -`col135` CHAR (198), -`col136` SET ('test1','test2','test3'), -`col137` MEDIUMTEXT, -`col138` SMALLINT, -`col139` BLOB, -`col140` LONGBLOB, -KEY `idx0` (`col14`(139),`col24`(208),`col38`,`col35`), -KEY `idx1` (`col48`,`col118`,`col29`(131),`col100`), -KEY `idx2` (`col86`,`col67`,`col43`(175)), -KEY `idx3` (`col19`), -KEY `idx4` (`col40`(220),`col67`), -KEY `idx5` (`col99`,`col56`), -KEY `idx6` (`col68`,`col28`,`col137`(157)), -KEY `idx7` (`col51`(160),`col99`,`col45`,`col39`(9)), -KEY `idx8` (`col15`,`col52`,`col90`,`col94`), -KEY `idx9` (`col24`(3),`col139`(248),`col108`(118),`col41`), -KEY `idx10` (`col36`,`col92`,`col114`), -KEY `idx11` (`col115`,`col9`(116)), -KEY `idx12` (`col130`,`col93`,`col134`), -KEY `idx13` (`col123`(65)), -KEY `idx14` (`col44`(90),`col86`,`col119`), -KEY `idx15` (`col69`), -KEY `idx16` (`col132`,`col81`(118),`col18`), -KEY `idx17` (`col24`(250),`col7`,`col92`,`col45`) -)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -# Creating a table with 199 columns and 1 indexes -DROP TABLE IF EXISTS `table3`; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE IF NOT EXISTS `table3` -(`col0` SMALLINT, -`col1` SET ('test1','test2','test3'), -`col2` TINYTEXT, -`col3` DOUBLE, -`col4` NUMERIC, -`col5` DATE, -`col6` BIGINT, -`col7` DOUBLE, -`col8` TEXT, -`col9` INT, -`col10` REAL, -`col11` TINYINT, -`col12` NUMERIC, -`col13` NUMERIC, -`col14` TIME, -`col15` DOUBLE, -`col16` REAL, -`col17` MEDIUMBLOB, -`col18` YEAR, -`col19` TINYTEXT, -`col20` YEAR, -`col21` CHAR (250), -`col22` TINYINT, -`col23` TINYINT, -`col24` SMALLINT, -`col25` DATETIME, -`col26` MEDIUMINT, -`col27` LONGBLOB, -`col28` VARCHAR (106), -`col29` FLOAT, -`col30` MEDIUMTEXT, -`col31` TINYBLOB, -`col32` BIGINT, -`col33` YEAR, -`col34` REAL, -`col35` MEDIUMBLOB, -`col36` LONGTEXT, -`col37` LONGBLOB, -`col38` BIGINT, -`col39` FLOAT, -`col40` TIME, -`col41` DATETIME, -`col42` BOOL, -`col43` BIGINT, -`col44` SMALLINT, -`col45` TIME, -`col46` DOUBLE PRECISION, -`col47` TIME, -`col48` TINYTEXT, -`col49` DOUBLE PRECISION, -`col50` BIGINT, -`col51` NUMERIC, -`col52` TINYBLOB, -`col53` DATE, -`col54` DECIMAL, -`col55` SMALLINT, -`col56` TINYTEXT, -`col57` ENUM ('test1','test2','test3'), -`col58` YEAR, -`col59` TIME, -`col60` TINYINT, -`col61` DECIMAL, -`col62` DOUBLE, -`col63` DATE, -`col64` LONGTEXT, -`col65` DOUBLE, -`col66` VARCHAR (88), -`col67` MEDIUMTEXT, -`col68` DATE, -`col69` MEDIUMINT, -`col70` DECIMAL, -`col71` MEDIUMTEXT, -`col72` LONGTEXT, -`col73` REAL, -`col74` DOUBLE, -`col75` TIME, -`col76` DATE, -`col77` DECIMAL, -`col78` MEDIUMBLOB, -`col79` NUMERIC, -`col80` BIGINT, -`col81` YEAR, -`col82` SMALLINT, -`col83` MEDIUMINT, -`col84` TINYINT, -`col85` MEDIUMBLOB, -`col86` TIME, -`col87` MEDIUMBLOB, -`col88` LONGTEXT, -`col89` BOOL, -`col90` BLOB, -`col91` LONGBLOB, -`col92` YEAR, -`col93` BLOB, -`col94` INT, -`col95` TINYTEXT, -`col96` TINYINT, -`col97` DECIMAL, -`col98` ENUM ('test1','test2','test3'), -`col99` MEDIUMINT, -`col100` TINYINT, -`col101` MEDIUMBLOB, -`col102` TINYINT, -`col103` SET ('test1','test2','test3'), -`col104` TIMESTAMP, -`col105` TEXT, -`col106` DATETIME, -`col107` MEDIUMTEXT, -`col108` CHAR (220), -`col109` TIME, -`col110` VARCHAR (131), -`col111` DECIMAL, -`col112` FLOAT, -`col113` SMALLINT, -`col114` BIGINT, -`col115` LONGBLOB, -`col116` SET ('test1','test2','test3'), -`col117` ENUM ('test1','test2','test3'), -`col118` BLOB, -`col119` MEDIUMTEXT, -`col120` SET ('test1','test2','test3'), -`col121` DATETIME, -`col122` FLOAT, -`col123` VARCHAR (242), -`col124` YEAR, -`col125` MEDIUMBLOB, -`col126` TIME, -`col127` BOOL, -`col128` TINYBLOB, -`col129` DOUBLE, -`col130` TINYINT, -`col131` BIGINT, -`col132` SMALLINT, -`col133` INT, -`col134` DOUBLE PRECISION, -`col135` MEDIUMBLOB, -`col136` SET ('test1','test2','test3'), -`col137` TINYTEXT, -`col138` DOUBLE PRECISION, -`col139` NUMERIC, -`col140` BLOB, -`col141` SET ('test1','test2','test3'), -`col142` INT, -`col143` VARCHAR (26), -`col144` BLOB, -`col145` REAL, -`col146` SET ('test1','test2','test3'), -`col147` LONGBLOB, -`col148` TEXT, -`col149` BLOB, -`col150` CHAR (189), -`col151` LONGTEXT, -`col152` INT, -`col153` FLOAT, -`col154` LONGTEXT, -`col155` DATE, -`col156` LONGBLOB, -`col157` TINYBLOB, -`col158` REAL, -`col159` DATE, -`col160` TIME, -`col161` YEAR, -`col162` DOUBLE, -`col163` VARCHAR (90), -`col164` FLOAT, -`col165` NUMERIC, -`col166` ENUM ('test1','test2','test3'), -`col167` DOUBLE PRECISION, -`col168` DOUBLE PRECISION, -`col169` TINYBLOB, -`col170` TIME, -`col171` SMALLINT, -`col172` TINYTEXT, -`col173` SMALLINT, -`col174` DOUBLE, -`col175` VARCHAR (14), -`col176` VARCHAR (90), -`col177` REAL, -`col178` MEDIUMINT, -`col179` TINYBLOB, -`col180` FLOAT, -`col181` TIMESTAMP, -`col182` REAL, -`col183` DOUBLE PRECISION, -`col184` BIGINT, -`col185` INT, -`col186` MEDIUMTEXT, -`col187` TIME, -`col188` FLOAT, -`col189` TIME, -`col190` INT, -`col191` FLOAT, -`col192` MEDIUMINT, -`col193` TINYINT, -`col194` MEDIUMTEXT, -`col195` DATE, -`col196` TIME, -`col197` YEAR, -`col198` CHAR (206), -KEY `idx0` (`col39`,`col23`) -)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -# Creating a table with 133 columns and 16 indexes -DROP TABLE IF EXISTS `table4`; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE IF NOT EXISTS `table4` -(`col0` VARCHAR (60), -`col1` NUMERIC, -`col2` LONGTEXT, -`col3` MEDIUMTEXT, -`col4` LONGTEXT, -`col5` LONGBLOB, -`col6` LONGBLOB, -`col7` DATETIME, -`col8` TINYTEXT, -`col9` BLOB, -`col10` BOOL, -`col11` BIGINT, -`col12` TEXT, -`col13` VARCHAR (213), -`col14` TINYBLOB, -`col15` BOOL, -`col16` MEDIUMTEXT, -`col17` DOUBLE, -`col18` TEXT, -`col19` BLOB, -`col20` SET ('test1','test2','test3'), -`col21` TINYINT, -`col22` DATETIME, -`col23` TINYINT, -`col24` ENUM ('test1','test2','test3'), -`col25` REAL, -`col26` BOOL, -`col27` FLOAT, -`col28` LONGBLOB, -`col29` DATETIME, -`col30` FLOAT, -`col31` SET ('test1','test2','test3'), -`col32` LONGBLOB, -`col33` NUMERIC, -`col34` YEAR, -`col35` VARCHAR (146), -`col36` BIGINT, -`col37` DATETIME, -`col38` DATE, -`col39` SET ('test1','test2','test3'), -`col40` CHAR (112), -`col41` FLOAT, -`col42` YEAR, -`col43` TIME, -`col44` DOUBLE, -`col45` NUMERIC, -`col46` FLOAT, -`col47` DECIMAL, -`col48` BIGINT, -`col49` DECIMAL, -`col50` YEAR, -`col51` MEDIUMTEXT, -`col52` LONGBLOB, -`col53` SET ('test1','test2','test3'), -`col54` BLOB, -`col55` FLOAT, -`col56` REAL, -`col57` REAL, -`col58` TEXT, -`col59` MEDIUMBLOB, -`col60` INT, -`col61` INT, -`col62` DATE, -`col63` TEXT, -`col64` DATE, -`col65` ENUM ('test1','test2','test3'), -`col66` DOUBLE PRECISION, -`col67` TINYTEXT, -`col68` TINYBLOB, -`col69` FLOAT, -`col70` BLOB, -`col71` DATETIME, -`col72` DOUBLE, -`col73` LONGTEXT, -`col74` TIME, -`col75` DATETIME, -`col76` VARCHAR (122), -`col77` MEDIUMTEXT, -`col78` MEDIUMTEXT, -`col79` BOOL, -`col80` LONGTEXT, -`col81` TINYTEXT, -`col82` NUMERIC, -`col83` DOUBLE PRECISION, -`col84` DATE, -`col85` YEAR, -`col86` BLOB, -`col87` TINYTEXT, -`col88` DOUBLE PRECISION, -`col89` MEDIUMINT, -`col90` MEDIUMTEXT, -`col91` NUMERIC, -`col92` DATETIME, -`col93` NUMERIC, -`col94` SET ('test1','test2','test3'), -`col95` TINYTEXT, -`col96` SET ('test1','test2','test3'), -`col97` YEAR, -`col98` MEDIUMINT, -`col99` TEXT, -`col100` TEXT, -`col101` TIME, -`col102` VARCHAR (225), -`col103` TINYTEXT, -`col104` TEXT, -`col105` MEDIUMTEXT, -`col106` TINYINT, -`col107` TEXT, -`col108` LONGBLOB, -`col109` LONGTEXT, -`col110` TINYTEXT, -`col111` CHAR (56), -`col112` YEAR, -`col113` ENUM ('test1','test2','test3'), -`col114` TINYBLOB, -`col115` DATETIME, -`col116` DATE, -`col117` TIME, -`col118` MEDIUMTEXT, -`col119` DOUBLE PRECISION, -`col120` FLOAT, -`col121` TIMESTAMP, -`col122` MEDIUMINT, -`col123` YEAR, -`col124` DATE, -`col125` TEXT, -`col126` FLOAT, -`col127` TINYTEXT, -`col128` BOOL, -`col129` NUMERIC, -`col130` TIMESTAMP, -`col131` INT, -`col132` MEDIUMBLOB, -KEY `idx0` (`col130`), -KEY `idx1` (`col30`,`col55`,`col19`(31)), -KEY `idx2` (`col104`(186)), -KEY `idx3` (`col131`), -KEY `idx4` (`col64`,`col93`,`col2`(11)), -KEY `idx5` (`col34`,`col121`,`col22`), -KEY `idx6` (`col33`,`col55`,`col83`), -KEY `idx7` (`col17`,`col87`(245),`col99`(17)), -KEY `idx8` (`col65`,`col120`), -KEY `idx9` (`col82`), -KEY `idx10` (`col9`(72)), -KEY `idx11` (`col88`), -KEY `idx12` (`col128`,`col9`(200),`col71`,`col66`), -KEY `idx13` (`col77`(126)), -KEY `idx14` (`col105`(26),`col13`,`col117`), -KEY `idx15` (`col4`(246),`col130`,`col115`,`col3`(141)) -)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -# Creating a table with 176 columns and 13 indexes -DROP TABLE IF EXISTS `table5`; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE IF NOT EXISTS `table5` -(`col0` MEDIUMTEXT, -`col1` VARCHAR (90), -`col2` TINYTEXT, -`col3` TIME, -`col4` BOOL, -`col5` TINYTEXT, -`col6` BOOL, -`col7` TIMESTAMP, -`col8` TINYBLOB, -`col9` TINYINT, -`col10` YEAR, -`col11` SET ('test1','test2','test3'), -`col12` TEXT, -`col13` CHAR (248), -`col14` BIGINT, -`col15` TEXT, -`col16` TINYINT, -`col17` NUMERIC, -`col18` SET ('test1','test2','test3'), -`col19` LONGBLOB, -`col20` FLOAT, -`col21` INT, -`col22` TEXT, -`col23` BOOL, -`col24` DECIMAL, -`col25` DOUBLE PRECISION, -`col26` FLOAT, -`col27` TINYBLOB, -`col28` NUMERIC, -`col29` MEDIUMBLOB, -`col30` DATE, -`col31` LONGTEXT, -`col32` DATE, -`col33` FLOAT, -`col34` BIGINT, -`col35` TINYTEXT, -`col36` MEDIUMTEXT, -`col37` TIME, -`col38` INT, -`col39` TINYINT, -`col40` SET ('test1','test2','test3'), -`col41` CHAR (130), -`col42` SMALLINT, -`col43` INT, -`col44` MEDIUMTEXT, -`col45` VARCHAR (126), -`col46` INT, -`col47` DOUBLE PRECISION, -`col48` BIGINT, -`col49` MEDIUMTEXT, -`col50` TINYBLOB, -`col51` MEDIUMINT, -`col52` TEXT, -`col53` VARCHAR (208), -`col54` VARCHAR (207), -`col55` NUMERIC, -`col56` DATETIME, -`col57` ENUM ('test1','test2','test3'), -`col58` NUMERIC, -`col59` TINYBLOB, -`col60` VARCHAR (73), -`col61` MEDIUMTEXT, -`col62` TINYBLOB, -`col63` DATETIME, -`col64` NUMERIC, -`col65` MEDIUMINT, -`col66` DATETIME, -`col67` NUMERIC, -`col68` TINYINT, -`col69` VARCHAR (58), -`col70` DECIMAL, -`col71` MEDIUMTEXT, -`col72` DATE, -`col73` TIME, -`col74` DOUBLE PRECISION, -`col75` DECIMAL, -`col76` MEDIUMBLOB, -`col77` REAL, -`col78` YEAR, -`col79` YEAR, -`col80` LONGBLOB, -`col81` BLOB, -`col82` BIGINT, -`col83` ENUM ('test1','test2','test3'), -`col84` NUMERIC, -`col85` SET ('test1','test2','test3'), -`col86` MEDIUMTEXT, -`col87` LONGBLOB, -`col88` TIME, -`col89` ENUM ('test1','test2','test3'), -`col90` DECIMAL, -`col91` FLOAT, -`col92` DATETIME, -`col93` TINYTEXT, -`col94` TIMESTAMP, -`col95` TIMESTAMP, -`col96` TEXT, -`col97` REAL, -`col98` VARCHAR (198), -`col99` TIME, -`col100` TINYINT, -`col101` BIGINT, -`col102` LONGBLOB, -`col103` LONGBLOB, -`col104` MEDIUMINT, -`col105` MEDIUMTEXT, -`col106` TIMESTAMP, -`col107` SMALLINT, -`col108` NUMERIC, -`col109` DECIMAL, -`col110` FLOAT, -`col111` DECIMAL, -`col112` REAL, -`col113` TINYTEXT, -`col114` FLOAT, -`col115` VARCHAR (7), -`col116` LONGTEXT, -`col117` DATE, -`col118` BIGINT, -`col119` TEXT, -`col120` BIGINT, -`col121` BLOB, -`col122` CHAR (110), -`col123` NUMERIC, -`col124` MEDIUMBLOB, -`col125` NUMERIC, -`col126` NUMERIC, -`col127` BOOL, -`col128` TIME, -`col129` TINYBLOB, -`col130` TINYBLOB, -`col131` DATE, -`col132` INT, -`col133` VARCHAR (123), -`col134` CHAR (238), -`col135` VARCHAR (225), -`col136` LONGTEXT, -`col137` LONGBLOB, -`col138` REAL, -`col139` TINYBLOB, -`col140` DATETIME, -`col141` TINYTEXT, -`col142` LONGBLOB, -`col143` BIGINT, -`col144` VARCHAR (236), -`col145` TEXT, -`col146` YEAR, -`col147` DECIMAL, -`col148` TEXT, -`col149` MEDIUMBLOB, -`col150` TINYINT, -`col151` BOOL, -`col152` VARCHAR (72), -`col153` INT, -`col154` VARCHAR (165), -`col155` TINYINT, -`col156` MEDIUMTEXT, -`col157` DOUBLE PRECISION, -`col158` TIME, -`col159` MEDIUMBLOB, -`col160` LONGBLOB, -`col161` DATETIME, -`col162` DOUBLE PRECISION, -`col163` BLOB, -`col164` ENUM ('test1','test2','test3'), -`col165` TIMESTAMP, -`col166` DATE, -`col167` TINYBLOB, -`col168` TINYBLOB, -`col169` LONGBLOB, -`col170` DATETIME, -`col171` BIGINT, -`col172` VARCHAR (30), -`col173` LONGTEXT, -`col174` TIME, -`col175` FLOAT, -KEY `idx0` (`col16`,`col156`(139),`col97`,`col120`), -KEY `idx1` (`col24`,`col0`(108)), -KEY `idx2` (`col117`,`col173`(34),`col132`,`col82`), -KEY `idx3` (`col2`(86)), -KEY `idx4` (`col2`(43)), -KEY `idx5` (`col83`,`col35`(87),`col111`), -KEY `idx6` (`col6`,`col134`,`col92`), -KEY `idx7` (`col56`), -KEY `idx8` (`col30`,`col53`,`col129`(66)), -KEY `idx9` (`col53`,`col113`(211),`col32`,`col15`(75)), -KEY `idx10` (`col34`), -KEY `idx11` (`col126`), -KEY `idx12` (`col24`) -)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -# Creating a table with 179 columns and 46 indexes -DROP TABLE IF EXISTS `table6`; --- error ER_TOO_BIG_ROWSIZE ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE IF NOT EXISTS `table6` -(`col0` ENUM ('test1','test2','test3'), -`col1` MEDIUMBLOB, -`col2` MEDIUMBLOB, -`col3` DATETIME, -`col4` DATE, -`col5` YEAR, -`col6` REAL, -`col7` NUMERIC, -`col8` MEDIUMBLOB, -`col9` TEXT, -`col10` TIMESTAMP, -`col11` DOUBLE, -`col12` DOUBLE, -`col13` SMALLINT, -`col14` TIMESTAMP, -`col15` DECIMAL, -`col16` DATE, -`col17` TEXT, -`col18` LONGBLOB, -`col19` BIGINT, -`col20` FLOAT, -`col21` DATETIME, -`col22` TINYINT, -`col23` MEDIUMBLOB, -`col24` SET ('test1','test2','test3'), -`col25` TIME, -`col26` TEXT, -`col27` LONGTEXT, -`col28` BIGINT, -`col29` REAL, -`col30` YEAR, -`col31` MEDIUMBLOB, -`col32` MEDIUMINT, -`col33` FLOAT, -`col34` TEXT, -`col35` DATE, -`col36` TIMESTAMP, -`col37` REAL, -`col38` BLOB, -`col39` BLOB, -`col40` BLOB, -`col41` TINYBLOB, -`col42` INT, -`col43` TINYINT, -`col44` REAL, -`col45` BIGINT, -`col46` TIMESTAMP, -`col47` BLOB, -`col48` ENUM ('test1','test2','test3'), -`col49` BOOL, -`col50` CHAR (109), -`col51` DOUBLE, -`col52` DOUBLE PRECISION, -`col53` ENUM ('test1','test2','test3'), -`col54` FLOAT, -`col55` DOUBLE PRECISION, -`col56` CHAR (166), -`col57` TEXT, -`col58` TIME, -`col59` DECIMAL, -`col60` TEXT, -`col61` ENUM ('test1','test2','test3'), -`col62` LONGTEXT, -`col63` YEAR, -`col64` DOUBLE, -`col65` CHAR (87), -`col66` DATE, -`col67` BOOL, -`col68` MEDIUMBLOB, -`col69` DATETIME, -`col70` DECIMAL, -`col71` TIME, -`col72` REAL, -`col73` LONGTEXT, -`col74` BLOB, -`col75` REAL, -`col76` INT, -`col77` INT, -`col78` FLOAT, -`col79` DOUBLE, -`col80` MEDIUMINT, -`col81` ENUM ('test1','test2','test3'), -`col82` VARCHAR (221), -`col83` BIGINT, -`col84` TINYINT, -`col85` BIGINT, -`col86` FLOAT, -`col87` MEDIUMBLOB, -`col88` CHAR (126), -`col89` MEDIUMBLOB, -`col90` DATETIME, -`col91` TINYINT, -`col92` DOUBLE, -`col93` NUMERIC, -`col94` DATE, -`col95` BLOB, -`col96` DATETIME, -`col97` TIME, -`col98` LONGBLOB, -`col99` INT, -`col100` SET ('test1','test2','test3'), -`col101` TINYBLOB, -`col102` INT, -`col103` MEDIUMBLOB, -`col104` MEDIUMTEXT, -`col105` FLOAT, -`col106` TINYBLOB, -`col107` VARCHAR (26), -`col108` TINYINT, -`col109` TIME, -`col110` TINYBLOB, -`col111` LONGBLOB, -`col112` TINYTEXT, -`col113` FLOAT, -`col114` TINYINT, -`col115` NUMERIC, -`col116` TIME, -`col117` SET ('test1','test2','test3'), -`col118` DATE, -`col119` SMALLINT, -`col120` BLOB, -`col121` TINYTEXT, -`col122` REAL, -`col123` YEAR, -`col124` REAL, -`col125` BOOL, -`col126` BLOB, -`col127` REAL, -`col128` MEDIUMBLOB, -`col129` TIMESTAMP, -`col130` LONGBLOB, -`col131` MEDIUMBLOB, -`col132` YEAR, -`col133` YEAR, -`col134` INT, -`col135` MEDIUMINT, -`col136` MEDIUMINT, -`col137` TINYTEXT, -`col138` TINYBLOB, -`col139` BLOB, -`col140` SET ('test1','test2','test3'), -`col141` ENUM ('test1','test2','test3'), -`col142` ENUM ('test1','test2','test3'), -`col143` TINYTEXT, -`col144` DATETIME, -`col145` TEXT, -`col146` DOUBLE PRECISION, -`col147` DECIMAL, -`col148` MEDIUMTEXT, -`col149` TINYTEXT, -`col150` SET ('test1','test2','test3'), -`col151` MEDIUMTEXT, -`col152` CHAR (126), -`col153` DOUBLE, -`col154` CHAR (243), -`col155` SET ('test1','test2','test3'), -`col156` SET ('test1','test2','test3'), -`col157` DATETIME, -`col158` DOUBLE, -`col159` NUMERIC, -`col160` DECIMAL, -`col161` FLOAT, -`col162` LONGBLOB, -`col163` LONGTEXT, -`col164` INT, -`col165` TIME, -`col166` CHAR (27), -`col167` VARCHAR (63), -`col168` TEXT, -`col169` TINYBLOB, -`col170` TINYBLOB, -`col171` ENUM ('test1','test2','test3'), -`col172` INT, -`col173` TIME, -`col174` DECIMAL, -`col175` DOUBLE, -`col176` MEDIUMBLOB, -`col177` LONGBLOB, -`col178` CHAR (43), -KEY `idx0` (`col131`(219)), -KEY `idx1` (`col67`,`col122`,`col59`,`col87`(33)), -KEY `idx2` (`col83`,`col42`,`col57`(152)), -KEY `idx3` (`col106`(124)), -KEY `idx4` (`col173`,`col80`,`col165`,`col89`(78)), -KEY `idx5` (`col174`,`col145`(108),`col23`(228),`col141`), -KEY `idx6` (`col157`,`col140`), -KEY `idx7` (`col130`(188),`col15`), -KEY `idx8` (`col52`), -KEY `idx9` (`col144`), -KEY `idx10` (`col155`), -KEY `idx11` (`col62`(230),`col1`(109)), -KEY `idx12` (`col151`(24),`col95`(85)), -KEY `idx13` (`col114`), -KEY `idx14` (`col42`,`col98`(56),`col146`), -KEY `idx15` (`col147`,`col39`(254),`col35`), -KEY `idx16` (`col79`), -KEY `idx17` (`col65`), -KEY `idx18` (`col149`(165),`col168`(119),`col32`,`col117`), -KEY `idx19` (`col64`), -KEY `idx20` (`col93`), -KEY `idx21` (`col64`,`col113`,`col104`(182)), -KEY `idx22` (`col52`,`col111`(189)), -KEY `idx23` (`col45`), -KEY `idx24` (`col154`,`col107`,`col110`(159)), -KEY `idx25` (`col149`(1),`col87`(131)), -KEY `idx26` (`col58`,`col115`,`col63`), -KEY `idx27` (`col95`(9),`col0`,`col87`(113)), -KEY `idx28` (`col92`,`col130`(1)), -KEY `idx29` (`col151`(129),`col137`(254),`col13`), -KEY `idx30` (`col49`), -KEY `idx31` (`col28`), -KEY `idx32` (`col83`,`col146`), -KEY `idx33` (`col155`,`col90`,`col17`(245)), -KEY `idx34` (`col174`,`col169`(44),`col107`), -KEY `idx35` (`col113`), -KEY `idx36` (`col52`), -KEY `idx37` (`col16`,`col120`(190)), -KEY `idx38` (`col28`), -KEY `idx39` (`col131`(165)), -KEY `idx40` (`col135`,`col26`(86)), -KEY `idx41` (`col69`,`col94`), -KEY `idx42` (`col105`,`col151`(38),`col97`), -KEY `idx43` (`col88`), -KEY `idx44` (`col176`(100),`col42`,`col73`(189),`col94`), -KEY `idx45` (`col2`(27),`col27`(116)) -)engine=innodb ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1; - -DROP TABLE IF EXISTS table0; -DROP TABLE IF EXISTS table1; -DROP TABLE IF EXISTS table2; -DROP TABLE IF EXISTS table3; -DROP TABLE IF EXISTS table4; -DROP TABLE IF EXISTS table5; -DROP TABLE IF EXISTS table6; - -EVAL SET GLOBAL innodb_file_format=$file_format; -EVAL SET GLOBAL innodb_file_per_table=$file_per_table; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug36172.result b/storage/innodb_plugin/mysql-test/innodb_bug36172.result deleted file mode 100644 index 195775f74c8..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug36172.result +++ /dev/null @@ -1 +0,0 @@ -SET storage_engine=InnoDB; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug36172.test b/storage/innodb_plugin/mysql-test/innodb_bug36172.test deleted file mode 100644 index c6c4e6fae47..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug36172.test +++ /dev/null @@ -1,32 +0,0 @@ -# -# Test case for bug 36172 -# - --- source include/not_embedded.inc --- source include/have_innodb.inc - -SET storage_engine=InnoDB; - -# we do not really care about what gets printed, we are only -# interested in getting success or failure according to our -# expectations - --- disable_query_log --- disable_result_log - -let $file_format=`select @@innodb_file_format`; -let $file_format_check=`select @@innodb_file_format_check`; -let $file_per_table=`select @@innodb_file_per_table`; -SET GLOBAL innodb_file_format='Barracuda'; -SET GLOBAL innodb_file_per_table=on; - -DROP TABLE IF EXISTS `table0`; -CREATE TABLE `table0` ( `col0` tinyint(1) DEFAULT NULL, `col1` tinyint(1) DEFAULT NULL, `col2` tinyint(4) DEFAULT NULL, `col3` date DEFAULT NULL, `col4` time DEFAULT NULL, `col5` set('test1','test2','test3') DEFAULT NULL, `col6` time DEFAULT NULL, `col7` text, `col8` decimal(10,0) DEFAULT NULL, `col9` set('test1','test2','test3') DEFAULT NULL, `col10` float DEFAULT NULL, `col11` double DEFAULT NULL, `col12` enum('test1','test2','test3') DEFAULT NULL, `col13` tinyblob, `col14` year(4) DEFAULT NULL, `col15` set('test1','test2','test3') DEFAULT NULL, `col16` decimal(10,0) DEFAULT NULL, `col17` decimal(10,0) DEFAULT NULL, `col18` blob, `col19` datetime DEFAULT NULL, `col20` double DEFAULT NULL, `col21` decimal(10,0) DEFAULT NULL, `col22` datetime DEFAULT NULL, `col23` decimal(10,0) DEFAULT NULL, `col24` decimal(10,0) DEFAULT NULL, `col25` longtext, `col26` tinyblob, `col27` time DEFAULT NULL, `col28` tinyblob, `col29` enum('test1','test2','test3') DEFAULT NULL, `col30` smallint(6) DEFAULT NULL, `col31` double DEFAULT NULL, `col32` float DEFAULT NULL, `col33` char(175) DEFAULT NULL, `col34` tinytext, `col35` tinytext, `col36` tinyblob, `col37` tinyblob, `col38` tinytext, `col39` mediumblob, `col40` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `col41` double DEFAULT NULL, `col42` smallint(6) DEFAULT NULL, `col43` longblob, `col44` varchar(80) DEFAULT NULL, `col45` mediumtext, `col46` decimal(10,0) DEFAULT NULL, `col47` bigint(20) DEFAULT NULL, `col48` date DEFAULT NULL, `col49` tinyblob, `col50` date DEFAULT NULL, `col51` tinyint(1) DEFAULT NULL, `col52` mediumint(9) DEFAULT NULL, `col53` float DEFAULT NULL, `col54` tinyblob, `col55` longtext, `col56` smallint(6) DEFAULT NULL, `col57` enum('test1','test2','test3') DEFAULT NULL, `col58` datetime DEFAULT NULL, `col59` mediumtext, `col60` varchar(232) DEFAULT NULL, `col61` decimal(10,0) DEFAULT NULL, `col62` year(4) DEFAULT NULL, `col63` smallint(6) DEFAULT NULL, `col64` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col65` blob, `col66` longblob, `col67` int(11) DEFAULT NULL, `col68` longtext, `col69` enum('test1','test2','test3') DEFAULT NULL, `col70` int(11) DEFAULT NULL, `col71` time DEFAULT NULL, `col72` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col73` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `col74` varchar(170) DEFAULT NULL, `col75` set('test1','test2','test3') DEFAULT NULL, `col76` tinyblob, `col77` bigint(20) DEFAULT NULL, `col78` decimal(10,0) DEFAULT NULL, `col79` datetime DEFAULT NULL, `col80` year(4) DEFAULT NULL, `col81` decimal(10,0) DEFAULT NULL, `col82` longblob, `col83` text, `col84` char(83) DEFAULT NULL, `col85` decimal(10,0) DEFAULT NULL, `col86` float DEFAULT NULL, `col87` int(11) DEFAULT NULL, `col88` varchar(145) DEFAULT NULL, `col89` date DEFAULT NULL, `col90` decimal(10,0) DEFAULT NULL, `col91` decimal(10,0) DEFAULT NULL, `col92` mediumblob, `col93` time DEFAULT NULL, KEY `idx0` (`col69`,`col90`,`col8`), KEY `idx1` (`col60`), KEY `idx2` (`col60`,`col70`,`col74`), KEY `idx3` (`col22`,`col32`,`col72`,`col30`), KEY `idx4` (`col29`), KEY `idx5` (`col19`,`col45`(143)), KEY `idx6` (`col46`,`col48`,`col5`,`col39`(118)), KEY `idx7` (`col48`,`col61`), KEY `idx8` (`col93`), KEY `idx9` (`col31`), KEY `idx10` (`col30`,`col21`), KEY `idx11` (`col67`), KEY `idx12` (`col44`,`col6`,`col8`,`col38`(226)), KEY `idx13` (`col71`,`col41`,`col15`,`col49`(88)), KEY `idx14` (`col78`), KEY `idx15` (`col63`,`col67`,`col64`), KEY `idx16` (`col17`,`col86`), KEY `idx17` (`col77`,`col56`,`col10`,`col55`(24)), KEY `idx18` (`col62`), KEY `idx19` (`col31`,`col57`,`col56`,`col53`), KEY `idx20` (`col46`), KEY `idx21` (`col83`(54)), KEY `idx22` (`col51`,`col7`(120)), KEY `idx23` (`col7`(163),`col31`,`col71`,`col14`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2; -insert ignore into `table0` set `col23` = 7887371.5084383683, `col24` = 4293854615.6906948000, `col25` = 'vitalist', `col26` = 'widespread', `col27` = '3570490', `col28` = 'habitual', `col30` = -5471, `col31` = 4286985783.6771750000, `col32` = 6354540.9826654866, `col33` = 'defoliation', `col34` = 'logarithms', `col35` = 'tegument\'s', `col36` = 'scouting\'s', `col37` = 'intermittency', `col38` = 'elongates', `col39` = 'prophecies', `col40` = '20560103035939', `col41` = 4292809130.0544143000, `col42` = 22057, `col43` = 'Hess\'s', `col44` = 'bandstand', `col45` = 'phenylketonuria', `col46` = 6338767.4018677324, `col47` = 5310247, `col48` = '12592418', `col49` = 'churchman\'s', `col50` = '32226125', `col51` = -58, `col52` = -6207968, `col53` = 1244839.3255104220, `col54` = 'robotized', `col55` = 'monotonous', `col56` = -26909, `col58` = '20720107023550', `col59` = 'suggestiveness\'s', `col60` = 'gemology', `col61` = 4287800670.2229986000, `col62` = '1944', `col63` = -16827, `col64` = '20700107212324', `col65` = 'Nicolais', `col66` = 'apteryx', `col67` = 6935317, `col68` = 'stroganoff', `col70` = 3316430, `col71` = '3277608', `col72` = '19300511045918', `col73` = '20421201003327', `col74` = 'attenuant', `col75` = '15173', `col76` = 'upstroke\'s', `col77` = 8118987, `col78` = 6791516.2735374002, `col79` = '20780701144624', `col80` = '2134', `col81` = 4290682351.3127537000, `col82` = 'unexplainably', `col83` = 'Storm', `col84` = 'Greyso\'s', `col85` = 4289119212.4306774000, `col86` = 7617575.8796655172, `col87` = -6325335, `col88` = 'fondue\'s', `col89` = '40608940', `col90` = 1659421.8093508712, `col91` = 8346904.6584368423, `col92` = 'reloads', `col93` = '5188366'; -CHECK TABLE table0 EXTENDED; -INSERT IGNORE INTO `table0` SET `col19` = '19940127002709', `col20` = 2383927.9055146948, `col21` = 4293243420.5621204000, `col22` = '20511211123705', `col23` = 4289899778.6573381000, `col24` = 4293449279.0540481000, `col25` = 'emphysemic', `col26` = 'dentally', `col27` = '2347406', `col28` = 'eruct', `col30` = 1222, `col31` = 4294372994.9941406000, `col32` = 4291385574.1173744000, `col33` = 'borrowing\'s', `col34` = 'septics', `col35` = 'ratter\'s', `col36` = 'Kaye', `col37` = 'Florentia', `col38` = 'allium', `col39` = 'barkeep', `col40` = '19510407003441', `col41` = 4293559200.4215522000, `col42` = 22482, `col43` = 'decussate', `col44` = 'Brom\'s', `col45` = 'violated', `col46` = 4925506.4635456400, `col47` = 930549, `col48` = '51296066', `col49` = 'voluminously', `col50` = '29306676', `col51` = -88, `col52` = -2153690, `col53` = 4290250202.1464887000, `col54` = 'expropriation', `col55` = 'Aberdeen\'s', `col56` = 20343, `col58` = '19640415171532', `col59` = 'extern', `col60` = 'Ubana', `col61` = 4290487961.8539081000, `col62` = '2147', `col63` = -24271, `col64` = '20750801194548', `col65` = 'Cunaxa\'s', `col66` = 'pasticcio', `col67` = 2795817, `col68` = 'Indore\'s', `col70` = 6864127, `col71` = '1817832', `col72` = '20540506114211', `col73` = '20040101012300', `col74` = 'rationalized', `col75` = '45522', `col76` = 'indene', `col77` = -6964559, `col78` = 4247535.5266884370, `col79` = '20720416124357', `col80` = '2143', `col81` = 4292060102.4466386000, `col82` = 'striving', `col83` = 'boneblack\'s', `col84` = 'redolent', `col85` = 6489697.9009369183, `col86` = 4287473465.9731131000, `col87` = 7726015, `col88` = 'perplexed', `col89` = '17153791', `col90` = 5478587.1108127078, `col91` = 4287091404.7004304000, `col92` = 'Boulez\'s', `col93` = '2931278'; -CHECK TABLE table0 EXTENDED; -DROP TABLE table0; -EVAL SET GLOBAL innodb_file_format=$file_format; -EVAL SET GLOBAL innodb_file_format_check=$file_format_check; -EVAL SET GLOBAL innodb_file_per_table=$file_per_table; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug40360.result b/storage/innodb_plugin/mysql-test/innodb_bug40360.result deleted file mode 100644 index ef4cf463903..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug40360.result +++ /dev/null @@ -1,4 +0,0 @@ -SET TX_ISOLATION='READ-COMMITTED'; -CREATE TABLE bug40360 (a INT) engine=innodb; -INSERT INTO bug40360 VALUES (1); -DROP TABLE bug40360; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug40360.test b/storage/innodb_plugin/mysql-test/innodb_bug40360.test deleted file mode 100644 index e88837aab4f..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug40360.test +++ /dev/null @@ -1,16 +0,0 @@ -# -# Make sure http://bugs.mysql.com/40360 remains fixed. -# - --- source include/not_embedded.inc --- source include/have_innodb.inc - -SET TX_ISOLATION='READ-COMMITTED'; - -# This is the default since MySQL 5.1.29 SET BINLOG_FORMAT='STATEMENT'; - -CREATE TABLE bug40360 (a INT) engine=innodb; - -INSERT INTO bug40360 VALUES (1); - -DROP TABLE bug40360; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug40565.result b/storage/innodb_plugin/mysql-test/innodb_bug40565.result deleted file mode 100644 index 21e923d9336..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug40565.result +++ /dev/null @@ -1,9 +0,0 @@ -create table bug40565(value decimal(4,2)) engine=innodb; -insert into bug40565 values (1), (null); -update bug40565 set value=NULL; -affected rows: 1 -info: Rows matched: 2 Changed: 1 Warnings: 0 -update bug40565 set value=NULL; -affected rows: 0 -info: Rows matched: 2 Changed: 0 Warnings: 0 -drop table bug40565; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug40565.test b/storage/innodb_plugin/mysql-test/innodb_bug40565.test deleted file mode 100644 index d7aa0fd514a..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug40565.test +++ /dev/null @@ -1,10 +0,0 @@ -# Bug #40565 Update Query Results in "1 Row Affected" But Should Be "Zero Rows" --- source include/have_innodb.inc - -create table bug40565(value decimal(4,2)) engine=innodb; -insert into bug40565 values (1), (null); ---enable_info -update bug40565 set value=NULL; -update bug40565 set value=NULL; ---disable_info -drop table bug40565; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug41904.result b/storage/innodb_plugin/mysql-test/innodb_bug41904.result deleted file mode 100644 index 6070d32d181..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug41904.result +++ /dev/null @@ -1,4 +0,0 @@ -CREATE TABLE bug41904 (id INT PRIMARY KEY, uniquecol CHAR(15)) ENGINE=InnoDB; -INSERT INTO bug41904 VALUES (1,NULL), (2,NULL); -CREATE UNIQUE INDEX ui ON bug41904 (uniquecol); -DROP TABLE bug41904; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug41904.test b/storage/innodb_plugin/mysql-test/innodb_bug41904.test deleted file mode 100644 index 365c5229adc..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug41904.test +++ /dev/null @@ -1,14 +0,0 @@ -# -# Make sure http://bugs.mysql.com/41904 remains fixed. -# - --- source include/not_embedded.inc --- source include/have_innodb.inc - -CREATE TABLE bug41904 (id INT PRIMARY KEY, uniquecol CHAR(15)) ENGINE=InnoDB; - -INSERT INTO bug41904 VALUES (1,NULL), (2,NULL); - -CREATE UNIQUE INDEX ui ON bug41904 (uniquecol); - -DROP TABLE bug41904; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero-master.opt b/storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero-master.opt deleted file mode 100644 index d71dbe17d5b..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_commit_concurrency=1 diff --git a/storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero.result b/storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero.result deleted file mode 100644 index 277dfffdd35..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero.result +++ /dev/null @@ -1,26 +0,0 @@ -set global innodb_commit_concurrency=0; -ERROR HY000: Incorrect arguments to SET -select @@innodb_commit_concurrency; -@@innodb_commit_concurrency -1 -set global innodb_commit_concurrency=1; -select @@innodb_commit_concurrency; -@@innodb_commit_concurrency -1 -set global innodb_commit_concurrency=42; -select @@innodb_commit_concurrency; -@@innodb_commit_concurrency -42 -set global innodb_commit_concurrency=DEFAULT; -select @@innodb_commit_concurrency; -@@innodb_commit_concurrency -1 -set global innodb_commit_concurrency=0; -ERROR HY000: Incorrect arguments to SET -select @@innodb_commit_concurrency; -@@innodb_commit_concurrency -1 -set global innodb_commit_concurrency=1; -select @@innodb_commit_concurrency; -@@innodb_commit_concurrency -1 diff --git a/storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero.test b/storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero.test deleted file mode 100644 index 685fdf20489..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug42101-nonzero.test +++ /dev/null @@ -1,21 +0,0 @@ -# -# Bug#42101 Race condition in innodb_commit_concurrency -# http://bugs.mysql.com/42101 -# - --- source include/have_innodb.inc - ---error ER_WRONG_ARGUMENTS -set global innodb_commit_concurrency=0; -select @@innodb_commit_concurrency; -set global innodb_commit_concurrency=1; -select @@innodb_commit_concurrency; -set global innodb_commit_concurrency=42; -select @@innodb_commit_concurrency; -set global innodb_commit_concurrency=DEFAULT; -select @@innodb_commit_concurrency; ---error ER_WRONG_ARGUMENTS -set global innodb_commit_concurrency=0; -select @@innodb_commit_concurrency; -set global innodb_commit_concurrency=1; -select @@innodb_commit_concurrency; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug42101.result b/storage/innodb_plugin/mysql-test/innodb_bug42101.result deleted file mode 100644 index 805097ffe9d..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug42101.result +++ /dev/null @@ -1,22 +0,0 @@ -set global innodb_commit_concurrency=0; -select @@innodb_commit_concurrency; -@@innodb_commit_concurrency -0 -set global innodb_commit_concurrency=1; -ERROR HY000: Incorrect arguments to SET -select @@innodb_commit_concurrency; -@@innodb_commit_concurrency -0 -set global innodb_commit_concurrency=42; -ERROR HY000: Incorrect arguments to SET -select @@innodb_commit_concurrency; -@@innodb_commit_concurrency -0 -set global innodb_commit_concurrency=0; -select @@innodb_commit_concurrency; -@@innodb_commit_concurrency -0 -set global innodb_commit_concurrency=DEFAULT; -select @@innodb_commit_concurrency; -@@innodb_commit_concurrency -0 diff --git a/storage/innodb_plugin/mysql-test/innodb_bug42101.test b/storage/innodb_plugin/mysql-test/innodb_bug42101.test deleted file mode 100644 index b6536490d48..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug42101.test +++ /dev/null @@ -1,19 +0,0 @@ -# -# Bug#42101 Race condition in innodb_commit_concurrency -# http://bugs.mysql.com/42101 -# - --- source include/have_innodb.inc - -set global innodb_commit_concurrency=0; -select @@innodb_commit_concurrency; ---error ER_WRONG_ARGUMENTS -set global innodb_commit_concurrency=1; -select @@innodb_commit_concurrency; ---error ER_WRONG_ARGUMENTS -set global innodb_commit_concurrency=42; -select @@innodb_commit_concurrency; -set global innodb_commit_concurrency=0; -select @@innodb_commit_concurrency; -set global innodb_commit_concurrency=DEFAULT; -select @@innodb_commit_concurrency; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug44032.result b/storage/innodb_plugin/mysql-test/innodb_bug44032.result deleted file mode 100644 index da2a000b06e..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug44032.result +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE bug44032(c CHAR(3) CHARACTER SET UTF8) ROW_FORMAT=REDUNDANT -ENGINE=InnoDB; -INSERT INTO bug44032 VALUES('abc'),(0xEFBCA4EFBCA4EFBCA4); -UPDATE bug44032 SET c='DDD' WHERE c=0xEFBCA4EFBCA4EFBCA4; -UPDATE bug44032 SET c=NULL WHERE c='DDD'; -UPDATE bug44032 SET c='DDD' WHERE c IS NULL; -DROP TABLE bug44032; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug44032.test b/storage/innodb_plugin/mysql-test/innodb_bug44032.test deleted file mode 100644 index a963cb8b68f..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug44032.test +++ /dev/null @@ -1,13 +0,0 @@ -# Bug44032 no update-in-place of UTF-8 columns in ROW_FORMAT=REDUNDANT -# (btr_cur_update_in_place not invoked when updating from/to NULL; -# the update is performed by delete and insert instead) - --- source include/have_innodb.inc - -CREATE TABLE bug44032(c CHAR(3) CHARACTER SET UTF8) ROW_FORMAT=REDUNDANT -ENGINE=InnoDB; -INSERT INTO bug44032 VALUES('abc'),(0xEFBCA4EFBCA4EFBCA4); -UPDATE bug44032 SET c='DDD' WHERE c=0xEFBCA4EFBCA4EFBCA4; -UPDATE bug44032 SET c=NULL WHERE c='DDD'; -UPDATE bug44032 SET c='DDD' WHERE c IS NULL; -DROP TABLE bug44032; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug44369.result b/storage/innodb_plugin/mysql-test/innodb_bug44369.result deleted file mode 100644 index e4b84ecac19..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug44369.result +++ /dev/null @@ -1,14 +0,0 @@ -create table bug44369 (DB_ROW_ID int) engine=innodb; -ERROR HY000: Can't create table 'test.bug44369' (errno: -1) -create table bug44369 (db_row_id int) engine=innodb; -ERROR HY000: Can't create table 'test.bug44369' (errno: -1) -show errors; -Level Code Message -Error 1005 Error creating table 'test/bug44369' with column name 'db_row_id'. 'db_row_id' is a reserved name. Please try to re-create the table with a different column name. -Error 1005 Can't create table 'test.bug44369' (errno: -1) -create table bug44369 (db_TRX_Id int) engine=innodb; -ERROR HY000: Can't create table 'test.bug44369' (errno: -1) -show errors; -Level Code Message -Error 1005 Error creating table 'test/bug44369' with column name 'db_TRX_Id'. 'db_TRX_Id' is a reserved name. Please try to re-create the table with a different column name. -Error 1005 Can't create table 'test.bug44369' (errno: -1) diff --git a/storage/innodb_plugin/mysql-test/innodb_bug44369.test b/storage/innodb_plugin/mysql-test/innodb_bug44369.test deleted file mode 100644 index 495059eb5e6..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug44369.test +++ /dev/null @@ -1,21 +0,0 @@ -# This is the test for bug 44369. We should -# block table creation with columns match -# some innodb internal reserved key words, -# both case sensitively and insensitely. - ---source include/have_innodb.inc - -# This create table operation should fail. ---error ER_CANT_CREATE_TABLE -create table bug44369 (DB_ROW_ID int) engine=innodb; - -# This create should fail as well ---error ER_CANT_CREATE_TABLE -create table bug44369 (db_row_id int) engine=innodb; - -show errors; - ---error ER_CANT_CREATE_TABLE -create table bug44369 (db_TRX_Id int) engine=innodb; - -show errors; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug44571.result b/storage/innodb_plugin/mysql-test/innodb_bug44571.result deleted file mode 100644 index 36374edcb3e..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug44571.result +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB; -ALTER TABLE bug44571 CHANGE foo bar INT; -ALTER TABLE bug44571 ADD INDEX bug44571b (foo); -ERROR 42000: Key column 'foo' doesn't exist in table -ALTER TABLE bug44571 ADD INDEX bug44571b (bar); -ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it -CREATE INDEX bug44571b ON bug44571 (bar); -ERROR HY000: Incorrect key file for table 'bug44571'; try to repair it -DROP TABLE bug44571; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug44571.test b/storage/innodb_plugin/mysql-test/innodb_bug44571.test deleted file mode 100644 index 685463ceff9..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug44571.test +++ /dev/null @@ -1,17 +0,0 @@ -# -# Bug#44571 InnoDB Plugin crashes on ADD INDEX -# http://bugs.mysql.com/44571 -# --- source include/have_innodb.inc - -CREATE TABLE bug44571 (foo INT) ENGINE=InnoDB; -ALTER TABLE bug44571 CHANGE foo bar INT; --- error ER_KEY_COLUMN_DOES_NOT_EXITS -ALTER TABLE bug44571 ADD INDEX bug44571b (foo); -# The following will fail, because the CHANGE foo bar was -# not communicated to InnoDB. ---error ER_NOT_KEYFILE -ALTER TABLE bug44571 ADD INDEX bug44571b (bar); ---error ER_NOT_KEYFILE -CREATE INDEX bug44571b ON bug44571 (bar); -DROP TABLE bug44571; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug45357.result b/storage/innodb_plugin/mysql-test/innodb_bug45357.result deleted file mode 100644 index 7adeff2062f..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug45357.result +++ /dev/null @@ -1,7 +0,0 @@ -set session transaction isolation level read committed; -create table bug45357(a int, b int,key(b))engine=innodb; -insert into bug45357 values (25170,6122); -update bug45357 set a=1 where b=30131; -delete from bug45357 where b < 20996; -delete from bug45357 where b < 7001; -drop table bug45357; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug45357.test b/storage/innodb_plugin/mysql-test/innodb_bug45357.test deleted file mode 100644 index 81727f352dd..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug45357.test +++ /dev/null @@ -1,10 +0,0 @@ --- source include/have_innodb.inc - -set session transaction isolation level read committed; - -create table bug45357(a int, b int,key(b))engine=innodb; -insert into bug45357 values (25170,6122); -update bug45357 set a=1 where b=30131; -delete from bug45357 where b < 20996; -delete from bug45357 where b < 7001; -drop table bug45357; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug46000.result b/storage/innodb_plugin/mysql-test/innodb_bug46000.result deleted file mode 100644 index ccff888a48d..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug46000.result +++ /dev/null @@ -1,17 +0,0 @@ -create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb; -ERROR HY000: Can't create table 'test.bug46000' (errno: -1) -create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb; -ERROR HY000: Can't create table 'test.bug46000' (errno: -1) -show errors; -Level Code Message -Error 1005 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index. -Error 1005 Can't create table 'test.bug46000' (errno: -1) -create table bug46000(id int) engine=innodb; -create index GEN_CLUST_INDEX on bug46000(id); -ERROR HY000: Can't create table '#sql-temporary' (errno: -1) -show errors; -Level Code Message -Error 1005 Cannot Create Index with name 'GEN_CLUST_INDEX'. The name is reserved for the system default primary index. -Error 1005 Can't create table '#sql-temporary' (errno: -1) -create index idx on bug46000(id); -drop table bug46000; diff --git a/storage/innodb_plugin/mysql-test/innodb_bug46000.test b/storage/innodb_plugin/mysql-test/innodb_bug46000.test deleted file mode 100644 index 80c18c58ef0..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_bug46000.test +++ /dev/null @@ -1,34 +0,0 @@ -# This is the test for bug 46000. We shall -# block any index creation with the name of -# "GEN_CLUST_INDEX", which is the reserved -# name for innodb default primary index. - ---source include/have_innodb.inc - -# This 'create table' operation should fail because of -# using the reserve name as its index name. ---error ER_CANT_CREATE_TABLE -create table bug46000(`id` int,key `GEN_CLUST_INDEX`(`id`))engine=innodb; - -# Mixed upper/lower case of the reserved key words ---error ER_CANT_CREATE_TABLE -create table bug46000(`id` int, key `GEN_clust_INDEX`(`id`))engine=innodb; - -show errors; - -create table bug46000(id int) engine=innodb; - -# This 'create index' operation should fail. ---replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/ ---error ER_CANT_CREATE_TABLE -create index GEN_CLUST_INDEX on bug46000(id); - ---replace_regex /'[^']*test.#sql-[0-9a-f_]*'/'#sql-temporary'/ -show errors; - -# This 'create index' operation should succeed, no -# temp table left from last failed create index -# operation. -create index idx on bug46000(id); - -drop table bug46000; diff --git a/storage/innodb_plugin/mysql-test/innodb_file_format.result b/storage/innodb_plugin/mysql-test/innodb_file_format.result deleted file mode 100644 index 8e9a317308b..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_file_format.result +++ /dev/null @@ -1,45 +0,0 @@ -select @@innodb_file_format; -@@innodb_file_format -Antelope -select @@innodb_file_format_check; -@@innodb_file_format_check -Antelope -set global innodb_file_format=antelope; -set global innodb_file_format=barracuda; -set global innodb_file_format=cheetah; -ERROR HY000: Incorrect arguments to SET -select @@innodb_file_format; -@@innodb_file_format -Barracuda -set global innodb_file_format=default; -select @@innodb_file_format; -@@innodb_file_format -Antelope -set global innodb_file_format=on; -ERROR HY000: Incorrect arguments to SET -set global innodb_file_format=off; -ERROR HY000: Incorrect arguments to SET -select @@innodb_file_format; -@@innodb_file_format -Antelope -set global innodb_file_format_check=antelope; -set global innodb_file_format_check=barracuda; -set global innodb_file_format_check=cheetah; -ERROR HY000: Incorrect arguments to SET -select @@innodb_file_format_check; -@@innodb_file_format_check -Barracuda -set global innodb_file_format_check=default; -Warnings: -Warning 1210 Ignoring SET innodb_file_format=on -select @@innodb_file_format_check; -@@innodb_file_format_check -Barracuda -set global innodb_file_format=on; -ERROR HY000: Incorrect arguments to SET -set global innodb_file_format=off; -ERROR HY000: Incorrect arguments to SET -select @@innodb_file_format_check; -@@innodb_file_format_check -Barracuda -set global innodb_file_format_check=antelope; diff --git a/storage/innodb_plugin/mysql-test/innodb_file_format.test b/storage/innodb_plugin/mysql-test/innodb_file_format.test deleted file mode 100644 index d63c9b0228f..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_file_format.test +++ /dev/null @@ -1,29 +0,0 @@ --- source include/have_innodb.inc - -select @@innodb_file_format; -select @@innodb_file_format_check; -set global innodb_file_format=antelope; -set global innodb_file_format=barracuda; ---error ER_WRONG_ARGUMENTS -set global innodb_file_format=cheetah; -select @@innodb_file_format; -set global innodb_file_format=default; -select @@innodb_file_format; ---error ER_WRONG_ARGUMENTS -set global innodb_file_format=on; ---error ER_WRONG_ARGUMENTS -set global innodb_file_format=off; -select @@innodb_file_format; -set global innodb_file_format_check=antelope; -set global innodb_file_format_check=barracuda; ---error ER_WRONG_ARGUMENTS -set global innodb_file_format_check=cheetah; -select @@innodb_file_format_check; -set global innodb_file_format_check=default; -select @@innodb_file_format_check; ---error ER_WRONG_ARGUMENTS -set global innodb_file_format=on; ---error ER_WRONG_ARGUMENTS -set global innodb_file_format=off; -select @@innodb_file_format_check; -set global innodb_file_format_check=antelope; diff --git a/storage/innodb_plugin/mysql-test/innodb_information_schema.result b/storage/innodb_plugin/mysql-test/innodb_information_schema.result deleted file mode 100644 index 396cae579ce..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_information_schema.result +++ /dev/null @@ -1,23 +0,0 @@ -lock_mode lock_type lock_table lock_index lock_rec lock_data -X RECORD `test`.```t'\"_str` `PRIMARY` 2 '1', 'abc', '''abc', 'abc''', 'a''bc', 'a''bc''', '''abc''''' -X RECORD `test`.```t'\"_str` `PRIMARY` 2 '1', 'abc', '''abc', 'abc''', 'a''bc', 'a''bc''', '''abc''''' -X RECORD `test`.```t'\"_str` `PRIMARY` 3 '2', 'abc', '"abc', 'abc"', 'a"bc', 'a"bc"', '"abc""' -X RECORD `test`.```t'\"_str` `PRIMARY` 3 '2', 'abc', '"abc', 'abc"', 'a"bc', 'a"bc"', '"abc""' -X RECORD `test`.```t'\"_str` `PRIMARY` 4 '3', 'abc', '\\abc', 'abc\\', 'a\\bc', 'a\\bc\\', '\\abc\\\\' -X RECORD `test`.```t'\"_str` `PRIMARY` 4 '3', 'abc', '\\abc', 'abc\\', 'a\\bc', 'a\\bc\\', '\\abc\\\\' -X RECORD `test`.```t'\"_str` `PRIMARY` 5 '4', 'abc', '\0abc', 'abc\0', 'a\0bc', 'a\0bc\0', 'a\0bc\0\0' -X RECORD `test`.```t'\"_str` `PRIMARY` 5 '4', 'abc', '\0abc', 'abc\0', 'a\0bc', 'a\0bc\0', 'a\0bc\0\0' -X RECORD `test`.`t_min` `PRIMARY` 2 -128, 0, -32768, 0, -8388608, 0, -2147483648, 0, -9223372036854775808, 0 -X RECORD `test`.`t_min` `PRIMARY` 2 -128, 0, -32768, 0, -8388608, 0, -2147483648, 0, -9223372036854775808, 0 -X RECORD `test`.`t_max` `PRIMARY` 2 127, 255, 32767, 65535, 8388607, 16777215, 2147483647, 4294967295, 9223372036854775807, 18446744073709551615 -X RECORD `test`.`t_max` `PRIMARY` 2 127, 255, 32767, 65535, 8388607, 16777215, 2147483647, 4294967295, 9223372036854775807, 18446744073709551615 -X RECORD `test`.```t'\"_str` `PRIMARY` 1 supremum pseudo-record -X RECORD `test`.```t'\"_str` `PRIMARY` 1 supremum pseudo-record -lock_table COUNT(*) -`test`.`t_max` 2 -`test`.`t_min` 2 -`test`.```t'\"_str` 10 -lock_table COUNT(*) -"test"."t_max" 2 -"test"."t_min" 2 -"test"."`t'\""_str" 10 diff --git a/storage/innodb_plugin/mysql-test/innodb_information_schema.test b/storage/innodb_plugin/mysql-test/innodb_information_schema.test deleted file mode 100644 index eaed653854a..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_information_schema.test +++ /dev/null @@ -1,145 +0,0 @@ -# -# Test that user data is correctly "visualized" in -# INFORMATION_SCHEMA.innodb_locks.lock_data -# - --- source include/have_innodb.inc - --- disable_query_log --- disable_result_log - -SET storage_engine=InnoDB; - --- disable_warnings -DROP TABLE IF EXISTS t_min, t_max; --- enable_warnings - -let $table_def = -( - c01 TINYINT, - c02 TINYINT UNSIGNED, - c03 SMALLINT, - c04 SMALLINT UNSIGNED, - c05 MEDIUMINT, - c06 MEDIUMINT UNSIGNED, - c07 INT, - c08 INT UNSIGNED, - c09 BIGINT, - c10 BIGINT UNSIGNED, - PRIMARY KEY(c01, c02, c03, c04, c05, c06, c07, c08, c09, c10) -); - --- eval CREATE TABLE t_min $table_def; -INSERT INTO t_min VALUES -(-128, 0, - -32768, 0, - -8388608, 0, - -2147483648, 0, - -9223372036854775808, 0); - --- eval CREATE TABLE t_max $table_def; -INSERT INTO t_max VALUES -(127, 255, - 32767, 65535, - 8388607, 16777215, - 2147483647, 4294967295, - 9223372036854775807, 18446744073709551615); - -CREATE TABLE ```t'\"_str` ( - c1 VARCHAR(32), - c2 VARCHAR(32), - c3 VARCHAR(32), - c4 VARCHAR(32), - c5 VARCHAR(32), - c6 VARCHAR(32), - c7 VARCHAR(32), - PRIMARY KEY(c1, c2, c3, c4, c5, c6, c7) -); -INSERT INTO ```t'\"_str` VALUES -('1', 'abc', '''abc', 'abc''', 'a''bc', 'a''bc''', '''abc'''''); -INSERT INTO ```t'\"_str` VALUES -('2', 'abc', '"abc', 'abc"', 'a"bc', 'a"bc"', '"abc""'); -INSERT INTO ```t'\"_str` VALUES -('3', 'abc', '\\abc', 'abc\\', 'a\\bc', 'a\\bc\\', '\\abc\\\\'); -INSERT INTO ```t'\"_str` VALUES -('4', 'abc', 0x00616263, 0x61626300, 0x61006263, 0x6100626300, 0x610062630000); - --- connect (con_lock,localhost,root,,) --- connect (con_min_trylock,localhost,root,,) --- connect (con_max_trylock,localhost,root,,) --- connect (con_str_insert_supremum,localhost,root,,) --- connect (con_str_lock_row1,localhost,root,,) --- connect (con_str_lock_row2,localhost,root,,) --- connect (con_str_lock_row3,localhost,root,,) --- connect (con_str_lock_row4,localhost,root,,) --- connect (con_verify_innodb_locks,localhost,root,,) - --- connection con_lock -SET autocommit=0; -SELECT * FROM t_min FOR UPDATE; -SELECT * FROM t_max FOR UPDATE; -SELECT * FROM ```t'\"_str` FOR UPDATE; - --- connection con_min_trylock --- send -SELECT * FROM t_min FOR UPDATE; - --- connection con_max_trylock --- send -SELECT * FROM t_max FOR UPDATE; - --- connection con_str_insert_supremum --- send -INSERT INTO ```t'\"_str` VALUES -('z', 'z', 'z', 'z', 'z', 'z', 'z'); - --- connection con_str_lock_row1 --- send -SELECT * FROM ```t'\"_str` WHERE c1 = '1' FOR UPDATE; - --- connection con_str_lock_row2 --- send -SELECT * FROM ```t'\"_str` WHERE c1 = '2' FOR UPDATE; - --- connection con_str_lock_row3 --- send -SELECT * FROM ```t'\"_str` WHERE c1 = '3' FOR UPDATE; - --- connection con_str_lock_row4 --- send -SELECT * FROM ```t'\"_str` WHERE c1 = '4' FOR UPDATE; - -# Give time to the above 2 queries to execute before continuing. -# Without this sleep it sometimes happens that the SELECT from innodb_locks -# executes before some of them, resulting in less than expected number -# of rows being selected from innodb_locks. --- sleep 0.1 - --- enable_result_log --- connection con_verify_innodb_locks -SELECT lock_mode, lock_type, lock_table, lock_index, lock_rec, lock_data -FROM INFORMATION_SCHEMA.INNODB_LOCKS ORDER BY lock_data; - -SELECT lock_table,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS -GROUP BY lock_table; - -set @save_sql_mode = @@sql_mode; -SET SQL_MODE='ANSI_QUOTES'; -SELECT lock_table,COUNT(*) FROM INFORMATION_SCHEMA.INNODB_LOCKS -GROUP BY lock_table; -SET @@sql_mode=@save_sql_mode; --- disable_result_log - --- connection default - --- disconnect con_lock --- disconnect con_min_trylock --- disconnect con_max_trylock --- disconnect con_str_insert_supremum --- disconnect con_str_lock_row1 --- disconnect con_str_lock_row2 --- disconnect con_str_lock_row3 --- disconnect con_str_lock_row4 --- disconnect con_verify_innodb_locks - -DROP TABLE t_min, t_max, ```t'\"_str`; diff --git a/storage/innodb_plugin/mysql-test/innodb_trx_weight.inc b/storage/innodb_plugin/mysql-test/innodb_trx_weight.inc deleted file mode 100644 index 56d3d47da36..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_trx_weight.inc +++ /dev/null @@ -1,51 +0,0 @@ --- connect (con1,localhost,root,,) --- connect (con2,localhost,root,,) - --- connection con1 -SET autocommit=0; -SELECT * FROM t1 FOR UPDATE; --- if ($con1_extra_sql_present) { - -- eval $con1_extra_sql --- } - --- connection con2 -SET autocommit=0; -SELECT * FROM t2 FOR UPDATE; --- if ($con2_extra_sql_present) { - -- eval $con2_extra_sql --- } - --- if ($con1_should_be_rolledback) { - -- connection con1 - -- send - INSERT INTO t2 VALUES (0); - - -- connection con2 - INSERT INTO t1 VALUES (0); - ROLLBACK; - - -- connection con1 - -- error ER_LOCK_DEADLOCK - -- reap --- } -# else --- if (!$con1_should_be_rolledback) { - -- connection con2 - -- send - INSERT INTO t1 VALUES (0); - - -- connection con1 - INSERT INTO t2 VALUES (0); - ROLLBACK; - - -- connection con2 - -- error ER_LOCK_DEADLOCK - -- reap --- } - --- connection default - -DELETE FROM t5_nontrans; - --- disconnect con1 --- disconnect con2 diff --git a/storage/innodb_plugin/mysql-test/innodb_trx_weight.result b/storage/innodb_plugin/mysql-test/innodb_trx_weight.result deleted file mode 100644 index 195775f74c8..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_trx_weight.result +++ /dev/null @@ -1 +0,0 @@ -SET storage_engine=InnoDB; diff --git a/storage/innodb_plugin/mysql-test/innodb_trx_weight.test b/storage/innodb_plugin/mysql-test/innodb_trx_weight.test deleted file mode 100644 index b72eaad345f..00000000000 --- a/storage/innodb_plugin/mysql-test/innodb_trx_weight.test +++ /dev/null @@ -1,108 +0,0 @@ -# -# Ensure that the number of locks (SELECT FOR UPDATE for example) is -# added to the number of altered rows when choosing the smallest -# transaction to kill as a victim when a deadlock is detected. -# Also transactions what had edited non-transactional tables should -# be heavier than ones that had not. -# - --- source include/have_innodb.inc - -SET storage_engine=InnoDB; - -# we do not really care about what gets printed, we are only -# interested in getting the deadlock resolved according to our -# expectations --- disable_query_log --- disable_result_log - -# we want to use "-- eval statement1; statement2" which does not work with -# prepared statements. Because this test should not behave differently with -# or without prepared statements we disable them so the test does not fail -# if someone runs ./mysql-test-run.pl --ps-protocol --- disable_ps_protocol - --- disable_warnings -DROP TABLE IF EXISTS t1, t2, t3, t4, t5_nontrans; --- enable_warnings - -# we will create a simple deadlock with t1, t2 and two connections -CREATE TABLE t1 (a INT); -CREATE TABLE t2 (a INT); - -# auxiliary table with a bulk of rows which will be locked by a -# transaction to increase its weight -CREATE TABLE t3 (a INT); - -# auxiliary empty table which will be inserted by a -# transaction to increase its weight -CREATE TABLE t4 (a INT); - -# auxiliary non-transactional table which will be edited by a -# transaction to tremendously increase its weight -CREATE TABLE t5_nontrans (a INT) ENGINE=MyISAM; - -INSERT INTO t1 VALUES (1); -INSERT INTO t2 VALUES (1); -# insert a lot of rows in t3 -INSERT INTO t3 VALUES (1); -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; -INSERT INTO t3 SELECT * FROM t3; - -# test locking weight - --- let $con1_extra_sql = --- let $con1_extra_sql_present = 0 --- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE --- let $con2_extra_sql_present = 1 --- let $con1_should_be_rolledback = 1 --- source include/innodb_trx_weight.inc - --- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1) --- let $con1_extra_sql_present = 1 --- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE --- let $con2_extra_sql_present = 1 --- let $con1_should_be_rolledback = 1 --- source include/innodb_trx_weight.inc - --- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1), (1), (1), (1) --- let $con1_extra_sql_present = 1 --- let $con2_extra_sql = SELECT * FROM t3 FOR UPDATE --- let $con2_extra_sql_present = 1 --- let $con1_should_be_rolledback = 0 --- source include/innodb_trx_weight.inc - -# test weight when non-transactional tables are edited - --- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1) --- let $con1_extra_sql_present = 1 --- let $con2_extra_sql = --- let $con2_extra_sql_present = 0 --- let $con1_should_be_rolledback = 0 --- source include/innodb_trx_weight.inc - --- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1) --- let $con1_extra_sql_present = 1 --- let $con2_extra_sql = INSERT INTO t5_nontrans VALUES (1) --- let $con2_extra_sql_present = 1 --- let $con1_should_be_rolledback = 1 --- source include/innodb_trx_weight.inc - --- let $con1_extra_sql = INSERT INTO t4 VALUES (1), (1), (1) --- let $con1_extra_sql = $con1_extra_sql; INSERT INTO t5_nontrans VALUES (1) --- let $con1_extra_sql_present = 1 --- let $con2_extra_sql = INSERT INTO t5_nontrans VALUES (1) --- let $con2_extra_sql_present = 1 --- let $con1_should_be_rolledback = 0 --- source include/innodb_trx_weight.inc - -DROP TABLE t1, t2, t3, t4, t5_nontrans; diff --git a/storage/innodb_plugin/mysql-test/patches/innodb-index.diff b/storage/innodb_plugin/mysql-test/patches/innodb-index.diff deleted file mode 100644 index 0b008c96f25..00000000000 --- a/storage/innodb_plugin/mysql-test/patches/innodb-index.diff +++ /dev/null @@ -1,62 +0,0 @@ -This part of the innodb-index test causes mysqld to print some warnings -and subsequently the whole mysql-test suite to fail. - -A permanent solution is probably to remove the printouts from the source -code or to somehow tell the mysql-test suite that warnings are expected. -Currently we simply do not execute the problematic tests. Please -coordinate a permanent solution with Marko, who added those tests. - -This cannot be proposed to MySQL because it touches files that are not -in the MySQL source repository. - -Index: storage/innobase/mysql-test/innodb-index.result -=================================================================== ---- storage/innobase/mysql-test/innodb-index.result (revision 2870) -+++ storage/innobase/mysql-test/innodb-index.result (working copy) -@@ -43,19 +43,12 @@ t1 CREATE TABLE `t1` ( - `b` int(11) DEFAULT NULL, - `c` char(10) NOT NULL, - `d` varchar(20) DEFAULT NULL, - KEY `d2` (`d`), - KEY `b` (`b`) - ) ENGINE=InnoDB DEFAULT CHARSET=latin1 --CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB; --alter table t1 add unique index (c), add index (d); --ERROR HY000: Table 'test.t1#1' already exists --rename table `t1#1` to `t1#2`; --alter table t1 add unique index (c), add index (d); --ERROR HY000: Table 'test.t1#2' already exists --drop table `t1#2`; - alter table t1 add unique index (c), add index (d); - show create table t1; - Table Create Table - t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, -Index: storage/innobase/mysql-test/innodb-index.test -=================================================================== ---- storage/innobase/mysql-test/innodb-index.test (revision 2870) -+++ storage/innobase/mysql-test/innodb-index.test (working copy) -@@ -14,22 +14,12 @@ select * from t1 force index (d2) order - --error ER_DUP_ENTRY - alter table t1 add unique index (b); - show create table t1; - alter table t1 add index (b); - show create table t1; - --# Check how existing tables interfere with temporary tables. --CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB; -- ----error 156 --alter table t1 add unique index (c), add index (d); --rename table `t1#1` to `t1#2`; ----error 156 --alter table t1 add unique index (c), add index (d); --drop table `t1#2`; -- - alter table t1 add unique index (c), add index (d); - show create table t1; - explain select * from t1 force index(c) order by c; - alter table t1 add primary key (a), drop index c; - show create table t1; - --error ER_MULTIPLE_PRI_KEY diff --git a/storage/innodb_plugin/os/os0file.c b/storage/innodb_plugin/os/os0file.c index 37edad442db..b244e3974b3 100644 --- a/storage/innodb_plugin/os/os0file.c +++ b/storage/innodb_plugin/os/os0file.c @@ -1,23 +1,6 @@ -/***************************************************************************** - -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA - -*****************************************************************************/ /*********************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2009, Percona Inc. Portions of this file contain modifications contributed and copyrighted @@ -806,7 +789,15 @@ next_file: #ifdef HAVE_READDIR_R ret = readdir_r(dir, (struct dirent*)dirent_buf, &ent); - if (ret != 0) { + if (ret != 0 +#ifdef UNIV_AIX + /* On AIX, only if we got non-NULL 'ent' (result) value and + a non-zero 'ret' (return) value, it indicates a failed + readdir_r() call. An NULL 'ent' with an non-zero 'ret' + would indicate the "end of the directory" is reached. */ + && ent != NULL +#endif + ) { fprintf(stderr, "InnoDB: cannot read directory %s, error %lu\n", dirname, (ulong)ret); @@ -3923,6 +3914,9 @@ os_aio_simulated_handle( ulint n; ulint i; + /* Fix compiler warning */ + *consecutive_ios = NULL; + segment = os_aio_get_array_and_local_segment(&array, global_segment); restart: diff --git a/storage/innodb_plugin/page/page0page.c b/storage/innodb_plugin/page/page0page.c index ab2ba60570e..10008f9ac25 100644 --- a/storage/innodb_plugin/page/page0page.c +++ b/storage/innodb_plugin/page/page0page.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -658,6 +658,14 @@ page_copy_rec_list_end( index, mtr); } + /* Update PAGE_MAX_TRX_ID on the uncompressed page. + Modifications will be redo logged and copied to the compressed + page in page_zip_compress() or page_zip_reorganize() below. */ + if (dict_index_is_sec_or_ibuf(index) && page_is_leaf(page)) { + page_update_max_trx_id(new_block, NULL, + page_get_max_trx_id(page), mtr); + } + if (UNIV_LIKELY_NULL(new_page_zip)) { mtr_set_log_mode(mtr, log_mode); @@ -696,15 +704,10 @@ page_copy_rec_list_end( } } - /* Update the lock table, MAX_TRX_ID, and possible hash index */ + /* Update the lock table and possible hash index */ lock_move_rec_list_end(new_block, block, rec); - if (dict_index_is_sec_or_ibuf(index) && page_is_leaf(page)) { - page_update_max_trx_id(new_block, new_page_zip, - page_get_max_trx_id(page), mtr); - } - btr_search_move_or_delete_hash_entries(new_block, block, index); return(ret); @@ -772,6 +775,16 @@ page_copy_rec_list_start( mem_heap_free(heap); } + /* Update PAGE_MAX_TRX_ID on the uncompressed page. + Modifications will be redo logged and copied to the compressed + page in page_zip_compress() or page_zip_reorganize() below. */ + if (dict_index_is_sec_or_ibuf(index) + && page_is_leaf(page_align(rec))) { + page_update_max_trx_id(new_block, NULL, + page_get_max_trx_id(page_align(rec)), + mtr); + } + if (UNIV_LIKELY_NULL(new_page_zip)) { mtr_set_log_mode(mtr, log_mode); @@ -809,14 +822,7 @@ page_copy_rec_list_start( } } - /* Update MAX_TRX_ID, the lock table, and possible hash index */ - - if (dict_index_is_sec_or_ibuf(index) - && page_is_leaf(page_align(rec))) { - page_update_max_trx_id(new_block, new_page_zip, - page_get_max_trx_id(page_align(rec)), - mtr); - } + /* Update the lock table and possible hash index */ lock_move_rec_list_start(new_block, block, rec, ret); @@ -2408,8 +2414,13 @@ page_validate( } offs = page_offset(rec_get_start(rec, offsets)); + i = rec_offs_size(offsets); + if (UNIV_UNLIKELY(offs + i >= UNIV_PAGE_SIZE)) { + fputs("InnoDB: record offset out of bounds\n", stderr); + goto func_exit; + } - for (i = rec_offs_size(offsets); i--; ) { + while (i--) { if (UNIV_UNLIKELY(buf[offs + i])) { /* No other record may overlap this */ @@ -2517,8 +2528,13 @@ n_owned_zero: count++; offs = page_offset(rec_get_start(rec, offsets)); + i = rec_offs_size(offsets); + if (UNIV_UNLIKELY(offs + i >= UNIV_PAGE_SIZE)) { + fputs("InnoDB: record offset out of bounds\n", stderr); + goto func_exit; + } - for (i = rec_offs_size(offsets); i--; ) { + while (i--) { if (UNIV_UNLIKELY(buf[offs + i])) { fputs("InnoDB: Record overlaps another" diff --git a/storage/innodb_plugin/plug.in.disabled b/storage/innodb_plugin/plug.in.disabled index 4ebde50cb35..e638332d74a 100644 --- a/storage/innodb_plugin/plug.in.disabled +++ b/storage/innodb_plugin/plug.in.disabled @@ -1,5 +1,5 @@ # -# Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved. +# Copyright (c) 2006, 2010, Innobase Oy. All Rights Reserved. # # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free Software @@ -15,7 +15,7 @@ # MYSQL_STORAGE_ENGINE(innodb_plugin,, [InnoDB Storage Engine], - [Transactional Tables using InnoDB],) + [Transactional Tables using InnoDB], [max,max-no-ndb]) MYSQL_PLUGIN_DIRECTORY(innodb_plugin, [storage/innodb_plugin]) MYSQL_PLUGIN_DYNAMIC(innodb_plugin, [ha_innodb_plugin.la]) MYSQL_PLUGIN_ACTIONS(innodb_plugin, [ diff --git a/storage/innodb_plugin/rem/rem0rec.c b/storage/innodb_plugin/rem/rem0rec.c index 1c8b3fd8c1e..37ba8ca2ffe 100644 --- a/storage/innodb_plugin/rem/rem0rec.c +++ b/storage/innodb_plugin/rem/rem0rec.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -212,6 +212,13 @@ rec_get_n_extern_new( const dict_col_t* col = dict_field_get_col(field); len = *lens--; + /* If the maximum length of the field is up + to 255 bytes, the actual length is always + stored in one byte. If the maximum length is + more than 255 bytes, the actual length is + stored in one byte for 0..127. The length + will be encoded in two bytes when it is 128 or + more, or when the field is stored externally. */ if (UNIV_UNLIKELY(col->len > 255) || UNIV_UNLIKELY(col->mtype == DATA_BLOB)) { if (len & 0x80) { @@ -294,6 +301,13 @@ rec_init_offsets_comp_ordinary( const dict_col_t* col = dict_field_get_col(field); len = *lens--; + /* If the maximum length of the field is up + to 255 bytes, the actual length is always + stored in one byte. If the maximum length is + more than 255 bytes, the actual length is + stored in one byte for 0..127. The length + will be encoded in two bytes when it is 128 or + more, or when the field is stored externally. */ if (UNIV_UNLIKELY(col->len > 255) || UNIV_UNLIKELY(col->mtype == DATA_BLOB)) { @@ -425,6 +439,15 @@ rec_init_offsets( const dict_col_t* col = dict_field_get_col(field); len = *lens--; + /* If the maximum length of the field + is up to 255 bytes, the actual length + is always stored in one byte. If the + maximum length is more than 255 bytes, + the actual length is stored in one + byte for 0..127. The length will be + encoded in two bytes when it is 128 or + more, or when the field is stored + externally. */ if (UNIV_UNLIKELY(col->len > 255) || UNIV_UNLIKELY(col->mtype == DATA_BLOB)) { @@ -647,6 +670,13 @@ rec_get_offsets_reverse( const dict_col_t* col = dict_field_get_col(field); len = *lens++; + /* If the maximum length of the field is up + to 255 bytes, the actual length is always + stored in one byte. If the maximum length is + more than 255 bytes, the actual length is + stored in one byte for 0..127. The length + will be encoded in two bytes when it is 128 or + more, or when the field is stored externally. */ if (UNIV_UNLIKELY(col->len > 255) || UNIV_UNLIKELY(col->mtype == DATA_BLOB)) { if (len & 0x80) { @@ -695,19 +725,9 @@ rec_get_nth_field_offs_old( ulint os; ulint next_os; - ut_ad(rec && len); - ut_ad(n < rec_get_n_fields_old(rec)); - - if (UNIV_UNLIKELY(n > REC_MAX_N_FIELDS)) { - fprintf(stderr, "Error: trying to access field %lu in rec\n", - (ulong) n); - ut_error; - } - - if (UNIV_UNLIKELY(rec == NULL)) { - fputs("Error: rec is NULL pointer\n", stderr); - ut_error; - } + ut_ad(len); + ut_a(rec); + ut_a(n < rec_get_n_fields_old(rec)); if (rec_get_1byte_offs_flag(rec)) { os = rec_1_get_field_start_offs(rec, n); @@ -791,12 +811,20 @@ rec_get_converted_size_comp_prefix( ut_ad(len <= col->len || col->mtype == DATA_BLOB); + /* If the maximum length of a variable-length field + is up to 255 bytes, the actual length is always stored + in one byte. If the maximum length is more than 255 + bytes, the actual length is stored in one byte for + 0..127. The length will be encoded in two bytes when + it is 128 or more, or when the field is stored externally. */ + if (field->fixed_len) { ut_ad(len == field->fixed_len); /* dict_index_add_col() should guarantee this */ ut_ad(!field->prefix_len || field->fixed_len == field->prefix_len); } else if (dfield_is_ext(&fields[i])) { + ut_ad(col->len >= 256 || col->mtype == DATA_BLOB); extra_size += 2; } else if (len < 128 || (col->len < 256 && col->mtype != DATA_BLOB)) { @@ -1096,6 +1124,8 @@ rec_convert_dtuple_to_rec_comp( /* Store the data and the offsets */ for (i = 0, field = fields; i < n_fields; i++, field++) { + const dict_field_t* ifield; + type = dfield_get_type(field); len = dfield_get_len(field); @@ -1130,12 +1160,20 @@ rec_convert_dtuple_to_rec_comp( /* only nullable fields can be null */ ut_ad(!dfield_is_null(field)); - fixed_len = dict_index_get_nth_field(index, i)->fixed_len; - + ifield = dict_index_get_nth_field(index, i); + fixed_len = ifield->fixed_len; + /* If the maximum length of a variable-length field + is up to 255 bytes, the actual length is always stored + in one byte. If the maximum length is more than 255 + bytes, the actual length is stored in one byte for + 0..127. The length will be encoded in two bytes when + it is 128 or more, or when the field is stored externally. */ if (fixed_len) { ut_ad(len == fixed_len); ut_ad(!dfield_is_ext(field)); } else if (dfield_is_ext(field)) { + ut_ad(ifield->col->len >= 256 + || ifield->col->mtype == DATA_BLOB); ut_ad(len <= REC_MAX_INDEX_COL_LEN + BTR_EXTERN_FIELD_REF_SIZE); *lens-- = (byte) (len >> 8) | 0xc0; @@ -1225,11 +1263,20 @@ rec_convert_dtuple_to_rec( mem_heap_t* heap = NULL; ulint offsets_[REC_OFFS_NORMAL_SIZE]; const ulint* offsets; + ulint i; rec_offs_init(offsets_); offsets = rec_get_offsets(rec, index, offsets_, ULINT_UNDEFINED, &heap); ut_ad(rec_validate(rec, offsets)); + ut_ad(dtuple_get_n_fields(dtuple) + == rec_offs_n_fields(offsets)); + + for (i = 0; i < rec_offs_n_fields(offsets); i++) { + ut_ad(!dfield_is_ext(dtuple_get_nth_field(dtuple, i)) + == !rec_offs_nth_extern(offsets, i)); + } + if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); } @@ -1412,6 +1459,13 @@ rec_copy_prefix_to_buf( prefix_len += field->fixed_len; } else { ulint len = *lens--; + /* If the maximum length of the column is up + to 255 bytes, the actual length is always + stored in one byte. If the maximum length is + more than 255 bytes, the actual length is + stored in one byte for 0..127. The length + will be encoded in two bytes when it is 128 or + more, or when the column is stored externally. */ if (col->len > 255 || col->mtype == DATA_BLOB) { if (len & 0x80) { /* 1exxxxxx */ diff --git a/storage/innodb_plugin/row/row0ins.c b/storage/innodb_plugin/row/row0ins.c index fe51fce82c4..230dc45dadc 100644 --- a/storage/innodb_plugin/row/row0ins.c +++ b/storage/innodb_plugin/row/row0ins.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1991,7 +1991,7 @@ row_ins_index_entry_low( btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE, mode | BTR_INSERT | ignore_sec_unique, - &cursor, 0, &mtr); + &cursor, 0, __FILE__, __LINE__, &mtr); if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) { /* The insertion was made to the insert buffer already during @@ -2049,7 +2049,8 @@ row_ins_index_entry_low( btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE, mode | BTR_INSERT, - &cursor, 0, &mtr); + &cursor, 0, + __FILE__, __LINE__, &mtr); } } @@ -2104,7 +2105,8 @@ function_exit: mtr_start(&mtr); btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE, - BTR_MODIFY_TREE, &cursor, 0, &mtr); + BTR_MODIFY_TREE, &cursor, 0, + __FILE__, __LINE__, &mtr); rec = btr_cur_get_rec(&cursor); offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap); diff --git a/storage/innodb_plugin/row/row0merge.c b/storage/innodb_plugin/row/row0merge.c index 25f041c0885..d61d626f92e 100644 --- a/storage/innodb_plugin/row/row0merge.c +++ b/storage/innodb_plugin/row/row0merge.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2005, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 2005, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -424,14 +424,13 @@ row_merge_dup_report( row_merge_dup_t* dup, /*!< in/out: for reporting duplicates */ const dfield_t* entry) /*!< in: duplicate index entry */ { - mrec_buf_t buf; + mrec_buf_t* buf; const dtuple_t* tuple; dtuple_t tuple_store; const rec_t* rec; const dict_index_t* index = dup->index; ulint n_fields= dict_index_get_n_fields(index); - mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; + mem_heap_t* heap; ulint* offsets; ulint n_ext; @@ -441,22 +440,22 @@ row_merge_dup_report( return; } - rec_offs_init(offsets_); - /* Convert the tuple to a record and then to MySQL format. */ + heap = mem_heap_create((1 + REC_OFFS_HEADER_SIZE + n_fields) + * sizeof *offsets + + sizeof *buf); + + buf = mem_heap_alloc(heap, sizeof *buf); tuple = dtuple_from_fields(&tuple_store, entry, n_fields); n_ext = dict_index_is_clust(index) ? dtuple_get_n_ext(tuple) : 0; - rec = rec_convert_dtuple_to_rec(buf, index, tuple, n_ext); - offsets = rec_get_offsets(rec, index, offsets_, ULINT_UNDEFINED, - &heap); + rec = rec_convert_dtuple_to_rec(*buf, index, tuple, n_ext); + offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap); innobase_rec_to_mysql(dup->table, rec, index, offsets); - if (UNIV_LIKELY_NULL(heap)) { - mem_heap_free(heap); - } + mem_heap_free(heap); } /*************************************************************//** @@ -627,22 +626,26 @@ row_merge_buf_write( } /******************************************************//** -Create a memory heap and allocate space for row_merge_rec_offsets(). +Create a memory heap and allocate space for row_merge_rec_offsets() +and mrec_buf_t[3]. @return memory heap */ static mem_heap_t* row_merge_heap_create( /*==================*/ const dict_index_t* index, /*!< in: record descriptor */ + mrec_buf_t** buf, /*!< out: 3 buffers */ ulint** offsets1, /*!< out: offsets */ ulint** offsets2) /*!< out: offsets */ { ulint i = 1 + REC_OFFS_HEADER_SIZE + dict_index_get_n_fields(index); - mem_heap_t* heap = mem_heap_create(2 * i * sizeof *offsets1); + mem_heap_t* heap = mem_heap_create(2 * i * sizeof **offsets1 + + 3 * sizeof **buf); - *offsets1 = mem_heap_alloc(heap, i * sizeof *offsets1); - *offsets2 = mem_heap_alloc(heap, i * sizeof *offsets2); + *buf = mem_heap_alloc(heap, 3 * sizeof **buf); + *offsets1 = mem_heap_alloc(heap, i * sizeof **offsets1); + *offsets2 = mem_heap_alloc(heap, i * sizeof **offsets2); (*offsets1)[0] = (*offsets2)[0] = i; (*offsets1)[1] = (*offsets2)[1] = dict_index_get_n_fields(index); @@ -1394,7 +1397,8 @@ row_merge_blocks( { mem_heap_t* heap; /*!< memory heap for offsets0, offsets1 */ - mrec_buf_t buf[3]; /*!< buffer for handling split mrec in block[] */ + mrec_buf_t* buf; /*!< buffer for handling + split mrec in block[] */ const byte* b0; /*!< pointer to block[0] */ const byte* b1; /*!< pointer to block[1] */ byte* b2; /*!< pointer to block[2] */ @@ -1414,7 +1418,7 @@ row_merge_blocks( } #endif /* UNIV_DEBUG */ - heap = row_merge_heap_create(index, &offsets0, &offsets1); + heap = row_merge_heap_create(index, &buf, &offsets0, &offsets1); /* Write a record and read the next record. Split the output file in two halves, which can be merged on the following pass. */ @@ -1500,7 +1504,7 @@ row_merge_blocks_copy( { mem_heap_t* heap; /*!< memory heap for offsets0, offsets1 */ - mrec_buf_t buf[3]; /*!< buffer for handling + mrec_buf_t* buf; /*!< buffer for handling split mrec in block[] */ const byte* b0; /*!< pointer to block[0] */ byte* b2; /*!< pointer to block[2] */ @@ -1518,7 +1522,7 @@ row_merge_blocks_copy( } #endif /* UNIV_DEBUG */ - heap = row_merge_heap_create(index, &offsets0, &offsets1); + heap = row_merge_heap_create(index, &buf, &offsets0, &offsets1); /* Write a record and read the next record. Split the output file in two halves, which can be merged on the following pass. */ @@ -1760,7 +1764,6 @@ row_merge_insert_index_tuples( int fd, /*!< in: file descriptor */ row_merge_block_t* block) /*!< in/out: file buffer */ { - mrec_buf_t buf; const byte* b; que_thr_t* thr; ins_node_t* node; @@ -1779,7 +1782,7 @@ row_merge_insert_index_tuples( trx->op_info = "inserting index entries"; - graph_heap = mem_heap_create(500); + graph_heap = mem_heap_create(500 + sizeof(mrec_buf_t)); node = ins_node_create(INS_DIRECT, table, graph_heap); thr = pars_complete_graph_for_exec(node, trx, graph_heap); @@ -1801,12 +1804,14 @@ row_merge_insert_index_tuples( if (!row_merge_read(fd, foffs, block)) { error = DB_CORRUPTION; } else { + mrec_buf_t* buf = mem_heap_alloc(graph_heap, sizeof *buf); + for (;;) { const mrec_t* mrec; dtuple_t* dtuple; ulint n_ext; - b = row_merge_read_rec(block, &buf, b, index, + b = row_merge_read_rec(block, buf, b, index, fd, &foffs, &mrec, offsets); if (UNIV_UNLIKELY(!b)) { /* End of list, or I/O error */ @@ -1977,14 +1982,12 @@ row_merge_drop_index( /* Drop the field definitions of the index. */ "DELETE FROM SYS_FIELDS WHERE INDEX_ID = :indexid;\n" /* Drop the index definition and the B-tree. */ - "DELETE FROM SYS_INDEXES WHERE ID = :indexid\n" - " AND TABLE_ID = :tableid;\n" + "DELETE FROM SYS_INDEXES WHERE ID = :indexid;\n" "END;\n"; ut_ad(index && table && trx); pars_info_add_dulint_literal(info, "indexid", index->id); - pars_info_add_dulint_literal(info, "tableid", table->id); trx_start_if_not_started(trx); trx->op_info = "dropping index"; @@ -2033,47 +2036,79 @@ row_merge_drop_temp_indexes(void) /*=============================*/ { trx_t* trx; - ulint err; - - /* We use the private SQL parser of Innobase to generate the - query graphs needed in deleting the dictionary data from system - tables in Innobase. Deleting a row from SYS_INDEXES table also - frees the file segments of the B-tree associated with the index. */ - static const char drop_temp_indexes[] = - "PROCEDURE DROP_TEMP_INDEXES_PROC () IS\n" - "indexid CHAR;\n" - "DECLARE CURSOR c IS SELECT ID FROM SYS_INDEXES\n" - "WHERE SUBSTR(NAME,0,1)='" TEMP_INDEX_PREFIX_STR "';\n" - "BEGIN\n" - "\tOPEN c;\n" - "\tWHILE 1=1 LOOP\n" - "\t\tFETCH c INTO indexid;\n" - "\t\tIF (SQL % NOTFOUND) THEN\n" - "\t\t\tEXIT;\n" - "\t\tEND IF;\n" - "\t\tDELETE FROM SYS_FIELDS WHERE INDEX_ID = indexid;\n" - "\t\tDELETE FROM SYS_INDEXES WHERE ID = indexid;\n" - "\tEND LOOP;\n" - "\tCLOSE c;\n" - "\tCOMMIT WORK;\n" - "END;\n"; + btr_pcur_t pcur; + mtr_t mtr; + /* Load the table definitions that contain partially defined + indexes, so that the data dictionary information can be checked + when accessing the tablename.ibd files. */ trx = trx_allocate_for_background(); trx->op_info = "dropping partially created indexes"; row_mysql_lock_data_dictionary(trx); - /* Incomplete transactions may be holding some locks on the - data dictionary tables. However, they should never have been - able to lock the records corresponding to the partially - created indexes that we are attempting to delete, because the - table was locked when the indexes were being created. We will - drop the partially created indexes before the rollback of - incomplete transactions is initiated. Thus, this should not - interfere with the incomplete transactions. */ - trx->isolation_level = TRX_ISO_READ_UNCOMMITTED; - err = que_eval_sql(NULL, drop_temp_indexes, FALSE, trx); - ut_a(err == DB_SUCCESS); + mtr_start(&mtr); + + btr_pcur_open_at_index_side( + TRUE, + dict_table_get_first_index(dict_sys->sys_indexes), + BTR_SEARCH_LEAF, &pcur, TRUE, &mtr); + + for (;;) { + const rec_t* rec; + const byte* field; + ulint len; + dulint table_id; + dict_table_t* table; + btr_pcur_move_to_next_user_rec(&pcur, &mtr); + + if (!btr_pcur_is_on_user_rec(&pcur)) { + break; + } + + rec = btr_pcur_get_rec(&pcur); + field = rec_get_nth_field_old(rec, DICT_SYS_INDEXES_NAME_FIELD, + &len); + if (len == UNIV_SQL_NULL || len == 0 + || (char) *field != TEMP_INDEX_PREFIX) { + continue; + } + + /* This is a temporary index. */ + + field = rec_get_nth_field_old(rec, 0/*TABLE_ID*/, &len); + if (len != 8) { + /* Corrupted TABLE_ID */ + continue; + } + + table_id = mach_read_from_8(field); + + btr_pcur_store_position(&pcur, &mtr); + btr_pcur_commit_specify_mtr(&pcur, &mtr); + + table = dict_load_table_on_id(table_id); + + if (table) { + dict_index_t* index; + + for (index = dict_table_get_first_index(table); + index; index = dict_table_get_next_index(index)) { + + if (*index->name == TEMP_INDEX_PREFIX) { + row_merge_drop_index(index, table, trx); + trx_commit_for_mysql(trx); + } + } + } + + mtr_start(&mtr); + btr_pcur_restore_position(BTR_SEARCH_LEAF, + &pcur, &mtr); + } + + btr_pcur_close(&pcur); + mtr_commit(&mtr); row_mysql_unlock_data_dictionary(trx); trx_free_for_background(trx); } diff --git a/storage/innodb_plugin/row/row0mysql.c b/storage/innodb_plugin/row/row0mysql.c index 181c39de881..24abf8067f2 100644 --- a/storage/innodb_plugin/row/row0mysql.c +++ b/storage/innodb_plugin/row/row0mysql.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2000, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 2000, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -485,7 +485,7 @@ next_column: /****************************************************************//** Handles user errors and lock waits detected by the database engine. @return TRUE if it was a lock wait and we should continue running the -query thread */ +query thread and in that case the thr is ALREADY in the running state. */ UNIV_INTERN ibool row_mysql_handle_errors( @@ -1458,7 +1458,7 @@ row_unlock_for_mysql( if (UNIV_UNLIKELY (!srv_locks_unsafe_for_binlog - && trx->isolation_level != TRX_ISO_READ_COMMITTED)) { + && trx->isolation_level > TRX_ISO_READ_COMMITTED)) { fprintf(stderr, "InnoDB: Error: calling row_unlock_for_mysql though\n" @@ -3255,19 +3255,13 @@ check_next_foreign: "END;\n" , FALSE, trx); - if (err != DB_SUCCESS) { - ut_a(err == DB_OUT_OF_FILE_SPACE); - - err = DB_MUST_GET_MORE_FILE_SPACE; - - row_mysql_handle_errors(&err, trx, NULL, NULL); - - ut_error; - } else { - ibool is_path; + switch (err) { + ibool is_temp; const char* name_or_path; mem_heap_t* heap; + case DB_SUCCESS: + heap = mem_heap_create(200); /* Clone the name, in case it has been allocated @@ -3277,12 +3271,13 @@ check_next_foreign: space_id = table->space; if (table->dir_path_of_temp_table != NULL) { - is_path = TRUE; name_or_path = mem_heap_strdup( heap, table->dir_path_of_temp_table); + is_temp = TRUE; } else { - is_path = FALSE; name_or_path = name; + is_temp = (table->flags >> DICT_TF2_SHIFT) + & DICT_TF2_TEMPORARY; } dict_table_remove_from_cache(table); @@ -3302,8 +3297,8 @@ check_next_foreign: if (err == DB_SUCCESS && space_id > 0) { if (!fil_space_for_table_exists_in_mem(space_id, name_or_path, - is_path, - FALSE, TRUE)) { + is_temp, FALSE, + !is_temp)) { err = DB_SUCCESS; fprintf(stderr, @@ -3332,7 +3327,27 @@ check_next_foreign: } mem_heap_free(heap); + break; + + case DB_TOO_MANY_CONCURRENT_TRXS: + /* Cannot even find a free slot for the + the undo log. We can directly exit here + and return the DB_TOO_MANY_CONCURRENT_TRXS + error. */ + break; + + case DB_OUT_OF_FILE_SPACE: + err = DB_MUST_GET_MORE_FILE_SPACE; + + row_mysql_handle_errors(&err, trx, NULL, NULL); + + /* Fall through to raise error */ + + default: + /* No other possible error returns */ + ut_error; } + funct_exit: if (locked_dictionary) { @@ -3348,6 +3363,90 @@ funct_exit: return((int) err); } +/*********************************************************************//** +Drop all temporary tables during crash recovery. */ +UNIV_INTERN +void +row_mysql_drop_temp_tables(void) +/*============================*/ +{ + trx_t* trx; + btr_pcur_t pcur; + mtr_t mtr; + mem_heap_t* heap; + + trx = trx_allocate_for_background(); + trx->op_info = "dropping temporary tables"; + row_mysql_lock_data_dictionary(trx); + + heap = mem_heap_create(200); + + mtr_start(&mtr); + + btr_pcur_open_at_index_side( + TRUE, + dict_table_get_first_index(dict_sys->sys_tables), + BTR_SEARCH_LEAF, &pcur, TRUE, &mtr); + + for (;;) { + const rec_t* rec; + const byte* field; + ulint len; + const char* table_name; + dict_table_t* table; + + btr_pcur_move_to_next_user_rec(&pcur, &mtr); + + if (!btr_pcur_is_on_user_rec(&pcur)) { + break; + } + + rec = btr_pcur_get_rec(&pcur); + field = rec_get_nth_field_old(rec, 4/*N_COLS*/, &len); + if (len != 4 || !(mach_read_from_4(field) & 0x80000000UL)) { + continue; + } + + /* Because this is not a ROW_FORMAT=REDUNDANT table, + the is_temp flag is valid. Examine it. */ + + field = rec_get_nth_field_old(rec, 7/*MIX_LEN*/, &len); + if (len != 4 + || !(mach_read_from_4(field) & DICT_TF2_TEMPORARY)) { + continue; + } + + /* This is a temporary table. */ + field = rec_get_nth_field_old(rec, 0/*NAME*/, &len); + if (len == UNIV_SQL_NULL || len == 0) { + /* Corrupted SYS_TABLES.NAME */ + continue; + } + + table_name = mem_heap_strdupl(heap, (const char*) field, len); + + btr_pcur_store_position(&pcur, &mtr); + btr_pcur_commit_specify_mtr(&pcur, &mtr); + + table = dict_load_table(table_name); + + if (table) { + row_drop_table_for_mysql(table_name, trx, FALSE); + trx_commit_for_mysql(trx); + } + + mtr_start(&mtr); + btr_pcur_restore_position(BTR_SEARCH_LEAF, + &pcur, &mtr); + } + + btr_pcur_close(&pcur); + mtr_commit(&mtr); + mem_heap_free(heap); + row_mysql_unlock_data_dictionary(trx); + trx_free_for_background(trx); +} + /*******************************************************************//** Drop all foreign keys in a database, see Bug#18942. Called at the end of row_drop_database_for_mysql(). @@ -3899,14 +3998,15 @@ Checks that the index contains entries in an ascending order, unique constraint is not broken, and calculates the number of index entries in the read view of the current transaction. @return TRUE if ok */ -static +UNIV_INTERN ibool -row_scan_and_check_index( -/*=====================*/ - row_prebuilt_t* prebuilt, /*!< in: prebuilt struct in MySQL */ - dict_index_t* index, /*!< in: index */ - ulint* n_rows) /*!< out: number of entries seen in the - current consistent read */ +row_check_index_for_mysql( +/*======================*/ + row_prebuilt_t* prebuilt, /*!< in: prebuilt struct + in MySQL handle */ + const dict_index_t* index, /*!< in: index */ + ulint* n_rows) /*!< out: number of entries + seen in the consistent read */ { dtuple_t* prev_entry = NULL; ulint matched_fields; @@ -3927,31 +4027,9 @@ row_scan_and_check_index( *n_rows = 0; - if (!row_merge_is_index_usable(prebuilt->trx, index)) { - /* A newly created index may lack some delete-marked - records that may exist in the read view of - prebuilt->trx. Thus, such indexes must not be - accessed by consistent read. */ - return(is_ok); - } - buf = mem_alloc(UNIV_PAGE_SIZE); heap = mem_heap_create(100); - /* Make a dummy template in prebuilt, which we will use - in scanning the index entries */ - - prebuilt->index = index; - /* row_merge_is_index_usable() was already checked above. */ - prebuilt->index_usable = TRUE; - prebuilt->sql_stat_start = TRUE; - prebuilt->template_type = ROW_MYSQL_DUMMY_TEMPLATE; - prebuilt->n_template = 0; - prebuilt->need_to_access_clustered = FALSE; - - dtuple_set_n_fields(prebuilt->search_tuple, 0); - - prebuilt->select_lock_type = LOCK_NONE; cnt = 1000; ret = row_search_for_mysql(buf, PAGE_CUR_G, prebuilt, 0, 0); @@ -4070,119 +4148,6 @@ not_ok: } /*********************************************************************//** -Checks a table for corruption. -@return DB_ERROR or DB_SUCCESS */ -UNIV_INTERN -ulint -row_check_table_for_mysql( -/*======================*/ - row_prebuilt_t* prebuilt) /*!< in: prebuilt struct in MySQL - handle */ -{ - dict_table_t* table = prebuilt->table; - dict_index_t* index; - ulint n_rows; - ulint n_rows_in_table = ULINT_UNDEFINED; - ulint ret = DB_SUCCESS; - ulint old_isolation_level; - - if (table->ibd_file_missing) { - ut_print_timestamp(stderr); - fprintf(stderr, " InnoDB: Error:\n" - "InnoDB: MySQL is trying to use a table handle" - " but the .ibd file for\n" - "InnoDB: table %s does not exist.\n" - "InnoDB: Have you deleted the .ibd file" - " from the database directory under\n" - "InnoDB: the MySQL datadir, or have you" - " used DISCARD TABLESPACE?\n" - "InnoDB: Look from\n" - "InnoDB: " REFMAN "innodb-troubleshooting.html\n" - "InnoDB: how you can resolve the problem.\n", - table->name); - return(DB_ERROR); - } - - prebuilt->trx->op_info = "checking table"; - - old_isolation_level = prebuilt->trx->isolation_level; - - /* We must run the index record counts at an isolation level - >= READ COMMITTED, because a dirty read can see a wrong number - of records in some index; to play safe, we use always - REPEATABLE READ here */ - - prebuilt->trx->isolation_level = TRX_ISO_REPEATABLE_READ; - - /* Enlarge the fatal lock wait timeout during CHECK TABLE. */ - mutex_enter(&kernel_mutex); - srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */ - mutex_exit(&kernel_mutex); - - index = dict_table_get_first_index(table); - - while (index != NULL) { - /* fputs("Validating index ", stderr); - ut_print_name(stderr, trx, FALSE, index->name); - putc('\n', stderr); */ - - if (!btr_validate_index(index, prebuilt->trx)) { - ret = DB_ERROR; - } else { - if (!row_scan_and_check_index(prebuilt,index, &n_rows)){ - ret = DB_ERROR; - } - - if (trx_is_interrupted(prebuilt->trx)) { - ret = DB_INTERRUPTED; - break; - } - - /* fprintf(stderr, "%lu entries in index %s\n", n_rows, - index->name); */ - - if (index == dict_table_get_first_index(table)) { - n_rows_in_table = n_rows; - } else if (n_rows != n_rows_in_table) { - - ret = DB_ERROR; - - fputs("Error: ", stderr); - dict_index_name_print(stderr, - prebuilt->trx, index); - fprintf(stderr, - " contains %lu entries," - " should be %lu\n", - (ulong) n_rows, - (ulong) n_rows_in_table); - } - } - - index = dict_table_get_next_index(index); - } - - /* Restore the original isolation level */ - prebuilt->trx->isolation_level = old_isolation_level; - - /* We validate also the whole adaptive hash index for all tables - at every CHECK TABLE */ - - if (!btr_search_validate()) { - - ret = DB_ERROR; - } - - /* Restore the fatal lock wait timeout after CHECK TABLE. */ - mutex_enter(&kernel_mutex); - srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */ - mutex_exit(&kernel_mutex); - - prebuilt->trx->op_info = ""; - - return(ret); -} - -/*********************************************************************//** Determines if a table is a magic monitor table. @return TRUE if monitor table */ UNIV_INTERN diff --git a/storage/innodb_plugin/row/row0row.c b/storage/innodb_plugin/row/row0row.c index 128ac3ba3e8..cb7dfa2b7c9 100644 --- a/storage/innodb_plugin/row/row0row.c +++ b/storage/innodb_plugin/row/row0row.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -915,6 +915,10 @@ row_raw_format( ret = row_raw_format_int(data, data_len, prtype, buf, buf_size, &format_in_hex); + if (format_in_hex) { + + goto format_in_hex; + } break; case DATA_CHAR: case DATA_VARCHAR: @@ -923,14 +927,15 @@ row_raw_format( ret = row_raw_format_str(data, data_len, prtype, buf, buf_size, &format_in_hex); + if (format_in_hex) { + + goto format_in_hex; + } + break; /* XXX support more data types */ default: - - format_in_hex = TRUE; - } - - if (format_in_hex) { + format_in_hex: if (UNIV_LIKELY(buf_size > 2)) { diff --git a/storage/innodb_plugin/row/row0sel.c b/storage/innodb_plugin/row/row0sel.c index 3ef9726588e..d0702a0cd2f 100644 --- a/storage/innodb_plugin/row/row0sel.c +++ b/storage/innodb_plugin/row/row0sel.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -132,7 +132,8 @@ index record. NOTE: the comparison is NOT done as a binary comparison, but character fields are compared with collation! @return TRUE if the secondary record is equal to the corresponding -fields in the clustered record, when compared with collation */ +fields in the clustered record, when compared with collation; +FALSE if not equal or if the clustered record has been marked for deletion */ static ibool row_sel_sec_rec_is_for_clust_rec( @@ -431,10 +432,6 @@ row_sel_fetch_columns( data = rec_get_nth_field(rec, offsets, field_no, &len); - if (len == UNIV_SQL_NULL) { - len = UNIV_SQL_NULL; - } - needs_copy = column->copy_val; } @@ -855,7 +852,7 @@ row_sel_get_clust_rec( trx = thr_get_trx(thr); if (srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) { + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) { lock_type = LOCK_REC_NOT_GAP; } else { lock_type = LOCK_ORDINARY; @@ -1468,7 +1465,7 @@ rec_loop: if (srv_locks_unsafe_for_binlog || trx->isolation_level - == TRX_ISO_READ_COMMITTED) { + <= TRX_ISO_READ_COMMITTED) { if (page_rec_is_supremum(next_rec)) { @@ -1525,7 +1522,7 @@ skip_lock: trx = thr_get_trx(thr); if (srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) { + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) { if (page_rec_is_supremum(rec)) { @@ -2170,36 +2167,6 @@ row_fetch_print( return((void*)42); } -/****************************************************************//** -Callback function for fetch that stores an unsigned 4 byte integer to the -location pointed. The column's type must be DATA_INT, DATA_UNSIGNED, length -= 4. -@return always returns NULL */ -UNIV_INTERN -void* -row_fetch_store_uint4( -/*==================*/ - void* row, /*!< in: sel_node_t* */ - void* user_arg) /*!< in: data pointer */ -{ - sel_node_t* node = row; - ib_uint32_t* val = user_arg; - ulint tmp; - - dfield_t* dfield = que_node_get_val(node->select_list); - const dtype_t* type = dfield_get_type(dfield); - ulint len = dfield_get_len(dfield); - - ut_a(dtype_get_mtype(type) == DATA_INT); - ut_a(dtype_get_prtype(type) & DATA_UNSIGNED); - ut_a(len == 4); - - tmp = mach_read_from_4(dfield_get_data(dfield)); - *val = (ib_uint32_t) tmp; - - return(NULL); -} - /***********************************************************//** Prints a row in a select result. @return query thread to run next or NULL */ @@ -2981,6 +2948,7 @@ row_sel_get_clust_rec_for_mysql( if (clust_rec && (old_vers + || trx->isolation_level <= TRX_ISO_READ_UNCOMMITTED || rec_get_deleted_flag(rec, dict_table_is_comp( sec_index->table))) && !row_sel_sec_rec_is_for_clust_rec( @@ -3202,14 +3170,17 @@ row_sel_try_search_shortcut_for_mysql( ut_ad(dict_index_is_clust(index)); ut_ad(!prebuilt->templ_contains_blob); +#ifndef UNIV_SEARCH_DEBUG btr_pcur_open_with_no_init(index, search_tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, pcur, -#ifndef UNIV_SEARCH_DEBUG RW_S_LATCH, -#else + mtr); +#else /* UNIV_SEARCH_DEBUG */ + btr_pcur_open_with_no_init(index, search_tuple, PAGE_CUR_GE, + BTR_SEARCH_LEAF, pcur, 0, -#endif mtr); +#endif /* UNIV_SEARCH_DEBUG */ rec = btr_pcur_get_rec(pcur); if (!page_rec_is_user_rec(rec)) { @@ -3694,7 +3665,7 @@ shortcut_fails_too_big_rec: && !page_rec_is_supremum(rec) && set_also_gap_locks && !(srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) && prebuilt->select_lock_type != LOCK_NONE) { /* Try to place a gap lock on the next index record @@ -3790,7 +3761,7 @@ rec_loop: if (set_also_gap_locks && !(srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) && prebuilt->select_lock_type != LOCK_NONE) { /* Try to place a lock on the index record */ @@ -3924,7 +3895,7 @@ wrong_offs: if (set_also_gap_locks && !(srv_locks_unsafe_for_binlog || trx->isolation_level - == TRX_ISO_READ_COMMITTED) + <= TRX_ISO_READ_COMMITTED) && prebuilt->select_lock_type != LOCK_NONE) { /* Try to place a gap lock on the index @@ -3960,7 +3931,7 @@ wrong_offs: if (set_also_gap_locks && !(srv_locks_unsafe_for_binlog || trx->isolation_level - == TRX_ISO_READ_COMMITTED) + <= TRX_ISO_READ_COMMITTED) && prebuilt->select_lock_type != LOCK_NONE) { /* Try to place a gap lock on the index @@ -4008,7 +3979,7 @@ wrong_offs: if (!set_also_gap_locks || srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED + || trx->isolation_level <= TRX_ISO_READ_COMMITTED || (unique_search && !UNIV_UNLIKELY(rec_get_deleted_flag(rec, comp)))) { @@ -4047,7 +4018,7 @@ no_gap_lock: const rec_t* old_vers; case DB_SUCCESS: if (srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) { + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) { /* Note that a record of prebuilt->index was locked. */ prebuilt->new_rec_locks = 1; @@ -4056,6 +4027,7 @@ no_gap_lock: case DB_LOCK_WAIT: if (UNIV_LIKELY(prebuilt->row_read_type != ROW_READ_TRY_SEMI_CONSISTENT) + || unique_search || index != clust_index) { goto lock_wait_or_error; @@ -4179,7 +4151,7 @@ no_gap_lock: /* The record is delete-marked: we can skip it */ if ((srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) && prebuilt->select_lock_type != LOCK_NONE && !did_semi_consistent_read) { @@ -4246,7 +4218,7 @@ requires_clust_rec: } if ((srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) && prebuilt->select_lock_type != LOCK_NONE) { /* Note that both the secondary index record and the clustered index record were locked. */ @@ -4259,7 +4231,7 @@ requires_clust_rec: /* The record is delete marked: we can skip it */ if ((srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) && prebuilt->select_lock_type != LOCK_NONE) { /* No need to keep a lock on a delete-marked @@ -4470,7 +4442,7 @@ lock_wait_or_error: moves_up, &mtr); if ((srv_locks_unsafe_for_binlog - || trx->isolation_level == TRX_ISO_READ_COMMITTED) + || trx->isolation_level <= TRX_ISO_READ_COMMITTED) && !same_user_rec) { /* Since we were not able to restore the cursor @@ -4616,6 +4588,7 @@ row_search_autoinc_read_column( dict_index_t* index, /*!< in: index to read from */ const rec_t* rec, /*!< in: current rec */ ulint col_no, /*!< in: column number */ + ulint mtype, /*!< in: column main type */ ibool unsigned_type) /*!< in: signed or unsigned flag */ { ulint len; @@ -4632,10 +4605,26 @@ row_search_autoinc_read_column( data = rec_get_nth_field(rec, offsets, col_no, &len); ut_a(len != UNIV_SQL_NULL); - ut_a(len <= sizeof value); - /* we assume AUTOINC value cannot be negative */ - value = mach_read_int_type(data, len, unsigned_type); + switch (mtype) { + case DATA_INT: + ut_a(len <= sizeof value); + value = mach_read_int_type(data, len, unsigned_type); + break; + + case DATA_FLOAT: + ut_a(len == sizeof(float)); + value = (ib_uint64_t) mach_float_read(data); + break; + + case DATA_DOUBLE: + ut_a(len == sizeof(double)); + value = (ib_uint64_t) mach_double_read(data); + break; + + default: + ut_error; + } if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); @@ -4721,7 +4710,8 @@ row_search_max_autoinc( dfield->col->prtype & DATA_UNSIGNED); *value = row_search_autoinc_read_column( - index, rec, i, unsigned_type); + index, rec, i, + dfield->col->mtype, unsigned_type); } } diff --git a/storage/innodb_plugin/row/row0umod.c b/storage/innodb_plugin/row/row0umod.c index 6be475d8c78..e7245dbee41 100644 --- a/storage/innodb_plugin/row/row0umod.c +++ b/storage/innodb_plugin/row/row0umod.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -144,13 +144,17 @@ row_undo_mod_clust_low( /***********************************************************//** Removes a clustered index record after undo if possible. +This is attempted when the record was inserted by updating a +delete-marked record and there no longer exist transactions +that would see the delete-marked record. In other words, we +roll back the insert by purging the record. @return DB_SUCCESS, DB_FAIL, or error code: we may run out of file space */ static ulint row_undo_mod_remove_clust_low( /*==========================*/ undo_node_t* node, /*!< in: row undo node */ - que_thr_t* thr __attribute__((unused)), /*!< in: query thread */ + que_thr_t* thr, /*!< in: query thread */ mtr_t* mtr, /*!< in: mtr */ ulint mode) /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE */ { @@ -159,6 +163,7 @@ row_undo_mod_remove_clust_low( ulint err; ibool success; + ut_ad(node->rec_type == TRX_UNDO_UPD_DEL_REC); pcur = &(node->pcur); btr_cur = btr_pcur_get_btr_cur(pcur); @@ -190,11 +195,13 @@ row_undo_mod_remove_clust_low( } else { ut_ad(mode == BTR_MODIFY_TREE); - /* Note that since this operation is analogous to purge, - we can free also inherited externally stored fields: - hence the RB_NONE in the call below */ + /* This operation is analogous to purge, we can free also + inherited externally stored fields */ - btr_cur_pessimistic_delete(&err, FALSE, btr_cur, RB_NONE, mtr); + btr_cur_pessimistic_delete(&err, FALSE, btr_cur, + thr_is_recv(thr) + ? RB_RECOVERY_PURGE_REC + : RB_NONE, mtr); /* The delete operation may fail if we have little file space left: TODO: easiest to crash the database @@ -370,10 +377,11 @@ row_undo_mod_del_mark_or_remove_sec_low( } else { ut_ad(mode == BTR_MODIFY_TREE); - /* No need to distinguish RB_RECOVERY here, because we - are deleting a secondary index record: the distinction - between RB_NORMAL and RB_RECOVERY only matters when - deleting a record that contains externally stored + /* No need to distinguish RB_RECOVERY_PURGE here, + because we are deleting a secondary index record: + the distinction between RB_NORMAL and + RB_RECOVERY_PURGE only matters when deleting a + record that contains externally stored columns. */ ut_ad(!dict_index_is_clust(index)); btr_cur_pessimistic_delete(&err, FALSE, btr_cur, @@ -438,7 +446,7 @@ row_undo_mod_del_unmark_sec_and_undo_update( BTR_MODIFY_TREE */ que_thr_t* thr, /*!< in: query thread */ dict_index_t* index, /*!< in: index */ - dtuple_t* entry) /*!< in: index entry */ + const dtuple_t* entry) /*!< in: index entry */ { mem_heap_t* heap; btr_pcur_t pcur; @@ -533,6 +541,7 @@ row_undo_mod_upd_del_sec( dict_index_t* index; ulint err = DB_SUCCESS; + ut_ad(node->rec_type == TRX_UNDO_UPD_DEL_REC); heap = mem_heap_create(1024); while (node->index != NULL) { @@ -550,7 +559,7 @@ row_undo_mod_upd_del_sec( does not exist. However, this situation may only occur during the rollback of incomplete transactions. */ - ut_a(trx_is_recv(thr_get_trx(thr))); + ut_a(thr_is_recv(thr)); } else { err = row_undo_mod_del_mark_or_remove_sec( node, thr, index, entry); diff --git a/storage/innodb_plugin/row/row0upd.c b/storage/innodb_plugin/row/row0upd.c index 58dfd43ead9..95d1d00aeef 100644 --- a/storage/innodb_plugin/row/row0upd.c +++ b/storage/innodb_plugin/row/row0upd.c @@ -1344,9 +1344,6 @@ row_upd_copy_columns( data = rec_get_nth_field(rec, offsets, column->field_nos[SYM_CLUST_FIELD_NO], &len); - if (len == UNIV_SQL_NULL) { - len = UNIV_SQL_NULL; - } eval_node_copy_and_alloc_val(column, data, len); column = UT_LIST_GET_NEXT(col_var_list, column); diff --git a/storage/innodb_plugin/srv/srv0srv.c b/storage/innodb_plugin/srv/srv0srv.c index 639da1ed2f3..63c355cea32 100644 --- a/storage/innodb_plugin/srv/srv0srv.c +++ b/storage/innodb_plugin/srv/srv0srv.c @@ -1,7 +1,8 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2008, 2009 Google Inc. +Copyright (c) 2009, Percona Inc. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -9,6 +10,13 @@ briefly in the InnoDB documentation. The contributions by Google are incorporated with their permission, and subject to the conditions contained in the file COPYING.Google. +Portions of this file contain modifications contributed and copyrighted +by Percona Inc.. Those modifications are +gratefully acknowledged and are described briefly in the InnoDB +documentation. The contributions by Percona Inc. are incorporated with +their permission, and subject to the conditions contained in the file +COPYING.Percona. + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. @@ -22,32 +30,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ -/*********************************************************************** - -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. -Copyright (c) 2009, Percona Inc. - -Portions of this file contain modifications contributed and copyrighted -by Percona Inc.. Those modifications are -gratefully acknowledged and are described briefly in the InnoDB -documentation. The contributions by Percona Inc. are incorporated with -their permission, and subject to the conditions contained in the file -COPYING.Percona. - -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -***********************************************************************/ /**************************************************//** @file srv/srv0srv.c @@ -119,7 +101,8 @@ UNIV_INTERN ulint srv_fatal_semaphore_wait_threshold = 600; in microseconds, in order to reduce the lagging of the purge thread. */ UNIV_INTERN ulint srv_dml_needed_delay = 0; -UNIV_INTERN ibool srv_lock_timeout_and_monitor_active = FALSE; +UNIV_INTERN ibool srv_lock_timeout_active = FALSE; +UNIV_INTERN ibool srv_monitor_active = FALSE; UNIV_INTERN ibool srv_error_monitor_active = FALSE; UNIV_INTERN const char* srv_main_thread_op_info = ""; @@ -188,7 +171,17 @@ UNIV_INTERN ulong srv_flush_log_at_trx_commit = 1; the checkpoints. */ UNIV_INTERN char srv_adaptive_flushing = TRUE; -/* The sort order table of the MySQL latin1_swedish_ci character set +/** Maximum number of times allowed to conditionally acquire +mutex before switching to blocking wait on the mutex */ +#define MAX_MUTEX_NOWAIT 20 + +/** Check whether the number of failed nonblocking mutex +acquisition attempts exceeds maximum allowed value. If so, +srv_printf_innodb_monitor() will request mutex acquisition +with mutex_enter(), which will wait until it gets the mutex. */ +#define MUTEX_NOWAIT(mutex_skipped) ((mutex_skipped) < MAX_MUTEX_NOWAIT) + +/** The sort order table of the MySQL latin1_swedish_ci character set collation */ UNIV_INTERN const byte* srv_latin1_ordering; @@ -1616,8 +1609,9 @@ srv_suspend_mysql_thread( innodb_lock_wait_timeout, because trx->mysql_thd == NULL. */ lock_wait_timeout = thd_lock_wait_timeout(trx->mysql_thd); - if (lock_wait_timeout < 100000000 - && wait_time > (double) lock_wait_timeout) { + if (trx_is_interrupted(trx) + || (lock_wait_timeout < 100000000 + && wait_time > (double) lock_wait_timeout)) { trx->error_state = DB_LOCK_WAIT_TIMEOUT; } @@ -1683,12 +1677,15 @@ srv_refresh_innodb_monitor_stats(void) } /******************************************************************//** -Outputs to a file the output of the InnoDB Monitor. */ +Outputs to a file the output of the InnoDB Monitor. +@return FALSE if not all information printed +due to failure to obtain necessary mutex */ UNIV_INTERN -void +ibool srv_printf_innodb_monitor( /*======================*/ FILE* file, /*!< in: output stream */ + ibool nowait, /*!< in: whether to wait for kernel mutex */ ulint* trx_start, /*!< out: file position of the start of the list of active transactions */ ulint* trx_end) /*!< out: file position of the end of @@ -1697,6 +1694,7 @@ srv_printf_innodb_monitor( double time_elapsed; time_t current_time; ulint n_reserved; + ibool ret; mutex_enter(&srv_innodb_monitor_mutex); @@ -1720,9 +1718,9 @@ srv_printf_innodb_monitor( "Per second averages calculated from the last %lu seconds\n", (ulong)time_elapsed); - fputs("----------\n" - "BACKGROUND THREAD\n" - "----------\n", file); + fputs("-----------------\n" + "BACKGROUND THREAD\n" + "-----------------\n", file); srv_print_master_thread_info(file); fputs("----------\n" @@ -1746,24 +1744,31 @@ srv_printf_innodb_monitor( mutex_exit(&dict_foreign_err_mutex); - lock_print_info_summary(file); - if (trx_start) { - long t = ftell(file); - if (t < 0) { - *trx_start = ULINT_UNDEFINED; - } else { - *trx_start = (ulint) t; + /* Only if lock_print_info_summary proceeds correctly, + before we call the lock_print_info_all_transactions + to print all the lock information. */ + ret = lock_print_info_summary(file, nowait); + + if (ret) { + if (trx_start) { + long t = ftell(file); + if (t < 0) { + *trx_start = ULINT_UNDEFINED; + } else { + *trx_start = (ulint) t; + } } - } - lock_print_info_all_transactions(file); - if (trx_end) { - long t = ftell(file); - if (t < 0) { - *trx_end = ULINT_UNDEFINED; - } else { - *trx_end = (ulint) t; + lock_print_info_all_transactions(file); + if (trx_end) { + long t = ftell(file); + if (t < 0) { + *trx_end = ULINT_UNDEFINED; + } else { + *trx_end = (ulint) t; + } } } + fputs("--------\n" "FILE I/O\n" "--------\n", file); @@ -1861,6 +1866,8 @@ srv_printf_innodb_monitor( "============================\n", file); mutex_exit(&srv_innodb_monitor_mutex); fflush(file); + + return(ret); } /******************************************************************//** @@ -1948,26 +1955,23 @@ srv_export_innodb_status(void) } /*********************************************************************//** -A thread which wakes up threads whose lock wait may have lasted too long. -This also prints the info output by various InnoDB monitors. +A thread which prints the info output by various InnoDB monitors. @return a dummy parameter */ UNIV_INTERN os_thread_ret_t -srv_lock_timeout_and_monitor_thread( -/*================================*/ +srv_monitor_thread( +/*===============*/ void* arg __attribute__((unused))) /*!< in: a dummy parameter required by os_thread_create */ { - srv_slot_t* slot; double time_elapsed; time_t current_time; time_t last_table_monitor_time; time_t last_tablespace_monitor_time; time_t last_monitor_time; - ibool some_waits; - double wait_time; - ulint i; + ulint mutex_skipped; + ibool last_srv_print_monitor; #ifdef UNIV_DEBUG_THREAD_CREATION fprintf(stderr, "Lock timeout thread starts, id %lu\n", @@ -1978,13 +1982,15 @@ srv_lock_timeout_and_monitor_thread( last_table_monitor_time = time(NULL); last_tablespace_monitor_time = time(NULL); last_monitor_time = time(NULL); + mutex_skipped = 0; + last_srv_print_monitor = srv_print_innodb_monitor; loop: - srv_lock_timeout_and_monitor_active = TRUE; + srv_monitor_active = TRUE; - /* When someone is waiting for a lock, we wake up every second - and check if a timeout has passed for a lock wait */ + /* Wake up every 5 seconds to see if we need to print + monitor information. */ - os_thread_sleep(1000000); + os_thread_sleep(5000000); current_time = time(NULL); @@ -1994,14 +2000,40 @@ loop: last_monitor_time = time(NULL); if (srv_print_innodb_monitor) { - srv_printf_innodb_monitor(stderr, NULL, NULL); + /* Reset mutex_skipped counter everytime + srv_print_innodb_monitor changes. This is to + ensure we will not be blocked by kernel_mutex + for short duration information printing, + such as requested by sync_array_print_long_waits() */ + if (!last_srv_print_monitor) { + mutex_skipped = 0; + last_srv_print_monitor = TRUE; + } + + if (!srv_printf_innodb_monitor(stderr, + MUTEX_NOWAIT(mutex_skipped), + NULL, NULL)) { + mutex_skipped++; + } else { + /* Reset the counter */ + mutex_skipped = 0; + } + } else { + last_srv_print_monitor = FALSE; } + if (srv_innodb_status) { mutex_enter(&srv_monitor_file_mutex); rewind(srv_monitor_file); - srv_printf_innodb_monitor(srv_monitor_file, NULL, - NULL); + if (!srv_printf_innodb_monitor(srv_monitor_file, + MUTEX_NOWAIT(mutex_skipped), + NULL, NULL)) { + mutex_skipped++; + } else { + mutex_skipped = 0; + } + os_file_set_eof(srv_monitor_file); mutex_exit(&srv_monitor_file_mutex); } @@ -2054,6 +2086,56 @@ loop: } } + if (srv_shutdown_state >= SRV_SHUTDOWN_CLEANUP) { + goto exit_func; + } + + if (srv_print_innodb_monitor + || srv_print_innodb_lock_monitor + || srv_print_innodb_tablespace_monitor + || srv_print_innodb_table_monitor) { + goto loop; + } + + srv_monitor_active = FALSE; + + goto loop; + +exit_func: + srv_monitor_active = FALSE; + + /* We count the number of threads in os_thread_exit(). A created + thread should always use that to exit and not use return() to exit. */ + + os_thread_exit(NULL); + + OS_THREAD_DUMMY_RETURN; +} + +/*********************************************************************//** +A thread which wakes up threads whose lock wait may have lasted too long. +@return a dummy parameter */ +UNIV_INTERN +os_thread_ret_t +srv_lock_timeout_thread( +/*====================*/ + void* arg __attribute__((unused))) + /* in: a dummy parameter required by + os_thread_create */ +{ + srv_slot_t* slot; + ibool some_waits; + double wait_time; + ulint i; + +loop: + /* When someone is waiting for a lock, we wake up every second + and check if a timeout has passed for a lock wait */ + + os_thread_sleep(1000000); + + srv_lock_timeout_active = TRUE; + mutex_enter(&kernel_mutex); some_waits = FALSE; @@ -2077,9 +2159,10 @@ loop: lock_wait_timeout = thd_lock_wait_timeout( trx->mysql_thd); - if (lock_wait_timeout < 100000000 - && (wait_time > (double) lock_wait_timeout - || wait_time < 0)) { + if (trx_is_interrupted(trx) + || (lock_wait_timeout < 100000000 + && (wait_time > (double) lock_wait_timeout + || wait_time < 0))) { /* Timeout exceeded or a wrap-around in system time counter: cancel the lock request queued @@ -2104,17 +2187,11 @@ loop: goto exit_func; } - if (some_waits || srv_print_innodb_monitor - || srv_print_innodb_lock_monitor - || srv_print_innodb_tablespace_monitor - || srv_print_innodb_table_monitor) { + if (some_waits) { goto loop; } - /* No one was waiting for a lock and no monitor was active: - suspend this thread */ - - srv_lock_timeout_and_monitor_active = FALSE; + srv_lock_timeout_active = FALSE; #if 0 /* The following synchronisation is disabled, since @@ -2124,7 +2201,7 @@ loop: goto loop; exit_func: - srv_lock_timeout_and_monitor_active = FALSE; + srv_lock_timeout_active = FALSE; /* We count the number of threads in os_thread_exit(). A created thread should always use that to exit and not use return() to exit. */ @@ -2449,7 +2526,10 @@ loop: BUF_FLUSH_LIST, n_flush, IB_ULONGLONG_MAX); - skip_sleep = TRUE; + + if (n_flush == PCT_IO(100)) { + skip_sleep = TRUE; + } } } diff --git a/storage/innodb_plugin/srv/srv0start.c b/storage/innodb_plugin/srv/srv0start.c index d5f6120ca31..e517b9a86b0 100644 --- a/storage/innodb_plugin/srv/srv0start.c +++ b/storage/innodb_plugin/srv/srv0start.c @@ -1,7 +1,8 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2008, Google Inc. +Copyright (c) 2009, Percona Inc. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -9,6 +10,13 @@ briefly in the InnoDB documentation. The contributions by Google are incorporated with their permission, and subject to the conditions contained in the file COPYING.Google. +Portions of this file contain modifications contributed and copyrighted +by Percona Inc.. Those modifications are +gratefully acknowledged and are described briefly in the InnoDB +documentation. The contributions by Percona Inc. are incorporated with +their permission, and subject to the conditions contained in the file +COPYING.Percona. + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. @@ -22,32 +30,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ -/*********************************************************************** - -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. -Copyright (c) 2009, Percona Inc. - -Portions of this file contain modifications contributed and copyrighted -by Percona Inc.. Those modifications are -gratefully acknowledged and are described briefly in the InnoDB -documentation. The contributions by Percona Inc. are incorporated with -their permission, and subject to the conditions contained in the file -COPYING.Percona. - -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -***********************************************************************/ /********************************************************************//** @file srv/srv0start.c @@ -105,6 +87,7 @@ Created 2/16/1996 Heikki Tuuri # include "btr0pcur.h" # include "thr0loc.h" # include "os0sync.h" /* for INNODB_RW_LOCKS_USE_ATOMICS */ +# include "zlib.h" /* for ZLIB_VERSION */ /** Log sequence number immediately after startup */ UNIV_INTERN ib_uint64_t srv_start_lsn; @@ -143,9 +126,9 @@ static mutex_t ios_mutex; static ulint ios; /** io_handler_thread parameters for thread identification */ -static ulint n[SRV_MAX_N_IO_THREADS + 5]; +static ulint n[SRV_MAX_N_IO_THREADS + 6]; /** io_handler_thread identifiers */ -static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 5]; +static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 6]; /** We use this mutex to test the return value of pthread_mutex_trylock on successful locking. HP-UX does NOT return 0, though Linux et al do. */ @@ -1074,7 +1057,11 @@ innobase_start_or_create_for_mysql(void) #ifdef UNIV_IBUF_DEBUG fprintf(stderr, "InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n" - "InnoDB: Crash recovery will fail with UNIV_IBUF_DEBUG\n"); +# ifdef UNIV_IBUF_COUNT_DEBUG + "InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on !!!!!!!!!\n" + "InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n" +# endif + ); #endif #ifdef UNIV_SYNC_DEBUG @@ -1101,7 +1088,15 @@ innobase_start_or_create_for_mysql(void) "InnoDB: The InnoDB memory heap is disabled\n"); } - fprintf(stderr, "InnoDB: %s\n", IB_ATOMICS_STARTUP_MSG); + fputs("InnoDB: " IB_ATOMICS_STARTUP_MSG + "\nInnoDB: Compressed tables use zlib " ZLIB_VERSION +#ifdef UNIV_ZIP_DEBUG + " with validation" +#endif /* UNIV_ZIP_DEBUG */ +#ifdef UNIV_ZIP_COPY + " and extra copying" +#endif /* UNIV_ZIP_COPY */ + "\n" , stderr); /* Since InnoDB does not currently clean up all its internal data structures in MySQL Embedded Server Library server_end(), we @@ -1575,6 +1570,14 @@ innobase_start_or_create_for_mysql(void) dict_boot(); trx_sys_init_at_db_start(); + /* Initialize the fsp free limit global variable in the log + system */ + fsp_header_get_free_limit(); + + /* recv_recovery_from_checkpoint_finish needs trx lists which + are initialized in trx_sys_init_at_db_start(). */ + + recv_recovery_from_checkpoint_finish(); if (srv_force_recovery < SRV_FORCE_NO_IBUF_MERGE) { /* The following call is necessary for the insert buffer to work with multiple tablespaces. We must @@ -1590,26 +1593,14 @@ innobase_start_or_create_for_mysql(void) every table in the InnoDB data dictionary that has an .ibd file. - We also determine the maximum tablespace id used. - - TODO: We may have incomplete transactions in the - data dictionary tables. Does that harm the scanning of - the data dictionary below? */ + We also determine the maximum tablespace id used. */ dict_check_tablespaces_and_store_max_id( recv_needed_recovery); } srv_startup_is_before_trx_rollback_phase = FALSE; - - /* Initialize the fsp free limit global variable in the log - system */ - fsp_header_get_free_limit(); - - /* recv_recovery_from_checkpoint_finish needs trx lists which - are initialized in trx_sys_init_at_db_start(). */ - - recv_recovery_from_checkpoint_finish(); + recv_recovery_rollback_active(); /* It is possible that file_format tag has never been set. In this case we initialize it to minimum @@ -1658,15 +1649,18 @@ innobase_start_or_create_for_mysql(void) /* fprintf(stderr, "Max allowed record size %lu\n", page_get_free_space_of_empty() / 2); */ - /* Create the thread which watches the timeouts for lock waits - and prints InnoDB monitor info */ - - os_thread_create(&srv_lock_timeout_and_monitor_thread, NULL, + /* Create the thread which watches the timeouts for lock waits */ + os_thread_create(&srv_lock_timeout_thread, NULL, thread_ids + 2 + SRV_MAX_N_IO_THREADS); /* Create the thread which warns of long semaphore waits */ os_thread_create(&srv_error_monitor_thread, NULL, thread_ids + 3 + SRV_MAX_N_IO_THREADS); + + /* Create the thread which prints InnoDB monitor info */ + os_thread_create(&srv_monitor_thread, NULL, + thread_ids + 4 + SRV_MAX_N_IO_THREADS); + srv_is_being_started = FALSE; if (trx_doublewrite == NULL) { diff --git a/storage/innodb_plugin/sync/sync0sync.c b/storage/innodb_plugin/sync/sync0sync.c index 569fc6328c4..2be9d667705 100644 --- a/storage/innodb_plugin/sync/sync0sync.c +++ b/storage/innodb_plugin/sync/sync0sync.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -315,6 +315,15 @@ mutex_free( ut_a(mutex_get_lock_word(mutex) == 0); ut_a(mutex_get_waiters(mutex) == 0); +#ifdef UNIV_MEM_DEBUG + if (mutex == &mem_hash_mutex) { + ut_ad(UT_LIST_GET_LEN(mutex_list) == 1); + ut_ad(UT_LIST_GET_FIRST(mutex_list) == &mem_hash_mutex); + UT_LIST_REMOVE(list, mutex_list, mutex); + goto func_exit; + } +#endif /* UNIV_MEM_DEBUG */ + if (mutex != &mutex_list_mutex #ifdef UNIV_SYNC_DEBUG && mutex != &sync_thread_mutex @@ -336,7 +345,9 @@ mutex_free( } os_event_free(mutex->event); - +#ifdef UNIV_MEM_DEBUG +func_exit: +#endif /* UNIV_MEM_DEBUG */ #if !defined(HAVE_ATOMIC_BUILTINS) os_fast_mutex_free(&(mutex->os_fast_mutex)); #endif @@ -947,12 +958,62 @@ sync_thread_levels_contain( } /******************************************************************//** +Checks if the level array for the current thread contains a +mutex or rw-latch at the specified level. +@return a matching latch, or NULL if not found */ +UNIV_INTERN +void* +sync_thread_levels_contains( +/*========================*/ + ulint level) /*!< in: latching order level + (SYNC_DICT, ...)*/ +{ + sync_level_t* arr; + sync_thread_t* thread_slot; + sync_level_t* slot; + ulint i; + + if (!sync_order_checks_on) { + + return(NULL); + } + + mutex_enter(&sync_thread_mutex); + + thread_slot = sync_thread_level_arrays_find_slot(); + + if (thread_slot == NULL) { + + mutex_exit(&sync_thread_mutex); + + return(NULL); + } + + arr = thread_slot->levels; + + for (i = 0; i < SYNC_THREAD_N_LEVELS; i++) { + + slot = sync_thread_levels_get_nth(arr, i); + + if (slot->latch != NULL && slot->level == level) { + + mutex_exit(&sync_thread_mutex); + return(slot->latch); + } + } + + mutex_exit(&sync_thread_mutex); + + return(NULL); +} + +/******************************************************************//** Checks that the level array for the current thread is empty. -@return TRUE if empty except the exceptions specified below */ +@return a latch, or NULL if empty except the exceptions specified below */ UNIV_INTERN -ibool -sync_thread_levels_empty_gen( -/*=========================*/ +void* +sync_thread_levels_nonempty_gen( +/*============================*/ ibool dict_mutex_allowed) /*!< in: TRUE if dictionary mutex is allowed to be owned by the thread, also purge_is_running mutex is @@ -965,7 +1026,7 @@ sync_thread_levels_empty_gen( if (!sync_order_checks_on) { - return(TRUE); + return(NULL); } mutex_enter(&sync_thread_mutex); @@ -976,7 +1037,7 @@ sync_thread_levels_empty_gen( mutex_exit(&sync_thread_mutex); - return(TRUE); + return(NULL); } arr = thread_slot->levels; @@ -993,13 +1054,13 @@ sync_thread_levels_empty_gen( mutex_exit(&sync_thread_mutex); ut_error; - return(FALSE); + return(slot->latch); } } mutex_exit(&sync_thread_mutex); - return(TRUE); + return(NULL); } /******************************************************************//** @@ -1370,6 +1431,12 @@ sync_close(void) mutex = UT_LIST_GET_FIRST(mutex_list); while (mutex) { +#ifdef UNIV_MEM_DEBUG + if (mutex == &mem_hash_mutex) { + mutex = UT_LIST_GET_NEXT(list, mutex); + continue; + } +#endif /* UNIV_MEM_DEBUG */ mutex_free(mutex); mutex = UT_LIST_GET_FIRST(mutex_list); } diff --git a/storage/innodb_plugin/trx/trx0i_s.c b/storage/innodb_plugin/trx/trx0i_s.c index 1b20eaabf42..c160eb2942a 100644 --- a/storage/innodb_plugin/trx/trx0i_s.c +++ b/storage/innodb_plugin/trx/trx0i_s.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2007, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 2007, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -28,11 +28,18 @@ table cache" for later retrieval. Created July 17, 2007 Vasil Dimov *******************************************************/ +/* Found during the build of 5.5.3 on Linux 2.4 and early 2.6 kernels: + The includes "univ.i" -> "my_global.h" cause a different path + to be taken further down with pthread functions and types, + so they must come first. + From the symptoms, this is related to bug#46587 in the MySQL bug DB. +*/ +#include "univ.i" + #include <mysql/plugin.h> #include "mysql_addons.h" -#include "univ.i" #include "buf0buf.h" #include "dict0dict.h" #include "ha0storage.h" diff --git a/storage/innodb_plugin/trx/trx0rec.c b/storage/innodb_plugin/trx/trx0rec.c index 5097cf18dcd..f50e10ed756 100644 --- a/storage/innodb_plugin/trx/trx0rec.c +++ b/storage/innodb_plugin/trx/trx0rec.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -350,8 +350,13 @@ trx_undo_rec_get_col_val( ut_ad(*orig_len >= BTR_EXTERN_FIELD_REF_SIZE); ut_ad(*len > *orig_len); - ut_ad(*len >= REC_MAX_INDEX_COL_LEN + /* @see dtuple_convert_big_rec() */ + ut_ad(*len >= BTR_EXTERN_FIELD_REF_SIZE * 2); + /* we do not have access to index->table here + ut_ad(dict_table_get_format(index->table) >= DICT_TF_FORMAT_ZIP + || *len >= REC_MAX_INDEX_COL_LEN + BTR_EXTERN_FIELD_REF_SIZE); + */ *len += UNIV_EXTERN_STORAGE_FIELD; break; @@ -977,6 +982,7 @@ trx_undo_update_rec_get_update( fprintf(stderr, "\n" "InnoDB: n_fields = %lu, i = %lu, ptr %p\n", (ulong) n_fields, (ulong) i, ptr); + *upd = NULL; return(NULL); } @@ -1074,11 +1080,15 @@ trx_undo_rec_get_partial_row( /* If the prefix of this column is indexed, ensure that enough prefix is stored in the undo log record. */ - ut_a(ignore_prefix - || !col->ord_part - || dfield_get_len(dfield) - >= REC_MAX_INDEX_COL_LEN - + BTR_EXTERN_FIELD_REF_SIZE); + if (!ignore_prefix && col->ord_part) { + ut_a(dfield_get_len(dfield) + >= 2 * BTR_EXTERN_FIELD_REF_SIZE); + ut_a(dict_table_get_format(index->table) + >= DICT_TF_FORMAT_ZIP + || dfield_get_len(dfield) + >= REC_MAX_INDEX_COL_LEN + + BTR_EXTERN_FIELD_REF_SIZE); + } } } diff --git a/storage/innodb_plugin/trx/trx0rseg.c b/storage/innodb_plugin/trx/trx0rseg.c index 8d754788e2a..36dea9b2a95 100644 --- a/storage/innodb_plugin/trx/trx0rseg.c +++ b/storage/innodb_plugin/trx/trx0rseg.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -286,39 +286,3 @@ trx_rseg_list_and_array_init( } } } - -/****************************************************************//** -Creates a new rollback segment to the database. -@return the created segment object, NULL if fail */ -UNIV_INTERN -trx_rseg_t* -trx_rseg_create( -/*============*/ - ulint space, /*!< in: space id */ - ulint max_size, /*!< in: max size in pages */ - ulint* id, /*!< out: rseg id */ - mtr_t* mtr) /*!< in: mtr */ -{ - ulint flags; - ulint zip_size; - ulint page_no; - trx_rseg_t* rseg; - - mtr_x_lock(fil_space_get_latch(space, &flags), mtr); - zip_size = dict_table_flags_to_zip_size(flags); - mutex_enter(&kernel_mutex); - - page_no = trx_rseg_header_create(space, zip_size, max_size, id, mtr); - - if (page_no == FIL_NULL) { - - mutex_exit(&kernel_mutex); - return(NULL); - } - - rseg = trx_rseg_mem_create(*id, space, zip_size, page_no, mtr); - - mutex_exit(&kernel_mutex); - - return(rseg); -} diff --git a/storage/innodb_plugin/trx/trx0sys.c b/storage/innodb_plugin/trx/trx0sys.c index 79e5af1c677..410c55f132d 100644 --- a/storage/innodb_plugin/trx/trx0sys.c +++ b/storage/innodb_plugin/trx/trx0sys.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -584,8 +584,8 @@ trx_sys_doublewrite_init_or_restore_pages( " recover the database" " with the my.cnf\n" "InnoDB: option:\n" - "InnoDB: set-variable=" - "innodb_force_recovery=6\n"); + "InnoDB:" + " innodb_force_recovery=6\n"); exit(1); } @@ -1535,6 +1535,7 @@ trx_sys_file_format_id_to_name( #endif /* !UNIV_HOTBACKUP */ +#ifndef UNIV_HOTBACKUP /********************************************************************* Shutdown/Close the transaction system. */ UNIV_INTERN @@ -1611,3 +1612,4 @@ trx_sys_close(void) trx_sys = NULL; mutex_exit(&kernel_mutex); } +#endif /* !UNIV_HOTBACKUP */ diff --git a/storage/innodb_plugin/trx/trx0trx.c b/storage/innodb_plugin/trx/trx0trx.c index 0951b98b79f..6ef7e62e6ae 100644 --- a/storage/innodb_plugin/trx/trx0trx.c +++ b/storage/innodb_plugin/trx/trx0trx.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -425,6 +425,7 @@ trx_lists_init_at_db_start(void) trx_undo_t* undo; trx_t* trx; + ut_ad(mutex_own(&kernel_mutex)); UT_LIST_INIT(trx_sys->trx_list); /* Look from the rollback segments if there exist undo logs for @@ -842,7 +843,7 @@ trx_commit_off_kernel( recovery i.e.: back ground rollback thread is still active then there is a chance that the rollback thread may see this trx as COMMITTED_IN_MEMORY and goes adhead to clean it - up calling trx_cleanup_at_db_startup(). This can happen + up calling trx_cleanup_at_db_startup(). This can happen in the case we are committing a trx here that is left in PREPARED state during the crash. Note that commit of the rollback of a PREPARED trx happens in the recovery thread diff --git a/storage/innodb_plugin/ut/ut0rbt.c b/storage/innodb_plugin/ut/ut0rbt.c new file mode 100644 index 00000000000..3d7bc91e714 --- /dev/null +++ b/storage/innodb_plugin/ut/ut0rbt.c @@ -0,0 +1,1249 @@ +/***************************************************************************** + +Copyright (c) 2006, 2009, Innobase Oy. All Rights Reserved. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; version 2 of the License. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA + +*****************************************************************************/ + +/*******************************************************************//** +@file ut/ut0rbt.c +Red-Black tree implementation + +Created 2007-03-20 Sunny Bains +***********************************************************************/ + +#include "ut0rbt.h" + +/************************************************************************ +Definition of a red-black tree +============================== + +A red-black tree is a binary search tree which has the following +red-black properties: + + 1. Every node is either red or black. + 2. Every leaf (NULL - in our case tree->nil) is black. + 3. If a node is red, then both its children are black. + 4. Every simple path from a node to a descendant leaf contains the + same number of black nodes. + + from (3) above, the implication is that on any path from the root + to a leaf, red nodes must not be adjacent. + + However, any number of black nodes may appear in a sequence. */ + +#if defined(IB_RBT_TESTING) +#warning "Testing enabled!" +#endif + +#define ROOT(t) (t->root->left) +#define SIZEOF_NODE(t) ((sizeof(ib_rbt_node_t) + t->sizeof_value) - 1) + +/****************************************************************//** +Print out the sub-tree recursively. */ +static +void +rbt_print_subtree( +/*==============*/ + const ib_rbt_t* tree, /*!< in: tree to traverse */ + const ib_rbt_node_t* node, /*!< in: node to print */ + ib_rbt_print_node print) /*!< in: print key function */ +{ + /* FIXME: Doesn't do anything yet */ + if (node != tree->nil) { + print(node); + rbt_print_subtree(tree, node->left, print); + rbt_print_subtree(tree, node->right, print); + } +} + +/****************************************************************//** +Verify that the keys are in order. +@return TRUE of OK. FALSE if not ordered */ +static +ibool +rbt_check_ordering( +/*===============*/ + const ib_rbt_t* tree) /*!< in: tree to verfify */ +{ + const ib_rbt_node_t* node; + const ib_rbt_node_t* prev = NULL; + + /* Iterate over all the nodes, comparing each node with the prev */ + for (node = rbt_first(tree); node; node = rbt_next(tree, prev)) { + + if (prev && tree->compare(prev->value, node->value) >= 0) { + return(FALSE); + } + + prev = node; + } + + return(TRUE); +} + +/****************************************************************//** +Check that every path from the root to the leaves has the same count. +Count is expressed in the number of black nodes. +@return 0 on failure else black height of the subtree */ +static +ibool +rbt_count_black_nodes( +/*==================*/ + const ib_rbt_t* tree, /*!< in: tree to verify */ + const ib_rbt_node_t* node) /*!< in: start of sub-tree */ +{ + ulint result; + + if (node != tree->nil) { + ulint left_height = rbt_count_black_nodes(tree, node->left); + + ulint right_height = rbt_count_black_nodes(tree, node->right); + + if (left_height == 0 + || right_height == 0 + || left_height != right_height) { + + result = 0; + } else if (node->color == IB_RBT_RED) { + + /* Case 3 */ + if (node->left->color != IB_RBT_BLACK + || node->right->color != IB_RBT_BLACK) { + + result = 0; + } else { + result = left_height; + } + /* Check if it's anything other than RED or BLACK. */ + } else if (node->color != IB_RBT_BLACK) { + + result = 0; + } else { + + result = right_height + 1; + } + } else { + result = 1; + } + + return(result); +} + +/****************************************************************//** +Turn the node's right child's left sub-tree into node's right sub-tree. +This will also make node's right child it's parent. */ +static +void +rbt_rotate_left( +/*============*/ + const ib_rbt_node_t* nil, /*!< in: nil node of the tree */ + ib_rbt_node_t* node) /*!< in: node to rotate */ +{ + ib_rbt_node_t* right = node->right; + + node->right = right->left; + + if (right->left != nil) { + right->left->parent = node; + } + + /* Right's new parent was node's parent. */ + right->parent = node->parent; + + /* Since root's parent is tree->nil and root->parent->left points + back to root, we can avoid the check. */ + if (node == node->parent->left) { + /* Node was on the left of its parent. */ + node->parent->left = right; + } else { + /* Node must have been on the right. */ + node->parent->right = right; + } + + /* Finally, put node on right's left. */ + right->left = node; + node->parent = right; +} + +/****************************************************************//** +Turn the node's left child's right sub-tree into node's left sub-tree. +This also make node's left child it's parent. */ +static +void +rbt_rotate_right( +/*=============*/ + const ib_rbt_node_t* nil, /*!< in: nil node of tree */ + ib_rbt_node_t* node) /*!< in: node to rotate */ +{ + ib_rbt_node_t* left = node->left; + + node->left = left->right; + + if (left->right != nil) { + left->right->parent = node; + } + + /* Left's new parent was node's parent. */ + left->parent = node->parent; + + /* Since root's parent is tree->nil and root->parent->left points + back to root, we can avoid the check. */ + if (node == node->parent->right) { + /* Node was on the left of its parent. */ + node->parent->right = left; + } else { + /* Node must have been on the left. */ + node->parent->left = left; + } + + /* Finally, put node on left's right. */ + left->right = node; + node->parent = left; +} + +/****************************************************************//** +Append a node to the tree. +@return inserted node */ +static +ib_rbt_node_t* +rbt_tree_add_child( +/*===============*/ + const ib_rbt_t* tree, /*!< in: rbt tree */ + ib_rbt_bound_t* parent, /*!< in: node's parent */ + ib_rbt_node_t* node) /*!< in: node to add */ +{ + /* Cast away the const. */ + ib_rbt_node_t* last = (ib_rbt_node_t*) parent->last; + + if (last == tree->root || parent->result < 0) { + last->left = node; + } else { + /* FIXME: We don't handle duplicates (yet)! */ + ut_a(parent->result != 0); + + last->right = node; + } + + node->parent = last; + + return(node); +} + +/****************************************************************//** +Generic binary tree insert +@return inserted node */ +static +ib_rbt_node_t* +rbt_tree_insert( +/*============*/ + ib_rbt_t* tree, /*!< in: rb tree */ + const void* key, /*!< in: key for ordering */ + ib_rbt_node_t* node) /*!< in: node hold the insert value */ +{ + ib_rbt_bound_t parent; + ib_rbt_node_t* current = ROOT(tree); + + parent.result = 0; + parent.last = tree->root; + + /* Regular binary search. */ + while (current != tree->nil) { + + parent.last = current; + parent.result = tree->compare(key, current->value); + + if (parent.result < 0) { + current = current->left; + } else { + current = current->right; + } + } + + ut_a(current == tree->nil); + + rbt_tree_add_child(tree, &parent, node); + + return(node); +} + +/****************************************************************//** +Balance a tree after inserting a node. */ +static +void +rbt_balance_tree( +/*=============*/ + const ib_rbt_t* tree, /*!< in: tree to balance */ + ib_rbt_node_t* node) /*!< in: node that was inserted */ +{ + const ib_rbt_node_t* nil = tree->nil; + ib_rbt_node_t* parent = node->parent; + + /* Restore the red-black property. */ + node->color = IB_RBT_RED; + + while (node != ROOT(tree) && parent->color == IB_RBT_RED) { + ib_rbt_node_t* grand_parent = parent->parent; + + if (parent == grand_parent->left) { + ib_rbt_node_t* uncle = grand_parent->right; + + if (uncle->color == IB_RBT_RED) { + + /* Case 1 - change the colors. */ + uncle->color = IB_RBT_BLACK; + parent->color = IB_RBT_BLACK; + grand_parent->color = IB_RBT_RED; + + /* Move node up the tree. */ + node = grand_parent; + + } else { + + if (node == parent->right) { + /* Right is a black node and node is + to the right, case 2 - move node + up and rotate. */ + node = parent; + rbt_rotate_left(nil, node); + } + + grand_parent = node->parent->parent; + + /* Case 3. */ + node->parent->color = IB_RBT_BLACK; + grand_parent->color = IB_RBT_RED; + + rbt_rotate_right(nil, grand_parent); + } + + } else { + ib_rbt_node_t* uncle = grand_parent->left; + + if (uncle->color == IB_RBT_RED) { + + /* Case 1 - change the colors. */ + uncle->color = IB_RBT_BLACK; + parent->color = IB_RBT_BLACK; + grand_parent->color = IB_RBT_RED; + + /* Move node up the tree. */ + node = grand_parent; + + } else { + + if (node == parent->left) { + /* Left is a black node and node is to + the right, case 2 - move node up and + rotate. */ + node = parent; + rbt_rotate_right(nil, node); + } + + grand_parent = node->parent->parent; + + /* Case 3. */ + node->parent->color = IB_RBT_BLACK; + grand_parent->color = IB_RBT_RED; + + rbt_rotate_left(nil, grand_parent); + } + } + + parent = node->parent; + } + + /* Color the root black. */ + ROOT(tree)->color = IB_RBT_BLACK; +} + +/****************************************************************//** +Find the given node's successor. +@return successor node or NULL if no successor */ +static +ib_rbt_node_t* +rbt_find_successor( +/*===============*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + const ib_rbt_node_t* current)/*!< in: this is declared const + because it can be called via + rbt_next() */ +{ + const ib_rbt_node_t* nil = tree->nil; + ib_rbt_node_t* next = current->right; + + /* Is there a sub-tree to the right that we can follow. */ + if (next != nil) { + + /* Follow the left most links of the current right child. */ + while (next->left != nil) { + next = next->left; + } + + } else { /* We will have to go up the tree to find the successor. */ + ib_rbt_node_t* parent = current->parent; + + /* Cast away the const. */ + next = (ib_rbt_node_t*) current; + + while (parent != tree->root && next == parent->right) { + next = parent; + parent = next->parent; + } + + next = (parent == tree->root) ? NULL : parent; + } + + return(next); +} + +/****************************************************************//** +Find the given node's precedecessor. +@return predecessor node or NULL if no predecesor */ +static +ib_rbt_node_t* +rbt_find_predecessor( +/*=================*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + const ib_rbt_node_t* current) /*!< in: this is declared const + because it can be called via + rbt_prev() */ +{ + const ib_rbt_node_t* nil = tree->nil; + ib_rbt_node_t* prev = current->left; + + /* Is there a sub-tree to the left that we can follow. */ + if (prev != nil) { + + /* Follow the right most links of the current left child. */ + while (prev->right != nil) { + prev = prev->right; + } + + } else { /* We will have to go up the tree to find the precedecessor. */ + ib_rbt_node_t* parent = current->parent; + + /* Cast away the const. */ + prev = (ib_rbt_node_t*)current; + + while (parent != tree->root && prev == parent->left) { + prev = parent; + parent = prev->parent; + } + + prev = (parent == tree->root) ? NULL : parent; + } + + return(prev); +} + +/****************************************************************//** +Replace node with child. After applying transformations eject becomes +an orphan. */ +static +void +rbt_eject_node( +/*===========*/ + ib_rbt_node_t* eject, /*!< in: node to eject */ + ib_rbt_node_t* node) /*!< in: node to replace with */ +{ + /* Update the to be ejected node's parent's child pointers. */ + if (eject->parent->left == eject) { + eject->parent->left = node; + } else if (eject->parent->right == eject) { + eject->parent->right = node; + } else { + ut_a(0); + } + /* eject is now an orphan but otherwise its pointers + and color are left intact. */ + + node->parent = eject->parent; +} + +/****************************************************************//** +Replace a node with another node. */ +static +void +rbt_replace_node( +/*=============*/ + ib_rbt_node_t* replace, /*!< in: node to replace */ + ib_rbt_node_t* node) /*!< in: node to replace with */ +{ + ib_rbt_color_t color = node->color; + + /* Update the node pointers. */ + node->left = replace->left; + node->right = replace->right; + + /* Update the child node pointers. */ + node->left->parent = node; + node->right->parent = node; + + /* Make the parent of replace point to node. */ + rbt_eject_node(replace, node); + + /* Swap the colors. */ + node->color = replace->color; + replace->color = color; +} + +/****************************************************************//** +Detach node from the tree replacing it with one of it's children. +@return the child node that now occupies the position of the detached node */ +static +ib_rbt_node_t* +rbt_detach_node( +/*============*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + ib_rbt_node_t* node) /*!< in: node to detach */ +{ + ib_rbt_node_t* child; + const ib_rbt_node_t* nil = tree->nil; + + if (node->left != nil && node->right != nil) { + /* Case where the node to be deleted has two children. */ + ib_rbt_node_t* successor = rbt_find_successor(tree, node); + + ut_a(successor != nil); + ut_a(successor->parent != nil); + ut_a(successor->left == nil); + + child = successor->right; + + /* Remove the successor node and replace with its child. */ + rbt_eject_node(successor, child); + + /* Replace the node to delete with its successor node. */ + rbt_replace_node(node, successor); + } else { + ut_a(node->left == nil || node->right == nil); + + child = (node->left != nil) ? node->left : node->right; + + /* Replace the node to delete with one of it's children. */ + rbt_eject_node(node, child); + } + + /* Reset the node links. */ + node->parent = node->right = node->left = tree->nil; + + return(child); +} + +/****************************************************************//** +Rebalance the right sub-tree after deletion. +@return node to rebalance if more rebalancing required else NULL */ +static +ib_rbt_node_t* +rbt_balance_right( +/*==============*/ + const ib_rbt_node_t* nil, /*!< in: rb tree nil node */ + ib_rbt_node_t* parent, /*!< in: parent node */ + ib_rbt_node_t* sibling)/*!< in: sibling node */ +{ + ib_rbt_node_t* node = NULL; + + ut_a(sibling != nil); + + /* Case 3. */ + if (sibling->color == IB_RBT_RED) { + + parent->color = IB_RBT_RED; + sibling->color = IB_RBT_BLACK; + + rbt_rotate_left(nil, parent); + + sibling = parent->right; + + ut_a(sibling != nil); + } + + /* Since this will violate case 3 because of the change above. */ + if (sibling->left->color == IB_RBT_BLACK + && sibling->right->color == IB_RBT_BLACK) { + + node = parent; /* Parent needs to be rebalanced too. */ + sibling->color = IB_RBT_RED; + + } else { + if (sibling->right->color == IB_RBT_BLACK) { + + ut_a(sibling->left->color == IB_RBT_RED); + + sibling->color = IB_RBT_RED; + sibling->left->color = IB_RBT_BLACK; + + rbt_rotate_right(nil, sibling); + + sibling = parent->right; + ut_a(sibling != nil); + } + + sibling->color = parent->color; + sibling->right->color = IB_RBT_BLACK; + + parent->color = IB_RBT_BLACK; + + rbt_rotate_left(nil, parent); + } + + return(node); +} + +/****************************************************************//** +Rebalance the left sub-tree after deletion. +@return node to rebalance if more rebalancing required else NULL */ +static +ib_rbt_node_t* +rbt_balance_left( +/*=============*/ + const ib_rbt_node_t* nil, /*!< in: rb tree nil node */ + ib_rbt_node_t* parent, /*!< in: parent node */ + ib_rbt_node_t* sibling)/*!< in: sibling node */ +{ + ib_rbt_node_t* node = NULL; + + ut_a(sibling != nil); + + /* Case 3. */ + if (sibling->color == IB_RBT_RED) { + + parent->color = IB_RBT_RED; + sibling->color = IB_RBT_BLACK; + + rbt_rotate_right(nil, parent); + sibling = parent->left; + + ut_a(sibling != nil); + } + + /* Since this will violate case 3 because of the change above. */ + if (sibling->right->color == IB_RBT_BLACK + && sibling->left->color == IB_RBT_BLACK) { + + node = parent; /* Parent needs to be rebalanced too. */ + sibling->color = IB_RBT_RED; + + } else { + if (sibling->left->color == IB_RBT_BLACK) { + + ut_a(sibling->right->color == IB_RBT_RED); + + sibling->color = IB_RBT_RED; + sibling->right->color = IB_RBT_BLACK; + + rbt_rotate_left(nil, sibling); + + sibling = parent->left; + + ut_a(sibling != nil); + } + + sibling->color = parent->color; + sibling->left->color = IB_RBT_BLACK; + + parent->color = IB_RBT_BLACK; + + rbt_rotate_right(nil, parent); + } + + return(node); +} + +/****************************************************************//** +Delete the node and rebalance the tree if necessary */ +static +void +rbt_remove_node_and_rebalance( +/*==========================*/ + ib_rbt_t* tree, /*!< in: rb tree */ + ib_rbt_node_t* node) /*!< in: node to remove */ +{ + /* Detach node and get the node that will be used + as rebalance start. */ + ib_rbt_node_t* child = rbt_detach_node(tree, node); + + if (node->color == IB_RBT_BLACK) { + ib_rbt_node_t* last = child; + + ROOT(tree)->color = IB_RBT_RED; + + while (child && child->color == IB_RBT_BLACK) { + ib_rbt_node_t* parent = child->parent; + + /* Did the deletion cause an imbalance in the + parents left sub-tree. */ + if (parent->left == child) { + + child = rbt_balance_right( + tree->nil, parent, parent->right); + + } else if (parent->right == child) { + + child = rbt_balance_left( + tree->nil, parent, parent->left); + + } else { + ut_error; + } + + if (child) { + last = child; + } + } + + ut_a(last); + + last->color = IB_RBT_BLACK; + ROOT(tree)->color = IB_RBT_BLACK; + } + + /* Note that we have removed a node from the tree. */ + --tree->n_nodes; +} + +/****************************************************************//** +Recursively free the nodes. */ +static +void +rbt_free_node( +/*==========*/ + ib_rbt_node_t* node, /*!< in: node to free */ + ib_rbt_node_t* nil) /*!< in: rb tree nil node */ +{ + if (node != nil) { + rbt_free_node(node->left, nil); + rbt_free_node(node->right, nil); + + ut_free(node); + } +} + +/****************************************************************//** +Free all the nodes and free the tree. */ +UNIV_INTERN +void +rbt_free( +/*=====*/ + ib_rbt_t* tree) /*!< in: rb tree to free */ +{ + rbt_free_node(tree->root, tree->nil); + ut_free(tree->nil); + ut_free(tree); +} + +/****************************************************************//** +Create an instance of a red black tree. +@return an empty rb tree */ +UNIV_INTERN +ib_rbt_t* +rbt_create( +/*=======*/ + size_t sizeof_value, /*!< in: sizeof data item */ + ib_rbt_compare compare) /*!< in: fn to compare items */ +{ + ib_rbt_t* tree; + ib_rbt_node_t* node; + + tree = (ib_rbt_t*) ut_malloc(sizeof(*tree)); + memset(tree, 0, sizeof(*tree)); + + tree->sizeof_value = sizeof_value; + + /* Create the sentinel (NIL) node. */ + node = tree->nil = (ib_rbt_node_t*) ut_malloc(sizeof(*node)); + memset(node, 0, sizeof(*node)); + + node->color = IB_RBT_BLACK; + node->parent = node->left = node->right = node; + + /* Create the "fake" root, the real root node will be the + left child of this node. */ + node = tree->root = (ib_rbt_node_t*) ut_malloc(sizeof(*node)); + memset(node, 0, sizeof(*node)); + + node->color = IB_RBT_BLACK; + node->parent = node->left = node->right = tree->nil; + + tree->compare = compare; + + return(tree); +} + +/****************************************************************//** +Generic insert of a value in the rb tree. +@return inserted node */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_insert( +/*=======*/ + ib_rbt_t* tree, /*!< in: rb tree */ + const void* key, /*!< in: key for ordering */ + const void* value) /*!< in: value of key, this value + is copied to the node */ +{ + ib_rbt_node_t* node; + + /* Create the node that will hold the value data. */ + node = (ib_rbt_node_t*) ut_malloc(SIZEOF_NODE(tree)); + + memcpy(node->value, value, tree->sizeof_value); + node->parent = node->left = node->right = tree->nil; + + /* Insert in the tree in the usual way. */ + rbt_tree_insert(tree, key, node); + rbt_balance_tree(tree, node); + + ++tree->n_nodes; + + return(node); +} + +/****************************************************************//** +Add a new node to the tree, useful for data that is pre-sorted. +@return appended node */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_add_node( +/*=========*/ + ib_rbt_t* tree, /*!< in: rb tree */ + ib_rbt_bound_t* parent, /*!< in: bounds */ + const void* value) /*!< in: this value is copied + to the node */ +{ + ib_rbt_node_t* node; + + /* Create the node that will hold the value data */ + node = (ib_rbt_node_t*) ut_malloc(SIZEOF_NODE(tree)); + + memcpy(node->value, value, tree->sizeof_value); + node->parent = node->left = node->right = tree->nil; + + /* If tree is empty */ + if (parent->last == NULL) { + parent->last = tree->root; + } + + /* Append the node, the hope here is that the caller knows + what s/he is doing. */ + rbt_tree_add_child(tree, parent, node); + rbt_balance_tree(tree, node); + + ++tree->n_nodes; + +#if defined(IB_RBT_TESTING) + ut_a(rbt_validate(tree)); +#endif + return(node); +} + +/****************************************************************//** +Find a matching node in the rb tree. +@return NULL if not found else the node where key was found */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_lookup( +/*=======*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + const void* key) /*!< in: key to use for search */ +{ + const ib_rbt_node_t* current = ROOT(tree); + + /* Regular binary search. */ + while (current != tree->nil) { + int result = tree->compare(key, current->value); + + if (result < 0) { + current = current->left; + } else if (result > 0) { + current = current->right; + } else { + break; + } + } + + return(current != tree->nil ? current : NULL); +} + +/****************************************************************//** +Delete a node from the red black tree, identified by key. +@return TRUE if success FALSE if not found */ +UNIV_INTERN +ibool +rbt_delete( +/*=======*/ + ib_rbt_t* tree, /*!< in: rb tree */ + const void* key) /*!< in: key to delete */ +{ + ibool deleted = FALSE; + ib_rbt_node_t* node = (ib_rbt_node_t*) rbt_lookup(tree, key); + + if (node) { + rbt_remove_node_and_rebalance(tree, node); + + ut_free(node); + deleted = TRUE; + } + + return(deleted); +} + +/****************************************************************//** +Remove a node from the rb tree, the node is not free'd, that is the +callers responsibility. +@return deleted node but without the const */ +UNIV_INTERN +ib_rbt_node_t* +rbt_remove_node( +/*============*/ + ib_rbt_t* tree, /*!< in: rb tree */ + const ib_rbt_node_t* const_node) /*!< in: node to delete, this + is a fudge and declared const + because the caller can access + only const nodes */ +{ + /* Cast away the const. */ + rbt_remove_node_and_rebalance(tree, (ib_rbt_node_t*) const_node); + + /* This is to make it easier to do something like this: + ut_free(rbt_remove_node(node)); + */ + + return((ib_rbt_node_t*) const_node); +} + +/****************************************************************//** +Find the node that has the lowest key that is >= key. +@return node satisfying the lower bound constraint or NULL */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_lower_bound( +/*============*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + const void* key) /*!< in: key to search */ +{ + ib_rbt_node_t* lb_node = NULL; + ib_rbt_node_t* current = ROOT(tree); + + while (current != tree->nil) { + int result = tree->compare(key, current->value); + + if (result > 0) { + + current = current->right; + + } else if (result < 0) { + + lb_node = current; + current = current->left; + + } else { + lb_node = current; + break; + } + } + + return(lb_node); +} + +/****************************************************************//** +Find the node that has the greatest key that is <= key. +@return node satisfying the upper bound constraint or NULL */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_upper_bound( +/*============*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + const void* key) /*!< in: key to search */ +{ + ib_rbt_node_t* ub_node = NULL; + ib_rbt_node_t* current = ROOT(tree); + + while (current != tree->nil) { + int result = tree->compare(key, current->value); + + if (result > 0) { + + ub_node = current; + current = current->right; + + } else if (result < 0) { + + current = current->left; + + } else { + ub_node = current; + break; + } + } + + return(ub_node); +} + +/****************************************************************//** +Find the node that has the greatest key that is <= key. +@return value of result */ +UNIV_INTERN +int +rbt_search( +/*=======*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + ib_rbt_bound_t* parent, /*!< in: search bounds */ + const void* key) /*!< in: key to search */ +{ + ib_rbt_node_t* current = ROOT(tree); + + /* Every thing is greater than the NULL root. */ + parent->result = 1; + parent->last = NULL; + + while (current != tree->nil) { + + parent->last = current; + parent->result = tree->compare(key, current->value); + + if (parent->result > 0) { + current = current->right; + } else if (parent->result < 0) { + current = current->left; + } else { + break; + } + } + + return(parent->result); +} + +/****************************************************************//** +Find the node that has the greatest key that is <= key. But use the +supplied comparison function. +@return value of result */ +UNIV_INTERN +int +rbt_search_cmp( +/*===========*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + ib_rbt_bound_t* parent, /*!< in: search bounds */ + const void* key, /*!< in: key to search */ + ib_rbt_compare compare) /*!< in: fn to compare items */ +{ + ib_rbt_node_t* current = ROOT(tree); + + /* Every thing is greater than the NULL root. */ + parent->result = 1; + parent->last = NULL; + + while (current != tree->nil) { + + parent->last = current; + parent->result = compare(key, current->value); + + if (parent->result > 0) { + current = current->right; + } else if (parent->result < 0) { + current = current->left; + } else { + break; + } + } + + return(parent->result); +} + +/****************************************************************//** +Get the leftmost node. +Return the left most node in the tree. */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_first( +/*======*/ + const ib_rbt_t* tree) /* in: rb tree */ +{ + ib_rbt_node_t* first = NULL; + ib_rbt_node_t* current = ROOT(tree); + + while (current != tree->nil) { + first = current; + current = current->left; + } + + return(first); +} + +/****************************************************************//** +Return the right most node in the tree. +@return the rightmost node or NULL */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_last( +/*=====*/ + const ib_rbt_t* tree) /*!< in: rb tree */ +{ + ib_rbt_node_t* last = NULL; + ib_rbt_node_t* current = ROOT(tree); + + while (current != tree->nil) { + last = current; + current = current->right; + } + + return(last); +} + +/****************************************************************//** +Return the next node. +@return node next from current */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_next( +/*=====*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + const ib_rbt_node_t* current)/*!< in: current node */ +{ + return(current ? rbt_find_successor(tree, current) : NULL); +} + +/****************************************************************//** +Return the previous node. +@return node prev from current */ +UNIV_INTERN +const ib_rbt_node_t* +rbt_prev( +/*=====*/ + const ib_rbt_t* tree, /*!< in: rb tree */ + const ib_rbt_node_t* current)/*!< in: current node */ +{ + return(current ? rbt_find_predecessor(tree, current) : NULL); +} + +/****************************************************************//** +Reset the tree. Delete all the nodes. */ +UNIV_INTERN +void +rbt_clear( +/*======*/ + ib_rbt_t* tree) /*!< in: rb tree */ +{ + rbt_free_node(ROOT(tree), tree->nil); + + tree->n_nodes = 0; + tree->root->left = tree->root->right = tree->nil; +} + +/****************************************************************//** +Merge the node from dst into src. Return the number of nodes merged. +@return no. of recs merged */ +UNIV_INTERN +ulint +rbt_merge_uniq( +/*===========*/ + ib_rbt_t* dst, /*!< in: dst rb tree */ + const ib_rbt_t* src) /*!< in: src rb tree */ +{ + ib_rbt_bound_t parent; + ulint n_merged = 0; + const ib_rbt_node_t* src_node = rbt_first(src); + + if (rbt_empty(src) || dst == src) { + return(0); + } + + for (/* No op */; src_node; src_node = rbt_next(src, src_node)) { + + if (rbt_search(dst, &parent, src_node->value) != 0) { + rbt_add_node(dst, &parent, src_node->value); + ++n_merged; + } + } + + return(n_merged); +} + +/****************************************************************//** +Merge the node from dst into src. Return the number of nodes merged. +Delete the nodes from src after copying node to dst. As a side effect +the duplicates will be left untouched in the src. +@return no. of recs merged */ +UNIV_INTERN +ulint +rbt_merge_uniq_destructive( +/*=======================*/ + ib_rbt_t* dst, /*!< in: dst rb tree */ + ib_rbt_t* src) /*!< in: src rb tree */ +{ + ib_rbt_bound_t parent; + ib_rbt_node_t* src_node; + ulint old_size = rbt_size(dst); + + if (rbt_empty(src) || dst == src) { + return(0); + } + + for (src_node = (ib_rbt_node_t*) rbt_first(src); src_node; /* */) { + ib_rbt_node_t* prev = src_node; + + src_node = (ib_rbt_node_t*)rbt_next(src, prev); + + /* Skip duplicates. */ + if (rbt_search(dst, &parent, prev->value) != 0) { + + /* Remove and reset the node but preserve + the node (data) value. */ + rbt_remove_node_and_rebalance(src, prev); + + /* The nil should be taken from the dst tree. */ + prev->parent = prev->left = prev->right = dst->nil; + rbt_tree_add_child(dst, &parent, prev); + rbt_balance_tree(dst, prev); + + ++dst->n_nodes; + } + } + +#if defined(IB_RBT_TESTING) + ut_a(rbt_validate(dst)); + ut_a(rbt_validate(src)); +#endif + return(rbt_size(dst) - old_size); +} + +/****************************************************************//** +Check that every path from the root to the leaves has the same count and +the tree nodes are in order. +@return TRUE if OK FALSE otherwise */ +UNIV_INTERN +ibool +rbt_validate( +/*=========*/ + const ib_rbt_t* tree) /*!< in: RB tree to validate */ +{ + if (rbt_count_black_nodes(tree, ROOT(tree)) > 0) { + return(rbt_check_ordering(tree)); + } + + return(FALSE); +} + +/****************************************************************//** +Iterate over the tree in depth first order. */ +UNIV_INTERN +void +rbt_print( +/*======*/ + const ib_rbt_t* tree, /*!< in: tree to traverse */ + ib_rbt_print_node print) /*!< in: print function */ +{ + rbt_print_subtree(tree, ROOT(tree), print); +} diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index 747eddecf97..3a6368f338d 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -437,8 +437,18 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) return 0; } - /* going up to the first-level tree to continue search there */ + /* + Going up to the first-level tree to continue search there. + Only done when performing prefix search. + + Key buffer data pointer as well as docid[0] may be smaller + than values we got while searching first-level tree. Thus + they must be restored to original values to avoid dead-loop, + when subsequent search for a bigger value eventually ends up + in this same second-level tree. + */ _mi_dpointer(info, (uchar*) (lastkey_buf+HA_FT_WLEN), ftbw->key_root); + ftbw->docid[0]= ftbw->key_root; ftbw->key_root=info->s->state.key_root[ftb->keynr]; ftbw->keyinfo=info->s->keyinfo+ftb->keynr; ftbw->off=0; diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 5edb79e7984..d2bbb4bd405 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1473,9 +1473,17 @@ int ha_myisam::enable_indexes(uint mode) { sql_print_warning("Warning: Enabling keys got errno %d on %s.%s, retrying", my_errno, param.db_name, param.table_name); - /* Repairing by sort failed. Now try standard repair method. */ - param.testflag&= ~(T_REP_BY_SORT | T_QUICK); - error= (repair(thd,param,0) != HA_ADMIN_OK); + /* + Repairing by sort failed. Now try standard repair method. + Still we want to fix only index file. If data file corruption + was detected (T_RETRY_WITHOUT_QUICK), we shouldn't do much here. + Let implicit repair do this job. + */ + if (!(param.testflag & T_RETRY_WITHOUT_QUICK)) + { + param.testflag&= ~T_REP_BY_SORT; + error= (repair(thd,param,0) != HA_ADMIN_OK); + } /* If the standard repair succeeded, clear all error messages which might have been set by the first repair. They can still be seen diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index a13387b140d..6df148857c5 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -2399,10 +2399,8 @@ int mi_repair_by_sort(HA_CHECK *param, register MI_INFO *info, /* fulltext indexes may have much more entries than the number of rows in the table. We estimate the number here. - - Note, built-in parser is always nr. 0 - see ftparser_call_initializer() */ - if (sort_param.keyinfo->ftkey_nr == 0) + if (sort_param.keyinfo->parser == &ft_default_parser) { /* for built-in parser the number of generated index entries @@ -2419,8 +2417,9 @@ int mi_repair_by_sort(HA_CHECK *param, register MI_INFO *info, so, we'll use all the sort memory and start from ~10 buffpeks. (see _create_index_by_sort) */ - sort_info.max_records= - 10*param->sort_buffer_length/sort_param.key_length; + sort_info.max_records= 10 * + max(param->sort_buffer_length, MIN_SORT_BUFFER) / + sort_param.key_length; } sort_param.key_read=sort_ft_key_read; diff --git a/storage/myisam/mi_delete_all.c b/storage/myisam/mi_delete_all.c index 18fcdee77e2..f1c654b0396 100644 --- a/storage/myisam/mi_delete_all.c +++ b/storage/myisam/mi_delete_all.c @@ -56,7 +56,7 @@ int mi_delete_all_rows(MI_INFO *info) FLUSH_IGNORE_CHANGED); #ifdef HAVE_MMAP if (share->file_map) - _mi_unmap_file(info); + mi_munmap_file(info); #endif if (my_chsize(info->dfile, 0, 0, MYF(MY_WME)) || my_chsize(share->kfile, share->base.keystart, 0, MYF(MY_WME)) ) diff --git a/storage/myisam/mi_delete_table.c b/storage/myisam/mi_delete_table.c index a3c0dede581..c4797187bec 100644 --- a/storage/myisam/mi_delete_table.c +++ b/storage/myisam/mi_delete_table.c @@ -19,6 +19,41 @@ #include "fulltext.h" + +/** + Remove MyISAM data/index file safely + + @details + If name is a symlink and file it is pointing to is not in + data directory, file is also removed. + + @param name file to remove + + @returns + 0 on success or my_errno on failure +*/ + +static int _mi_safe_delete_file(const char *name) +{ + DBUG_ENTER("_mi_safe_delete_file"); + if (my_is_symlink(name) && (*myisam_test_invalid_symlink)(name)) + { + /* + Symlink is pointing to file in data directory. + Remove symlink, keep file. + */ + if (my_delete(name, MYF(MY_WME))) + DBUG_RETURN(my_errno); + } + else + { + if (my_delete_with_symlink(name, MYF(MY_WME))) + DBUG_RETURN(my_errno); + } + DBUG_RETURN(0); +} + + int mi_delete_table(const char *name) { char from[FN_REFLEN]; @@ -58,12 +93,12 @@ int mi_delete_table(const char *name) #endif /* USE_RAID */ fn_format(from,name,"",MI_NAME_IEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT); - if (my_delete_with_symlink(from, MYF(MY_WME))) + if (_mi_safe_delete_file(from)) DBUG_RETURN(my_errno); fn_format(from,name,"",MI_NAME_DEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT); #ifdef USE_RAID if (raid_type) DBUG_RETURN(my_raid_delete(from, raid_chunks, MYF(MY_WME)) ? my_errno : 0); #endif - DBUG_RETURN(my_delete_with_symlink(from, MYF(MY_WME)) ? my_errno : 0); + DBUG_RETURN(_mi_safe_delete_file(from)); } diff --git a/storage/myisam/mi_dynrec.c b/storage/myisam/mi_dynrec.c index 374fcfd4ddf..adae7076858 100644 --- a/storage/myisam/mi_dynrec.c +++ b/storage/myisam/mi_dynrec.c @@ -94,6 +94,34 @@ my_bool mi_dynmap_file(MI_INFO *info, my_off_t size) madvise((char*) info->s->file_map, size, MADV_RANDOM); #endif info->s->mmaped_length= size; + info->s->file_read= mi_mmap_pread; + info->s->file_write= mi_mmap_pwrite; + DBUG_RETURN(0); +} + + +/* + Destroy mmaped area for MyISAM handler + + SYNOPSIS + mi_munmap_file() + info MyISAM handler + + RETURN + 0 ok + !0 error. +*/ + +int mi_munmap_file(MI_INFO *info) +{ + int ret; + DBUG_ENTER("mi_unmap_file"); + if ((ret= my_munmap(info->s->file_map, info->s->mmaped_length))) + DBUG_RETURN(ret); + info->s->file_read= mi_nommap_pread; + info->s->file_write= mi_nommap_pwrite; + info->s->file_map= 0; + info->s->mmaped_length= 0; DBUG_RETURN(0); } @@ -112,8 +140,7 @@ void mi_remap_file(MI_INFO *info, my_off_t size) { if (info->s->file_map) { - VOID(my_munmap((char*) info->s->file_map, - (size_t) info->s->mmaped_length)); + mi_munmap_file(info); mi_dynmap_file(info, size); } } @@ -933,8 +960,16 @@ static int update_dynamic_record(MI_INFO *info, my_off_t filepos, uchar *record, } if (block_info.next_filepos != HA_OFFSET_ERROR) + { + /* + delete_dynamic_record() may change data file position. + IO cache must be notified as it may still have cached + data, which has to be flushed later. + */ + info->rec_cache.seek_not_done= 1; if (delete_dynamic_record(info,block_info.next_filepos,1)) goto err; + } DBUG_RETURN(0); err: DBUG_RETURN(1); diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c index 32516d0115e..7352b75096e 100644 --- a/storage/myisam/mi_extra.c +++ b/storage/myisam/mi_extra.c @@ -383,11 +383,6 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) DBUG_PRINT("warning",("mmap failed: errno: %d",errno)); error= my_errno= errno; } - else - { - share->file_read= mi_mmap_pread; - share->file_write= mi_mmap_pwrite; - } } pthread_mutex_unlock(&share->intern_lock); #endif diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c index a76790c7d7d..860c9c57889 100644 --- a/storage/myisam/mi_locking.c +++ b/storage/myisam/mi_locking.c @@ -330,7 +330,6 @@ void mi_update_status(void* param) (long) info->s->state.state.data_file_length)); #endif info->s->state.state= *info->state; - info->state= &info->s->state.state; #ifdef HAVE_QUERY_CACHE DBUG_PRINT("info", ("invalidator... '%s' (status update)", info->filename)); @@ -338,6 +337,7 @@ void mi_update_status(void* param) (*info->s->chst_invalidator)((const char *)info->filename); #endif } + info->state= &info->s->state.state; info->append_insert_at_end= 0; /* diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 2ded6a8e8cd..7436548c7e1 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -663,6 +663,9 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags) myisam_open_list=list_add(myisam_open_list,&m_info->open_list); pthread_mutex_unlock(&THR_LOCK_myisam); + + bzero(info.buff, share->base.max_key_block_length * 2); + if (myisam_log_file >= 0) { intern_filename(name_buff,share->index_file_name); diff --git a/storage/myisam/mi_page.c b/storage/myisam/mi_page.c index 70a26c5ba25..17a5820d768 100644 --- a/storage/myisam/mi_page.c +++ b/storage/myisam/mi_page.c @@ -86,13 +86,6 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo, if ((length=keyinfo->block_length) > IO_SIZE*2 && info->state->key_file_length != page+length) length= ((mi_getint(buff)+IO_SIZE-1) & (uint) ~(IO_SIZE-1)); -#ifdef HAVE_valgrind - { - length=mi_getint(buff); - bzero((uchar*) buff+length,keyinfo->block_length-length); - length=keyinfo->block_length; - } -#endif DBUG_RETURN((key_cache_write(info->s->key_cache, info->s->kfile, &info->s->dirty_part_map, page, level, (uchar*) buff, length, diff --git a/storage/myisam/mi_rnext.c b/storage/myisam/mi_rnext.c index 7ce66d41e0f..b9bbda3cacb 100644 --- a/storage/myisam/mi_rnext.c +++ b/storage/myisam/mi_rnext.c @@ -28,6 +28,7 @@ int mi_rnext(MI_INFO *info, uchar *buf, int inx) { int error,changed; uint flag; + uint update_mask= HA_STATE_NEXT_FOUND; DBUG_ENTER("mi_rnext"); if ((inx = _mi_check_index(info,inx)) < 0) @@ -55,6 +56,20 @@ int mi_rnext(MI_INFO *info, uchar *buf, int inx) info->s->state.key_root[inx]); break; } + /* + "search first" failed. This means we have no pivot for + "search next", or in other words MI_INFO::lastkey is + likely uninitialized. + + Normally SQL layer would never request "search next" if + "search first" failed. But HANDLER may do anything. + + As mi_rnext() without preceeding mi_rkey()/mi_rfirst() + equals to mi_rfirst(), we must restore original state + as if failing mi_rfirst() was not called. + */ + if (error) + update_mask|= HA_STATE_PREV_FOUND; } else { @@ -100,7 +115,7 @@ int mi_rnext(MI_INFO *info, uchar *buf, int inx) } /* Don't clear if database-changed */ info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); - info->update|= HA_STATE_NEXT_FOUND; + info->update|= update_mask; if (error) { diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c index 6ad23154b45..86c4df77817 100644 --- a/storage/myisam/mi_write.c +++ b/storage/myisam/mi_write.c @@ -830,7 +830,7 @@ static int _mi_balance_page(register MI_INFO *info, MI_KEYDEF *keyinfo, (size_t) (length=new_left_length - left_length - k_length)); pos=buff+2+length; memcpy((uchar*) father_key_pos,(uchar*) pos,(size_t) k_length); - bmove((uchar*) buff+2,(uchar*) pos+k_length,new_right_length); + bmove((uchar*) buff + 2, (uchar*) pos + k_length, new_right_length - 2); } else { /* Move keys -> buff */ diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h index c003048e07e..7be59b96ec1 100644 --- a/storage/myisam/myisamdef.h +++ b/storage/myisam/myisamdef.h @@ -724,6 +724,7 @@ int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, const char *orn_name, int mi_open_keyfile(MYISAM_SHARE *share); void mi_setup_functions(register MYISAM_SHARE *share); my_bool mi_dynmap_file(MI_INFO *info, my_off_t size); +int mi_munmap_file(MI_INFO *info); void mi_remap_file(MI_INFO *info, my_off_t size); /* Functions needed by mi_check */ diff --git a/storage/myisam/rt_index.c b/storage/myisam/rt_index.c index 608f91ddf30..575cc32eb56 100644 --- a/storage/myisam/rt_index.c +++ b/storage/myisam/rt_index.c @@ -404,10 +404,16 @@ int rtree_get_first(MI_INFO *info, uint keynr, uint key_length) int rtree_get_next(MI_INFO *info, uint keynr, uint key_length) { - my_off_t root; + my_off_t root= info->s->state.key_root[keynr]; MI_KEYDEF *keyinfo = info->s->keyinfo + keynr; - if (!info->buff_used) + if (root == HA_OFFSET_ERROR) + { + my_errno= HA_ERR_END_OF_FILE; + return -1; + } + + if (!info->buff_used && !info->page_changed) { uint k_len = keyinfo->keylength - info->s->base.rec_reflength; /* rt_PAGE_NEXT_KEY(info->int_keypos) */ @@ -428,16 +434,8 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length) return 0; } - else - { - if ((root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR) - { - my_errno= HA_ERR_END_OF_FILE; - return -1; - } - - return rtree_get_req(info, keyinfo, key_length, root, 0); - } + + return rtree_get_req(info, keyinfo, key_length, root, 0); } @@ -643,18 +641,12 @@ static int rtree_insert_level(MI_INFO *info, uint keynr, uchar *key, } case 1: /* root was split, grow a new root */ { - uchar *new_root_buf; + uchar *new_root_buf= info->buff + info->s->base.max_key_block_length; my_off_t new_root; uchar *new_key; uint nod_flag = info->s->base.key_reflength; DBUG_PRINT("rtree", ("root was split, grow a new root")); - if (!(new_root_buf = (uchar*)my_alloca((uint)keyinfo->block_length + - HA_MAX_KEY_BUFF))) - { - my_errno = HA_ERR_OUT_OF_MEM; - DBUG_RETURN(-1); /* purecov: inspected */ - } mi_putint(new_root_buf, 2, nod_flag); if ((new_root = _mi_new(info, keyinfo, DFLT_INIT_HITS)) == @@ -682,10 +674,8 @@ static int rtree_insert_level(MI_INFO *info, uint keynr, uchar *key, DBUG_PRINT("rtree", ("new root page: %lu level: %d nod_flag: %u", (ulong) new_root, 0, mi_test_if_nod(new_root_buf))); - my_afree((uchar*)new_root_buf); break; err1: - my_afree((uchar*)new_root_buf); DBUG_RETURN(-1); /* purecov: inspected */ } default: diff --git a/storage/myisam/rt_split.c b/storage/myisam/rt_split.c index ef988dbd048..88cf643faf9 100644 --- a/storage/myisam/rt_split.c +++ b/storage/myisam/rt_split.c @@ -258,7 +258,7 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key, double *old_coord; int n_dim; uchar *source_cur, *cur1, *cur2; - uchar *new_page; + uchar *new_page= info->buff; int err_code= 0; uint nod_flag= mi_test_if_nod(page); uint full_length= key_length + (nod_flag ? nod_flag : @@ -304,12 +304,7 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key, goto split_err; } - if (!(new_page = (uchar*)my_alloca((uint)keyinfo->block_length))) - { - err_code= -1; - goto split_err; - } - + info->buff_used= 1; stop = task + (max_keys + 1); cur1 = rt_PAGE_FIRST_KEY(page, nod_flag); cur2 = rt_PAGE_FIRST_KEY(new_page, nod_flag); @@ -345,8 +340,6 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key, DFLT_INIT_HITS, new_page); DBUG_PRINT("rtree", ("split new block: %lu", (ulong) *new_page_offs)); - my_afree((uchar*)new_page); - split_err: my_afree((uchar*) coord_buf); DBUG_RETURN(err_code); diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index 86e4c8351c4..fd0bd971e10 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -28,13 +28,11 @@ /* static variables */ -#undef MIN_SORT_MEMORY #undef MYF_RW #undef DISK_BUFFER_SIZE #define MERGEBUFF 15 #define MERGEBUFF2 31 -#define MIN_SORT_MEMORY (4096-MALLOC_OVERHEAD) #define MYF_RW MYF(MY_NABP | MY_WME | MY_WAIT_IF_FULL) #define DISK_BUFFER_SIZE (IO_SIZE*16) @@ -131,12 +129,12 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, sort_keys= (uchar **) NULL; error= 1; maxbuffer=1; - memavl=max(sortbuff_size,MIN_SORT_MEMORY); + memavl= max(sortbuff_size, MIN_SORT_BUFFER); records= info->sort_info->max_records; sort_length= info->key_length; LINT_INIT(keys); - while (memavl >= MIN_SORT_MEMORY) + while (memavl >= MIN_SORT_BUFFER) { if ((records < UINT_MAX32) && ((my_off_t) (records + 1) * @@ -171,10 +169,10 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, break; } old_memavl=memavl; - if ((memavl=memavl/4*3) < MIN_SORT_MEMORY && old_memavl > MIN_SORT_MEMORY) - memavl=MIN_SORT_MEMORY; + if ((memavl= memavl/4*3) < MIN_SORT_BUFFER && old_memavl > MIN_SORT_BUFFER) + memavl= MIN_SORT_BUFFER; } - if (memavl < MIN_SORT_MEMORY) + if (memavl < MIN_SORT_BUFFER) { mi_check_print_error(info->sort_info->param,"MyISAM sort buffer too small"); /* purecov: tested */ goto err; /* purecov: tested */ @@ -348,12 +346,12 @@ pthread_handler_t thr_find_all_keys(void *arg) bzero((char*) &sort_param->unique, sizeof(sort_param->unique)); sort_keys= (uchar **) NULL; - memavl= max(sort_param->sortbuff_size, MIN_SORT_MEMORY); + memavl= max(sort_param->sortbuff_size, MIN_SORT_BUFFER); idx= (uint)sort_param->sort_info->max_records; sort_length= sort_param->key_length; maxbuffer= 1; - while (memavl >= MIN_SORT_MEMORY) + while (memavl >= MIN_SORT_BUFFER) { if ((my_off_t) (idx+1)*(sort_length+sizeof(char*)) <= (my_off_t) memavl) @@ -391,11 +389,11 @@ pthread_handler_t thr_find_all_keys(void *arg) break; } old_memavl= memavl; - if ((memavl= memavl/4*3) < MIN_SORT_MEMORY && - old_memavl > MIN_SORT_MEMORY) - memavl= MIN_SORT_MEMORY; + if ((memavl= memavl / 4 * 3) < MIN_SORT_BUFFER && + old_memavl > MIN_SORT_BUFFER) + memavl= MIN_SORT_BUFFER; } - if (memavl < MIN_SORT_MEMORY) + if (memavl < MIN_SORT_BUFFER) { mi_check_print_error(sort_param->sort_info->param, "MyISAM sort buffer too small"); @@ -506,7 +504,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) for (i= 0, sinfo= sort_param ; i < sort_info->total_keys ; - i++, rec_per_key_part+=sinfo->keyinfo->keysegs, sinfo++) + i++, sinfo++) { if (!sinfo->sort_keys) { @@ -529,11 +527,6 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) flush_ft_buf(sinfo) || flush_pending_blocks(sinfo)) got_error=1; } - if (!got_error && param->testflag & T_STATISTICS) - update_key_parts(sinfo->keyinfo, rec_per_key_part, sinfo->unique, - param->stats_method == MI_STATS_METHOD_IGNORE_NULLS? - sinfo->notnull: NULL, - (ulonglong) info->state->records); } my_free((uchar*) sinfo->sort_keys,MYF(0)); my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff), @@ -547,7 +540,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) delete_dynamic(&sinfo->buffpek), close_cached_file(&sinfo->tempfile), close_cached_file(&sinfo->tempfile_for_exceptions), - sinfo++) + rec_per_key_part+= sinfo->keyinfo->keysegs, sinfo++) { if (got_error) continue; @@ -569,7 +562,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) if (!mergebuf) { length=param->sort_buffer_length; - while (length >= MIN_SORT_MEMORY) + while (length >= MIN_SORT_BUFFER) { if ((mergebuf= my_malloc(length, MYF(0)))) break; @@ -639,6 +632,11 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) got_error=1; } } + if (!got_error && param->testflag & T_STATISTICS) + update_key_parts(sinfo->keyinfo, rec_per_key_part, sinfo->unique, + param->stats_method == MI_STATS_METHOD_IGNORE_NULLS ? + sinfo->notnull : NULL, + (ulonglong) info->state->records); } my_free((uchar*) mergebuf,MYF(MY_ALLOW_ZERO_PTR)); DBUG_RETURN(got_error); diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index b0e64fec344..f27f22761b1 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2006 MySQL AB +/* Copyright (c) 2000, 2010 Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -216,36 +216,14 @@ const char *ha_myisammrg::index_type(uint key_number) static int myisammrg_parent_open_callback(void *callback_param, const char *filename) { - ha_myisammrg *ha_myrg; - TABLE *parent; + ha_myisammrg *ha_myrg= (ha_myisammrg*) callback_param; + TABLE *parent= ha_myrg->table_ptr(); TABLE_LIST *child_l; - const char *db; - const char *table_name; size_t dirlen; char dir_path[FN_REFLEN]; + char name_buf[NAME_LEN]; DBUG_ENTER("myisammrg_parent_open_callback"); - /* Extract child table name and database name from filename. */ - dirlen= dirname_length(filename); - if (dirlen >= FN_REFLEN) - { - /* purecov: begin inspected */ - DBUG_PRINT("error", ("name too long: '%.64s'", filename)); - my_errno= ENAMETOOLONG; - DBUG_RETURN(1); - /* purecov: end */ - } - table_name= filename + dirlen; - dirlen--; /* Strip off trailing '/'. */ - memcpy(dir_path, filename, dirlen); - dir_path[dirlen]= '\0'; - db= base_name(dir_path); - dirlen-= db - dir_path; /* This is now the length of 'db'. */ - DBUG_PRINT("myrg", ("open: '%s'.'%s'", db, table_name)); - - ha_myrg= (ha_myisammrg*) callback_param; - parent= ha_myrg->table_ptr(); - /* Get a TABLE_LIST object. */ if (!(child_l= (TABLE_LIST*) alloc_root(&parent->mem_root, sizeof(TABLE_LIST)))) @@ -257,13 +235,70 @@ static int myisammrg_parent_open_callback(void *callback_param, } bzero((char*) child_l, sizeof(TABLE_LIST)); - /* Set database (schema) name. */ - child_l->db_length= dirlen; - child_l->db= strmake_root(&parent->mem_root, db, dirlen); - /* Set table name. */ - child_l->table_name_length= strlen(table_name); - child_l->table_name= strmake_root(&parent->mem_root, table_name, - child_l->table_name_length); + /* + Depending on MySQL version, filename may be encoded by table name to + file name encoding or not. Always encoded if parent table is created + by 5.1.46+. Encoded if parent is created by 5.1.6+ and child table is + in different database. + */ + if (!has_path(filename)) + { + /* Child is in the same database as parent. */ + child_l->db_length= parent->s->db.length; + child_l->db= strmake_root(&parent->mem_root, parent->s->db.str, + child_l->db_length); + /* Child table name is encoded in parent dot-MRG starting with 5.1.46. */ + if (parent->s->mysql_version >= 50146) + { + child_l->table_name_length= filename_to_tablename(filename, name_buf, + sizeof(name_buf)); + child_l->table_name= strmake_root(&parent->mem_root, name_buf, + child_l->table_name_length); + } + else + { + child_l->table_name_length= strlen(filename); + child_l->table_name= strmake_root(&parent->mem_root, filename, + child_l->table_name_length); + } + } + else + { + DBUG_ASSERT(strlen(filename) < sizeof(dir_path)); + fn_format(dir_path, filename, "", "", 0); + /* Extract child table name and database name from filename. */ + dirlen= dirname_length(dir_path); + /* Child db/table name is encoded in parent dot-MRG starting with 5.1.6. */ + if (parent->s->mysql_version >= 50106) + { + child_l->table_name_length= filename_to_tablename(dir_path + dirlen, + name_buf, + sizeof(name_buf)); + child_l->table_name= strmake_root(&parent->mem_root, name_buf, + child_l->table_name_length); + dir_path[dirlen - 1]= 0; + dirlen= dirname_length(dir_path); + child_l->db_length= filename_to_tablename(dir_path + dirlen, name_buf, + sizeof(name_buf)); + child_l->db= strmake_root(&parent->mem_root, name_buf, child_l->db_length); + } + else + { + child_l->table_name_length= strlen(dir_path + dirlen); + child_l->table_name= strmake_root(&parent->mem_root, dir_path + dirlen, + child_l->table_name_length); + dir_path[dirlen - 1]= 0; + dirlen= dirname_length(dir_path); + child_l->db_length= strlen(dir_path + dirlen); + child_l->db= strmake_root(&parent->mem_root, dir_path + dirlen, + child_l->db_length); + } + } + + DBUG_PRINT("myrg", ("open: '%.*s'.'%.*s'", (int)(child_l->db_length), + child_l->db, (int)(child_l->table_name_length), + child_l->table_name)); + /* Convert to lowercase if required. */ if (lower_case_table_names && child_l->table_name_length) child_l->table_name_length= my_casedn_str(files_charset_info, @@ -395,13 +430,13 @@ static MI_INFO *myisammrg_attach_children_callback(void *callback_param) @detail This function initializes the MERGE storage engine structures and adds a child list of TABLE_LIST to the parent TABLE. - @param[in] name MERGE table path name - @param[in] mode read/write mode, unused - @param[in] test_if_locked open flags + @param[in] name MERGE table path name + @param[in] mode read/write mode, unused + @param[in] test_if_locked_arg open flags @return status - @retval 0 OK - @retval -1 Error, my_errno gives reason + @retval 0 OK + @retval -1 Error, my_errno gives reason */ int ha_myisammrg::open(const char *name, int mode __attribute__((unused)), @@ -409,7 +444,7 @@ int ha_myisammrg::open(const char *name, int mode __attribute__((unused)), { DBUG_ENTER("ha_myisammrg::open"); DBUG_PRINT("myrg", ("name: '%s' table: 0x%lx", name, (long) table)); - DBUG_PRINT("myrg", ("test_if_locked: %u", test_if_locked_arg)); + DBUG_PRINT("myrg", ("test_if_locked_arg: %u", test_if_locked_arg)); /* Save for later use. */ test_if_locked= test_if_locked_arg; @@ -1135,7 +1170,7 @@ int ha_myisammrg::create(const char *name, register TABLE *form, /* Create child path names. */ for (pos= table_names; tables; tables= tables->next_local) { - const char *table_name; + const char *table_name= buff; /* Construct the path to the MyISAM table. Try to meet two conditions: @@ -1161,10 +1196,12 @@ int ha_myisammrg::create(const char *name, register TABLE *form, as the MyISAM tables are from the same database as the MERGE table. */ if ((dirname_length(buff) == dirlgt) && ! memcmp(buff, name, dirlgt)) - table_name= tables->table_name; - else - if (! (table_name= thd->strmake(buff, length))) - DBUG_RETURN(HA_ERR_OUT_OF_MEM); /* purecov: inspected */ + { + table_name+= dirlgt; + length-= dirlgt; + } + if (!(table_name= thd->strmake(table_name, length))) + DBUG_RETURN(HA_ERR_OUT_OF_MEM); /* purecov: inspected */ *pos++= table_name; } @@ -1185,7 +1222,7 @@ void ha_myisammrg::append_create_info(String *packet) const char *current_db; size_t db_length; THD *thd= current_thd; - MYRG_TABLE *open_table, *first; + TABLE_LIST *open_table, *first; if (file->merge_insert_method != MERGE_INSERT_DISABLED) { @@ -1203,14 +1240,11 @@ void ha_myisammrg::append_create_info(String *packet) current_db= table->s->db.str; db_length= table->s->db.length; - for (first=open_table=file->open_tables ; - open_table != file->end_table ; - open_table++) + for (first= open_table= table->child_l;; + open_table= open_table->next_global) { - LEX_STRING db, name; - LINT_INIT(db.str); + LEX_STRING db= { open_table->db, open_table->db_length }; - split_file_name(open_table->table->filename, &db, &name); if (open_table != first) packet->append(','); /* Report database for mapped table if it isn't in current database */ @@ -1221,7 +1255,10 @@ void ha_myisammrg::append_create_info(String *packet) append_identifier(thd, packet, db.str, db.length); packet->append('.'); } - append_identifier(thd, packet, name.str, name.length); + append_identifier(thd, packet, open_table->table_name, + open_table->table_name_length); + if (&open_table->next_global == table->child_last_l) + break; } packet->append(')'); } diff --git a/storage/myisammrg/myrg_open.c b/storage/myisammrg/myrg_open.c index 32ac719ec4d..ea306c5ba9c 100644 --- a/storage/myisammrg/myrg_open.c +++ b/storage/myisammrg/myrg_open.c @@ -312,14 +312,6 @@ MYRG_INFO *myrg_parent_open(const char *parent_name, if (!child_name_buff[0] || (child_name_buff[0] == '#')) continue; - if (!has_path(child_name_buff)) - { - VOID(strmake(parent_name_buff + dir_length, child_name_buff, - sizeof(parent_name_buff) - 1 - dir_length)); - VOID(cleanup_dirname(child_name_buff, parent_name_buff)); - } - else - fn_format(child_name_buff, child_name_buff, "", "", 0); DBUG_PRINT("info", ("child: '%s'", child_name_buff)); /* Callback registers child with handler table. */ diff --git a/storage/pbxt/ChangeLog b/storage/pbxt/ChangeLog index 2f7297d64ff..b6023d26139 100644 --- a/storage/pbxt/ChangeLog +++ b/storage/pbxt/ChangeLog @@ -1,6 +1,111 @@ PBXT Release Notes ================== ++------- 1.0.11 Pre-GA - 2010-05-11 + +RN322: Creating a table the references a non-existing table can now only be done if you set: foreign_key_checks = 0. Also fixed a failure when creating tables with recursive foreign key declarations. + +RN321: Added "Extended record count" to the CHECK TABLE output. This indicates the number of records that have a data log component. + +RN320: All tests now run with MySQL 5.1.46. + +------- 1.0.10n RC4 - 2010-04-28 + +RN319: Fix RN1/3 and RN1/4 back-ported from 1.1: Fixed a deadlock that could occur during low index cache situations and added some checks for index corruption, and added the try lock variation for R/W locks. + +RN318: Fixed a bug in the atomic R/W lock. This bug occurred on multi-core Linux when under extrem load. The affect was that an index lookup could fail. The index was not corrupted. + +------- 1.0.10m RC4 - 2010-03-29 + +RN317: This change prevents a unscheduled checkpoint from occurring when the sweeper has work to do. Checkpoint required due to the Checkpoint threshold reached are done as usual. + +------- 1.0.10k RC4 - 2010-03-29 + +RN316: Set the maximum delay, while waiting for previous transactions to commit to 1/100s. This situation occurs when cleanup begins of a long running transaction. + +RN315: Fixed a bug that could lead to a data log error, for example: Data log not found: '.../dlog-129602.xt'. This error occurred after a duplicate key error, dending on the table structure, because the row buffer was not restored after writing an extended record. + +RN314: Server startup time could be very long when data logs become large because the log size was not save in the header when a data log is full. + +------- 1.0.10j RC4 - 2010-03-24 + +RN313: Fixed an error in the calculation of the handle data record (.xtd files) size when AVG_ROW_LENGTH is set explicitly to a value less than 12. For example: + +CREATE TABLE objs ( + id int(10) unsigned NOT NULL, + objdata mediumblob NOT NULL, + PRIMARY KEY (id) +) ENGINE=PBXT AVG_ROW_LENGTH=10 + +This table definition previously lead to corruption of the table because the handle data record was set to 24 (14+10), which is less than the minimum (for variable length records) handle data record size of 26. + +This minimum consists of 14 byte record header and 12 bytes reference to the extended record data (the part of the record in the data log). + +Tip: when setting AVG_ROW_LENGTH you should normally add 12 to the average row length estimate to ensure that the average length part of the record is always in the handle data file. This is important, for example if you wish to make sure that the rows used to build indexes are in the handle data file. CHECK TABLE tells you how many rows are in the "fixed length part" of the record (output in MySQL error log). In the example above, this would be AVG_ROW_LENGTH=17. + +The maximum size of a field can be calculated adding the maximum byte size as described here: http://dev.mysql.com/doc/refman/5.1/en/storage-requirements.html, and then add the following values, depending on the byte size: + +byte size <= 240, add 1 +byte size < 2^16 (65536), add 3 +byte size < 2^24 (16777216), add 4 +byte size > 2^24, add 5 + +------- 1.0.10i RC4 - 2010-03-17 + +RN312: Fixed bug #534361: Valgrind error: write of uninitialised bytes in xt_flush_indices() + +RN311: Fixed ilog corruption when running out of disk space during an index flush operation, which lead to corruption of the index. + +------- 1.0.10h RC4 - 2010-02-25 + +RN310: Fixed Windows atomic INC/DEC operations, which lead to atomic R/W lock not working correctly. The result was that some index entries were not foound. + +RN309: Fixed a bug that caused a crash when the index was corrupted. The crash occurs if the index page in not completely written, and an item in the index has a bad length. + +RN308: Fixed bug #509803: can't run tpcc (cannot compare FKs that rely on indexes of different length). + +------- 1.0.10g RC4 - 2010-02-11 + +RN307: 2010-02-15: Set the internal version number 1.0.10g. + +RN306: All tests now run with MySQL 5.1.42. + +RN305: Fixed a bug that could cause a crash in filesort. The problem was that the return row estimate was incorrect, which caused the result of estimate_rows_upper_bound() to overflow to zero. Row estimate has been changed, and no longer takes into account deleted rows (so the row estimate is now a maximum). + +RN304: Fixed bug #513012: On a table with a trigger the same record is updated more than once in one statement + +------- 1.0.10f RC4 - 2010-01-29 + +RN303: Fix RN1/10 back-ported from 1.1: Fixed a bug in the record cache that caused PBXT to think it had run out of cache memory. The effect was that PBXT used less and less cache over time. The bug occurs during heavy concurrent access on the record cache. The affect is the PBXT gets slower and slower. + +RN302: Fix RN1/11 back-ported from 1.1: Corrected a problem that sometimes caused a pause in activity when the record cache was full. + +------- 1.0.10e RC4 - 2010-01-25 + +RN301: Fixed index statistics calculation. This bug lead to the wrong indices being selected by the optimizer because all indices returned the same cost. + +RN300: Fixed bug #509968: START TRANSACTION WITH CONSISTENT SNAPSHOT breaks transactional flow. + +RN299: Fixed bug #509218: Server asserts with Assertion `mutex->__data.__owner == 0' failed on high concurrency OLTP test. + +------- 1.0.10d RC4 - 2010-01-11 + +RN298: Fixed a bug that caused huge amounts of transaction log to be written when pbxt_flush_log_at_trx_commit = 2. + +------- 1.0.10c RC4 - 2009-12-29 + +RN297: Updated "LOCK TABLES ... READ LOCAL" behavior to be more restrictive and compatible with InnoDB + +RN296: Fixed bug #499026: START TRANSACTION WITH CONSISTENT SNAPSHOT does not work for PBXT + +------- 1.0.10 RC4 - 2009-12-18 + +RN295: PBXT tests now all run with MySQL 5.1.41. + +RN294: Fixed bug #483714: a broken table can prevent other tables from opening + +RN293: Added system variable pbxt_flush_log_at_trx_commit. The value of this variable determines whether the transaction log is written and/or flushed when a transaction is ended. A value of 0 means don't write or flush the transaction log, 1 means write and flush and 2 means write, but do not flush. No matter what the setting is choosen, the transaction log is written and flushed at least once per second. + ------- 1.0.09g RC3 - 2009-12-16 RN292: Fixed a bug that resulted in 2-phase commit not being used between PBXT and the binlog. This bug was a result of a hack which as added to solve a problem in an pre-release version of MySQL 5.1. The hack was removed. diff --git a/storage/pbxt/Makefile.am b/storage/pbxt/Makefile.am index 4ef1eab50c2..371756c84be 100644 --- a/storage/pbxt/Makefile.am +++ b/storage/pbxt/Makefile.am @@ -1,3 +1,3 @@ -SUBDIRS = src +SUBDIRS = src bin EXTRA_DIST = CMakeLists.txt plug.in diff --git a/storage/pbxt/bin/Makefile.am b/storage/pbxt/bin/Makefile.am new file mode 100644 index 00000000000..ab7b711a6f1 --- /dev/null +++ b/storage/pbxt/bin/Makefile.am @@ -0,0 +1,14 @@ +# Used to build Makefile.in + +INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ + -I$(top_srcdir)/regex \ + -I$(top_srcdir)/storage/innobase/include \ + -I$(top_srcdir)/sql \ + -I$(srcdir) \ + -I$(srcdir)/../src + +bin_PROGRAMS = xtstat + +xtstat_SOURCES = xtstat_xt.cc ../src/strutil_xt.cc + +xtstat_LDADD = $(top_builddir)/libmysql/libmysqlclient.la diff --git a/storage/pbxt/bin/xtstat_xt.cc b/storage/pbxt/bin/xtstat_xt.cc new file mode 100644 index 00000000000..93b3d42e3f6 --- /dev/null +++ b/storage/pbxt/bin/xtstat_xt.cc @@ -0,0 +1,819 @@ +/* Copyright (c) 2005 PrimeBase Technologies GmbH + * + * PrimeBase XT + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * 2008-11-19 Paul McCullagh + * + * H&G2JCtL + */ + +#include "xt_config.h" + +#include <mysql.h> +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include <string.h> + +#include "strutil_xt.h" +#include "util_xt.h" + +//#define DEBUG_INTERRUPT + +#define OPT_NONE -1 +#define OPT_HELP 0 +#define OPT_HOST 1 +#define OPT_USER 2 +#define OPT_PASSWORD 3 +#define OPT_DATABASE 4 +#define OPT_PORT 5 +#define OPT_SOCKET 6 +#define OPT_DELAY 7 +#define OPT_PROTOCOL 8 +#define OPT_DISPLAY 9 + +#define OPT_HAS_VALUE 1 +#define OPT_OPTIONAL 2 +#define OPT_INTEGER 4 + +llong record_cache_size; +llong index_cache_size; +llong log_cache_size; + +llong accumulative_values[XT_STAT_CURRENT_MAX]; +int columns_used; +int use_i_s = 0; + +struct DisplayOrder { + int do_statistic; + bool do_combo; +} display_order[XT_STAT_CURRENT_MAX]; + +struct Options { + int opt_id; + const char opt_char; + const char *opt_name; + int opt_flags; + const char *opt_desc; + const char *opt_value_str; + int opt_value_int; + bool opt_value_bool; +} options[] = { + { OPT_HELP, '?', "help", 0, + "Prints help text", NULL, 0, false }, + { OPT_HOST, 'h', "host", OPT_HAS_VALUE, + "Connect to host", NULL, 0, false }, + { OPT_USER, 'u', "user", OPT_HAS_VALUE, + "User for login if not current user", NULL, 0, false }, + { OPT_PASSWORD, 'p', "password", OPT_HAS_VALUE | OPT_OPTIONAL, + "Password to use when connecting to server. If password is not given it's asked from the tty", NULL, 0, false }, + { OPT_DATABASE, 'd', "database", OPT_HAS_VALUE, + "Database to be used (pbxt or information_schema required), default is information_schema", "information_schema", 0, false }, + { OPT_PORT, 'P', "port", OPT_HAS_VALUE | OPT_INTEGER, + "Port number to use for connection", NULL, 3306, false }, + { OPT_SOCKET, 'S', "socket", OPT_HAS_VALUE, + "Socket file to use for connection", NULL, 0, false }, + { OPT_DELAY, 'D', "delay", OPT_HAS_VALUE | OPT_INTEGER, + "Delay in seconds between polls of the database", NULL, 1, false }, + { OPT_PROTOCOL, 0, "protocol", OPT_HAS_VALUE, + "Connection protocol to use: default/tcp/socket/pipe/memory", "default", MYSQL_PROTOCOL_DEFAULT, false }, + { OPT_DISPLAY, 0, "display", OPT_HAS_VALUE, + "Columns to display: use short names separated by |, partial match allowed", "time-msec,commt,row-ins,rec,ind,ilog,xlog,data,to,dirty", 0, false }, + { OPT_NONE, 0, NULL, 0, NULL, NULL, 0, false } +}; + +#ifdef XT_WIN +#define atoll _atoi64 +#endif + +void add_statistic(int stat) +{ + /* Check if column has already been added: */ + for (int i=0; i<columns_used; i++) { + if (display_order[i].do_statistic == stat) + return; + } + display_order[columns_used].do_statistic = stat; + display_order[columns_used].do_combo = false; + columns_used++; +} + +void determine_display_order() +{ + const char *cols = options[OPT_DISPLAY].opt_value_str; + char column_1[21], column_2[21]; + int i; + bool add, added, add_combo; + XTStatMetaDataPtr meta, meta2; + + if (strcmp(cols, "all") == 0) + cols = "time,xact,stat,rec,ind,ilog,xlog,data,to,sweep,scan,row"; + columns_used = 0; + while (*cols) { + i = 0; + while (*cols && *cols != '-' && *cols != ',') { + if (i < 20) { + column_1[i] = *cols; + i++; + } + cols++; + } + column_1[i] = 0; + + i = 0; + if (*cols == '-') { + cols++; + while (*cols && *cols != '-' && *cols != ',') { + if (i < 20) { + column_2[i] = *cols; + i++; + } + cols++; + } + } + column_2[i] = 0; + + if (*cols == ',') + cols++; + + if (strcmp(column_1, "ms") == 0) + strcpy(column_1, "msec"); + if (strcmp(column_2, "ms") == 0) + strcpy(column_2, "msec"); + add_combo = false; + if (strcmp(column_1, "syncs/ms") == 0) { + strcpy(column_1, "syncs"); + add_combo = true; + } + if (strcmp(column_2, "syncs/ms") == 0) { + strcpy(column_2, "syncs"); + add_combo = true; + } + + added = false; + for (i=0; i<XT_STAT_MAXIMUM; i++) { + meta = xt_get_stat_meta_data(i); + add = false; + if (strcmp(meta->sm_short_line_1, column_1) == 0) { + if (column_2[0]) { + if (strcmp(meta->sm_short_line_2, column_2) == 0) + add = true; + } + else { + if (i != XT_STAT_XLOG_CACHE_USAGE) + add = true; + } + } + else if (!column_2[0]) { + if (strcmp(meta->sm_short_line_2, column_1) == 0) { + /* XT_STAT_XLOG_CACHE_USAGE is ignored, unless explicity listed! */ + if (i != XT_STAT_XLOG_CACHE_USAGE) + add = true; + } + } + if (add) { + added = true; + add_statistic(i); + if (add_combo) + add_statistic(i+1); + } + } + if (!added) { + if (column_2[0]) + fprintf(stderr, "ERROR: No statistic matches display option: '%s-%s'\n", column_1, column_2); + else + fprintf(stderr, "ERROR: No statistic matches display option: '%s'\n", column_1); + fprintf(stderr, "Display options: %s\n", options[OPT_DISPLAY].opt_value_str); + exit(1); + } + } + + /* Setup "combo" fields: */ + for (i=0; i<columns_used; i++) { + meta = xt_get_stat_meta_data(display_order[i].do_statistic); + if (meta->sm_flags & XT_STAT_COMBO_FIELD) { + if (i+1 < columns_used) { + meta2 = xt_get_stat_meta_data(display_order[i+1].do_statistic); + if (meta2->sm_flags & XT_STAT_COMBO_FIELD_2) { + if (strcmp(meta->sm_short_line_1, meta2->sm_short_line_1) == 0) + display_order[i].do_combo = true; + } + } + } + } +} + +void format_percent_value(char *buffer, double value, double perc) +{ + value = value * (double) 100 / (double) perc; + if (value >= 100) + sprintf(buffer, "%.0f", value); + else + sprintf(buffer, "%.1f", value); + buffer[4] = 0; + if (buffer[3] == '.') + buffer[3] = 0; +} + +#define XT_1_K ((double) 1024) +#define XT_1_M ((double) 1024 * (double) 1024) +#define XT_1_G ((double) 1024 * (double) 1024 * (double) 1024) +#define XT_1_T ((double) 1024 * (double) 1024 * (double) 1024 * (double) 1024) +#define XT_10000_K ((double) 10000 * XT_1_K) +#define XT_10000_M ((double) 10000 * XT_1_M) +#define XT_10000_G ((double) 10000 * XT_1_G) + +void format_byte_value(char *buffer, double value) +{ + double dval; + char string[100]; + char ch; + + if (value < (double) 100000) { + /* byte value from 0 to 99999: */ + sprintf(buffer, "%.0f", value); + return; + } + + if (value < XT_10000_K) { + dval = value / XT_1_K; + ch = 'K'; + } + else if (value < XT_10000_M) { + dval = value / XT_1_M; + ch = 'M'; + } + else if (value < XT_10000_G) { + dval = value / XT_1_G; + ch = 'G'; + } + else { + dval = value / XT_1_T; + ch = 'T'; + } + + if (dval < (double) 10.0) + sprintf(string, "%.2f", dval); + else if (dval < (double) 100.0) + sprintf(string, "%.1f", dval); + else + sprintf(string, "%.0f", dval); + if (string[3] == '.') + string[3] = 0; + else + string[4] = 0; + sprintf(buffer, "%s%c", string, ch); +} + +/* + * Uses: + * t = thousands + * m = millions + * b = billions + */ +void format_mini_count_value(char *buffer, double value) +{ + double dval; + char string[100]; + char ch; + + if (value < (double) 100) { + /* Value from 0 to 99: */ + sprintf(buffer, "%.0f", value); + return; + } + + if (value < (double) 1000) { + sprintf(buffer, "<t"); + return; + } + + if (value < (double) 10000) { + /* Value is less than 1m */ + dval = value / (double) 1000.0; + ch = 't'; + } + else if (value < (double) 1000000) { + sprintf(buffer, "<m"); + return; + } + else if (value < (double) 10000000) { + /* Value is less than 1b */ + dval = value / (double) 1000000.0; + ch = 'm'; + } + else if (value < (double) 1000000000) { + sprintf(buffer, "<b"); + return; + } + else { + /* Value is greater than 1 billion */ + dval = value / (double) 1000000000.0; + ch = 'b'; + } + + sprintf(string, "%1.0f", dval); + string[1] = 0; + sprintf(buffer, "%s%c", string, ch); +} + +#define XT_1_THOUSAND ((double) 1000) +#define XT_1_MILLION ((double) 1000 * (double) 1000) +#define XT_1_BILLION ((double) 1000 * (double) 1000 * (double) 1000) +#define XT_1_TRILLION ((double) 1000 * (double) 1000 * (double) 1000 * (double) 1000) +#define XT_10_THOUSAND ((double) 10 * (double) 1000) +#define XT_10_MILLION ((double) 10 * (double) 1000 * (double) 1000) +#define XT_10_BILLION ((double) 10 * (double) 1000 * (double) 1000 * (double) 1000) +#define XT_10_TRILLION ((double) 10 * (double) 1000 * (double) 1000 * (double) 1000 * (double) 1000) + +void format_count_value(char *buffer, double value) +{ + double dval; + char string[100]; + char ch; + + if (value < (double) 0) { + strcpy(buffer, "0"); + return; + } + + if (value < XT_10_THOUSAND) { + /* byte value from 0 to 99999: */ + sprintf(buffer, "%.0f", value); + return; + } + + if (value < XT_10_MILLION) { + /* Value is less than 10 million */ + dval = value / XT_1_THOUSAND; + ch = 't'; + } + else if (value < XT_10_BILLION) { + /* Value is less than 10 million */ + dval = value / XT_1_MILLION; + ch = 'm'; + } + else if (value < XT_10_TRILLION) { + /* Value is less than 10 trillion */ + dval = value / XT_1_BILLION; + ch = 'b'; + } + else { + dval = value / XT_1_TRILLION; + ch = 't'; + } + + if (dval < (double) 10.0) + sprintf(string, "%.2f", dval); + else if (dval < (double) 100.0) + sprintf(string, "%.1f", dval); + else + sprintf(string, "%.0f", dval); + if (string[3] == '.') + string[3] = 0; + else + string[4] = 0; + sprintf(buffer, "%s%c", string, ch); +} + +void print_help() +{ + struct Options *opt; + char command[100]; + + printf("Usage: xtstat [ options ]\n"); + printf("e.g. xtstat -D10 : Poll every 10 seconds\n"); + opt = options; + printf("Options :-\n"); + while (opt->opt_id != OPT_NONE) { + strcpy(command, opt->opt_name); + if (opt->opt_flags & OPT_HAS_VALUE) { + if (opt->opt_flags & OPT_OPTIONAL) + strcat(command, "[=value]"); + else + strcat(command, "=value"); + } + if (opt->opt_char) + printf("-%c, --%-16s %s.\n", opt->opt_char, command, opt->opt_desc); + else + printf(" --%-16s %s.\n", command, opt->opt_desc); + opt++; + } +} + +void print_stat_key() +{ + printf("Key :-\n"); + printf("K = Kilobytes (1,024 bytes)\n"); + printf("M = Megabytes (1,048,576 bytes)\n"); + printf("G = Gigabytes (1,073,741,024 bytes)\n"); + printf("T = Terabytes (1,099,511,627,776 bytes)\n"); + printf("t = thousands (1,000s)\n"); + printf("m = millions (1,000,000s)\n"); + printf("b = billions (1,000,000,000s)\n"); +} + +void print_stat_info() +{ + XTStatMetaDataPtr meta; + char buffer[40]; + char desc[400]; + + printf("Statistics :-\n"); + for (int i=0; i<XT_STAT_CURRENT_MAX; i++) { + meta = xt_get_stat_meta_data(i); + sprintf(desc, meta->sm_description, "milli"); + sprintf(buffer, "%s-%s", meta->sm_short_line_1, meta->sm_short_line_2); + if (meta->sm_flags & XT_STAT_COMBO_FIELD) { + /* Combine next 2 fields: */ + i++; + strcat(buffer, "/ms"); + strcat(desc, "/time taken in milliseconds"); + } + printf("%-13s %-21s - %s.\n", buffer, meta->sm_name, desc); + } +} + +bool match_arg(char *what, const char *opt, char **value) +{ + while (*what && *opt && isalpha(*what)) { + if (*what != *opt) + return false; + what++; + opt++; + } + if (*opt) + return false; + if (*what == '=') + *value = what + 1; + else if (*what) + return false; + else + *value = NULL; + return true; +} + +void parse_args(int argc, char **argv) +{ + char *ptr; + char *value; + int i = 1; + struct Options *opt; + bool found; + + while (i < argc) { + ptr = argv[i]; + found = false; + if (*ptr == '-') { + ptr++; + if (*ptr == '-') { + ptr++; + opt = options; + while (opt->opt_id != OPT_NONE) { + if (match_arg(ptr, opt->opt_name, &value)) { + found = true; + opt->opt_value_str = value; + opt->opt_value_bool = true; + break; + } + opt++; + } + } + else { + opt = options; + while (opt->opt_id != OPT_NONE) { + if (*ptr == opt->opt_char) { + ptr++; + if (*ptr) + opt->opt_value_str = ptr; + else { + opt->opt_value_str = NULL; + if (i+1 < argc) { + ptr = argv[i+1]; + if (*ptr != '-') { + opt->opt_value_str = ptr; + i++; + } + } + } + found = true; + opt->opt_value_bool = true; + break; + } + opt++; + } + } + } + + if (!found) { + fprintf(stderr, "Unknown option: %s\n", argv[i]); + print_help(); + exit(1); + } + + if (opt->opt_flags & OPT_HAS_VALUE) { + if (!(opt->opt_flags & OPT_OPTIONAL)) { + if (!opt->opt_value_str) { + fprintf(stderr, "Option requires a value: %s\n", argv[i]); + printf("Use --help for help on commands and usage\n"); + exit(1); + } + } + } + else { + if (opt->opt_value_str) { + fprintf(stderr, "Option does not accept a value: %s\n", argv[i]); + printf("Use --help for help on commands and usage\n"); + exit(1); + } + } + + if (opt->opt_value_str && (opt->opt_flags & OPT_INTEGER)) + opt->opt_value_int = atoi(opt->opt_value_str); + + if (opt->opt_id == OPT_HELP) { + print_help(); + print_stat_key(); + print_stat_info(); + exit(1); + } + + i++; + } +} + +#ifdef DEBUG_INTERRUPT +void interrupt_pbxt(MYSQL *conn) +{ + MYSQL_RES *res; + + if (mysql_query(conn, "show engine pbxt status")) { + fprintf(stderr, "%s\n", mysql_error(conn)); + exit(1); + } + + res = mysql_use_result(conn); + mysql_free_result(res); +} +#endif + +static bool display_parameters(MYSQL *conn) +{ + MYSQL_RES *res; + MYSQL_ROW row; + + /* send SQL query */ + if (mysql_query(conn, "show variables like 'pbxt_%'")) + return false; + + if (!(res = mysql_use_result(conn))) + return false; + + /* output table name */ + printf("-- PBXT System Variables --\n"); + while ((row = mysql_fetch_row(res)) != NULL) { + if (strcmp(row[0], "pbxt_index_cache_size") == 0) + index_cache_size = xt_byte_size_to_int8(row[1]); + else if (strcmp(row[0], "pbxt_record_cache_size") == 0) + record_cache_size = xt_byte_size_to_int8(row[1]); + else if (strcmp(row[0], "pbxt_log_cache_size") == 0) + log_cache_size = xt_byte_size_to_int8(row[1]); + printf("%-29s= %s\n", row[0], row[1]); + } + + mysql_free_result(res); + + for (int i=0; i<XT_STAT_CURRENT_MAX; i++) + accumulative_values[i] = 0; + + printf("Display options: %s\n", options[OPT_DISPLAY].opt_value_str); + return true; +} + +static bool connect(MYSQL *conn) +{ + unsigned int type; + + if (strcasecmp(options[OPT_PROTOCOL].opt_value_str, "tcp") == 0) + type = MYSQL_PROTOCOL_TCP; + else if (strcasecmp(options[OPT_PROTOCOL].opt_value_str, "socket") == 0) + type = MYSQL_PROTOCOL_SOCKET; + else if (strcasecmp(options[OPT_PROTOCOL].opt_value_str, "pipe") == 0) + type = MYSQL_PROTOCOL_PIPE; + else if (strcasecmp(options[OPT_PROTOCOL].opt_value_str, "memory") == 0) + type = MYSQL_PROTOCOL_MEMORY; + else + type = MYSQL_PROTOCOL_DEFAULT; + + if (mysql_options(conn, MYSQL_OPT_PROTOCOL, (char *) &type)) + return false; + + if (mysql_options(conn, MYSQL_READ_DEFAULT_GROUP, "xtstat")) + return false; + + if (strcasecmp(options[OPT_DATABASE].opt_value_str, "pbxt") == 0) + use_i_s = FALSE; + else if (strcasecmp(options[OPT_DATABASE].opt_value_str, "information_schema") == 0) + use_i_s = TRUE; + else + use_i_s = TRUE; + + /* Connect to database */ + if (!mysql_real_connect(conn, + options[OPT_HOST].opt_value_str, + options[OPT_USER].opt_value_str, + options[OPT_PASSWORD].opt_value_str, + options[OPT_DATABASE].opt_value_str, + options[OPT_PORT].opt_value_int, + options[OPT_SOCKET].opt_value_str, + 0)) + return false; + + return true; +} + +int main(int argc, char **argv) +{ + MYSQL *conn; + MYSQL_RES *res; + MYSQL_ROW row; + llong current_values[XT_STAT_CURRENT_MAX]; + double value; + char str_value[100]; + XTStatMetaDataPtr meta; + int len; + int stat; + int err; + bool select_worked = true; + + xt_set_time_unit("msec"); + parse_args(argc, argv); + + determine_display_order(); + + if (!(conn = mysql_init(NULL))) { + fprintf(stderr, "Insufficient memory\n"); + exit(1); + } + + if (!connect(conn) || !display_parameters(conn)) { + fprintf(stderr, "%s\n", mysql_error(conn)); + exit(1); + } + + retry: + for (int loop = 0; ; loop++) { + if (use_i_s) + err = mysql_query(conn, "select id, Value from information_schema.pbxt_statistics order by ID"); + else + err = mysql_query(conn, "select id, Value from pbxt.statistics order by ID"); + if (err) + goto reconnect; + + if (!(res = mysql_use_result(conn))) + goto reconnect; + select_worked = true; + + while ((row = mysql_fetch_row(res)) != NULL) { + stat = atoi(row[0])-1; + current_values[stat] = atoll(row[1]); + } + mysql_free_result(res); + +#ifdef DEBUG_INTERRUPT + if (current_values[XT_STAT_STAT_WRITES] - accumulative_values[XT_STAT_STAT_WRITES] == 0 && + current_values[XT_STAT_REC_SYNC_TIME] - accumulative_values[XT_STAT_REC_SYNC_TIME] == 0 && + current_values[XT_STAT_IND_SYNC_TIME] - accumulative_values[XT_STAT_IND_SYNC_TIME] == 0) + interrupt_pbxt(); +#endif + + if ((loop % 25) == 0) { + for (int column=0; column<columns_used; column++) { + len = 5; + meta = xt_get_stat_meta_data(display_order[column].do_statistic); + strcpy(str_value, meta->sm_short_line_1); + if (display_order[column].do_combo) { + /* Combine next 2 fields: */ + len = 8; + column++; + } + else if (meta->sm_flags & XT_STAT_PERCENTAGE) + len = 4; + else if (meta->sm_flags & XT_STAT_DATE) + len = 15; + printf("%*s ", len, str_value); + } + printf("\n"); + for (int column=0; column<columns_used; column++) { + len = 5; + meta = xt_get_stat_meta_data(display_order[column].do_statistic); + strcpy(str_value, meta->sm_short_line_2); + if (display_order[column].do_combo) { + /* Combine next 2 fields: */ + len = 8; + column++; + strcat(str_value, "/ms"); + } + else if (meta->sm_flags & XT_STAT_PERCENTAGE) + len = 4; + else if (meta->sm_flags & XT_STAT_DATE) + len = 15; + printf("%*s ", len, str_value); + } + printf("\n"); + } + + for (int column=0; column<columns_used; column++) { + len = 5; + stat = display_order[column].do_statistic; + meta = xt_get_stat_meta_data(stat); + if (meta->sm_flags & XT_STAT_ACCUMULATIVE) { + /* Take care of overflow! */ + if (current_values[stat] < accumulative_values[stat]) + value = (double) (0xFFFFFFFF - (accumulative_values[stat] - current_values[stat])); + else + value = (double) (current_values[stat] - accumulative_values[stat]); + } + else + value = (double) current_values[stat]; + accumulative_values[stat] = current_values[stat]; + if (meta->sm_flags & XT_STAT_TIME_VALUE) + value = value / (double) 1000; + if (display_order[column].do_combo) { + format_mini_count_value(str_value, value); + strcat(str_value, "/"); + column++; + stat = display_order[column].do_statistic; + value = (double) (current_values[stat] - accumulative_values[stat]); + accumulative_values[stat] = current_values[stat]; + value = value / (double) 1000; + format_count_value(&str_value[strlen(str_value)], value); + len = 8; + } + else if (meta->sm_flags & XT_STAT_PERCENTAGE) { + double perc = 100; + switch (stat) { + case XT_STAT_REC_CACHE_USAGE: perc = (double)record_cache_size; break; + case XT_STAT_IND_CACHE_USAGE: perc = (double)index_cache_size; break; + case XT_STAT_XLOG_CACHE_USAGE: perc = (double)log_cache_size; break; + } + format_percent_value(str_value, value, perc); + len = 4; + } + else if (meta->sm_flags & XT_STAT_DATE) { + time_t ticks = (time_t) value; + const struct tm *ltime = localtime(&ticks); + strftime(str_value, 99, "%y%m%d %H:%M:%S", ltime); + len = 15; + } + else if (meta->sm_flags & XT_STAT_BYTE_COUNT) + format_byte_value(str_value, value); + else + format_count_value(str_value, value); + if (column == columns_used-1) + printf("%*s\n", len, str_value); + else + printf("%*s ", len, str_value); + } + + sleep(options[OPT_DELAY].opt_value_int); + } + + /* close connection */ + mysql_close(conn); + return 0; + + reconnect: + /* Reconnect... */ + if (select_worked) { + /* Only print message if the SELECT worked. + * or we will get a screen full of messages: + */ + fprintf(stderr, "%s\n", mysql_error(conn)); + printf("Reconnecting...\n"); + } + mysql_close(conn); + if (!(conn = mysql_init(NULL))) { + fprintf(stderr, "Insufficient memory\n"); + exit(1); + } + do { + sleep(2); + } while (!connect(conn)); + select_worked = false; + goto retry; +} diff --git a/storage/pbxt/src/backup_xt.cc b/storage/pbxt/src/backup_xt.cc index da88c363822..b9631f2cfd5 100644 --- a/storage/pbxt/src/backup_xt.cc +++ b/storage/pbxt/src/backup_xt.cc @@ -287,7 +287,7 @@ result_t PBXTBackupDriver::get_data(Buffer &buf) bd_table_no++; try_(a) { xt_ha_open_database_of_table(self, (XTPathStrPtr) path); - tab = xt_use_table(self, (XTPathStrPtr) path, FALSE, FALSE, NULL); + tab = xt_use_table(self, (XTPathStrPtr) path, FALSE, FALSE); pushr_(xt_heap_release, tab); if (!(bd_ot = xt_db_open_table_using_tab(tab, bd_thread))) xt_throw(self); @@ -403,7 +403,7 @@ result_t PBXTBackupDriver::lock() bd_thread->st_abort_trans = FALSE; bd_thread->st_stat_ended = FALSE; bd_thread->st_stat_trans = FALSE; - bd_thread->st_is_update = FALSE; + bd_thread->st_is_update = NULL; if (!xt_xn_begin(bd_thread)) return backup::ERROR; bd_state = BUP_STATE_AFTER_LOCK; @@ -562,7 +562,7 @@ result_t PBXTRestoreDriver::send_data(Buffer &buf) m_tables[rd_table_no-1].internal_name(path, sizeof(path)); try_(a) { xt_ha_open_database_of_table(self, (XTPathStrPtr) path); - tab = xt_use_table(self, (XTPathStrPtr) path, FALSE, FALSE, NULL); + tab = xt_use_table(self, (XTPathStrPtr) path, FALSE, FALSE); pushr_(xt_heap_release, tab); if (!(rd_ot = xt_db_open_table_using_tab(tab, rd_thread))) xt_throw(self); diff --git a/storage/pbxt/src/cache_xt.cc b/storage/pbxt/src/cache_xt.cc index a8b2ff20ea2..85eea41dd79 100644 --- a/storage/pbxt/src/cache_xt.cc +++ b/storage/pbxt/src/cache_xt.cc @@ -90,7 +90,7 @@ #define IDX_CAC_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, &(i)->cs_lock) #define IDX_CAC_FREE_LOCK(s, i) xt_spinxslock_free(s, &(i)->cs_lock) #define IDX_CAC_READ_LOCK(i, s) xt_spinxslock_slock(&(i)->cs_lock, (s)->t_id) -#define IDX_CAC_WRITE_LOCK(i, s) xt_spinxslock_xlock(&(i)->cs_lock, (s)->t_id) +#define IDX_CAC_WRITE_LOCK(i, s) xt_spinxslock_xlock(&(i)->cs_lock, FALSE, (s)->t_id) #define IDX_CAC_UNLOCK(i, s) xt_spinxslock_unlock(&(i)->cs_lock, (s)->t_id) #endif @@ -178,6 +178,7 @@ static DcGlobalsRec ind_cac_globals; KEY_CACHE my_cache; #undef pthread_rwlock_rdlock #undef pthread_rwlock_wrlock +#undef pthread_rwlock_try_wrlock #undef pthread_rwlock_unlock #undef pthread_mutex_lock #undef pthread_mutex_unlock @@ -410,7 +411,7 @@ xtPublic void xt_ind_release_handle(XTIndHandlePtr handle, xtBool have_lock, XTT /* Because of the lock order, I have to release the * handle before I get a lock on the cache block. * - * But, by doing this, thie cache block may be gone! + * But, by doing this, this cache block may be gone! */ if (block) { IDX_CAC_READ_LOCK(seg, thread); @@ -420,6 +421,11 @@ xtPublic void xt_ind_release_handle(XTIndHandlePtr handle, xtBool have_lock, XTT /* Found the block... * {HANDLE-COUNT-SLOCK} * 04.05.2009, changed to slock. + * The xlock causes too much contention + * on the cache block for read only loads. + * + * Is it safe? + * See below... */ XT_IPAGE_READ_LOCK(&block->cb_lock); goto block_found; @@ -691,6 +697,9 @@ xtPublic void xt_ind_exit(XTThreadPtr self) } } + /* Must be done before freeing the blocks! */ + ind_handle_exit(self); + if (ind_cac_globals.cg_blocks) { xt_free(self, ind_cac_globals.cg_blocks); ind_cac_globals.cg_blocks = NULL; @@ -702,7 +711,6 @@ xtPublic void xt_ind_exit(XTThreadPtr self) ind_cac_globals.cg_buffer = NULL; } #endif - ind_handle_exit(self); memset(&ind_cac_globals, 0, sizeof(ind_cac_globals)); } @@ -882,7 +890,58 @@ static xtBool ind_free_block(XTOpenTablePtr ot, XTIndBlockPtr block) while (xblock) { if (block == xblock) { /* Found the block... */ - XT_IPAGE_WRITE_LOCK(&block->cb_lock, ot->ot_thread->t_id); + /* It is possible that a thread enters this code holding a + * lock on a page. This can cause a deadlock: + * + * #0 0x91faa2ce in semaphore_wait_signal_trap + * #1 0x91fb1da5 in pthread_mutex_lock + * #2 0x00e2ec13 in xt_p_mutex_lock at pthread_xt.cc:544 + * #3 0x00e6c30a in xt_xsmutex_xlock at lock_xt.cc:1547 + * #4 0x00dee402 in ind_free_block at cache_xt.cc:879 + * #5 0x00dee76a in ind_cac_free_lru_blocks at cache_xt.cc:1033 + * #6 0x00def8d1 in xt_ind_reserve at cache_xt.cc:1513 + * #7 0x00e22118 in xt_idx_insert at index_xt.cc:2047 + * #8 0x00e4d7ee in xt_tab_new_record at table_xt.cc:4702 + * #9 0x00e0ff0b in ha_pbxt::write_row at ha_pbxt.cc:2340 + * #10 0x0023a00f in handler::ha_write_row at handler.cc:4570 + * #11 0x001a32c8 in write_record at sql_insert.cc:1568 + * #12 0x001ab635 in mysql_insert at sql_insert.cc:812 + * #13 0x0010e068 in mysql_execute_command at sql_parse.cc:3066 + * #14 0x0011480d in mysql_parse at sql_parse.cc:5787 + * #15 0x00115afb in dispatch_command at sql_parse.cc:1200 + * #16 0x00116de2 in do_command at sql_parse.cc:857 + * #17 0x00101ee4 in handle_one_connection at sql_connect.cc:1115 + * #18 0x91fdb155 in _pthread_start + * #19 0x91fdb012 in thread_start + * + * #0 0x91fb146e in __semwait_signal + * #1 0x91fb12ef in nanosleep$UNIX2003 + * #2 0x91fb1236 in usleep$UNIX2003 + * #3 0x00e52112 in xt_yield at thread_xt.cc:1274 + * #4 0x00e6c0eb in xt_spinxslock_xlock at lock_xt.cc:1456 + * #5 0x00dee444 in ind_free_block at cache_xt.cc:886 + * #6 0x00dee76a in ind_cac_free_lru_blocks at cache_xt.cc:1033 + * #7 0x00deeaf0 in ind_cac_fetch at cache_xt.cc:1130 + * #8 0x00def604 in xt_ind_fetch at cache_xt.cc:1386 + * #9 0x00e2159a in xt_idx_update_row_id at index_xt.cc:2489 + * #10 0x00e603c8 in xn_sw_clean_indices at xaction_xt.cc:1932 + * #11 0x00e606d4 in xn_sw_cleanup_variation at xaction_xt.cc:2056 + * #12 0x00e60e29 in xn_sw_cleanup_xact at xaction_xt.cc:2276 + * #13 0x00e615ed in xn_sw_main at xaction_xt.cc:2433 + * #14 0x00e61919 in xn_sw_run_thread at xaction_xt.cc:2564 + * #15 0x00e53f80 in thr_main at thread_xt.cc:1017 + * #16 0x91fdb155 in _pthread_start + * #17 0x91fdb012 in thread_start + * + * So we back off if a lock is held! + */ + if (!XT_IPAGE_WRITE_TRY_LOCK(&block->cb_lock, ot->ot_thread->t_id)) { + IDX_CAC_UNLOCK(seg, ot->ot_thread); +#ifdef DEBUG_CHECK_IND_CACHE + xt_ind_check_cache(NULL); +#endif + return FALSE; + } if (block->cb_state != IDX_CAC_BLOCK_CLEAN) { /* This block cannot be freeed: */ XT_IPAGE_UNLOCK(&block->cb_lock, TRUE); @@ -1376,6 +1435,7 @@ xtPublic xtBool xt_ind_fetch(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID ad register XTIndBlockPtr block; DcSegmentPtr seg; xtWord2 branch_size; + u_int rec_size; xtBool xlock = FALSE; #ifdef DEBUG @@ -1386,10 +1446,24 @@ xtPublic xtBool xt_ind_fetch(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID ad return FAILED; branch_size = XT_GET_DISK_2(((XTIdxBranchDPtr) block->cb_data)->tb_size_2); - if (XT_GET_INDEX_BLOCK_LEN(branch_size) < 2 || XT_GET_INDEX_BLOCK_LEN(branch_size) > XT_INDEX_PAGE_SIZE) { - IDX_CAC_UNLOCK(seg, ot->ot_thread); - xt_register_taberr(XT_REG_CONTEXT, XT_ERR_INDEX_CORRUPTED, ot->ot_table->tab_name); - return FAILED; + rec_size = XT_GET_INDEX_BLOCK_LEN(branch_size); + if (rec_size < 2 || rec_size > XT_INDEX_PAGE_SIZE) + goto failed_corrupt; + if (ind->mi_fix_key) { + rec_size -= 2; + if (XT_IS_NODE(branch_size)) { + if (rec_size != 0) { + if (rec_size < XT_NODE_REF_SIZE) + goto failed_corrupt; + rec_size -= XT_NODE_REF_SIZE; + if ((rec_size % (ind->mi_key_size + XT_RECORD_REF_SIZE + XT_NODE_REF_SIZE)) != 0) + goto failed_corrupt; + } + } + else { + if ((rec_size % (ind->mi_key_size + XT_RECORD_REF_SIZE)) != 0) + goto failed_corrupt; + } } switch (ltype) { @@ -1450,6 +1524,11 @@ xtPublic xtBool xt_ind_fetch(XTOpenTablePtr ot, XTIndexPtr ind, xtIndexNodeID ad iref->ir_block = block; iref->ir_branch = (XTIdxBranchDPtr) block->cb_data; return OK; + + failed_corrupt: + IDX_CAC_UNLOCK(seg, ot->ot_thread); + xt_register_taberr(XT_REG_CONTEXT, XT_ERR_INDEX_CORRUPTED, ot->ot_table->tab_name); + return FAILED; } xtPublic xtBool xt_ind_release(XTOpenTablePtr ot, XTIndexPtr ind, XTPageUnlockType XT_NDEBUG_UNUSED(utype), XTIndReferencePtr iref) diff --git a/storage/pbxt/src/cache_xt.h b/storage/pbxt/src/cache_xt.h index 5dd7de629e3..ca796ab1a74 100644 --- a/storage/pbxt/src/cache_xt.h +++ b/storage/pbxt/src/cache_xt.h @@ -58,7 +58,8 @@ struct XTIdxReadBuffer; #define XT_IPAGE_INIT_LOCK(s, i) xt_atomicrwlock_init_with_autoname(s, i) #define XT_IPAGE_FREE_LOCK(s, i) xt_atomicrwlock_free(s, i) #define XT_IPAGE_READ_LOCK(i) xt_atomicrwlock_slock(i) -#define XT_IPAGE_WRITE_LOCK(i, o) xt_atomicrwlock_xlock(i, o) +#define XT_IPAGE_WRITE_LOCK(i, o) xt_atomicrwlock_xlock(i, FALSE, o) +#define XT_IPAGE_WRITE_TRY_LOCK(i, o) xt_atomicrwlock_xlock(i, TRUE, o) #define XT_IPAGE_UNLOCK(i, x) xt_atomicrwlock_unlock(i, x) #elif defined(XT_IPAGE_USE_PTHREAD_RW) #define XT_IPAGE_LOCK_TYPE xt_rwlock_type @@ -66,20 +67,23 @@ struct XTIdxReadBuffer; #define XT_IPAGE_FREE_LOCK(s, i) xt_free_rwlock(i) #define XT_IPAGE_READ_LOCK(i) xt_slock_rwlock_ns(i) #define XT_IPAGE_WRITE_LOCK(i, s) xt_xlock_rwlock_ns(i) +#define XT_IPAGE_WRITE_TRY_LOCK(i, s) xt_xlock_try_rwlock_ns(i) #define XT_IPAGE_UNLOCK(i, x) xt_unlock_rwlock_ns(i) #elif defined(XT_IPAGE_USE_SPINXSLOCK) #define XT_IPAGE_LOCK_TYPE XTSpinXSLockRec #define XT_IPAGE_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, i) #define XT_IPAGE_FREE_LOCK(s, i) xt_spinxslock_free(s, i) #define XT_IPAGE_READ_LOCK(i) xt_spinxslock_slock(i) -#define XT_IPAGE_WRITE_LOCK(i, o) xt_spinxslock_xlock(i, o) +#define XT_IPAGE_WRITE_LOCK(i, o) xt_spinxslock_xlock(i, FALSE, o) +#define XT_IPAGE_WRITE_TRY_LOCK(i, o) xt_spinxslock_xlock(i, TRUE, o) #define XT_IPAGE_UNLOCK(i, x) xt_spinxslock_unlock(i, x) #else // XT_IPAGE_USE_SKEW_RW #define XT_IPAGE_LOCK_TYPE XTSkewRWLockRec #define XT_IPAGE_INIT_LOCK(s, i) xt_skewrwlock_init_with_autoname(s, i) #define XT_IPAGE_FREE_LOCK(s, i) xt_skewrwlock_free(s, i) #define XT_IPAGE_READ_LOCK(i) xt_skewrwlock_slock(i) -#define XT_IPAGE_WRITE_LOCK(i, o) xt_skewrwlock_xlock(i, o) +#define XT_IPAGE_WRITE_LOCK(i, o) xt_skewrwlock_xlock(i, FALSE, o) +#define XT_IPAGE_WRITE_TRY_LOCK(i, o) xt_skewrwlock_xlock(i, TRUE, o) #define XT_IPAGE_UNLOCK(i, x) xt_skewrwlock_unlock(i, x) #endif @@ -103,10 +107,10 @@ typedef struct XTIndBlock { struct XTIndBlock *cb_lr_used; /* Less recently used blocks. */ /* Protected by cb_lock: */ XT_IPAGE_LOCK_TYPE cb_lock; - xtWord1 cb_state; /* Block status. */ + xtWord4 cp_flush_seq; xtWord2 cb_handle_count; /* TRUE if this page is referenced by a handle. */ - xtWord2 cp_flush_seq; xtWord2 cp_del_count; /* Number of deleted entries. */ + xtWord1 cb_state; /* Block status. */ #ifdef XT_USE_DIRECT_IO_ON_INDEX xtWord1 *cb_data; #else diff --git a/storage/pbxt/src/database_xt.cc b/storage/pbxt/src/database_xt.cc index 288520dfed0..8d1b4e46da9 100644 --- a/storage/pbxt/src/database_xt.cc +++ b/storage/pbxt/src/database_xt.cc @@ -68,6 +68,7 @@ xtPublic int xt_db_log_file_count; xtPublic int xt_db_auto_increment_mode; /* 0 = MySQL compatible, 1 = PrimeBase Compatible. */ xtPublic int xt_db_offline_log_function; /* 0 = recycle logs, 1 = delete logs, 2 = keep logs */ xtPublic int xt_db_sweeper_priority; /* 0 = low (default), 1 = normal, 2 = high */ +xtPublic int xt_db_flush_log_at_trx_commit; /* 0 = no-write/no-flush, 1 = yes, 2 = write/no-flush */ xtPublic XTSortedListPtr xt_db_open_db_by_id = NULL; xtPublic XTHashTabPtr xt_db_open_databases = NULL; @@ -288,6 +289,7 @@ xtPublic void xt_stop_database_threads(XTThreadPtr self, xtBool sync) /* Wait for the checkpointer: */ xt_wait_for_checkpointer(self, db); } + xt_stop_flusher(self, db); xt_stop_checkpointer(self, db); xt_stop_writer(self, db); xt_stop_sweeper(self, db); @@ -317,6 +319,7 @@ static void db_finalize(XTThreadPtr self, void *x) { XTDatabaseHPtr db = (XTDatabaseHPtr) x; + xt_stop_flusher(self, db); xt_stop_checkpointer(self, db); xt_stop_compactor(self, db); xt_stop_sweeper(self, db); @@ -475,6 +478,8 @@ xtPublic XTDatabaseHPtr xt_get_database(XTThreadPtr self, char *path, xtBool mul xt_start_compactor(self, db); xt_start_writer(self, db); xt_start_checkpointer(self, db); + if (xt_db_flush_log_at_trx_commit == 0 || xt_db_flush_log_at_trx_commit == 2) + xt_start_flusher(self, db); popr_(); xt_ht_put(self, xt_db_open_databases, db); @@ -574,6 +579,7 @@ xtPublic void xt_drop_database(XTThreadPtr self, XTDatabaseHPtr db) pushr_(xt_ht_unlock, xt_db_open_databases); /* Shutdown the database daemons: */ + xt_stop_flusher(self, db); xt_stop_checkpointer(self, db); xt_stop_sweeper(self, db); xt_stop_compactor(self, db); @@ -902,7 +908,7 @@ xtPublic XTOpenTablePoolPtr xt_db_lock_table_pool_by_name(XTThreadPtr self, XTDa XTTableHPtr tab; xtTableID tab_id; - pushsr_(tab, xt_heap_release, xt_use_table(self, tab_name, no_load, missing_ok, NULL)); + pushsr_(tab, xt_heap_release, xt_use_table(self, tab_name, no_load, missing_ok)); if (!tab) { freer_(); // xt_heap_release(tab) return NULL; diff --git a/storage/pbxt/src/database_xt.h b/storage/pbxt/src/database_xt.h index 21dfdde6f5a..1b1863d2045 100644 --- a/storage/pbxt/src/database_xt.h +++ b/storage/pbxt/src/database_xt.h @@ -60,6 +60,7 @@ extern int xt_db_log_file_count; extern int xt_db_auto_increment_mode; extern int xt_db_offline_log_function; extern int xt_db_sweeper_priority; +extern int xt_db_flush_log_at_trx_commit; extern XTSortedListPtr xt_db_open_db_by_id; extern XTHashTabPtr xt_db_open_databases; @@ -187,6 +188,10 @@ typedef struct XTDatabase : public XTHeap { xt_mutex_type db_cp_lock; xt_cond_type db_cp_cond; /* Writer condition when idle (must bw woken by log flush! */ XTCheckPointStateRec db_cp_state; /* The checkpoint state. */ + + /* The "flusher" thread (used when pbxt_flush_log_at_trx_commit = 0 or 2) */ + struct XTThread *db_fl_thread; /* The flusher thread (flushes the transation log). */ + xt_mutex_type db_fl_lock; } XTDatabaseRec, *XTDatabaseHPtr; /* Heap pointer */ #define XT_FOR_USER 0 diff --git a/storage/pbxt/src/datadic_xt.cc b/storage/pbxt/src/datadic_xt.cc index a236408074d..075d28edabe 100644 --- a/storage/pbxt/src/datadic_xt.cc +++ b/storage/pbxt/src/datadic_xt.cc @@ -1142,8 +1142,8 @@ u_int XTParseTable::columnList(XTThreadPtr self, bool index_cols) void XTParseTable::parseReferenceDefinition(XTThreadPtr self, u_int req_cols) { - int on_delete = XT_KEY_ACTION_DEFAULT; - int on_update = XT_KEY_ACTION_DEFAULT; + int on_delete = XT_KEY_ACTION_RESTRICT; + int on_update = XT_KEY_ACTION_RESTRICT; char name[XT_IDENTIFIER_NAME_SIZE]; char parent_name[XT_IDENTIFIER_NAME_SIZE]; u_int cols = 0; @@ -1437,7 +1437,7 @@ void XTCreateTable::setTableName(XTThreadPtr self, char *name, bool alterTable) XTTableHPtr tab; /* Find the table... */ - pushsr_(tab, xt_heap_release, xt_use_table(self, (XTPathStrPtr) path, FALSE, TRUE, NULL)); + pushsr_(tab, xt_heap_release, xt_use_table(self, (XTPathStrPtr) path, FALSE, TRUE)); /* Clone the foreign key definitions: */ if (tab && tab->tab_dic.dic_table) { @@ -2027,24 +2027,52 @@ bool XTDDTableRef::modifyRow(XTOpenTablePtr XT_UNUSED(ref_ot), xtWord1 *before_b void XTDDTableRef::deleteAllRows(XTThreadPtr self) { XTOpenTablePtr ot; - xtInt8 row_count; + xtBool eof; + xtWord1 *buffer; if (!tr_fkey->getReferenceIndexPtr()) - throw_(); + xt_throw(self); if (!tr_fkey->getIndexPtr()) - throw_(); + xt_throw(self); if (!(ot = xt_db_open_table_using_tab(tr_fkey->co_table->dt_table, self))) - throw_(); + xt_throw(self); + /* {FREE-ROWS-BAD} */ + /* row_count = ((xtInt8) ot->ot_table->tab_row_eof_id) - 1; row_count -= (xtInt8) ot->ot_table->tab_row_fnum; + */ + /* Check if there are any rows in the referencing table: */ + if (!xt_tab_seq_init(ot)) + goto failed; + + if (!(buffer = (xtWord1 *) xt_malloc(self, ot->ot_table->tab_dic.dic_mysql_buf_size))) + goto failed_1; + + if (!xt_tab_seq_next(ot, buffer, &eof)) + goto failed_2; + + xt_free(self, buffer); + + xt_tab_seq_exit(ot); xt_db_return_table_to_pool_ns(ot); - if (row_count > 0) + if (!eof) xt_throw_ixterr(XT_CONTEXT, XT_ERR_ROW_IS_REFERENCED, tr_fkey->co_name); + return; + + failed_2: + xt_free(self, buffer); + + failed_1: + xt_tab_seq_exit(ot); + + failed: + xt_db_return_table_to_pool_ns(ot); + xt_throw(self); } void XTDDIndex::init(XTThreadPtr self, XTObject *obj) @@ -2117,7 +2145,7 @@ void XTDDForeignKey::loadString(XTThreadPtr self, XTStringBufferPtr sb) } xt_sb_concat(self, sb, "`)"); - if (fk_on_delete != XT_KEY_ACTION_DEFAULT && fk_on_delete != XT_KEY_ACTION_RESTRICT) { + if (fk_on_delete != XT_KEY_ACTION_RESTRICT) { xt_sb_concat(self, sb, " ON DELETE "); switch (fk_on_delete) { case XT_KEY_ACTION_CASCADE: xt_sb_concat(self, sb, "CASCADE"); break; @@ -2126,10 +2154,9 @@ void XTDDForeignKey::loadString(XTThreadPtr self, XTStringBufferPtr sb) case XT_KEY_ACTION_NO_ACTION: xt_sb_concat(self, sb, "NO ACTION"); break; } } - if (fk_on_update != XT_KEY_ACTION_DEFAULT && fk_on_update != XT_KEY_ACTION_RESTRICT) { + if (fk_on_update != XT_KEY_ACTION_RESTRICT) { xt_sb_concat(self, sb, " ON UPDATE "); switch (fk_on_update) { - case XT_KEY_ACTION_DEFAULT: xt_sb_concat(self, sb, "RESTRICT"); break; case XT_KEY_ACTION_RESTRICT: xt_sb_concat(self, sb, "RESTRICT"); break; case XT_KEY_ACTION_CASCADE: xt_sb_concat(self, sb, "CASCADE"); break; case XT_KEY_ACTION_SET_NULL: xt_sb_concat(self, sb, "SET NULL"); break; @@ -2259,8 +2286,8 @@ void XTDDForeignKey::removeReference(XTThreadPtr self) { XTDDTable *ref_tab; - xt_xlock_rwlock(self, &co_table->dt_ref_lock); - pushr_(xt_unlock_rwlock, &co_table->dt_ref_lock); + xt_recurrwlock_xlock(self, &co_table->dt_ref_lock); + pushr_(xt_recurrwlock_unxlock, &co_table->dt_ref_lock); if ((ref_tab = fk_ref_table)) { fk_ref_table = NULL; @@ -2270,7 +2297,7 @@ void XTDDForeignKey::removeReference(XTThreadPtr self) fk_ref_index = UINT_MAX; - freer_(); // xt_unlock_rwlock(&co_table->dt_ref_lock); + freer_(); // xt_recurrwlock_unxlock(&co_table->dt_ref_lock); } /* @@ -2289,7 +2316,7 @@ bool XTDDForeignKey::insertRow(xtWord1 *before_buf, xtWord1 *rec_buf, XTThreadPt /* This lock ensures that the foreign key references are not * changed. */ - xt_slock_rwlock_ns(&co_table->dt_ref_lock); + xt_recurrwlock_slock_ns(&co_table->dt_ref_lock); if (!(loc_ind = getIndexPtr())) goto failed; @@ -2374,11 +2401,11 @@ bool XTDDForeignKey::insertRow(xtWord1 *before_buf, xtWord1 *rec_buf, XTThreadPt xt_db_return_table_to_pool_ns(ot); failed: - xt_unlock_rwlock_ns(&co_table->dt_ref_lock); + xt_recurrwlock_unslock_ns(&co_table->dt_ref_lock); return false; success: - xt_unlock_rwlock_ns(&co_table->dt_ref_lock); + xt_recurrwlock_unslock_ns(&co_table->dt_ref_lock); return true; } @@ -2389,7 +2416,6 @@ const char *XTDDForeignKey::actionTypeToString(int action) { switch (action) { - case XT_KEY_ACTION_DEFAULT: case XT_KEY_ACTION_RESTRICT: return "RESTRICT"; case XT_KEY_ACTION_CASCADE: @@ -2407,7 +2433,7 @@ const char *XTDDForeignKey::actionTypeToString(int action) void XTDDTable::init(XTThreadPtr self) { - xt_init_rwlock_with_autoname(self, &dt_ref_lock); + xt_recurrwlock_init_with_autoname(self, &dt_ref_lock); dt_trefs = NULL; } @@ -2444,7 +2470,7 @@ void XTDDTable::finalize(XTThreadPtr self) ptr->release(self); } - xt_free_rwlock(&dt_ref_lock); + xt_recurrwlock_free(&dt_ref_lock); } XTDDColumn *XTDDTable::findColumn(char *name) @@ -2520,8 +2546,8 @@ void XTDDTable::attachReference(XTThreadPtr self, XTDDForeignKey *fk) throw_(); } - xt_xlock_rwlock(self, &dt_ref_lock); - pushr_(xt_unlock_rwlock, &dt_ref_lock); + xt_recurrwlock_xlock(self, &dt_ref_lock); + pushr_(xt_recurrwlock_unxlock, &dt_ref_lock); if (!(tr = new XTDDTableRef())) xt_throw_errno(XT_CONTEXT, XT_ENOMEM); @@ -2536,7 +2562,7 @@ void XTDDTable::attachReference(XTThreadPtr self, XTDDForeignKey *fk) */ xt_heap_reference(self, fk->co_table->dt_table); - freer_(); // xt_unlock_rwlock(&dt_ref_lock); + freer_(); // xt_recurrwlock_unxlock(&dt_ref_lock); } /* @@ -2546,8 +2572,8 @@ void XTDDTable::removeReference(XTThreadPtr self, XTDDForeignKey *fk) { XTDDTableRef *tr, *prev_tr = NULL; - xt_xlock_rwlock(self, &dt_ref_lock); - pushr_(xt_unlock_rwlock, &dt_ref_lock); + xt_recurrwlock_xlock(self, &dt_ref_lock); + pushr_(xt_recurrwlock_unxlock, &dt_ref_lock); tr = dt_trefs; while (tr) { @@ -2561,7 +2587,7 @@ void XTDDTable::removeReference(XTThreadPtr self, XTDDForeignKey *fk) prev_tr = tr; tr = tr->tr_next; } - freer_(); // xt_unlock_rwlock(&dt_ref_lock); + freer_(); // xt_recurrwlock_unxlock(&dt_ref_lock); if (tr) tr->release(self); } @@ -2588,8 +2614,8 @@ void XTDDTable::attachReference(XTThreadPtr self, XTDDTable *dt) dt->attachReference(self, fk); - xt_xlock_rwlock(self, &dt_ref_lock); - pushr_(xt_unlock_rwlock, &dt_ref_lock); + xt_recurrwlock_xlock(self, &dt_ref_lock); + pushr_(xt_recurrwlock_unxlock, &dt_ref_lock); /* Referenced the table, not the index! * We do this because we know that if the table is referenced, the * index will remain valid! @@ -2599,7 +2625,7 @@ void XTDDTable::attachReference(XTThreadPtr self, XTDDTable *dt) */ xt_heap_reference(self, dt->dt_table); fk->fk_ref_table = dt; - freer_(); // xt_unlock_rwlock(&dt_ref_lock); + freer_(); // xt_recurrwlock_unxlock(&dt_ref_lock); } } } @@ -2626,7 +2652,7 @@ void XTDDTable::attachReferences(XTThreadPtr self, XTDatabaseHPtr db) /* get pointer to the referenced table, load it if needed * cyclic references are being handled, absent table is ignored */ - tab = xt_use_table_no_lock(self, db, fk->fk_ref_tab_name, /*TRUE*/FALSE, /*FALSE*/TRUE, NULL, NULL); + tab = xt_use_table_no_lock(self, db, fk->fk_ref_tab_name, /*TRUE*/FALSE, /*FALSE*/TRUE, NULL); if (tab) { pushr_(xt_heap_release, tab); @@ -2663,8 +2689,8 @@ void XTDDTable::removeReferences(XTThreadPtr self) XTDDTableRef *tr; XTDDTable *tab; - xt_xlock_rwlock(self, &dt_ref_lock); - pushr_(xt_unlock_rwlock, &dt_ref_lock); + xt_recurrwlock_xlock(self, &dt_ref_lock); + pushr_(xt_recurrwlock_unxlock, &dt_ref_lock); for (u_int i=0; i<dt_fkeys.size(); i++) { fk = dt_fkeys.itemAt(i); @@ -2675,13 +2701,13 @@ void XTDDTable::removeReferences(XTThreadPtr self) /* To avoid deadlock we do not hold more than * one lock at a time! */ - freer_(); // xt_unlock_rwlock(&dt_ref_lock); + freer_(); // xt_recurrwlock_unxlock(&dt_ref_lock); tab->removeReference(self, fk); xt_heap_release(self, tab->dt_table); /* We referenced the table, not the index! */ - xt_xlock_rwlock(self, &dt_ref_lock); - pushr_(xt_unlock_rwlock, &dt_ref_lock); + xt_recurrwlock_xlock(self, &dt_ref_lock); + pushr_(xt_recurrwlock_unxlock, &dt_ref_lock); } } } @@ -2689,13 +2715,13 @@ void XTDDTable::removeReferences(XTThreadPtr self) while (dt_trefs) { tr = dt_trefs; dt_trefs = tr->tr_next; - freer_(); // xt_unlock_rwlock(&dt_ref_lock); + freer_(); // xt_recurrwlock_unxlock(&dt_ref_lock); tr->release(self); - xt_xlock_rwlock(self, &dt_ref_lock); - pushr_(xt_unlock_rwlock, &dt_ref_lock); + xt_recurrwlock_xlock(self, &dt_ref_lock); + pushr_(xt_recurrwlock_unxlock, &dt_ref_lock); } - freer_(); // xt_unlock_rwlock(&dt_ref_lock); + freer_(); // xt_recurrwlock_unxlock(&dt_ref_lock); } void XTDDTable::checkForeignKeys(XTThreadPtr self, bool temp_table) @@ -2727,7 +2753,7 @@ void XTDDTable::checkForeignKeys(XTThreadPtr self, bool temp_table) // TODO: dont close table immediately so it can be possibly reused in this loop XTTable *ref_tab; - pushsr_(ref_tab, xt_heap_release, xt_use_table(self, fk->fk_ref_tab_name, FALSE, TRUE, NULL)); + pushsr_(ref_tab, xt_heap_release, xt_use_table(self, fk->fk_ref_tab_name, FALSE, TRUE)); if (ref_tab && !fk->checkReferencedTypes(ref_tab->tab_dic.dic_table)) throw_(); freer_(); @@ -2845,7 +2871,7 @@ bool XTDDTable::checkNoAction(XTOpenTablePtr ot, xtRecordID rec_id) return false; rec_ptr = rec_buf.ib_db.db_data; - xt_slock_rwlock_ns(&dt_ref_lock); + xt_recurrwlock_slock_ns(&dt_ref_lock); tr = dt_trefs; while (tr) { if (!tr->checkReference(rec_ptr, ot->ot_thread)) { @@ -2854,7 +2880,7 @@ bool XTDDTable::checkNoAction(XTOpenTablePtr ot, xtRecordID rec_id) } tr = tr->tr_next; } - xt_unlock_rwlock_ns(&dt_ref_lock); + xt_recurrwlock_unslock_ns(&dt_ref_lock); xt_ib_free(NULL, &rec_buf); return ok; } @@ -2875,7 +2901,7 @@ bool XTDDTable::deleteRow(XTOpenTablePtr ot, xtWord1 *rec_ptr) rec_ptr = rec_buf.ib_db.db_data; } - xt_slock_rwlock_ns(&dt_ref_lock); + xt_recurrwlock_slock_ns(&dt_ref_lock); tr = dt_trefs; while (tr) { if (!tr->modifyRow(ot, rec_ptr, NULL, ot->ot_thread)) { @@ -2884,7 +2910,7 @@ bool XTDDTable::deleteRow(XTOpenTablePtr ot, xtWord1 *rec_ptr) } tr = tr->tr_next; } - xt_unlock_rwlock_ns(&dt_ref_lock); + xt_recurrwlock_unslock_ns(&dt_ref_lock); xt_ib_free(NULL, &rec_buf); return ok; } @@ -2893,8 +2919,8 @@ void XTDDTable::deleteAllRows(XTThreadPtr self) { XTDDTableRef *tr; - xt_slock_rwlock(self, &dt_ref_lock); - pushr_(xt_unlock_rwlock, &dt_ref_lock); + xt_recurrwlock_slock(self, &dt_ref_lock); + pushr_(xt_recurrwlock_unslock, &dt_ref_lock); tr = dt_trefs; while (tr) { @@ -2902,7 +2928,7 @@ void XTDDTable::deleteAllRows(XTThreadPtr self) tr = tr->tr_next; } - freer_(); // xt_unlock_rwlock(&dt_ref_lock); + freer_(); // xt_recurrwlock_unslock(&dt_ref_lock); } bool XTDDTable::updateRow(XTOpenTablePtr ot, xtWord1 *before, xtWord1 *after) @@ -2932,7 +2958,7 @@ bool XTDDTable::updateRow(XTOpenTablePtr ot, xtWord1 *before, xtWord1 *after) ok = true; before_buf.ib_free = FALSE; - xt_slock_rwlock_ns(&dt_ref_lock); + xt_recurrwlock_slock_ns(&dt_ref_lock); if ((tr = dt_trefs)) { if (!before) { if (!xt_tab_load_record(ot, ot->ot_curr_rec_id, &before_buf)) @@ -2948,7 +2974,7 @@ bool XTDDTable::updateRow(XTOpenTablePtr ot, xtWord1 *before, xtWord1 *after) tr = tr->tr_next; } } - xt_unlock_rwlock_ns(&dt_ref_lock); + xt_recurrwlock_unslock_ns(&dt_ref_lock); xt_ib_free(NULL, &before_buf); return ok; diff --git a/storage/pbxt/src/datadic_xt.h b/storage/pbxt/src/datadic_xt.h index 1e56561614d..8dd6387f137 100644 --- a/storage/pbxt/src/datadic_xt.h +++ b/storage/pbxt/src/datadic_xt.h @@ -45,7 +45,6 @@ struct XTIndex; #define XT_DD_KEY_PRIMARY 2 #define XT_DD_KEY_FOREIGN 3 -#define XT_KEY_ACTION_DEFAULT 0 #define XT_KEY_ACTION_RESTRICT 1 #define XT_KEY_ACTION_CASCADE 2 #define XT_KEY_ACTION_SET_NULL 3 @@ -259,7 +258,7 @@ class XTDDTable : public XTObject { XTList<XTDDColumn> dt_cols; XTList<XTDDIndex> dt_indexes; - xt_rwlock_type dt_ref_lock; /* The lock for adding and using references. */ + XTRecurRWLockRec dt_ref_lock; /* The lock for adding and using references. */ XTList<XTDDForeignKey> dt_fkeys; /* The foreign keys on this table. */ XTDDTableRef *dt_trefs; /* A list of tables that reference this table. */ diff --git a/storage/pbxt/src/datalog_xt.cc b/storage/pbxt/src/datalog_xt.cc index 3530b516f62..ff58a122e10 100644 --- a/storage/pbxt/src/datalog_xt.cc +++ b/storage/pbxt/src/datalog_xt.cc @@ -1148,6 +1148,11 @@ void XTDataLogBuffer::dlb_exit(XTThreadPtr self) xtBool XTDataLogBuffer::dlb_close_log(XTThreadPtr thread) { if (dlb_data_log) { + if (dlb_data_log->dlf_log_file) { + if (!dl_write_log_header(dlb_data_log, dlb_data_log->dlf_log_file, 0, thread)) + return FAILED; + } + /* Flush and commit the data in the old log: */ if (!dlb_flush_log(TRUE, thread)) return FAILED; @@ -1244,7 +1249,7 @@ xtBool XTDataLogBuffer::dlb_write_thru_log(xtLogID XT_NDEBUG_UNUSED(log_id), xtL */ dlb_data_log->dlf_log_eof += size; #ifdef DEBUG - if (log_offset + size > dlb_max_write_offset) + if ((ulonglong) (log_offset + size) > (ulonglong) dlb_max_write_offset) dlb_max_write_offset = log_offset + size; #endif dlb_flush_required = TRUE; @@ -1286,7 +1291,7 @@ xtBool XTDataLogBuffer::dlb_append_log(xtLogID XT_NDEBUG_UNUSED(log_id), xtLogOf if (!xt_pwrite_file(dlb_data_log->dlf_log_file, log_offset, size, data, &thread->st_statistics.st_data, thread)) return FAILED; #ifdef DEBUG - if (log_offset + size > dlb_max_write_offset) + if ((ulonglong) (log_offset + size) > (ulonglong) dlb_max_write_offset) dlb_max_write_offset = log_offset + size; #endif dlb_flush_required = TRUE; @@ -1729,8 +1734,8 @@ static xtBool dl_collect_garbage(XTThreadPtr self, XTDatabaseHPtr db, XTDataLogF xtLogOffset src_log_offset; xtLogID curr_log_id; xtLogOffset curr_log_offset; - xtLogID dest_log_id; - xtLogOffset dest_log_offset; + xtLogID dest_log_id= 0; + xtLogOffset dest_log_offset= 0; off_t garbage_count = 0; memset(&cs, 0, sizeof(XTCompactorStateRec)); @@ -1952,7 +1957,7 @@ static xtBool dl_collect_garbage(XTThreadPtr self, XTDatabaseHPtr db, XTDataLogF log_rec.xl_status_1 = XT_LOG_ENT_DEL_LOG; log_rec.xl_checksum_1 = XT_CHECKSUM_1(data_log->dlf_log_id); XT_SET_DISK_4(log_rec.xl_log_id_4, data_log->dlf_log_id); - if (!xt_xlog_log_data(self, sizeof(XTXactNewLogEntryDRec), (XTXactLogBufferDPtr) &log_rec, TRUE)) { + if (!xt_xlog_log_data(self, sizeof(XTXactNewLogEntryDRec), (XTXactLogBufferDPtr) &log_rec, XT_XLOG_WRITE_AND_FLUSH)) { db->db_datalogs.dls_set_log_state(data_log, XT_DL_TO_COMPACT); xt_throw(self); } diff --git a/storage/pbxt/src/filesys_xt.h b/storage/pbxt/src/filesys_xt.h index d6762823cc0..6d8dd280e5e 100644 --- a/storage/pbxt/src/filesys_xt.h +++ b/storage/pbxt/src/filesys_xt.h @@ -119,7 +119,7 @@ xtBool xt_fs_rename(struct XTThread *self, char *from_path, char *to_path); #define FILE_MAP_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, i) #define FILE_MAP_FREE_LOCK(s, i) xt_spinxslock_free(s, i) #define FILE_MAP_READ_LOCK(i, o) xt_spinxslock_slock(i, o) -#define FILE_MAP_WRITE_LOCK(i, o) xt_spinxslock_xlock(i, o) +#define FILE_MAP_WRITE_LOCK(i, o) xt_spinxslock_xlock(i, FALSE, o) #define FILE_MAP_UNLOCK(i, o) xt_spinxslock_unlock(i, o) #endif diff --git a/storage/pbxt/src/ha_pbxt.cc b/storage/pbxt/src/ha_pbxt.cc index 78de3c44e37..ba3aa756516 100644 --- a/storage/pbxt/src/ha_pbxt.cc +++ b/storage/pbxt/src/ha_pbxt.cc @@ -80,6 +80,7 @@ using drizzled::plugin::InfoSchemaMethods; #include "systab_xt.h" #include "xaction_xt.h" #include "backup_xt.h" +#include "heap_xt.h" #ifdef DEBUG //#define XT_USE_SYS_PAR_DEBUG_SIZES @@ -113,6 +114,7 @@ static int pbxt_prepare(handlerton *hton, THD *thd, bool all); static int pbxt_recover(handlerton *hton, XID *xid_list, uint len); static int pbxt_commit_by_xid(handlerton *hton, XID *xid); static int pbxt_rollback_by_xid(handlerton *hton, XID *xid); +static int pbxt_start_consistent_snapshot(handlerton *hton, THD *thd); #endif static void ha_aquire_exclusive_use(XTThreadPtr self, XTSharePtr share, ha_pbxt *mine); static void ha_release_exclusive_use(XTThreadPtr self, XTSharePtr share); @@ -286,7 +288,7 @@ static void ha_trace_function(const char *function, char *table) char func_buf[50], *ptr; XTThreadPtr thread = xt_get_self(); - if ((ptr = strchr(function, '('))) { + if ((ptr = const_cast<char *>(strchr(function, '(')))) { ptr--; while (ptr > function) { if (!(isalnum(*ptr) || *ptr == '_')) @@ -345,13 +347,13 @@ static xtHashValue ha_hash_ci(xtBool is_key, void *key_data) return xt_ht_casehash(share->sh_table_path->ps_path); } -static void ha_open_share(XTThreadPtr self, XTShareRec *share, xtBool *tabled_opened) +static void ha_open_share(XTThreadPtr self, XTShareRec *share) { xt_lock_mutex(self, (xt_mutex_type *) share->sh_ex_mutex); pushr_(xt_unlock_mutex, share->sh_ex_mutex); if (!share->sh_table) { - share->sh_table = xt_use_table(self, share->sh_table_path, FALSE, FALSE, tabled_opened); + share->sh_table = xt_use_table(self, share->sh_table_path, FALSE, FALSE); share->sh_dic_key_count = share->sh_table->tab_dic.dic_key_count; share->sh_dic_keys = share->sh_table->tab_dic.dic_keys; share->sh_recalc_selectivity = FALSE; @@ -411,7 +413,7 @@ static void ha_hash_free(XTThreadPtr self, void *data) * This structure contains information that is common to all handles. * (i.e. it is table specific). */ -static XTSharePtr ha_get_share(XTThreadPtr self, const char *table_path, bool open_table, xtBool *tabled_opened) +static XTSharePtr ha_get_share(XTThreadPtr self, const char *table_path, bool open_table) { XTShareRec *share; @@ -433,7 +435,7 @@ static XTSharePtr ha_get_share(XTThreadPtr self, const char *table_path, bool op share->sh_table_path = (XTPathStrPtr) xt_dup_string(self, table_path); if (open_table) - ha_open_share(self, share, tabled_opened); + ha_open_share(self, share); popr_(); // Discard ha_cleanup_share(share); @@ -476,6 +478,25 @@ static xtBool ha_unget_share_removed(XTThreadPtr self, XTSharePtr share) return removed; } +static inline void thd_init_xact(THD *thd, XTThreadPtr self, bool set_table_trans) +{ + self->st_xact_mode = thd_tx_isolation(thd) <= ISO_READ_COMMITTED ? XT_XACT_COMMITTED_READ : XT_XACT_REPEATABLE_READ; + self->st_ignore_fkeys = (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) != 0; + self->st_auto_commit = (thd_test_options(thd,(OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) == 0; + if (set_table_trans) { +#ifdef DRIZZLED + self->st_table_trans = FALSE; +#else + self->st_table_trans = thd_sql_command(thd) == SQLCOM_LOCK_TABLES; +#endif + } + self->st_abort_trans = FALSE; + self->st_stat_ended = FALSE; + self->st_stat_trans = FALSE; + XT_PRINT0(self, "xt_xn_begin\n"); + xt_xres_wait_for_recovery(self, XT_RECOVER_SWEPT); +} + /* * ----------------------------------------------------------------------- * PUBLIC FUNCTIONS @@ -1146,6 +1167,7 @@ static int pbxt_init(void *p) pbxt_hton->show_status = pbxt_show_status; pbxt_hton->flags = HTON_NO_FLAGS; /* HTON_CAN_RECREATE - Without this flags TRUNCATE uses delete_all_rows() */ pbxt_hton->slot = (uint)-1; /* assign invald value, so we know when it's inited later */ + pbxt_hton->start_consistent_snapshot = pbxt_start_consistent_snapshot; #if defined(MYSQL_SUPPORTS_BACKUP) && defined(XT_ENABLE_ONLINE_BACKUP) pbxt_hton->get_backup_engine = pbxt_backup_engine; #endif @@ -1175,13 +1197,8 @@ static int pbxt_init(void *p) * +1 Temporary thread (e.g. TempForClose, TempForEnd) */ #ifndef DRIZZLED - if (pbxt_max_threads == 0) { - // Embedded server sets max_connections=1 - if (max_connections > 1) - pbxt_max_threads = max_connections + 7; - else - pbxt_max_threads = 100; - } + if (pbxt_max_threads == 0) + pbxt_max_threads = max_connections + 7; #endif self = xt_init_threading(pbxt_max_threads); /* Create the main self: */ if (!self) @@ -1284,7 +1301,7 @@ static int pbxt_init(void *p) #6 0x000debe1 in THD::THD at sql_class.cc:631 #7 0x00e207a4 in myxt_create_thread at myxt_xt.cc:2666 #8 0x00e3134b in tabc_fr_run_thread at tabcache_xt.cc:982 - #9 0x00e422ca in thr_main_pbxt at thread_xt.cc:1006 + #9 0x00e422ca in xt_thread_main at thread_xt.cc:1006 #10 0x91ff7c55 in _pthread_start #11 0x91ff7b12 in thread_start * @@ -1417,8 +1434,43 @@ static void pbxt_drop_database(handlerton *XT_UNUSED(hton), char *XT_UNUSED(path * * 3. If in BEGIN/END we must call ha_rollback() if we abort the transaction * internally. + * + * NOTE ON CONSISTENT SNAPSHOTS: + * + * PBXT itself doesn't need this functiona as its transaction mechanism provides + * consistent snapshots for all transactions by default. This function is needed + * only for multi-engine cases like this: + * + * CREATE TABLE t1 ... ENGINE=INNODB + * CREATE TABLE t2 ... ENGINE=PBXT + * START TRANSACTION WITH CONSISTENT SNAPSHOT + * SELECT * FROM t1 <-- at this point we need to know about the snapshot */ +static int pbxt_start_consistent_snapshot(handlerton *hton, THD *thd) +{ + int err = 0; + XTThreadPtr self = ha_set_current_thread(thd, &err); + + if (!self->st_database && pbxt_database) { + xt_ha_open_database_of_table(self, (XTPathStrPtr) NULL); + } + + thd_init_xact(thd, self, true); + + if (xt_xn_begin(self)) { + trans_register_ha(thd, TRUE, hton); + } else { + err = xt_ha_pbxt_thread_error_for_mysql(thd, self, FALSE); + } + + /* + * As of MySQL 5.1.41 the return value is not checked, so the server might assume + * everything is fine even it isn't. InnoDB returns 0 on success. + */ + return err; +} + /* * Commit the PBXT transaction of the given thread. * thd is the MySQL thread structure. @@ -1860,7 +1912,6 @@ xtPublic int ha_pbxt::reopen() THD *thd = current_thd; int err = 0; XTThreadPtr self; - xtBool tabled_opened = FALSE; if (!(self = ha_set_current_thread(thd, &err))) return xt_ha_pbxt_to_mysql_error(err); @@ -1868,24 +1919,30 @@ xtPublic int ha_pbxt::reopen() try_(a) { xt_ha_open_database_of_table(self, pb_share->sh_table_path); - ha_open_share(self, pb_share, &tabled_opened); + ha_open_share(self, pb_share); if (!(pb_open_tab = xt_db_open_table_using_tab(pb_share->sh_table, self))) xt_throw(self); pb_open_tab->ot_thread = self; - if (tabled_opened) { + /* {TABLE-STATS} + * We no longer use the information that a table + * was opened in order to know when to calculate + * statistics. + */ + if (!pb_open_tab->ot_table->tab_ind_stat_calc_time) { #ifdef LOAD_TABLE_ON_OPEN xt_tab_load_table(self, pb_open_tab); #else xt_tab_load_row_pointers(self, pb_open_tab); #endif - xt_ind_set_index_selectivity(self, pb_open_tab); + xt_ind_set_index_selectivity(pb_open_tab, self); /* If the number of rows is less than 150 we will recalculate the * selectity of the indices, as soon as the number of rows * exceeds 200 (see [**]) */ - pb_share->sh_recalc_selectivity = (pb_share->sh_table->tab_row_eof_id - 1 - pb_share->sh_table->tab_row_fnum) < 150; + /* {FREE-ROWS-BAD} */ + pb_share->sh_recalc_selectivity = (pb_share->sh_table->tab_row_eof_id - 1 /* - pb_share->sh_table->tab_row_fnum */) < 150; } /* I am not doing this anymore because it was only required @@ -2259,7 +2316,6 @@ int ha_pbxt::open(const char *table_path, int XT_UNUSED(mode), uint XT_UNUSED(te THD *thd = current_thd; int err = 0; XTThreadPtr self; - xtBool tabled_opened = FALSE; ref_length = XT_RECORD_OFFS_SIZE; @@ -2272,28 +2328,30 @@ int ha_pbxt::open(const char *table_path, int XT_UNUSED(mode), uint XT_UNUSED(te try_(a) { xt_ha_open_database_of_table(self, (XTPathStrPtr) table_path); - pb_share = ha_get_share(self, table_path, true, &tabled_opened); + pb_share = ha_get_share(self, table_path, false); ha_add_to_handler_list(self, pb_share, this); if (pb_share->sh_table_lock) { if (!ha_wait_for_shared_use(this, pb_share)) xt_throw(self); } - ha_open_share(self, pb_share, &tabled_opened); + ha_open_share(self, pb_share); thr_lock_data_init(&pb_share->sh_lock, &pb_lock, NULL); if (!(pb_open_tab = xt_db_open_table_using_tab(pb_share->sh_table, self))) xt_throw(self); pb_open_tab->ot_thread = self; - if (tabled_opened) { + /* {TABLE-STATS} */ + if (!pb_open_tab->ot_table->tab_ind_stat_calc_time) { #ifdef LOAD_TABLE_ON_OPEN xt_tab_load_table(self, pb_open_tab); #else xt_tab_load_row_pointers(self, pb_open_tab); #endif - xt_ind_set_index_selectivity(self, pb_open_tab); - pb_share->sh_recalc_selectivity = (pb_share->sh_table->tab_row_eof_id - 1 - pb_share->sh_table->tab_row_fnum) < 150; + xt_ind_set_index_selectivity(pb_open_tab, self); + /* {FREE-ROWS-BAD} */ + pb_share->sh_recalc_selectivity = (pb_share->sh_table->tab_row_eof_id - 1 /* - pb_share->sh_table->tab_row_fnum */) < 150; } init_auto_increment(0); @@ -2401,7 +2459,7 @@ void ha_pbxt::init_auto_increment(xtWord8 min_auto_inc) self->st_abort_trans = FALSE; self->st_stat_ended = FALSE; self->st_stat_trans = FALSE; - self->st_is_update = FALSE; + self->st_is_update = NULL; if (!xt_xn_begin(self)) { xt_spinlock_unlock(&tab->tab_ainc_lock); xt_throw(self); @@ -2641,8 +2699,14 @@ int ha_pbxt::write_row(byte *buf) * and if it gets dup-key error it tries UPDATE, so the same row can be overwriten multiple * times within the same statement */ - if (err == HA_ERR_FOUND_DUPP_KEY && pb_open_tab->ot_thread->st_is_update) - pb_open_tab->ot_thread->st_update_id++; + if (err == HA_ERR_FOUND_DUPP_KEY && pb_open_tab->ot_thread->st_is_update) { + /* Pop the update stack: */ + //pb_open_tab->ot_thread->st_update_id++; + XTOpenTablePtr curr = pb_open_tab->ot_thread->st_is_update; + + pb_open_tab->ot_thread->st_is_update = curr->ot_prev_update; + curr->ot_prev_update = NULL; + } } done: @@ -2710,9 +2774,12 @@ int ha_pbxt::update_row(const byte * old_data, byte * new_data) xt_xlog_check_long_writer(self); - if (!self->st_is_update) { - self->st_is_update = TRUE; - self->st_update_id++; + /* {UPDATE-STACK} */ + if (self->st_is_update != pb_open_tab) { + /* Push the update stack: */ + pb_open_tab->ot_prev_update = self->st_is_update; + self->st_is_update = pb_open_tab; + pb_open_tab->ot_update_id++; } if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) @@ -3110,6 +3177,7 @@ int ha_pbxt::index_init(uint idx, bool XT_UNUSED(sorted)) active_index = idx; if (pb_open_tab->ot_table->tab_dic.dic_disable_index) { + active_index = MAX_KEY; xt_tab_set_index_error(pb_open_tab->ot_table); return ha_log_pbxt_thread_error_for_mysql(pb_ignore_dup_key); } @@ -3260,6 +3328,10 @@ int ha_pbxt::index_read_xt(byte * buf, uint idx, const byte *key, uint key_len, int prefix = 0; XTIdxSearchKeyRec search_key; + if (idx == MAX_KEY) { + err = HA_ERR_WRONG_INDEX; + goto done; + } #ifdef XT_TRACK_RETURNED_ROWS ha_start_scan(pb_open_tab, idx); #endif @@ -3310,6 +3382,7 @@ int ha_pbxt::index_read_xt(byte * buf, uint idx, const byte *key, uint key_len, ha_return_row(pb_open_tab, idx); #endif XT_DISABLED_TRACE(("search tx=%d val=%d err=%d\n", (int) pb_open_tab->ot_thread->st_xact_data->xd_start_xn_id, (int) XT_GET_DISK_4(key), err)); + done: if (err) table->status = STATUS_NOT_FOUND; else { @@ -3354,6 +3427,10 @@ int ha_pbxt::index_next(byte * buf) //statistic_increment(ha_read_next_count,&LOCK_status); ASSERT_NS(pb_ex_in_use); + if (active_index == MAX_KEY) { + err = HA_ERR_WRONG_INDEX; + goto done; + } ind = (XTIndexPtr) pb_share->sh_dic_keys[active_index]; if (!xt_idx_next(pb_open_tab, ind, NULL)) @@ -3366,6 +3443,7 @@ int ha_pbxt::index_next(byte * buf) if (!err) ha_return_row(pb_open_tab, active_index); #endif + done: if (err) table->status = STATUS_NOT_FOUND; else { @@ -3396,6 +3474,10 @@ int ha_pbxt::index_next_same(byte * buf, const byte *key, uint length) //statistic_increment(ha_read_next_count,&LOCK_status); ASSERT_NS(pb_ex_in_use); + if (active_index == MAX_KEY) { + err = HA_ERR_WRONG_INDEX; + goto done; + } ind = (XTIndexPtr) pb_share->sh_dic_keys[active_index]; search_key.sk_key_value.sv_flags = HA_READ_KEY_EXACT; @@ -3415,6 +3497,7 @@ int ha_pbxt::index_next_same(byte * buf, const byte *key, uint length) if (!err) ha_return_row(pb_open_tab, active_index); #endif + done: if (err) table->status = STATUS_NOT_FOUND; else { @@ -3436,6 +3519,10 @@ int ha_pbxt::index_prev(byte * buf) //statistic_increment(ha_read_prev_count,&LOCK_status); ASSERT_NS(pb_ex_in_use); + if (active_index == MAX_KEY) { + err = HA_ERR_WRONG_INDEX; + goto done; + } ind = (XTIndexPtr) pb_share->sh_dic_keys[active_index]; if (!xt_idx_prev(pb_open_tab, ind, NULL)) @@ -3448,6 +3535,7 @@ int ha_pbxt::index_prev(byte * buf) if (!err) ha_return_row(pb_open_tab, active_index); #endif + done: if (err) table->status = STATUS_NOT_FOUND; else { @@ -3470,6 +3558,18 @@ int ha_pbxt::index_first(byte * buf) //statistic_increment(ha_read_first_count,&LOCK_status); ASSERT_NS(pb_ex_in_use); + /* This is required because MySQL ignores the error returned + * init init_index sometimes, for example: + * + * if (!table->file->inited) + * table->file->ha_index_init(tab->index, tab->sorted); + * if ((error=tab->table->file->index_first(tab->table->record[0]))) + */ + if (active_index == MAX_KEY) { + err = HA_ERR_WRONG_INDEX; + goto done; + } + #ifdef XT_TRACK_RETURNED_ROWS ha_start_scan(pb_open_tab, active_index); #endif @@ -3488,6 +3588,7 @@ int ha_pbxt::index_first(byte * buf) if (!err) ha_return_row(pb_open_tab, active_index); #endif + done: if (err) table->status = STATUS_NOT_FOUND; else { @@ -3510,6 +3611,11 @@ int ha_pbxt::index_last(byte * buf) //statistic_increment(ha_read_last_count,&LOCK_status); ASSERT_NS(pb_ex_in_use); + if (active_index == MAX_KEY) { + err = HA_ERR_WRONG_INDEX; + goto done; + } + #ifdef XT_TRACK_RETURNED_ROWS ha_start_scan(pb_open_tab, active_index); #endif @@ -3528,6 +3634,7 @@ int ha_pbxt::index_last(byte * buf) if (!err) ha_return_row(pb_open_tab, active_index); #endif + done: if (err) table->status = STATUS_NOT_FOUND; else { @@ -3815,8 +3922,34 @@ int ha_pbxt::info(uint flag) if ((ot = pb_open_tab)) { if (flag & HA_STATUS_VARIABLE) { - stats.deleted = ot->ot_table->tab_row_fnum; - stats.records = (ha_rows) (ot->ot_table->tab_row_eof_id - 1 - stats.deleted); + /* {FREE-ROWS-BAD} + * Free row count is not reliable, so ignore it. + * The problem is if tab_row_fnum > tab_row_eof_id - 1 then + * we have a very bad result. + * + * If stats.records+EXTRA_RECORDS == 0 as returned by + * estimate_rows_upper_bound(), then filesort will crash here: + * + * make_sortkey(param,sort_keys[idx++],ref_pos); + * + * #0 0x000bf69c in Field_long::sort_string at field.cc:3766 + * #1 0x0022e1f1 in make_sortkey at filesort.cc:769 + * #2 0x0022f1cf in find_all_keys at filesort.cc:619 + * #3 0x00230eec in filesort at filesort.cc:243 + * #4 0x001b9d89 in mysql_update at sql_update.cc:415 + * #5 0x0010db12 in mysql_execute_command at sql_parse.cc:2959 + * #6 0x0011480d in mysql_parse at sql_parse.cc:5787 + * #7 0x00115afb in dispatch_command at sql_parse.cc:1200 + * #8 0x00116de2 in do_command at sql_parse.cc:857 + * #9 0x00101ee4 in handle_one_connection at sql_connect.cc:1115 + * + * The problem is that sort_keys is allocated to handle just 1 vector. + * Sorting one vector crashes. Although I could not find a check for + * the actual number of vectors. But it must assume that it has at + * least EXTRA_RECORDS vectors. + */ + stats.deleted = /* ot->ot_table->tab_row_fnum */ 0; + stats.records = (ha_rows) (ot->ot_table->tab_row_eof_id - 1 /* - stats.deleted */); stats.data_file_length = xt_rec_id_to_rec_offset(ot->ot_table, ot->ot_table->tab_rec_eof_id); stats.index_file_length = xt_ind_node_to_offset(ot->ot_table, ot->ot_table->tab_ind_eof); stats.delete_length = ot->ot_table->tab_rec_fnum * ot->ot_rec_size; @@ -4444,11 +4577,13 @@ xtPublic int ha_pbxt::external_lock(THD *thd, int lock_type) } if (pb_share->sh_recalc_selectivity) { - if ((pb_share->sh_table->tab_row_eof_id - 1 - pb_share->sh_table->tab_row_fnum) >= 200) { + /* {FREE-ROWS-BAD} */ + if ((pb_share->sh_table->tab_row_eof_id - 1 /* - pb_share->sh_table->tab_row_fnum */) >= 200) { /* [**] */ pb_share->sh_recalc_selectivity = FALSE; - xt_ind_set_index_selectivity(self, pb_open_tab); - pb_share->sh_recalc_selectivity = (pb_share->sh_table->tab_row_eof_id - 1 - pb_share->sh_table->tab_row_fnum) < 150; + xt_ind_set_index_selectivity(pb_open_tab, self); + /* {FREE-ROWS-BAD} */ + pb_share->sh_recalc_selectivity = (pb_share->sh_table->tab_row_eof_id - 1 /* - pb_share->sh_table->tab_row_fnum */) < 150; } } } @@ -4487,7 +4622,7 @@ xtPublic int ha_pbxt::external_lock(THD *thd, int lock_type) if (!pb_share->sh_table) { xt_ha_open_database_of_table(self, pb_share->sh_table_path); - ha_open_share(self, pb_share, NULL); + ha_open_share(self, pb_share); } } catch_(a) { @@ -4593,8 +4728,8 @@ xtPublic int ha_pbxt::external_lock(THD *thd, int lock_type) cont_(b); } - /* See {IS-UPDATE-STAT} */ - self->st_is_update = FALSE; + /* See {IS-UPDATE-STAT} nad {UPDATE-STACK} */ + self->st_is_update = NULL; /* Auto begin a transaction (if one is not already running): */ if (!self->st_xact_data) { @@ -4602,19 +4737,8 @@ xtPublic int ha_pbxt::external_lock(THD *thd, int lock_type) (void) ASSERT_NS(ISO_READ_UNCOMMITTED == XT_XACT_UNCOMMITTED_READ); (void) ASSERT_NS(ISO_SERIALIZABLE == XT_XACT_SERIALIZABLE); - self->st_xact_mode = thd_tx_isolation(thd) <= ISO_READ_COMMITTED ? XT_XACT_COMMITTED_READ : XT_XACT_REPEATABLE_READ; - self->st_ignore_fkeys = (thd_test_options(thd,OPTION_NO_FOREIGN_KEY_CHECKS)) != 0; - self->st_auto_commit = (thd_test_options(thd, (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) == 0; -#ifdef DRIZZLED - self->st_table_trans = FALSE; -#else - self->st_table_trans = thd_sql_command(thd) == SQLCOM_LOCK_TABLES; -#endif - self->st_abort_trans = FALSE; - self->st_stat_ended = FALSE; - self->st_stat_trans = FALSE; - XT_PRINT0(self, "xt_xn_begin\n"); - xt_xres_wait_for_recovery(self, XT_RECOVER_SWEPT); + thd_init_xact(thd, self, true); + if (!xt_xn_begin(self)) { err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key); pb_ex_in_use = 0; @@ -4837,19 +4961,27 @@ int ha_pbxt::start_stmt(THD *thd, thr_lock_type lock_type) * are nested within an open close of the select t1 * statement. */ - self->st_is_update = FALSE; + /* {UPDATE-STACK} + * Add to this I add the following: + * A trigger in the middle of an update also causes nested + * statements. If I reset st_is_update, then then + * when the trigger returns the system thinks we + * are in a different update statement, and may + * update the same row again. + */ + if (self->st_is_update == pb_open_tab) { + /* Pop the update stack: */ + XTOpenTablePtr curr = pb_open_tab->ot_thread->st_is_update; + + pb_open_tab->ot_thread->st_is_update = curr->ot_prev_update; + curr->ot_prev_update = NULL; + } /* See comment {START-TRANS} */ if (!self->st_xact_data) { - self->st_xact_mode = thd_tx_isolation(thd) <= ISO_READ_COMMITTED ? XT_XACT_COMMITTED_READ : XT_XACT_REPEATABLE_READ; - self->st_ignore_fkeys = (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) != 0; - self->st_auto_commit = (thd_test_options(thd,(OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) == 0; - /* self->st_table_trans = not set here! */ - self->st_abort_trans = FALSE; - self->st_stat_ended = FALSE; - self->st_stat_trans = FALSE; - XT_PRINT0(self, "xt_xn_begin\n"); - xt_xres_wait_for_recovery(self, XT_RECOVER_SWEPT); + + thd_init_xact(thd, self, false); + if (!xt_xn_begin(self)) { err = xt_ha_pbxt_thread_error_for_mysql(thd, self, pb_ignore_dup_key); goto complete; @@ -4905,6 +5037,18 @@ int ha_pbxt::start_stmt(THD *thd, thr_lock_type lock_type) */ THR_LOCK_DATA **ha_pbxt::store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type) { + /* + * TL_READ means concurrent INSERTs are allowed. This is a problem as in this mode + * PBXT is not compatible with MyISAM which allows INSERTs but isolates them from + * current "transaction" (started by LOCK TABLES, ended by UNLOCK TABLES). PBXT + * used to allow INSERTs and made them visible to the locker (on commit). + * While MySQL manual doesn't state anything regarding row visibility limitations + * we choose to convert local locks into normal read locks for better compatibility + * with MyISAM. + */ + if (lock_type == TL_READ) + lock_type = TL_READ_NO_INSERT; + if (lock_type != TL_IGNORE && pb_lock.type == TL_UNLOCK) { /* Set to TRUE for operations that require a table lock: */ switch (thd_sql_command(thd)) { @@ -5102,7 +5246,7 @@ int ha_pbxt::delete_table(const char *table_path) * We also cannot use pb_share because the handler used * to delete a table is not openned correctly. */ - share = ha_get_share(self, table_path, false, NULL); + share = ha_get_share(self, table_path, false); pushr_(ha_unget_share, share); ha_aquire_exclusive_use(self, share, NULL); pushr_(ha_release_exclusive_use, share); @@ -5261,7 +5405,7 @@ int ha_pbxt::rename_table(const char *from, const char *to) * called without correctly initializing * the handler! */ - share = ha_get_share(self, from, true, NULL); + share = ha_get_share(self, from, true); pushr_(ha_unget_share, share); ha_aquire_exclusive_use(self, share, NULL); pushr_(ha_release_exclusive_use, share); @@ -5842,6 +5986,11 @@ static MYSQL_SYSVAR_BOOL(support_xa, pbxt_support_xa, NULL, NULL, FALSE); #endif +static MYSQL_SYSVAR_INT(flush_log_at_trx_commit, xt_db_flush_log_at_trx_commit, + PLUGIN_VAR_OPCMDARG, + "Determines whether the transaction log is written and/or flushed when a transaction is committed (no matter what the setting the log is written and flushed once per second), 0 = no write & no flush, 1 = write & flush (default), 2 = write & no flush.", + NULL, NULL, 1, 0, 2, 1); + static struct st_mysql_sys_var* pbxt_system_variables[] = { MYSQL_SYSVAR(index_cache_size), MYSQL_SYSVAR(record_cache_size), @@ -5860,6 +6009,7 @@ static struct st_mysql_sys_var* pbxt_system_variables[] = { MYSQL_SYSVAR(sweeper_priority), MYSQL_SYSVAR(max_threads), MYSQL_SYSVAR(support_xa), + MYSQL_SYSVAR(flush_log_at_trx_commit), NULL }; #endif diff --git a/storage/pbxt/src/index_xt.cc b/storage/pbxt/src/index_xt.cc index 81437caf723..c8995fe253c 100644 --- a/storage/pbxt/src/index_xt.cc +++ b/storage/pbxt/src/index_xt.cc @@ -1328,10 +1328,12 @@ static void idx_insert_node_item(XTTableHPtr XT_UNUSED(tab), XTIndexPtr XT_UNUSE XT_SET_DISK_2(leaf->tb_size_2, XT_MAKE_NODE_SIZE(result->sr_item.i_total_size)); } -static void idx_get_middle_branch_item(XTIndexPtr ind, XTIdxBranchDPtr branch, XTIdxKeyValuePtr value, XTIdxResultPtr result) +static xtBool idx_get_middle_branch_item(XTOpenTablePtr ot, XTIndexPtr ind, XTIdxBranchDPtr branch, XTIdxKeyValuePtr value, XTIdxResultPtr result) { xtWord1 *bitem; + ASSERT_NS(result->sr_item.i_node_ref_size == 0 || result->sr_item.i_node_ref_size == XT_NODE_REF_SIZE); + ASSERT_NS((int) result->sr_item.i_total_size >= 0 && result->sr_item.i_total_size <= XT_INDEX_PAGE_SIZE*2); if (ind->mi_fix_key) { u_int full_item_size = result->sr_item.i_item_size + result->sr_item.i_node_ref_size; @@ -1346,18 +1348,25 @@ static void idx_get_middle_branch_item(XTIndexPtr ind, XTIdxBranchDPtr branch, X } else { u_int node_ref_size; - u_int ilen; + u_int ilen, tlen; xtWord1 *bend; node_ref_size = result->sr_item.i_node_ref_size; - bitem = branch->tb_data + node_ref_size;; + bitem = branch->tb_data + node_ref_size; bend = &branch->tb_data[(result->sr_item.i_total_size - node_ref_size) / 2 + node_ref_size]; ilen = 0; if (bitem < bend) { + tlen = 0; for (;;) { ilen = myxt_get_key_length(ind, bitem); - if (bitem + ilen + XT_RECORD_REF_SIZE + node_ref_size >= bend) + tlen += ilen + XT_RECORD_REF_SIZE + node_ref_size; + if (bitem + ilen + XT_RECORD_REF_SIZE + node_ref_size >= bend) { + if (ilen > XT_INDEX_PAGE_SIZE || tlen > result->sr_item.i_total_size) { + xt_register_taberr(XT_REG_CONTEXT, XT_ERR_INDEX_CORRUPTED, ot->ot_table->tab_name); + return FAILED; + } break; + } bitem += ilen + XT_RECORD_REF_SIZE + node_ref_size; } } @@ -1370,6 +1379,7 @@ static void idx_get_middle_branch_item(XTIndexPtr ind, XTIdxBranchDPtr branch, X xt_get_record_ref(bitem + ilen, &value->sv_rec_id, &value->sv_row_id); memcpy(value->sv_key, bitem, value->sv_length); } + return OK; } static size_t idx_write_branch_item(XTIndexPtr XT_UNUSED(ind), xtWord1 *item, XTIdxKeyValuePtr value) @@ -1438,7 +1448,8 @@ static xtBool idx_replace_node_key(XTOpenTablePtr ot, XTIndexPtr ind, IdxStackIt /* We assume that value can be overwritten (which is the case) */ key_value.sv_flags = XT_SEARCH_WHOLE_KEY; key_value.sv_key = key_buf; - idx_get_middle_branch_item(ind, iref.ir_branch, &key_value, &result); + if (!idx_get_middle_branch_item(ot, ind, iref.ir_branch, &key_value, &result)) + goto failed_1; if (!idx_new_branch(ot, ind, &new_branch)) goto failed_1; @@ -1567,7 +1578,8 @@ static xtBool idx_insert_node(XTOpenTablePtr ot, XTIndexPtr ind, IdxBranchStackP ASSERT_NS(result.sr_item.i_total_size > XT_INDEX_PAGE_DATA_SIZE); /* We assume that value can be overwritten (which is the case) */ - idx_get_middle_branch_item(ind, &ot->ot_ind_wbuf, key_value, &result); + if (!idx_get_middle_branch_item(ot, ind, &ot->ot_ind_wbuf, key_value, &result)) + goto failed_1; if (!idx_new_branch(ot, ind, &new_branch)) goto failed_1; @@ -2041,7 +2053,7 @@ xtPublic xtBool xt_idx_insert(XTOpenTablePtr ot, XTIndexPtr ind, xtRowID row_id, memcpy(&ot->ot_ind_wbuf, iref.ir_branch, offsetof(XTIdxBranchDRec, tb_data) + result.sr_item.i_total_size); idx_insert_leaf_item(ind, &ot->ot_ind_wbuf, &key_value, &result); IDX_TRACE("%d-> %x\n", (int) XT_NODE_ID(current), (int) XT_GET_DISK_2(ot->ot_ind_wbuf.tb_size_2)); - ASSERT_NS(result.sr_item.i_total_size > XT_INDEX_PAGE_DATA_SIZE); + ASSERT_NS(result.sr_item.i_total_size > XT_INDEX_PAGE_DATA_SIZE && result.sr_item.i_total_size <= XT_INDEX_PAGE_DATA_SIZE*2); /* This is the number of potential writes. In other words, the total number * of blocks that may be accessed. @@ -2053,7 +2065,8 @@ xtPublic xtBool xt_idx_insert(XTOpenTablePtr ot, XTIndexPtr ind, xtRowID row_id, goto failed_1; /* Key does not fit, must split... */ - idx_get_middle_branch_item(ind, &ot->ot_ind_wbuf, &key_value, &result); + if (!idx_get_middle_branch_item(ot, ind, &ot->ot_ind_wbuf, &key_value, &result)) + goto failed_1; if (!idx_new_branch(ot, ind, &new_branch)) goto failed_1; @@ -3317,7 +3330,7 @@ xtPublic xtBool xt_idx_match_search(register XTOpenTablePtr XT_UNUSED(ot), regis return FALSE; } -static void idx_set_index_selectivity(XTThreadPtr self, XTOpenTablePtr ot, XTIndexPtr ind) +static void idx_set_index_selectivity(XTOpenTablePtr ot, XTIndexPtr ind, XTThreadPtr thread) { static const xtRecordID MAX_RECORDS = 100; @@ -3368,7 +3381,7 @@ static void idx_set_index_selectivity(XTThreadPtr self, XTOpenTablePtr ot, XTInd last_rec = ot->ot_curr_rec_id; key_len = ot->ot_ind_state.i_item_size - XT_RECORD_REF_SIZE; - xt_ind_unlock_handle(ot->ot_ind_rhandle); + xt_ind_lock_handle(ot->ot_ind_rhandle); memcpy(key_buf, ot->ot_ind_rhandle->ih_branch->tb_data + ot->ot_ind_state.i_item_offset, key_len); xt_ind_unlock_handle(ot->ot_ind_rhandle); } @@ -3410,7 +3423,7 @@ static void idx_set_index_selectivity(XTThreadPtr self, XTOpenTablePtr ot, XTInd last_iter_rec = last_rec; if (ot->ot_ind_rhandle) { - xt_ind_release_handle(ot->ot_ind_rhandle, FALSE, self); + xt_ind_release_handle(ot->ot_ind_rhandle, FALSE, thread); ot->ot_ind_rhandle = NULL; } } @@ -3431,8 +3444,10 @@ static void idx_set_index_selectivity(XTThreadPtr self, XTOpenTablePtr ot, XTInd return; failed_1: - xt_ind_release_handle(ot->ot_ind_rhandle, FALSE, self); - ot->ot_ind_rhandle = NULL; + if (ot->ot_ind_rhandle) { + xt_ind_release_handle(ot->ot_ind_rhandle, FALSE, thread); + ot->ot_ind_rhandle = NULL; + } failed: xt_tab_disable_index(ot->ot_table, XT_INDEX_CORRUPTED); @@ -3440,16 +3455,23 @@ static void idx_set_index_selectivity(XTThreadPtr self, XTOpenTablePtr ot, XTInd return; } -xtPublic void xt_ind_set_index_selectivity(XTThreadPtr self, XTOpenTablePtr ot) +xtPublic void xt_ind_set_index_selectivity(XTOpenTablePtr ot, XTThreadPtr thread) { XTTableHPtr tab = ot->ot_table; XTIndexPtr *ind; u_int i; - - if (!tab->tab_dic.dic_disable_index) { - for (i=0, ind=tab->tab_dic.dic_keys; i<tab->tab_dic.dic_key_count; i++, ind++) - idx_set_index_selectivity(self, ot, *ind); + time_t now; + + now = time(NULL); + xt_lock_mutex_ns(&tab->tab_ind_stat_lock); + if (tab->tab_ind_stat_calc_time < now) { + if (!tab->tab_dic.dic_disable_index) { + for (i=0, ind=tab->tab_dic.dic_keys; i<tab->tab_dic.dic_key_count; i++, ind++) + idx_set_index_selectivity(ot, *ind, thread); + } + tab->tab_ind_stat_calc_time = time(NULL); } + xt_unlock_mutex_ns(&tab->tab_ind_stat_lock); } /* @@ -3740,7 +3762,8 @@ xtPublic void xt_ind_count_deleted_items(XTTableHPtr tab, XTIndexPtr ind, XTIndB static xtBool idx_flush_dirty_list(XTIndexLogPtr il, XTOpenTablePtr ot, u_int *flush_count, XTIndBlockPtr *flush_list) { for (u_int i=0; i<*flush_count; i++) - il->il_write_block(ot, flush_list[i]); + if (!il->il_write_block(ot, flush_list[i])) + return FAILED; *flush_count = 0; return OK; } @@ -3793,7 +3816,7 @@ xtPublic xtBool xt_flush_indices(XTOpenTablePtr ot, off_t *bytes_flushed, xtBool xtIndexNodeID ind_free; xtBool something_to_free = FALSE; xtIndexNodeID last_address, next_address; - xtWord2 curr_flush_seq; + xtWord4 curr_flush_seq; XTIndFreeListPtr list_ptr; u_int dirty_blocks; XTCheckPointTablePtr cp_tab; @@ -3810,8 +3833,9 @@ xtPublic xtBool xt_flush_indices(XTOpenTablePtr ot, off_t *bytes_flushed, xtBool if (!tab->tab_db->db_indlogs.ilp_get_log(&il, ot->ot_thread)) goto failed_3; - il->il_reset(tab->tab_id); - if (!il->il_write_byte(ot, XT_DT_FREE_LIST)) + if (!il->il_reset(ot)) + goto failed_2; + if (!il->il_write_byte(ot, XT_DT_LOG_HEAD)) goto failed_2; if (!il->il_write_word4(ot, tab->tab_id)) goto failed_2; @@ -3849,7 +3873,7 @@ xtPublic xtBool xt_flush_indices(XTOpenTablePtr ot, off_t *bytes_flushed, xtBool wrote_something = TRUE; while (block) { ASSERT_NS(block->cb_state == IDX_CAC_BLOCK_DIRTY); - ASSERT_NS(block->cp_flush_seq == curr_flush_seq); + ASSERT_NS((block->cp_flush_seq == curr_flush_seq) || xt_xn_is_before(block->cp_flush_seq, curr_flush_seq)); if (!ind_add_to_dirty_list(il, ot, &flush_count, flush_list, block)) goto failed; block = block->cb_dirty_next; @@ -4023,7 +4047,7 @@ xtPublic xtBool xt_flush_indices(XTOpenTablePtr ot, off_t *bytes_flushed, xtBool fblock = block; block = block->cb_dirty_next; ASSERT_NS(fblock->cb_state == IDX_CAC_BLOCK_DIRTY); - if (fblock->cp_flush_seq == curr_flush_seq) { + if (fblock->cp_flush_seq == curr_flush_seq || xt_xn_is_before(fblock->cp_flush_seq, curr_flush_seq)) { /* Take the block off the dirty list: */ if (fblock->cb_dirty_next) fblock->cb_dirty_next->cb_dirty_prev = fblock->cb_dirty_prev; @@ -4254,12 +4278,32 @@ void XTIndexLogPool::ilp_release_log(XTIndexLogPtr il) xt_unlock_mutex_ns(&ilp_lock); } -void XTIndexLog::il_reset(xtTableID tab_id) +xtBool XTIndexLog::il_reset(XTOpenTable *ot) { + XTIndLogHeadDRec log_head; + xtTableID tab_id = ot->ot_table->tab_id; + il_tab_id = tab_id; il_log_eof = 0; il_buffer_len = 0; il_buffer_offset = 0; + + /* We must write the header and flush here or the "previous" status (from the + * last flush run) could remain. Failure to write the file completely leave the + * old header in place, and other parts of the file changed. + * This would lead to index corruption. + */ + log_head.ilh_data_type = XT_DT_LOG_HEAD; + XT_SET_DISK_4(log_head.ilh_tab_id_4, tab_id); + XT_SET_DISK_4(log_head.ilh_log_eof_4, 0); + + if (!xt_pwrite_file(il_of, 0, sizeof(XTIndLogHeadDRec), (xtWord1 *) &log_head, &ot->ot_thread->st_statistics.st_ilog, ot->ot_thread)) + return FAILED; + + if (!xt_flush_file(il_of, &ot->ot_thread->st_statistics.st_ilog, ot->ot_thread)) + return FAILED; + + return OK; } void XTIndexLog::il_close(xtBool delete_it) diff --git a/storage/pbxt/src/index_xt.h b/storage/pbxt/src/index_xt.h index ed4b9cef6ae..52f8f32dd33 100644 --- a/storage/pbxt/src/index_xt.h +++ b/storage/pbxt/src/index_xt.h @@ -30,6 +30,7 @@ #include <mysql_version.h> #include <my_bitmap.h> #endif +#include <time.h> #include "thread_xt.h" #include "linklist_xt.h" @@ -293,7 +294,6 @@ typedef struct XTIndFreeList { */ typedef struct XTIndex { u_int mi_index_no; /* The index number (used by MySQL). */ - xt_mutex_type mi_flush_lock; /* Lock the index during flushing. */ /* Protected by the mi_rwlock lock: */ XT_INDEX_LOCK_TYPE mi_rwlock; /* This lock protects the structure of the index. @@ -407,7 +407,7 @@ typedef struct XTIndexLog { off_t il_buffer_offset; - void il_reset(xtTableID tab_id); + xtBool il_reset(XTOpenTable *ot); void il_close(xtBool delete_it); void il_release(); @@ -478,7 +478,7 @@ xtBool xt_idx_search_prev(struct XTOpenTable *ot, struct XTIndex *ind, register xtBool xt_idx_next(register struct XTOpenTable *ot, register struct XTIndex *ind, register XTIdxSearchKeyPtr search_key); xtBool xt_idx_prev(register struct XTOpenTable *ot, register struct XTIndex *ind, register XTIdxSearchKeyPtr search_key); xtBool xt_idx_read(struct XTOpenTable *ot, struct XTIndex *ind, xtWord1 *rec_buf); -void xt_ind_set_index_selectivity(XTThreadPtr self, struct XTOpenTable *ot); +void xt_ind_set_index_selectivity(struct XTOpenTable *ot, XTThreadPtr thread); void xt_check_indices(struct XTOpenTable *ot); void xt_load_indices(XTThreadPtr self, struct XTOpenTable *ot); void xt_ind_count_deleted_items(struct XTTable *ot, struct XTIndex *ind, struct XTIndBlock *block); diff --git a/storage/pbxt/src/lock_xt.cc b/storage/pbxt/src/lock_xt.cc index 4513de17c5e..0e9af277c7b 100644 --- a/storage/pbxt/src/lock_xt.cc +++ b/storage/pbxt/src/lock_xt.cc @@ -1444,7 +1444,7 @@ xtPublic void xt_spinxslock_free(struct XTThread *XT_UNUSED(self), XTSpinXSLockP #endif } -xtPublic xtBool xt_spinxslock_xlock(XTSpinXSLockPtr sxs, xtThreadID XT_NDEBUG_UNUSED(thd_id)) +xtPublic xtBool xt_spinxslock_xlock(XTSpinXSLockPtr sxs, xtBool try_lock, xtThreadID XT_NDEBUG_UNUSED(thd_id)) { register xtWord2 set; @@ -1453,6 +1453,8 @@ xtPublic xtBool xt_spinxslock_xlock(XTSpinXSLockPtr sxs, xtThreadID XT_NDEBUG_UN set = xt_atomic_tas2(&sxs->sxs_xlocked, 1); if (!set) break; + if (try_lock) + return FALSE; xt_yield(); } @@ -1460,9 +1462,25 @@ xtPublic xtBool xt_spinxslock_xlock(XTSpinXSLockPtr sxs, xtThreadID XT_NDEBUG_UN sxs->sxs_locker = thd_id; #endif - /* Wait for all the reader to wait! */ - while (sxs->sxs_wait_count < sxs->sxs_rlock_count) - xt_yield(); + /* Wait for all the readers to wait! */ + while (sxs->sxs_wait_count < sxs->sxs_rlock_count) { + sxs->sxs_xwaiter = 1; + xt_yield(); //* + /* This should not be required, because there is only one thread + * accessing this value. However, the lock fails if this + * is not done with an atomic op. + * + * This is because threads on other processors have the + * value in processor cache. So they do not + * notice that the value has been set to zero. + * They think it is still 1 and march through + * the barrier (sxs->sxs_xwaiter < sxs->sxs_xlocked) below. + * + * In the meantime, this X locker has gone on thinking + * all is OK. + */ + xt_atomic_tas2(&sxs->sxs_xwaiter, 0); + } #ifdef XT_THREAD_LOCK_INFO xt_thread_lock_info_add_owner(&sxs->sxs_lock_info); @@ -1474,12 +1492,12 @@ xtPublic xtBool xt_spinxslock_slock(XTSpinXSLockPtr sxs) { xt_atomic_inc2(&sxs->sxs_rlock_count); - /* Check if there could be an X locker: */ - if (sxs->sxs_xlocked) { - /* I am waiting... */ + /* Wait as long as the locker is not waiting: */ + while (sxs->sxs_xwaiter < sxs->sxs_xlocked) { xt_atomic_inc2(&sxs->sxs_wait_count); - while (sxs->sxs_xlocked) + while (sxs->sxs_xwaiter < sxs->sxs_xlocked) { xt_yield(); + } xt_atomic_dec2(&sxs->sxs_wait_count); } @@ -1493,12 +1511,17 @@ xtPublic xtBool xt_spinxslock_unlock(XTSpinXSLockPtr sxs, xtBool xlocked) { if (xlocked) { #ifdef DEBUG + ASSERT_NS(sxs->sxs_locker && sxs->sxs_xlocked); sxs->sxs_locker = 0; #endif sxs->sxs_xlocked = 0; } - else + else { +#ifdef DEBUG + ASSERT_NS(sxs->sxs_rlock_count > 0); +#endif xt_atomic_dec2(&sxs->sxs_rlock_count); + } #ifdef XT_THREAD_LOCK_INFO xt_thread_lock_info_release_owner(&sxs->sxs_lock_info); @@ -1698,7 +1721,7 @@ xtPublic void xt_atomicrwlock_free(struct XTThread *, XTAtomicRWLockPtr XT_UNUSE #endif } -xtPublic xtBool xt_atomicrwlock_xlock(XTAtomicRWLockPtr arw, xtThreadID XT_NDEBUG_UNUSED(thr_id)) +xtPublic xtBool xt_atomicrwlock_xlock(XTAtomicRWLockPtr arw, xtBool try_lock, xtThreadID XT_NDEBUG_UNUSED(thr_id)) { register xtWord2 set; @@ -1707,6 +1730,8 @@ xtPublic xtBool xt_atomicrwlock_xlock(XTAtomicRWLockPtr arw, xtThreadID XT_NDEBU set = xt_atomic_tas2(&arw->arw_xlock_set, 1); if (!set) break; + if (try_lock) + return FALSE; xt_yield(); } @@ -1721,7 +1746,7 @@ xtPublic xtBool xt_atomicrwlock_xlock(XTAtomicRWLockPtr arw, xtThreadID XT_NDEBU #ifdef XT_THREAD_LOCK_INFO xt_thread_lock_info_add_owner(&arw->arw_lock_info); #endif - return OK; + return TRUE; } xtPublic xtBool xt_atomicrwlock_slock(XTAtomicRWLockPtr arw) @@ -1799,7 +1824,7 @@ xtPublic void xt_skewrwlock_free(struct XTThread *, XTSkewRWLockPtr XT_UNUSED(sr #endif } -xtPublic xtBool xt_skewrwlock_xlock(XTSkewRWLockPtr srw, xtThreadID XT_NDEBUG_UNUSED(thr_id)) +xtPublic xtBool xt_skewrwlock_xlock(XTSkewRWLockPtr srw, xtBool try_lock, xtThreadID XT_NDEBUG_UNUSED(thr_id)) { register xtWord2 set; @@ -1808,6 +1833,8 @@ xtPublic xtBool xt_skewrwlock_xlock(XTSkewRWLockPtr srw, xtThreadID XT_NDEBUG_UN set = xt_atomic_tas2(&srw->srw_xlock_set, 1); if (!set) break; + if (try_lock) + return FALSE; xt_yield(); } @@ -1822,7 +1849,7 @@ xtPublic xtBool xt_skewrwlock_xlock(XTSkewRWLockPtr srw, xtThreadID XT_NDEBUG_UN #ifdef XT_THREAD_LOCK_INFO xt_thread_lock_info_add_owner(&srw->srw_lock_info); #endif - return OK; + return TRUE; } xtPublic xtBool xt_skewrwlock_slock(XTSkewRWLockPtr srw) @@ -1869,6 +1896,124 @@ xtPublic xtBool xt_skewrwlock_unlock(XTSkewRWLockPtr srw, xtBool xlocked) /* * ----------------------------------------------------------------------- + * RECURSIVE R/W LOCK (allows X lockers to lock again) + */ + +#ifdef XT_THREAD_LOCK_INFO +void xt_recursivemutex_init(XTThreadPtr self, XTRecursiveMutexPtr rm, const char *name) +{ + rm->rm_locker = NULL; + rm->rm_lock_count = 0; + xt_init_mutex(self, &rm->rm_mutex, name); +} +#else +xtPublic void xt_recursivemutex_init(XTThreadPtr self, XTRecursiveMutexPtr rm) +{ + rm->rm_locker = NULL; + rm->rm_lock_count = 0; + xt_init_mutex(self, &rm->rm_mutex); +} +#endif + +xtPublic void xt_recursivemutex_free(XTRecursiveMutexPtr rm) +{ + xt_free_mutex(&rm->rm_mutex); +#ifdef XT_THREAD_LOCK_INFO + xt_thread_lock_info_free(&rm->rm_lock_info); +#endif +} + +xtPublic void xt_recursivemutex_lock(XTThreadPtr self, XTRecursiveMutexPtr rm) +{ + if (self != rm->rm_locker) { + xt_lock_mutex(self, &rm->rm_mutex); + rm->rm_locker = self; + } + rm->rm_lock_count++; +} + +xtPublic void xt_recursivemutex_unlock(XTThreadPtr self, XTRecursiveMutexPtr rm) +{ + ASSERT(self == rm->rm_locker); + ASSERT(rm->rm_lock_count > 0); + rm->rm_lock_count--; + if (!rm->rm_lock_count) { + rm->rm_locker = NULL; + xt_unlock_mutex(self, &rm->rm_mutex); + } +} + +/* + * ----------------------------------------------------------------------- + * RECURSIVE MUTEX (allows lockers to lock again) + */ + +#ifdef XT_THREAD_LOCK_INFO +void xt_recurrwlock_init(struct XTThread *self, XTRecurRWLockPtr rrw, const char *name) +{ + rrw->rrw_locker = NULL; + rrw->rrw_lock_count = 0; + xt_init_rwlock(self, &rrw->rrw_lock, name); +} +#else +void xt_recurrwlock_init(struct XTThread *self, XTRecurRWLockPtr rrw) +{ + rrw->rrw_locker = NULL; + rrw->rrw_lock_count = 0; + xt_init_rwlock(self, &rrw->rrw_lock); +} +#endif + +void xt_recurrwlock_free(XTRecurRWLockPtr rrw) +{ + xt_free_rwlock(&rrw->rrw_lock); +#ifdef XT_THREAD_LOCK_INFO + xt_thread_lock_info_free(&rrw->rrw_lock_info); +#endif +} + +void xt_recurrwlock_xlock(struct XTThread *self, XTRecurRWLockPtr rrw) +{ + if (self != rrw->rrw_locker) { + xt_xlock_rwlock(self, &rrw->rrw_lock); + rrw->rrw_locker = self; + } + rrw->rrw_lock_count++; +} + +void xt_recurrwlock_slock(struct XTThread *self, XTRecurRWLockPtr rrw) +{ + xt_slock_rwlock(self, &rrw->rrw_lock); +} + +void xt_recurrwlock_slock_ns(XTRecurRWLockPtr rrw) +{ + xt_slock_rwlock_ns(&rrw->rrw_lock); +} + +void xt_recurrwlock_unxlock(struct XTThread *self, XTRecurRWLockPtr rrw) +{ + ASSERT(self == rrw->rrw_locker); + ASSERT(rrw->rrw_lock_count > 0); + rrw->rrw_lock_count--; + if (!rrw->rrw_lock_count) { + rrw->rrw_locker = NULL; + xt_unlock_rwlock(self, &rrw->rrw_lock); + } +} + +void xt_recurrwlock_unslock(struct XTThread *self, XTRecurRWLockPtr rrw) +{ + xt_unlock_rwlock(self, &rrw->rrw_lock); +} + +void xt_recurrwlock_unslock_ns(XTRecurRWLockPtr rrw) +{ + xt_unlock_rwlock_ns(&rrw->rrw_lock); +} + +/* + * ----------------------------------------------------------------------- * UNIT TESTS */ @@ -2031,7 +2176,7 @@ static void *lck_run_writer(XTThreadPtr self) xt_rwmutex_unlock(&data->xs_lock, self->t_id); } else if (data->xs_which_lock == LOCK_SPINXSLOCK) { - xt_spinxslock_xlock(&data->xs_spinrwlock, self->t_id); + xt_spinxslock_xlock(&data->xs_spinrwlock, FALSE, self->t_id); lck_do_job(self, data->xs_which_job, data, FALSE); xt_spinxslock_unlock(&data->xs_spinrwlock, TRUE); } @@ -2041,12 +2186,12 @@ static void *lck_run_writer(XTThreadPtr self) xt_xsmutex_unlock(&data->xs_fastrwlock, self->t_id); } else if (data->xs_which_lock == LOCK_ATOMICRWLOCK) { - xt_atomicrwlock_xlock(&data->xs_atomicrwlock, self->t_id); + xt_atomicrwlock_xlock(&data->xs_atomicrwlock, FALSE, self->t_id); lck_do_job(self, data->xs_which_job, data, FALSE); xt_atomicrwlock_unlock(&data->xs_atomicrwlock, TRUE); } else if (data->xs_which_lock == LOCK_SKEWRWLOCK) { - xt_skewrwlock_xlock(&data->xs_skewrwlock, self->t_id); + xt_skewrwlock_xlock(&data->xs_skewrwlock, FALSE, self->t_id); lck_do_job(self, data->xs_which_job, data, FALSE); xt_skewrwlock_unlock(&data->xs_skewrwlock, TRUE); } diff --git a/storage/pbxt/src/lock_xt.h b/storage/pbxt/src/lock_xt.h index 05ba9af244e..4e5af648c37 100644 --- a/storage/pbxt/src/lock_xt.h +++ b/storage/pbxt/src/lock_xt.h @@ -109,7 +109,8 @@ inline xtWord1 xt_atomic_dec1(volatile xtWord1 *mptr) inline void xt_atomic_inc2(volatile xtWord2 *mptr) { #ifdef XT_ATOMIC_WIN32_X86 - __asm LOCK INC WORD PTR mptr + __asm MOV ECX, mptr + __asm LOCK INC WORD PTR [ECX] #elif defined(XT_ATOMIC_GNUC_X86) asm volatile ("lock; incw %0" : : "m" (*mptr) : "memory"); #elif defined(XT_ATOMIC_GCC_OPS) @@ -125,7 +126,8 @@ inline void xt_atomic_inc2(volatile xtWord2 *mptr) inline void xt_atomic_dec2(volatile xtWord2 *mptr) { #ifdef XT_ATOMIC_WIN32_X86 - __asm LOCK DEC WORD PTR mptr + __asm MOV ECX, mptr + __asm LOCK DEC WORD PTR [ECX] #elif defined(XT_ATOMIC_GNUC_X86) asm volatile ("lock; decw %0" : : "m" (*mptr) : "memory"); #elif defined(XT_ATOMIC_GCC_OPS) @@ -427,6 +429,7 @@ inline void xt_fastlock_unlock(XTFastLockPtr fal, struct XTThread *XT_UNUSED(thr typedef struct XTSpinXSLock { volatile xtWord2 sxs_xlocked; + volatile xtWord2 sxs_xwaiter; volatile xtWord2 sxs_rlock_count; volatile xtWord2 sxs_wait_count; /* The number of readers waiting for the xlocker. */ #ifdef DEBUG @@ -446,7 +449,7 @@ void xt_spinxslock_init(struct XTThread *self, XTSpinXSLockPtr sxs, const char * void xt_spinxslock_init(struct XTThread *self, XTSpinXSLockPtr sxs); #endif void xt_spinxslock_free(struct XTThread *self, XTSpinXSLockPtr sxs); -xtBool xt_spinxslock_xlock(XTSpinXSLockPtr sxs, xtThreadID thd_id); +xtBool xt_spinxslock_xlock(XTSpinXSLockPtr sxs, xtBool try_lock, xtThreadID thd_id); xtBool xt_spinxslock_slock(XTSpinXSLockPtr sxs); xtBool xt_spinxslock_unlock(XTSpinXSLockPtr sxs, xtBool xlocked); @@ -500,7 +503,7 @@ void xt_atomicrwlock_init(struct XTThread *self, XTAtomicRWLockPtr xsl, const ch void xt_atomicrwlock_init(struct XTThread *self, XTAtomicRWLockPtr xsl); #endif void xt_atomicrwlock_free(struct XTThread *self, XTAtomicRWLockPtr xsl); -xtBool xt_atomicrwlock_xlock(XTAtomicRWLockPtr xsl, xtThreadID thr_id); +xtBool xt_atomicrwlock_xlock(XTAtomicRWLockPtr xsl, xtBool try_lock, xtThreadID thr_id); xtBool xt_atomicrwlock_slock(XTAtomicRWLockPtr xsl); xtBool xt_atomicrwlock_unlock(XTAtomicRWLockPtr xsl, xtBool xlocked); @@ -525,7 +528,7 @@ void xt_skewrwlock_init(struct XTThread *self, XTSkewRWLockPtr xsl, const char * void xt_skewrwlock_init(struct XTThread *self, XTSkewRWLockPtr xsl); #endif void xt_skewrwlock_free(struct XTThread *self, XTSkewRWLockPtr xsl); -xtBool xt_skewrwlock_xlock(XTSkewRWLockPtr xsl, xtThreadID thr_id); +xtBool xt_skewrwlock_xlock(XTSkewRWLockPtr xsl, xtBool try_lock, xtThreadID thr_id); xtBool xt_skewrwlock_slock(XTSkewRWLockPtr xsl); xtBool xt_skewrwlock_unlock(XTSkewRWLockPtr xsl, xtBool xlocked); @@ -713,4 +716,57 @@ void xt_exit_row_lock_list(XTRowLockListPtr rl); #define XT_HAVE_LOCK 2 #define XT_WAITING 3 +/* + * ----------------------------------------------------------------------- + * RECURSIVE MUTEX (allows lockers to lock again) + */ + +typedef struct XTRecursiveMutex { + struct XTThread *rm_locker; + u_int rm_lock_count; + xt_mutex_type rm_mutex; + +#ifdef XT_THREAD_LOCK_INFO + XTThreadLockInfoRec rm_lock_info; + const char *rm_name; +#endif +} XTRecursiveMutexRec, *XTRecursiveMutexPtr; + +#ifdef XT_THREAD_LOCK_INFO +#define xt_recursivemutex_init_with_autoname(a,b) xt_recursivemutex_init(a,b,LOCKLIST_ARG_SUFFIX(b)) +void xt_recursivemutex_init(struct XTThread *self, XTRecursiveMutexPtr rm, const char *name); +#else +#define xt_recursivemutex_init_with_autoname(a,b) xt_recursivemutex_init(a,b) +void xt_recursivemutex_init(struct XTThread *self, XTRecursiveMutexPtr rm); +#endif +void xt_recursivemutex_free(XTRecursiveMutexPtr rm); +void xt_recursivemutex_lock(struct XTThread *self, XTRecursiveMutexPtr rm); +void xt_recursivemutex_unlock(struct XTThread *self, XTRecursiveMutexPtr rm); + +typedef struct XTRecurRWLock { + struct XTThread *rrw_locker; + u_int rrw_lock_count; + xt_rwlock_type rrw_lock; + +#ifdef XT_THREAD_LOCK_INFO + XTThreadLockInfoRec rrw_lock_info; + const char *rrw_name; +#endif +} XTRecurRWLockRec, *XTRecurRWLockPtr; + +#ifdef XT_THREAD_LOCK_INFO +#define xt_recurrwlock_init_with_autoname(a,b) xt_recurrwlock_init(a,b,LOCKLIST_ARG_SUFFIX(b)) +void xt_recurrwlock_init(struct XTThread *self, XTRecurRWLockPtr rrw, const char *name); +#else +#define xt_recurrwlock_init_with_autoname(a,b) xt_recurrwlock_init(a,b) +void xt_recurrwlock_init(struct XTThread *self, XTRecurRWLockPtr rrw); +#endif +void xt_recurrwlock_free(XTRecurRWLockPtr rrw); +void xt_recurrwlock_xlock(struct XTThread *self, XTRecurRWLockPtr rrw); +void xt_recurrwlock_slock(struct XTThread *self, XTRecurRWLockPtr rrw); +void xt_recurrwlock_slock_ns(XTRecurRWLockPtr rrw); +void xt_recurrwlock_unxlock(struct XTThread *self, XTRecurRWLockPtr rrw); +void xt_recurrwlock_unslock(struct XTThread *self, XTRecurRWLockPtr rrw); +void xt_recurrwlock_unslock_ns(XTRecurRWLockPtr rrw); + #endif diff --git a/storage/pbxt/src/locklist_xt.cc b/storage/pbxt/src/locklist_xt.cc index cbb004a70ca..9f79442560b 100644 --- a/storage/pbxt/src/locklist_xt.cc +++ b/storage/pbxt/src/locklist_xt.cc @@ -180,6 +180,10 @@ void xt_trace_thread_locks(XTThread *self) lock_type = "XTAtomicRWLock"; lock_name = li->li_atomic_rwlock->arw_name; break; + case XTThreadLockInfo::SKEW_RW_LOCK: + lock_type = "XTSkewRWLock"; + lock_name = li->li_skew_rwlock->srw_name; + break; } xt_ttracef(self, " #lock#%d: type: %s name: %s \n", count, lock_type, lock_name); diff --git a/storage/pbxt/src/myxt_xt.cc b/storage/pbxt/src/myxt_xt.cc index 2b5d59e72fb..51490fc00f5 100644 --- a/storage/pbxt/src/myxt_xt.cc +++ b/storage/pbxt/src/myxt_xt.cc @@ -54,6 +54,7 @@ extern pthread_key_t THR_Session; #include "database_xt.h" #include "cache_xt.h" #include "datalog_xt.h" +#include "memory_xt.h" static void myxt_bitmap_init(XTThreadPtr self, MX_BITMAP *map, u_int n_bits); static void myxt_bitmap_free(XTThreadPtr self, MX_BITMAP *map); @@ -255,6 +256,11 @@ xtPublic u_int myxt_create_key_from_row(XTIndexPtr ind, xtWord1 *key, xtWord1 *r xtWord1 *end; xtWord1 *start; +#ifdef HAVE_valgrind + if (ind->mi_fix_key) + memset((byte*) key, 0,(size_t) (ind->mi_key_size) ); +#endif + start = key; for (u_int i=0; i<ind->mi_seg_count; i++, keyseg++) { @@ -531,7 +537,7 @@ xtPublic u_int myxt_create_foreign_key_from_row(XTIndexPtr ind, xtWord1 *key, xt key += length; } - return fkey_ind->mi_fix_key ? fkey_ind->mi_key_size : (u_int) (key - start); /* Return keylength */ + return (u_int) (key - start); } /* I may be overcautious here, but can I assume that @@ -2132,10 +2138,10 @@ static void my_deref_index_data(struct XTThread *self, XTIndexPtr mi) { enter_(); /* The dirty list of cache pages should be empty here! */ - ASSERT(!mi->mi_dirty_list); + /* This is not the case if we were not able to flush data. E.g. when running out of disk space */ + //ASSERT(!mi->mi_dirty_list); ASSERT(!mi->mi_free_list); - xt_free_mutex(&mi->mi_flush_lock); xt_spinlock_free(self, &mi->mi_dirty_lock); XT_INDEX_FREE_LOCK(self, mi); myxt_bitmap_free(self, &mi->mi_col_map); @@ -2174,7 +2180,6 @@ static XTIndexPtr my_create_index(XTThreadPtr self, TABLE *table_arg, u_int idx, pushsr_(ind, my_deref_index_data, (XTIndexPtr) xt_calloc(self, MX_OFFSETOF(XTIndexRec, mi_seg) + sizeof(XTIndexSegRec) * index->key_parts)); XT_INDEX_INIT_LOCK(self, ind); - xt_init_mutex_with_autoname(self, &ind->mi_flush_lock); xt_spinlock_init_with_autoname(self, &ind->mi_dirty_lock); ind->mi_index_no = idx; ind->mi_flags = (index->flags & (HA_NOSAME | HA_NULL_ARE_EQUAL | HA_UNIQUE_CHECK)); @@ -2556,8 +2561,12 @@ xtPublic void myxt_setup_dictionary(XTThreadPtr self, XTDictionaryPtr dic) ave_row_size += 3 + ave_data_size; /* This is the length of the record required for all indexes: */ - if (field_count + 1 == dic->dic_ind_cols_req) - dic->dic_ind_rec_len = max_data_size; + /* This was calculated incorrectly. Not a serius bug because it + * is only used in the case of fixed length row, and in this + * case the dic_ind_rec_len is set correctly below. + */ + if (field_count == dic->dic_ind_cols_req) + dic->dic_ind_rec_len = max_row_size; } dic->dic_min_row_size = min_row_size; @@ -2624,6 +2633,20 @@ xtPublic void myxt_setup_dictionary(XTThreadPtr self, XTDictionaryPtr dic) } } + /* Ensure that handle data record size is big enough to + * include the extended record reference, in the case of + * variable length rows + */ + if (!dic_rec_fixed) { + if (dic_rec_size < offsetof(XTTabRecExtDRec, re_data)) + dic_rec_size = offsetof(XTTabRecExtDRec, re_data); + } +#ifdef DEBUG + else { + ASSERT_NS(dic_rec_size > offsetof(XTTabRecFix, rf_data)); + } +#endif + if (!dic->dic_rec_size) { dic->dic_rec_size = dic_rec_size; dic->dic_rec_fixed = dic_rec_fixed; @@ -2861,6 +2884,7 @@ static void ha_create_dd_index(XTThreadPtr self, XTDDIndex *ind, KEY *key) for (key_part = key->key_part; key_part != key_part_end; key_part++) { if (!(cref = new XTDDColumnRef())) xt_throw_errno(XT_CONTEXT, XT_ENOMEM); + cref->init(self); ind->co_cols.append(self, cref); cref->cr_col_name = xt_dup_string(self, (char *) key_part->field->field_name); } diff --git a/storage/pbxt/src/pthread_xt.cc b/storage/pbxt/src/pthread_xt.cc index 2dfb8a64af2..e7f0632e9ae 100755 --- a/storage/pbxt/src/pthread_xt.cc +++ b/storage/pbxt/src/pthread_xt.cc @@ -39,25 +39,25 @@ #ifdef XT_WIN -void xt_p_init_threading(void) +xtPublic void xt_p_init_threading(void) { } -int xt_p_set_normal_priority(pthread_t thr) +xtPublic int xt_p_set_normal_priority(pthread_t thr) { if (!SetThreadPriority (thr, THREAD_PRIORITY_NORMAL)) return GetLastError(); return 0; } -int xt_p_set_low_priority(pthread_t thr) +xtPublic int xt_p_set_low_priority(pthread_t thr) { if (!SetThreadPriority (thr, THREAD_PRIORITY_LOWEST)) return GetLastError(); return 0; } -int xt_p_set_high_priority(pthread_t thr) +xtPublic int xt_p_set_high_priority(pthread_t thr) { if (!SetThreadPriority (thr, THREAD_PRIORITY_HIGHEST)) return GetLastError(); @@ -67,9 +67,9 @@ int xt_p_set_high_priority(pthread_t thr) #define XT_RWLOCK_MAGIC 0x78AC390E #ifdef XT_THREAD_LOCK_INFO -int xt_p_mutex_init(xt_mutex_type *mutex, const pthread_mutexattr_t *attr, const char *n) +xtPublic int xt_p_mutex_init(xt_mutex_type *mutex, const pthread_mutexattr_t *attr, const char *n) #else -int xt_p_mutex_init(xt_mutex_type *mutex, const pthread_mutexattr_t *attr) +xtPublic int xt_p_mutex_init(xt_mutex_type *mutex, const pthread_mutexattr_t *attr) #endif { InitializeCriticalSection(&mutex->mt_cs); @@ -80,7 +80,7 @@ int xt_p_mutex_init(xt_mutex_type *mutex, const pthread_mutexattr_t *attr) return 0; } -int xt_p_mutex_destroy(xt_mutex_type *mutex) +xtPublic int xt_p_mutex_destroy(xt_mutex_type *mutex) { DeleteCriticalSection(&mutex->mt_cs); #ifdef XT_THREAD_LOCK_INFO @@ -89,7 +89,7 @@ int xt_p_mutex_destroy(xt_mutex_type *mutex) return 0; } -int xt_p_mutex_lock(xt_mutex_type *mx) +xtPublic int xt_p_mutex_lock(xt_mutex_type *mx) { EnterCriticalSection(&mx->mt_cs); #ifdef XT_THREAD_LOCK_INFO @@ -98,7 +98,7 @@ int xt_p_mutex_lock(xt_mutex_type *mx) return 0; } -int xt_p_mutex_unlock(xt_mutex_type *mx) +xtPublic int xt_p_mutex_unlock(xt_mutex_type *mx) { LeaveCriticalSection(&mx->mt_cs); #ifdef XT_THREAD_LOCK_INFO @@ -107,7 +107,7 @@ int xt_p_mutex_unlock(xt_mutex_type *mx) return 0; } -int xt_p_mutex_trylock(xt_mutex_type *mutex) +xtPublic int xt_p_mutex_trylock(xt_mutex_type *mutex) { #if(_WIN32_WINNT >= 0x0400) /* NOTE: MySQL bug! was using?! @@ -130,9 +130,9 @@ int xt_p_mutex_trylock(xt_mutex_type *mutex) } #ifdef XT_THREAD_LOCK_INFO -int xt_p_rwlock_init(xt_rwlock_type *rwl, const pthread_condattr_t *attr, const char *n) +xtPublic int xt_p_rwlock_init(xt_rwlock_type *rwl, const pthread_condattr_t *attr, const char *n) #else -int xt_p_rwlock_init(xt_rwlock_type *rwl, const pthread_condattr_t *attr) +xtPublic int xt_p_rwlock_init(xt_rwlock_type *rwl, const pthread_condattr_t *attr) #endif { int result; @@ -173,7 +173,7 @@ int xt_p_rwlock_init(xt_rwlock_type *rwl, const pthread_condattr_t *attr) return result; } -int xt_p_rwlock_destroy(xt_rwlock_type *rwl) +xtPublic int xt_p_rwlock_destroy(xt_rwlock_type *rwl) { int result = 0, result1 = 0, result2 = 0; @@ -225,7 +225,7 @@ int xt_p_rwlock_destroy(xt_rwlock_type *rwl) } -int xt_p_rwlock_rdlock(xt_rwlock_type *rwl) +xtPublic int xt_p_rwlock_rdlock(xt_rwlock_type *rwl) { int result; @@ -262,7 +262,7 @@ int xt_p_rwlock_rdlock(xt_rwlock_type *rwl) return (xt_p_mutex_unlock (&(rwl->rw_ex_lock))); } -int xt_p_rwlock_wrlock(xt_rwlock_type *rwl) +xtPublic int xt_p_rwlock_wrlock(xt_rwlock_type *rwl) { int result; @@ -309,7 +309,54 @@ int xt_p_rwlock_wrlock(xt_rwlock_type *rwl) return result; } -int xt_p_rwlock_unlock(xt_rwlock_type *rwl) +xtPublic xtBool xt_p_rwlock_try_wrlock(xt_rwlock_type *rwl) +{ + int result; + + if (rwl == NULL) + return FALSE; + + if (rwl->rw_magic != XT_RWLOCK_MAGIC) + return FALSE; + + if ((result = xt_p_mutex_trylock(&rwl->rw_ex_lock)) != 0) + return FALSE; + + if ((result = xt_p_mutex_lock(&rwl->rw_sh_lock)) != 0) { + (void) xt_p_mutex_unlock(&rwl->rw_ex_lock); + return FALSE; + } + + if (rwl->rw_ex_count == 0) { + if (rwl->rw_sh_complete_count > 0) { + rwl->rw_sh_count -= rwl->rw_sh_complete_count; + rwl->rw_sh_complete_count = 0; + } + + if (rwl->rw_sh_count > 0) { + rwl->rw_sh_complete_count = -rwl->rw_sh_count; + + do { + result = pthread_cond_wait (&rwl->rw_sh_cond, &rwl->rw_sh_lock.mt_cs); + } + while (result == 0 && rwl->rw_sh_complete_count < 0); + + if (result == 0) + rwl->rw_sh_count = 0; + } + } + + if (result == 0) + rwl->rw_ex_count++; + +#ifdef XT_THREAD_LOCK_INFO + xt_thread_lock_info_add_owner(&rwl->rw_lock_info); +#endif + + return TRUE; +} + +xtPublic int xt_p_rwlock_unlock(xt_rwlock_type *rwl) { int result, result1; @@ -342,12 +389,12 @@ int xt_p_rwlock_unlock(xt_rwlock_type *rwl) return ((result != 0) ? result : result1); } -int xt_p_cond_wait(xt_cond_type *cond, xt_mutex_type *mutex) +xtPublic int xt_p_cond_wait(xt_cond_type *cond, xt_mutex_type *mutex) { return xt_p_cond_timedwait(cond, mutex, NULL); } -int xt_p_cond_timedwait(xt_cond_type *cond, xt_mutex_type *mt, struct timespec *abstime) +xtPublic int xt_p_cond_timedwait(xt_cond_type *cond, xt_mutex_type *mt, struct timespec *abstime) { pthread_mutex_t *mutex = &mt->mt_cs; int result; @@ -393,7 +440,7 @@ int xt_p_cond_timedwait(xt_cond_type *cond, xt_mutex_type *mt, struct timespec * return result == WAIT_TIMEOUT ? ETIMEDOUT : 0; } -int xt_p_join(pthread_t thread, void **value) +xtPublic int xt_p_join(pthread_t thread, void **value) { DWORD exitcode; @@ -676,6 +723,23 @@ xtPublic int xt_p_rwlock_wrlock(xt_rwlock_type *rwlock) return r; } +xtPublic xtBool xt_p_rwlock_try_wrlock(xt_rwlock_type *rwlock) +{ + XTThreadPtr self = xt_get_self(); + int r; + + ASSERT_NS(rwlock->rw_init == 67890); + r = pthread_rwlock_trywrlock(&rwlock->rw_plock); + if (r == 0) { + ASSERT_NS(!rwlock->rw_locker); + rwlock->rw_locker = self; +#ifdef XT_THREAD_LOCK_INFO + xt_thread_lock_info_add_owner(&rwlock->rw_lock_info); +#endif + } + return r == 0; +} + xtPublic int xt_p_rwlock_unlock(xt_rwlock_type *rwlock) { XTThreadPtr self = xt_get_self(); diff --git a/storage/pbxt/src/pthread_xt.h b/storage/pbxt/src/pthread_xt.h index d8ef1a85d41..dccc5779aad 100755 --- a/storage/pbxt/src/pthread_xt.h +++ b/storage/pbxt/src/pthread_xt.h @@ -101,13 +101,14 @@ int xt_p_rwlock_init(xt_rwlock_type *rwlock, const pthread_condattr_t *attr, con #else int xt_p_rwlock_init(xt_rwlock_type *rwlock, const pthread_condattr_t *attr); #endif -int xt_p_rwlock_destroy(xt_rwlock_type *rwlock); -int xt_p_rwlock_rdlock(xt_rwlock_type *mx); -int xt_p_rwlock_wrlock(xt_rwlock_type *mx); -int xt_p_rwlock_unlock(xt_rwlock_type *mx); +int xt_p_rwlock_destroy(xt_rwlock_type *rwlock); +int xt_p_rwlock_rdlock(xt_rwlock_type *mx); +int xt_p_rwlock_wrlock(xt_rwlock_type *mx); +xtBool xt_p_rwlock_try_wrlock(xt_rwlock_type *rwl); +int xt_p_rwlock_unlock(xt_rwlock_type *mx); -int xt_p_cond_wait(xt_cond_type *cond, xt_mutex_type *mutex); -int xt_p_cond_timedwait(xt_cond_type *cond, xt_mutex_type *mutex, struct timespec *abstime); +int xt_p_cond_wait(xt_cond_type *cond, xt_mutex_type *mutex); +int xt_p_cond_timedwait(xt_cond_type *cond, xt_mutex_type *mutex, struct timespec *abstime); int xt_p_join(pthread_t thread, void **value); @@ -125,6 +126,7 @@ int xt_p_join(pthread_t thread, void **value); #define xt_slock_rwlock_ns xt_p_rwlock_rdlock #define xt_xlock_rwlock_ns xt_p_rwlock_wrlock +#define xt_xlock_try_rwlock_ns xt_p_rwlock_try_wrlock #define xt_unlock_rwlock_ns xt_p_rwlock_unlock #ifdef XT_THREAD_LOCK_INFO @@ -225,9 +227,10 @@ typedef struct xt_rwlock_struct { #endif } xt_rwlock_type; -int xt_p_rwlock_rdlock(xt_rwlock_type *mx); -int xt_p_rwlock_wrlock(xt_rwlock_type *mx); -int xt_p_rwlock_unlock(xt_rwlock_type *mx); +int xt_p_rwlock_rdlock(xt_rwlock_type *mx); +int xt_p_rwlock_wrlock(xt_rwlock_type *mx); +xtBool xt_p_rwlock_try_wrlock(xt_rwlock_type *mx); +int xt_p_rwlock_unlock(xt_rwlock_type *mx); int xt_p_mutex_lock(xt_mutex_type *mx, u_int line, const char *file); int xt_p_mutex_unlock(xt_mutex_type *mx); @@ -251,37 +254,39 @@ int xt_p_cond_timedwait(xt_cond_type *cond, xt_mutex_type *mutex, const struct t } #endif -#define xt_slock_rwlock_ns xt_p_rwlock_rdlock -#define xt_xlock_rwlock_ns xt_p_rwlock_wrlock -#define xt_unlock_rwlock_ns xt_p_rwlock_unlock +#define xt_slock_rwlock_ns xt_p_rwlock_rdlock +#define xt_xlock_rwlock_ns xt_p_rwlock_wrlock +#define xt_xlock_try_rwlock_ns xt_p_rwlock_try_wrlock +#define xt_unlock_rwlock_ns xt_p_rwlock_unlock -#define xt_lock_mutex_ns(x) xt_p_mutex_lock(x, __LINE__, __FILE__) -#define xt_unlock_mutex_ns xt_p_mutex_unlock -#define xt_mutex_trylock xt_p_mutex_trylock +#define xt_lock_mutex_ns(x) xt_p_mutex_lock(x, __LINE__, __FILE__) +#define xt_unlock_mutex_ns xt_p_mutex_unlock +#define xt_mutex_trylock xt_p_mutex_trylock #else // DEBUG_LOCKING -#define xt_rwlock_struct _opaque_pthread_rwlock_t -#define xt_mutex_struct _opaque_pthread_mutex_t +#define xt_rwlock_struct _opaque_pthread_rwlock_t +#define xt_mutex_struct _opaque_pthread_mutex_t -#define xt_rwlock_type pthread_rwlock_t -#define xt_mutex_type pthread_mutex_t +#define xt_rwlock_type pthread_rwlock_t +#define xt_mutex_type pthread_mutex_t -#define xt_slock_rwlock_ns pthread_rwlock_rdlock -#define xt_xlock_rwlock_ns pthread_rwlock_wrlock -#define xt_unlock_rwlock_ns pthread_rwlock_unlock +#define xt_slock_rwlock_ns pthread_rwlock_rdlock +#define xt_xlock_rwlock_ns pthread_rwlock_wrlock +#define xt_xlock_try_rwlock_ns(x) (pthread_rwlock_trywrlock(x) == 0) +#define xt_unlock_rwlock_ns pthread_rwlock_unlock -#define xt_lock_mutex_ns pthread_mutex_lock -#define xt_unlock_mutex_ns pthread_mutex_unlock -#define xt_mutex_trylock pthread_mutex_trylock +#define xt_lock_mutex_ns pthread_mutex_lock +#define xt_unlock_mutex_ns pthread_mutex_unlock +#define xt_mutex_trylock pthread_mutex_trylock -#define xt_p_mutex_trylock pthread_mutex_trylock -#define xt_p_mutex_destroy pthread_mutex_destroy -#define xt_p_mutex_init pthread_mutex_init -#define xt_p_rwlock_destroy pthread_rwlock_destroy -#define xt_p_rwlock_init pthread_rwlock_init -#define xt_p_cond_wait pthread_cond_wait -#define xt_p_cond_timedwait pthread_cond_timedwait +#define xt_p_mutex_trylock pthread_mutex_trylock +#define xt_p_mutex_destroy pthread_mutex_destroy +#define xt_p_mutex_init pthread_mutex_init +#define xt_p_rwlock_destroy pthread_rwlock_destroy +#define xt_p_rwlock_init pthread_rwlock_init +#define xt_p_cond_wait pthread_cond_wait +#define xt_p_cond_timedwait pthread_cond_timedwait #endif // DEBUG_LOCKING diff --git a/storage/pbxt/src/restart_xt.cc b/storage/pbxt/src/restart_xt.cc index 472c5ad0478..b0c8f2854ae 100644 --- a/storage/pbxt/src/restart_xt.cc +++ b/storage/pbxt/src/restart_xt.cc @@ -1315,7 +1315,7 @@ static void xres_apply_operations(XTThreadPtr self, XTWriterStatePtr ws, xtBool tab->tab_head_op_seq = op->or_op_seq; if (tab->tab_wr_wake_freeer) { if (!XTTableSeq::xt_op_is_before(tab->tab_head_op_seq, tab->tab_wake_freeer_op)) - xt_wr_wake_freeer(self); + xt_wr_wake_freeer(self, ws->ws_db); } i++; } @@ -1498,7 +1498,7 @@ xtPublic void xt_xres_apply_in_order(XTThreadPtr self, XTWriterStatePtr ws, xtLo tab->tab_head_op_seq = op_seq; if (tab->tab_wr_wake_freeer) { if (!XTTableSeq::xt_op_is_before(tab->tab_head_op_seq, tab->tab_wake_freeer_op)) - xt_wr_wake_freeer(self); + xt_wr_wake_freeer(self, ws->ws_db); } /* Apply any operations in the list that now follow on... @@ -1575,10 +1575,12 @@ static int xres_comp_flush_tabs(XTThreadPtr XT_UNUSED(self), register const void static void xres_init_checkpoint_state(XTThreadPtr self, XTCheckPointStatePtr cp) { xt_init_mutex_with_autoname(self, &cp->cp_state_lock); + cp->cp_inited = TRUE; } static void xres_free_checkpoint_state(XTThreadPtr self, XTCheckPointStatePtr cp) { + cp->cp_inited = FALSE; xt_free_mutex(&cp->cp_state_lock); if (cp->cp_table_ids) { xt_free_sortedlist(self, cp->cp_table_ids); @@ -1616,6 +1618,7 @@ xtPublic void xt_xres_init(XTThreadPtr self, XTDatabaseHPtr db) xt_init_mutex_with_autoname(self, &db->db_cp_lock); xt_init_cond(self, &db->db_cp_cond); + xt_init_mutex_with_autoname(self, &db->db_fl_lock); xres_init_checkpoint_state(self, &db->db_cp_state); db->db_restart.xres_init(self, db, &db->db_wr_log_id, &db->db_wr_log_offset, &max_log_id); @@ -1633,6 +1636,7 @@ xtPublic void xt_xres_exit(XTThreadPtr self, XTDatabaseHPtr db) xres_free_checkpoint_state(self, &db->db_cp_state); xt_free_mutex(&db->db_cp_lock); xt_free_cond(&db->db_cp_cond); + xt_free_mutex(&db->db_fl_lock); } /* ---------------------------------------------------------------------- @@ -2182,7 +2186,7 @@ xtBool XTXactRestart::xres_restart(XTThreadPtr self, xtLogID *log_id, xtLogOffse xtBool XTXactRestart::xres_is_checkpoint_pending(xtLogID curr_log_id, xtLogOffset curr_log_offset) { - return xt_bytes_since_last_checkpoint(xres_db, curr_log_id, curr_log_offset) >= xt_db_checkpoint_frequency / 2; + return xt_bytes_since_last_checkpoint(xres_db, curr_log_id, curr_log_offset) >= xt_db_checkpoint_frequency; } /* @@ -2531,10 +2535,10 @@ static void xres_cp_main(XTThreadPtr self) XTDatabaseHPtr db = self->st_database; u_int curr_writer_total; time_t now; + xtXactID sweep_count; xt_set_low_priority(self); - while (!self->t_quit) { /* Wait 2 seconds: */ curr_writer_total = db->db_xn_total_writer_count; @@ -2549,9 +2553,13 @@ static void xres_cp_main(XTThreadPtr self) if (self->t_quit) break; - if (curr_writer_total == db->db_xn_total_writer_count) + sweep_count = db->db_xn_curr_id + 1 - db->db_xn_to_clean_id; + if (curr_writer_total == db->db_xn_total_writer_count && + !sweep_count && + db->db_wr_idle == XT_THREAD_IDLE) { /* No activity in 2 seconds: */ xres_cp_checkpoint(self, db, curr_writer_total, FALSE); + } else { /* There server is busy, check if we need to * write a checkpoint anyway... @@ -2672,6 +2680,10 @@ xtPublic xtBool xt_begin_checkpoint(XTDatabaseHPtr db, xtBool have_table_lock, X XTOperationPtr op; XTCheckPointTableRec cpt; XTSortedListPtr tables = NULL; + + /* during startup we can get an error before the checkpointer is inited */ + if (!cp->cp_inited) + return FAILED; /* First check if a checkpoint is already running: */ xt_lock_mutex_ns(&cp->cp_state_lock); @@ -3314,7 +3326,7 @@ static void *xn_xres_run_recovery_thread(XTThreadPtr self) * #7 0x000c0db2 in THD::~THD at sql_class.cc:934 * #8 0x003b025b in myxt_destroy_thread at myxt_xt.cc:2999 * #9 0x003b66b5 in xn_xres_run_recovery_thread at restart_xt.cc:3196 - * #10 0x003cbfbb in thr_main_pbxt at thread_xt.cc:1020 + * #10 0x003cbfbb in xt_thread_main at thread_xt.cc:1020 * myxt_destroy_thread(mysql_thread, TRUE); */ @@ -3350,3 +3362,123 @@ xtPublic void xt_xres_terminate_recovery(XTThreadPtr self) xt_wait_for_thread(tid, TRUE); } } + +/* ---------------------------------------------------------------------- + * L O G F L U S H P R O C E S S + */ + +static void *xres_fl_run_thread(XTThreadPtr self) +{ + XTDatabaseHPtr db = (XTDatabaseHPtr) self->t_data; + int count; + void *mysql_thread; + xtWord8 to_flush; + + if (!(mysql_thread = myxt_create_thread())) + xt_throw(self); + + while (!self->t_quit) { + try_(a) { + /* + * The garbage collector requires that the database + * is in use because. + */ + xt_use_database(self, db, XT_FOR_CHECKPOINTER); + + /* This action is both safe and required (see details elsewhere) */ + xt_heap_release(self, self->st_database); + + xt_set_low_priority(self); + + to_flush = xt_trace_clock() + XT_XLOG_FLUSH_FREQ * 1000; + for (;;) { + /* Wait 1 second: */ + while (!self->t_quit && xt_trace_clock() < to_flush) + xt_sleep_milli_second(10); + + if (self->t_quit) + break; + + if (!db->db_xlog.xlog_flush(self)) + xt_throw(self); + + to_flush += XT_XLOG_FLUSH_FREQ * 1000; + } + } + catch_(a) { + /* This error is "normal"! */ + if (self->t_exception.e_xt_err != XT_ERR_NO_DICTIONARY && + !(self->t_exception.e_xt_err == XT_SIGNAL_CAUGHT && + self->t_exception.e_sys_err == SIGTERM)) + xt_log_and_clear_exception(self); + } + cont_(a); + + /* Avoid releasing the database (done above) */ + self->st_database = NULL; + xt_unuse_database(self, self); + + /* After an exception, pause before trying again... */ + /* Number of seconds */ + count = 60; + while (!self->t_quit && count > 0) { + sleep(1); + count--; + } + } + + /* + * {MYSQL-THREAD-KILL} + myxt_destroy_thread(mysql_thread, TRUE); + */ + return NULL; +} + +static void xres_fl_free_thread(XTThreadPtr self, void *data) +{ + XTDatabaseHPtr db = (XTDatabaseHPtr) data; + + if (db->db_fl_thread) { + xt_lock_mutex(self, &db->db_fl_lock); + pushr_(xt_unlock_mutex, &db->db_fl_lock); + db->db_fl_thread = NULL; + freer_(); // xt_unlock_mutex(&db->db_fl_lock) + } +} + +xtPublic void xt_start_flusher(XTThreadPtr self, XTDatabaseHPtr db) +{ + char name[PATH_MAX]; + + sprintf(name, "FL-%s", xt_last_directory_of_path(db->db_main_path)); + xt_remove_dir_char(name); + db->db_fl_thread = xt_create_daemon(self, name); + xt_set_thread_data(db->db_fl_thread, db, xres_fl_free_thread); + xt_run_thread(self, db->db_fl_thread, xres_fl_run_thread); +} + +xtPublic void xt_stop_flusher(XTThreadPtr self, XTDatabaseHPtr db) +{ + XTThreadPtr thr_fl; + + if (db->db_fl_thread) { + xt_lock_mutex(self, &db->db_fl_lock); + pushr_(xt_unlock_mutex, &db->db_fl_lock); + + /* This pointer is safe as long as you have the transaction lock. */ + if ((thr_fl = db->db_fl_thread)) { + xtThreadID tid = thr_fl->t_id; + + /* Make sure the thread quits when woken up. */ + xt_terminate_thread(self, thr_fl); + + freer_(); // xt_unlock_mutex(&db->db_cp_lock) + + xt_wait_for_thread(tid, FALSE); + db->db_fl_thread = NULL; + } + else + freer_(); // xt_unlock_mutex(&db->db_cp_lock) + } +} + diff --git a/storage/pbxt/src/restart_xt.h b/storage/pbxt/src/restart_xt.h index 73128c4ded8..614fd74a39d 100644 --- a/storage/pbxt/src/restart_xt.h +++ b/storage/pbxt/src/restart_xt.h @@ -92,6 +92,7 @@ private: } XTXactRestartRec, *XTXactRestartPtr; typedef struct XTCheckPointState { + xtBool cp_inited; /* TRUE if structure was inited */ xt_mutex_type cp_state_lock; /* Lock and the entire checkpoint state. */ xtBool cp_running; /* TRUE if a checkpoint is running. */ xtLogID cp_log_id; @@ -136,6 +137,9 @@ void xt_dump_xlogs(struct XTDatabase *db, xtLogID start_log); void xt_xres_start_database_recovery(XTThreadPtr self); void xt_xres_terminate_recovery(XTThreadPtr self); +void xt_start_flusher(struct XTThread *self, struct XTDatabase *db); +void xt_stop_flusher(struct XTThread *self, struct XTDatabase *db); + #define XT_RECOVER_PENDING 0 #define XT_RECOVER_DONE 1 #define XT_RECOVER_SWEPT 2 diff --git a/storage/pbxt/src/strutil_xt.cc b/storage/pbxt/src/strutil_xt.cc index 5c3856de100..02132fbb06b 100644 --- a/storage/pbxt/src/strutil_xt.cc +++ b/storage/pbxt/src/strutil_xt.cc @@ -380,7 +380,7 @@ xtPublic void xt_int8_to_byte_size(xtInt8 value, char *string) /* Version number must also be set in configure.in! */ xtPublic c_char *xt_get_version(void) { - return "1.0.09g RC"; + return "1.0.11 Pre-GA"; } /* Copy and URL decode! */ diff --git a/storage/pbxt/src/tabcache_xt.cc b/storage/pbxt/src/tabcache_xt.cc index 9897525ad69..92958f2da49 100644 --- a/storage/pbxt/src/tabcache_xt.cc +++ b/storage/pbxt/src/tabcache_xt.cc @@ -46,8 +46,10 @@ static void tabc_fr_wait_for_cache(XTThreadPtr self, u_int msecs); xtPublic void xt_tc_set_cache_size(size_t cache_size) { xt_tab_cache.tcm_cache_size = cache_size; - xt_tab_cache.tcm_low_level = cache_size / 4 * 3; // Current 75% - xt_tab_cache.tcm_high_level = cache_size / 100 * 95; // Current 95% + /* Multiplying by this number can overflow a 4 byte value! */ + xt_tab_cache.tcm_low_level = (size_t) ((xtWord8) cache_size * (xtWord8) 70 / (xtWord8) 100); // Current 70% + xt_tab_cache.tcm_high_level = (size_t) ((xtWord8) cache_size * 95 / (xtWord8) 100); // Current 95% + xt_tab_cache.tcm_mid_level = (size_t) ((xtWord8) cache_size * 85 / (xtWord8) 100); // Current 85% } /* @@ -84,25 +86,30 @@ xtPublic void xt_tc_init(XTThreadPtr self, size_t cache_size) xtPublic void xt_tc_exit(XTThreadPtr self) { + XTTabCacheSegPtr seg; + for (u_int i=0; i<XT_TC_SEGMENT_COUNT; i++) { - if (xt_tab_cache.tcm_segment[i].tcs_hash_table) { - if (xt_tab_cache.tcm_segment[i].tcs_cache_in_use) { - XTTabCachePagePtr page, tmp_page; - - for (size_t j=0; j<xt_tab_cache.tcm_hash_size; j++) { - page = xt_tab_cache.tcm_segment[i].tcs_hash_table[j]; - while (page) { - tmp_page = page; - page = page->tcp_next; - xt_free(self, tmp_page); - } + seg = &xt_tab_cache.tcm_segment[i]; + if (seg->tcs_hash_table) { + XTTabCachePagePtr page, tmp_page; + + for (size_t j=0; j<xt_tab_cache.tcm_hash_size; j++) { + page = seg->tcs_hash_table[j]; + while (page) { + tmp_page = page; + page = page->tcp_next; + ASSERT_NS(seg->tcs_cache_in_use >= offsetof(XTTabCachePageRec, tcp_data) + tmp_page->tcp_data_size); + seg->tcs_cache_in_use -= (offsetof(XTTabCachePageRec, tcp_data) + tmp_page->tcp_data_size); + ASSERT_NS(seg->tcs_cache_in_use == 0 || seg->tcs_cache_in_use >= 25000); + xt_free(self, tmp_page); } } - xt_free(self, xt_tab_cache.tcm_segment[i].tcs_hash_table); - xt_tab_cache.tcm_segment[i].tcs_hash_table = NULL; - TAB_CAC_FREE_LOCK(self, &xt_tab_cache.tcm_segment[i].tcs_lock); + xt_free(self, seg->tcs_hash_table); + seg->tcs_hash_table = NULL; + TAB_CAC_FREE_LOCK(self, &seg->tcs_lock); } + ASSERT_NS(seg->tcs_cache_in_use == 0); } xt_free_mutex(&xt_tab_cache.tcm_lock); @@ -554,24 +561,24 @@ xtBool XTTabCache::tc_fetch(XT_ROW_REC_FILE_PTR file, xtRefID ref_id, XTTabCache } page = page->tcp_next; } + + size_t page_size = offsetof(XTTabCachePageRec, tcp_data) + this->tci_page_size; + TAB_CAC_UNLOCK(&seg->tcs_lock, thread->t_id); /* Page not found, allocate a new page: */ - size_t page_size = offsetof(XTTabCachePageRec, tcp_data) + this->tci_page_size; if (!(new_page = (XTTabCachePagePtr) xt_malloc_ns(page_size))) return FAILED; - /* Increment cache used. */ - seg->tcs_cache_in_use += page_size; /* Check the level of the cache: */ size_t cache_used = 0; for (int i=0; i<XT_TC_SEGMENT_COUNT; i++) cache_used += dcg->tcm_segment[i].tcs_cache_in_use; - if (cache_used > dcg->tcm_cache_high) + if (cache_used + page_size > dcg->tcm_cache_high) dcg->tcm_cache_high = cache_used; - if (cache_used > dcg->tcm_cache_size) { + if (cache_used + page_size > dcg->tcm_cache_size) { XTThreadPtr self; time_t now; @@ -638,7 +645,7 @@ xtBool XTTabCache::tc_fetch(XT_ROW_REC_FILE_PTR file, xtRefID ref_id, XTTabCache for (int i=0; i<XT_TC_SEGMENT_COUNT; i++) cache_used += dcg->tcm_segment[i].tcs_cache_in_use; - if (cache_used <= dcg->tcm_high_level) + if (cache_used + page_size <= dcg->tcm_high_level) break; /* * If there is too little cache we can get stuck here. @@ -663,7 +670,7 @@ xtBool XTTabCache::tc_fetch(XT_ROW_REC_FILE_PTR file, xtRefID ref_id, XTTabCache while (time(NULL) < now + 5); xt_unlock_mutex_ns(&dcg->tcm_freeer_lock); } - else if (cache_used > dcg->tcm_high_level) { + else if (cache_used + page_size > dcg->tcm_high_level) { /* Wake up the freeer because the cache level, * is higher than the high level. */ @@ -693,6 +700,9 @@ xtBool XTTabCache::tc_fetch(XT_ROW_REC_FILE_PTR file, xtRefID ref_id, XTTabCache } #ifdef XT_MEMSET_UNUSED_SPACE + else + red_size = 0; + /* Removing this is an optimization. It should not be required * to clear the unused space in the page. */ @@ -727,6 +737,15 @@ xtBool XTTabCache::tc_fetch(XT_ROW_REC_FILE_PTR file, xtRefID ref_id, XTTabCache page->tcp_next = seg->tcs_hash_table[hash_idx]; seg->tcs_hash_table[hash_idx] = page; + /* GOTCHA! This increment was done just after the malloc! + * So it was not protected by the segment lock! + * The result was that this count was no longer reliable, + * This resulted in the amount of cache being used becoming less, and\ + * less, because increments were lost over time! + */ + /* Increment cache used. */ + seg->tcs_cache_in_use += page_size; + done_ok: *ret_seg = seg; *ret_page = page; @@ -761,7 +780,7 @@ xtBool XTTableSeq::ts_log_no_op(XTThreadPtr thread, xtTableID tab_id, xtOpSeqNo * some will be missing, so the writer will not * be able to contniue. */ - return xt_xlog_log_data(thread, sizeof(XTactNoOpEntryDRec), (XTXactLogBufferDPtr) &ent_rec, FALSE); + return xt_xlog_log_data(thread, sizeof(XTactNoOpEntryDRec), (XTXactLogBufferDPtr) &ent_rec, XT_XLOG_NO_WRITE_NO_FLUSH); } #ifdef XT_NOT_INLINE @@ -828,13 +847,23 @@ xtBool XTTableSeq::xt_op_is_before(register xtOpSeqNo now, register xtOpSeqNo th /* * Used by the writer to wake the freeer. */ -xtPublic void xt_wr_wake_freeer(XTThreadPtr self) +xtPublic void xt_wr_wake_freeer(XTThreadPtr self, XTDatabaseHPtr db) { + /* BUG FIX: Was using tcm_freeer_cond. + * This is incorrect. When the freeer waits for the + * writter, it uses the writer's condition! + */ + xt_lock_mutex_ns(&db->db_wr_lock); + if (!xt_broadcast_cond_ns(&db->db_wr_cond)) + xt_log_and_clear_exception_ns(); + xt_unlock_mutex_ns(&db->db_wr_lock); +/* xt_lock_mutex(self, &xt_tab_cache.tcm_freeer_lock); pushr_(xt_unlock_mutex, &xt_tab_cache.tcm_freeer_lock); if (!xt_broadcast_cond_ns(&xt_tab_cache.tcm_freeer_cond)) xt_log_and_clear_exception_ns(); freer_(); // xt_unlock_mutex(&xt_tab_cache.tcm_freeer_lock) +*/ } /* Wait for a transaction to quit: */ @@ -1070,7 +1099,9 @@ static size_t tabc_free_page(XTThreadPtr self, TCResourcePtr tc) /* Free the page: */ size_t freed_space = offsetof(XTTabCachePageRec, tcp_data) + page->tcp_data_size; + ASSERT_NS(seg->tcs_cache_in_use >= freed_space); seg->tcs_cache_in_use -= freed_space; + ASSERT_NS(seg->tcs_cache_in_use == 0 || seg->tcs_cache_in_use >= 25000); xt_free_ns(page); TAB_CAC_UNLOCK(&seg->tcs_lock, self->t_id); @@ -1083,6 +1114,7 @@ static void tabc_fr_main(XTThreadPtr self) { register XTTabCacheMemPtr dcg = &xt_tab_cache; TCResourceRec tc = { 0 }; + int i; xt_set_low_priority(self); dcg->tcm_freeer_busy = TRUE; @@ -1095,14 +1127,20 @@ static void tabc_fr_main(XTThreadPtr self) while (!self->t_quit) { /* Total up the cache memory used: */ cache_used = 0; - for (int i=0; i<XT_TC_SEGMENT_COUNT; i++) + for (i=0; i<XT_TC_SEGMENT_COUNT; i++) cache_used += dcg->tcm_segment[i].tcs_cache_in_use; - if (cache_used > dcg->tcm_cache_high) { + + if (cache_used > dcg->tcm_cache_high) dcg->tcm_cache_high = cache_used; - } /* Check if the cache usage is over 95%: */ - if (self->t_quit || cache_used < dcg->tcm_high_level) + if (self->t_quit) + break; + + /* If threads are waiting then we are more aggressive about freeing + * cache. + */ + if (cache_used < (dcg->tcm_threads_waiting ? dcg->tcm_mid_level : dcg->tcm_high_level)) break; /* Reduce cache to the 75% level: */ @@ -1137,7 +1175,23 @@ static void tabc_fr_main(XTThreadPtr self) */ xt_db_approximate_time = time(NULL); dcg->tcm_freeer_busy = FALSE; - tabc_fr_wait_for_cache(self, 500); + /* No idea, why, but I am getting an uneccesarry pause here. + * I run DBT2 with low record cache. + * + * Every now and then there is a pause where the freeer is here, + * and all user threads are waiting for the freeer. + * + * So adding the tcm_threads_waiting condition. + */ + if (dcg->tcm_threads_waiting) { + cache_used = 0; + for (i=0; i<XT_TC_SEGMENT_COUNT; i++) + cache_used += dcg->tcm_segment[i].tcs_cache_in_use; + if (cache_used < dcg->tcm_mid_level) + tabc_fr_wait_for_cache(self, 500); + } + else + tabc_fr_wait_for_cache(self, 500); //tabc_fr_wait_for_cache(self, 30*1000); dcg->tcm_freeer_busy = TRUE; xt_db_approximate_time = time(NULL); @@ -1174,7 +1228,7 @@ static void *tabc_fr_run_thread(XTThreadPtr self) count = 2*60; #endif while (!self->t_quit && count > 0) { - xt_db_approximate_time = xt_trace_clock(); + xt_db_approximate_time = time(NULL); sleep(1); count--; } diff --git a/storage/pbxt/src/tabcache_xt.h b/storage/pbxt/src/tabcache_xt.h index fae8ad9be66..5dcd39050d4 100644 --- a/storage/pbxt/src/tabcache_xt.h +++ b/storage/pbxt/src/tabcache_xt.h @@ -29,6 +29,7 @@ struct XTTable; struct XTOpenTable; struct XTTabCache; +struct XTDatabase; #include "thread_xt.h" #include "filesys_xt.h" @@ -226,6 +227,7 @@ typedef struct XTTabCacheMem { size_t tcm_cache_high; /* The high water level of cache allocation. */ size_t tcm_low_level; /* This is the level to which the freeer will free, once it starts working. */ size_t tcm_high_level; /* This is the level at which the freeer will start to work (to avoid waiting)! */ + size_t tcm_mid_level; /* At this level the freeer will not sleep if there are threads waiting. */ /* The free'er thread: */ struct XTThread *tcm_freeer_thread; /* The freeer thread . */ @@ -283,6 +285,6 @@ void xt_check_table_cache(struct XTTable *tab); void xt_quit_freeer(XTThreadPtr self); void xt_stop_freeer(XTThreadPtr self); void xt_start_freeer(XTThreadPtr self); -void xt_wr_wake_freeer(XTThreadPtr self); +void xt_wr_wake_freeer(XTThreadPtr self, struct XTDatabase *db); #endif diff --git a/storage/pbxt/src/table_xt.cc b/storage/pbxt/src/table_xt.cc index 1aef77ef253..b01f4404ce3 100644 --- a/storage/pbxt/src/table_xt.cc +++ b/storage/pbxt/src/table_xt.cc @@ -61,6 +61,11 @@ #define CHECK_TABLE_STATS +/* The problem is that this can take a long time + * if the table is very large! + */ +//#define CHECK_TABLE_READ_DATA_LOG + #ifdef TRACE_TABLE_IDS //#define PRINTF xt_ftracef #define PRINTF xt_trace @@ -217,6 +222,7 @@ static void tab_finalize(XTThreadPtr self, void *x) xt_spinlock_free(self, &tab->tab_ainc_lock); xt_free_mutex(&tab->tab_rec_flush_lock); xt_free_mutex(&tab->tab_ind_flush_lock); + xt_free_mutex(&tab->tab_ind_stat_lock); xt_free_mutex(&tab->tab_dic_field_lock); xt_free_mutex(&tab->tab_row_lock); xt_free_mutex(&tab->tab_ind_lock); @@ -487,6 +493,12 @@ xtPublic void xt_tab_init_db(XTThreadPtr self, XTDatabaseHPtr db) } freer_(); // xt_describe_tables_exit(&desc) + /* + * When we open all tables, we ignore problems with foreign keys. + * This must be done or we will not be able to load tables that + * were created with foreign key checks off. + */ + self->st_ignore_fkeys = 1; /* * The purpose of this code is to ensure that all tables are opened and cached, * which is actually only required if tables have foreign key references. @@ -499,14 +511,30 @@ xtPublic void xt_tab_init_db(XTThreadPtr self, XTDatabaseHPtr db) * * Cannot open tables in the loop above because db->db_table_by_id which is built * above is used by xt_use_table_no_lock() + * + * {TABLE-STATS} + * NOTE: The code also lead to the statistics failing to work because + * the tables were already open when the handler was opened. + * Previously we only caclulated statistics when a handler was opened + * and the underlying table was also opened. */ xt_enum_tables_init(&edx); while ((te_ptr = xt_enum_tables_next(self, db, &edx))) { xt_strcpy(PATH_MAX, pbuf, te_ptr->te_tab_path->tp_path); xt_add_dir_char(PATH_MAX, pbuf); xt_strcat(PATH_MAX, pbuf, te_ptr->te_tab_name); - xt_heap_release(self, xt_use_table_no_lock(self, db, (XTPathStrPtr)pbuf, FALSE, FALSE, NULL, NULL)); + try_(a) { + xt_heap_release(self, xt_use_table_no_lock(self, db, (XTPathStrPtr) pbuf, FALSE, FALSE, NULL)); + } + catch_(a) { + /* ignore errors, because we are just loading all + * the tables that we can... + */ + xt_log_and_clear_warning(self); + } + cont_(a); } + self->st_ignore_fkeys = 0; popr_(); // Discard xt_tab_exit_db(db) exit_(); @@ -651,7 +679,7 @@ xtPublic void xt_check_tables(XTThreadPtr self) xt_strcpy(PATH_MAX, path, te_ptr->te_tab_path->tp_path); xt_add_dir_char(PATH_MAX, path); xt_strcat(PATH_MAX, path, te_ptr->te_tab_name); - tab = xt_use_table(self, (XTPathStrPtr) path, FALSE, FALSE, NULL); + tab = xt_use_table(self, (XTPathStrPtr) path, FALSE, FALSE); tab_check_table(self, tab); xt_heap_release(self, tab); tab = NULL; @@ -1009,6 +1037,7 @@ xtPublic xtBool xt_tab_write_min_auto_inc(XTOpenTablePtr ot) /* a helper function to remove table from the open tables hash on exception * used in tab_new_handle() below */ + #ifdef NO_LONGER_REQ static void xt_del_from_db_tables_ht(XTThreadPtr self, XTTableHPtr tab) { XTTableEntryPtr te_ptr; @@ -1024,6 +1053,7 @@ static void xt_del_from_db_tables_ht(XTThreadPtr self, XTTableHPtr tab) if ((te_ptr = (XTTableEntryPtr) xt_sl_find(self, db->db_table_by_id, &tab_id))) te_ptr->te_table = NULL; } +#endif /* * Create a new table handle (i.e. open a table). @@ -1067,6 +1097,7 @@ static int tab_new_handle(XTThreadPtr self, XTTableHPtr *r_tab, XTDatabaseHPtr d xt_spinlock_init_with_autoname(self, &tab->tab_ainc_lock); xt_init_mutex_with_autoname(self, &tab->tab_rec_flush_lock); xt_init_mutex_with_autoname(self, &tab->tab_ind_flush_lock); + xt_init_mutex_with_autoname(self, &tab->tab_ind_stat_lock); xt_init_mutex_with_autoname(self, &tab->tab_dic_field_lock); xt_init_mutex_with_autoname(self, &tab->tab_row_lock); xt_init_mutex_with_autoname(self, &tab->tab_ind_lock); @@ -1148,9 +1179,16 @@ static int tab_new_handle(XTThreadPtr self, XTTableHPtr *r_tab, XTDatabaseHPtr d * will work if we have cyclic foreign key references. */ if (tab->tab_dic.dic_table) { - pushr_(xt_del_from_db_tables_ht, tab); - tab->tab_dic.dic_table->attachReferences(self, db); - popr_(); + try_(a) { + tab->tab_dic.dic_table->attachReferences(self, db); + } + catch_(a) { + /* Errors are thrown when: set foreign_key_checks = 1 */ + /* Undo everything done above: */ + xt_ht_del(self, db->db_tables, tab->tab_name); + xt_throw(self); + } + cont_(a); } *r_tab = tab; @@ -1162,7 +1200,7 @@ static int tab_new_handle(XTThreadPtr self, XTTableHPtr *r_tab, XTDatabaseHPtr d * Get a reference to a table in the current database. The table reference is valid, * as long as the thread is using the database!!! */ -xtPublic XTTableHPtr xt_use_table_no_lock(XTThreadPtr self, XTDatabaseHPtr db, XTPathStrPtr name, xtBool no_load, xtBool missing_ok, XTDictionaryPtr dic, xtBool *opened) +xtPublic XTTableHPtr xt_use_table_no_lock(XTThreadPtr self, XTDatabaseHPtr db, XTPathStrPtr name, xtBool no_load, xtBool missing_ok, XTDictionaryPtr dic) { XTTableHPtr tab; @@ -1181,9 +1219,6 @@ xtPublic XTTableHPtr xt_use_table_no_lock(XTThreadPtr self, XTDatabaseHPtr db, X if (tab_new_handle(self, &tab, db, tab_id, name, FALSE, dic) == XT_TAB_NO_DICTIONARY) xt_throw_taberr(XT_CONTEXT, XT_ERR_NO_DICTIONARY, name); - - if (opened) - *opened = TRUE; } if (tab) @@ -1297,7 +1332,7 @@ xtPublic void xt_create_table(XTThreadPtr self, XTPathStrPtr name, XTDictionaryP XTSortedListInfoRec li_undo; #ifdef TRACE_CREATE_TABLES - fprintf(stderr, "CREATE %s\n", name->ps_path); + printf("CREATE %s\n", name->ps_path); #endif enter_(); if (strlen(xt_last_name_of_path(name->ps_path)) > XT_TABLE_NAME_SIZE-1) @@ -1528,7 +1563,7 @@ xtPublic void xt_create_table(XTThreadPtr self, XTPathStrPtr name, XTDictionaryP * as well. */ if (!old_tab_id) { - tab = xt_use_table_no_lock(self, db, name, FALSE, FALSE, NULL, NULL); + tab = xt_use_table_no_lock(self, db, name, FALSE, FALSE, NULL); xt_heap_release(self, tab); } } @@ -1556,7 +1591,7 @@ xtPublic void xt_create_table(XTThreadPtr self, XTPathStrPtr name, XTDictionaryP /* Same purpose as above {LOAD-FOR-FKS} (although this should work, * beacuse this is a TRUNCATE TABLE. */ - tab = xt_use_table_no_lock(self, db, name, FALSE, FALSE, NULL, NULL); + tab = xt_use_table_no_lock(self, db, name, FALSE, FALSE, NULL); xt_heap_release(self, tab); } catch_(b) { @@ -1599,7 +1634,7 @@ xtPublic void xt_create_table(XTThreadPtr self, XTPathStrPtr name, XTDictionaryP /* this code is not needed anymore as we open tables referred by FKs as necessary during checks xt_ht_lock(self, db->db_tables); pushr_(xt_ht_unlock, db->db_tables); - tab = xt_use_table_no_lock(self, db, name, FALSE, FALSE, NULL, NULL); + tab = xt_use_table_no_lock(self, db, name, FALSE, FALSE, NULL); freer_(); // xt_ht_unlock(db->db_tables) xt_heap_release(self, tab); * CHANGED see {LOAD-FOR-FKS} above. @@ -1619,7 +1654,7 @@ xtPublic void xt_drop_table(XTThreadPtr self, XTPathStrPtr tab_name, xtBool drop enter_(); #ifdef TRACE_CREATE_TABLES - fprintf(stderr, "DROP %s\n", tab_name->ps_path); + printf("DROP %s\n", tab_name->ps_path); #endif table_pool = tab_lock_table(self, tab_name, FALSE, TRUE, TRUE, &tab); @@ -1758,10 +1793,12 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) XTTableHPtr tab = ot->ot_table; xtRecordID prec_id; XTTabRecExtDPtr rec_buf = (XTTabRecExtDPtr) ot->ot_row_rbuffer; +#ifdef CHECK_TABLE_READ_DATA_LOG XTactExtRecEntryDRec ext_rec; size_t log_size; xtLogID log_id; xtLogOffset log_offset; +#endif xtRecordID rec_id; xtRecordID prev_rec_id; xtXactID xn_id; @@ -1775,9 +1812,10 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) size_t rec_size; size_t row_size; u_llong ext_data_len = 0; + u_llong ext_rec_count = 0; #if defined(DUMP_CHECK_TABLE) || defined(CHECK_TABLE_STATS) - fprintf(stderr, "\nCHECK TABLE: %s\n", tab->tab_name->ps_path); + printf("\nCHECK TABLE: %s\n", tab->tab_name->ps_path); #endif xt_lock_mutex(self, &tab->tab_db->db_co_ext_lock); @@ -1787,38 +1825,38 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) pushr_(xt_unlock_mutex, &tab->tab_rec_lock); #ifdef CHECK_TABLE_STATS - fprintf(stderr, "Record buffer size = %lu\n", (u_long) tab->tab_dic.dic_mysql_buf_size); - fprintf(stderr, "Fixed length rec. len. = %lu\n", (u_long) tab->tab_dic.dic_mysql_rec_size); - fprintf(stderr, "Handle data record size = %lu\n", (u_long) tab->tab_dic.dic_rec_size); - fprintf(stderr, "Min/max header size = %d/%d\n", (int) offsetof(XTTabRecFix, rf_data), tab->tab_dic.dic_rec_fixed ? (int) offsetof(XTTabRecFix, rf_data) : (int) offsetof(XTTabRecExtDRec, re_data)); - fprintf(stderr, "Min/avg/max record size = %llu/%llu/%llu\n", (u_llong) tab->tab_dic.dic_min_row_size, (u_llong) tab->tab_dic.dic_ave_row_size, (u_llong) tab->tab_dic.dic_max_row_size); + printf("Record buffer size = %lu\n", (u_long) tab->tab_dic.dic_mysql_buf_size); + printf("Fixed length rec. len. = %lu\n", (u_long) tab->tab_dic.dic_mysql_rec_size); + printf("Handle data record size = %lu\n", (u_long) tab->tab_dic.dic_rec_size); + printf("Min/max header size = %d/%d\n", (int) offsetof(XTTabRecFix, rf_data), tab->tab_dic.dic_rec_fixed ? (int) offsetof(XTTabRecFix, rf_data) : (int) offsetof(XTTabRecExtDRec, re_data)); + printf("Min/avg/max record size = %llu/%llu/%llu\n", (u_llong) tab->tab_dic.dic_min_row_size, (u_llong) tab->tab_dic.dic_ave_row_size, (u_llong) tab->tab_dic.dic_max_row_size); if (tab->tab_dic.dic_def_ave_row_size) - fprintf(stderr, "Avg row len set for tab = %lu\n", (u_long) tab->tab_dic.dic_def_ave_row_size); + printf("Avg row len set for tab = %lu\n", (u_long) tab->tab_dic.dic_def_ave_row_size); else - fprintf(stderr, "Avg row len set for tab = not specified\n"); - fprintf(stderr, "Rows fixed length = %s\n", tab->tab_dic.dic_rec_fixed ? "YES" : "NO"); + printf("Avg row len set for tab = not specified\n"); + printf("Rows fixed length = %s\n", tab->tab_dic.dic_rec_fixed ? "YES" : "NO"); if (tab->tab_dic.dic_tab_flags & XT_TAB_FLAGS_TEMP_TAB) - fprintf(stderr, "Table type = TEMP\n"); + printf("Table type = TEMP\n"); if (tab->tab_dic.dic_def_ave_row_size) - fprintf(stderr, "Maximum fixed size = %lu\n", (u_long) XT_TAB_MAX_FIX_REC_LENGTH_SPEC); + printf("Maximum fixed size = %lu\n", (u_long) XT_TAB_MAX_FIX_REC_LENGTH_SPEC); else - fprintf(stderr, "Maximum fixed size = %lu\n", (u_long) XT_TAB_MAX_FIX_REC_LENGTH); - fprintf(stderr, "Minimum variable size = %lu\n", (u_long) XT_TAB_MIN_VAR_REC_LENGTH); - fprintf(stderr, "Minimum auto-increment = %llu\n", (u_llong) tab->tab_dic.dic_min_auto_inc); - fprintf(stderr, "Number of columns = %lu\n", (u_long) tab->tab_dic.dic_no_of_cols); - fprintf(stderr, "Number of fixed columns = %lu\n", (u_long) tab->tab_dic.dic_fix_col_count); - fprintf(stderr, "Columns req. for index = %lu\n", (u_long) tab->tab_dic.dic_ind_cols_req); + printf("Maximum fixed size = %lu\n", (u_long) XT_TAB_MAX_FIX_REC_LENGTH); + printf("Minimum variable size = %lu\n", (u_long) XT_TAB_MIN_VAR_REC_LENGTH); + printf("Minimum auto-increment = %llu\n", (u_llong) tab->tab_dic.dic_min_auto_inc); + printf("Number of columns = %lu\n", (u_long) tab->tab_dic.dic_no_of_cols); + printf("Number of fixed columns = %lu\n", (u_long) tab->tab_dic.dic_fix_col_count); + printf("Columns req. for index = %lu\n", (u_long) tab->tab_dic.dic_ind_cols_req); if (tab->tab_dic.dic_ind_rec_len) - fprintf(stderr, "Rec len req. for index = %llu\n", (u_llong) tab->tab_dic.dic_ind_rec_len); - fprintf(stderr, "Columns req. for blobs = %lu\n", (u_long) tab->tab_dic.dic_blob_cols_req); - fprintf(stderr, "Number of blob columns = %lu\n", (u_long) tab->tab_dic.dic_blob_count); - fprintf(stderr, "Number of indices = %lu\n", (u_long) tab->tab_dic.dic_key_count); + printf("Rec len req. for index = %llu\n", (u_llong) tab->tab_dic.dic_ind_rec_len); + printf("Columns req. for blobs = %lu\n", (u_long) tab->tab_dic.dic_blob_cols_req); + printf("Number of blob columns = %lu\n", (u_long) tab->tab_dic.dic_blob_count); + printf("Number of indices = %lu\n", (u_long) tab->tab_dic.dic_key_count); #endif #ifdef DUMP_CHECK_TABLE - fprintf(stderr, "Records:-\n"); - fprintf(stderr, "Free list: %llu (%llu)\n", (u_llong) tab->tab_rec_free_id, (u_llong) tab->tab_rec_fnum); - fprintf(stderr, "EOF: %llu\n", (u_llong) tab->tab_rec_eof_id); + printf("Records:-\n"); + printf("Free list: %llu (%llu)\n", (u_llong) tab->tab_rec_free_id, (u_llong) tab->tab_rec_fnum); + printf("EOF: %llu\n", (u_llong) tab->tab_rec_eof_id); #endif rec_size = XT_REC_EXT_HEADER_SIZE; @@ -1830,24 +1868,24 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) xt_throw(self); #ifdef DUMP_CHECK_TABLE - fprintf(stderr, "%-4llu ", (u_llong) rec_id); + printf("%-4llu ", (u_llong) rec_id); #endif switch (rec_buf->tr_rec_type_1 & XT_TAB_STATUS_MASK) { case XT_TAB_STATUS_FREED: #ifdef DUMP_CHECK_TABLE - fprintf(stderr, "======== "); + printf("======== "); #endif free_rec_count++; break; case XT_TAB_STATUS_DELETE: #ifdef DUMP_CHECK_TABLE - fprintf(stderr, "delete "); + printf("delete "); #endif delete_rec_count++; break; case XT_TAB_STATUS_FIXED: #ifdef DUMP_CHECK_TABLE - fprintf(stderr, "record-F "); + printf("record-F "); #endif alloc_rec_count++; row_size = myxt_store_row_length(ot, (char *) ot->ot_row_rbuffer + XT_REC_FIX_HEADER_SIZE); @@ -1859,7 +1897,7 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) break; case XT_TAB_STATUS_VARIABLE: #ifdef DUMP_CHECK_TABLE - fprintf(stderr, "record-V "); + printf("record-V "); #endif alloc_rec_count++; row_size = myxt_load_row_length(ot, tab->tab_dic.dic_rec_size, ot->ot_row_rbuffer + XT_REC_FIX_HEADER_SIZE, NULL); @@ -1871,9 +1909,10 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) break; case XT_TAB_STATUS_EXT_DLOG: #ifdef DUMP_CHECK_TABLE - fprintf(stderr, "record-X "); + printf("record-X "); #endif alloc_rec_count++; + ext_rec_count++; ext_data_len += XT_GET_DISK_4(rec_buf->re_log_dat_siz_4); row_size = XT_GET_DISK_4(rec_buf->re_log_dat_siz_4) + ot->ot_rec_size - XT_REC_EXT_HEADER_SIZE; alloc_rec_bytes += row_size; @@ -1885,9 +1924,9 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) } #ifdef DUMP_CHECK_TABLE if (rec_buf->tr_rec_type_1 & XT_TAB_STATUS_CLEANED_BIT) - fprintf(stderr, "C"); + printf("C"); else - fprintf(stderr, " "); + printf(" "); #endif prev_rec_id = XT_GET_DISK_4(rec_buf->tr_prev_rec_id_4); xn_id = XT_GET_DISK_4(rec_buf->tr_xact_id_4); @@ -1895,14 +1934,15 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) switch (rec_buf->tr_rec_type_1 & XT_TAB_STATUS_MASK) { case XT_TAB_STATUS_FREED: #ifdef DUMP_CHECK_TABLE - fprintf(stderr, " prev=%-3llu (xact=%-3llu row=%lu)\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id); + printf(" prev=%-3llu (xact=%-3llu row=%lu)\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id); #endif break; case XT_TAB_STATUS_EXT_DLOG: #ifdef DUMP_CHECK_TABLE - fprintf(stderr, " prev=%-3llu xact=%-3llu row=%lu Xlog=%lu Xoff=%llu Xsiz=%lu\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id, (u_long) XT_GET_DISK_2(rec_buf->re_log_id_2), (u_llong) XT_GET_DISK_6(rec_buf->re_log_offs_6), (u_long) XT_GET_DISK_4(rec_buf->re_log_dat_siz_4)); + printf(" prev=%-3llu xact=%-3llu row=%lu Xlog=%lu Xoff=%llu Xsiz=%lu\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id, (u_long) XT_GET_DISK_2(rec_buf->re_log_id_2), (u_llong) XT_GET_DISK_6(rec_buf->re_log_offs_6), (u_long) XT_GET_DISK_4(rec_buf->re_log_dat_siz_4)); #endif +#ifdef CHECK_TABLE_READ_DATA_LOG log_size = XT_GET_DISK_4(rec_buf->re_log_dat_siz_4); XT_GET_LOG_REF(log_id, log_offset, rec_buf); if (!self->st_dlog_buf.dlb_read_log(log_id, log_offset, offsetof(XTactExtRecEntryDRec, er_data), (xtWord1 *) &ext_rec, self)) @@ -1919,10 +1959,11 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) xt_logf(XT_INFO, "Table %s: record %llu, extended record %lu:%llu not valid\n", tab->tab_name, (u_llong) rec_id, (u_long) log_id, (u_llong) log_offset); } } +#endif break; default: #ifdef DUMP_CHECK_TABLE - fprintf(stderr, " prev=%-3llu xact=%-3llu row=%lu\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id); + printf(" prev=%-3llu xact=%-3llu row=%lu\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id); #endif break; } @@ -1930,17 +1971,19 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) } #ifdef CHECK_TABLE_STATS - if (!tab->tab_dic.dic_rec_fixed) - fprintf(stderr, "Extendend data length = %llu\n", ext_data_len); + if (!tab->tab_dic.dic_rec_fixed) { + printf("Extended data length = %llu\n", ext_data_len); + printf("Extended record count = %llu\n", ext_rec_count); + } if (alloc_rec_count) { - fprintf(stderr, "Minumum comp. rec. len. = %llu\n", (u_llong) min_comp_rec_len); - fprintf(stderr, "Average comp. rec. len. = %llu\n", (u_llong) ((double) alloc_rec_bytes / (double) alloc_rec_count + (double) 0.5)); - fprintf(stderr, "Maximum comp. rec. len. = %llu\n", (u_llong) max_comp_rec_len); + printf("Minumum comp. rec. len. = %llu\n", (u_llong) min_comp_rec_len); + printf("Average comp. rec. len. = %llu\n", (u_llong) ((double) alloc_rec_bytes / (double) alloc_rec_count + (double) 0.5)); + printf("Maximum comp. rec. len. = %llu\n", (u_llong) max_comp_rec_len); } - fprintf(stderr, "Free record count = %llu\n", (u_llong) free_rec_count); - fprintf(stderr, "Deleted record count = %llu\n", (u_llong) delete_rec_count); - fprintf(stderr, "Allocated record count = %llu\n", (u_llong) alloc_rec_count); + printf("Free record count = %llu\n", (u_llong) free_rec_count); + printf("Deleted record count = %llu\n", (u_llong) delete_rec_count); + printf("Allocated record count = %llu\n", (u_llong) alloc_rec_count); #endif if (tab->tab_rec_fnum != free_rec_count) xt_logf(XT_INFO, "Table %s: incorrect number of free blocks, %llu, should be: %llu\n", tab->tab_name, (u_llong) free_rec_count, (u_llong) tab->tab_rec_fnum); @@ -1978,9 +2021,9 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) pushr_(xt_unlock_mutex, &tab->tab_row_lock); #ifdef DUMP_CHECK_TABLE - fprintf(stderr, "Rows:-\n"); - fprintf(stderr, "Free list: %llu (%llu)\n", (u_llong) tab->tab_row_free_id, (u_llong) tab->tab_row_fnum); - fprintf(stderr, "EOF: %llu\n", (u_llong) tab->tab_row_eof_id); + printf("Rows:-\n"); + printf("Free list: %llu (%llu)\n", (u_llong) tab->tab_row_free_id, (u_llong) tab->tab_row_fnum); + printf("EOF: %llu\n", (u_llong) tab->tab_row_eof_id); #endif rec_id = 1; @@ -1988,13 +2031,13 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot) if (!tab->tab_rows.xt_tc_read_4(ot->ot_row_file, rec_id, &ref_id, self)) xt_throw(self); #ifdef DUMP_CHECK_TABLE - fprintf(stderr, "%-3llu ", (u_llong) rec_id); + printf("%-3llu ", (u_llong) rec_id); #endif #ifdef DUMP_CHECK_TABLE if (ref_id == 0) - fprintf(stderr, "====== 0\n"); + printf("====== 0\n"); else - fprintf(stderr, "in use %llu\n", (u_llong) ref_id); + printf("in use %llu\n", (u_llong) ref_id); #endif rec_id++; } @@ -2026,7 +2069,7 @@ xtPublic void xt_rename_table(XTThreadPtr self, XTPathStrPtr old_name, XTPathStr memset(&dic, 0, sizeof(dic)); #ifdef TRACE_CREATE_TABLES - fprintf(stderr, "RENAME %s --> %s\n", old_name->ps_path, new_name->ps_path); + printf("RENAME %s --> %s\n", old_name->ps_path, new_name->ps_path); #endif if (strlen(xt_last_name_of_path(new_name->ps_path)) > XT_TABLE_NAME_SIZE-1) xt_throw_taberr(XT_CONTEXT, XT_ERR_NAME_TOO_LONG, new_name); @@ -2100,7 +2143,7 @@ xtPublic void xt_rename_table(XTThreadPtr self, XTPathStrPtr old_name, XTPathStr popr_(); // Discard tab_free_table_path(te_new_path); popr_(); // Discard xt_free(te_new_name); - tab = xt_use_table_no_lock(self, db, new_name, FALSE, FALSE, &dic, NULL); + tab = xt_use_table_no_lock(self, db, new_name, FALSE, FALSE, &dic); /* All renamed tables are considered repaired! */ xt_tab_table_repaired(tab); xt_heap_release(self, tab); @@ -2110,14 +2153,14 @@ xtPublic void xt_rename_table(XTThreadPtr self, XTPathStrPtr old_name, XTPathStr freer_(); // xt_db_unlock_table_pool(table_pool) } -xtPublic XTTableHPtr xt_use_table(XTThreadPtr self, XTPathStrPtr name, xtBool no_load, xtBool missing_ok, xtBool *opened) +xtPublic XTTableHPtr xt_use_table(XTThreadPtr self, XTPathStrPtr name, xtBool no_load, xtBool missing_ok) { XTTableHPtr tab; XTDatabaseHPtr db = self->st_database; xt_ht_lock(self, db->db_tables); pushr_(xt_ht_unlock, db->db_tables); - tab = xt_use_table_no_lock(self, db, name, no_load, missing_ok, NULL, opened); + tab = xt_use_table_no_lock(self, db, name, no_load, missing_ok, NULL); freer_(); return tab; } @@ -2221,7 +2264,7 @@ xtPublic xtBool xt_flush_record_row(XTOpenTablePtr ot, off_t *bytes_flushed, xtB xt_tab_store_header(ot, &rec_head); #ifdef TRACE_FLUSH - fprintf(stderr, "FLUSH rec/row %d %s\n", (int) tab->tab_bytes_to_flush, tab->tab_name->ps_path); + printf("FLUSH rec/row %d %s\n", (int) tab->tab_bytes_to_flush, tab->tab_name->ps_path); fflush(stdout); #endif /* Write the table header: */ @@ -2276,7 +2319,7 @@ xtPublic xtBool xt_flush_record_row(XTOpenTablePtr ot, off_t *bytes_flushed, xtB xt_unlock_mutex_ns(&cp->cp_state_lock); #ifdef TRACE_FLUSH - fprintf(stderr, "FLUSH --end-- %s\n", tab->tab_name->ps_path); + printf("FLUSH --end-- %s\n", tab->tab_name->ps_path); fflush(stdout); #endif xt_unlock_mutex_ns(&tab->tab_rec_flush_lock); @@ -2858,7 +2901,7 @@ static int tab_visible(register XTOpenTablePtr ot, XTTabRecHeadDPtr rec_head, xt /* This is a record written by this transaction. */ if (thread->st_is_update) { /* Check that it was not written by the current update statement: */ - if (XT_STAT_ID_MASK(thread->st_update_id) == rec_head->tr_stat_id_1) { + if (XT_STAT_ID_MASK(ot->ot_update_id) == rec_head->tr_stat_id_1) { #ifdef TRACE_VARIATIONS if (len <= 450) len += sprintf(t_buf+len, "MY UPDATE IN THIS STATEMENT T%d\n", (int) xn_id); @@ -3139,7 +3182,7 @@ static int tab_visible(register XTOpenTablePtr ot, XTTabRecHeadDPtr rec_head, xt } if (lw.lw_curr_lock != XT_NO_LOCK) { #ifdef TRACE_VARIATIONS - xt_ttracef(thread, "T%d WAIT FOR LOCK(%D) T%d\n", (int) thread->st_xact_data->xd_start_xn_id, (int) lock_type, (int) xn_id); + xt_ttracef(thread, "T%d WAIT FOR LOCK(%s) T%d\n", (int) thread->st_xact_data->xd_start_xn_id, (int) lw.lw_curr_lock == XT_TEMP_LOCK ? "temp" : "perm", (int) xn_id); #endif if (!xt_xn_wait_for_xact(thread, NULL, &lw)) { #ifdef DEBUG_LOCK_QUEUE @@ -3950,6 +3993,21 @@ static void tab_free_row_on_fail(XTOpenTablePtr ot, XTTableHPtr tab, xtRowID row tab_restore_exception(&e); } +static xtBool tab_write_ext_record(XTOpenTablePtr ot, XTTabRecInfoPtr rec_info, xtTableID tab_id, xtRecordID rec_id, xtLogID log_id, xtLogOffset log_offset, XTThreadPtr thread) +{ + xtWord1 tmp_buffer[offsetof(XTactExtRecEntryDRec, er_data)]; + xtBool ok; + + memcpy(tmp_buffer, rec_info->ri_log_buf, sizeof(tmp_buffer)); + rec_info->ri_log_buf->er_status_1 = XT_LOG_ENT_EXT_REC_OK; + XT_SET_DISK_4(rec_info->ri_log_buf->er_data_size_4, rec_info->ri_log_data_size); + XT_SET_DISK_4(rec_info->ri_log_buf->er_tab_id_4, tab_id); + XT_SET_DISK_4(rec_info->ri_log_buf->er_rec_id_4, rec_id); + ok = thread->st_dlog_buf.dlb_append_log(log_id, log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info->ri_log_data_size, (xtWord1 *) rec_info->ri_log_buf, thread); + memcpy(rec_info->ri_log_buf, tmp_buffer, sizeof(tmp_buffer)); + return ok; +} + static xtBool tab_add_record(XTOpenTablePtr ot, XTTabRecInfoPtr rec_info, u_int status) { register XTTableHPtr tab = ot->ot_table; @@ -4007,26 +4065,19 @@ static xtBool tab_add_record(XTOpenTablePtr ot, XTTabRecInfoPtr rec_info, u_int */ read = ((rec_id - 1) % tab->tab_recs.tci_rows_per_page) != 0; - if (!tab->tab_recs.xt_tc_write(ot->ot_rec_file, rec_id, 0, rec_info->ri_rec_buf_size, (xtWord1 *) rec_info->ri_fix_rec_buf, &op_seq, read, ot->ot_thread)) { + if (!tab->tab_recs.xt_tc_write(ot->ot_rec_file, rec_id, 0, rec_info->ri_rec_buf_size, (xtWord1 *) rec_info->ri_fix_rec_buf, &op_seq, read, thread)) { xt_unlock_mutex_ns(&tab->tab_rec_lock); return FAILED; } } xt_unlock_mutex_ns(&tab->tab_rec_lock); - if (!xt_xlog_modify_table(tab->tab_id, status, op_seq, next_rec_id, rec_id, rec_info->ri_rec_buf_size, (xtWord1 *) rec_info->ri_fix_rec_buf, ot->ot_thread)) + if (!xt_xlog_modify_table(tab->tab_id, status, op_seq, next_rec_id, rec_id, rec_info->ri_rec_buf_size, (xtWord1 *) rec_info->ri_fix_rec_buf, thread)) return FAILED; if (rec_info->ri_ext_rec) { - /* Write the log buffer overflow: */ - rec_info->ri_log_buf->er_status_1 = XT_LOG_ENT_EXT_REC_OK; - XT_SET_DISK_4(rec_info->ri_log_buf->er_data_size_4, rec_info->ri_log_data_size); - XT_SET_DISK_4(rec_info->ri_log_buf->er_tab_id_4, tab->tab_id); - XT_SET_DISK_4(rec_info->ri_log_buf->er_rec_id_4, rec_id); - if (!thread->st_dlog_buf.dlb_append_log(log_id, log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info->ri_log_data_size, (xtWord1 *) rec_info->ri_log_buf, ot->ot_thread)) { - /* Failed to write the overflow, free the record allocated above: */ + if (!tab_write_ext_record(ot, rec_info, tab->tab_id, rec_id, log_id, log_offset, thread)) return FAILED; - } } XT_DISABLED_TRACE(("new rec tx=%d val=%d\n", (int) thread->st_xact_data->xd_start_xn_id, (int) rec_id)); @@ -4062,8 +4113,11 @@ static void tab_delete_record_on_fail(XTOpenTablePtr ot, xtRowID row_id, xtRecor } } + /* This is not required because the extended record will be free + * later when the record is freed! if (row_ptr->tr_rec_type_1 == XT_TAB_STATUS_EXT_DLOG || row_ptr->tr_rec_type_1 == XT_TAB_STATUS_EXT_CLEAN) tab_free_ext_record_on_fail(ot, rec_id, (XTTabRecExtDPtr) row_ptr, log_err); + */ rec_info.ri_fix_rec_buf = (XTTabRecFixDPtr) ot->ot_row_wbuffer; rec_info.ri_rec_buf_size = offsetof(XTTabRecFixDRec, rf_data); @@ -4369,7 +4423,7 @@ xtPublic xtBool xt_tab_new_record(XTOpenTablePtr ot, xtWord1 *rec_buf) if (!(row_id = tab_new_row(ot, tab))) goto failed_0; - rec_info.ri_fix_rec_buf->tr_stat_id_1 = self->st_update_id; + rec_info.ri_fix_rec_buf->tr_stat_id_1 = ot->ot_update_id; XT_SET_DISK_4(rec_info.ri_fix_rec_buf->tr_row_id_4, row_id); XT_SET_DISK_4(rec_info.ri_fix_rec_buf->tr_prev_rec_id_4, 0); XT_SET_DISK_4(rec_info.ri_fix_rec_buf->tr_xact_id_4, self->st_xact_data->xd_start_xn_id); @@ -4458,7 +4512,7 @@ static xtBool tab_overwrite_record_on_fail(XTOpenTablePtr ot, XTTabRecInfoPtr re * order to do this we'd need to read the before-image of the * record before modifying it. */ - if (!ot->ot_thread->t_exception.e_xt_err) + if (!thread->t_exception.e_xt_err) xt_register_xterr(XT_REG_CONTEXT, XT_ERR_NO_BEFORE_IMAGE); return FAILED; } @@ -4471,7 +4525,7 @@ static xtBool tab_overwrite_record_on_fail(XTOpenTablePtr ot, XTTabRecInfoPtr re if (rec_info->ri_ext_rec) { /* Determine where the overflow will go... */ - if (!thread->st_dlog_buf.dlb_get_log_offset(&log_id, &log_offset, rec_info->ri_log_data_size + offsetof(XTactExtRecEntryDRec, er_data), ot->ot_thread)) + if (!thread->st_dlog_buf.dlb_get_log_offset(&log_id, &log_offset, rec_info->ri_log_data_size + offsetof(XTactExtRecEntryDRec, er_data), thread)) return FAILED; XT_SET_LOG_REF(rec_info->ri_ext_rec, log_id, log_offset); } @@ -4481,11 +4535,7 @@ static xtBool tab_overwrite_record_on_fail(XTOpenTablePtr ot, XTTabRecInfoPtr re if (rec_info->ri_ext_rec) { /* Write the log buffer overflow: */ - rec_info->ri_log_buf->er_status_1 = XT_LOG_ENT_EXT_REC_OK; - XT_SET_DISK_4(rec_info->ri_log_buf->er_data_size_4, rec_info->ri_log_data_size); - XT_SET_DISK_4(rec_info->ri_log_buf->er_tab_id_4, tab->tab_id); - XT_SET_DISK_4(rec_info->ri_log_buf->er_rec_id_4, rec_id); - if (!thread->st_dlog_buf.dlb_append_log(log_id, log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info->ri_log_data_size, (xtWord1 *) rec_info->ri_log_buf, ot->ot_thread)) + if (!tab_write_ext_record(ot, rec_info, tab->tab_id, rec_id, log_id, log_offset, thread)) return FAILED; } @@ -4529,12 +4579,12 @@ static xtBool tab_overwrite_record(XTOpenTablePtr ot, xtWord1 *before_buf, xtWor if (rec_info.ri_ext_rec) { /* Determine where the overflow will go... */ - if (!self->st_dlog_buf.dlb_get_log_offset(&log_id, &log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info.ri_log_data_size, ot->ot_thread)) + if (!self->st_dlog_buf.dlb_get_log_offset(&log_id, &log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info.ri_log_data_size, self)) goto failed_0; XT_SET_LOG_REF(rec_info.ri_ext_rec, log_id, log_offset); } - rec_info.ri_fix_rec_buf->tr_stat_id_1 = self->st_update_id; + rec_info.ri_fix_rec_buf->tr_stat_id_1 = ot->ot_update_id; XT_SET_DISK_4(rec_info.ri_fix_rec_buf->tr_row_id_4, row_id); XT_COPY_DISK_4(rec_info.ri_fix_rec_buf->tr_prev_rec_id_4, prev_rec_head.tr_prev_rec_id_4); XT_SET_DISK_4(rec_info.ri_fix_rec_buf->tr_xact_id_4, self->st_xact_data->xd_start_xn_id); @@ -4555,11 +4605,7 @@ static xtBool tab_overwrite_record(XTOpenTablePtr ot, xtWord1 *before_buf, xtWor if (rec_info.ri_ext_rec) { /* Write the log buffer overflow: */ - rec_info.ri_log_buf->er_status_1 = XT_LOG_ENT_EXT_REC_OK; - XT_SET_DISK_4(rec_info.ri_log_buf->er_data_size_4, rec_info.ri_log_data_size); - XT_SET_DISK_4(rec_info.ri_log_buf->er_tab_id_4, tab->tab_id); - XT_SET_DISK_4(rec_info.ri_log_buf->er_rec_id_4, rec_id); - if (!self->st_dlog_buf.dlb_append_log(log_id, log_offset, offsetof(XTactExtRecEntryDRec, er_data) + rec_info.ri_log_data_size, (xtWord1 *) rec_info.ri_log_buf, ot->ot_thread)) + if (!tab_write_ext_record(ot, &rec_info, tab->tab_id, rec_id, log_id, log_offset, self)) goto failed_1; } @@ -4678,7 +4724,7 @@ xtPublic xtBool xt_tab_update_record(XTOpenTablePtr ot, xtWord1 *before_buf, xtW if (!myxt_store_row(ot, &rec_info, (char *) after_buf)) goto failed_0; - rec_info.ri_fix_rec_buf->tr_stat_id_1 = self->st_update_id; + rec_info.ri_fix_rec_buf->tr_stat_id_1 = ot->ot_update_id; XT_SET_DISK_4(rec_info.ri_fix_rec_buf->tr_row_id_4, row_id); XT_SET_DISK_4(rec_info.ri_fix_rec_buf->tr_prev_rec_id_4, ot->ot_curr_rec_id); XT_SET_DISK_4(rec_info.ri_fix_rec_buf->tr_xact_id_4, self->st_xact_data->xd_start_xn_id); @@ -4688,7 +4734,7 @@ xtPublic xtBool xt_tab_update_record(XTOpenTablePtr ot, xtWord1 *before_buf, xtW goto failed_0; /* Link the new variation into the list: */ - XT_TAB_ROW_WRITE_LOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], ot->ot_thread); + XT_TAB_ROW_WRITE_LOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], self); if (!xt_tab_get_row(ot, row_id, &curr_var_rec_id)) goto failed_1; @@ -4714,7 +4760,7 @@ xtPublic xtBool xt_tab_update_record(XTOpenTablePtr ot, xtWord1 *before_buf, xtW goto failed_1; XT_DISABLED_TRACE(("set upd tx=%d row=%d rec=%d\n", (int) self->st_xact_data->xd_start_xn_id, (int) row_id, (int) rec_info.ri_rec_id)); - XT_TAB_ROW_UNLOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], ot->ot_thread); + XT_TAB_ROW_UNLOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], self); /* Add the index references: */ for (idx_cnt=0, ind=tab->tab_dic.dic_keys; idx_cnt<tab->tab_dic.dic_key_count; idx_cnt++, ind++) { @@ -4729,7 +4775,7 @@ xtPublic xtBool xt_tab_update_record(XTOpenTablePtr ot, xtWord1 *before_buf, xtW goto failed_2; } - ot->ot_thread->st_statistics.st_row_update++; + self->st_statistics.st_row_update++; return OK; failed_2: @@ -4737,7 +4783,7 @@ xtPublic xtBool xt_tab_update_record(XTOpenTablePtr ot, xtWord1 *before_buf, xtW goto failed_0; failed_1: - XT_TAB_ROW_UNLOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], ot->ot_thread); + XT_TAB_ROW_UNLOCK(&tab->tab_row_rwlock[row_id % XT_ROW_RWLOCKS], self); failed_0: return FAILED; diff --git a/storage/pbxt/src/table_xt.h b/storage/pbxt/src/table_xt.h index f7d7e1c6526..83f2168dd6e 100644 --- a/storage/pbxt/src/table_xt.h +++ b/storage/pbxt/src/table_xt.h @@ -364,6 +364,9 @@ typedef struct XTTable : public XTHeap { xtWord4 tab_rec_fnum; /* The count of the number of free rows on the free list. */ xt_mutex_type tab_rec_lock; /* Lock for the free list. */ + xt_mutex_type tab_ind_stat_lock; /* Aquired when calculating index statistics. */ + time_t tab_ind_stat_calc_time; /* Zero means the index stats have not be calculated, otherwize this is a time. */ + xt_mutex_type tab_ind_flush_lock; /* Required while the index file is being flushed. */ xtLogID tab_ind_rec_log_id; /* The point before which index entries have been written. */ xtLogOffset tab_ind_rec_log_offset; /* The log offset of the write point. */ @@ -372,7 +375,7 @@ typedef struct XTTable : public XTHeap { xtIndexNodeID tab_ind_free; /* The start of the free page list of the index. */ XTIndFreeListPtr tab_ind_free_list; /* A cache of the free list (if exists, don't go to disk!) */ xt_mutex_type tab_ind_lock; /* Lock for reading and writing the index free list. */ - xtWord2 tab_ind_flush_seq; + xtWord4 tab_ind_flush_seq; } XTTableHRec, *XTTableHPtr; /* Heap pointer */ /* Used for an in-memory list of the tables, ordered by ID. */ @@ -403,6 +406,8 @@ typedef struct XTOpenTable { size_t ot_rec_size; /* Cached from table for quick access. */ char ot_error_key[XT_IDENTIFIER_NAME_SIZE]; + struct XTOpenTable *ot_prev_update; /* The UPDATE statement stack! {UPDATE-STACK} */ + u_int ot_update_id; /* The update statement ID. */ xtBool ot_for_update; /* True if reading FOR UPDATE. */ xtBool ot_is_modify; /* True if UPDATE or DELETE. */ xtRowID ot_temp_row_lock; /* The temporary row lock set on this table. */ @@ -507,11 +512,11 @@ void xt_check_tables(struct XTThread *self); char *xt_tab_file_to_name(size_t size, char *tab_name, char *file_name); void xt_create_table(struct XTThread *self, XTPathStrPtr name, XTDictionaryPtr dic); -XTTableHPtr xt_use_table(struct XTThread *self, XTPathStrPtr name, xtBool no_load, xtBool missing_ok, xtBool *opened); +XTTableHPtr xt_use_table(struct XTThread *self, XTPathStrPtr name, xtBool no_load, xtBool missing_ok); void xt_sync_flush_table(struct XTThread *self, XTOpenTablePtr ot); xtBool xt_flush_record_row(XTOpenTablePtr ot, off_t *bytes_flushed, xtBool have_table_loc); void xt_flush_table(struct XTThread *self, XTOpenTablePtr ot); -XTTableHPtr xt_use_table_no_lock(XTThreadPtr self, struct XTDatabase *db, XTPathStrPtr name, xtBool no_load, xtBool missing_ok, XTDictionaryPtr dic, xtBool *opened); +XTTableHPtr xt_use_table_no_lock(XTThreadPtr self, struct XTDatabase *db, XTPathStrPtr name, xtBool no_load, xtBool missing_ok, XTDictionaryPtr dic); int xt_use_table_by_id(struct XTThread *self, XTTableHPtr *tab, struct XTDatabase *db, xtTableID tab_id); XTOpenTablePtr xt_open_table(XTTableHPtr tab); void xt_close_table(XTOpenTablePtr ot, xtBool flush, xtBool have_table_lock); diff --git a/storage/pbxt/src/thread_xt.cc b/storage/pbxt/src/thread_xt.cc index c31e23e69df..ac42896d22f 100644 --- a/storage/pbxt/src/thread_xt.cc +++ b/storage/pbxt/src/thread_xt.cc @@ -96,7 +96,7 @@ xtPublic xtBool xt_init_logging(void) { int err; - log_file = stderr; + log_file = stdout; log_level = XT_LOG_TRACE; err = xt_p_mutex_init_with_autoname(&log_mutex, NULL); if (err) { @@ -413,7 +413,8 @@ static void thr_save_error_va(XTExceptionPtr e, XTThreadPtr self, xtBool throw_i vsnprintf(e->e_err_msg, XT_ERR_MSG_SIZE, fmt, ap); /* Make the first character of the message upper case: */ - if (isalpha(e->e_err_msg[0]) && islower(e->e_err_msg[0])) + /* This did not work for foreign languages! */ + if (e->e_err_msg[0] >= 'a' && e->e_err_msg[0] <= 'z') e->e_err_msg[0] = (char) toupper(e->e_err_msg[0]); if (func && *func && *func != '-') @@ -793,11 +794,9 @@ xtPublic void xt_register_tabcolerr(c_char *func, c_char *file, u_int line, int xt_2nd_last_name_of_path(sizeof(buffer), buffer, tab_item->ps_path); xt_strcat(sizeof(buffer), buffer, "."); - xt_strcpy(sizeof(buffer), buffer, xt_last_name_of_path(tab_item->ps_path)); - xt_strcat(sizeof(buffer), buffer, "."); - xt_strcat(sizeof(buffer), buffer, item2); + xt_strcat(sizeof(buffer), buffer, xt_last_name_of_path(tab_item->ps_path)); - xt_register_ixterr(func, file, line, xt_err, buffer); + xt_register_i2xterr(func, file, line, xt_err, buffer, item2); } xtPublic void xt_register_taberr(c_char *func, c_char *file, u_int line, int xt_err, XTPathStrPtr tab_item) @@ -806,7 +805,7 @@ xtPublic void xt_register_taberr(c_char *func, c_char *file, u_int line, int xt_ xt_2nd_last_name_of_path(sizeof(buffer), buffer, tab_item->ps_path); xt_strcat(sizeof(buffer), buffer, "."); - xt_strcpy(sizeof(buffer), buffer, xt_last_name_of_path(tab_item->ps_path)); + xt_strcat(sizeof(buffer), buffer, xt_last_name_of_path(tab_item->ps_path)); xt_register_ixterr(func, file, line, xt_err, buffer); } @@ -1013,7 +1012,7 @@ static xtBool thr_setup_signals(void) typedef void *(*ThreadMainFunc)(XTThreadPtr self); -extern "C" void *thr_main_pbxt(void *data) +extern "C" void *xt_thread_main(void *data) { ThreadDataPtr td = (ThreadDataPtr) data; XTThreadPtr self = td->td_thr; @@ -1168,6 +1167,14 @@ xtPublic XTThreadPtr xt_init_threading(u_int max_threads) /* Align the number of threads: */ xt_thr_maximum_threads = xt_align_size(max_threads, XT_XS_LOCK_ALIGN); +#ifdef XT_TRACK_CONNECTIONS + if (xt_thr_maximum_threads > XT_TRACK_MAX_CONNS) { + xt_log_error(XT_NS_CONTEXT, XT_LOG_FATAL, XT_ERR_TOO_MANY_THREADS, 0, + "XT_TRACK_CONNECTIONS is enabled and xt_thr_maximum_threads > XT_TRACK_MAX_CONNS"); + goto failed; + } +#endif + #ifdef HANDLE_SIGNALS if (!thr_setup_signals()) return NULL; @@ -1503,10 +1510,10 @@ xtPublic pthread_t xt_run_thread(XTThreadPtr self, XTThreadPtr child, void *(*st pthread_attr_t attr = { 0, 0, 0 }; attr.priority = THREAD_PRIORITY_NORMAL; - err = pthread_create(&child_thread, &attr, thr_main_pbxt, &data); + err = pthread_create(&child_thread, &attr, xt_thread_main, &data); } #else - err = pthread_create(&child_thread, NULL, thr_main_pbxt, &data); + err = pthread_create(&child_thread, NULL, xt_thread_main, &data); #endif if (err) { xt_free_thread(child); diff --git a/storage/pbxt/src/thread_xt.h b/storage/pbxt/src/thread_xt.h index 7fcf6105a59..a07f7b7ae01 100644 --- a/storage/pbxt/src/thread_xt.h +++ b/storage/pbxt/src/thread_xt.h @@ -132,6 +132,7 @@ struct XTSortedList; struct XTXactLog; struct XTXactData; struct XTDatabase; +struct XTOpenTable; typedef void (*XTThreadFreeFunc)(struct XTThread *self, void *data); @@ -307,8 +308,7 @@ typedef struct XTThread { xtThreadID *st_thread_list; /* Used to prevent a record from being updated twice in one statement. */ - xtBool st_is_update; /* TRUE if this is an UPDATE statement. */ - u_int st_update_id; /* The update statement ID. */ + struct XTOpenTable *st_is_update; /* TRUE if this is an UPDATE statement. {UPDATE-STACK} */ XTRowLockListRec st_lock_list; /* The thread row lock list (drop locks on transaction end). */ XTStatisticsRec st_statistics; /* Accumulated statistics for this thread. */ @@ -536,7 +536,10 @@ extern struct XTThread **xt_thr_array; * Function prototypes */ -extern "C" void *thr_main_pbxt(void *data); +/* OpenSolaris has thr_main in /usr/include/thread.h (name conflict) + * Thanks for the tip Monty! + */ +extern "C" void *xt_thread_main(void *data); void xt_get_now(char *buffer, size_t len); xtBool xt_init_logging(void); diff --git a/storage/pbxt/src/trace_xt.cc b/storage/pbxt/src/trace_xt.cc index fed4eb59036..709ff71addc 100644 --- a/storage/pbxt/src/trace_xt.cc +++ b/storage/pbxt/src/trace_xt.cc @@ -36,6 +36,7 @@ #ifdef DEBUG //#define PRINT_TRACE //#define RESET_AFTER_DUMP +//#define DUMP_TO_STDOUT #endif static xtBool trace_initialized = FALSE; @@ -109,10 +110,10 @@ xtPublic void xt_print_trace(void) xt_lock_mutex_ns(&trace_mutex); if (trace_log_end > trace_log_offset+1) { trace_log_buffer[trace_log_end] = 0; - fprintf(stderr, "%s", trace_log_buffer + trace_log_offset + 1); + printf("%s", trace_log_buffer + trace_log_offset + 1); } trace_log_buffer[trace_log_offset] = 0; - fprintf(stderr, "%s", trace_log_buffer); + printf("%s", trace_log_buffer); trace_log_offset = 0; trace_log_end = 0; xt_unlock_mutex_ns(&trace_mutex); @@ -121,9 +122,18 @@ xtPublic void xt_print_trace(void) xtPublic void xt_dump_trace(void) { - FILE *fp; - if (trace_log_offset) { +#ifdef DUMP_TO_STDOUT + if (trace_log_end > trace_log_offset+1) { + trace_log_buffer[trace_log_end] = 0; + printf("%s", trace_log_buffer + trace_log_offset + 1); + } + trace_log_buffer[trace_log_offset] = 0; + printf("%s", trace_log_buffer); + printf("\n"); +#else + FILE *fp; + fp = fopen("pbxt.log", "w"); xt_lock_mutex_ns(&trace_mutex); @@ -136,6 +146,7 @@ xtPublic void xt_dump_trace(void) fprintf(fp, "%s", trace_log_buffer); fclose(fp); } +#endif #ifdef RESET_AFTER_DUMP trace_log_offset = 0; @@ -379,9 +390,9 @@ xtPublic void xt_dump_conn_tracking(void) ptr = conn_info; for (int i=0; i<XT_TRACK_MAX_CONNS; i++) { if (ptr->ci_curr_xact_id || ptr->ci_prev_xact_id) { - fprintf(stderr, "%3d curr=%d prev=%d prev-time=%ld\n", (int) ptr->cu_t_id, (int) ptr->ci_curr_xact_id, (int) ptr->ci_prev_xact_id, (long) ptr->ci_prev_xact_time); + printf("%3d curr=%d prev=%d prev-time=%ld\n", (int) ptr->cu_t_id, (int) ptr->ci_curr_xact_id, (int) ptr->ci_prev_xact_id, (long) ptr->ci_prev_xact_time); if (i+1<XT_TRACK_MAX_CONNS) { - fprintf(stderr, " diff=%d\n", (int) (ptr+1)->ci_curr_xact_id - (int) ptr->ci_curr_xact_id); + printf(" diff=%d\n", (int) (ptr+1)->ci_curr_xact_id - (int) ptr->ci_curr_xact_id); } } ptr++; diff --git a/storage/pbxt/src/trace_xt.h b/storage/pbxt/src/trace_xt.h index 9b00a5a05c7..34459a94dca 100644 --- a/storage/pbxt/src/trace_xt.h +++ b/storage/pbxt/src/trace_xt.h @@ -51,7 +51,9 @@ void xt_ftracef(char *fmt, ...); * CONNECTION TRACKING */ +#ifdef DEBUG #define XT_TRACK_CONNECTIONS +#endif #ifdef XT_TRACK_CONNECTIONS #define XT_TRACK_MAX_CONNS 500 diff --git a/storage/pbxt/src/xaction_xt.cc b/storage/pbxt/src/xaction_xt.cc index 86be55a6bcf..7281eafd8db 100644 --- a/storage/pbxt/src/xaction_xt.cc +++ b/storage/pbxt/src/xaction_xt.cc @@ -1326,7 +1326,7 @@ static xtBool xn_end_xact(XTThreadPtr thread, u_int status) } /* Write and flush the transaction log: */ - if (!xt_xlog_log_data(thread, sizeof(XTXactEndEntryDRec), (XTXactLogBufferDPtr) &entry, TRUE)) { + if (!xt_xlog_log_data(thread, sizeof(XTXactEndEntryDRec), (XTXactLogBufferDPtr) &entry, xt_db_flush_log_at_trx_commit)) { ok = FALSE; status = XT_LOG_ENT_ABORT; /* Make sure this is done, if we failed to log @@ -1440,16 +1440,23 @@ static xtBool xn_end_xact(XTThreadPtr thread, u_int status) /* Don't get too far ahead of the sweeper! */ if (writer) { #ifdef XT_WAIT_FOR_CLEANUP - xtXactID wait_xn_id; - - /* This is the transaction that was committed 3 transactions ago: */ - wait_xn_id = thread->st_prev_xact[thread->st_last_xact]; - thread->st_prev_xact[thread->st_last_xact] = xn_id; - /* This works because XT_MAX_XACT_BEHIND == 2! */ - ASSERT_NS((thread->st_last_xact + 1) % XT_MAX_XACT_BEHIND == (thread->st_last_xact ^ 1)); - thread->st_last_xact ^= 1; - while (xt_xn_is_before(db->db_xn_to_clean_id, wait_xn_id) && (db->db_sw_faster & XT_SW_TOO_FAR_BEHIND)) { - xt_critical_wait(); + if (db->db_sw_faster & XT_SW_TOO_FAR_BEHIND) { + /* Set a maximum wait time (1/100s) */ + xtWord8 then = xt_trace_clock() + (xtWord8) 100000; + xtXactID wait_xn_id; + + /* This is the transaction that was committed 3 transactions ago: */ + wait_xn_id = thread->st_prev_xact[thread->st_last_xact]; + thread->st_prev_xact[thread->st_last_xact] = xn_id; + /* This works because XT_MAX_XACT_BEHIND == 2! */ + ASSERT_NS((thread->st_last_xact + 1) % XT_MAX_XACT_BEHIND == (thread->st_last_xact ^ 1)); + thread->st_last_xact ^= 1; + + while (xt_xn_is_before(db->db_xn_to_clean_id, wait_xn_id) && (db->db_sw_faster & XT_SW_TOO_FAR_BEHIND)) { + if (xt_trace_clock() >= then) + break; + xt_critical_wait(); + } } #else if ((db->db_sw_faster & XT_SW_TOO_FAR_BEHIND) != 0) { @@ -1486,7 +1493,7 @@ xtPublic xtBool xt_xn_log_tab_id(XTThreadPtr self, xtTableID tab_id) entry.xt_status_1 = XT_LOG_ENT_NEW_TAB; entry.xt_checksum_1 = XT_CHECKSUM_1(tab_id); XT_SET_DISK_4(entry.xt_tab_id_4, tab_id); - return xt_xlog_log_data(self, sizeof(XTXactNewTabEntryDRec), (XTXactLogBufferDPtr) &entry, TRUE); + return xt_xlog_log_data(self, sizeof(XTXactNewTabEntryDRec), (XTXactLogBufferDPtr) &entry, XT_XLOG_WRITE_AND_FLUSH); } xtPublic int xt_xn_status(XTOpenTablePtr ot, xtXactID xn_id, xtRecordID XT_UNUSED(rec_id)) @@ -2266,6 +2273,7 @@ static xtBool xn_sw_cleanup_variation(XTThreadPtr self, XNSweeperStatePtr ss, XT xt_log_and_clear_exception(self); break; } + prev_rec_id = next_rec_id; next_rec_id = XT_GET_DISK_4(prev_rec_head.tr_prev_rec_id_4); } @@ -2461,7 +2469,7 @@ static xtBool xn_sw_cleanup_xact(XTThreadPtr self, XNSweeperStatePtr ss, XTXactD cu.xc_checksum_1 = XT_CHECKSUM_1(XT_CHECKSUM4_XACT(xact->xd_start_xn_id)); XT_SET_DISK_4(cu.xc_xact_id_4, xact->xd_start_xn_id); - if (!xt_xlog_log_data(self, sizeof(XTXactCleanupEntryDRec), (XTXactLogBufferDPtr) &cu, FALSE)) + if (!xt_xlog_log_data(self, sizeof(XTXactCleanupEntryDRec), (XTXactLogBufferDPtr) &cu, XT_XLOG_NO_WRITE_NO_FLUSH)) return FAILED; ss->ss_flush_pending = TRUE; @@ -2656,7 +2664,9 @@ static void xn_sw_main(XTThreadPtr self) * we flush the log. */ if (now >= idle_start + 2) { - if (!xt_xlog_flush_log(db, self)) + /* Don't do this if flusher is active! */ + if (!db->db_fl_thread && + !xt_xlog_flush_log(db, self)) xt_throw(self); ss->ss_flush_pending = FALSE; } diff --git a/storage/pbxt/src/xaction_xt.h b/storage/pbxt/src/xaction_xt.h index ac742088ebb..e679a0f38f0 100644 --- a/storage/pbxt/src/xaction_xt.h +++ b/storage/pbxt/src/xaction_xt.h @@ -153,14 +153,14 @@ typedef struct XTXactData { #define XT_XACT_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, i) #define XT_XACT_FREE_LOCK(s, i) xt_spinxslock_free(s, i) #define XT_XACT_READ_LOCK(i, s) xt_spinxslock_slock(i) -#define XT_XACT_WRITE_LOCK(i, s) xt_spinxslock_xlock(i, (s)->t_id) +#define XT_XACT_WRITE_LOCK(i, s) xt_spinxslock_xlock(i, FALSE, (s)->t_id) #define XT_XACT_UNLOCK(i, s, b) xt_spinxslock_unlock(i, b) #else #define XT_XACT_LOCK_TYPE XTSkewRWLockRec #define XT_XACT_INIT_LOCK(s, i) xt_skewrwlock_init_with_autoname(s, i) #define XT_XACT_FREE_LOCK(s, i) xt_skewrwlock_free(s, i) #define XT_XACT_READ_LOCK(i, s) xt_skewrwlock_slock(i) -#define XT_XACT_WRITE_LOCK(i, s) xt_skewrwlock_xlock(i, (s)->t_id) +#define XT_XACT_WRITE_LOCK(i, s) xt_skewrwlock_xlock(i, FALSE, (s)->t_id) #define XT_XACT_UNLOCK(i, s, b) xt_skewrwlock_unlock(i, b) #endif diff --git a/storage/pbxt/src/xactlog_xt.cc b/storage/pbxt/src/xactlog_xt.cc index f50dbc802bb..addc14ff5d8 100644 --- a/storage/pbxt/src/xactlog_xt.cc +++ b/storage/pbxt/src/xactlog_xt.cc @@ -719,14 +719,14 @@ void XTDatabaseLog::xlog_exit(XTThreadPtr self) } } -#define WR_NO_SPACE 1 -#define WR_FLUSH 2 +#define WR_NO_SPACE 1 /* Write because there is no space, or some other reason */ +#define WR_FLUSH 2 /* Normal commit, write and flush */ xtBool XTDatabaseLog::xlog_flush(XTThreadPtr thread) { if (!xlog_flush_pending()) return OK; - return xlog_append(thread, 0, NULL, 0, NULL, TRUE, NULL, NULL); + return xlog_append(thread, 0, NULL, 0, NULL, XT_XLOG_WRITE_AND_FLUSH, NULL, NULL); } xtBool XTDatabaseLog::xlog_flush_pending() @@ -754,7 +754,7 @@ xtBool XTDatabaseLog::xlog_flush_pending() * This function returns the log ID and offset of * the data write position. */ -xtBool XTDatabaseLog::xlog_append(XTThreadPtr thread, size_t size1, xtWord1 *data1, size_t size2, xtWord1 *data2, xtBool commit, xtLogID *log_id, xtLogOffset *log_offset) +xtBool XTDatabaseLog::xlog_append(XTThreadPtr thread, size_t size1, xtWord1 *data1, size_t size2, xtWord1 *data2, int flush_log_at_trx_commit, xtLogID *log_id, xtLogOffset *log_offset) { int write_reason = 0; xtLogID req_flush_log_id; @@ -763,19 +763,20 @@ xtBool XTDatabaseLog::xlog_append(XTThreadPtr thread, size_t size1, xtWord1 *dat xtWord8 flush_time; xtWord2 sum; + /* The first size value must be set, of the second is set! */ + ASSERT_NS(size1 || !size2); + if (!size1) { /* Just flush the buffer... */ xt_lck_slock(&xl_buffer_lock); - write_reason = WR_FLUSH; + write_reason = flush_log_at_trx_commit == XT_XLOG_WRITE_AND_FLUSH ? WR_FLUSH : WR_NO_SPACE; req_flush_log_id = xl_append_log_id; req_flush_log_offset = xl_append_log_offset + xl_append_buf_pos; xt_spinlock_unlock(&xl_buffer_lock); goto write_log_to_file; } - else { - req_flush_log_id = 0; - req_flush_log_offset = 0; - } + req_flush_log_id = 0; + req_flush_log_offset = 0; /* * This is a dirty read, which will send us to the @@ -866,11 +867,17 @@ xtBool XTDatabaseLog::xlog_append(XTThreadPtr thread, size_t size1, xtWord1 *dat return OK; } } - else { + else if (size1) { /* It may be that there is now space in the append buffer: */ if (xl_append_buf_pos + size1 + size2 <= xl_size_of_buffers) goto copy_to_log_buffer; } + else { + /* We are just writing the buffer! */ + ASSERT_NS(write_reason == WR_NO_SPACE); + if (xt_comp_log_pos(req_flush_log_id, req_flush_log_offset, xl_write_log_id, xl_write_log_offset + (xl_write_done ? xl_write_buf_pos : xl_write_buf_pos_start)) <= 0) + return OK; + } if (xt_trace_clock() >= then) { xt_lock_mutex_ns(&xl_write_lock); @@ -922,12 +929,18 @@ xtBool XTDatabaseLog::xlog_append(XTThreadPtr thread, size_t size1, xtWord1 *dat ASSERT_NS(xt_comp_log_pos(xl_write_log_id, xl_write_log_offset, xl_append_log_id, xl_append_log_offset) <= 0); return OK; } - goto write_log_to_file; } - - /* It may be that there is now space in the append buffer: */ - if (xl_append_buf_pos + size1 + size2 <= xl_size_of_buffers) - goto copy_to_log_buffer; + else if (size1) { + /* It may be that there is now space in the append buffer: */ + if (xl_append_buf_pos + size1 + size2 <= xl_size_of_buffers) + goto copy_to_log_buffer; + } + else { + /* We are just writing the buffer! */ + ASSERT_NS(write_reason == WR_NO_SPACE); + if (xt_comp_log_pos(req_flush_log_id, req_flush_log_offset, xl_write_log_id, xl_write_log_offset + (xl_write_done ? xl_write_buf_pos : xl_write_buf_pos_start)) <= 0) + return OK; + } goto write_log_to_file; } @@ -952,7 +965,7 @@ xtBool XTDatabaseLog::xlog_append(XTThreadPtr thread, size_t size1, xtWord1 *dat return OK; } /* Not flushed, but what about written? */ - if (xt_comp_log_pos(req_flush_log_id, req_flush_log_offset, xl_write_log_id, xl_write_log_offset + (xl_write_done ? xl_write_buf_pos : 0)) <= 0) { + if (xt_comp_log_pos(req_flush_log_id, req_flush_log_offset, xl_write_log_id, xl_write_log_offset + (xl_write_done ? xl_write_buf_pos : xl_write_buf_pos_start)) <= 0) { /* The write position is after or equal to the required flush * position. This means that all we have to do is flush * to satisfy the writers condition. @@ -960,7 +973,7 @@ xtBool XTDatabaseLog::xlog_append(XTThreadPtr thread, size_t size1, xtWord1 *dat xtBool ok = TRUE; if (xl_log_id != xl_write_log_id) - ok = xlog_open_log(xl_write_log_id, xl_write_log_offset + (xl_write_done ? xl_write_buf_pos : 0), thread); + ok = xlog_open_log(xl_write_log_id, xl_write_log_offset + (xl_write_done ? xl_write_buf_pos : xl_write_buf_pos_start), thread); if (ok) { if (xl_db->db_co_busy) { @@ -979,7 +992,7 @@ xtBool XTDatabaseLog::xlog_append(XTThreadPtr thread, size_t size1, xtWord1 *dat xt_lock_mutex_ns(&xl_db->db_wr_lock); xl_flush_log_id = xl_write_log_id; - xl_flush_log_offset = xl_write_log_offset + (xl_write_done ? xl_write_buf_pos : 0); + xl_flush_log_offset = xl_write_log_offset + (xl_write_done ? xl_write_buf_pos : xl_write_buf_pos_start); /* * We have written data to the log, wake the writer to commit * the data to the database. @@ -1000,8 +1013,11 @@ xtBool XTDatabaseLog::xlog_append(XTThreadPtr thread, size_t size1, xtWord1 *dat return ok; } } - else { - /* If there is space in the buffer, then we can go on + else if (size1) { + /* If the amounf of data to be written is 0, then we are just required + * to write the transaction buffer. + * + * If there is space in the buffer, then we can go on * to copy our data into the buffer: */ if (xl_append_buf_pos + size1 + size2 <= xl_size_of_buffers) { @@ -1016,6 +1032,21 @@ xtBool XTDatabaseLog::xlog_append(XTThreadPtr thread, size_t size1, xtWord1 *dat goto copy_to_log_buffer; } } + else { + /* We are just writing the buffer! */ + ASSERT_NS(write_reason == WR_NO_SPACE); + if (xt_comp_log_pos(req_flush_log_id, req_flush_log_offset, xl_write_log_id, xl_write_log_offset + (xl_write_done ? xl_write_buf_pos : xl_write_buf_pos_start)) <= 0) { +#ifdef XT_XLOG_WAIT_SPINS + xt_writing = 0; + if (xt_waiting) + xt_cond_wakeall(&xl_write_cond); +#else + xt_writing = FALSE; + xt_cond_wakeall(&xl_write_cond); +#endif + return OK; + } + } rewrite: /* If the current write buffer has been written, then @@ -1109,7 +1140,8 @@ xtBool XTDatabaseLog::xlog_append(XTThreadPtr thread, size_t size1, xtWord1 *dat part_size = 512 - part_size; xl_write_buffer[xl_write_buf_pos] = XT_LOG_ENT_END_OF_LOG; #ifdef HAVE_valgrind - memset(xl_write_buffer + xl_write_buf_pos + 1, 0x66, part_size); + if (part_size > 1) + memset(xl_write_buffer + xl_write_buf_pos + 1, 0x66, part_size - 1); #endif if (!xt_pwrite_file(xl_log_file, xl_write_log_offset, xl_write_buf_pos+part_size, xl_write_buffer, &thread->st_statistics.st_xlog, thread)) goto write_failed; @@ -1197,9 +1229,13 @@ xtBool XTDatabaseLog::xlog_append(XTThreadPtr thread, size_t size1, xtWord1 *dat xt_writing = FALSE; xt_cond_wakeall(&xl_write_cond); #endif + + if (size1 == 0) + return OK; } copy_to_log_buffer: + ASSERT_NS(size1); xt_spinlock_lock(&xl_buffer_lock); /* Now we have to check again. The check above was a dirty read! */ @@ -1291,11 +1327,14 @@ xtBool XTDatabaseLog::xlog_append(XTThreadPtr thread, size_t size1, xtWord1 *dat if (log_offset) *log_offset = xl_append_log_offset + xl_append_buf_pos; xl_append_buf_pos += size1 + size2; - if (commit) { - write_reason = WR_FLUSH; + if (flush_log_at_trx_commit != XT_XLOG_NO_WRITE_NO_FLUSH) { + write_reason = flush_log_at_trx_commit == XT_XLOG_WRITE_AND_FLUSH ? WR_FLUSH : WR_NO_SPACE; req_flush_log_id = xl_append_log_id; req_flush_log_offset = xl_append_log_offset + xl_append_buf_pos; xt_spinlock_unlock(&xl_buffer_lock); + /* We have written the data already! */ + size1 = 0; + size2 = 0; goto write_log_to_file; } @@ -1485,9 +1524,9 @@ xtPublic xtBool xt_xlog_flush_log(struct XTDatabase *db, XTThreadPtr thread) return db->db_xlog.xlog_flush(thread); } -xtPublic xtBool xt_xlog_log_data(XTThreadPtr thread, size_t size, XTXactLogBufferDPtr log_entry, xtBool commit) +xtPublic xtBool xt_xlog_log_data(XTThreadPtr thread, size_t size, XTXactLogBufferDPtr log_entry, int flush_log_at_trx_commit) { - return thread->st_database->db_xlog.xlog_append(thread, size, (xtWord1 *) log_entry, 0, NULL, commit, NULL, NULL); + return thread->st_database->db_xlog.xlog_append(thread, size, (xtWord1 *) log_entry, 0, NULL, flush_log_at_trx_commit, NULL, NULL); } /* Allocate a record from the free list. */ @@ -1498,7 +1537,7 @@ xtPublic xtBool xt_xlog_modify_table(xtTableID tab_id, u_int status, xtOpSeqNo o xtWord4 sum = 0; int check_size = 1; XTXactDataPtr xact = NULL; - xtBool commit = FALSE; + int flush_log_at_trx_commit = XT_XLOG_NO_WRITE_NO_FLUSH; switch (status) { case XT_LOG_ENT_REC_MODIFIED: @@ -1613,7 +1652,7 @@ xtPublic xtBool xt_xlog_modify_table(xtTableID tab_id, u_int status, xtOpSeqNo o XT_SET_DISK_4(log_entry.xp.xp_xact_id_4, op_seq); log_entry.xp.xp_xa_len_1 = (xtWord1) size; len = offsetof(XTXactPrepareEntryDRec, xp_xa_data); - commit = TRUE; + flush_log_at_trx_commit = xt_db_flush_log_at_trx_commit; break; default: ASSERT_NS(FALSE); @@ -1652,9 +1691,9 @@ xtPublic xtBool xt_xlog_modify_table(xtTableID tab_id, u_int status, xtOpSeqNo o xt_print_log_record(0, 0, &log_entry); #endif if (xact) - return thread->st_database->db_xlog.xlog_append(thread, len, (xtWord1 *) &log_entry, size, data, commit, &xact->xd_begin_log, &xact->xd_begin_offset); + return thread->st_database->db_xlog.xlog_append(thread, len, (xtWord1 *) &log_entry, size, data, flush_log_at_trx_commit, &xact->xd_begin_log, &xact->xd_begin_offset); - return thread->st_database->db_xlog.xlog_append(thread, len, (xtWord1 *) &log_entry, size, data, commit, NULL, NULL); + return thread->st_database->db_xlog.xlog_append(thread, len, (xtWord1 *) &log_entry, size, data, flush_log_at_trx_commit, NULL, NULL); } /* diff --git a/storage/pbxt/src/xactlog_xt.h b/storage/pbxt/src/xactlog_xt.h index db1cf944c1b..f72b810d66b 100644 --- a/storage/pbxt/src/xactlog_xt.h +++ b/storage/pbxt/src/xactlog_xt.h @@ -75,6 +75,10 @@ struct XTDatabase; #define XT_DELETE_LOGS 1 #define XT_KEEP_LOGS 2 +#define XT_XLOG_NO_WRITE_NO_FLUSH 0 +#define XT_XLOG_WRITE_AND_FLUSH 1 +#define XT_XLOG_WRITE_AND_NO_FLUSH 2 + /* LOG CACHE ---------------------------------------------------- */ typedef struct XTXLogBlock { @@ -443,7 +447,7 @@ typedef struct XTDatabaseLog { void xlog_name(size_t size, char *path, xtLogID log_id); int xlog_delete_log(xtLogID del_log_id, struct XTThread *thread); - xtBool xlog_append(struct XTThread *thread, size_t size1, xtWord1 *data1, size_t size2, xtWord1 *data2, xtBool commit, xtLogID *log_id, xtLogOffset *log_offset); + xtBool xlog_append(struct XTThread *thread, size_t size1, xtWord1 *data1, size_t size2, xtWord1 *data2, int flush_log_at_trx_commit, xtLogID *log_id, xtLogOffset *log_offset); xtBool xlog_flush(struct XTThread *thread); xtBool xlog_flush_pending(); @@ -464,7 +468,7 @@ private: } XTDatabaseLogRec, *XTDatabaseLogPtr; xtBool xt_xlog_flush_log(struct XTDatabase *db, struct XTThread *thread); -xtBool xt_xlog_log_data(struct XTThread *thread, size_t len, XTXactLogBufferDPtr log_entry, xtBool commit); +xtBool xt_xlog_log_data(struct XTThread *thread, size_t len, XTXactLogBufferDPtr log_entry, int flush_log_at_trx_commit); xtBool xt_xlog_modify_table(xtTableID tab_id, u_int status, xtOpSeqNo op_seq, xtRecordID free_list, xtRecordID address, size_t size, xtWord1 *data, struct XTThread *thread); void xt_xlog_init(struct XTThread *self, size_t cache_size); diff --git a/storage/pbxt/src/xt_config.h b/storage/pbxt/src/xt_config.h index f3749071087..cb3009ecb79 100644 --- a/storage/pbxt/src/xt_config.h +++ b/storage/pbxt/src/xt_config.h @@ -128,4 +128,8 @@ const int max_connections = 500; #endif #endif +#if defined(DBUG_ON) && !defined(DBUG_OFF) && !defined(DEBUG) +#define DEBUG +#endif // DBUG_ON + #endif diff --git a/storage/pbxt/src/xt_defs.h b/storage/pbxt/src/xt_defs.h index 0e1d11d52bd..98ebe0957a5 100644 --- a/storage/pbxt/src/xt_defs.h +++ b/storage/pbxt/src/xt_defs.h @@ -221,7 +221,7 @@ typedef struct XTPathStr { */ #ifdef DEBUG -//#define XT_USE_GLOBAL_DEBUG_SIZES +#define XT_USE_GLOBAL_DEBUG_SIZES #endif /* @@ -392,6 +392,11 @@ typedef struct XTPathStr { //#define XT_NO_ATOMICS #endif +/* When pbxt_flush_log_at_trx_commit != 1, the transaction log is flushed + * at regular intervals. Set the interval here. + */ +#define XT_XLOG_FLUSH_FREQ 1000 + /* ---------------------------------------------------------------------- * GLOBAL CONSTANTS */ @@ -457,21 +462,24 @@ typedef struct XTPathStr { #ifdef XT_USE_GLOBAL_DEBUG_SIZES //#undef XT_ROW_RWLOCKS -//#define XT_ROW_RWLOCKS 2 +//#define XT_ROW_RWLOCKS 2 //#undef XT_TAB_MIN_VAR_REC_LENGTH -//#define XT_TAB_MIN_VAR_REC_LENGTH 20 +//#define XT_TAB_MIN_VAR_REC_LENGTH 20 //#undef XT_ROW_LOCK_COUNT -//#define XT_ROW_LOCK_COUNT (XT_ROW_RWLOCKS * 2) +//#define XT_ROW_LOCK_COUNT (XT_ROW_RWLOCKS * 2) //#undef XT_INDEX_PAGE_SHIFTS -//#define XT_INDEX_PAGE_SHIFTS 8 // 256 +//#define XT_INDEX_PAGE_SHIFTS 8 // 256 //#undef XT_BLOCK_SIZE_FOR_DIRECT_IO -//#define XT_BLOCK_SIZE_FOR_DIRECT_IO 256 +//#define XT_BLOCK_SIZE_FOR_DIRECT_IO 256 //#undef XT_INDEX_WRITE_BUFFER_SIZE -//#define XT_INDEX_WRITE_BUFFER_SIZE (40 * 1024) +//#define XT_INDEX_WRITE_BUFFER_SIZE (40 * 1024) + +//#undef XT_XLOG_FLUSH_FREQ +//#define XT_XLOG_FLUSH_FREQ (30 * 1000) #endif diff --git a/storage/xtradb/btr/btr0btr.c b/storage/xtradb/btr/btr0btr.c index 086b3a0a599..520c18553ea 100644 --- a/storage/xtradb/btr/btr0btr.c +++ b/storage/xtradb/btr/btr0btr.c @@ -137,6 +137,12 @@ btr_root_block_get( root_page_no = dict_index_get_page(index); block = btr_block_get(space, zip_size, root_page_no, RW_X_LATCH, mtr); + + if (srv_pass_corrupt_table && !block) { + return(0); + } + ut_a(block); + ut_a((ibool)!!page_is_comp(buf_block_get_frame(block)) == dict_table_is_comp(index->table)); #ifdef UNIV_BTR_DEBUG @@ -422,6 +428,12 @@ btr_get_size( root = btr_root_get(index, &mtr); + if (srv_pass_corrupt_table && !root) { + mtr_commit(&mtr); + return(0); + } + ut_a(root); + if (flag == BTR_N_LEAF_PAGES) { seg_header = root + PAGE_HEADER + PAGE_BTR_SEG_LEAF; @@ -862,6 +874,13 @@ leaf_loop: mtr_start(&mtr); root = btr_page_get(space, zip_size, root_page_no, RW_X_LATCH, &mtr); + + if (srv_pass_corrupt_table && !root) { + mtr_commit(&mtr); + return; + } + ut_a(root); + #ifdef UNIV_BTR_DEBUG ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF + root, space)); @@ -884,6 +903,12 @@ top_loop: mtr_start(&mtr); root = btr_page_get(space, zip_size, root_page_no, RW_X_LATCH, &mtr); + + if (srv_pass_corrupt_table && !root) { + mtr_commit(&mtr); + return; + } + ut_a(root); #ifdef UNIV_BTR_DEBUG ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP + root, space)); @@ -917,6 +942,11 @@ btr_free_root( block = btr_block_get(space, zip_size, root_page_no, RW_X_LATCH, mtr); + if (srv_pass_corrupt_table && !block) { + return; + } + ut_a(block); + btr_search_drop_page_hash_index(block); header = buf_block_get_frame(block) + PAGE_HEADER + PAGE_BTR_SEG_TOP; diff --git a/storage/xtradb/btr/btr0cur.c b/storage/xtradb/btr/btr0cur.c index ce07b99c611..06b54bc7120 100644 --- a/storage/xtradb/btr/btr0cur.c +++ b/storage/xtradb/btr/btr0cur.c @@ -227,6 +227,11 @@ btr_cur_latch_leaves( case BTR_MODIFY_LEAF: mode = latch_mode == BTR_SEARCH_LEAF ? RW_S_LATCH : RW_X_LATCH; get_block = btr_block_get(space, zip_size, page_no, mode, mtr); + + if (srv_pass_corrupt_table && !get_block) { + return; + } + ut_a(get_block); #ifdef UNIV_BTR_DEBUG ut_a(page_is_comp(get_block->frame) == page_is_comp(page)); #endif /* UNIV_BTR_DEBUG */ @@ -240,6 +245,11 @@ btr_cur_latch_leaves( get_block = btr_block_get(space, zip_size, left_page_no, RW_X_LATCH, mtr); + + if (srv_pass_corrupt_table && !get_block) { + return; + } + ut_a(get_block); #ifdef UNIV_BTR_DEBUG ut_a(page_is_comp(get_block->frame) == page_is_comp(page)); @@ -251,6 +261,11 @@ btr_cur_latch_leaves( get_block = btr_block_get(space, zip_size, page_no, RW_X_LATCH, mtr); + + if (srv_pass_corrupt_table && !get_block) { + return; + } + ut_a(get_block); #ifdef UNIV_BTR_DEBUG ut_a(page_is_comp(get_block->frame) == page_is_comp(page)); #endif /* UNIV_BTR_DEBUG */ @@ -262,6 +277,11 @@ btr_cur_latch_leaves( get_block = btr_block_get(space, zip_size, right_page_no, RW_X_LATCH, mtr); + + if (srv_pass_corrupt_table && !get_block) { + return; + } + ut_a(get_block); #ifdef UNIV_BTR_DEBUG ut_a(page_is_comp(get_block->frame) == page_is_comp(page)); @@ -283,6 +303,11 @@ btr_cur_latch_leaves( get_block = btr_block_get(space, zip_size, left_page_no, mode, mtr); cursor->left_block = get_block; + + if (srv_pass_corrupt_table && !get_block) { + return; + } + ut_a(get_block); #ifdef UNIV_BTR_DEBUG ut_a(page_is_comp(get_block->frame) == page_is_comp(page)); @@ -293,6 +318,11 @@ btr_cur_latch_leaves( } get_block = btr_block_get(space, zip_size, page_no, mode, mtr); + + if (srv_pass_corrupt_table && !get_block) { + return; + } + ut_a(get_block); #ifdef UNIV_BTR_DEBUG ut_a(page_is_comp(get_block->frame) == page_is_comp(page)); #endif /* UNIV_BTR_DEBUG */ @@ -522,6 +552,16 @@ retry_page_get: rw_latch, guess, buf_mode, __FILE__, __LINE__, mtr); if (block == NULL) { + if (srv_pass_corrupt_table && buf_mode != BUF_GET_IF_IN_POOL) { + page_cursor->block = 0; + page_cursor->rec = 0; + if (estimate) { + cursor->path_arr->nth_rec = ULINT_UNDEFINED; + } + break; + } + ut_a(buf_mode == BUF_GET_IF_IN_POOL); + /* This must be a search to perform an insert; try insert to the insert buffer */ @@ -549,6 +589,16 @@ retry_page_get: page = buf_block_get_frame(block); + if (srv_pass_corrupt_table && !page) { + page_cursor->block = 0; + page_cursor->rec = 0; + if (estimate) { + cursor->path_arr->nth_rec = ULINT_UNDEFINED; + } + break; + } + ut_a(page); + block->check_index_page_at_flush = TRUE; if (rw_latch != RW_NO_LATCH) { @@ -730,6 +780,17 @@ btr_cur_open_at_index_side( RW_NO_LATCH, NULL, BUF_GET, __FILE__, __LINE__, mtr); page = buf_block_get_frame(block); + + if (srv_pass_corrupt_table && !page) { + page_cursor->block = 0; + page_cursor->rec = 0; + if (estimate) { + cursor->path_arr->nth_rec = ULINT_UNDEFINED; + } + break; + } + ut_a(page); + ut_ad(0 == ut_dulint_cmp(index->id, btr_page_get_index_id(page))); @@ -849,6 +910,14 @@ btr_cur_open_at_rnd_pos( RW_NO_LATCH, NULL, BUF_GET, __FILE__, __LINE__, mtr); page = buf_block_get_frame(block); + + if (srv_pass_corrupt_table && !page) { + page_cursor->block = 0; + page_cursor->rec = 0; + break; + } + ut_a(page); + ut_ad(0 == ut_dulint_cmp(index->id, btr_page_get_index_id(page))); @@ -886,6 +955,108 @@ btr_cur_open_at_rnd_pos( } } +/**********************************************************************//** +Positions a cursor at a randomly chosen position within a B-tree +after the given path +@return TRUE if the position is at the first page, and cursor must point + the first record for used by the caller.*/ +UNIV_INTERN +ibool +btr_cur_open_at_rnd_pos_after_path( +/*====================*/ + dict_index_t* index, /*!< in: index */ + ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */ + btr_path_t* first_rec_path, + btr_cur_t* cursor, /*!< in/out: B-tree cursor */ + mtr_t* mtr) /*!< in: mtr */ +{ + page_cur_t* page_cursor; + btr_path_t* slot; + ibool is_first_rec = TRUE; + ulint page_no; + ulint space; + ulint zip_size; + ulint height; + rec_t* node_ptr; + mem_heap_t* heap = NULL; + ulint offsets_[REC_OFFS_NORMAL_SIZE]; + ulint* offsets = offsets_; + rec_offs_init(offsets_); + + if (latch_mode == BTR_MODIFY_TREE) { + mtr_x_lock(dict_index_get_lock(index), mtr); + } else { + mtr_s_lock(dict_index_get_lock(index), mtr); + } + + page_cursor = btr_cur_get_page_cur(cursor); + cursor->index = index; + + space = dict_index_get_space(index); + zip_size = dict_table_zip_size(index->table); + page_no = dict_index_get_page(index); + + height = ULINT_UNDEFINED; + slot = first_rec_path; + + for (;;) { + buf_block_t* block; + page_t* page; + + block = buf_page_get_gen(space, zip_size, page_no, + RW_NO_LATCH, NULL, BUF_GET, + __FILE__, __LINE__, mtr); + page = buf_block_get_frame(block); + ut_ad(0 == ut_dulint_cmp(index->id, + btr_page_get_index_id(page))); + + if (height == ULINT_UNDEFINED) { + /* We are in the root node */ + + height = btr_page_get_level(page, mtr); + } + + if (height == 0) { + btr_cur_latch_leaves(page, space, zip_size, page_no, + latch_mode, cursor, mtr); + } + + if (is_first_rec && slot->nth_rec != ULINT_UNDEFINED) { + if (height == 0) { + /* must open the first rec */ + page_cur_open_on_nth_user_rec(block, page_cursor, slot->nth_rec); + } else { + is_first_rec = page_cur_open_on_rnd_user_rec_after_nth(block, + page_cursor, slot->nth_rec); + } + } else { + is_first_rec = FALSE; + page_cur_open_on_rnd_user_rec(block, page_cursor); + } + + if (height == 0) { + break; + } + + ut_ad(height > 0); + + height--; + slot++; + + node_ptr = page_cur_get_rec(page_cursor); + offsets = rec_get_offsets(node_ptr, cursor->index, offsets, + ULINT_UNDEFINED, &heap); + /* Go to the child node */ + page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets); + } + + if (UNIV_LIKELY_NULL(heap)) { + mem_heap_free(heap); + } + + return (is_first_rec); +} + /*==================== B-TREE INSERT =========================*/ /*************************************************************//** @@ -1064,6 +1235,12 @@ btr_cur_optimistic_insert( *big_rec = NULL; block = btr_cur_get_block(cursor); + + if (srv_pass_corrupt_table && !block) { + return(DB_CORRUPTION); + } + ut_a(block); + page = buf_block_get_frame(block); index = cursor->index; zip_size = buf_block_get_zip_size(block); @@ -2810,6 +2987,11 @@ btr_cur_optimistic_delete( block = btr_cur_get_block(cursor); + if (srv_pass_corrupt_table && !block) { + return(DB_CORRUPTION); + } + ut_a(block); + ut_ad(page_is_leaf(buf_block_get_frame(block))); rec = btr_cur_get_rec(cursor); @@ -3216,6 +3398,154 @@ btr_estimate_n_rows_in_range( } /*******************************************************************//** +Estimates the number of pages which have not null value of the key of n_cols. +@return estimated number of pages */ +UNIV_INTERN +ulint +btr_estimate_n_pages_not_null( +/*=========================*/ + dict_index_t* index, /*!< in: index */ + ulint n_cols, /*!< in: The cols should be not null */ + btr_path_t* path1) /*!< in: path1[BTR_PATH_ARRAY_N_SLOTS] */ +{ + dtuple_t* tuple1; + btr_path_t path2[BTR_PATH_ARRAY_N_SLOTS]; + btr_cur_t cursor; + btr_path_t* slot1; + btr_path_t* slot2; + ibool diverged; + ibool diverged_lot; + ulint divergence_level; + ulint n_pages; + ulint i; + mtr_t mtr; + mem_heap_t* heap; + + heap = mem_heap_create(n_cols * sizeof(dfield_t) + + sizeof(dtuple_t)); + + /* make tuple1 (NULL,NULL,,,) from n_cols */ + tuple1 = dtuple_create(heap, n_cols); + dict_index_copy_types(tuple1, index, n_cols); + + for (i = 0; i < n_cols; i++) { + dfield_set_null(dtuple_get_nth_field(tuple1, i)); + } + + mtr_start(&mtr); + + cursor.path_arr = path1; + + btr_cur_search_to_nth_level(index, 0, tuple1, PAGE_CUR_G, + BTR_SEARCH_LEAF | BTR_ESTIMATE, + &cursor, 0, &mtr); + + mtr_commit(&mtr); + + + + mtr_start(&mtr); + + cursor.path_arr = path2; + + btr_cur_open_at_index_side(FALSE, index, + BTR_SEARCH_LEAF | BTR_ESTIMATE, + &cursor, &mtr); + + mtr_commit(&mtr); + + mem_heap_free(heap); + + /* We have the path information for the range in path1 and path2 */ + + n_pages = 1; + diverged = FALSE; /* This becomes true when the path is not + the same any more */ + diverged_lot = FALSE; /* This becomes true when the paths are + not the same or adjacent any more */ + divergence_level = 1000000; /* This is the level where paths diverged + a lot */ + for (i = 0; ; i++) { + ut_ad(i < BTR_PATH_ARRAY_N_SLOTS); + + slot1 = path1 + i; + slot2 = path2 + i; + + if ((slot1 + 1)->nth_rec == ULINT_UNDEFINED + || (slot2 + 1)->nth_rec == ULINT_UNDEFINED) { + + if (i > divergence_level + 1) { + /* In trees whose height is > 1 our algorithm + tends to underestimate: multiply the estimate + by 2: */ + + n_pages = n_pages * 2; + } + + /* Do not estimate the number of rows in the range + to over 1 / 2 of the estimated rows in the whole + table */ + + if (n_pages > index->stat_n_leaf_pages / 2) { + n_pages = index->stat_n_leaf_pages / 2; + + /* If there are just 0 or 1 rows in the table, + then we estimate all rows are in the range */ + + if (n_pages == 0) { + n_pages = index->stat_n_leaf_pages; + } + } + + return(n_pages); + } + + if (!diverged && slot1->nth_rec != slot2->nth_rec) { + + diverged = TRUE; + + if (slot1->nth_rec < slot2->nth_rec) { + n_pages = slot2->nth_rec - slot1->nth_rec; + + if (n_pages > 1) { + diverged_lot = TRUE; + divergence_level = i; + } + } else { + /* Maybe the tree has changed between + searches */ + + return(10); + } + + } else if (diverged && !diverged_lot) { + + if (slot1->nth_rec < slot1->n_recs + || slot2->nth_rec > 1) { + + diverged_lot = TRUE; + divergence_level = i; + + n_pages = 0; + + if (slot1->nth_rec < slot1->n_recs) { + n_pages += slot1->n_recs + - slot1->nth_rec; + } + + if (slot2->nth_rec > 1) { + n_pages += slot2->nth_rec - 1; + } + } + } else if (diverged_lot) { + + n_pages = (n_pages * (slot1->n_recs + slot2->n_recs)) + / 2; + } + } +} + +/*******************************************************************//** Estimates the number of different key values in a given index, for each n-column prefix of the index where n <= dict_index_get_n_unique(index). The estimates are stored in the array index->stat_n_diff_key_vals. */ @@ -3231,9 +3561,7 @@ btr_estimate_number_of_different_key_vals( ulint n_cols; ulint matched_fields; ulint matched_bytes; - ib_int64_t n_recs = 0; ib_int64_t* n_diff; - ib_int64_t* n_not_nulls= 0; ullint n_sample_pages; /* number of pages to sample */ ulint not_empty_flag = 0; ulint total_external_size = 0; @@ -3247,22 +3575,37 @@ btr_estimate_number_of_different_key_vals( ulint* offsets_rec = offsets_rec_; ulint* offsets_next_rec= offsets_next_rec_; ulint stats_method = srv_stats_method; + btr_path_t first_rec_path[BTR_PATH_ARRAY_N_SLOTS]; + ulint effective_pages; /* effective leaf pages */ rec_offs_init(offsets_rec_); rec_offs_init(offsets_next_rec_); n_cols = dict_index_get_n_unique(index); - n_diff = mem_zalloc((n_cols + 1) * sizeof(ib_int64_t)); - if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS) { - n_not_nulls = mem_zalloc((n_cols + 1) * sizeof(ib_int64_t)); + /* estimate effective pages and path for the first effective record */ + /* TODO: make it work also for n_cols > 1. */ + effective_pages = btr_estimate_n_pages_not_null(index, 1 /*k*/, first_rec_path); + + if (!effective_pages) { + for (j = 0; j <= n_cols; j++) { + index->stat_n_diff_key_vals[j] = (ib_int64_t)index->stat_n_leaf_pages; + } + return; + } else if (effective_pages > index->stat_n_leaf_pages) { + effective_pages = index->stat_n_leaf_pages; + } + } else { + effective_pages = index->stat_n_leaf_pages; } + n_diff = mem_zalloc((n_cols + 1) * sizeof(ib_int64_t)); + /* It makes no sense to test more pages than are contained in the index, thus we lower the number if it is too high */ - if (srv_stats_sample_pages > index->stat_index_size) { - if (index->stat_index_size > 0) { - n_sample_pages = index->stat_index_size; + if (srv_stats_sample_pages > effective_pages) { + if (effective_pages > 0) { + n_sample_pages = effective_pages; } else { n_sample_pages = 1; } @@ -3274,9 +3617,15 @@ btr_estimate_number_of_different_key_vals( for (i = 0; i < n_sample_pages; i++) { rec_t* supremum; + ibool is_first_page = TRUE; mtr_start(&mtr); + if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS) { + is_first_page = btr_cur_open_at_rnd_pos_after_path(index, BTR_SEARCH_LEAF, + first_rec_path, &cursor, &mtr); + } else { btr_cur_open_at_rnd_pos(index, BTR_SEARCH_LEAF, &cursor, &mtr); + } /* Count the number of different key values for each prefix of the key on this index page. If the prefix does not determine @@ -3286,8 +3635,19 @@ btr_estimate_number_of_different_key_vals( page = btr_cur_get_page(&cursor); + if (srv_pass_corrupt_table && !page) { + break; + } + ut_a(page); + supremum = page_get_supremum_rec(page); + if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS && is_first_page) { + /* the cursor should be the first record of the page. */ + /* Counting should be started from here. */ + rec = btr_cur_get_rec(&cursor); + } else { rec = page_rec_get_next(page_get_infimum_rec(page)); + } if (rec != supremum) { not_empty_flag = 1; @@ -3297,20 +3657,6 @@ btr_estimate_number_of_different_key_vals( while (rec != supremum) { rec_t* next_rec; - /* count recs */ - if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS) { - n_recs++; - for (j = 0; j <= n_cols; j++) { - ulint f_len; - (void) rec_get_nth_field(rec, - offsets_rec, - j, &f_len); - if (f_len == UNIV_SQL_NULL) - break; - - n_not_nulls[j]++; - } - } next_rec = page_rec_get_next(rec); if (next_rec == supremum) { break; @@ -3325,7 +3671,10 @@ btr_estimate_number_of_different_key_vals( cmp_rec_rec_with_match(rec, next_rec, offsets_rec, offsets_next_rec, index, &matched_fields, - &matched_bytes, srv_stats_method); + &matched_bytes, + (stats_method==SRV_STATS_METHOD_NULLS_NOT_EQUAL) ? + SRV_STATS_METHOD_NULLS_NOT_EQUAL : + SRV_STATS_METHOD_NULLS_EQUAL); for (j = matched_fields + 1; j <= n_cols; j++) { /* We add one if this index record has @@ -3386,7 +3735,7 @@ btr_estimate_number_of_different_key_vals( for (j = 0; j <= n_cols; j++) { index->stat_n_diff_key_vals[j] = ((n_diff[j] - * (ib_int64_t)index->stat_n_leaf_pages + * (ib_int64_t)effective_pages + n_sample_pages - 1 + total_external_size + not_empty_flag) @@ -3401,7 +3750,7 @@ btr_estimate_number_of_different_key_vals( different key values, or even more. Let us try to approximate that: */ - add_on = index->stat_n_leaf_pages + add_on = effective_pages / (10 * (n_sample_pages + total_external_size)); @@ -3411,20 +3760,18 @@ btr_estimate_number_of_different_key_vals( index->stat_n_diff_key_vals[j] += add_on; - /* revision for 'nulls_ignored' */ if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS) { - if (!n_not_nulls[j]) - n_not_nulls[j] = 1; + /* index->stat_n_diff_key_vals[k] is used for calc rec_per_key, + as "stats.records / index->stat_n_diff_key_vals[x]". + So it should be adjusted to the value which is based on whole of the index. */ index->stat_n_diff_key_vals[j] = - index->stat_n_diff_key_vals[j] * n_recs - / n_not_nulls[j]; + index->stat_n_diff_key_vals[j] * (ib_int64_t)index->stat_n_leaf_pages + / (ib_int64_t)effective_pages; } } mem_free(n_diff); - if (stats_method == SRV_STATS_METHOD_IGNORE_NULLS) { - mem_free(n_not_nulls); - } + if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); } diff --git a/storage/xtradb/btr/btr0pcur.c b/storage/xtradb/btr/btr0pcur.c index ec98692c35b..86beea5a899 100644 --- a/storage/xtradb/btr/btr0pcur.c +++ b/storage/xtradb/btr/btr0pcur.c @@ -32,7 +32,7 @@ Created 2/23/1996 Heikki Tuuri #include "ut0byte.h" #include "rem0cmp.h" #include "trx0trx.h" - +#include "srv0srv.h" /**************************************************************//** Allocates memory for a persistent cursor object and initializes the cursor. @return own: persistent cursor */ @@ -102,6 +102,12 @@ btr_pcur_store_position( ut_ad(cursor->latch_mode != BTR_NO_LATCHES); block = btr_pcur_get_block(cursor); + + if (srv_pass_corrupt_table && !block) { + return; + } + ut_a(block); + index = btr_cur_get_index(btr_pcur_get_btr_cur(cursor)); page_cursor = btr_pcur_get_page_cur(cursor); @@ -413,6 +419,15 @@ btr_pcur_move_to_next_page( next_block = btr_block_get(space, zip_size, next_page_no, cursor->latch_mode, mtr); next_page = buf_block_get_frame(next_block); + + if (srv_pass_corrupt_table && !next_page) { + btr_leaf_page_release(btr_pcur_get_block(cursor), + cursor->latch_mode, mtr); + btr_pcur_get_page_cur(cursor)->block = 0; + btr_pcur_get_page_cur(cursor)->rec = 0; + return; + } + ut_a(next_page); #ifdef UNIV_BTR_DEBUG ut_a(page_is_comp(next_page) == page_is_comp(page)); ut_a(btr_page_get_prev(next_page, mtr) diff --git a/storage/xtradb/btr/btr0sea.c b/storage/xtradb/btr/btr0sea.c index e59d51e056e..61909903a67 100644 --- a/storage/xtradb/btr/btr0sea.c +++ b/storage/xtradb/btr/btr0sea.c @@ -42,7 +42,7 @@ Created 2/17/1996 Heikki Tuuri #include "btr0pcur.h" #include "btr0btr.h" #include "ha0ha.h" - +#include "srv0srv.h" /** Flag: has the search system been enabled? Protected by btr_search_latch and btr_search_enabled_mutex. */ UNIV_INTERN char btr_search_enabled = TRUE; @@ -585,6 +585,11 @@ btr_search_info_update_slow( block = btr_cur_get_block(cursor); + if (srv_pass_corrupt_table && !block) { + return; + } + ut_a(block); + /* NOTE that the following two function calls do NOT protect info or block->n_fields etc. with any semaphore, to save CPU time! We cannot assume the fields are consistent when we return from diff --git a/storage/xtradb/buf/buf0buddy.c b/storage/xtradb/buf/buf0buddy.c index 586a8dee1a2..d5e45745757 100644 --- a/storage/xtradb/buf/buf0buddy.c +++ b/storage/xtradb/buf/buf0buddy.c @@ -43,7 +43,7 @@ static ulint buf_buddy_n_frames; #endif /* UNIV_DEBUG */ /** Statistics of the buddy system, indexed by block size. Protected by buf_pool_mutex. */ -UNIV_INTERN buf_buddy_stat_t buf_buddy_stat[BUF_BUDDY_SIZES + 1]; +UNIV_INTERN buf_buddy_stat_t buf_buddy_stat[BUF_BUDDY_SIZES_MAX + 1]; /**********************************************************************//** Get the offset of the buddy of a compressed page frame. diff --git a/storage/xtradb/buf/buf0buf.c b/storage/xtradb/buf/buf0buf.c index 2ea17baf34a..79a9488e339 100644 --- a/storage/xtradb/buf/buf0buf.c +++ b/storage/xtradb/buf/buf0buf.c @@ -52,6 +52,7 @@ Created 11/5/1995 Heikki Tuuri #include "log0recv.h" #include "page0zip.h" #include "trx0trx.h" +#include "srv0start.h" /* prototypes for new functions added to ha_innodb.cc */ trx_t* innobase_get_trx(); @@ -348,6 +349,27 @@ buf_calc_page_new_checksum( return(checksum); } +UNIV_INTERN +ulint +buf_calc_page_new_checksum_32( +/*==========================*/ + const byte* page) /*!< in: buffer page */ +{ + ulint checksum; + + checksum = ut_fold_binary(page + FIL_PAGE_OFFSET, + FIL_PAGE_FILE_FLUSH_LSN - FIL_PAGE_OFFSET) + + ut_fold_binary(page + FIL_PAGE_DATA, + FIL_PAGE_DATA_ALIGN_32 - FIL_PAGE_DATA) + + ut_fold_binary_32(page + FIL_PAGE_DATA_ALIGN_32, + UNIV_PAGE_SIZE - FIL_PAGE_DATA_ALIGN_32 + - FIL_PAGE_END_LSN_OLD_CHKSUM); + + checksum = checksum & 0xFFFFFFFFUL; + + return(checksum); +} + /********************************************************************//** In versions < 4.0.14 and < 4.1.1 there was a bug that the checksum only looked at the first few bytes of the page. This calculates that old @@ -462,13 +484,25 @@ buf_page_is_corrupted( /* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id (always equal to 0), to FIL_PAGE_SPACE_OR_CHKSUM */ - if (checksum_field != 0 + if (!srv_fast_checksum + && checksum_field != 0 && checksum_field != BUF_NO_CHECKSUM_MAGIC && checksum_field != buf_calc_page_new_checksum(read_buf)) { return(TRUE); } + + if (srv_fast_checksum + && checksum_field != 0 + && checksum_field != BUF_NO_CHECKSUM_MAGIC + && checksum_field + != buf_calc_page_new_checksum_32(read_buf) + && checksum_field + != buf_calc_page_new_checksum(read_buf)) { + + return(TRUE); + } } return(FALSE); @@ -488,6 +522,7 @@ buf_page_print( dict_index_t* index; #endif /* !UNIV_HOTBACKUP */ ulint checksum; + ulint checksum_32; ulint old_checksum; ulint size = zip_size; @@ -574,12 +609,14 @@ buf_page_print( checksum = srv_use_checksums ? buf_calc_page_new_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC; + checksum_32 = srv_use_checksums + ? buf_calc_page_new_checksum_32(read_buf) : BUF_NO_CHECKSUM_MAGIC; old_checksum = srv_use_checksums ? buf_calc_page_old_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC; ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB: Page checksum %lu, prior-to-4.0.14-form" + " InnoDB: Page checksum %lu (32bit_calc: %lu), prior-to-4.0.14-form" " checksum %lu\n" "InnoDB: stored checksum %lu, prior-to-4.0.14-form" " stored checksum %lu\n" @@ -588,7 +625,7 @@ buf_page_print( "InnoDB: Page number (if stored to page already) %lu,\n" "InnoDB: space id (if created with >= MySQL-4.1.1" " and stored already) %lu\n", - (ulong) checksum, (ulong) old_checksum, + (ulong) checksum, (ulong) checksum_32, (ulong) old_checksum, (ulong) mach_read_from_4(read_buf + FIL_PAGE_SPACE_OR_CHKSUM), (ulong) mach_read_from_4(read_buf + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM), @@ -1809,6 +1846,14 @@ err_exit: return(NULL); } + if (srv_pass_corrupt_table) { + if (bpage->is_corrupt) { + rw_lock_s_unlock(&page_hash_latch); + return(NULL); + } + } + ut_a(!(bpage->is_corrupt)); + block_mutex = buf_page_get_mutex_enter(bpage); rw_lock_s_unlock(&page_hash_latch); @@ -2246,6 +2291,14 @@ loop2: return(NULL); } + if (srv_pass_corrupt_table) { + if (block->page.is_corrupt) { + mutex_exit(block_mutex); + return(NULL); + } + } + ut_a(!(block->page.is_corrupt)); + switch (buf_block_get_state(block)) { buf_page_t* bpage; ibool success; @@ -2874,6 +2927,7 @@ buf_page_init_low( bpage->newest_modification = 0; bpage->oldest_modification = 0; HASH_INVALIDATE(bpage, hash); + bpage->is_corrupt = FALSE; #ifdef UNIV_DEBUG_FILE_ACCESSES bpage->file_page_was_freed = FALSE; #endif /* UNIV_DEBUG_FILE_ACCESSES */ @@ -3329,7 +3383,8 @@ UNIV_INTERN void buf_page_io_complete( /*=================*/ - buf_page_t* bpage) /*!< in: pointer to the block in question */ + buf_page_t* bpage, /*!< in: pointer to the block in question */ + trx_t* trx) { enum buf_io_fix io_type; const ibool uncompressed = (buf_page_get_state(bpage) @@ -3406,6 +3461,7 @@ buf_page_io_complete( (ulong) bpage->offset); } + if (!srv_pass_corrupt_table || !bpage->is_corrupt) { /* From version 3.23.38 up we store the page checksum to the 4 first bytes of the page end lsn field */ @@ -3447,6 +3503,19 @@ corrupt: REFMAN "forcing-recovery.html\n" "InnoDB: about forcing recovery.\n", stderr); + if (srv_pass_corrupt_table && bpage->space > 0 + && bpage->space < SRV_LOG_SPACE_FIRST_ID) { + fprintf(stderr, + "InnoDB: space %u will be treated as corrupt.\n", + bpage->space); + fil_space_set_corrupt(bpage->space); + if (trx && trx->dict_operation_lock_mode == 0) { + dict_table_set_corrupt_by_space(bpage->space, TRUE); + } else { + dict_table_set_corrupt_by_space(bpage->space, FALSE); + } + bpage->is_corrupt = TRUE; + } else if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) { fputs("InnoDB: Ending processing because of" " a corrupt database page.\n", @@ -3454,6 +3523,7 @@ corrupt: exit(1); } } + } /**/ if (recv_recovery_is_on()) { /* Pages must be uncompressed for crash recovery. */ @@ -3463,8 +3533,11 @@ corrupt: if (uncompressed && !recv_no_ibuf_operations) { ibuf_merge_or_delete_for_page( + /* Delete possible entries, if bpage is_corrupt */ + (srv_pass_corrupt_table && bpage->is_corrupt) ? NULL : (buf_block_t*) bpage, bpage->space, bpage->offset, buf_page_get_zip_size(bpage), + (srv_pass_corrupt_table && bpage->is_corrupt) ? FALSE : TRUE); } } diff --git a/storage/xtradb/buf/buf0flu.c b/storage/xtradb/buf/buf0flu.c index 9fb4fe7d9ea..1735f6ac3cb 100644 --- a/storage/xtradb/buf/buf0flu.c +++ b/storage/xtradb/buf/buf0flu.c @@ -711,7 +711,9 @@ buf_flush_init_for_writing( mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, srv_use_checksums - ? buf_calc_page_new_checksum(page) + ? (!srv_fast_checksum + ? buf_calc_page_new_checksum(page) + : buf_calc_page_new_checksum_32(page)) : BUF_NO_CHECKSUM_MAGIC); /* We overwrite the first 4 bytes of the end lsn field to store @@ -1271,7 +1273,7 @@ buf_flush_LRU_recommendation(void) if(UT_LIST_GET_LEN(buf_pool->unzip_LRU)) have_LRU_mutex = TRUE; - +retry: //buf_pool_mutex_enter(); if (have_LRU_mutex) mutex_enter(&LRU_list_mutex); @@ -1313,6 +1315,10 @@ buf_flush_LRU_recommendation(void) if (n_replaceable >= BUF_FLUSH_FREE_BLOCK_MARGIN) { return(0); + } else if (!have_LRU_mutex) { + /* confirm it again with LRU_mutex for exactness */ + have_LRU_mutex = TRUE; + goto retry; } return(BUF_FLUSH_FREE_BLOCK_MARGIN + BUF_FLUSH_EXTRA_MARGIN diff --git a/storage/xtradb/buf/buf0rea.c b/storage/xtradb/buf/buf0rea.c index 08aaac788d5..e5d04df797f 100644 --- a/storage/xtradb/buf/buf0rea.c +++ b/storage/xtradb/buf/buf0rea.c @@ -187,12 +187,19 @@ not_to_recover: sync, space, 0, offset, 0, UNIV_PAGE_SIZE, ((buf_block_t*) bpage)->frame, bpage, trx); } + + if (srv_pass_corrupt_table) { + if (*err != DB_SUCCESS) { + bpage->is_corrupt = TRUE; + } + } else { ut_a(*err == DB_SUCCESS); + } if (sync) { /* The i/o is already completed when we arrive from fil_read */ - buf_page_io_complete(bpage); + buf_page_io_complete(bpage, trx); } return(1); diff --git a/storage/xtradb/build/debian/README.Maintainer b/storage/xtradb/build/debian/README.Maintainer new file mode 100644 index 00000000000..9554bdd7c62 --- /dev/null +++ b/storage/xtradb/build/debian/README.Maintainer @@ -0,0 +1,116 @@ + +########################### +## FIXME for 5.1 ## +########################### + +* put this trigger-recreation thing into the init scripts -- what?! +* Let debian-i10n-english review all template changes before the translaters start. +* Mark debconf translations as obsolete with debconf-updatepo. + +########################################################################### +# Here are some information that are only of interest for the current and # +# following Debian maintainers of MySQL. # +########################################################################### + +The debian/ directory is under SVN control, see debian/control for URL. + +# +# Preparing a new version +# +The new orig.tar.gz (without non-free documentation) is created in /tmp/ when +running this command: + +debian/rules get-orig-source + +# +# mysqlreport +# +The authors e-mail address is <public@codenode.com>. + +# +# Remarks to dependencies +# +libwrap0-dev (>= 7.6-8.3) + According to bug report 114582 where where build problems on + IA-64/sid with at least two prior versions. +psmisc + /usr/bin/killall in the initscript + +zlib1g in libmysqlclient-dev: + "mysql_config --libs" ads "-lz" + +Build-Dep: + +debhelper (>=4.1.16): + See po-debconf(7). + +autoconf (>= 2.13-20), automake1.7 + Try to get rid of them. + +doxygen, tetex-bin, tetex-extra, gs + for ndb/docs/*tex + +# +# Remarks to the start scripts +# + +## initscripts rely on mysqladmin from a different package +We have the problem that "/etc/init.d/mysql stop" relies on mysqladmin which +is in another package (mysql-client) and a passwordless access that's maybe +only available if the user configured his /root/.my.cnf. Can this be a problem? +* normal mode: not because the user is required to have it. Else: +* purge/remove: not, same as normal mode +* upgrade: not, same as normal mode +* first install: not, it depends on mysql-client which at least is unpacked + so mysqladmin is there (to ping). It is not yet configured + passwordles but if there's a server running then there's a + /root/.my.cnf. Anyways, we simply kill anything that's mysqld. + +## Passwordless access for the maintainer scripts +Another issue is that the scripts needs passwordless access. To ensure this +a debian-sys-maint user is configured which has process and shutdown privs. +The file with the randomly (that's important!) generated password must be +present as long as the databases remain installed because else a new install +would have no access. This file should be used like: + mysqladmin --defaults-file=/etc/mysql/debian.cnf restart +to avoid providing the password in plaintext on a commandline where it would +be visible to any user via the "ps" command. + +## When to start the daemon? +We aim to give the admin full control on when MySQL is running. +Issues to be faced here: +OLD: + 1. Debconf asks whether MySQL should be started on boot so update-rc.d is + only run if the answer has been yes. The admin is likely to forget + this decision but update-rc.d checks for an existing line in + /etc/runlevel.conf and leaves it intact. + 2. On initial install, if the answer is yes, the daemon has to be started. + 3. On upgrades it should only be started if it was already running, everything + else is confusing. Especiall relying on an debconf decision made month ago + is considered suboptimal. See bug #274264 + Implementation so far: + prerm (called on upgrade before stopping the server): + check for a running server and set flag if necessary + preinst (called on initial install and before unpacking when upgrading): + check for the debconf variable and set flag if necessary + postinst (called on initial install and after each upgrade after unpacking): + call update-rc.d if debconf says yes + call invoce-rc.d if the flag has been set + Problems remaining: + dpkg-reconfigure and setting mysql start on boot to yes did not start mysql + (ok "start on boot" literally does not mean "start now" so that might have been ok) +NEW: + 1. --- no debconf anymore for the sake of simplicity. We have runlevel.conf, + the admin should use it + 2. On initial install the server is started. + 3. On upgrades the server is started exactly if it was running before so the + runlevel configuration is irrelevant. It will be preserved by the mean of + update-rc.d's builtin check. + Implementation: + prerm (called on upgrade before stopping the server): + check for a running server and set flag if necessary + preinst (called on initial install and before unpacking when upgrading): + check for $1 beeing (initial) "install" and set flag + postinst (called on initial install and after each upgrade after unpacking): + call update-rc.d + call invoce-rc.d if the flag has been set diff --git a/storage/xtradb/build/debian/additions/Docs__Images__Makefile.in b/storage/xtradb/build/debian/additions/Docs__Images__Makefile.in new file mode 100644 index 00000000000..f7316d4e345 --- /dev/null +++ b/storage/xtradb/build/debian/additions/Docs__Images__Makefile.in @@ -0,0 +1,6 @@ +all: + +distclean: + -rm -f Makefile + +.PHONY: all distclean clean install check diff --git a/storage/xtradb/build/debian/additions/Docs__Makefile.in b/storage/xtradb/build/debian/additions/Docs__Makefile.in new file mode 100644 index 00000000000..f7316d4e345 --- /dev/null +++ b/storage/xtradb/build/debian/additions/Docs__Makefile.in @@ -0,0 +1,6 @@ +all: + +distclean: + -rm -f Makefile + +.PHONY: all distclean clean install check diff --git a/storage/xtradb/build/debian/additions/debian-start b/storage/xtradb/build/debian/additions/debian-start new file mode 100644 index 00000000000..10628019e40 --- /dev/null +++ b/storage/xtradb/build/debian/additions/debian-start @@ -0,0 +1,31 @@ +#!/bin/bash +# +# This script is executed by "/etc/init.d/mysql" on every (re)start. +# +# Changes to this file will be preserved when updating the Debian package. +# + +source /usr/share/mysql/debian-start.inc.sh + +MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf" +MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" +MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf" +MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf" +MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables" +MYCHECK_PARAMS="--all-databases --fast --silent" +MYCHECK_RCPT="root" + +# The following commands should be run when the server is up but in background +# where they do not block the server start and in one shell instance so that +# they run sequentially. They are supposed not to echo anything to stdout. +# If you want to disable the check for crashed tables comment +# "check_for_crashed_tables" out. +# (There may be no output to stdout inside the background process!) +echo "Checking for corrupt, not cleanly closed and upgrade needing tables." +( + upgrade_system_tables_if_necessary; + check_root_accounts; + check_for_crashed_tables; +) >&2 & + +exit 0 diff --git a/storage/xtradb/build/debian/additions/debian-start.inc.sh b/storage/xtradb/build/debian/additions/debian-start.inc.sh new file mode 100644 index 00000000000..736cb3448eb --- /dev/null +++ b/storage/xtradb/build/debian/additions/debian-start.inc.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# +# This file is included by /etc/mysql/debian-start +# + +## Check all unclosed tables. +# - Requires the server to be up. +# - Is supposed to run silently in background. +function check_for_crashed_tables() { + set -e + set -u + + # But do it in the background to not stall the boot process. + logger -p daemon.info -i -t$0 "Triggering myisam-recover for all MyISAM tables" + + # Checking for $? is unreliable so the size of the output is checked. + # Some table handlers like HEAP do not support CHECK TABLE. + tempfile=`tempfile` + # We have to use xargs in this case, because a for loop barfs on the + # spaces in the thing to be looped over. + LC_ALL=C $MYSQL --skip-column-names --batch -e ' + select concat("select count(*) into @discard from `", + TABLE_SCHEMA, "`.`", TABLE_NAME, "`") + from information_schema.TABLES where ENGINE="MyISAM"' | \ + xargs -i $MYSQL --skip-column-names --silent --batch \ + --force -e "{}" >$tempfile + if [ -s $tempfile ]; then + ( + /bin/echo -e "\n" \ + "Improperly closed tables are also reported if clients are accessing\n" \ + "the tables *now*. A list of current connections is below.\n"; + $MYADMIN processlist status + ) >> $tempfile + # Check for presence as a dependency on mailx would require an MTA. + if [ -x /usr/bin/mailx ]; then + mailx -e -s"$MYCHECK_SUBJECT" $MYCHECK_RCPT < $tempfile + fi + (echo "$MYCHECK_SUBJECT"; cat $tempfile) | logger -p daemon.warn -i -t$0 + fi + rm $tempfile +} + +## Check for tables needing an upgrade. +# - Requires the server to be up. +# - Is supposed to run silently in background. +function upgrade_system_tables_if_necessary() { + set -e + set -u + + logger -p daemon.info -i -t$0 "Upgrading MySQL tables if necessary." + + # Filter all "duplicate column", "duplicate key" and "unknown column" + # errors as the script is designed to be idempotent. + LC_ALL=C $MYUPGRADE \ + 2>&1 \ + | egrep -v '^(1|@had|ERROR (1054|1060|1061))' \ + | logger -p daemon.warn -i -t$0 +} + +## Check for the presence of both, root accounts with and without password. +# This might have been caused by a bug related to mysql_install_db (#418672). +function check_root_accounts() { + set -e + set -u + + logger -p daemon.info -i -t$0 "Checking for insecure root accounts." + + ret=$( echo "SELECT count(*) FROM mysql.user WHERE user='root' and password='';" | $MYSQL --skip-column-names ) + if [ "$ret" -ne "0" ]; then + logger -p daemon.warn -i -t$0 "WARNING: mysql.user contains $ret root accounts without password!" + fi +} diff --git a/storage/xtradb/build/debian/additions/echo_stderr b/storage/xtradb/build/debian/additions/echo_stderr new file mode 100644 index 00000000000..67b3ed7cfb3 --- /dev/null +++ b/storage/xtradb/build/debian/additions/echo_stderr @@ -0,0 +1,2 @@ +#!/bin/bash +echo "$*" 1>&2 diff --git a/storage/xtradb/build/debian/additions/innotop/InnoDBParser.pm b/storage/xtradb/build/debian/additions/innotop/InnoDBParser.pm new file mode 100644 index 00000000000..3aaa7acd5b8 --- /dev/null +++ b/storage/xtradb/build/debian/additions/innotop/InnoDBParser.pm @@ -0,0 +1,1089 @@ +use strict; +use warnings FATAL => 'all'; + +package InnoDBParser; + +# This program is copyright (c) 2006 Baron Schwartz, baron at xaprb dot com. +# Feedback and improvements are gratefully received. +# +# THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +# MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free Software +# Foundation, version 2; OR the Perl Artistic License. On UNIX and similar +# systems, you can issue `man perlgpl' or `man perlartistic' to read these + +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 59 Temple +# Place, Suite 330, Boston, MA 02111-1307 USA + +our $VERSION = '1.6.0'; + +use Data::Dumper; +$Data::Dumper::Sortkeys = 1; +use English qw(-no_match_vars); +use List::Util qw(max); + +# Some common patterns +my $d = qr/(\d+)/; # Digit +my $f = qr/(\d+\.\d+)/; # Float +my $t = qr/(\d+ \d+)/; # Transaction ID +my $i = qr/((?:\d{1,3}\.){3}\d+)/; # IP address +my $n = qr/([^`\s]+)/; # MySQL object name +my $w = qr/(\w+)/; # Words +my $fl = qr/([\w\.\/]+) line $d/; # Filename and line number +my $h = qr/((?:0x)?[0-9a-f]*)/; # Hex +my $s = qr/(\d{6} .\d:\d\d:\d\d)/; # InnoDB timestamp + +# If you update this variable, also update the SYNOPSIS in the pod. +my %innodb_section_headers = ( + "TRANSACTIONS" => "tx", + "BUFFER POOL AND MEMORY" => "bp", + "SEMAPHORES" => "sm", + "LOG" => "lg", + "ROW OPERATIONS" => "ro", + "INSERT BUFFER AND ADAPTIVE HASH INDEX" => "ib", + "FILE I/O" => "io", + "LATEST DETECTED DEADLOCK" => "dl", + "LATEST FOREIGN KEY ERROR" => "fk", +); + +my %parser_for = ( + tx => \&parse_tx_section, + bp => \&parse_bp_section, + sm => \&parse_sm_section, + lg => \&parse_lg_section, + ro => \&parse_ro_section, + ib => \&parse_ib_section, + io => \&parse_io_section, + dl => \&parse_dl_section, + fk => \&parse_fk_section, +); + +my %fk_parser_for = ( + Transaction => \&parse_fk_transaction_error, + Error => \&parse_fk_bad_constraint_error, + Cannot => \&parse_fk_cant_drop_parent_error, +); + +# A thread's proc_info can be at least 98 different things I've found in the +# source. Fortunately, most of them begin with a gerunded verb. These are +# the ones that don't. +my %is_proc_info = ( + 'After create' => 1, + 'Execution of init_command' => 1, + 'FULLTEXT initialization' => 1, + 'Reopen tables' => 1, + 'Repair done' => 1, + 'Repair with keycache' => 1, + 'System lock' => 1, + 'Table lock' => 1, + 'Thread initialized' => 1, + 'User lock' => 1, + 'copy to tmp table' => 1, + 'discard_or_import_tablespace' => 1, + 'end' => 1, + 'got handler lock' => 1, + 'got old table' => 1, + 'init' => 1, + 'key cache' => 1, + 'locks' => 1, + 'malloc' => 1, + 'query end' => 1, + 'rename result table' => 1, + 'rename' => 1, + 'setup' => 1, + 'statistics' => 1, + 'status' => 1, + 'table cache' => 1, + 'update' => 1, +); + +sub new { + bless {}, shift; +} + +# Parse the status and return it. +# See srv_printf_innodb_monitor in innobase/srv/srv0srv.c +# Pass in the text to parse, whether to be in debugging mode, which sections +# to parse (hashref; if empty, parse all), and whether to parse full info from +# locks and such (probably shouldn't unless you need to). +sub parse_status_text { + my ( $self, $fulltext, $debug, $sections, $full ) = @_; + + die "I can't parse undef" unless defined $fulltext; + $fulltext =~ s/[\r\n]+/\n/g; + + $sections ||= {}; + die '$sections must be a hashref' unless ref($sections) eq 'HASH'; + + my %innodb_data = ( + got_all => 0, # Whether I was able to get the whole thing + ts => '', # Timestamp the server put on it + last_secs => 0, # Num seconds the averages are over + sections => {}, # Parsed values from each section + ); + + if ( $debug ) { + $innodb_data{'fulltext'} = $fulltext; + } + + # Get the most basic info about the status: beginning and end, and whether + # I got the whole thing (if there has been a big deadlock and there are + # too many locks to print, the output might be truncated) + my ( $time_text ) = $fulltext =~ m/^$s INNODB MONITOR OUTPUT$/m; + $innodb_data{'ts'} = [ parse_innodb_timestamp( $time_text ) ]; + $innodb_data{'timestring'} = ts_to_string($innodb_data{'ts'}); + ( $innodb_data{'last_secs'} ) = $fulltext + =~ m/Per second averages calculated from the last $d seconds/; + + ( my $got_all ) = $fulltext =~ m/END OF INNODB MONITOR OUTPUT/; + $innodb_data{'got_all'} = $got_all || 0; + + # Split it into sections. Each section begins with + # ----- + # LABEL + # ----- + my %innodb_sections; + my @matches = $fulltext + =~ m#\n(---+)\n([A-Z /]+)\n\1\n(.*?)(?=\n(---+)\n[A-Z /]+\n\4\n|$)#gs; + while ( my ( $start, $name, $text, $end ) = splice(@matches, 0, 4) ) { + $innodb_sections{$name} = [ $text, $end ? 1 : 0 ]; + } + # The Row Operations section is a special case, because instead of ending + # with the beginning of another section, it ends with the end of the file. + # So this section is complete if the entire file is complete. + $innodb_sections{'ROW OPERATIONS'}->[1] ||= $innodb_data{'got_all'}; + + # Just for sanity's sake, make sure I understand what to do with each + # section + eval { + foreach my $section ( keys %innodb_sections ) { + my $header = $innodb_section_headers{$section}; + die "Unknown section $section in $fulltext\n" + unless $header; + $innodb_data{'sections'}->{ $header } + ->{'fulltext'} = $innodb_sections{$section}->[0]; + $innodb_data{'sections'}->{ $header } + ->{'complete'} = $innodb_sections{$section}->[1]; + } + }; + if ( $EVAL_ERROR ) { + _debug( $debug, $EVAL_ERROR); + } + + # ################################################################ + # Parse the detailed data out of the sections. + # ################################################################ + eval { + foreach my $section ( keys %parser_for ) { + if ( defined $innodb_data{'sections'}->{$section} + && (!%$sections || (defined($sections->{$section} && $sections->{$section})) )) { + $parser_for{$section}->( + $innodb_data{'sections'}->{$section}, + $innodb_data{'sections'}->{$section}->{'complete'}, + $debug, + $full ) + or delete $innodb_data{'sections'}->{$section}; + } + else { + delete $innodb_data{'sections'}->{$section}; + } + } + }; + if ( $EVAL_ERROR ) { + _debug( $debug, $EVAL_ERROR); + } + + return \%innodb_data; +} + +# Parses the status text and returns it flattened out as a single hash. +sub get_status_hash { + my ( $self, $fulltext, $debug, $sections, $full ) = @_; + + # Parse the status text... + my $innodb_status + = $self->parse_status_text($fulltext, $debug, $sections, $full ); + + # Flatten the hierarchical structure into a single list by grabbing desired + # sections from it. + return + (map { 'IB_' . $_ => $innodb_status->{$_} } qw(timestring last_secs got_all)), + (map { 'IB_bp_' . $_ => $innodb_status->{'sections'}->{'bp'}->{$_} } + qw( writes_pending buf_pool_hit_rate total_mem_alloc buf_pool_reads + awe_mem_alloc pages_modified writes_pending_lru page_creates_sec + reads_pending pages_total buf_pool_hits writes_pending_single_page + page_writes_sec pages_read pages_written page_reads_sec + writes_pending_flush_list buf_pool_size add_pool_alloc + dict_mem_alloc pages_created buf_free complete )), + (map { 'IB_tx_' . $_ => $innodb_status->{'sections'}->{'tx'}->{$_} } + qw( num_lock_structs history_list_len purge_done_for transactions + purge_undo_for is_truncated trx_id_counter complete )), + (map { 'IB_ib_' . $_ => $innodb_status->{'sections'}->{'ib'}->{$_} } + qw( hash_table_size hash_searches_s non_hash_searches_s + bufs_in_node_heap used_cells size free_list_len seg_size inserts + merged_recs merges complete )), + (map { 'IB_lg_' . $_ => $innodb_status->{'sections'}->{'lg'}->{$_} } + qw( log_ios_done pending_chkp_writes last_chkp log_ios_s + log_flushed_to log_seq_no pending_log_writes complete )), + (map { 'IB_sm_' . $_ => $innodb_status->{'sections'}->{'sm'}->{$_} } + qw( wait_array_size rw_shared_spins rw_excl_os_waits mutex_os_waits + mutex_spin_rounds mutex_spin_waits rw_excl_spins rw_shared_os_waits + waits signal_count reservation_count complete )), + (map { 'IB_ro_' . $_ => $innodb_status->{'sections'}->{'ro'}->{$_} } + qw( queries_in_queue n_reserved_extents main_thread_state + main_thread_proc_no main_thread_id read_sec del_sec upd_sec ins_sec + read_views_open num_rows_upd num_rows_ins num_rows_read + queries_inside num_rows_del complete )), + (map { 'IB_fk_' . $_ => $innodb_status->{'sections'}->{'fk'}->{$_} } + qw( trigger parent_table child_index parent_index attempted_op + child_db timestring fk_name records col_name reason txn parent_db + type child_table parent_col complete )), + (map { 'IB_io_' . $_ => $innodb_status->{'sections'}->{'io'}->{$_} } + qw( pending_buffer_pool_flushes pending_pwrites pending_preads + pending_normal_aio_reads fsyncs_s os_file_writes pending_sync_ios + reads_s flush_type avg_bytes_s pending_ibuf_aio_reads writes_s + threads os_file_reads pending_aio_writes pending_log_ios os_fsyncs + pending_log_flushes complete )), + (map { 'IB_dl_' . $_ => $innodb_status->{'sections'}->{'dl'}->{$_} } + qw( timestring rolled_back txns complete )); + +} + +sub ts_to_string { + my $parts = shift; + return sprintf('%02d-%02d-%02d %02d:%02d:%02d', @$parts); +} + +sub parse_innodb_timestamp { + my $text = shift; + my ( $y, $m, $d, $h, $i, $s ) + = $text =~ m/^(\d\d)(\d\d)(\d\d) +(\d+):(\d+):(\d+)$/; + die("Can't get timestamp from $text\n") unless $y; + $y += 2000; + return ( $y, $m, $d, $h, $i, $s ); +} + +sub parse_fk_section { + my ( $section, $complete, $debug, $full ) = @_; + my $fulltext = $section->{'fulltext'}; + + return 0 unless $fulltext; + + my ( $ts, $type ) = $fulltext =~ m/^$s\s+(\w+)/m; + $section->{'ts'} = [ parse_innodb_timestamp( $ts ) ]; + $section->{'timestring'} = ts_to_string($section->{'ts'}); + $section->{'type'} = $type; + + # Decide which type of FK error happened, and dispatch to the right parser. + if ( $type && $fk_parser_for{$type} ) { + $fk_parser_for{$type}->( $section, $complete, $debug, $fulltext, $full ); + } + + delete $section->{'fulltext'} unless $debug; + + return 1; +} + +sub parse_fk_cant_drop_parent_error { + my ( $section, $complete, $debug, $fulltext, $full ) = @_; + + # Parse the parent/child table info out + @{$section}{ qw(attempted_op parent_db parent_table) } = $fulltext + =~ m{Cannot $w table `(.*)/(.*)`}m; + @{$section}{ qw(child_db child_table) } = $fulltext + =~ m{because it is referenced by `(.*)/(.*)`}m; + + ( $section->{'reason'} ) = $fulltext =~ m/(Cannot .*)/s; + $section->{'reason'} =~ s/\n(?:InnoDB: )?/ /gm + if $section->{'reason'}; + + # Certain data may not be present. Make them '' if not present. + map { $section->{$_} ||= "" } + qw(child_index fk_name col_name parent_col); +} + +# See dict/dict0dict.c, function dict_foreign_error_report +# I don't care much about these. There are lots of different messages, and +# they come from someone trying to create a foreign key, or similar +# statements. They aren't indicative of some transaction trying to insert, +# delete or update data. Sometimes it is possible to parse out a lot of +# information about the tables and indexes involved, but often the message +# contains the DDL string the user entered, which is way too much for this +# module to try to handle. +sub parse_fk_bad_constraint_error { + my ( $section, $complete, $debug, $fulltext, $full ) = @_; + + # Parse the parent/child table and index info out + @{$section}{ qw(child_db child_table) } = $fulltext + =~ m{Error in foreign key constraint of table (.*)/(.*):$}m; + $section->{'attempted_op'} = 'DDL'; + + # FK name, parent info... if possible. + @{$section}{ qw(fk_name col_name parent_db parent_table parent_col) } + = $fulltext + =~ m/CONSTRAINT `?$n`? FOREIGN KEY \(`?$n`?\) REFERENCES (?:`?$n`?\.)?`?$n`? \(`?$n`?\)/; + + if ( !defined($section->{'fk_name'}) ) { + # Try to parse SQL a user might have typed in a CREATE statement or such + @{$section}{ qw(col_name parent_db parent_table parent_col) } + = $fulltext + =~ m/FOREIGN\s+KEY\s*\(`?$n`?\)\s+REFERENCES\s+(?:`?$n`?\.)?`?$n`?\s*\(`?$n`?\)/i; + } + $section->{'parent_db'} ||= $section->{'child_db'}; + + # Name of the child index (index in the same table where the FK is, see + # definition of dict_foreign_struct in include/dict0mem.h, where it is + # called foreign_index, as opposed to referenced_index which is in the + # parent table. This may not be possible to find. + @{$section}{ qw(child_index) } = $fulltext + =~ m/^The index in the foreign key in table is $n$/m; + + @{$section}{ qw(reason) } = $fulltext =~ m/:\s*([^:]+)(?= Constraint:|$)/ms; + $section->{'reason'} =~ s/\s+/ /g + if $section->{'reason'}; + + # Certain data may not be present. Make them '' if not present. + map { $section->{$_} ||= "" } + qw(child_index fk_name col_name parent_table parent_col); +} + +# see source file row/row0ins.c +sub parse_fk_transaction_error { + my ( $section, $complete, $debug, $fulltext, $full ) = @_; + + # Parse the txn info out + my ( $txn ) = $fulltext + =~ m/Transaction:\n(TRANSACTION.*)\nForeign key constraint fails/s; + if ( $txn ) { + $section->{'txn'} = parse_tx_text( $txn, $complete, $debug, $full ); + } + + # Parse the parent/child table and index info out. There are two types: an + # update or a delete of a parent record leaves a child orphaned + # (row_ins_foreign_report_err), and an insert or update of a child record has + # no matching parent record (row_ins_foreign_report_add_err). + + @{$section}{ qw(reason child_db child_table) } + = $fulltext =~ m{^(Foreign key constraint fails for table `(.*)/(.*)`:)$}m; + + @{$section}{ qw(fk_name col_name parent_db parent_table parent_col) } + = $fulltext + =~ m/CONSTRAINT `$n` FOREIGN KEY \(`$n`\) REFERENCES (?:`$n`\.)?`$n` \(`$n`\)/; + $section->{'parent_db'} ||= $section->{'child_db'}; + + # Special case, which I don't know how to trigger, but see + # innobase/row/row0ins.c row_ins_check_foreign_constraint + if ( $fulltext =~ m/ibd file does not currently exist!/ ) { + my ( $attempted_op, $index, $records ) + = $fulltext =~ m/^Trying to (add to index) `$n` tuple:\n(.*))?/sm; + $section->{'child_index'} = $index; + $section->{'attempted_op'} = $attempted_op || ''; + if ( $records && $full ) { + ( $section->{'records'} ) + = parse_innodb_record_dump( $records, $complete, $debug ); + } + @{$section}{qw(parent_db parent_table)} + =~ m/^But the parent table `$n`\.`$n`$/m; + } + else { + my ( $attempted_op, $which, $index ) + = $fulltext =~ m/^Trying to ([\w ]*) in (child|parent) table, in index `$n` tuple:$/m; + if ( $which ) { + $section->{$which . '_index'} = $index; + $section->{'attempted_op'} = $attempted_op || ''; + + # Parse out the related records in the other table. + my ( $search_index, $records ); + if ( $which eq 'child' ) { + ( $search_index, $records ) = $fulltext + =~ m/^But in parent table [^,]*, in index `$n`,\nthe closest match we can find is record:\n(.*)/ms; + $section->{'parent_index'} = $search_index; + } + else { + ( $search_index, $records ) = $fulltext + =~ m/^But in child table [^,]*, in index `$n`, (?:the record is not available|there is a record:\n(.*))?/ms; + $section->{'child_index'} = $search_index; + } + if ( $records && $full ) { + $section->{'records'} + = parse_innodb_record_dump( $records, $complete, $debug ); + } + else { + $section->{'records'} = ''; + } + } + } + + # Parse out the tuple trying to be updated, deleted or inserted. + my ( $trigger ) = $fulltext =~ m/^(DATA TUPLE: \d+ fields;\n.*)$/m; + if ( $trigger ) { + $section->{'trigger'} = parse_innodb_record_dump( $trigger, $complete, $debug ); + } + + # Certain data may not be present. Make them '' if not present. + map { $section->{$_} ||= "" } + qw(child_index fk_name col_name parent_table parent_col); +} + +# There are new-style and old-style record formats. See rem/rem0rec.c +# TODO: write some tests for this +sub parse_innodb_record_dump { + my ( $dump, $complete, $debug ) = @_; + return undef unless $dump; + + my $result = {}; + + if ( $dump =~ m/PHYSICAL RECORD/ ) { + my $style = $dump =~ m/compact format/ ? 'new' : 'old'; + $result->{'style'} = $style; + + # This is a new-style record. + if ( $style eq 'new' ) { + @{$result}{qw( heap_no type num_fields info_bits )} + = $dump + =~ m/^(?:Record lock, heap no $d )?([A-Z ]+): n_fields $d; compact format; info bits $d$/m; + } + + # OK, it's old-style. Unfortunately there are variations here too. + elsif ( $dump =~ m/-byte offs / ) { + # Older-old style. + @{$result}{qw( heap_no type num_fields byte_offset info_bits )} + = $dump + =~ m/^(?:Record lock, heap no $d )?([A-Z ]+): n_fields $d; $d-byte offs [A-Z]+; info bits $d$/m; + if ( $dump !~ m/-byte offs TRUE/ ) { + $result->{'byte_offset'} = 0; + } + } + else { + # Newer-old style. + @{$result}{qw( heap_no type num_fields byte_offset info_bits )} + = $dump + =~ m/^(?:Record lock, heap no $d )?([A-Z ]+): n_fields $d; $d-byte offsets; info bits $d$/m; + } + + } + else { + $result->{'style'} = 'tuple'; + @{$result}{qw( type num_fields )} + = $dump =~ m/^(DATA TUPLE): $d fields;$/m; + } + + # Fill in default values for things that couldn't be parsed. + map { $result->{$_} ||= 0 } + qw(heap_no num_fields byte_offset info_bits); + map { $result->{$_} ||= '' } + qw(style type ); + + my @fields = $dump =~ m/ (\d+:.*?;?);(?=$| \d+:)/gm; + $result->{'fields'} = [ map { parse_field($_, $complete, $debug ) } @fields ]; + + return $result; +} + +# New/old-style applies here. See rem/rem0rec.c +# $text should not include the leading space or the second trailing semicolon. +sub parse_field { + my ( $text, $complete, $debug ) = @_; + + # Sample fields: + # '4: SQL NULL, size 4 ' + # '1: len 6; hex 000000005601; asc V ;' + # '6: SQL NULL' + # '5: len 30; hex 687474703a2f2f7777772e737765657477617465722e636f6d2f73746f72; asc http://www.sweetwater.com/stor;...(truncated)' + my ( $id, $nullsize, $len, $hex, $asc, $truncated ); + ( $id, $nullsize ) = $text =~ m/^$d: SQL NULL, size $d $/; + if ( !defined($id) ) { + ( $id ) = $text =~ m/^$d: SQL NULL$/; + } + if ( !defined($id) ) { + ( $id, $len, $hex, $asc, $truncated ) + = $text =~ m/^$d: len $d; hex $h; asc (.*);(\.\.\.\(truncated\))?$/; + } + + die "Could not parse this field: '$text'" unless defined $id; + return { + id => $id, + len => defined($len) ? $len : defined($nullsize) ? $nullsize : 0, + 'hex' => defined($hex) ? $hex : '', + asc => defined($asc) ? $asc : '', + trunc => $truncated ? 1 : 0, + }; + +} + +sub parse_dl_section { + my ( $dl, $complete, $debug, $full ) = @_; + return unless $dl; + my $fulltext = $dl->{'fulltext'}; + return 0 unless $fulltext; + + my ( $ts ) = $fulltext =~ m/^$s$/m; + return 0 unless $ts; + + $dl->{'ts'} = [ parse_innodb_timestamp( $ts ) ]; + $dl->{'timestring'} = ts_to_string($dl->{'ts'}); + $dl->{'txns'} = {}; + + my @sections + = $fulltext + =~ m{ + ^\*{3}\s([^\n]*) # *** (1) WAITING FOR THIS... + (.*?) # Followed by anything, non-greedy + (?=(?:^\*{3})|\z) # Followed by another three stars or EOF + }gmsx; + + + # Loop through each section. There are no assumptions about how many + # there are, who holds and wants what locks, and who gets rolled back. + while ( my ($header, $body) = splice(@sections, 0, 2) ) { + my ( $txn_id, $what ) = $header =~ m/^\($d\) (.*):$/; + next unless $txn_id; + $dl->{'txns'}->{$txn_id} ||= {}; + my $txn = $dl->{'txns'}->{$txn_id}; + + if ( $what eq 'TRANSACTION' ) { + $txn->{'tx'} = parse_tx_text( $body, $complete, $debug, $full ); + } + else { + push @{$txn->{'locks'}}, parse_innodb_record_locks( $body, $complete, $debug, $full ); + } + } + + @{ $dl }{ qw(rolled_back) } + = $fulltext =~ m/^\*\*\* WE ROLL BACK TRANSACTION \($d\)$/m; + + # Make sure certain values aren't undef + map { $dl->{$_} ||= '' } qw(rolled_back); + + delete $dl->{'fulltext'} unless $debug; + return 1; +} + +sub parse_innodb_record_locks { + my ( $text, $complete, $debug, $full ) = @_; + my @result; + + foreach my $lock ( $text =~ m/(^(?:RECORD|TABLE) LOCKS?.*$)/gm ) { + my $hash = {}; + @{$hash}{ qw(lock_type space_id page_no n_bits index db table txn_id lock_mode) } + = $lock + =~ m{^(RECORD|TABLE) LOCKS? (?:space id $d page no $d n bits $d index `?$n`? of )?table `$n(?:/|`\.`)$n` trx id $t lock.mode (\S+)}m; + ( $hash->{'special'} ) + = $lock =~ m/^(?:RECORD|TABLE) .*? locks (rec but not gap|gap before rec)/m; + $hash->{'insert_intention'} + = $lock =~ m/^(?:RECORD|TABLE) .*? insert intention/m ? 1 : 0; + $hash->{'waiting'} + = $lock =~ m/^(?:RECORD|TABLE) .*? waiting/m ? 1 : 0; + + # Some things may not be in the text, so make sure they are not + # undef. + map { $hash->{$_} ||= 0 } qw(n_bits page_no space_id); + map { $hash->{$_} ||= "" } qw(index special); + push @result, $hash; + } + + return @result; +} + +sub parse_tx_text { + my ( $txn, $complete, $debug, $full ) = @_; + + my ( $txn_id, $txn_status, $active_secs, $proc_no, $os_thread_id ) + = $txn + =~ m/^(?:---)?TRANSACTION $t, (\D*?)(?: $d sec)?, (?:process no $d, )?OS thread id $d/m; + my ( $thread_status, $thread_decl_inside ) + = $txn + =~ m/OS thread id \d+(?: ([^,]+?))?(?:, thread declared inside InnoDB $d)?$/m; + + # Parsing the line that begins 'MySQL thread id' is complicated. The only + # thing always in the line is the thread and query id. See function + # innobase_mysql_print_thd in InnoDB source file sql/ha_innodb.cc. + my ( $thread_line ) = $txn =~ m/^(MySQL thread id .*)$/m; + my ( $mysql_thread_id, $query_id, $hostname, $ip, $user, $query_status ); + + if ( $thread_line ) { + # These parts can always be gotten. + ( $mysql_thread_id, $query_id ) = $thread_line =~ m/^MySQL thread id $d, query id $d/m; + + # If it's a master/slave thread, "Has (read|sent) all" may be the thread's + # proc_info. In these cases, there won't be any host/ip/user info + ( $query_status ) = $thread_line =~ m/(Has (?:read|sent) all .*$)/m; + if ( defined($query_status) ) { + $user = 'system user'; + } + + # It may be the case that the query id is the last thing in the line. + elsif ( $thread_line =~ m/query id \d+ / ) { + # The IP address is the only non-word thing left, so it's the most + # useful marker for where I have to start guessing. + ( $hostname, $ip ) = $thread_line =~ m/query id \d+(?: ([A-Za-z]\S+))? $i/m; + if ( defined $ip ) { + ( $user, $query_status ) = $thread_line =~ m/$ip $w(?: (.*))?$/; + } + else { # OK, there wasn't an IP address. + # There might not be ANYTHING except the query status. + ( $query_status ) = $thread_line =~ m/query id \d+ (.*)$/; + if ( $query_status !~ m/^\w+ing/ && !exists($is_proc_info{$query_status}) ) { + # The remaining tokens are, in order: hostname, user, query_status. + # It's basically impossible to know which is which. + ( $hostname, $user, $query_status ) = $thread_line + =~ m/query id \d+(?: ([A-Za-z]\S+))?(?: $w(?: (.*))?)?$/m; + } + else { + $user = 'system user'; + } + } + } + } + + my ( $lock_wait_status, $lock_structs, $heap_size, $row_locks, $undo_log_entries ) + = $txn + =~ m/^(?:(\D*) )?$d lock struct\(s\), heap size $d(?:, $d row lock\(s\))?(?:, undo log entries $d)?$/m; + my ( $lock_wait_time ) + = $txn + =~ m/^------- TRX HAS BEEN WAITING $d SEC/m; + + my $locks; + # If the transaction has locks, grab the locks. + if ( $txn =~ m/^TABLE LOCK|RECORD LOCKS/ ) { + $locks = [parse_innodb_record_locks($txn, $complete, $debug, $full)]; + } + + my ( $tables_in_use, $tables_locked ) + = $txn + =~ m/^mysql tables in use $d, locked $d$/m; + my ( $txn_doesnt_see_ge, $txn_sees_lt ) + = $txn + =~ m/^Trx read view will not see trx with id >= $t, sees < $t$/m; + my $has_read_view = defined($txn_doesnt_see_ge); + # Only a certain number of bytes of the query text are included here, at least + # under some circumstances. Some versions include 300, some 600. + my ( $query_text ) + = $txn + =~ m{ + ^MySQL\sthread\sid\s[^\n]+\n # This comes before the query text + (.*?) # The query text + (?= # Followed by any of... + ^Trx\sread\sview + |^-------\sTRX\sHAS\sBEEN\sWAITING + |^TABLE\sLOCK + |^RECORD\sLOCKS\sspace\sid + |^(?:---)?TRANSACTION + |^\*\*\*\s\(\d\) + |\Z + ) + }xms; + if ( $query_text ) { + $query_text =~ s/\s+$//; + } + else { + $query_text = ''; + } + + my %stuff = ( + active_secs => $active_secs, + has_read_view => $has_read_view, + heap_size => $heap_size, + hostname => $hostname, + ip => $ip, + lock_structs => $lock_structs, + lock_wait_status => $lock_wait_status, + lock_wait_time => $lock_wait_time, + mysql_thread_id => $mysql_thread_id, + os_thread_id => $os_thread_id, + proc_no => $proc_no, + query_id => $query_id, + query_status => $query_status, + query_text => $query_text, + row_locks => $row_locks, + tables_in_use => $tables_in_use, + tables_locked => $tables_locked, + thread_decl_inside => $thread_decl_inside, + thread_status => $thread_status, + txn_doesnt_see_ge => $txn_doesnt_see_ge, + txn_id => $txn_id, + txn_sees_lt => $txn_sees_lt, + txn_status => $txn_status, + undo_log_entries => $undo_log_entries, + user => $user, + ); + $stuff{'fulltext'} = $txn if $debug; + $stuff{'locks'} = $locks if $locks; + + # Some things may not be in the txn text, so make sure they are not + # undef. + map { $stuff{$_} ||= 0 } qw(active_secs heap_size lock_structs + tables_in_use undo_log_entries tables_locked has_read_view + thread_decl_inside lock_wait_time proc_no row_locks); + map { $stuff{$_} ||= "" } qw(thread_status txn_doesnt_see_ge + txn_sees_lt query_status ip query_text lock_wait_status user); + $stuff{'hostname'} ||= $stuff{'ip'}; + + return \%stuff; +} + +sub parse_tx_section { + my ( $section, $complete, $debug, $full ) = @_; + return unless $section && $section->{'fulltext'}; + my $fulltext = $section->{'fulltext'}; + $section->{'transactions'} = []; + + # Handle the individual transactions + my @transactions = $fulltext =~ m/(---TRANSACTION \d.*?)(?=\n---TRANSACTION|$)/gs; + foreach my $txn ( @transactions ) { + my $stuff = parse_tx_text( $txn, $complete, $debug, $full ); + delete $stuff->{'fulltext'} unless $debug; + push @{$section->{'transactions'}}, $stuff; + } + + # Handle the general info + @{$section}{ 'trx_id_counter' } + = $fulltext =~ m/^Trx id counter $t$/m; + @{$section}{ 'purge_done_for', 'purge_undo_for' } + = $fulltext =~ m/^Purge done for trx's n:o < $t undo n:o < $t$/m; + @{$section}{ 'history_list_len' } # This isn't present in some 4.x versions + = $fulltext =~ m/^History list length $d$/m; + @{$section}{ 'num_lock_structs' } + = $fulltext =~ m/^Total number of lock structs in row lock hash table $d$/m; + @{$section}{ 'is_truncated' } + = $fulltext =~ m/^\.\.\. truncated\.\.\.$/m ? 1 : 0; + + # Fill in things that might not be present + foreach ( qw(history_list_len) ) { + $section->{$_} ||= 0; + } + + delete $section->{'fulltext'} unless $debug; + return 1; +} + +# I've read the source for this section. +sub parse_ro_section { + my ( $section, $complete, $debug, $full ) = @_; + return unless $section && $section->{'fulltext'}; + my $fulltext = $section->{'fulltext'}; + + # Grab the info + @{$section}{ 'queries_inside', 'queries_in_queue' } + = $fulltext =~ m/^$d queries inside InnoDB, $d queries in queue$/m; + ( $section->{ 'read_views_open' } ) + = $fulltext =~ m/^$d read views open inside InnoDB$/m; + ( $section->{ 'n_reserved_extents' } ) + = $fulltext =~ m/^$d tablespace extents now reserved for B-tree/m; + @{$section}{ 'main_thread_proc_no', 'main_thread_id', 'main_thread_state' } + = $fulltext =~ m/^Main thread (?:process no. $d, )?id $d, state: (.*)$/m; + @{$section}{ 'num_rows_ins', 'num_rows_upd', 'num_rows_del', 'num_rows_read' } + = $fulltext =~ m/^Number of rows inserted $d, updated $d, deleted $d, read $d$/m; + @{$section}{ 'ins_sec', 'upd_sec', 'del_sec', 'read_sec' } + = $fulltext =~ m#^$f inserts/s, $f updates/s, $f deletes/s, $f reads/s$#m; + $section->{'main_thread_proc_no'} ||= 0; + + map { $section->{$_} ||= 0 } qw(read_views_open n_reserved_extents); + delete $section->{'fulltext'} unless $debug; + return 1; +} + +sub parse_lg_section { + my ( $section, $complete, $debug, $full ) = @_; + return unless $section; + my $fulltext = $section->{'fulltext'}; + + # Grab the info + ( $section->{ 'log_seq_no' } ) + = $fulltext =~ m/Log sequence number \s*(\d.*)$/m; + ( $section->{ 'log_flushed_to' } ) + = $fulltext =~ m/Log flushed up to \s*(\d.*)$/m; + ( $section->{ 'last_chkp' } ) + = $fulltext =~ m/Last checkpoint at \s*(\d.*)$/m; + @{$section}{ 'pending_log_writes', 'pending_chkp_writes' } + = $fulltext =~ m/$d pending log writes, $d pending chkp writes/; + @{$section}{ 'log_ios_done', 'log_ios_s' } + = $fulltext =~ m#$d log i/o's done, $f log i/o's/second#; + + delete $section->{'fulltext'} unless $debug; + return 1; +} + +sub parse_ib_section { + my ( $section, $complete, $debug, $full ) = @_; + return unless $section && $section->{'fulltext'}; + my $fulltext = $section->{'fulltext'}; + + # Some servers will output ibuf information for tablespace 0, as though there + # might be many tablespaces with insert buffers. (In practice I believe + # the source code shows there will only ever be one). I have to parse both + # cases here, but I assume there will only be one. + @{$section}{ 'size', 'free_list_len', 'seg_size' } + = $fulltext =~ m/^Ibuf(?: for space 0)?: size $d, free list len $d, seg size $d,$/m; + @{$section}{ 'inserts', 'merged_recs', 'merges' } + = $fulltext =~ m/^$d inserts, $d merged recs, $d merges$/m; + + @{$section}{ 'hash_table_size', 'used_cells', 'bufs_in_node_heap' } + = $fulltext =~ m/^Hash table size $d, used cells $d, node heap has $d buffer\(s\)$/m; + @{$section}{ 'hash_searches_s', 'non_hash_searches_s' } + = $fulltext =~ m{^$f hash searches/s, $f non-hash searches/s$}m; + + delete $section->{'fulltext'} unless $debug; + return 1; +} + +sub parse_wait_array { + my ( $text, $complete, $debug, $full ) = @_; + my %result; + + @result{ qw(thread waited_at_filename waited_at_line waited_secs) } + = $text =~ m/^--Thread $d has waited at $fl for $f seconds/m; + + # Depending on whether it's a SYNC_MUTEX,RW_LOCK_EX,RW_LOCK_SHARED, + # there will be different text output + if ( $text =~ m/^Mutex at/m ) { + $result{'request_type'} = 'M'; + @result{ qw( lock_mem_addr lock_cfile_name lock_cline lock_var) } + = $text =~ m/^Mutex at $h created file $fl, lock var $d$/m; + @result{ qw( waiters_flag )} + = $text =~ m/^waiters flag $d$/m; + } + else { + @result{ qw( request_type lock_mem_addr lock_cfile_name lock_cline) } + = $text =~ m/^(.)-lock on RW-latch at $h created in file $fl$/m; + @result{ qw( writer_thread writer_lock_mode ) } + = $text =~ m/^a writer \(thread id $d\) has reserved it in mode (.*)$/m; + @result{ qw( num_readers waiters_flag )} + = $text =~ m/^number of readers $d, waiters flag $d$/m; + @result{ qw(last_s_file_name last_s_line ) } + = $text =~ m/Last time read locked in file $fl$/m; + @result{ qw(last_x_file_name last_x_line ) } + = $text =~ m/Last time write locked in file $fl$/m; + } + + $result{'cell_waiting'} = $text =~ m/^wait has ended$/m ? 0 : 1; + $result{'cell_event_set'} = $text =~ m/^wait is ending$/m ? 1 : 0; + + # Because there are two code paths, some things won't get set. + map { $result{$_} ||= '' } + qw(last_s_file_name last_x_file_name writer_lock_mode); + map { $result{$_} ||= 0 } + qw(num_readers lock_var last_s_line last_x_line writer_thread); + + return \%result; +} + +sub parse_sm_section { + my ( $section, $complete, $debug, $full ) = @_; + return 0 unless $section && $section->{'fulltext'}; + my $fulltext = $section->{'fulltext'}; + + # Grab the info + @{$section}{ 'reservation_count', 'signal_count' } + = $fulltext =~ m/^OS WAIT ARRAY INFO: reservation count $d, signal count $d$/m; + @{$section}{ 'mutex_spin_waits', 'mutex_spin_rounds', 'mutex_os_waits' } + = $fulltext =~ m/^Mutex spin waits $d, rounds $d, OS waits $d$/m; + @{$section}{ 'rw_shared_spins', 'rw_shared_os_waits', 'rw_excl_spins', 'rw_excl_os_waits' } + = $fulltext =~ m/^RW-shared spins $d, OS waits $d; RW-excl spins $d, OS waits $d$/m; + + # Look for info on waits. + my @waits = $fulltext =~ m/^(--Thread.*?)^(?=Mutex spin|--Thread)/gms; + $section->{'waits'} = [ map { parse_wait_array($_, $complete, $debug) } @waits ]; + $section->{'wait_array_size'} = scalar(@waits); + + delete $section->{'fulltext'} unless $debug; + return 1; +} + +# I've read the source for this section. +sub parse_bp_section { + my ( $section, $complete, $debug, $full ) = @_; + return unless $section && $section->{'fulltext'}; + my $fulltext = $section->{'fulltext'}; + + # Grab the info + @{$section}{ 'total_mem_alloc', 'add_pool_alloc' } + = $fulltext =~ m/^Total memory allocated $d; in additional pool allocated $d$/m; + @{$section}{'dict_mem_alloc'} = $fulltext =~ m/Dictionary memory allocated $d/; + @{$section}{'awe_mem_alloc'} = $fulltext =~ m/$d MB of AWE memory/; + @{$section}{'buf_pool_size'} = $fulltext =~ m/^Buffer pool size\s*$d$/m; + @{$section}{'buf_free'} = $fulltext =~ m/^Free buffers\s*$d$/m; + @{$section}{'pages_total'} = $fulltext =~ m/^Database pages\s*$d$/m; + @{$section}{'pages_modified'} = $fulltext =~ m/^Modified db pages\s*$d$/m; + @{$section}{'pages_read', 'pages_created', 'pages_written'} + = $fulltext =~ m/^Pages read $d, created $d, written $d$/m; + @{$section}{'page_reads_sec', 'page_creates_sec', 'page_writes_sec'} + = $fulltext =~ m{^$f reads/s, $f creates/s, $f writes/s$}m; + @{$section}{'buf_pool_hits', 'buf_pool_reads'} + = $fulltext =~ m{Buffer pool hit rate $d / $d$}m; + if ($fulltext =~ m/^No buffer pool page gets since the last printout$/m) { + @{$section}{'buf_pool_hits', 'buf_pool_reads'} = (0, 0); + @{$section}{'buf_pool_hit_rate'} = '--'; + } + else { + @{$section}{'buf_pool_hit_rate'} + = $fulltext =~ m{Buffer pool hit rate (\d+ / \d+)$}m; + } + @{$section}{'reads_pending'} = $fulltext =~ m/^Pending reads $d/m; + @{$section}{'writes_pending_lru', 'writes_pending_flush_list', 'writes_pending_single_page' } + = $fulltext =~ m/^Pending writes: LRU $d, flush list $d, single page $d$/m; + + map { $section->{$_} ||= 0 } + qw(writes_pending_lru writes_pending_flush_list writes_pending_single_page + awe_mem_alloc dict_mem_alloc); + @{$section}{'writes_pending'} = List::Util::sum( + @{$section}{ qw(writes_pending_lru writes_pending_flush_list writes_pending_single_page) }); + + delete $section->{'fulltext'} unless $debug; + return 1; +} + +# I've read the source for this. +sub parse_io_section { + my ( $section, $complete, $debug, $full ) = @_; + return unless $section && $section->{'fulltext'}; + my $fulltext = $section->{'fulltext'}; + $section->{'threads'} = {}; + + # Grab the I/O thread info + my @threads = $fulltext =~ m<^(I/O thread \d+ .*)$>gm; + foreach my $thread (@threads) { + my ( $tid, $state, $purpose, $event_set ) + = $thread =~ m{I/O thread $d state: (.+?) \((.*)\)(?: ev set)?$}m; + if ( defined $tid ) { + $section->{'threads'}->{$tid} = { + thread => $tid, + state => $state, + purpose => $purpose, + event_set => $event_set ? 1 : 0, + }; + } + } + + # Grab the reads/writes/flushes info + @{$section}{ 'pending_normal_aio_reads', 'pending_aio_writes' } + = $fulltext =~ m/^Pending normal aio reads: $d, aio writes: $d,$/m; + @{$section}{ 'pending_ibuf_aio_reads', 'pending_log_ios', 'pending_sync_ios' } + = $fulltext =~ m{^ ibuf aio reads: $d, log i/o's: $d, sync i/o's: $d$}m; + @{$section}{ 'flush_type', 'pending_log_flushes', 'pending_buffer_pool_flushes' } + = $fulltext =~ m/^Pending flushes \($w\) log: $d; buffer pool: $d$/m; + @{$section}{ 'os_file_reads', 'os_file_writes', 'os_fsyncs' } + = $fulltext =~ m/^$d OS file reads, $d OS file writes, $d OS fsyncs$/m; + @{$section}{ 'reads_s', 'avg_bytes_s', 'writes_s', 'fsyncs_s' } + = $fulltext =~ m{^$f reads/s, $d avg bytes/read, $f writes/s, $f fsyncs/s$}m; + @{$section}{ 'pending_preads', 'pending_pwrites' } + = $fulltext =~ m/$d pending preads, $d pending pwrites$/m; + @{$section}{ 'pending_preads', 'pending_pwrites' } = (0, 0) + unless defined($section->{'pending_preads'}); + + delete $section->{'fulltext'} unless $debug; + return 1; +} + +sub _debug { + my ( $debug, $msg ) = @_; + if ( $debug ) { + die $msg; + } + else { + warn $msg; + } + return 1; +} + +1; + +# end_of_package +# ############################################################################ +# Perldoc section. I put this last as per the Dog book. +# ############################################################################ +=pod + +=head1 NAME + +InnoDBParser - Parse InnoDB monitor text. + +=head1 DESCRIPTION + +InnoDBParser tries to parse the output of the InnoDB monitor. One way to get +this output is to connect to a MySQL server and issue the command SHOW ENGINE +INNODB STATUS (omit 'ENGINE' on earlier versions of MySQL). The goal is to +turn text into data that something else (e.g. innotop) can use. + +The output comes from all over, but the place to start in the source is +innobase/srv/srv0srv.c. + +=head1 SYNOPSIS + + use InnoDBParser; + use DBI; + + # Get the status text. + my $dbh = DBI->connect( + "DBI::mysql:test;host=localhost", + 'user', + 'password' + ); + my $query = 'SHOW /*!5 ENGINE */ INNODB STATUS'; + my $text = $dbh->selectcol_arrayref($query)->[0]; + + # 1 or 0 + my $debug = 1; + + # Choose sections of the monitor text you want. Possible values: + # TRANSACTIONS => tx + # BUFFER POOL AND MEMORY => bp + # SEMAPHORES => sm + # LOG => lg + # ROW OPERATIONS => ro + # INSERT BUFFER AND ADAPTIVE HASH INDEX => ib + # FILE I/O => io + # LATEST DETECTED DEADLOCK => dl + # LATEST FOREIGN KEY ERROR => fk + + my $required_sections = { + tx => 1, + }; + + # Parse the status text. + my $parser = InnoDBParser->new; + $innodb_status = $parser->parse_status_text( + $text, + $debug, + # Omit the following parameter to get all sections. + $required_sections, + ); + +=head1 COPYRIGHT, LICENSE AND WARRANTY + +This package is copyright (c) 2006 Baron Schwartz, baron at xaprb dot com. +Feedback and improvements are gratefully received. + +THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, version 2; OR the Perl Artistic License. On UNIX and similar +systems, you can issue `man perlgpl' or `man perlartistic' to read these +licenses. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA + +=head1 AUTHOR + +Baron Schwartz, baron at xaprb dot com. + +=head1 BUGS + +None known, but I bet there are some. The InnoDB monitor text wasn't really +designed to be parsable. + +=head1 SEE ALSO + +innotop - a program that can format the parsed status information for humans +to read and enjoy. + +=cut diff --git a/storage/xtradb/build/debian/additions/innotop/changelog.innotop b/storage/xtradb/build/debian/additions/innotop/changelog.innotop new file mode 100644 index 00000000000..baff706e235 --- /dev/null +++ b/storage/xtradb/build/debian/additions/innotop/changelog.innotop @@ -0,0 +1,318 @@ +Changelog for innotop and InnoDBParser: + +2007-11-09: version 1.6.0 + + * S mode crashed on non-numeric values. + * New user-defined columns crashed upon restart. + * Added --color option to control terminal coloring. + +2007-09-18: version 1.5.2 + + * Added the ability to monitor InnoDB status from a file. + * Changed W mode to L mode; it monitors all locks, not just lock waits. + +2007-09-16: version 1.5.1 + + * Added C (Command Summary) mode. + * Fixed a bug in the 'avg' aggregate function. + +2007-09-10: version 1.5.0 + + Changes: + * Added plugin functionality. + * Added group-by functionality. + * Moved the configuration file to a directory. + * Enhanced filtering and sorting on pivoted tables. + * Many small bug fixes. + +2007-07-16: version 1.4.3 + + Changes: + * Added standard --version command-line option + * Changed colors to cyan instead of blue; more visible on dark terminals. + * Added information to the filter-choosing dialog. + * Added column auto-completion when entering a filter expression. + * Changed Term::ReadKey from optional to mandatory. + * Clarified username in password prompting. + * Ten thousand words of documentation! + + Bugs fixed: + * innotop crashed in W mode when InnoDB status data was truncated. + * innotop didn't display errors in tables if debug was enabled. + * The colored() subroutine wasn't being created in non-interactive mode. + * Don't prompt to save password except the first time. + +2007-05-03: version 1.4.2 + + This version contains all changes to the trunk until revision 239; some + changes in revisions 240:250 are included. + + MAJOR CHANGES: + + * Quick-filters to easily filter any column in any display + * Compatibility with MySQL 3.23 through 6.0 + * Improved error handling when a server is down, permissions denied, etc + * Use additional SHOW INNODB STATUS information in 5.1.x + * Make all modes use tables consistently, so they can all be edited, + filtered, colored and sorted consistently + * Combine V, G and S modes into S mode, with v, g, and s hot-keys + * Let DBD driver read MySQL option files; permit connections without + user/pass/etc + * Compile SQL-like expressions into Perl subroutines; eliminate need to + know Perl + * Do not save all config data to config file, only save user's customizations + * Rewritten and improved command-line option handling + * Added --count, --delay, and other command-line options to support + run-and-exit operation + * Improve built-in variable sets + * Improve help screen with three-part balanced-column layout + * Simplify table-editor and improve hotkey support + * Require Perl to have high-resolution time support (Time::HiRes) + * Help the user choose a query to analyze or kill + * Enable EXPLAIN, show-full-query in T mode just like Q mode + * Let data-extraction access current, previous and incremental data sets + all at once + + MINOR CHANGES: + + * Column stabilizing for Q mode + * New color rules for T, Q, W modes + * Apply slave I/O filter to Q mode + * Improve detection of server version and other meta-data + * Make connection timeout a config variable + * Improve cross-version-compatible SQL syntax + * Get some information from the DBD driver instead of asking MySQL for it + * Improved error messages + * Improve server group creation/editing + * Improve connection/thread killing + * Fix broken key bindings and restore previously mapped hot-keys for + choosing columns + * Some documentation updates (but not nearly enough) + * Allow the user to specify graphing char in S mode (formerly G mode) + * Allow easy switching between variable sets in S mode + * Bind 'n' key globally to choose the 'next' server connection + * Bind '%' key globally to filter displayed tables + * Allow aligning columns on the decimal place for easy readability + * Add hide_hdr config variable to hide column headers in tables + * Add a feature to smartly run PURGE MASTER LOGS in Replication mode + * Enable debug mode as a globally configurable variable + * Improve error messages when an expression or filter doesn't compile or has + a run-time error; die on error when debug is enabled + * Allow user-configurable delays after executing SQL (to let the server + settle down before taking another measurement) + * Add an expression to show how long until a transaction is finished + * Add skip_innodb as a global config variable + * Add '%' after percentages to help disambiguate (user-configurable) + * Add column to M mode to help see how fast slave is catching up to master + + BUG FIXES: + + * T and W modes had wrong value for wait_status column + * Error tracking on connections didn't reset when the connection recovered + * wait_timeout on connections couldn't be set before MySQL 4.0.3 + * There was a crash on 3.23 when wiping deadlocks + * Lettercase changes in some result sets (SHOW MASTER/SLAVE STATUS) between + MySQL versions crashed innotop + * Inactive connections crashed innotop upon access to DBD driver + * set_precision did not respect user defaults for number of digits + * --inc command-line option could not be negated + * InnoDB status parsing was not always parsing all needed information + * S mode (formerly G mode) could crash trying to divide non-numeric data + * M table didn't show Slave_open_temp_tables variable; incorrect lettercase + * DBD drivers with broken AutoCommit would crash innotop + * Some key bindings had incorrect labels + * Some config-file loading routines could load data for things that didn't + exist + * Headers printed too often in S mode + * High-resolution time was not used even when the user had it + * Non-interactive mode printed blank lines sometimes + * Q-mode header and statusbar showed different QPS numbers + * Formulas for key-cache and query-cache hit ratios were wrong + * Mac OS "Darwin" machines were mis-identified as Microsoft Windows + * Some multiplications crashed when given undefined input + * The commify transformation did not check its input and could crash + * Specifying an invalid mode on the command line or config file could crash + innotop + +2007-03-29: version 1.4.1 + + * More tweaks to display of connection errors. + * Fixed a problem with skip-innodb in MySQL 5.1. + * Fix a bug with dead connections in single-connection mode. + * Fix a regex to allow parsing more data from truncated deadlocks. + * Don't load active cxns from the config file if the cxn isn't defined. + +2007-03-03: version 1.4.0 + + * Further tweak error handling and display of connection errors + * More centralization of querying + * Fix forking so it doesn't kill all database connections + * Allow user to run innotop without permissions for GLOBAL variables and status + +2007-02-11: version 1.3.6 + + * Handle some connection failures so innotop doesn't crash because of one server. + * Enable incremental display in more modes. + * Tweaks to colorizing, color editor, and default color rules. + * Tweaks to default sorting rules. + * Use prepared statements for efficiency. + * Bug fixes and code cleanups. + * Data storage is keyed on clock ticks now. + +2007-02-03: version 1.3.5 + + * Bug fixes. + * More tools for editing configuration from within innotop. + * Filters and transformations are constrained to valid values. + * Support for colorizing rows. + * Sorting by multiple columns. + * Compress headers when display is very wide. + * Stabilize and limit column widths. + * Check config file formats when upgrading so upgrades go smoothly. + * Make D mode handle many connections at once. + * Extract simple expressions from data sets in column src property. + This makes innotop more awk-ish. + +2007-01-16: version 1.3 + + * Readline support. + * Can be used unattended, or in a pipe-and-filter mode + where it outputs tab-separated data to standard output. + * You can specify a config file on the command line. + Config files can be marked read-only. + * Monitor multiple servers simultaneously. + * Server groups to help manage many servers conveniently. + * Monitor master/slave status, and control slaves. + * Columns can have user-defined expressions as their data sources. + * Better configuration tools. + * InnoDB status information is merged into SHOW VARIABLES and + SHOW STATUS information, so you can access it all together. + * High-precision time support in more places. + * Lots of tweaks to make things display more readably and compactly. + * Column transformations and filters. + +2007-01-16: version 1.0.1 + * NOTE: innotop is now hosted at Sourceforge, in Subversion not CVS. + The new project homepage is http://sourceforge.net/projects/innotop/ + * Tweak default T/Q mode sort columns to match what people expect. + * Fix broken InnoDBParser.pm documentation (and hence man page). + +2007-01-06: version 1.0 + * NOTE: innotop is now hosted at Sourceforge, in Subversion not CVS. + The new project homepage is http://sourceforge.net/projects/innotop/ + * Prevent control characters from freaking terminal out. + * Set timeout to keep busy servers from closing connection. + * There is only one InnoDB insert buffer. + * Make licenses clear and consistent. + +2006-11-14: innotop 0.1.160, InnoDBParser version 1.69 + * Support for ANSI color on Microsoft Windows (more readable, compact + display; thanks Gisbert W. Selke). + * Better handling of $ENV{HOME} on Windows. + * Added a LICENSE file to the package as per Gentoo bug: + http://bugs.gentoo.org/show_bug.cgi?id=147600 + +2006-11-11: innotop 0.1.157, InnoDBParser version 1.69 + * Add Microsoft Windows support. + +2006-10-19: innotop 0.1.154, InnoDBParser version 1.69 + * Add O (Open Tables) mode + * Add some more checks to handle incomplete InnoDB status information + +2006-09-30: innotop 0.1.152, InnoDBParser version 1.69 + * Figured out what was wrong with package $VERSION variable: it wasn't + after the package declaration! + +2006-09-28: innotop 0.1.152, InnoDBParser version 1.67 + * Make more efforts towards crash-resistance and tolerance of completely + messed-up inputs. If innotop itself is broken, it is now much harder to + tell, because it just keeps on running without complaining. + * Fix a small bug parsing out some information and displaying it. + +2006-09-05: innotop 0.1.149, InnoDBParser version 1.64 + * Try to find and eliminate any parsing code that assumes pattern matches + will succeed. + +2006-09-05: innotop 0.1.149, InnoDBParser version 1.62 + * Make innotop crash-resistant, so I can declare it STABLE finally. + * Instead of using SQL conditional comments, detect MySQL version. + +2006-08-22: innotop 0.1.147, InnoDBParser version 1.60 + * Fix some innotop bugs with undefined values, bad formatting etc. + +2006-08-19: innotop 0.1.146, InnoDBParser version 1.60 + * Make innotop handle some unexpected NULL values in Q mode. + * Add OS wait information to W mode, so it is now "everything that waits." + * Center section captions better. + * Make R mode more readable and compact. + * Make InnoDBParser parse lock waits even when they've been waiting 0 secs. + +2006-08-12: innotop 0.1.139, InnoDBParser version 1.59 + * Add more documentation + * Tweak V mode to show more info in less space. + * Fix a bug in G mode. + +2006-08-10: innotop 0.1.132, InnoDBParser version 1.58 + * Handle yet more types of FK error... it will never end! + * Handle some special cases when DEADLOCK info truncated + * Add a bit more FK info to F mode in innotop + * More tests added to the test suite + +2006-08-07: innotop 0.1.131, InnoDBParser version 1.55 + * Fix another issue with configuration + * Handle another type of FK error + +2006-08-03: innotop 0.1.130, InnoDBParser version 1.54 + * Fix an issue loading config file + * Add heap_no to 'D' (InnoDB Deadlock) mode to ease deadlock debugging. + +2006-08-02: innotop 0.1.128, InnoDBParser version 1.54 + * Parse lock wait information from the TRANSACTION section. + * Even more OS-specific parsing... pain in the butt... + * Add 'W' (InnoDB Lock Wait) mode. + * Fix some minor display issues with statusbar. + +2006-08-02: innotop 0.1.125, InnoDBParser version 1.50 + * Don't try to get references to Perl built-in functions like time() + * Handle more OS-specific variations of InnoDB status text + * Add some more information to various places in innotop + +2006-08-01: innotop 0.1.123, InnoDBParser version 1.47 + + * Enhance S and G modes: clear screen and re-print headers + * Don't crash when deadlock data is truncated + * Make Analyze mode say how to get back to whatever you came from + * Display 'nothing to display' when there is nothing + * Add ability to read InnoDB status text from a file (mostly helps test) + * Add table of Wait Array Information in Row Op/Semaphore mode + * Add table of lock information in InnoDB deadlock mode + * Ensure new features in upgrades don't get masked by existing config files + * Tweak default column choices for T mode + * Enhance foreign key parsing + * Enhance physical record and data tuple parsing + * Enhance lock parsing (handle old-style and new-style formats) + +2006-07-24: innotop 0.1.112, InnoDBParser version 1.36 + + * InnoDBParser enhancements for FK error messages. + * A fix to innotop to prevent it from crashing while trying to display a FK + error message. + * Some minor cosmetic changes to number formatting in innotop. + +2006-07-22: innotop 0.1.106, InnoDBParser version 1.35 + + * InnoDBParser is much more complete and accurate. + * Tons of bug fixes. + * Add partitions to EXPLAIN mode. + * Enhance Q mode header, add T mode header. + * Share some configuration variables across modes. + * Add formatted time columns to Q, T modes. + * Add command-line argument parsing. + * Turn off echo when asking for password. + * Add option to specify port when connecting. + * Let display-optimized-query display multiple notes. + * Lots of small improvements, such as showing more info in statusbar. + +2006-07-02: innotop 0.1.74, InnoDBParser version 1.24 + + * Initial release for public consumption. diff --git a/storage/xtradb/build/debian/additions/innotop/innotop b/storage/xtradb/build/debian/additions/innotop/innotop new file mode 100644 index 00000000000..e2bfc1bd965 --- /dev/null +++ b/storage/xtradb/build/debian/additions/innotop/innotop @@ -0,0 +1,9485 @@ +#!/usr/bin/perl + +# vim: tw=160:nowrap:expandtab:tabstop=3:shiftwidth=3:softtabstop=3 + +use strict; +use warnings FATAL => 'all'; +use sigtrap qw(handler finish untrapped normal-signals); + +use Data::Dumper; +use DBI; +use English qw(-no_match_vars); +use File::Basename qw(dirname); +use Getopt::Long; +use List::Util qw(max min maxstr sum); +use InnoDBParser; +use POSIX qw(ceil); +use Time::HiRes qw(time sleep); +use Term::ReadKey qw(ReadMode ReadKey); + +# Version, license and warranty information. {{{1 +# ########################################################################### +our $VERSION = '1.6.0'; +our $SVN_REV = sprintf("%d", q$Revision: 383 $ =~ m/(\d+)/g); +our $SVN_URL = sprintf("%s", q$URL: https://innotop.svn.sourceforge.net/svnroot/innotop/trunk/innotop $ =~ m$svnroot/innotop/(\S+)$g); + +my $innotop_license = <<"LICENSE"; + +This is innotop version $VERSION, a MySQL and InnoDB monitor. + +This program is copyright (c) 2006 Baron Schwartz. +Feedback and improvements are welcome. + +THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, version 2; OR the Perl Artistic License. On UNIX and similar +systems, you can issue `man perlgpl' or `man perlartistic' to read these +licenses. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA. +LICENSE + +# Configuration information and global setup {{{1 +# ########################################################################### + +# Really, really, super-global variables. +my @config_versions = ( + "000-000-000", "001-003-000", # config file was one big name-value hash. + "001-003-000", "001-004-002", # config file contained non-user-defined stuff. +); + +my $clear_screen_sub; + +# This defines expected properties and defaults for the column definitions that +# eventually end up in tbl_meta. +my %col_props = ( + hdr => '', + just => '-', + dec => 0, # Whether to align the column on the decimal point + num => 0, + label => '', + user => 0, + src => '', + tbl => '', # Helps when writing/reading custom columns in config files + minw => 0, + maxw => 0, + trans => [], + agg => 'first', # Aggregate function + aggonly => 0, # Whether to show only when tbl_meta->{aggregate} is true +); + +# Actual DBI connections to MySQL servers. +my %dbhs; + +# Command-line parameters {{{2 +# ########################################################################### + +my @opt_spec = ( + { s => 'help', d => 'Show this help message' }, + { s => 'color|C!', d => 'Use terminal coloring (default)', c => 'color' }, + { s => 'config|c=s', d => 'Config file to read' }, + { s => 'nonint|n', d => 'Non-interactive, output tab-separated fields' }, + { s => 'count=i', d => 'Number of updates before exiting' }, + { s => 'delay|d=f', d => 'Delay between updates in seconds', c => 'interval' }, + { s => 'mode|m=s', d => 'Operating mode to start in', c => 'mode' }, + { s => 'inc|i!', d => 'Measure incremental differences', c => 'status_inc' }, + { s => 'version', d => 'Output version information and exit' }, +); + +# This is the container for the command-line options' values to be stored in +# after processing. Initial values are defaults. +my %opts = ( + n => !( -t STDIN && -t STDOUT ), # If in/out aren't to terminals, we're interactive +); +# Post-process... +my %opt_seen; +foreach my $spec ( @opt_spec ) { + my ( $long, $short ) = $spec->{s} =~ m/^(\w+)(?:\|([^!+=]*))?/; + $spec->{k} = $short || $long; + $spec->{l} = $long; + $spec->{t} = $short; + $spec->{n} = $spec->{s} =~ m/!/; + $opts{$spec->{k}} = undef unless defined $opts{$spec->{k}}; + die "Duplicate option $spec->{k}" if $opt_seen{$spec->{k}}++; +} + +Getopt::Long::Configure('no_ignore_case', 'bundling'); +GetOptions( map { $_->{s} => \$opts{$_->{k}} } @opt_spec) or $opts{help} = 1; + +if ( $opts{version} ) { + print "innotop Ver $VERSION Changeset $SVN_REV from $SVN_URL\n"; + exit(0); +} + +if ( $opts{'help'} ) { + print "Usage: innotop <options> <innodb-status-file>\n\n"; + my $maxw = max(map { length($_->{l}) + ($_->{n} ? 4 : 0)} @opt_spec); + foreach my $spec ( sort { $a->{l} cmp $b->{l} } @opt_spec ) { + my $long = $spec->{n} ? "[no]$spec->{l}" : $spec->{l}; + my $short = $spec->{t} ? "-$spec->{t}" : ''; + printf(" --%-${maxw}s %-4s %s\n", $long, $short, $spec->{d}); + } + print <<USAGE; + +innotop is a MySQL and InnoDB transaction/status monitor, like 'top' for +MySQL. It displays queries, InnoDB transactions, lock waits, deadlocks, +foreign key errors, open tables, replication status, buffer information, +row operations, logs, I/O operations, load graph, and more. You can +monitor many servers at once with innotop. + +USAGE + exit(1); +} + +# Meta-data (table definitions etc) {{{2 +# ########################################################################### + +# Expressions {{{3 +# Convenience so I can copy/paste these in several places... +# ########################################################################### +my %exprs = ( + Host => q{my $host = host || hostname || ''; ($host) = $host =~ m/^((?:[\d.]+(?=:))|(?:[a-zA-Z]\w+))/; return $host || ''}, + Port => q{my ($p) = host =~ m/:(.*)$/; return $p || 0}, + OldVersions => q{dulint_to_int(IB_tx_trx_id_counter) - dulint_to_int(IB_tx_purge_done_for)}, + MaxTxnTime => q/max(map{ $_->{active_secs} } @{ IB_tx_transactions }) || 0/, + NumTxns => q{scalar @{ IB_tx_transactions } }, + DirtyBufs => q{ $cur->{IB_bp_pages_modified} / ($cur->{IB_bp_buf_pool_size} || 1) }, + BufPoolFill => q{ $cur->{IB_bp_pages_total} / ($cur->{IB_bp_buf_pool_size} || 1) }, + ServerLoad => q{ $cur->{Threads_connected}/(Questions||1)/Uptime_hires }, + TxnTimeRemain => q{ defined undo_log_entries && defined $pre->{undo_log_entries} && undo_log_entries < $pre->{undo_log_entries} ? undo_log_entries / (($pre->{undo_log_entries} - undo_log_entries)/((active_secs-$pre->{active_secs})||1))||1 : 0}, + SlaveCatchupRate => ' defined $cur->{seconds_behind_master} && defined $pre->{seconds_behind_master} && $cur->{seconds_behind_master} < $pre->{seconds_behind_master} ? ($pre->{seconds_behind_master}-$cur->{seconds_behind_master})/($cur->{Uptime_hires}-$pre->{Uptime_hires}) : 0', + QcacheHitRatio => q{(Qcache_hits||0)/(((Com_select||0)+(Qcache_hits||0))||1)}, +); + +# ########################################################################### +# Column definitions {{{3 +# Defines every column in every table. A named column has the following +# properties: +# * hdr Column header/title +# * label Documentation for humans. +# * num Whether it's numeric (for sorting). +# * just Alignment; generated from num, user-overridable in tbl_meta +# * minw, maxw Auto-generated, user-overridable. +# Values from this hash are just copied to tbl_meta, which is where everything +# else in the program should read from. +# ########################################################################### + +my %columns = ( + active_secs => { hdr => 'SecsActive', num => 1, label => 'Seconds transaction has been active', }, + add_pool_alloc => { hdr => 'Add\'l Pool', num => 1, label => 'Additonal pool allocated' }, + attempted_op => { hdr => 'Action', num => 0, label => 'The action that caused the error' }, + awe_mem_alloc => { hdr => 'AWE Memory', num => 1, label => '[Windows] AWE memory allocated' }, + binlog_cache_overflow => { hdr => 'Binlog Cache', num => 1, label => 'Transactions too big for binlog cache that went to disk' }, + binlog_do_db => { hdr => 'Binlog Do DB', num => 0, label => 'binlog-do-db setting' }, + binlog_ignore_db => { hdr => 'Binlog Ignore DB', num => 0, label => 'binlog-ignore-db setting' }, + bps_in => { hdr => 'BpsIn', num => 1, label => 'Bytes per second received by the server', }, + bps_out => { hdr => 'BpsOut', num => 1, label => 'Bytes per second sent by the server', }, + buf_free => { hdr => 'Free Bufs', num => 1, label => 'Buffers free in the buffer pool' }, + buf_pool_hit_rate => { hdr => 'Hit Rate', num => 0, label => 'Buffer pool hit rate' }, + buf_pool_hits => { hdr => 'Hits', num => 1, label => 'Buffer pool hits' }, + buf_pool_reads => { hdr => 'Reads', num => 1, label => 'Buffer pool reads' }, + buf_pool_size => { hdr => 'Size', num => 1, label => 'Buffer pool size' }, + bufs_in_node_heap => { hdr => 'Node Heap Bufs', num => 1, label => 'Buffers in buffer pool node heap' }, + bytes_behind_master => { hdr => 'ByteLag', num => 1, label => 'Bytes the slave lags the master in binlog' }, + cell_event_set => { hdr => 'Ending?', num => 1, label => 'Whether the cell event is set' }, + cell_waiting => { hdr => 'Waiting?', num => 1, label => 'Whether the cell is waiting' }, + child_db => { hdr => 'Child DB', num => 0, label => 'The database of the child table' }, + child_index => { hdr => 'Child Index', num => 0, label => 'The index in the child table' }, + child_table => { hdr => 'Child Table', num => 0, label => 'The child table' }, + cmd => { hdr => 'Cmd', num => 0, label => 'Type of command being executed', }, + cnt => { hdr => 'Cnt', num => 0, label => 'Count', agg => 'count', aggonly => 1 }, + connect_retry => { hdr => 'Connect Retry', num => 1, label => 'Slave connect-retry timeout' }, + cxn => { hdr => 'CXN', num => 0, label => 'Connection from which the data came', }, + db => { hdr => 'DB', num => 0, label => 'Current database', }, + dict_mem_alloc => { hdr => 'Dict Mem', num => 1, label => 'Dictionary memory allocated' }, + dirty_bufs => { hdr => 'Dirty Buf', num => 1, label => 'Dirty buffer pool pages' }, + dl_txn_num => { hdr => 'Num', num => 0, label => 'Deadlocked transaction number', }, + event_set => { hdr => 'Evt Set?', num => 1, label => '[Win32] if a wait event is set', }, + exec_master_log_pos => { hdr => 'Exec Master Log Pos', num => 1, label => 'Exec Master Log Position' }, + fk_name => { hdr => 'Constraint', num => 0, label => 'The name of the FK constraint' }, + free_list_len => { hdr => 'Free List Len', num => 1, label => 'Length of the free list' }, + has_read_view => { hdr => 'Rd View', num => 1, label => 'Whether the transaction has a read view' }, + hash_searches_s => { hdr => 'Hash/Sec', num => 1, label => 'Number of hash searches/sec' }, + hash_table_size => { hdr => 'Size', num => 1, label => 'Number of non-hash searches/sec' }, + heap_no => { hdr => 'Heap', num => 1, label => 'Heap number' }, + heap_size => { hdr => 'Heap', num => 1, label => 'Heap size' }, + history_list_len => { hdr => 'History', num => 1, label => 'History list length' }, + host_and_domain => { hdr => 'Host', num => 0, label => 'Hostname/IP and domain' }, + host_and_port => { hdr => 'Host/IP', num => 0, label => 'Hostname or IP address, and port number', }, + hostname => { hdr => 'Host', num => 0, label => 'Hostname' }, + index => { hdr => 'Index', num => 0, label => 'The index involved' }, + index_ref => { hdr => 'Index Ref', num => 0, label => 'Index referenced' }, + info => { hdr => 'Query', num => 0, label => 'Info or the current query', }, + insert_intention => { hdr => 'Ins Intent', num => 1, label => 'Whether the thread was trying to insert' }, + inserts => { hdr => 'Inserts', num => 1, label => 'Inserts' }, + io_bytes_s => { hdr => 'Bytes/Sec', num => 1, label => 'Average I/O bytes/sec' }, + io_flush_type => { hdr => 'Flush Type', num => 0, label => 'I/O Flush Type' }, + io_fsyncs_s => { hdr => 'fsyncs/sec', num => 1, label => 'I/O fsyncs/sec' }, + io_reads_s => { hdr => 'Reads/Sec', num => 1, label => 'Average I/O reads/sec' }, + io_writes_s => { hdr => 'Writes/Sec', num => 1, label => 'Average I/O writes/sec' }, + ip => { hdr => 'IP', num => 0, label => 'IP address' }, + is_name_locked => { hdr => 'Locked', num => 1, label => 'Whether table is name locked', }, + key_buffer_hit => { hdr => 'KCacheHit', num => 1, label => 'Key cache hit ratio', }, + key_len => { hdr => 'Key Length', num => 1, label => 'Number of bytes used in the key' }, + last_chkp => { hdr => 'Last Checkpoint', num => 0, label => 'Last log checkpoint' }, + last_errno => { hdr => 'Last Errno', num => 1, label => 'Last error number' }, + last_error => { hdr => 'Last Error', num => 0, label => 'Last error' }, + last_s_file_name => { hdr => 'S-File', num => 0, label => 'Filename where last read locked' }, + last_s_line => { hdr => 'S-Line', num => 1, label => 'Line where last read locked' }, + last_x_file_name => { hdr => 'X-File', num => 0, label => 'Filename where last write locked' }, + last_x_line => { hdr => 'X-Line', num => 1, label => 'Line where last write locked' }, + last_pct => { hdr => 'Pct', num => 1, label => 'Last Percentage' }, + last_total => { hdr => 'Last Total', num => 1, label => 'Last Total' }, + last_value => { hdr => 'Last Incr', num => 1, label => 'Last Value' }, + load => { hdr => 'Load', num => 1, label => 'Server load' }, + lock_cfile_name => { hdr => 'Crtd File', num => 0, label => 'Filename where lock created' }, + lock_cline => { hdr => 'Crtd Line', num => 1, label => 'Line where lock created' }, + lock_mem_addr => { hdr => 'Addr', num => 0, label => 'The lock memory address' }, + lock_mode => { hdr => 'Mode', num => 0, label => 'The lock mode' }, + lock_structs => { hdr => 'LStrcts', num => 1, label => 'Number of lock structs' }, + lock_type => { hdr => 'Type', num => 0, label => 'The lock type' }, + lock_var => { hdr => 'Lck Var', num => 1, label => 'The lock variable' }, + lock_wait_time => { hdr => 'Wait', num => 1, label => 'How long txn has waited for a lock' }, + log_flushed_to => { hdr => 'Flushed To', num => 0, label => 'Log position flushed to' }, + log_ios_done => { hdr => 'IO Done', num => 1, label => 'Log I/Os done' }, + log_ios_s => { hdr => 'IO/Sec', num => 1, label => 'Average log I/Os per sec' }, + log_seq_no => { hdr => 'Sequence No.', num => 0, label => 'Log sequence number' }, + main_thread_id => { hdr => 'Main Thread ID', num => 1, label => 'Main thread ID' }, + main_thread_proc_no => { hdr => 'Main Thread Proc', num => 1, label => 'Main thread process number' }, + main_thread_state => { hdr => 'Main Thread State', num => 0, label => 'Main thread state' }, + master_file => { hdr => 'File', num => 0, label => 'Master file' }, + master_host => { hdr => 'Master', num => 0, label => 'Master server hostname' }, + master_log_file => { hdr => 'Master Log File', num => 0, label => 'Master log file' }, + master_port => { hdr => 'Master Port', num => 1, label => 'Master port' }, + master_pos => { hdr => 'Position', num => 1, label => 'Master position' }, + master_ssl_allowed => { hdr => 'Master SSL Allowed', num => 0, label => 'Master SSL Allowed' }, + master_ssl_ca_file => { hdr => 'Master SSL CA File', num => 0, label => 'Master SSL Cert Auth File' }, + master_ssl_ca_path => { hdr => 'Master SSL CA Path', num => 0, label => 'Master SSL Cert Auth Path' }, + master_ssl_cert => { hdr => 'Master SSL Cert', num => 0, label => 'Master SSL Cert' }, + master_ssl_cipher => { hdr => 'Master SSL Cipher', num => 0, label => 'Master SSL Cipher' }, + master_ssl_key => { hdr => 'Master SSL Key', num => 0, label => 'Master SSL Key' }, + master_user => { hdr => 'Master User', num => 0, label => 'Master username' }, + max_txn => { hdr => 'MaxTxnTime', num => 1, label => 'MaxTxn' }, + merged_recs => { hdr => 'Merged Recs', num => 1, label => 'Merged records' }, + merges => { hdr => 'Merges', num => 1, label => 'Merges' }, + mutex_os_waits => { hdr => 'Waits', num => 1, label => 'Mutex OS Waits' }, + mutex_spin_rounds => { hdr => 'Rounds', num => 1, label => 'Mutex Spin Rounds' }, + mutex_spin_waits => { hdr => 'Spins', num => 1, label => 'Mutex Spin Waits' }, + mysql_thread_id => { hdr => 'ID', num => 1, label => 'MySQL connection (thread) ID', }, + name => { hdr => 'Name', num => 0, label => 'Variable Name' }, + n_bits => { hdr => '# Bits', num => 1, label => 'Number of bits' }, + non_hash_searches_s => { hdr => 'Non-Hash/Sec', num => 1, label => 'Non-hash searches/sec' }, + num_deletes => { hdr => 'Del', num => 1, label => 'Number of deletes' }, + num_deletes_sec => { hdr => 'Del/Sec', num => 1, label => 'Number of deletes' }, + num_inserts => { hdr => 'Ins', num => 1, label => 'Number of inserts' }, + num_inserts_sec => { hdr => 'Ins/Sec', num => 1, label => 'Number of inserts' }, + num_readers => { hdr => 'Readers', num => 1, label => 'Number of readers' }, + num_reads => { hdr => 'Read', num => 1, label => 'Number of reads' }, + num_reads_sec => { hdr => 'Read/Sec', num => 1, label => 'Number of reads' }, + num_res_ext => { hdr => 'BTree Extents', num => 1, label => 'Number of extents reserved for B-Tree' }, + num_rows => { hdr => 'Row Count', num => 1, label => 'Number of rows estimated to examine' }, + num_times_open => { hdr => 'In Use', num => 1, label => '# times table is opened', }, + num_txns => { hdr => 'Txns', num => 1, label => 'Number of transactions' }, + num_updates => { hdr => 'Upd', num => 1, label => 'Number of updates' }, + num_updates_sec => { hdr => 'Upd/Sec', num => 1, label => 'Number of updates' }, + os_file_reads => { hdr => 'OS Reads', num => 1, label => 'OS file reads' }, + os_file_writes => { hdr => 'OS Writes', num => 1, label => 'OS file writes' }, + os_fsyncs => { hdr => 'OS fsyncs', num => 1, label => 'OS fsyncs' }, + os_thread_id => { hdr => 'OS Thread', num => 1, label => 'The operating system thread ID' }, + p_aio_writes => { hdr => 'Async Wrt', num => 1, label => 'Pending asynchronous I/O writes' }, + p_buf_pool_flushes => { hdr => 'Buffer Pool Flushes', num => 1, label => 'Pending buffer pool flushes' }, + p_ibuf_aio_reads => { hdr => 'IBuf Async Rds', num => 1, label => 'Pending insert buffer asynch I/O reads' }, + p_log_flushes => { hdr => 'Log Flushes', num => 1, label => 'Pending log flushes' }, + p_log_ios => { hdr => 'Log I/Os', num => 1, label => 'Pending log I/O operations' }, + p_normal_aio_reads => { hdr => 'Async Rds', num => 1, label => 'Pending asynchronous I/O reads' }, + p_preads => { hdr => 'preads', num => 1, label => 'Pending p-reads' }, + p_pwrites => { hdr => 'pwrites', num => 1, label => 'Pending p-writes' }, + p_sync_ios => { hdr => 'Sync I/Os', num => 1, label => 'Pending synchronous I/O operations' }, + page_creates_sec => { hdr => 'Creates/Sec', num => 1, label => 'Page creates/sec' }, + page_no => { hdr => 'Page', num => 1, label => 'Page number' }, + page_reads_sec => { hdr => 'Reads/Sec', num => 1, label => 'Page reads per second' }, + page_writes_sec => { hdr => 'Writes/Sec', num => 1, label => 'Page writes per second' }, + pages_created => { hdr => 'Created', num => 1, label => 'Pages created' }, + pages_modified => { hdr => 'Dirty Pages', num => 1, label => 'Pages modified (dirty)' }, + pages_read => { hdr => 'Reads', num => 1, label => 'Pages read' }, + pages_total => { hdr => 'Pages', num => 1, label => 'Pages total' }, + pages_written => { hdr => 'Writes', num => 1, label => 'Pages written' }, + parent_col => { hdr => 'Parent Column', num => 0, label => 'The referred column in the parent table', }, + parent_db => { hdr => 'Parent DB', num => 0, label => 'The database of the parent table' }, + parent_index => { hdr => 'Parent Index', num => 0, label => 'The referred index in the parent table' }, + parent_table => { hdr => 'Parent Table', num => 0, label => 'The parent table' }, + part_id => { hdr => 'Part ID', num => 1, label => 'Sub-part ID of the query' }, + partitions => { hdr => 'Partitions', num => 0, label => 'Query partitions used' }, + pct => { hdr => 'Pct', num => 1, label => 'Percentage' }, + pending_chkp_writes => { hdr => 'Chkpt Writes', num => 1, label => 'Pending log checkpoint writes' }, + pending_log_writes => { hdr => 'Log Writes', num => 1, label => 'Pending log writes' }, + port => { hdr => 'Port', num => 1, label => 'Client port number', }, + possible_keys => { hdr => 'Poss. Keys', num => 0, label => 'Possible keys' }, + proc_no => { hdr => 'Proc', num => 1, label => 'Process number' }, + q_cache_hit => { hdr => 'QCacheHit', num => 1, label => 'Query cache hit ratio', }, + qps => { hdr => 'QPS', num => 1, label => 'How many queries/sec', }, + queries_in_queue => { hdr => 'Queries Queued', num => 1, label => 'Queries in queue' }, + queries_inside => { hdr => 'Queries Inside', num => 1, label => 'Queries inside InnoDB' }, + query_id => { hdr => 'Query ID', num => 1, label => 'Query ID' }, + query_status => { hdr => 'Query Status', num => 0, label => 'The query status' }, + query_text => { hdr => 'Query Text', num => 0, label => 'The query text' }, + questions => { hdr => 'Questions', num => 1, label => 'How many queries the server has gotten', }, + read_master_log_pos => { hdr => 'Read Master Pos', num => 1, label => 'Read master log position' }, + read_views_open => { hdr => 'Rd Views', num => 1, label => 'Number of read views open' }, + reads_pending => { hdr => 'Pending Reads', num => 1, label => 'Reads pending' }, + relay_log_file => { hdr => 'Relay File', num => 0, label => 'Relay log file' }, + relay_log_pos => { hdr => 'Relay Pos', num => 1, label => 'Relay log position' }, + relay_log_size => { hdr => 'Relay Size', num => 1, label => 'Relay log size' }, + relay_master_log_file => { hdr => 'Relay Master File', num => 0, label => 'Relay master log file' }, + replicate_do_db => { hdr => 'Do DB', num => 0, label => 'Replicate-do-db setting' }, + replicate_do_table => { hdr => 'Do Table', num => 0, label => 'Replicate-do-table setting' }, + replicate_ignore_db => { hdr => 'Ignore DB', num => 0, label => 'Replicate-ignore-db setting' }, + replicate_ignore_table => { hdr => 'Ignore Table', num => 0, label => 'Replicate-do-table setting' }, + replicate_wild_do_table => { hdr => 'Wild Do Table', num => 0, label => 'Replicate-wild-do-table setting' }, + replicate_wild_ignore_table => { hdr => 'Wild Ignore Table', num => 0, label => 'Replicate-wild-ignore-table setting' }, + request_type => { hdr => 'Type', num => 0, label => 'Type of lock the thread waits for' }, + reservation_count => { hdr => 'ResCnt', num => 1, label => 'Reservation Count' }, + row_locks => { hdr => 'RLocks', num => 1, label => 'Number of row locks' }, + rw_excl_os_waits => { hdr => 'RW Waits', num => 1, label => 'R/W Excl. OS Waits' }, + rw_excl_spins => { hdr => 'RW Spins', num => 1, label => 'R/W Excl. Spins' }, + rw_shared_os_waits => { hdr => 'Sh Waits', num => 1, label => 'R/W Shared OS Waits' }, + rw_shared_spins => { hdr => 'Sh Spins', num => 1, label => 'R/W Shared Spins' }, + scan_type => { hdr => 'Type', num => 0, label => 'Scan type in chosen' }, + seg_size => { hdr => 'Seg. Size', num => 1, label => 'Segment size' }, + select_type => { hdr => 'Select Type', num => 0, label => 'Type of select used' }, + signal_count => { hdr => 'Signals', num => 1, label => 'Signal Count' }, + size => { hdr => 'Size', num => 1, label => 'Size of the tablespace' }, + skip_counter => { hdr => 'Skip Counter', num => 1, label => 'Skip counter' }, + slave_catchup_rate => { hdr => 'Catchup', num => 1, label => 'How fast the slave is catching up in the binlog' }, + slave_io_running => { hdr => 'Slave-IO', num => 0, label => 'Whether the slave I/O thread is running' }, + slave_io_state => { hdr => 'Slave IO State', num => 0, label => 'Slave I/O thread state' }, + slave_open_temp_tables => { hdr => 'Temp', num => 1, label => 'Slave open temp tables' }, + slave_sql_running => { hdr => 'Slave-SQL', num => 0, label => 'Whether the slave SQL thread is running' }, + slow => { hdr => 'Slow', num => 1, label => 'How many slow queries', }, + space_id => { hdr => 'Space', num => 1, label => 'Tablespace ID' }, + special => { hdr => 'Special', num => 0, label => 'Special/Other info' }, + state => { hdr => 'State', num => 0, label => 'Connection state', maxw => 18, }, + tables_in_use => { hdr => 'Tbl Used', num => 1, label => 'Number of tables in use' }, + tables_locked => { hdr => 'Tbl Lck', num => 1, label => 'Number of tables locked' }, + tbl => { hdr => 'Table', num => 0, label => 'Table', }, + thread => { hdr => 'Thread', num => 1, label => 'Thread number' }, + thread_decl_inside => { hdr => 'Thread Inside', num => 0, label => 'What the thread is declared inside' }, + thread_purpose => { hdr => 'Purpose', num => 0, label => "The thread's purpose" }, + thread_status => { hdr => 'Thread Status', num => 0, label => 'The thread status' }, + time => { hdr => 'Time', num => 1, label => 'Time since the last event', }, + time_behind_master => { hdr => 'TimeLag', num => 1, label => 'Time slave lags master' }, + timestring => { hdr => 'Timestring', num => 0, label => 'Time the event occurred' }, + total => { hdr => 'Total', num => 1, label => 'Total' }, + total_mem_alloc => { hdr => 'Memory', num => 1, label => 'Total memory allocated' }, + truncates => { hdr => 'Trunc', num => 0, label => 'Whether the deadlock is truncating InnoDB status' }, + txn_doesnt_see_ge => { hdr => "Txn Won't See", num => 0, label => 'Where txn read view is limited' }, + txn_id => { hdr => 'ID', num => 0, label => 'Transaction ID' }, + txn_sees_lt => { hdr => 'Txn Sees', num => 1, label => 'Where txn read view is limited' }, + txn_status => { hdr => 'Txn Status', num => 0, label => 'Transaction status' }, + txn_time_remain => { hdr => 'Remaining', num => 1, label => 'Time until txn rollback/commit completes' }, + undo_log_entries => { hdr => 'Undo', num => 1, label => 'Number of undo log entries' }, + undo_for => { hdr => 'Undo', num => 0, label => 'Undo for' }, + until_condition => { hdr => 'Until Condition', num => 0, label => 'Slave until condition' }, + until_log_file => { hdr => 'Until Log File', num => 0, label => 'Slave until log file' }, + until_log_pos => { hdr => 'Until Log Pos', num => 1, label => 'Slave until log position' }, + used_cells => { hdr => 'Cells Used', num => 1, label => 'Number of cells used' }, + used_bufs => { hdr => 'Used Bufs', num => 1, label => 'Number of buffer pool pages used' }, + user => { hdr => 'User', num => 0, label => 'Database username', }, + value => { hdr => 'Value', num => 1, label => 'Value' }, + versions => { hdr => 'Versions', num => 1, label => 'Number of InnoDB MVCC versions unpurged' }, + victim => { hdr => 'Victim', num => 0, label => 'Whether this txn was the deadlock victim' }, + wait_array_size => { hdr => 'Wait Array Size', num => 1, label => 'Wait Array Size' }, + wait_status => { hdr => 'Lock Status', num => 0, label => 'Status of txn locks' }, + waited_at_filename => { hdr => 'File', num => 0, label => 'Filename at which thread waits' }, + waited_at_line => { hdr => 'Line', num => 1, label => 'Line at which thread waits' }, + waiters_flag => { hdr => 'Waiters', num => 1, label => 'Waiters Flag' }, + waiting => { hdr => 'Waiting', num => 1, label => 'Whether lock is being waited for' }, + when => { hdr => 'When', num => 0, label => 'Time scale' }, + writer_lock_mode => { hdr => 'Wrtr Lck Mode', num => 0, label => 'Writer lock mode' }, + writer_thread => { hdr => 'Wrtr Thread', num => 1, label => 'Writer thread ID' }, + writes_pending => { hdr => 'Writes', num => 1, label => 'Number of writes pending' }, + writes_pending_flush_list => { hdr => 'Flush List Writes', num => 1, label => 'Number of flush list writes pending' }, + writes_pending_lru => { hdr => 'LRU Writes', num => 1, label => 'Number of LRU writes pending' }, + writes_pending_single_page => { hdr => '1-Page Writes', num => 1, label => 'Number of 1-page writes pending' }, +); + +# Apply a default property or three. By default, columns are not width-constrained, +# aligned left, and sorted alphabetically, not numerically. +foreach my $col ( values %columns ) { + map { $col->{$_} ||= 0 } qw(num minw maxw); + $col->{just} = $col->{num} ? '' : '-'; +} + +# Filters {{{3 +# This hash defines every filter that can be applied to a table. These +# become part of tbl_meta as well. Each filter is just an expression that +# returns true or false. +# Properties of each entry: +# * func: the subroutine +# * name: the name, repeated +# * user: whether it's a user-defined filter (saved in config) +# * text: text of the subroutine +# * note: explanation +my %filters = (); + +# These are pre-processed to live in %filters above, by compiling them. +my %builtin_filters = ( + hide_self => { + text => <<' END', + return ( !$set->{info} || $set->{info} ne 'SHOW FULL PROCESSLIST' ) + && ( !$set->{query_text} || $set->{query_text} !~ m/INNODB STATUS$/ ); + END + note => 'Removes the innotop processes from the list', + tbls => [qw(innodb_transactions processlist)], + }, + hide_inactive => { + text => <<' END', + return ( !defined($set->{txn_status}) || $set->{txn_status} ne 'not started' ) + && ( !defined($set->{cmd}) || $set->{cmd} !~ m/Sleep|Binlog Dump/ ) + && ( !defined($set->{info}) || $set->{info} =~ m/\S/ ); + END + note => 'Removes processes which are not doing anything', + tbls => [qw(innodb_transactions processlist)], + }, + hide_slave_io => { + text => <<' END', + return !$set->{state} || $set->{state} !~ m/^(?:Waiting for master|Has read all relay)/; + END + note => 'Removes slave I/O threads from the list', + tbls => [qw(processlist slave_io_status)], + }, + table_is_open => { + text => <<' END', + return $set->{num_times_open} + $set->{is_name_locked}; + END + note => 'Removes tables that are not in use or locked', + tbls => [qw(open_tables)], + }, + cxn_is_master => { + text => <<' END', + return $set->{master_file} ? 1 : 0; + END + note => 'Removes servers that are not masters', + tbls => [qw(master_status)], + }, + cxn_is_slave => { + text => <<' END', + return $set->{master_host} ? 1 : 0; + END + note => 'Removes servers that are not slaves', + tbls => [qw(slave_io_status slave_sql_status)], + }, + thd_is_not_waiting => { + text => <<' END', + return $set->{thread_status} !~ m#waiting for i/o request#; + END + note => 'Removes idle I/O threads', + tbls => [qw(io_threads)], + }, +); +foreach my $key ( keys %builtin_filters ) { + my ( $sub, $err ) = compile_filter($builtin_filters{$key}->{text}); + $filters{$key} = { + func => $sub, + text => $builtin_filters{$key}->{text}, + user => 0, + name => $key, # useful for later + note => $builtin_filters{$key}->{note}, + tbls => $builtin_filters{$key}->{tbls}, + } +} + +# Variable sets {{{3 +# Sets (arrayrefs) of variables that are used in S mode. They are read/written to +# the config file. +my %var_sets = ( + general => { + text => join( + ', ', + 'set_precision(Questions/Uptime_hires) as QPS', + 'set_precision(Com_commit/Uptime_hires) as Commit_PS', + 'set_precision((Com_rollback||0)/(Com_commit||1)) as Rollback_Commit', + 'set_precision((' + . join('+', map { "($_||0)" } + qw(Com_delete Com_delete_multi Com_insert Com_insert_select Com_replace + Com_replace_select Com_select Com_update Com_update_multi)) + . ')/(Com_commit||1)) as Write_Commit', + 'set_precision((Com_select+(Qcache_hits||0))/((' + . join('+', map { "($_||0)" } + qw(Com_delete Com_delete_multi Com_insert Com_insert_select Com_replace + Com_replace_select Com_select Com_update Com_update_multi)) + . ')||1)) as R_W_Ratio', + 'set_precision(Opened_tables/Uptime_hires) as Opens_PS', + 'percent($cur->{Open_tables}/($cur->{table_cache})) as Table_Cache_Used', + 'set_precision(Threads_created/Uptime_hires) as Threads_PS', + 'percent($cur->{Threads_cached}/($cur->{thread_cache_size}||1)) as Thread_Cache_Used', + 'percent($cur->{Max_used_connections}/($cur->{max_connections}||1)) as CXN_Used_Ever', + 'percent($cur->{Threads_connected}/($cur->{max_connections}||1)) as CXN_Used_Now', + ), + }, + commands => { + text => join( + ', ', + qw(Uptime Questions Com_delete Com_delete_multi Com_insert + Com_insert_select Com_replace Com_replace_select Com_select Com_update + Com_update_multi) + ), + }, + query_status => { + text => join( + ',', + qw( Uptime Select_full_join Select_full_range_join Select_range + Select_range_check Select_scan Slow_queries Sort_merge_passes + Sort_range Sort_rows Sort_scan) + ), + }, + innodb => { + text => join( + ',', + qw( Uptime Innodb_row_lock_current_waits Innodb_row_lock_time + Innodb_row_lock_time_avg Innodb_row_lock_time_max Innodb_row_lock_waits + Innodb_rows_deleted Innodb_rows_inserted Innodb_rows_read + Innodb_rows_updated) + ), + }, + txn => { + text => join( + ',', + qw( Uptime Com_begin Com_commit Com_rollback Com_savepoint + Com_xa_commit Com_xa_end Com_xa_prepare Com_xa_recover Com_xa_rollback + Com_xa_start) + ), + }, + key_cache => { + text => join( + ',', + qw( Uptime Key_blocks_not_flushed Key_blocks_unused Key_blocks_used + Key_read_requests Key_reads Key_write_requests Key_writes ) + ), + }, + query_cache => { + text => join( + ',', + "percent($exprs{QcacheHitRatio}) as Hit_Pct", + 'set_precision((Qcache_hits||0)/(Qcache_inserts||1)) as Hit_Ins', + 'set_precision((Qcache_lowmem_prunes||0)/Uptime_hires) as Lowmem_Prunes_sec', + 'percent(1-((Qcache_free_blocks||0)/(Qcache_total_blocks||1))) as Blocks_used', + qw( Qcache_free_blocks Qcache_free_memory Qcache_not_cached Qcache_queries_in_cache) + ), + }, + handler => { + text => join( + ',', + qw( Uptime Handler_read_key Handler_read_first Handler_read_next + Handler_read_prev Handler_read_rnd Handler_read_rnd_next Handler_delete + Handler_update Handler_write) + ), + }, + cxns_files_threads => { + text => join( + ',', + qw( Uptime Aborted_clients Aborted_connects Bytes_received Bytes_sent + Compression Connections Created_tmp_disk_tables Created_tmp_files + Created_tmp_tables Max_used_connections Open_files Open_streams + Open_tables Opened_tables Table_locks_immediate Table_locks_waited + Threads_cached Threads_connected Threads_created Threads_running) + ), + }, + prep_stmt => { + text => join( + ',', + qw( Uptime Com_dealloc_sql Com_execute_sql Com_prepare_sql Com_reset + Com_stmt_close Com_stmt_execute Com_stmt_fetch Com_stmt_prepare + Com_stmt_reset Com_stmt_send_long_data ) + ), + }, + innodb_health => { + text => join( + ',', + "$exprs{OldVersions} as OldVersions", + qw(IB_sm_mutex_spin_waits IB_sm_mutex_spin_rounds IB_sm_mutex_os_waits), + "$exprs{NumTxns} as NumTxns", + "$exprs{MaxTxnTime} as MaxTxnTime", + qw(IB_ro_queries_inside IB_ro_queries_in_queue), + "set_precision($exprs{DirtyBufs} * 100) as dirty_bufs", + "set_precision($exprs{BufPoolFill} * 100) as buf_fill", + qw(IB_bp_pages_total IB_bp_pages_read IB_bp_pages_written IB_bp_pages_created) + ), + }, + innodb_health2 => { + text => join( + ', ', + 'percent(1-((Innodb_buffer_pool_pages_free||0)/($cur->{Innodb_buffer_pool_pages_total}||1))) as BP_page_cache_usage', + 'percent(1-((Innodb_buffer_pool_reads||0)/(Innodb_buffer_pool_read_requests||1))) as BP_cache_hit_ratio', + 'Innodb_buffer_pool_wait_free', + 'Innodb_log_waits', + ), + }, + slow_queries => { + text => join( + ', ', + 'set_precision(Slow_queries/Uptime_hires) as Slow_PS', + 'set_precision(Select_full_join/Uptime_hires) as Full_Join_PS', + 'percent(Select_full_join/(Com_select||1)) as Full_Join_Ratio', + ), + }, +); + +# Server sets {{{3 +# Defines sets of servers between which the user can quickly switch. +my %server_groups; + +# Connections {{{3 +# This hash defines server connections. Each connection is a string that can be passed to +# the DBI connection. These are saved in the connections section in the config file. +my %connections; +# Defines the parts of connections. +my @conn_parts = qw(user have_user pass have_pass dsn savepass dl_table); + +# Graph widths {{{3 +# This hash defines the max values seen for various status/variable values, for graphing. +# These are stored in their own section in the config file. These are just initial values: +my %mvs = ( + Com_select => 50, + Com_insert => 50, + Com_update => 50, + Com_delete => 50, + Questions => 100, +); + +# ########################################################################### +# Valid Term::ANSIColor color strings. +# ########################################################################### +my %ansicolors = map { $_ => 1 } + qw( black blink blue bold clear concealed cyan dark green magenta on_black + on_blue on_cyan on_green on_magenta on_red on_white on_yellow red reset + reverse underline underscore white yellow); + +# ########################################################################### +# Valid comparison operators for color rules +# ########################################################################### +my %comp_ops = ( + '==' => 'Numeric equality', + '>' => 'Numeric greater-than', + '<' => 'Numeric less-than', + '>=' => 'Numeric greater-than/equal', + '<=' => 'Numeric less-than/equal', + '!=' => 'Numeric not-equal', + 'eq' => 'String equality', + 'gt' => 'String greater-than', + 'lt' => 'String less-than', + 'ge' => 'String greater-than/equal', + 'le' => 'String less-than/equal', + 'ne' => 'String not-equal', + '=~' => 'Pattern match', + '!~' => 'Negated pattern match', +); + +# ########################################################################### +# Valid aggregate functions. +# ########################################################################### +my %agg_funcs = ( + first => sub { + return $_[0] + }, + count => sub { + return 0 + @_; + }, + avg => sub { + my @args = grep { defined $_ } @_; + return (sum(map { m/([\d\.-]+)/g } @args) || 0) / (scalar(@args) || 1); + }, + sum => \&sum, +); + +# ########################################################################### +# Valid functions for transformations. +# ########################################################################### +my %trans_funcs = ( + shorten => \&shorten, + secs_to_time => \&secs_to_time, + no_ctrl_char => \&no_ctrl_char, + percent => \&percent, + commify => \&commify, + dulint_to_int => \&dulint_to_int, + set_precision => \&set_precision, +); + +# Table definitions {{{3 +# This hash defines every table that can get displayed in every mode. Each +# table specifies columns and column data sources. The column is +# defined by the %columns hash. +# +# Example: foo => { src => 'bar' } means the foo column (look at +# $columns{foo} for its definition) gets its data from the 'bar' element of +# the current data set, whatever that is. +# +# These columns are post-processed after being defined, because they get stuff +# from %columns. After all the config is loaded for columns, there's more +# post-processing too; the subroutines compiled from src get added to +# the hash elements for extract_values to use. +# ########################################################################### + +my %tbl_meta = ( + adaptive_hash_index => { + capt => 'Adaptive Hash Index', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + hash_table_size => { src => 'IB_ib_hash_table_size', trans => [qw(shorten)], }, + used_cells => { src => 'IB_ib_used_cells' }, + bufs_in_node_heap => { src => 'IB_ib_bufs_in_node_heap' }, + hash_searches_s => { src => 'IB_ib_hash_searches_s' }, + non_hash_searches_s => { src => 'IB_ib_non_hash_searches_s' }, + }, + visible => [ qw(cxn hash_table_size used_cells bufs_in_node_heap hash_searches_s non_hash_searches_s) ], + filters => [], + sort_cols => 'cxn', + sort_dir => '1', + innodb => 'ib', + group_by => [], + aggregate => 0, + }, + buffer_pool => { + capt => 'Buffer Pool', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + total_mem_alloc => { src => 'IB_bp_total_mem_alloc', trans => [qw(shorten)], }, + awe_mem_alloc => { src => 'IB_bp_awe_mem_alloc', trans => [qw(shorten)], }, + add_pool_alloc => { src => 'IB_bp_add_pool_alloc', trans => [qw(shorten)], }, + buf_pool_size => { src => 'IB_bp_buf_pool_size', trans => [qw(shorten)], }, + buf_free => { src => 'IB_bp_buf_free' }, + buf_pool_hit_rate => { src => 'IB_bp_buf_pool_hit_rate' }, + buf_pool_reads => { src => 'IB_bp_buf_pool_reads' }, + buf_pool_hits => { src => 'IB_bp_buf_pool_hits' }, + dict_mem_alloc => { src => 'IB_bp_dict_mem_alloc' }, + pages_total => { src => 'IB_bp_pages_total' }, + pages_modified => { src => 'IB_bp_pages_modified' }, + reads_pending => { src => 'IB_bp_reads_pending' }, + writes_pending => { src => 'IB_bp_writes_pending' }, + writes_pending_lru => { src => 'IB_bp_writes_pending_lru' }, + writes_pending_flush_list => { src => 'IB_bp_writes_pending_flush_list' }, + writes_pending_single_page => { src => 'IB_bp_writes_pending_single_page' }, + page_creates_sec => { src => 'IB_bp_page_creates_sec' }, + page_reads_sec => { src => 'IB_bp_page_reads_sec' }, + page_writes_sec => { src => 'IB_bp_page_writes_sec' }, + pages_created => { src => 'IB_bp_pages_created' }, + pages_read => { src => 'IB_bp_pages_read' }, + pages_written => { src => 'IB_bp_pages_written' }, + }, + visible => [ qw(cxn buf_pool_size buf_free pages_total pages_modified buf_pool_hit_rate total_mem_alloc add_pool_alloc)], + filters => [], + sort_cols => 'cxn', + sort_dir => '1', + innodb => 'bp', + group_by => [], + aggregate => 0, + }, + # TODO: a new step in set_to_tbl: join result to itself, grouped? + # TODO: this would also enable pulling Q and T data together. + # TODO: using a SQL-ish language would also allow pivots to be easier -- treat the pivoted data as a view and SELECT from it. + cmd_summary => { + capt => 'Command Summary', + cust => {}, + cols => { + name => { src => 'name' }, + total => { src => 'total' }, + value => { src => 'value', agg => 'sum'}, + pct => { src => 'value/total', trans => [qw(percent)] }, + last_total => { src => 'last_total' }, + last_value => { src => 'last_value', agg => 'sum'}, + last_pct => { src => 'last_value/last_total', trans => [qw(percent)] }, + }, + visible => [qw(name value pct last_value last_pct)], + filters => [qw()], + sort_cols => '-value', + sort_dir => '1', + innodb => '', + group_by => [qw(name)], + aggregate => 1, + }, + deadlock_locks => { + capt => 'Deadlock Locks', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + mysql_thread_id => { src => 'mysql_thread_id' }, + dl_txn_num => { src => 'dl_txn_num' }, + lock_type => { src => 'lock_type' }, + space_id => { src => 'space_id' }, + page_no => { src => 'page_no' }, + heap_no => { src => 'heap_no' }, + n_bits => { src => 'n_bits' }, + index => { src => 'index' }, + db => { src => 'db' }, + tbl => { src => 'table' }, + lock_mode => { src => 'lock_mode' }, + special => { src => 'special' }, + insert_intention => { src => 'insert_intention' }, + waiting => { src => 'waiting' }, + }, + visible => [ qw(cxn mysql_thread_id waiting lock_mode db tbl index special insert_intention)], + filters => [], + sort_cols => 'cxn mysql_thread_id', + sort_dir => '1', + innodb => 'dl', + group_by => [], + aggregate => 0, + }, + deadlock_transactions => { + capt => 'Deadlock Transactions', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + active_secs => { src => 'active_secs' }, + dl_txn_num => { src => 'dl_txn_num' }, + has_read_view => { src => 'has_read_view' }, + heap_size => { src => 'heap_size' }, + host_and_domain => { src => 'hostname' }, + hostname => { src => $exprs{Host} }, + ip => { src => 'ip' }, + lock_structs => { src => 'lock_structs' }, + lock_wait_time => { src => 'lock_wait_time', trans => [ qw(secs_to_time) ] }, + mysql_thread_id => { src => 'mysql_thread_id' }, + os_thread_id => { src => 'os_thread_id' }, + proc_no => { src => 'proc_no' }, + query_id => { src => 'query_id' }, + query_status => { src => 'query_status' }, + query_text => { src => 'query_text', trans => [ qw(no_ctrl_char) ] }, + row_locks => { src => 'row_locks' }, + tables_in_use => { src => 'tables_in_use' }, + tables_locked => { src => 'tables_locked' }, + thread_decl_inside => { src => 'thread_decl_inside' }, + thread_status => { src => 'thread_status' }, + 'time' => { src => 'active_secs', trans => [ qw(secs_to_time) ] }, + timestring => { src => 'timestring' }, + txn_doesnt_see_ge => { src => 'txn_doesnt_see_ge' }, + txn_id => { src => 'txn_id' }, + txn_sees_lt => { src => 'txn_sees_lt' }, + txn_status => { src => 'txn_status' }, + truncates => { src => 'truncates' }, + undo_log_entries => { src => 'undo_log_entries' }, + user => { src => 'user' }, + victim => { src => 'victim' }, + wait_status => { src => 'lock_wait_status' }, + }, + visible => [ qw(cxn mysql_thread_id timestring user hostname victim time undo_log_entries lock_structs query_text)], + filters => [], + sort_cols => 'cxn mysql_thread_id', + sort_dir => '1', + innodb => 'dl', + group_by => [], + aggregate => 0, + }, + explain => { + capt => 'EXPLAIN Results', + cust => {}, + cols => { + part_id => { src => 'id' }, + select_type => { src => 'select_type' }, + tbl => { src => 'table' }, + partitions => { src => 'partitions' }, + scan_type => { src => 'type' }, + possible_keys => { src => 'possible_keys' }, + index => { src => 'key' }, + key_len => { src => 'key_len' }, + index_ref => { src => 'ref' }, + num_rows => { src => 'rows' }, + special => { src => 'extra' }, + }, + visible => [ qw(select_type tbl partitions scan_type possible_keys index key_len index_ref num_rows special)], + filters => [], + sort_cols => '', + sort_dir => '1', + innodb => '', + group_by => [], + aggregate => 0, + }, + file_io_misc => { + capt => 'File I/O Misc', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + io_bytes_s => { src => 'IB_io_avg_bytes_s' }, + io_flush_type => { src => 'IB_io_flush_type' }, + io_fsyncs_s => { src => 'IB_io_fsyncs_s' }, + io_reads_s => { src => 'IB_io_reads_s' }, + io_writes_s => { src => 'IB_io_writes_s' }, + os_file_reads => { src => 'IB_io_os_file_reads' }, + os_file_writes => { src => 'IB_io_os_file_writes' }, + os_fsyncs => { src => 'IB_io_os_fsyncs' }, + }, + visible => [ qw(cxn os_file_reads os_file_writes os_fsyncs io_reads_s io_writes_s io_bytes_s)], + filters => [], + sort_cols => 'cxn', + sort_dir => '1', + innodb => 'io', + group_by => [], + aggregate => 0, + }, + fk_error => { + capt => 'Foreign Key Error Info', + cust => {}, + cols => { + timestring => { src => 'IB_fk_timestring' }, + child_db => { src => 'IB_fk_child_db' }, + child_table => { src => 'IB_fk_child_table' }, + child_index => { src => 'IB_fk_child_index' }, + fk_name => { src => 'IB_fk_fk_name' }, + parent_db => { src => 'IB_fk_parent_db' }, + parent_table => { src => 'IB_fk_parent_table' }, + parent_col => { src => 'IB_fk_parent_col' }, + parent_index => { src => 'IB_fk_parent_index' }, + attempted_op => { src => 'IB_fk_attempted_op' }, + }, + visible => [ qw(timestring child_db child_table child_index parent_db parent_table parent_col parent_index fk_name attempted_op)], + filters => [], + sort_cols => '', + sort_dir => '1', + innodb => 'fk', + group_by => [], + aggregate => 0, + }, + insert_buffers => { + capt => 'Insert Buffers', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + inserts => { src => 'IB_ib_inserts' }, + merged_recs => { src => 'IB_ib_merged_recs' }, + merges => { src => 'IB_ib_merges' }, + size => { src => 'IB_ib_size' }, + free_list_len => { src => 'IB_ib_free_list_len' }, + seg_size => { src => 'IB_ib_seg_size' }, + }, + visible => [ qw(cxn inserts merged_recs merges size free_list_len seg_size)], + filters => [], + sort_cols => 'cxn', + sort_dir => '1', + innodb => 'ib', + group_by => [], + aggregate => 0, + }, + innodb_locks => { + capt => 'InnoDB Locks', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + db => { src => 'db' }, + index => { src => 'index' }, + insert_intention => { src => 'insert_intention' }, + lock_mode => { src => 'lock_mode' }, + lock_type => { src => 'lock_type' }, + lock_wait_time => { src => 'lock_wait_time', trans => [ qw(secs_to_time) ] }, + mysql_thread_id => { src => 'mysql_thread_id' }, + n_bits => { src => 'n_bits' }, + page_no => { src => 'page_no' }, + space_id => { src => 'space_id' }, + special => { src => 'special' }, + tbl => { src => 'table' }, + 'time' => { src => 'active_secs', hdr => 'Active', trans => [ qw(secs_to_time) ] }, + txn_id => { src => 'txn_id' }, + waiting => { src => 'waiting' }, + }, + visible => [ qw(cxn mysql_thread_id lock_type waiting lock_wait_time time lock_mode db tbl index insert_intention special)], + filters => [], + sort_cols => 'cxn -lock_wait_time', + sort_dir => '1', + innodb => 'tx', + colors => [ + { col => 'lock_wait_time', op => '>', arg => 60, color => 'red' }, + { col => 'lock_wait_time', op => '>', arg => 30, color => 'yellow' }, + { col => 'lock_wait_time', op => '>', arg => 10, color => 'green' }, + ], + group_by => [], + aggregate => 0, + }, + innodb_transactions => { + capt => 'InnoDB Transactions', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + active_secs => { src => 'active_secs' }, + has_read_view => { src => 'has_read_view' }, + heap_size => { src => 'heap_size' }, + hostname => { src => $exprs{Host} }, + ip => { src => 'ip' }, + wait_status => { src => 'lock_wait_status' }, + lock_wait_time => { src => 'lock_wait_time', trans => [ qw(secs_to_time) ] }, + lock_structs => { src => 'lock_structs' }, + mysql_thread_id => { src => 'mysql_thread_id' }, + os_thread_id => { src => 'os_thread_id' }, + proc_no => { src => 'proc_no' }, + query_id => { src => 'query_id' }, + query_status => { src => 'query_status' }, + query_text => { src => 'query_text', trans => [ qw(no_ctrl_char) ] }, + txn_time_remain => { src => $exprs{TxnTimeRemain}, trans => [ qw(secs_to_time) ] }, + row_locks => { src => 'row_locks' }, + tables_in_use => { src => 'tables_in_use' }, + tables_locked => { src => 'tables_locked' }, + thread_decl_inside => { src => 'thread_decl_inside' }, + thread_status => { src => 'thread_status' }, + 'time' => { src => 'active_secs', trans => [ qw(secs_to_time) ], agg => 'sum' }, + txn_doesnt_see_ge => { src => 'txn_doesnt_see_ge' }, + txn_id => { src => 'txn_id' }, + txn_sees_lt => { src => 'txn_sees_lt' }, + txn_status => { src => 'txn_status', minw => 10, maxw => 10 }, + undo_log_entries => { src => 'undo_log_entries' }, + user => { src => 'user', maxw => 10 }, + cnt => { src => 'mysql_thread_id', minw => 0 }, + }, + visible => [ qw(cxn cnt mysql_thread_id user hostname txn_status time undo_log_entries query_text)], + filters => [ qw( hide_self hide_inactive ) ], + sort_cols => '-active_secs txn_status cxn mysql_thread_id', + sort_dir => '1', + innodb => 'tx', + hide_caption => 1, + colors => [ + { col => 'wait_status', op => 'eq', arg => 'LOCK WAIT', color => 'black on_red' }, + { col => 'time', op => '>', arg => 600, color => 'red' }, + { col => 'time', op => '>', arg => 300, color => 'yellow' }, + { col => 'time', op => '>', arg => 60, color => 'green' }, + { col => 'time', op => '>', arg => 30, color => 'cyan' }, + { col => 'txn_status', op => 'eq', arg => 'not started', color => 'white' }, + ], + group_by => [ qw(cxn txn_status) ], + aggregate => 0, + }, + io_threads => { + capt => 'I/O Threads', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + thread => { src => 'thread' }, + thread_purpose => { src => 'purpose' }, + event_set => { src => 'event_set' }, + thread_status => { src => 'state' }, + }, + visible => [ qw(cxn thread thread_purpose thread_status)], + filters => [ qw() ], + sort_cols => 'cxn thread', + sort_dir => '1', + innodb => 'io', + group_by => [], + aggregate => 0, + }, + log_statistics => { + capt => 'Log Statistics', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + last_chkp => { src => 'IB_lg_last_chkp' }, + log_flushed_to => { src => 'IB_lg_log_flushed_to' }, + log_ios_done => { src => 'IB_lg_log_ios_done' }, + log_ios_s => { src => 'IB_lg_log_ios_s' }, + log_seq_no => { src => 'IB_lg_log_seq_no' }, + pending_chkp_writes => { src => 'IB_lg_pending_chkp_writes' }, + pending_log_writes => { src => 'IB_lg_pending_log_writes' }, + }, + visible => [ qw(cxn log_seq_no log_flushed_to last_chkp log_ios_done log_ios_s)], + filters => [], + sort_cols => 'cxn', + sort_dir => '1', + innodb => 'lg', + group_by => [], + aggregate => 0, + }, + master_status => { + capt => 'Master Status', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + binlog_do_db => { src => 'binlog_do_db' }, + binlog_ignore_db => { src => 'binlog_ignore_db' }, + master_file => { src => 'file' }, + master_pos => { src => 'position' }, + binlog_cache_overflow => { src => '(Binlog_cache_disk_use||0)/(Binlog_cache_use||1)', trans => [ qw(percent) ] }, + }, + visible => [ qw(cxn master_file master_pos binlog_cache_overflow)], + filters => [ qw(cxn_is_master) ], + sort_cols => 'cxn', + sort_dir => '1', + innodb => '', + group_by => [], + aggregate => 0, + }, + pending_io => { + capt => 'Pending I/O', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + p_normal_aio_reads => { src => 'IB_io_pending_normal_aio_reads' }, + p_aio_writes => { src => 'IB_io_pending_aio_writes' }, + p_ibuf_aio_reads => { src => 'IB_io_pending_ibuf_aio_reads' }, + p_sync_ios => { src => 'IB_io_pending_sync_ios' }, + p_buf_pool_flushes => { src => 'IB_io_pending_buffer_pool_flushes' }, + p_log_flushes => { src => 'IB_io_pending_log_flushes' }, + p_log_ios => { src => 'IB_io_pending_log_ios' }, + p_preads => { src => 'IB_io_pending_preads' }, + p_pwrites => { src => 'IB_io_pending_pwrites' }, + }, + visible => [ qw(cxn p_normal_aio_reads p_aio_writes p_ibuf_aio_reads p_sync_ios p_log_flushes p_log_ios)], + filters => [], + sort_cols => 'cxn', + sort_dir => '1', + innodb => 'io', + group_by => [], + aggregate => 0, + }, + open_tables => { + capt => 'Open Tables', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + db => { src => 'database' }, + tbl => { src => 'table' }, + num_times_open => { src => 'in_use' }, + is_name_locked => { src => 'name_locked' }, + }, + visible => [ qw(cxn db tbl num_times_open is_name_locked)], + filters => [ qw(table_is_open) ], + sort_cols => '-num_times_open cxn db tbl', + sort_dir => '1', + innodb => '', + group_by => [], + aggregate => 0, + }, + page_statistics => { + capt => 'Page Statistics', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + pages_read => { src => 'IB_bp_pages_read' }, + pages_written => { src => 'IB_bp_pages_written' }, + pages_created => { src => 'IB_bp_pages_created' }, + page_reads_sec => { src => 'IB_bp_page_reads_sec' }, + page_writes_sec => { src => 'IB_bp_page_writes_sec' }, + page_creates_sec => { src => 'IB_bp_page_creates_sec' }, + }, + visible => [ qw(cxn pages_read pages_written pages_created page_reads_sec page_writes_sec page_creates_sec)], + filters => [], + sort_cols => 'cxn', + sort_dir => '1', + innodb => 'bp', + group_by => [], + aggregate => 0, + }, + processlist => { + capt => 'MySQL Process List', + cust => {}, + cols => { + cxn => { src => 'cxn', minw => 6, maxw => 10 }, + mysql_thread_id => { src => 'id', minw => 6, maxw => 0 }, + user => { src => 'user', minw => 5, maxw => 8 }, + hostname => { src => $exprs{Host}, minw => 13, maxw => 8, }, + port => { src => $exprs{Port}, minw => 0, maxw => 0, }, + host_and_port => { src => 'host', minw => 0, maxw => 0 }, + db => { src => 'db', minw => 6, maxw => 12 }, + cmd => { src => 'command', minw => 5, maxw => 0 }, + time => { src => 'time', minw => 5, maxw => 0, trans => [ qw(secs_to_time) ], agg => 'sum' }, + state => { src => 'state', minw => 0, maxw => 0 }, + info => { src => 'info', minw => 0, maxw => 0, trans => [ qw(no_ctrl_char) ] }, + cnt => { src => 'id', minw => 0, maxw => 0 }, + }, + visible => [ qw(cxn cmd cnt mysql_thread_id user hostname db time info)], + filters => [ qw(hide_self hide_inactive hide_slave_io) ], + sort_cols => '-time cxn hostname mysql_thread_id', + sort_dir => '1', + innodb => '', + hide_caption => 1, + colors => [ + { col => 'state', op => 'eq', arg => 'Locked', color => 'black on_red' }, + { col => 'cmd', op => 'eq', arg => 'Sleep', color => 'white' }, + { col => 'user', op => 'eq', arg => 'system user', color => 'white' }, + { col => 'cmd', op => 'eq', arg => 'Connect', color => 'white' }, + { col => 'cmd', op => 'eq', arg => 'Binlog Dump', color => 'white' }, + { col => 'time', op => '>', arg => 600, color => 'red' }, + { col => 'time', op => '>', arg => 120, color => 'yellow' }, + { col => 'time', op => '>', arg => 60, color => 'green' }, + { col => 'time', op => '>', arg => 30, color => 'cyan' }, + ], + group_by => [qw(cxn cmd)], + aggregate => 0, + }, + + # TODO: some more columns: + # kb_used=hdr='BufUsed' minw='0' num='0' src='percent(1 - ((Key_blocks_unused * key_cache_block_size) / (key_buffer_size||1)))' dec='0' trans='' tbl='q_header' just='-' user='1' maxw='0' label='User-defined' + # retries=hdr='Retries' minw='0' num='0' src='Slave_retried_transactions' dec='0' trans='' tbl='slave_sql_status' just='-' user='1' maxw='0' label='User-defined' + # thd=hdr='Thd' minw='0' num='0' src='Threads_connected' dec='0' trans='' tbl='slave_sql_status' just='-' user='1' maxw='0' label='User-defined' + + q_header => { + capt => 'Q-mode Header', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + questions => { src => 'Questions' }, + qps => { src => 'Questions/Uptime_hires', dec => 1, trans => [qw(shorten)] }, + load => { src => $exprs{ServerLoad}, dec => 1, trans => [qw(shorten)] }, + slow => { src => 'Slow_queries', dec => 1, trans => [qw(shorten)] }, + q_cache_hit => { src => $exprs{QcacheHitRatio}, dec => 1, trans => [qw(percent)] }, + key_buffer_hit => { src => '1-(Key_reads/(Key_read_requests||1))', dec => 1, trans => [qw(percent)] }, + bps_in => { src => 'Bytes_received/Uptime_hires', dec => 1, trans => [qw(shorten)] }, + bps_out => { src => 'Bytes_sent/Uptime_hires', dec => 1, trans => [qw(shorten)] }, + when => { src => 'when' }, + }, + visible => [ qw(cxn when load qps slow q_cache_hit key_buffer_hit bps_in bps_out)], + filters => [], + sort_cols => 'when cxn', + sort_dir => '1', + innodb => '', + hide_caption => 1, + group_by => [], + aggregate => 0, + }, + row_operations => { + capt => 'InnoDB Row Operations', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + num_inserts => { src => 'IB_ro_num_rows_ins' }, + num_updates => { src => 'IB_ro_num_rows_upd' }, + num_reads => { src => 'IB_ro_num_rows_read' }, + num_deletes => { src => 'IB_ro_num_rows_del' }, + num_inserts_sec => { src => 'IB_ro_ins_sec' }, + num_updates_sec => { src => 'IB_ro_upd_sec' }, + num_reads_sec => { src => 'IB_ro_read_sec' }, + num_deletes_sec => { src => 'IB_ro_del_sec' }, + }, + visible => [ qw(cxn num_inserts num_updates num_reads num_deletes num_inserts_sec + num_updates_sec num_reads_sec num_deletes_sec)], + filters => [], + sort_cols => 'cxn', + sort_dir => '1', + innodb => 'ro', + group_by => [], + aggregate => 0, + }, + row_operation_misc => { + capt => 'Row Operation Misc', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + queries_in_queue => { src => 'IB_ro_queries_in_queue' }, + queries_inside => { src => 'IB_ro_queries_inside' }, + read_views_open => { src => 'IB_ro_read_views_open' }, + main_thread_id => { src => 'IB_ro_main_thread_id' }, + main_thread_proc_no => { src => 'IB_ro_main_thread_proc_no' }, + main_thread_state => { src => 'IB_ro_main_thread_state' }, + num_res_ext => { src => 'IB_ro_n_reserved_extents' }, + }, + visible => [ qw(cxn queries_in_queue queries_inside read_views_open main_thread_state)], + filters => [], + sort_cols => 'cxn', + sort_dir => '1', + innodb => 'ro', + group_by => [], + aggregate => 0, + }, + semaphores => { + capt => 'InnoDB Semaphores', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + mutex_os_waits => { src => 'IB_sm_mutex_os_waits' }, + mutex_spin_rounds => { src => 'IB_sm_mutex_spin_rounds' }, + mutex_spin_waits => { src => 'IB_sm_mutex_spin_waits' }, + reservation_count => { src => 'IB_sm_reservation_count' }, + rw_excl_os_waits => { src => 'IB_sm_rw_excl_os_waits' }, + rw_excl_spins => { src => 'IB_sm_rw_excl_spins' }, + rw_shared_os_waits => { src => 'IB_sm_rw_shared_os_waits' }, + rw_shared_spins => { src => 'IB_sm_rw_shared_spins' }, + signal_count => { src => 'IB_sm_signal_count' }, + wait_array_size => { src => 'IB_sm_wait_array_size' }, + }, + visible => [ qw(cxn mutex_os_waits mutex_spin_waits mutex_spin_rounds + rw_excl_os_waits rw_excl_spins rw_shared_os_waits rw_shared_spins + signal_count reservation_count )], + filters => [], + sort_cols => 'cxn', + sort_dir => '1', + innodb => 'sm', + group_by => [], + aggregate => 0, + }, + slave_io_status => { + capt => 'Slave I/O Status', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + connect_retry => { src => 'connect_retry' }, + master_host => { src => 'master_host', hdr => 'Master'}, + master_log_file => { src => 'master_log_file', hdr => 'File' }, + master_port => { src => 'master_port' }, + master_ssl_allowed => { src => 'master_ssl_allowed' }, + master_ssl_ca_file => { src => 'master_ssl_ca_file' }, + master_ssl_ca_path => { src => 'master_ssl_ca_path' }, + master_ssl_cert => { src => 'master_ssl_cert' }, + master_ssl_cipher => { src => 'master_ssl_cipher' }, + master_ssl_key => { src => 'master_ssl_key' }, + master_user => { src => 'master_user' }, + read_master_log_pos => { src => 'read_master_log_pos', hdr => 'Pos' }, + relay_log_size => { src => 'relay_log_space', trans => [qw(shorten)] }, + slave_io_running => { src => 'slave_io_running', hdr => 'On?' }, + slave_io_state => { src => 'slave_io_state', hdr => 'State' }, + }, + visible => [ qw(cxn master_host slave_io_running master_log_file relay_log_size read_master_log_pos slave_io_state)], + filters => [ qw( cxn_is_slave ) ], + sort_cols => 'slave_io_running cxn', + colors => [ + { col => 'slave_io_running', op => 'ne', arg => 'Yes', color => 'black on_red' }, + ], + sort_dir => '1', + innodb => '', + group_by => [], + aggregate => 0, + }, + slave_sql_status => { + capt => 'Slave SQL Status', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + exec_master_log_pos => { src => 'exec_master_log_pos', hdr => 'Master Pos' }, + last_errno => { src => 'last_errno' }, + last_error => { src => 'last_error' }, + master_host => { src => 'master_host', hdr => 'Master' }, + relay_log_file => { src => 'relay_log_file' }, + relay_log_pos => { src => 'relay_log_pos' }, + relay_log_size => { src => 'relay_log_space', trans => [qw(shorten)] }, + relay_master_log_file => { src => 'relay_master_log_file', hdr => 'Master File' }, + replicate_do_db => { src => 'replicate_do_db' }, + replicate_do_table => { src => 'replicate_do_table' }, + replicate_ignore_db => { src => 'replicate_ignore_db' }, + replicate_ignore_table => { src => 'replicate_ignore_table' }, + replicate_wild_do_table => { src => 'replicate_wild_do_table' }, + replicate_wild_ignore_table => { src => 'replicate_wild_ignore_table' }, + skip_counter => { src => 'skip_counter' }, + slave_sql_running => { src => 'slave_sql_running', hdr => 'On?' }, + until_condition => { src => 'until_condition' }, + until_log_file => { src => 'until_log_file' }, + until_log_pos => { src => 'until_log_pos' }, + time_behind_master => { src => 'seconds_behind_master', trans => [ qw(secs_to_time) ] }, + bytes_behind_master => { src => 'master_log_file && master_log_file eq relay_master_log_file ? read_master_log_pos - exec_master_log_pos : 0', trans => [qw(shorten)] }, + slave_catchup_rate => { src => $exprs{SlaveCatchupRate}, trans => [ qw(set_precision) ] }, + slave_open_temp_tables => { src => 'Slave_open_temp_tables' }, + }, + visible => [ qw(cxn master_host slave_sql_running time_behind_master slave_catchup_rate slave_open_temp_tables relay_log_pos last_error)], + filters => [ qw( cxn_is_slave ) ], + sort_cols => 'slave_sql_running cxn', + sort_dir => '1', + innodb => '', + colors => [ + { col => 'slave_sql_running', op => 'ne', arg => 'Yes', color => 'black on_red' }, + { col => 'time_behind_master', op => '>', arg => 600, color => 'red' }, + { col => 'time_behind_master', op => '>', arg => 60, color => 'yellow' }, + { col => 'time_behind_master', op => '==', arg => 0, color => 'white' }, + ], + group_by => [], + aggregate => 0, + }, + t_header => { + capt => 'T-Mode Header', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + dirty_bufs => { src => $exprs{DirtyBufs}, trans => [qw(percent)] }, + history_list_len => { src => 'IB_tx_history_list_len' }, + lock_structs => { src => 'IB_tx_num_lock_structs' }, + num_txns => { src => $exprs{NumTxns} }, + max_txn => { src => $exprs{MaxTxnTime}, trans => [qw(secs_to_time)] }, + undo_for => { src => 'IB_tx_purge_undo_for' }, + used_bufs => { src => $exprs{BufPoolFill}, trans => [qw(percent)]}, + versions => { src => $exprs{OldVersions} }, + }, + visible => [ qw(cxn history_list_len versions undo_for dirty_bufs used_bufs num_txns max_txn lock_structs)], + filters => [ ], + sort_cols => 'cxn', + sort_dir => '1', + innodb => '', + colors => [], + hide_caption => 1, + group_by => [], + aggregate => 0, + }, + var_status => { + capt => 'Variables & Status', + cust => {}, + cols => {}, # Generated from current varset + visible => [], # Generated from current varset + filters => [], + sort_cols => '', + sort_dir => 1, + innodb => '', + temp => 1, # Do not persist to config file. + hide_caption => 1, + pivot => 0, + group_by => [], + aggregate => 0, + }, + wait_array => { + capt => 'InnoDB Wait Array', + cust => {}, + cols => { + cxn => { src => 'cxn' }, + thread => { src => 'thread' }, + waited_at_filename => { src => 'waited_at_filename' }, + waited_at_line => { src => 'waited_at_line' }, + 'time' => { src => 'waited_secs', trans => [ qw(secs_to_time) ] }, + request_type => { src => 'request_type' }, + lock_mem_addr => { src => 'lock_mem_addr' }, + lock_cfile_name => { src => 'lock_cfile_name' }, + lock_cline => { src => 'lock_cline' }, + writer_thread => { src => 'writer_thread' }, + writer_lock_mode => { src => 'writer_lock_mode' }, + num_readers => { src => 'num_readers' }, + lock_var => { src => 'lock_var' }, + waiters_flag => { src => 'waiters_flag' }, + last_s_file_name => { src => 'last_s_file_name' }, + last_s_line => { src => 'last_s_line' }, + last_x_file_name => { src => 'last_x_file_name' }, + last_x_line => { src => 'last_x_line' }, + cell_waiting => { src => 'cell_waiting' }, + cell_event_set => { src => 'cell_event_set' }, + }, + visible => [ qw(cxn thread time waited_at_filename waited_at_line request_type num_readers lock_var waiters_flag cell_waiting cell_event_set)], + filters => [], + sort_cols => 'cxn -time', + sort_dir => '1', + innodb => 'sm', + group_by => [], + aggregate => 0, + }, +); + +# Initialize %tbl_meta from %columns and do some checks. +foreach my $table_name ( keys %tbl_meta ) { + my $table = $tbl_meta{$table_name}; + my $cols = $table->{cols}; + + foreach my $col_name ( keys %$cols ) { + my $col_def = $table->{cols}->{$col_name}; + die "I can't find a column named '$col_name' for '$table_name'" unless $columns{$col_name}; + $columns{$col_name}->{referenced} = 1; + + foreach my $prop ( keys %col_props ) { + # Each column gets non-existing values set from %columns or defaults from %col_props. + if ( !$col_def->{$prop} ) { + $col_def->{$prop} + = defined($columns{$col_name}->{$prop}) + ? $columns{$col_name}->{$prop} + : $col_props{$prop}; + } + } + + # Ensure transformations and aggregate functions are valid + die "Unknown aggregate function '$col_def->{agg}' " + . "for column '$col_name' in table '$table_name'" + unless exists $agg_funcs{$col_def->{agg}}; + foreach my $trans ( @{$col_def->{trans}} ) { + die "Unknown transformation '$trans' " + . "for column '$col_name' in table '$table_name'" + unless exists $trans_funcs{$trans}; + } + } + + # Ensure each column in visible and group_by exists in cols + foreach my $place ( qw(visible group_by) ) { + foreach my $col_name ( @{$table->{$place}} ) { + if ( !exists $cols->{$col_name} ) { + die "Column '$col_name' is listed in '$place' for '$table_name', but doesn't exist"; + } + } + } + + # Compile sort and color subroutines + $table->{sort_func} = make_sort_func($table); + $table->{color_func} = make_color_func($table); +} + +# This is for code cleanup: +{ + my @unused_cols = grep { !$columns{$_}->{referenced} } sort keys %columns; + if ( @unused_cols ) { + die "The following columns are not used: " + . join(' ', @unused_cols); + } +} + +# ########################################################################### +# Operating modes {{{3 +# ########################################################################### +my %modes = ( + B => { + hdr => 'InnoDB Buffers', + cust => {}, + note => 'Shows buffer info from InnoDB', + action_for => { + i => { + action => sub { toggle_config('status_inc') }, + label => 'Toggle incremental status display', + }, + }, + display_sub => \&display_B, + connections => [], + server_group => '', + one_connection => 0, + tables => [qw(buffer_pool page_statistics insert_buffers adaptive_hash_index)], + visible_tables => [qw(buffer_pool page_statistics insert_buffers adaptive_hash_index)], + }, + C => { + hdr => 'Command Summary', + cust => {}, + note => 'Shows relative magnitude of variables', + action_for => { + s => { + action => sub { get_config_interactive('cmd_filter') }, + label => 'Choose variable prefix', + }, + }, + display_sub => \&display_C, + connections => [], + server_group => '', + one_connection => 0, + tables => [qw(cmd_summary)], + visible_tables => [qw(cmd_summary)], + }, + D => { + hdr => 'InnoDB Deadlocks', + cust => {}, + note => 'View InnoDB deadlock information', + action_for => { + c => { + action => sub { edit_table('deadlock_transactions') }, + label => 'Choose visible columns', + }, + w => { + action => \&create_deadlock, + label => 'Wipe deadlock status info by creating a deadlock', + }, + }, + display_sub => \&display_D, + connections => [], + server_group => '', + one_connection => 0, + tables => [qw(deadlock_transactions deadlock_locks)], + visible_tables => [qw(deadlock_transactions deadlock_locks)], + }, + F => { + hdr => 'InnoDB FK Err', + cust => {}, + note => 'View the latest InnoDB foreign key error', + action_for => {}, + display_sub => \&display_F, + connections => [], + server_group => '', + one_connection => 1, + tables => [qw(fk_error)], + visible_tables => [qw(fk_error)], + }, + I => { + hdr => 'InnoDB I/O Info', + cust => {}, + note => 'Shows I/O info (i/o, log...) from InnoDB', + action_for => { + i => { + action => sub { toggle_config('status_inc') }, + label => 'Toggle incremental status display', + }, + }, + display_sub => \&display_I, + connections => [], + server_group => '', + one_connection => 0, + tables => [qw(io_threads pending_io file_io_misc log_statistics)], + visible_tables => [qw(io_threads pending_io file_io_misc log_statistics)], + }, + L => { + hdr => 'Locks', + cust => {}, + note => 'Shows transaction locks', + action_for => { + a => { + action => sub { send_cmd_to_servers('CREATE TABLE IF NOT EXISTS test.innodb_lock_monitor(a int) ENGINE=InnoDB', 0, '', []); }, + label => 'Start the InnoDB Lock Monitor', + }, + o => { + action => sub { send_cmd_to_servers('DROP TABLE IF EXISTS test.innodb_lock_monitor', 0, '', []); }, + label => 'Stop the InnoDB Lock Monitor', + }, + }, + display_sub => \&display_L, + connections => [], + server_group => '', + one_connection => 0, + tables => [qw(innodb_locks)], + visible_tables => [qw(innodb_locks)], + }, + M => { + hdr => 'Replication Status', + cust => {}, + note => 'Shows replication (master and slave) status', + action_for => { + a => { + action => sub { send_cmd_to_servers('START SLAVE', 0, 'START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE = ?, MASTER_LOG_POS = ?', []); }, + label => 'Start slave(s)', + }, + i => { + action => sub { toggle_config('status_inc') }, + label => 'Toggle incremental status display', + }, + o => { + action => sub { send_cmd_to_servers('STOP SLAVE', 0, '', []); }, + label => 'Stop slave(s)', + }, + b => { + action => sub { purge_master_logs() }, + label => 'Purge unused master logs', + }, + }, + display_sub => \&display_M, + connections => [], + server_group => '', + one_connection => 0, + tables => [qw(slave_sql_status slave_io_status master_status)], + visible_tables => [qw(slave_sql_status slave_io_status master_status)], + }, + O => { + hdr => 'Open Tables', + cust => {}, + note => 'Shows open tables in MySQL', + action_for => { + r => { + action => sub { reverse_sort('open_tables'); }, + label => 'Reverse sort order', + }, + s => { + action => sub { choose_sort_cols('open_tables'); }, + label => "Choose sort column", + }, + }, + display_sub => \&display_O, + connections => [], + server_group => '', + one_connection => 0, + tables => [qw(open_tables)], + visible_tables => [qw(open_tables)], + }, + Q => { + hdr => 'Query List', + cust => {}, + note => 'Shows queries from SHOW FULL PROCESSLIST', + action_for => { + a => { + action => sub { toggle_filter('processlist', 'hide_self') }, + label => 'Toggle the innotop process', + }, + c => { + action => sub { edit_table('processlist') }, + label => 'Choose visible columns', + }, + e => { + action => sub { analyze_query('e'); }, + label => "Explain a thread's query", + }, + f => { + action => sub { analyze_query('f'); }, + label => "Show a thread's full query", + }, + h => { + action => sub { toggle_visible_table('Q', 'q_header') }, + label => 'Toggle the header on and off', + }, + i => { + action => sub { toggle_filter('processlist', 'hide_inactive') }, + label => 'Toggle idle processes', + }, + k => { + action => sub { kill_query('CONNECTION') }, + label => "Kill a query's connection", + }, + r => { + action => sub { reverse_sort('processlist'); }, + label => 'Reverse sort order', + }, + s => { + action => sub { choose_sort_cols('processlist'); }, + label => "Change the display's sort column", + }, + x => { + action => sub { kill_query('QUERY') }, + label => "Kill a query", + }, + }, + display_sub => \&display_Q, + connections => [], + server_group => '', + one_connection => 0, + tables => [qw(q_header processlist)], + visible_tables => [qw(q_header processlist)], + }, + R => { + hdr => 'InnoDB Row Ops', + cust => {}, + note => 'Shows InnoDB row operation and semaphore info', + action_for => { + i => { + action => sub { toggle_config('status_inc') }, + label => 'Toggle incremental status display', + }, + }, + display_sub => \&display_R, + connections => [], + server_group => '', + one_connection => 0, + tables => [qw(row_operations row_operation_misc semaphores wait_array)], + visible_tables => [qw(row_operations row_operation_misc semaphores wait_array)], + }, + S => { + hdr => 'Variables & Status', + cust => {}, + note => 'Shows query load statistics a la vmstat', + action_for => { + '>' => { + action => sub { switch_var_set('S_set', 1) }, + label => 'Switch to next variable set', + }, + '<' => { + action => sub { switch_var_set('S_set', -1) }, + label => 'Switch to prev variable set', + }, + c => { + action => sub { + choose_var_set('S_set'); + start_S_mode(); + }, + label => "Choose which set to display", + }, + e => { + action => \&edit_current_var_set, + label => 'Edit the current set of variables', + }, + i => { + action => sub { $clear_screen_sub->(); toggle_config('status_inc') }, + label => 'Toggle incremental status display', + }, + '-' => { + action => sub { set_display_precision(-1) }, + label => 'Decrease fractional display precision', + }, + '+' => { + action => sub { set_display_precision(1) }, + label => 'Increase fractional display precision', + }, + g => { + action => sub { set_s_mode('g') }, + label => 'Switch to graph (tload) view', + }, + s => { + action => sub { set_s_mode('s') }, + label => 'Switch to standard (vmstat) view', + }, + v => { + action => sub { set_s_mode('v') }, + label => 'Switch to pivoted view', + }, + }, + display_sub => \&display_S, + no_clear_screen => 1, + connections => [], + server_group => '', + one_connection => 0, + tables => [qw(var_status)], + visible_tables => [qw(var_status)], + }, + T => { + hdr => 'InnoDB Txns', + cust => {}, + note => 'Shows InnoDB transactions in top-like format', + action_for => { + a => { + action => sub { toggle_filter('innodb_transactions', 'hide_self') }, + label => 'Toggle the innotop process', + }, + c => { + action => sub { edit_table('innodb_transactions') }, + label => 'Choose visible columns', + }, + e => { + action => sub { analyze_query('e'); }, + label => "Explain a thread's query", + }, + f => { + action => sub { analyze_query('f'); }, + label => "Show a thread's full query", + }, + h => { + action => sub { toggle_visible_table('T', 't_header') }, + label => 'Toggle the header on and off', + }, + i => { + action => sub { toggle_filter('innodb_transactions', 'hide_inactive') }, + label => 'Toggle inactive transactions', + }, + k => { + action => sub { kill_query('CONNECTION') }, + label => "Kill a transaction's connection", + }, + r => { + action => sub { reverse_sort('innodb_transactions'); }, + label => 'Reverse sort order', + }, + s => { + action => sub { choose_sort_cols('innodb_transactions'); }, + label => "Change the display's sort column", + }, + x => { + action => sub { kill_query('QUERY') }, + label => "Kill a query", + }, + }, + display_sub => \&display_T, + connections => [], + server_group => '', + one_connection => 0, + tables => [qw(t_header innodb_transactions)], + visible_tables => [qw(t_header innodb_transactions)], + }, +); + +# ########################################################################### +# Global key mappings {{{3 +# Keyed on a single character, which is read from the keyboard. Uppercase +# letters switch modes. Lowercase letters access commands when in a mode. +# These can be overridden by action_for in %modes. +# ########################################################################### +my %action_for = ( + '$' => { + action => \&edit_configuration, + label => 'Edit configuration settings', + }, + '?' => { + action => \&display_help, + label => 'Show help', + }, + '!' => { + action => \&display_license, + label => 'Show license and warranty', + }, + '^' => { + action => \&edit_table, + label => "Edit the displayed table(s)", + }, + '#' => { + action => \&choose_server_groups, + label => 'Select/create server groups', + }, + '@' => { + action => \&choose_servers, + label => 'Select/create server connections', + }, + '/' => { + action => \&add_quick_filter, + label => 'Quickly filter what you see', + }, + '\\' => { + action => \&clear_quick_filters, + label => 'Clear quick-filters', + }, + '%' => { + action => \&choose_filters, + label => 'Choose and edit table filters', + }, + "\t" => { + action => \&next_server_group, + label => 'Switch to the next server group', + key => 'TAB', + }, + '=' => { + action => \&toggle_aggregate, + label => 'Toggle aggregation', + }, + # TODO: can these be auto-generated from %modes? + B => { + action => sub { switch_mode('B') }, + label => '', + }, + C => { + action => sub { switch_mode('C') }, + label => '', + }, + D => { + action => sub { switch_mode('D') }, + label => '', + }, + F => { + action => sub { switch_mode('F') }, + label => '', + }, + I => { + action => sub { switch_mode('I') }, + label => '', + }, + L => { + action => sub { switch_mode('L') }, + label => '', + }, + M => { + action => sub { switch_mode('M') }, + label => '', + }, + O => { + action => sub { switch_mode('O') }, + label => '', + }, + Q => { + action => sub { switch_mode('Q') }, + label => '', + }, + R => { + action => sub { switch_mode('R') }, + label => '', + }, + S => { + action => \&start_S_mode, + label => '', + }, + T => { + action => sub { switch_mode('T') }, + label => '', + }, + d => { + action => sub { get_config_interactive('interval') }, + label => 'Change refresh interval', + }, + n => { action => \&next_server, label => 'Switch to the next connection' }, + p => { action => \&pause, label => 'Pause innotop', }, + q => { action => \&finish, label => 'Quit innotop', }, +); + +# ########################################################################### +# Sleep times after certain statements {{{3 +# ########################################################################### +my %stmt_sleep_time_for = (); + +# ########################################################################### +# Config editor key mappings {{{3 +# ########################################################################### +my %cfg_editor_action = ( + c => { + note => 'Edit columns, etc in the displayed table(s)', + func => \&edit_table, + }, + g => { + note => 'Edit general configuration', + func => \&edit_configuration_variables, + }, + k => { + note => 'Edit row-coloring rules', + func => \&edit_color_rules, + }, + p => { + note => 'Manage plugins', + func => \&edit_plugins, + }, + s => { + note => 'Edit server groups', + func => \&edit_server_groups, + }, + S => { + note => 'Edit SQL statement sleep delays', + func => \&edit_stmt_sleep_times, + }, + t => { + note => 'Choose which table(s) to display in this mode', + func => \&choose_mode_tables, + }, +); + +# ########################################################################### +# Color editor key mappings {{{3 +# ########################################################################### +my %color_editor_action = ( + n => { + note => 'Create a new color rule', + func => sub { + my ( $tbl, $idx ) = @_; + my $meta = $tbl_meta{$tbl}; + + $clear_screen_sub->(); + my $col; + do { + $col = prompt_list( + 'Choose the target column for the rule', + '', + sub { return keys %{$meta->{cols}} }, + { map { $_ => $meta->{cols}->{$_}->{label} } keys %{$meta->{cols}} }); + } while ( !$col ); + ( $col ) = grep { $_ } split(/\W+/, $col); + return $idx unless $col && exists $meta->{cols}->{$col}; + + $clear_screen_sub->(); + my $op; + do { + $op = prompt_list( + 'Choose the comparison operator for the rule', + '', + sub { return keys %comp_ops }, + { map { $_ => $comp_ops{$_} } keys %comp_ops } ); + } until ( $op ); + $op =~ s/\s+//g; + return $idx unless $op && exists $comp_ops{$op}; + + my $arg; + do { + $arg = prompt('Specify an argument for the comparison'); + } until defined $arg; + + my $color; + do { + $color = prompt_list( + 'Choose the color(s) the row should be when the rule matches', + '', + sub { return keys %ansicolors }, + { map { $_ => $_ } keys %ansicolors } ); + } until defined $color; + $color = join(' ', unique(grep { exists $ansicolors{$_} } split(/\W+/, $color))); + return $idx unless $color; + + push @{$tbl_meta{$tbl}->{colors}}, { + col => $col, + op => $op, + arg => $arg, + color => $color + }; + $tbl_meta{$tbl}->{cust}->{colors} = 1; + + return $idx; + }, + }, + d => { + note => 'Remove the selected rule', + func => sub { + my ( $tbl, $idx ) = @_; + my @rules = @{ $tbl_meta{$tbl}->{colors} }; + return 0 unless @rules > 0 && $idx < @rules && $idx >= 0; + splice(@{$tbl_meta{$tbl}->{colors}}, $idx, 1); + $tbl_meta{$tbl}->{cust}->{colors} = 1; + return $idx == @rules ? $#rules : $idx; + }, + }, + j => { + note => 'Move highlight down one', + func => sub { + my ( $tbl, $idx ) = @_; + my $num_rules = scalar @{$tbl_meta{$tbl}->{colors}}; + return ($idx + 1) % $num_rules; + }, + }, + k => { + note => 'Move highlight up one', + func => sub { + my ( $tbl, $idx ) = @_; + my $num_rules = scalar @{$tbl_meta{$tbl}->{colors}}; + return ($idx - 1) % $num_rules; + }, + }, + '+' => { + note => 'Move selected rule up one', + func => sub { + my ( $tbl, $idx ) = @_; + my $meta = $tbl_meta{$tbl}; + my $dest = $idx == 0 ? scalar(@{$meta->{colors}} - 1) : $idx - 1; + my $temp = $meta->{colors}->[$idx]; + $meta->{colors}->[$idx] = $meta->{colors}->[$dest]; + $meta->{colors}->[$dest] = $temp; + $meta->{cust}->{colors} = 1; + return $dest; + }, + }, + '-' => { + note => 'Move selected rule down one', + func => sub { + my ( $tbl, $idx ) = @_; + my $meta = $tbl_meta{$tbl}; + my $dest = $idx == scalar(@{$meta->{colors}} - 1) ? 0 : $idx + 1; + my $temp = $meta->{colors}->[$idx]; + $meta->{colors}->[$idx] = $meta->{colors}->[$dest]; + $meta->{colors}->[$dest] = $temp; + $meta->{cust}->{colors} = 1; + return $dest; + }, + }, +); + +# ########################################################################### +# Plugin editor key mappings {{{3 +# ########################################################################### +my %plugin_editor_action = ( + '*' => { + note => 'Toggle selected plugin active/inactive', + func => sub { + my ( $plugins, $idx ) = @_; + my $plugin = $plugins->[$idx]; + $plugin->{active} = $plugin->{active} ? 0 : 1; + return $idx; + }, + }, + j => { + note => 'Move highlight down one', + func => sub { + my ( $plugins, $idx ) = @_; + return ($idx + 1) % scalar(@$plugins); + }, + }, + k => { + note => 'Move highlight up one', + func => sub { + my ( $plugins, $idx ) = @_; + return $idx == 0 ? @$plugins - 1 : $idx - 1; + }, + }, +); + +# ########################################################################### +# Table editor key mappings {{{3 +# ########################################################################### +my %tbl_editor_action = ( + a => { + note => 'Add a column to the table', + func => sub { + my ( $tbl, $col ) = @_; + my @visible_cols = @{ $tbl_meta{$tbl}->{visible} }; + my %all_cols = %{ $tbl_meta{$tbl}->{cols} }; + delete @all_cols{@visible_cols}; + my $choice = prompt_list( + 'Choose a column', + '', + sub { return keys %all_cols; }, + { map { $_ => $all_cols{$_}->{label} || $all_cols{$_}->{hdr} } keys %all_cols }); + if ( $all_cols{$choice} ) { + push @{$tbl_meta{$tbl}->{visible}}, $choice; + $tbl_meta{$tbl}->{cust}->{visible} = 1; + return $choice; + } + return $col; + }, + }, + n => { + note => 'Create a new column and add it to the table', + func => sub { + my ( $tbl, $col ) = @_; + + $clear_screen_sub->(); + print word_wrap("Choose a name for the column. This name is not displayed, and is used only " + . "for internal reference. It can contain only lowercase letters, numbers, " + . "and underscores."); + print "\n\n"; + do { + $col = prompt("Enter column name"); + $col = '' if $col =~ m/[^a-z0-9_]/; + } while ( !$col ); + + $clear_screen_sub->(); + my $hdr; + do { + $hdr = prompt("Enter column header"); + } while ( !$hdr ); + + $clear_screen_sub->(); + print "Choose a source for the column's data\n\n"; + my ( $src, $sub, $err ); + do { + if ( $err ) { + print "Error: $err\n\n"; + } + $src = prompt("Enter column source"); + if ( $src ) { + ( $sub, $err ) = compile_expr($src); + } + } until ( !$err); + + # TODO: this duplicates %col_props. + $tbl_meta{$tbl}->{cols}->{$col} = { + hdr => $hdr, + src => $src, + just => '-', + num => 0, + label => 'User-defined', + user => 1, + tbl => $tbl, + minw => 0, + maxw => 0, + trans => [], + func => $sub, + dec => 0, + agg => 0, + aggonly => 0, + }; + + $tbl_meta{$tbl}->{visible} = [ unique(@{$tbl_meta{$tbl}->{visible}}, $col) ]; + $tbl_meta{$tbl}->{cust}->{visible} = 1; + return $col; + }, + }, + d => { + note => 'Remove selected column', + func => sub { + my ( $tbl, $col ) = @_; + my @visible_cols = @{ $tbl_meta{$tbl}->{visible} }; + my $idx = 0; + return $col unless @visible_cols > 1; + while ( $visible_cols[$idx] ne $col ) { + $idx++; + } + $tbl_meta{$tbl}->{visible} = [ grep { $_ ne $col } @visible_cols ]; + $tbl_meta{$tbl}->{cust}->{visible} = 1; + return $idx == $#visible_cols ? $visible_cols[$idx - 1] : $visible_cols[$idx + 1]; + }, + }, + e => { + note => 'Edit selected column', + func => sub { + # TODO: make this editor hotkey-driven and give readline support. + my ( $tbl, $col ) = @_; + $clear_screen_sub->(); + my $meta = $tbl_meta{$tbl}->{cols}->{$col}; + my @prop = qw(hdr label src just num minw maxw trans agg); # TODO redundant + + my $answer; + do { + # Do what the user asked... + if ( $answer && grep { $_ eq $answer } @prop ) { + # Some properties are arrays, others scalars. + my $ini = ref $col_props{$answer} ? join(' ', @{$meta->{$answer}}) : $meta->{$answer}; + my $val = prompt("New value for $answer", undef, $ini); + $val = [ split(' ', $val) ] if ref($col_props{$answer}); + if ( $answer eq 'trans' ) { + $val = [ unique(grep{ exists $trans_funcs{$_} } @$val) ]; + } + @{$meta}{$answer, 'user', 'tbl' } = ( $val, 1, $tbl ); + } + + my @display_lines = ( + '', + "You are editing column $tbl.$col.\n", + ); + + push @display_lines, create_table2( + \@prop, + { map { $_ => $_ } @prop }, + { map { $_ => ref $meta->{$_} eq 'ARRAY' ? join(' ', @{$meta->{$_}}) + : ref $meta->{$_} ? '[expression code]' + : $meta->{$_} + } @prop + }, + { sep => ' ' }); + draw_screen(\@display_lines, { raw => 1 }); + print "\n\n"; # One to add space, one to clear readline artifacts + $answer = prompt('Edit what? (q to quit)'); + } while ( $answer ne 'q' ); + + return $col; + }, + }, + j => { + note => 'Move highlight down one', + func => sub { + my ( $tbl, $col ) = @_; + my @visible_cols = @{ $tbl_meta{$tbl}->{visible} }; + my $idx = 0; + while ( $visible_cols[$idx] ne $col ) { + $idx++; + } + return $visible_cols[ ($idx + 1) % @visible_cols ]; + }, + }, + k => { + note => 'Move highlight up one', + func => sub { + my ( $tbl, $col ) = @_; + my @visible_cols = @{ $tbl_meta{$tbl}->{visible} }; + my $idx = 0; + while ( $visible_cols[$idx] ne $col ) { + $idx++; + } + return $visible_cols[ $idx - 1 ]; + }, + }, + '+' => { + note => 'Move selected column up one', + func => sub { + my ( $tbl, $col ) = @_; + my $meta = $tbl_meta{$tbl}; + my @visible_cols = @{$meta->{visible}}; + my $idx = 0; + while ( $visible_cols[$idx] ne $col ) { + $idx++; + } + if ( $idx ) { + $visible_cols[$idx] = $visible_cols[$idx - 1]; + $visible_cols[$idx - 1] = $col; + $meta->{visible} = \@visible_cols; + } + else { + shift @{$meta->{visible}}; + push @{$meta->{visible}}, $col; + } + $meta->{cust}->{visible} = 1; + return $col; + }, + }, + '-' => { + note => 'Move selected column down one', + func => sub { + my ( $tbl, $col ) = @_; + my $meta = $tbl_meta{$tbl}; + my @visible_cols = @{$meta->{visible}}; + my $idx = 0; + while ( $visible_cols[$idx] ne $col ) { + $idx++; + } + if ( $idx == $#visible_cols ) { + unshift @{$meta->{visible}}, $col; + pop @{$meta->{visible}}; + } + else { + $visible_cols[$idx] = $visible_cols[$idx + 1]; + $visible_cols[$idx + 1] = $col; + $meta->{visible} = \@visible_cols; + } + $meta->{cust}->{visible} = 1; + return $col; + }, + }, + f => { + note => 'Choose filters', + func => sub { + my ( $tbl, $col ) = @_; + choose_filters($tbl); + return $col; + }, + }, + o => { + note => 'Edit color rules', + func => sub { + my ( $tbl, $col ) = @_; + edit_color_rules($tbl); + return $col; + }, + }, + s => { + note => 'Choose sort columns', + func => sub { + my ( $tbl, $col ) = @_; + choose_sort_cols($tbl); + return $col; + }, + }, + g => { + note => 'Choose group-by (aggregate) columns', + func => sub { + my ( $tbl, $col ) = @_; + choose_group_cols($tbl); + return $col; + }, + }, +); + +# ########################################################################### +# Global variables and environment {{{2 +# ########################################################################### + +my @this_term_size; # w_chars, h_chars, w_pix, h_pix +my @last_term_size; # w_chars, h_chars, w_pix, h_pix +my $char; +my $windows = $OSNAME =~ m/MSWin/; +my $have_color = 0; +my $MAX_ULONG = 4294967295; # 2^32-1 +my $num_regex = qr/^[+-]?(?=\d|\.)\d*(?:\.\d+)?(?:E[+-]?\d+|)$/i; +my $int_regex = qr/^\d+$/; +my $bool_regex = qr/^[01]$/; +my $term = undef; +my $file = undef; # File to watch for InnoDB monitor output +my $file_mtime = undef; # Status of watched file +my $file_data = undef; # Last chunk of text read from file +my $innodb_parser = InnoDBParser->new; + +my $nonfatal_errs = join('|', + 'Access denied for user', + 'Unknown MySQL server host', + 'Unknown database', + 'Can\'t connect to local MySQL server through socket', + 'Can\'t connect to MySQL server on', + 'MySQL server has gone away', + 'Cannot call SHOW INNODB STATUS', + 'Access denied', + 'AutoCommit', +); + +if ( !$opts{n} ) { + require Term::ReadLine; + $term = Term::ReadLine->new('innotop'); +} + +# Stores status, variables, innodb status, master/slave status etc. +# Keyed on connection name. Each entry is a hashref of current and past data sets, +# keyed on clock tick. +my %vars; +my %info_gotten = (); # Which things have been retrieved for the current clock tick. + +# Stores info on currently displayed queries: cxn, connection ID, query text. +my @current_queries; + +my $lines_printed = 0; +my $clock = 0; # Incremented with every wake-sleep cycle +my $clearing_deadlocks = 0; + +# Find the home directory; it's different on different OSes. +my $homepath = $ENV{HOME} || $ENV{HOMEPATH} || $ENV{USERPROFILE} || '.'; + +# If terminal coloring is available, use it. The only function I want from +# the module is the colored() function. +eval { + if ( !$opts{n} ) { + if ( $windows ) { + require Win32::Console::ANSI; + } + require Term::ANSIColor; + import Term::ANSIColor qw(colored); + $have_color = 1; + } +}; +if ( $EVAL_ERROR || $opts{n} ) { + # If there was an error, manufacture my own colored() function that does no + # coloring. + *colored = sub { pop @_; @_; }; +} + +if ( $opts{n} ) { + $clear_screen_sub = sub {}; +} +elsif ( $windows ) { + $clear_screen_sub = sub { $lines_printed = 0; system("cls") }; +} +else { + my $clear = `clear`; + $clear_screen_sub = sub { $lines_printed = 0; print $clear }; +} + +# ########################################################################### +# Config storage. {{{2 +# ########################################################################### +my %config = ( + color => { + val => $have_color, + note => 'Whether to use terminal coloring', + conf => 'ALL', + pat => $bool_regex, + }, + cmd_filter => { + val => 'Com_', + note => 'Prefix for values in C mode', + conf => [qw(C)], + }, + plugin_dir => { + val => "$homepath/.innotop/plugins", + note => 'Directory where plugins can be found', + conf => 'ALL', + }, + show_percent => { + val => 1, + note => 'Show the % symbol after percentages', + conf => 'ALL', + pat => $bool_regex, + }, + skip_innodb => { + val => 0, + note => 'Disable SHOW INNODB STATUS', + conf => 'ALL', + pat => $bool_regex, + }, + S_func => { + val => 's', + note => 'What to display in S mode: graph, status, pivoted status', + conf => [qw(S)], + pat => qr/^[gsv]$/, + }, + cxn_timeout => { + val => 28800, + note => 'Connection timeout for keeping unused connections alive', + conf => 'ALL', + pat => $int_regex, + }, + graph_char => { + val => '*', + note => 'Character for drawing graphs', + conf => [ qw(S) ], + pat => qr/^.$/, + }, + show_cxn_errors_in_tbl => { + val => 1, + note => 'Whether to display connection errors as rows in the table', + conf => 'ALL', + pat => $bool_regex, + }, + hide_hdr => { + val => 0, + note => 'Whether to show column headers', + conf => 'ALL', + pat => $bool_regex, + }, + show_cxn_errors => { + val => 1, + note => 'Whether to print connection errors to STDOUT', + conf => 'ALL', + pat => $bool_regex, + }, + readonly => { + val => 0, + note => 'Whether the config file is read-only', + conf => [ qw() ], + pat => $bool_regex, + }, + global => { + val => 1, + note => 'Whether to show GLOBAL variables and status', + conf => 'ALL', + pat => $bool_regex, + }, + header_highlight => { + val => 'bold', + note => 'How to highlight table column headers', + conf => 'ALL', + pat => qr/^(?:bold|underline)$/, + }, + display_table_captions => { + val => 1, + note => 'Whether to put captions on tables', + conf => 'ALL', + pat => $bool_regex, + }, + charset => { + val => 'ascii', + note => 'What type of characters should be displayed in queries (ascii, unicode, none)', + conf => 'ALL', + pat => qr/^(?:ascii|unicode|none)$/, + }, + auto_wipe_dl => { + val => 0, + note => 'Whether to auto-wipe InnoDB deadlocks', + conf => 'ALL', + pat => $bool_regex, + }, + max_height => { + val => 30, + note => '[Win32] Max window height', + conf => 'ALL', + }, + debug => { + val => 0, + pat => $bool_regex, + note => 'Debug mode (more verbose errors, uses more memory)', + conf => 'ALL', + }, + num_digits => { + val => 2, + pat => $int_regex, + note => 'How many digits to show in fractional numbers and percents', + conf => 'ALL', + }, + debugfile => { + val => "$homepath/.innotop/core_dump", + note => 'A debug file in case you are interested in error output', + }, + show_statusbar => { + val => 1, + pat => $bool_regex, + note => 'Whether to show the status bar in the display', + conf => 'ALL', + }, + mode => { + val => "T", + note => "Which mode to start in", + cmdline => 1, + }, + status_inc => { + val => 0, + note => 'Whether to show raw or incremental values for status variables', + pat => $bool_regex, + }, + interval => { + val => 10, + pat => qr/^(?:(?:\d*?[1-9]\d*(?:\.\d*)?)|(?:\d*\.\d*?[1-9]\d*))$/, + note => "The interval at which the display will be refreshed. Fractional values allowed.", + }, + num_status_sets => { + val => 9, + pat => $int_regex, + note => 'How many sets of STATUS and VARIABLES values to show', + conf => [ qw(S) ], + }, + S_set => { + val => 'general', + pat => qr/^\w+$/, + note => 'Which set of variables to display in S (Variables & Status) mode', + conf => [ qw(S) ], + }, +); + +# ########################################################################### +# Config file sections {{{2 +# The configuration file is broken up into sections like a .ini file. This +# variable defines those sections and the subroutines responsible for reading +# and writing them. +# ########################################################################### +my %config_file_sections = ( + plugins => { + reader => \&load_config_plugins, + writer => \&save_config_plugins, + }, + group_by => { + reader => \&load_config_group_by, + writer => \&save_config_group_by, + }, + filters => { + reader => \&load_config_filters, + writer => \&save_config_filters, + }, + active_filters => { + reader => \&load_config_active_filters, + writer => \&save_config_active_filters, + }, + visible_tables => { + reader => \&load_config_visible_tables, + writer => \&save_config_visible_tables, + }, + sort_cols => { + reader => \&load_config_sort_cols, + writer => \&save_config_sort_cols, + }, + active_columns => { + reader => \&load_config_active_columns, + writer => \&save_config_active_columns, + }, + tbl_meta => { + reader => \&load_config_tbl_meta, + writer => \&save_config_tbl_meta, + }, + general => { + reader => \&load_config_config, + writer => \&save_config_config, + }, + connections => { + reader => \&load_config_connections, + writer => \&save_config_connections, + }, + active_connections => { + reader => \&load_config_active_connections, + writer => \&save_config_active_connections, + }, + server_groups => { + reader => \&load_config_server_groups, + writer => \&save_config_server_groups, + }, + active_server_groups => { + reader => \&load_config_active_server_groups, + writer => \&save_config_active_server_groups, + }, + max_values_seen => { + reader => \&load_config_mvs, + writer => \&save_config_mvs, + }, + varsets => { + reader => \&load_config_varsets, + writer => \&save_config_varsets, + }, + colors => { + reader => \&load_config_colors, + writer => \&save_config_colors, + }, + stmt_sleep_times => { + reader => \&load_config_stmt_sleep_times, + writer => \&save_config_stmt_sleep_times, + }, +); + +# Config file sections have some dependencies, so they have to be read/written in order. +my @ordered_config_file_sections = qw(general plugins filters active_filters tbl_meta + connections active_connections server_groups active_server_groups max_values_seen + active_columns sort_cols visible_tables varsets colors stmt_sleep_times + group_by); + +# All events for which plugins may register themselves. Entries are arrayrefs. +my %event_listener_for = map { $_ => [] } + qw( + extract_values + set_to_tbl_pre_filter set_to_tbl_pre_sort set_to_tbl_pre_group + set_to_tbl_pre_colorize set_to_tbl_pre_transform set_to_tbl_pre_pivot + set_to_tbl_pre_create set_to_tbl_post_create + draw_screen + ); + +# All variables to which plugins have access. +my %pluggable_vars = ( + action_for => \%action_for, + agg_funcs => \%agg_funcs, + config => \%config, + connections => \%connections, + dbhs => \%dbhs, + filters => \%filters, + modes => \%modes, + server_groups => \%server_groups, + tbl_meta => \%tbl_meta, + trans_funcs => \%trans_funcs, + var_sets => \%var_sets, +); + +# ########################################################################### +# Contains logic to generate prepared statements for a given function for a +# given DB connection. Returns a $sth. +# ########################################################################### +my %stmt_maker_for = ( + INNODB_STATUS => sub { + my ( $dbh ) = @_; + return $dbh->prepare(version_ge( $dbh, '5.0.0' ) + ? 'SHOW ENGINE INNODB STATUS' + : 'SHOW INNODB STATUS'); + }, + SHOW_VARIABLES => sub { + my ( $dbh ) = @_; + return $dbh->prepare($config{global}->{val} && version_ge( $dbh, '4.0.3' ) + ? 'SHOW GLOBAL VARIABLES' + : 'SHOW VARIABLES'); + }, + SHOW_STATUS => sub { + my ( $dbh ) = @_; + return $dbh->prepare($config{global}->{val} && version_ge( $dbh, '5.0.2' ) + ? 'SHOW GLOBAL STATUS' + : 'SHOW STATUS'); + }, + KILL_QUERY => sub { + my ( $dbh ) = @_; + return $dbh->prepare(version_ge( $dbh, '5.0.0' ) + ? 'KILL QUERY ?' + : 'KILL ?'); + }, + SHOW_MASTER_LOGS => sub { + my ( $dbh ) = @_; + return $dbh->prepare('SHOW MASTER LOGS'); + }, + SHOW_MASTER_STATUS => sub { + my ( $dbh ) = @_; + return $dbh->prepare('SHOW MASTER STATUS'); + }, + SHOW_SLAVE_STATUS => sub { + my ( $dbh ) = @_; + return $dbh->prepare('SHOW SLAVE STATUS'); + }, + KILL_CONNECTION => sub { + my ( $dbh ) = @_; + return $dbh->prepare(version_ge( $dbh, '5.0.0' ) + ? 'KILL CONNECTION ?' + : 'KILL ?'); + }, + OPEN_TABLES => sub { + my ( $dbh ) = @_; + return version_ge($dbh, '4.0.0') + ? $dbh->prepare('SHOW OPEN TABLES') + : undef; + }, + PROCESSLIST => sub { + my ( $dbh ) = @_; + return $dbh->prepare('SHOW FULL PROCESSLIST'); + }, +); + +# Plugins! +my %plugins = ( +); + +# ########################################################################### +# Run the program {{{1 +# ########################################################################### + +# This config variable is only useful for MS Windows because its terminal +# can't tell how tall it is. +if ( !$windows ) { + delete $config{max_height}; +} + +# Try to lower my priority. +eval { setpriority(0, 0, getpriority(0, 0) + 10); }; + +# Print stuff to the screen immediately, don't wait for a newline. +$OUTPUT_AUTOFLUSH = 1; + +# Clear the screen and load the configuration. +$clear_screen_sub->(); +load_config(); +post_process_tbl_meta(); + +# Make sure no changes are written to config file in non-interactive mode. +if ( $opts{n} ) { + $config{readonly}->{val} = 1; +} + +eval { + + # Open the file for InnoDB status + if ( @ARGV ) { + my $filename = shift @ARGV; + open $file, "<", $filename + or die "Cannot open '$filename': $OS_ERROR"; + } + + # In certain modes we might have to collect data for two cycles + # before printing anything out, so we need to bump up the count one. + if ( $opts{n} && $opts{count} && $config{status_inc}->{val} + && $config{mode}->{val} =~ m/[S]/ ) + { + $opts{count}++; + } + + while (++$clock) { + + my $mode = $config{mode}->{val} || 'T'; + if ( !$modes{$mode} ) { + die "Mode '$mode' doesn't exist; try one of these:\n" + . join("\n", map { " $_ $modes{$_}->{hdr}" } sort keys %modes) + . "\n"; + } + + if ( !$opts{n} ) { + @last_term_size = @this_term_size; + @this_term_size = Term::ReadKey::GetTerminalSize(\*STDOUT); + if ( $windows ) { + $this_term_size[0]--; + $this_term_size[1] + = min($this_term_size[1], $config{max_height}->{val}); + } + die("Can't read terminal size") unless @this_term_size; + } + + # If there's no connection to a database server, we need to fix that... + if ( !%connections ) { + print "You have not defined any database connections.\n\n"; + add_new_dsn(); + } + + # See whether there are any connections defined for this mode. If there's only one + # connection total, assume the user wants to just use innotop for a single server + # and don't ask which server to connect to. Also, if we're monitoring from a file, + # we just use the first connection. + if ( !get_connections() ) { + if ( $file || 1 == scalar keys %connections ) { + $modes{$config{mode}->{val}}->{connections} = [ keys %connections ]; + } + else { + choose_connections(); + } + } + + # Term::ReadLine might have re-set $OUTPUT_AUTOFLUSH. + $OUTPUT_AUTOFLUSH = 1; + + # Prune old data + my $sets = $config{num_status_sets}->{val}; + foreach my $store ( values %vars ) { + delete @{$store}{ grep { $_ < $clock - $sets } keys %$store }; + } + %info_gotten = (); + + # Call the subroutine to display this mode. + $modes{$mode}->{display_sub}->(); + + # It may be time to quit now. + if ( $opts{count} && $clock >= $opts{count} ) { + finish(); + } + + # Wait for a bit. + if ( $opts{n} ) { + sleep($config{interval}->{val}); + } + else { + ReadMode('cbreak'); + $char = ReadKey($config{interval}->{val}); + ReadMode('normal'); + } + + # Handle whatever action the key indicates. + do_key_action(); + + } +}; +if ( $EVAL_ERROR ) { + core_dump( $EVAL_ERROR ); +} +finish(); + +# Subroutines {{{1 +# Mode functions{{{2 +# switch_mode {{{3 +sub switch_mode { + my $mode = shift; + $config{mode}->{val} = $mode; +} + +# Prompting functions {{{2 +# prompt_list {{{3 +# Prompts the user for a value, given a question, initial value, +# a completion function and a hashref of hints. +sub prompt_list { + die "Can't call in non-interactive mode" if $opts{n}; + my ( $question, $init, $completion, $hints ) = @_; + if ( $hints ) { + # Figure out how wide the table will be + my $max_name = max(map { length($_) } keys %$hints ); + $max_name ||= 0; + $max_name += 3; + my @meta_rows = create_table2( + [ sort keys %$hints ], + { map { $_ => $_ } keys %$hints }, + { map { $_ => trunc($hints->{$_}, $this_term_size[0] - $max_name) } keys %$hints }, + { sep => ' ' }); + if (@meta_rows > 10) { + # Try to split and stack the meta rows next to each other + my $split = int(@meta_rows / 2); + @meta_rows = stack_next( + [@meta_rows[0..$split - 1]], + [@meta_rows[$split..$#meta_rows]], + { pad => ' | '}, + ); + } + print join( "\n", + '', + map { ref $_ ? colored(@$_) : $_ } create_caption('Choose from', @meta_rows), ''), + "\n"; + } + $term->Attribs->{completion_function} = $completion; + my $answer = $term->readline("$question: ", $init); + $OUTPUT_AUTOFLUSH = 1; + $answer = '' if !defined($answer); + $answer =~ s/\s+$//; + return $answer; +} + +# prompt {{{3 +# Prints out a prompt and reads from the keyboard, then validates with the +# validation regex until the input is correct. +sub prompt { + die "Can't call in non-interactive mode" if $opts{n}; + my ( $prompt, $regex, $init, $completion ) = @_; + my $response; + my $success = 0; + do { + if ( $completion ) { + $term->Attribs->{completion_function} = $completion; + } + $response = $term->readline("$prompt: ", $init); + if ( $regex && $response !~ m/$regex/ ) { + print "Invalid response.\n\n"; + } + else { + $success = 1; + } + } while ( !$success ); + $OUTPUT_AUTOFLUSH = 1; + $response =~ s/\s+$//; + return $response; +} + +# prompt_noecho {{{3 +# Unfortunately, suppressing echo with Term::ReadLine isn't reliable; the user might not +# have that library, or it might not support that feature. +sub prompt_noecho { + my ( $prompt ) = @_; + print colored("$prompt: ", 'underline'); + my $response; + ReadMode('noecho'); + $response = <STDIN>; + chomp($response); + ReadMode('normal'); + return $response; +} + +# do_key_action {{{3 +# Depending on whether a key was read, do something. Keys have certain +# actions defined in lookup tables. Each mode may have its own lookup table, +# which trumps the global table -- so keys can be context-sensitive. The key +# may be read and written in a subroutine, so it's a global. +sub do_key_action { + if ( defined $char ) { + my $mode = $config{mode}->{val}; + my $action + = defined($modes{$mode}->{action_for}->{$char}) + ? $modes{$mode}->{action_for}->{$char}->{action} + : defined($action_for{$char}) + ? $action_for{$char}->{action} + : sub{}; + $action->(); + } +} + +# pause {{{3 +sub pause { + die "Can't call in non-interactive mode" if $opts{n}; + my $msg = shift; + print defined($msg) ? "\n$msg" : "\nPress any key to continue"; + ReadMode('cbreak'); + my $char = ReadKey(0); + ReadMode('normal'); + return $char; +} + +# reverse_sort {{{3 +sub reverse_sort { + my $tbl = shift; + $tbl_meta{$tbl}->{sort_dir} *= -1; +} + +# select_cxn {{{3 +# Selects connection(s). If the mode (or argument list) has only one, returns +# it without prompt. +sub select_cxn { + my ( $prompt, @cxns ) = @_; + if ( !@cxns ) { + @cxns = get_connections(); + } + if ( @cxns == 1 ) { + return $cxns[0]; + } + my $choices = prompt_list( + $prompt, + $cxns[0], + sub{ return @cxns }, + { map { $_ => $connections{$_}->{dsn} } @cxns }); + my @result = unique(grep { my $a = $_; grep { $_ eq $a } @cxns } split(/\s+/, $choices)); + return @result; +} + +# kill_query {{{3 +# Kills a connection, or on new versions, optionally a query but not connection. +sub kill_query { + my ( $q_or_c ) = @_; + + my $info = choose_thread( + sub { 1 }, + 'Select a thread to kill the ' . $q_or_c, + ); + return unless $info; + return unless pause("Kill $info->{id}?") =~ m/y/i; + + eval { + do_stmt($info->{cxn}, $q_or_c eq 'QUERY' ? 'KILL_QUERY' : 'KILL_CONNECTION', $info->{id} ); + }; + + if ( $EVAL_ERROR ) { + print "\nError: $EVAL_ERROR"; + pause(); + } +} + +# set_display_precision {{{3 +sub set_display_precision { + my $dir = shift; + $config{num_digits}->{val} = min(9, max(0, $config{num_digits}->{val} + $dir)); +} + +sub toggle_visible_table { + my ( $mode, $table ) = @_; + my $visible = $modes{$mode}->{visible_tables}; + if ( grep { $_ eq $table } @$visible ) { + $modes{$mode}->{visible_tables} = [ grep { $_ ne $table } @$visible ]; + } + else { + unshift @$visible, $table; + } + $modes{$mode}->{cust}->{visible_tables} = 1; +} + +# toggle_filter{{{3 +sub toggle_filter { + my ( $tbl, $filter ) = @_; + my $filters = $tbl_meta{$tbl}->{filters}; + if ( grep { $_ eq $filter } @$filters ) { + $tbl_meta{$tbl}->{filters} = [ grep { $_ ne $filter } @$filters ]; + } + else { + push @$filters, $filter; + } + $tbl_meta{$tbl}->{cust}->{filters} = 1; +} + +# toggle_config {{{3 +sub toggle_config { + my ( $key ) = @_; + $config{$key}->{val} ^= 1; +} + +# create_deadlock {{{3 +sub create_deadlock { + $clear_screen_sub->(); + + print "This function will deliberately cause a small deadlock, " + . "clearing deadlock information from the InnoDB monitor.\n\n"; + + my $answer = prompt("Are you sure you want to proceed? Say 'y' if you do"); + return 0 unless $answer eq 'y'; + + my ( $cxn ) = select_cxn('Clear on which server? '); + return unless $cxn && exists($connections{$cxn}); + + clear_deadlock($cxn); +} + +# deadlock_thread {{{3 +sub deadlock_thread { + my ( $id, $tbl, $cxn ) = @_; + + eval { + my $dbh = get_new_db_connection($cxn, 1); + my @stmts = ( + "set transaction isolation level serializable", + (version_ge($dbh, '4.0.11') ? "start transaction" : 'begin'), + "select * from $tbl where a = $id", + "update $tbl set a = $id where a <> $id", + ); + + foreach my $stmt (@stmts[0..2]) { + $dbh->do($stmt); + } + sleep(1 + $id); + $dbh->do($stmts[-1]); + }; + if ( $EVAL_ERROR ) { + if ( $EVAL_ERROR !~ m/Deadlock found/ ) { + die $EVAL_ERROR; + } + } + exit(0); +} + +# Purges unused binlogs on the master, up to but not including the latest log. +# TODO: guess which connections are slaves of a given master. +sub purge_master_logs { + my @cxns = get_connections(); + + get_master_slave_status(@cxns); + + # Toss out the rows that don't have master/slave status... + my @vars = + grep { $_ && ($_->{file} || $_->{master_host}) } + map { $vars{$_}->{$clock} } @cxns; + @cxns = map { $_->{cxn} } @vars; + + # Figure out which master to purge ons. + my @masters = map { $_->{cxn} } grep { $_->{file} } @vars; + my ( $master ) = select_cxn('Which master?', @masters ); + return unless $master; + my ($master_status) = grep { $_->{cxn} eq $master } @vars; + + # Figure out the result order (not lexical order) of master logs. + my @master_logs = get_master_logs($master); + my $i = 0; + my %master_logs = map { $_->{log_name} => $i++ } @master_logs; + + # Ask which slave(s) are reading from this master. + my @slave_status = grep { $_->{master_host} } @vars; + my @slaves = map { $_->{cxn} } @slave_status; + @slaves = select_cxn("Which slaves are reading from $master?", @slaves); + @slave_status = grep { my $item = $_; grep { $item->{cxn} eq $_ } @slaves } @slave_status; + return unless @slave_status; + + # Find the minimum binary log in use. + my $min_log = min(map { $master_logs{$_->{master_log_file}} } @slave_status); + my $log_name = $master_logs[$min_log]->{log_name}; + + my $stmt = "PURGE MASTER LOGS TO '$log_name'"; + send_cmd_to_servers($stmt, 0, 'PURGE {MASTER | BINARY} LOGS {TO "log_name" | BEFORE "date"}', [$master]); +} + +sub send_cmd_to_servers { + my ( $cmd, $all, $hint, $cxns ) = @_; + if ( $all ) { + @$cxns = get_connections(); + } + elsif ( !@$cxns ) { + @$cxns = select_cxn('Which servers?', @$cxns); + } + if ( $hint ) { + print "\nHint: $hint\n"; + } + $cmd = prompt('Command to send', undef, $cmd); + foreach my $cxn ( @$cxns ) { + eval { + my $sth = do_query($cxn, $cmd); + }; + if ( $EVAL_ERROR ) { + print "Error from $cxn: $EVAL_ERROR\n"; + } + else { + print "Success on $cxn\n"; + } + } + pause(); +} + +# Display functions {{{2 + +sub set_s_mode { + my ( $func ) = @_; + $clear_screen_sub->(); + $config{S_func}->{val} = $func; +} + +# start_S_mode {{{3 +sub start_S_mode { + $clear_screen_sub->(); + switch_mode('S'); +} + +# display_B {{{3 +sub display_B { + my @display_lines; + my @cxns = get_connections(); + get_innodb_status(\@cxns); + + my @buffer_pool; + my @page_statistics; + my @insert_buffers; + my @adaptive_hash_index; + my %rows_for = ( + buffer_pool => \@buffer_pool, + page_statistics => \@page_statistics, + insert_buffers => \@insert_buffers, + adaptive_hash_index => \@adaptive_hash_index, + ); + + my @visible = get_visible_tables(); + my %wanted = map { $_ => 1 } @visible; + + foreach my $cxn ( @cxns ) { + my $set = $vars{$cxn}->{$clock}; + my $pre = $vars{$cxn}->{$clock-1} || $set; + + if ( $set->{IB_bp_complete} ) { + if ( $wanted{buffer_pool} ) { + push @buffer_pool, extract_values($set, $set, $pre, 'buffer_pool'); + } + if ( $wanted{page_statistics} ) { + push @page_statistics, extract_values($set, $set, $pre, 'page_statistics'); + } + } + if ( $set->{IB_ib_complete} ) { + if ( $wanted{insert_buffers} ) { + push @insert_buffers, extract_values( + $config{status_inc}->{val} ? inc(0, $cxn) : $set, $set, $pre, + 'insert_buffers'); + } + if ( $wanted{adaptive_hash_index} ) { + push @adaptive_hash_index, extract_values($set, $set, $pre, 'adaptive_hash_index'); + } + } + } + + my $first_table = 0; + foreach my $tbl ( @visible ) { + push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl); + push @display_lines, get_cxn_errors(@cxns) + if ( $config{debug}->{val} || !$first_table++ ); + } + + draw_screen(\@display_lines); +} + +# display_C {{{3 +sub display_C { + my @display_lines; + my @cxns = get_connections(); + get_status_info(@cxns); + + my @cmd_summary; + my %rows_for = ( + cmd_summary => \@cmd_summary, + ); + + my @visible = get_visible_tables(); + my %wanted = map { $_ => 1 } @visible; + + # For now, I'm manually pulling these variables out and pivoting. Eventually a SQL-ish + # dialect should let me join a table to a grouped and pivoted table and do this more easily. + # TODO: make it so. + my $prefix = qr/^$config{cmd_filter}->{val}/; # TODO: this is a total hack + my @values; + my ($total, $last_total) = (0, 0); + foreach my $cxn ( @cxns ) { + my $set = $vars{$cxn}->{$clock}; + my $pre = $vars{$cxn}->{$clock-1} || $set; + foreach my $key ( keys %$set ) { + next unless $key =~ m/$prefix/i; + my $val = $set->{$key}; + next unless defined $val && $val =~ m/^\d+$/; + my $last_val = $val - ($pre->{$key} || 0); + $total += $val; + $last_total += $last_val; + push @values, { + name => $key, + value => $val, + last_value => $last_val, + }; + } + } + + # Add aggregation and turn into a real set TODO: total hack + if ( $wanted{cmd_summary} ) { + foreach my $value ( @values ) { + @{$value}{qw(total last_total)} = ($total, $last_total); + push @cmd_summary, extract_values($value, $value, $value, 'cmd_summary'); + } + } + + my $first_table = 0; + foreach my $tbl ( @visible ) { + push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl); + push @display_lines, get_cxn_errors(@cxns) + if ( $config{debug}->{val} || !$first_table++ ); + } + + draw_screen(\@display_lines); +} + +# display_D {{{3 +sub display_D { + my @display_lines; + my @cxns = get_connections(); + get_innodb_status(\@cxns); + + my @deadlock_transactions; + my @deadlock_locks; + my %rows_for = ( + deadlock_transactions => \@deadlock_transactions, + deadlock_locks => \@deadlock_locks, + ); + + my @visible = get_visible_tables(); + my %wanted = map { $_ => 1 } @visible; + + foreach my $cxn ( @cxns ) { + my $innodb_status = $vars{$cxn}->{$clock}; + my $prev_status = $vars{$cxn}->{$clock-1} || $innodb_status; + + if ( $innodb_status->{IB_dl_timestring} ) { + + my $victim = $innodb_status->{IB_dl_rolled_back} || 0; + + if ( %wanted ) { + foreach my $txn_id ( keys %{$innodb_status->{IB_dl_txns}} ) { + my $txn = $innodb_status->{IB_dl_txns}->{$txn_id}; + my $pre = $prev_status->{IB_dl_txns}->{$txn_id} || $txn; + + if ( $wanted{deadlock_transactions} ) { + my $hash = extract_values($txn->{tx}, $txn->{tx}, $pre->{tx}, 'deadlock_transactions'); + $hash->{cxn} = $cxn; + $hash->{dl_txn_num} = $txn_id; + $hash->{victim} = $txn_id == $victim ? 'Yes' : 'No'; + $hash->{timestring} = $innodb_status->{IB_dl_timestring}; + $hash->{truncates} = $innodb_status->{IB_dl_complete} ? 'No' : 'Yes'; + push @deadlock_transactions, $hash; + } + + if ( $wanted{deadlock_locks} ) { + foreach my $lock ( @{$txn->{locks}} ) { + my $hash = extract_values($lock, $lock, $lock, 'deadlock_locks'); + $hash->{dl_txn_num} = $txn_id; + $hash->{cxn} = $cxn; + $hash->{mysql_thread_id} = $txn->{tx}->{mysql_thread_id}; + push @deadlock_locks, $hash; + } + } + + } + } + } + } + + my $first_table = 0; + foreach my $tbl ( @visible ) { + push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl); + push @display_lines, get_cxn_errors(@cxns) + if ( $config{debug}->{val} || !$first_table++ ); + } + + draw_screen(\@display_lines); +} + +# display_F {{{3 +sub display_F { + my @display_lines; + my ( $cxn ) = get_connections(); + get_innodb_status([$cxn]); + my $innodb_status = $vars{$cxn}->{$clock}; + + if ( $innodb_status->{IB_fk_timestring} ) { + + push @display_lines, 'Reason: ' . $innodb_status->{IB_fk_reason}; + + # Display FK errors caused by invalid DML. + if ( $innodb_status->{IB_fk_txn} ) { + my $txn = $innodb_status->{IB_fk_txn}; + push @display_lines, + '', + "User $txn->{user} from $txn->{hostname}, thread $txn->{mysql_thread_id} was executing:", + '', no_ctrl_char($txn->{query_text}); + } + + my @fk_table = create_table2( + $tbl_meta{fk_error}->{visible}, + meta_to_hdr('fk_error'), + extract_values($innodb_status, $innodb_status, $innodb_status, 'fk_error'), + { just => '-', sep => ' '}); + push @display_lines, '', @fk_table; + + } + else { + push @display_lines, '', 'No foreign key error data.'; + } + draw_screen(\@display_lines, { raw => 1 } ); +} + +# display_I {{{3 +sub display_I { + my @display_lines; + my @cxns = get_connections(); + get_innodb_status(\@cxns); + + my @io_threads; + my @pending_io; + my @file_io_misc; + my @log_statistics; + my %rows_for = ( + io_threads => \@io_threads, + pending_io => \@pending_io, + file_io_misc => \@file_io_misc, + log_statistics => \@log_statistics, + ); + + my @visible = get_visible_tables(); + my %wanted = map { $_ => 1 } @visible; + + foreach my $cxn ( @cxns ) { + my $set = $vars{$cxn}->{$clock}; + my $pre = $vars{$cxn}->{$clock-1} || $set; + + if ( $set->{IB_io_complete} ) { + if ( $wanted{io_threads} ) { + my $cur_threads = $set->{IB_io_threads}; + my $pre_threads = $pre->{IB_io_threads} || $cur_threads; + foreach my $key ( sort keys %$cur_threads ) { + my $cur_thd = $cur_threads->{$key}; + my $pre_thd = $pre_threads->{$key} || $cur_thd; + my $hash = extract_values($cur_thd, $cur_thd, $pre_thd, 'io_threads'); + $hash->{cxn} = $cxn; + push @io_threads, $hash; + } + } + if ( $wanted{pending_io} ) { + push @pending_io, extract_values($set, $set, $pre, 'pending_io'); + } + if ( $wanted{file_io_misc} ) { + push @file_io_misc, extract_values( + $config{status_inc}->{val} ? inc(0, $cxn) : $set, + $set, $pre, 'file_io_misc'); + } + } + if ( $set->{IB_lg_complete} && $wanted{log_statistics} ) { + push @log_statistics, extract_values($set, $set, $pre, 'log_statistics'); + } + } + + my $first_table = 0; + foreach my $tbl ( @visible ) { + push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl); + push @display_lines, get_cxn_errors(@cxns) + if ( $config{debug}->{val} || !$first_table++ ); + } + + draw_screen(\@display_lines); +} + +# display_L {{{3 +sub display_L { + my @display_lines; + my @cxns = get_connections(); + get_innodb_status(\@cxns); + + my @innodb_locks; + my %rows_for = ( + innodb_locks => \@innodb_locks, + ); + + my @visible = get_visible_tables(); + my %wanted = map { $_ => 1 } @visible; + + # Get info on locks + foreach my $cxn ( @cxns ) { + my $set = $vars{$cxn}->{$clock} or next; + my $pre = $vars{$cxn}->{$clock-1} || $set; + + if ( $wanted{innodb_locks} && defined $set->{IB_tx_transactions} && @{$set->{IB_tx_transactions}} ) { + + my $cur_txns = $set->{IB_tx_transactions}; + my $pre_txns = $pre->{IB_tx_transactions} || $cur_txns; + my %cur_txns = map { $_->{mysql_thread_id} => $_ } @$cur_txns; + my %pre_txns = map { $_->{mysql_thread_id} => $_ } @$pre_txns; + foreach my $txn ( @$cur_txns ) { + foreach my $lock ( @{$txn->{locks}} ) { + my %hash = map { $_ => $txn->{$_} } qw(txn_id mysql_thread_id lock_wait_time active_secs); + map { $hash{$_} = $lock->{$_} } qw(lock_type space_id page_no n_bits index db table txn_id lock_mode special insert_intention waiting); + $hash{cxn} = $cxn; + push @innodb_locks, extract_values(\%hash, \%hash, \%hash, 'innodb_locks'); + } + } + } + } + + my $first_table = 0; + foreach my $tbl ( @visible ) { + push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl); + push @display_lines, get_cxn_errors(@cxns) + if ( $config{debug}->{val} || !$first_table++ ); + } + + draw_screen(\@display_lines); +} + +# display_M {{{3 +sub display_M { + my @display_lines; + my @cxns = get_connections(); + get_master_slave_status(@cxns); + get_status_info(@cxns); + + my @slave_sql_status; + my @slave_io_status; + my @master_status; + my %rows_for = ( + slave_sql_status => \@slave_sql_status, + slave_io_status => \@slave_io_status, + master_status => \@master_status, + ); + + my @visible = get_visible_tables(); + my %wanted = map { $_ => 1 } @visible; + + foreach my $cxn ( @cxns ) { + my $set = $config{status_inc}->{val} ? inc(0, $cxn) : $vars{$cxn}->{$clock}; + my $pre = $vars{$cxn}->{$clock - 1} || $set; + if ( $wanted{slave_sql_status} ) { + push @slave_sql_status, extract_values($set, $set, $pre, 'slave_sql_status'); + } + if ( $wanted{slave_io_status} ) { + push @slave_io_status, extract_values($set, $set, $pre, 'slave_io_status'); + } + if ( $wanted{master_status} ) { + push @master_status, extract_values($set, $set, $pre, 'master_status'); + } + } + + my $first_table = 0; + foreach my $tbl ( @visible ) { + push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl); + push @display_lines, get_cxn_errors(@cxns) + if ( $config{debug}->{val} || !$first_table++ ); + } + + draw_screen(\@display_lines); +} + +# display_O {{{3 +sub display_O { + my @display_lines = (''); + my @cxns = get_connections(); + my @open_tables = get_open_tables(@cxns); + my @tables = map { extract_values($_, $_, $_, 'open_tables') } @open_tables; + push @display_lines, set_to_tbl(\@tables, 'open_tables'), get_cxn_errors(@cxns); + draw_screen(\@display_lines); +} + +# display_Q {{{3 +sub display_Q { + my @display_lines; + + my @q_header; + my @processlist; + my %rows_for = ( + q_header => \@q_header, + processlist => \@processlist, + ); + + my @visible = $opts{n} ? 'processlist' : get_visible_tables(); + my %wanted = map { $_ => 1 } @visible; + + # Get the data + my @cxns = get_connections(); + my @full_processlist = get_full_processlist(@cxns); + + # Create header + if ( $wanted{q_header} ) { + get_status_info(@cxns); + foreach my $cxn ( @cxns ) { + my $set = $vars{$cxn}->{$clock}; + my $pre = $vars{$cxn}->{$clock-1} || $set; + my $hash = extract_values($set, $set, $pre, 'q_header'); + $hash->{cxn} = $cxn; + $hash->{when} = 'Total'; + push @q_header, $hash; + + if ( exists $vars{$cxn}->{$clock - 1} ) { + my $inc = inc(0, $cxn); + my $hash = extract_values($inc, $set, $pre, 'q_header'); + $hash->{cxn} = $cxn; + $hash->{when} = 'Now'; + push @q_header, $hash; + } + } + } + + if ( $wanted{processlist} ) { + # TODO: save prev values + push @processlist, map { extract_values($_, $_, $_, 'processlist') } @full_processlist; + } + + my $first_table = 0; + foreach my $tbl ( @visible ) { + next unless $wanted{$tbl}; + push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl); + push @display_lines, get_cxn_errors(@cxns) + if ( $config{debug}->{val} || !$first_table++ ); + } + + # Save queries in global variable for analysis. The rows in %rows_for have been + # filtered, etc as a side effect of set_to_tbl(), so they are the same as the rows + # that get pushed to the screen. + @current_queries = map { + my %hash; + @hash{ qw(cxn id db query secs) } = @{$_}{ qw(cxn mysql_thread_id db info secs) }; + \%hash; + } @{$rows_for{processlist}}; + + draw_screen(\@display_lines); +} + +# display_R {{{3 +sub display_R { + my @display_lines; + my @cxns = get_connections(); + get_innodb_status(\@cxns); + + my @row_operations; + my @row_operation_misc; + my @semaphores; + my @wait_array; + my %rows_for = ( + row_operations => \@row_operations, + row_operation_misc => \@row_operation_misc, + semaphores => \@semaphores, + wait_array => \@wait_array, + ); + + my @visible = get_visible_tables(); + my %wanted = map { $_ => 1 } @visible; + my $incvar = $config{status_inc}->{val}; + + foreach my $cxn ( @cxns ) { + my $set = $vars{$cxn}->{$clock}; + my $pre = $vars{$cxn}->{$clock-1} || $set; + my $inc; # Only assigned to if wanted + + if ( $set->{IB_ro_complete} ) { + if ( $wanted{row_operations} ) { + $inc ||= $incvar ? inc(0, $cxn) : $set; + push @row_operations, extract_values($inc, $set, $pre, 'row_operations'); + } + if ( $wanted{row_operation_misc} ) { + push @row_operation_misc, extract_values($set, $set, $pre, 'row_operation_misc'), + } + } + + if ( $set->{IB_sm_complete} && $wanted{semaphores} ) { + $inc ||= $incvar ? inc(0, $cxn) : $set; + push @semaphores, extract_values($inc, $set, $pre, 'semaphores'); + } + + if ( $set->{IB_sm_wait_array_size} && $wanted{wait_array} ) { + foreach my $wait ( @{$set->{IB_sm_waits}} ) { + my $hash = extract_values($wait, $wait, $wait, 'wait_array'); + $hash->{cxn} = $cxn; + push @wait_array, $hash; + } + } + } + + my $first_table = 0; + foreach my $tbl ( @visible ) { + push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl); + push @display_lines, get_cxn_errors(@cxns) + if ( $config{debug}->{val} || !$first_table++ ); + } + + draw_screen(\@display_lines); +} + +# display_T {{{3 +sub display_T { + my @display_lines; + + my @t_header; + my @innodb_transactions; + my %rows_for = ( + t_header => \@t_header, + innodb_transactions => \@innodb_transactions, + ); + + my @visible = $opts{n} ? 'innodb_transactions' : get_visible_tables(); + my %wanted = map { $_ => 1 } @visible; + + my @cxns = get_connections(); + + # If the header is to be shown, buffer pool data is required. + get_innodb_status( \@cxns, [ $wanted{t_header} ? qw(bp) : () ] ); + + foreach my $cxn ( get_connections() ) { + my $set = $vars{$cxn}->{$clock}; + my $pre = $vars{$cxn}->{$clock-1} || $set; + + next unless $set->{IB_tx_transactions}; + + if ( $wanted{t_header} ) { + my $hash = extract_values($set, $set, $pre, 't_header'); + push @t_header, $hash; + } + + if ( $wanted{innodb_transactions} ) { + my $cur_txns = $set->{IB_tx_transactions}; + my $pre_txns = $pre->{IB_tx_transactions} || $cur_txns; + my %cur_txns = map { $_->{mysql_thread_id} => $_ } @$cur_txns; + my %pre_txns = map { $_->{mysql_thread_id} => $_ } @$pre_txns; + foreach my $thd_id ( sort keys %cur_txns ) { + my $cur_txn = $cur_txns{$thd_id}; + my $pre_txn = $pre_txns{$thd_id} || $cur_txn; + my $hash = extract_values($cur_txn, $cur_txn, $pre_txn, 'innodb_transactions'); + $hash->{cxn} = $cxn; + push @innodb_transactions, $hash; + } + } + + } + + my $first_table = 0; + foreach my $tbl ( @visible ) { + push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl); + push @display_lines, get_cxn_errors(@cxns) + if ( $config{debug}->{val} || !$first_table++ ); + } + + # Save queries in global variable for analysis. The rows in %rows_for have been + # filtered, etc as a side effect of set_to_tbl(), so they are the same as the rows + # that get pushed to the screen. + @current_queries = map { + my %hash; + @hash{ qw(cxn id db query secs) } = @{$_}{ qw(cxn mysql_thread_id db query_text active_secs) }; + \%hash; + } @{$rows_for{innodb_transactions}}; + + draw_screen(\@display_lines); +} + +# display_S {{{3 +sub display_S { + my $fmt = get_var_set('S_set'); + my $func = $config{S_func}->{val}; + my $inc = $func eq 'g' || $config{status_inc}->{val}; + + # The table's meta-data is generated from the compiled var_set. + my ( $cols, $visible ); + if ( $tbl_meta{var_status}->{fmt} && $fmt eq $tbl_meta{var_status}->{fmt} ) { + ( $cols, $visible ) = @{$tbl_meta{var_status}}{qw(cols visible)}; + } + else { + ( $cols, $visible ) = compile_select_stmt($fmt); + + # Apply missing values to columns. Always apply averages across all connections. + map { + $_->{agg} = 'avg'; + $_->{label} = $_->{hdr}; + } values %$cols; + + $tbl_meta{var_status}->{cols} = $cols; + $tbl_meta{var_status}->{visible} = $visible; + $tbl_meta{var_status}->{fmt} = $fmt; + map { $tbl_meta{var_status}->{cols}->{$_}->{just} = ''} @$visible; + } + + my @var_status; + my %rows_for = ( + var_status => \@var_status, + ); + + my @visible = get_visible_tables(); + my %wanted = map { $_ => 1 } @visible; + my @cxns = get_connections(); + + get_status_info(@cxns); + get_innodb_status(\@cxns); + + # Set up whether to pivot and how many sets to extract. + $tbl_meta{var_status}->{pivot} = $func eq 'v'; + + my $num_sets + = $func eq 'v' + ? $config{num_status_sets}->{val} + : 0; + foreach my $set ( 0 .. $num_sets ) { + my @rows; + foreach my $cxn ( @cxns ) { + my $vars = $inc ? inc($set, $cxn) : $vars{$cxn}->{$clock - $set}; + my $cur = $vars{$cxn}->{$clock-$set}; + my $pre = $vars{$cxn}->{$clock-$set-1} || $cur; + next unless $vars && %$vars; + my $hash = extract_values($vars, $cur, $pre, 'var_status'); + push @rows, $hash; + } + @rows = apply_group_by('var_status', [], @rows); + push @var_status, @rows; + } + + # Recompile the sort func. TODO: avoid recompiling at every refresh. + # Figure out whether the data is all numeric and decide on a sort type. + # my $cmp + # = scalar( + # grep { !defined $_ || $_ !~ m/^\d+$/ } + # map { my $col = $_; map { $_->{$col} } @var_status } + # $tbl_meta{var_status}->{sort_cols} =~ m/(\w+)/g) + # ? 'cmp' + # : '<=>'; + $tbl_meta{var_status}->{sort_func} = make_sort_func($tbl_meta{var_status}); + + # ################################################################ + # Now there is specific display code based on $config{S_func} + # ################################################################ + if ( $func =~ m/s|g/ ) { + my $min_width = 4; + + # Clear the screen if the display width changed. + if ( @last_term_size && $this_term_size[0] != $last_term_size[0] ) { + $lines_printed = 0; + $clear_screen_sub->(); + } + + if ( $func eq 's' ) { + # Decide how wide columns should be. + my $num_cols = scalar(@$visible); + my $width = $opts{n} ? 0 : max($min_width, int(($this_term_size[0] - $num_cols + 1) / $num_cols)); + my $g_format = $opts{n} ? ( "%s\t" x $num_cols ) : ( "%-${width}s " x $num_cols ); + + # Print headers every now and then. Headers can get really long, so compact them. + my @hdr = @$visible; + if ( $opts{n} ) { + if ( $lines_printed == 0 ) { + print join("\t", @hdr), "\n"; + $lines_printed++; + } + } + elsif ( $lines_printed == 0 || $lines_printed > $this_term_size[1] - 2 ) { + @hdr = map { donut(crunch($_, $width), $width) } @hdr; + print join(' ', map { sprintf( "%${width}s", donut($_, $width)) } @hdr) . "\n"; + $lines_printed = 1; + } + + # Design a column format for the values. + my $format + = $opts{n} + ? join("\t", map { '%s' } @$visible) . "\n" + : join(' ', map { "%${width}s" } @hdr) . "\n"; + + foreach my $row ( @var_status ) { + printf($format, map { defined $_ ? $_ : '' } @{$row}{ @$visible }); + $lines_printed++; + } + } + else { # 'g' mode + # Design a column format for the values. + my $num_cols = scalar(@$visible); + my $width = $opts{n} ? 0 : int(($this_term_size[0] - $num_cols + 1) / $num_cols); + my $format = $opts{n} ? ( "%s\t" x $num_cols ) : ( "%-${width}s " x $num_cols ); + $format =~ s/\s$/\n/; + + # Print headers every now and then. + if ( $opts{n} ) { + if ( $lines_printed == 0 ) { + print join("\t", @$visible), "\n"; + print join("\t", map { shorten($mvs{$_}) } @$visible), "\n"; + } + } + elsif ( $lines_printed == 0 || $lines_printed > $this_term_size[1] - 2 ) { + printf($format, map { donut(crunch($_, $width), $width) } @$visible); + printf($format, map { shorten($mvs{$_} || 0) } @$visible); + $lines_printed = 2; + } + + # Update the max ever seen, and scale by the max ever seen. + my $set = $var_status[0]; + foreach my $col ( @$visible ) { + $set->{$col} = 1 unless defined $set->{$col} && $set->{$col} =~ m/$num_regex/; + $set->{$col} = ($set->{$col} || 1) / ($set->{Uptime_hires} || 1); + $mvs{$col} = max($mvs{$col} || 1, $set->{$col}); + $set->{$col} /= $mvs{$col}; + } + printf($format, map { ( $config{graph_char}->{val} x int( $width * $set->{$_} )) || '.' } @$visible ); + $lines_printed++; + + } + } + else { # 'v' + my $first_table = 0; + my @display_lines; + foreach my $tbl ( @visible ) { + push @display_lines, '', set_to_tbl($rows_for{$tbl}, $tbl); + push @display_lines, get_cxn_errors(@cxns) + if ( $config{debug}->{val} || !$first_table++ ); + } + $clear_screen_sub->(); + draw_screen( \@display_lines ); + } +} + +# display_explain {{{3 +sub display_explain { + my $info = shift; + my $cxn = $info->{cxn}; + my $db = $info->{db}; + + my ( $mods, $query ) = rewrite_for_explain($info->{query}); + + my @display_lines; + + if ( $query ) { + + my $part = version_ge($dbhs{$cxn}->{dbh}, '5.1.5') ? 'PARTITIONS' : ''; + $query = "EXPLAIN $part\n" . $query; + + eval { + if ( $db ) { + do_query($cxn, "use $db"); + } + my $sth = do_query($cxn, $query); + + my $res; + while ( $res = $sth->fetchrow_hashref() ) { + map { $res->{$_} ||= '' } ( 'partitions', keys %$res); + my @this_table = create_caption("Sub-Part $res->{id}", + create_table2( + $tbl_meta{explain}->{visible}, + meta_to_hdr('explain'), + extract_values($res, $res, $res, 'explain'))); + @display_lines = stack_next(\@display_lines, \@this_table, { pad => ' ', vsep => 2 }); + } + }; + + if ( $EVAL_ERROR ) { + push @display_lines, + '', + "The query could not be explained. Only SELECT queries can be " + . "explained; innotop tries to rewrite certain REPLACE and INSERT queries " + . "into SELECT, but this doesn't always succeed."; + } + + } + else { + push @display_lines, '', 'The query could not be explained.'; + } + + if ( $mods ) { + push @display_lines, '', '[This query has been re-written to be explainable]'; + } + + unshift @display_lines, no_ctrl_char($query); + draw_screen(\@display_lines, { raw => 1 } ); +} + +# rewrite_for_explain {{{3 +sub rewrite_for_explain { + my $query = shift; + + my $mods = 0; + my $orig = $query; + $mods += $query =~ s/^\s*(?:replace|insert).*?select/select/is; + $mods += $query =~ s/^ + \s*create\s+(?:temporary\s+)?table + \s+(?:\S+\s+)as\s+select/select/xis; + $mods += $query =~ s/\s+on\s+duplicate\s+key\s+update.*$//is; + return ( $mods, $query ); +} + +# show_optimized_query {{{3 +sub show_optimized_query { + my $info = shift; + my $cxn = $info->{cxn}; + my $db = $info->{db}; + my $meta = $dbhs{$cxn}; + + my @display_lines; + + my ( $mods, $query ) = rewrite_for_explain($info->{query}); + + if ( $mods ) { + push @display_lines, '[This query has been re-written to be explainable]'; + } + + if ( $query ) { + push @display_lines, no_ctrl_char($info->{query}); + + eval { + if ( $db ) { + do_query($cxn, "use $db"); + } + do_query( $cxn, 'EXPLAIN EXTENDED ' . $query ) or die "Can't explain query"; + my $sth = do_query($cxn, 'SHOW WARNINGS'); + my $res = $sth->fetchall_arrayref({}); + + if ( $res ) { + foreach my $result ( @$res ) { + push @display_lines, 'Note:', no_ctrl_char($result->{message}); + } + } + else { + push @display_lines, '', 'The query optimization could not be generated.'; + } + }; + + if ( $EVAL_ERROR ) { + push @display_lines, '', "The optimization could not be generated: $EVAL_ERROR"; + } + + } + else { + push @display_lines, '', 'The query optimization could not be generated.'; + } + + draw_screen(\@display_lines, { raw => 1 } ); +} + +# display_help {{{3 +sub display_help { + my $mode = $config{mode}->{val}; + + # Get globally mapped keys, then overwrite them with mode-specific ones. + my %keys = map { + $_ => $action_for{$_}->{label} + } keys %action_for; + foreach my $key ( keys %{$modes{$mode}->{action_for}} ) { + $keys{$key} = $modes{$mode}->{action_for}->{$key}->{label}; + } + delete $keys{'?'}; + + # Split them into three kinds of keys: MODE keys, action keys, and + # magic (special character) keys. + my @modes = sort grep { m/[A-Z]/ } keys %keys; + my @actions = sort grep { m/[a-z]/ } keys %keys; + my @magic = sort grep { m/[^A-Z]/i } keys %keys; + + my @display_lines = ( '', 'Switch to a different mode:' ); + + # Mode keys + my @all_modes = map { "$_ $modes{$_}->{hdr}" } @modes; + my @col1 = splice(@all_modes, 0, ceil(@all_modes/3)); + my @col2 = splice(@all_modes, 0, ceil(@all_modes/2)); + my $max1 = max(map {length($_)} @col1); + my $max2 = max(map {length($_)} @col2); + while ( @col1 ) { + push @display_lines, sprintf(" %-${max1}s %-${max2}s %s", + (shift @col1 || ''), + (shift @col2 || ''), + (shift @all_modes || '')); + } + + # Action keys + my @all_actions = map { "$_ $keys{$_}" } @actions; + @col1 = splice(@all_actions, 0, ceil(@all_actions/2)); + $max1 = max(map {length($_)} @col1); + push @display_lines, '', 'Actions:'; + while ( @col1 ) { + push @display_lines, sprintf(" %-${max1}s %s", + (shift @col1 || ''), + (shift @all_actions || '')); + } + + # Magic keys + my @all_magic = map { sprintf('%4s', $action_for{$_}->{key} || $_) . " $keys{$_}" } @magic; + @col1 = splice(@all_magic, 0, ceil(@all_magic/2)); + $max1 = max(map {length($_)} @col1); + push @display_lines, '', 'Other:'; + while ( @col1 ) { + push @display_lines, sprintf("%-${max1}s%s", + (shift @col1 || ''), + (shift @all_magic || '')); + } + + $clear_screen_sub->(); + draw_screen(\@display_lines, { show_all => 1 } ); + pause(); + $clear_screen_sub->(); +} + +# show_full_query {{{3 +sub show_full_query { + my $info = shift; + my @display_lines = no_ctrl_char($info->{query}); + draw_screen(\@display_lines, { raw => 1 }); +} + +# Formatting functions {{{2 + +# create_table2 {{{3 +# Makes a two-column table, labels on left, data on right. +# Takes refs of @cols, %labels and %data, %user_prefs +sub create_table2 { + my ( $cols, $labels, $data, $user_prefs ) = @_; + my @rows; + + if ( @$cols && %$data ) { + + # Override defaults + my $p = { + just => '', + sep => ':', + just1 => '-', + }; + if ( $user_prefs ) { + map { $p->{$_} = $user_prefs->{$_} } keys %$user_prefs; + } + + # Fix undef values + map { $data->{$_} = '' unless defined $data->{$_} } @$cols; + + # Format the table + my $max_l = max(map{ length($labels->{$_}) } @$cols); + my $max_v = max(map{ length($data->{$_}) } @$cols); + my $format = "%$p->{just}${max_l}s$p->{sep} %$p->{just1}${max_v}s"; + foreach my $col ( @$cols ) { + push @rows, sprintf($format, $labels->{$col}, $data->{$col}); + } + } + return @rows; +} + +# stack_next {{{3 +# Stacks one display section next to the other. Accepts left-hand arrayref, +# right-hand arrayref, and options hashref. Tries to stack as high as +# possible, so +# aaaaaa +# bbb +# can stack ccc next to the bbb. +# NOTE: this DOES modify its arguments, even though it returns a new array. +sub stack_next { + my ( $left, $right, $user_prefs ) = @_; + my @result; + + my $p = { + pad => ' ', + vsep => 0, + }; + if ( $user_prefs ) { + map { $p->{$_} = $user_prefs->{$_} } keys %$user_prefs; + } + + # Find out how wide the LHS can be and still let the RHS fit next to it. + my $pad = $p->{pad}; + my $max_r = max( map { length($_) } @$right) || 0; + my $max_l = $this_term_size[0] - $max_r - length($pad); + + # Find the minimum row on the LHS that the RHS will fit next to. + my $i = scalar(@$left) - 1; + while ( $i >= 0 && length($left->[$i]) <= $max_l ) { + $i--; + } + $i++; + my $offset = $i; + + if ( $i < scalar(@$left) ) { + # Find the max width of the section of the LHS against which the RHS + # will sit. + my $max_i_in_common = min($i + scalar(@$right) - 1, scalar(@$left) - 1); + my $max_width = max( map { length($_) } @{$left}[$i..$max_i_in_common]); + + # Append the RHS onto the LHS until one runs out. + while ( $i < @$left && $i - $offset < @$right ) { + my $format = "%-${max_width}s$pad%${max_r}s"; + $left->[$i] = sprintf($format, $left->[$i], $right->[$i - $offset]); + $i++; + } + while ( $i - $offset < @$right ) { + # There is more RHS to push on the end of the array + push @$left, + sprintf("%${max_width}s$pad%${max_r}s", ' ', $right->[$i - $offset]); + $i++; + } + push @result, @$left; + } + else { + # There is no room to put them side by side. Add them below, with + # a blank line above them if specified. + push @result, @$left; + push @result, (' ' x $this_term_size[0]) if $p->{vsep} && @$left; + push @result, @$right; + } + return @result; +} + +# create_caption {{{3 +sub create_caption { + my ( $caption, @rows ) = @_; + if ( @rows ) { + + # Calculate the width of what will be displayed, so it can be centered + # in that space. When the thing is wider than the display, center the + # caption in the display. + my $width = min($this_term_size[0], max(map { length(ref($_) ? $_->[0] : $_) } @rows)); + + my $cap_len = length($caption); + + # It may be narrow enough to pad the sides with underscores and save a + # line on the screen. + if ( $cap_len <= $width - 6 ) { + my $left = int(($width - 2 - $cap_len) / 2); + unshift @rows, + ("_" x $left) . " $caption " . ("_" x ($width - $left - $cap_len - 2)); + } + + # The caption is too wide to add underscores on each side. + else { + + # Color is supported, so we can use terminal underlining. + if ( $config{color}->{val} ) { + my $left = int(($width - $cap_len) / 2); + unshift @rows, [ + (" " x $left) . $caption . (" " x ($width - $left - $cap_len)), + 'underline', + ]; + } + + # Color is not supported, so we have to add a line underneath to separate the + # caption from whatever it's captioning. + else { + my $left = int(($width - $cap_len) / 2); + unshift @rows, ('-' x $width); + unshift @rows, (" " x $left) . $caption . (" " x ($width - $left - $cap_len)); + } + + # The caption is wider than the thing it labels, so we have to pad the + # thing it labels to a consistent width. + if ( $cap_len > $width ) { + @rows = map { + ref($_) + ? [ sprintf('%-' . $cap_len . 's', $_->[0]), $_->[1] ] + : sprintf('%-' . $cap_len . 's', $_); + } @rows; + } + + } + } + return @rows; +} + +# create_table {{{3 +# Input: an arrayref of columns, hashref of col info, and an arrayref of hashes +# Example: [ 'a', 'b' ] +# { a => spec, b => spec } +# [ { a => 1, b => 2}, { a => 3, b => 4 } ] +# The 'spec' is a hashref of hdr => label, just => ('-' or ''). It also supports min and max-widths +# vi the minw and maxw params. +# Output: an array of strings, one per row. +# Example: +# Column One Column Two +# ---------- ---------- +# 1 2 +# 3 4 +sub create_table { + my ( $cols, $info, $data, $prefs ) = @_; + $prefs ||= {}; + $prefs->{no_hdr} ||= ($opts{n} && $clock != 1); + + # Truncate rows that will surely be off screen even if this is the only table. + if ( !$opts{n} && !$prefs->{raw} && !$prefs->{show_all} && $this_term_size[1] < @$data-1 ) { + $data = [ @$data[0..$this_term_size[1] - 1] ]; + } + + my @rows = (); + + if ( @$cols && %$info ) { + + # Fix undef values, collapse whitespace. + foreach my $row ( @$data ) { + map { $row->{$_} = collapse_ws($row->{$_}) } @$cols; + } + + my $col_sep = $opts{n} ? "\t" : ' '; + + # Find each column's max width. + my %width_for; + if ( !$opts{n} ) { + %width_for = map { + my $col_name = $_; + if ( $info->{$_}->{dec} ) { + # Align along the decimal point + my $max_rodp = max(0, map { $_->{$col_name} =~ m/([^\s\d-].*)$/ ? length($1) : 0 } @$data); + foreach my $row ( @$data ) { + my $col = $row->{$col_name}; + my ( $l, $r ) = $col =~ m/^([\s\d]*)(.*)$/; + $row->{$col_name} = sprintf("%s%-${max_rodp}s", $l, $r); + } + } + my $max_width = max( length($info->{$_}->{hdr}), map { length($_->{$col_name}) } @$data); + if ( $info->{$col_name}->{maxw} ) { + $max_width = min( $max_width, $info->{$col_name}->{maxw} ); + } + if ( $info->{$col_name}->{minw} ) { + $max_width = max( $max_width, $info->{$col_name}->{minw} ); + } + $col_name => $max_width; + } @$cols; + } + + # The table header. + if ( !$config{hide_hdr}->{val} && !$prefs->{no_hdr} ) { + push @rows, $opts{n} + ? join( $col_sep, @$cols ) + : join( $col_sep, map { sprintf( "%-$width_for{$_}s", trunc($info->{$_}->{hdr}, $width_for{$_}) ) } @$cols ); + if ( $config{color}->{val} && $config{header_highlight}->{val} ) { + push @rows, [ pop @rows, $config{header_highlight}->{val} ]; + } + elsif ( !$opts{n} ) { + push @rows, join( $col_sep, map { "-" x $width_for{$_} } @$cols ); + } + } + + # The table data. + if ( $opts{n} ) { + foreach my $item ( @$data ) { + push @rows, join($col_sep, map { $item->{$_} } @$cols ); + } + } + else { + my $format = join( $col_sep, + map { "%$info->{$_}->{just}$width_for{$_}s" } @$cols ); + foreach my $item ( @$data ) { + my $row = sprintf($format, map { trunc($item->{$_}, $width_for{$_}) } @$cols ); + if ( $config{color}->{val} && $item->{_color} ) { + push @rows, [ $row, $item->{_color} ]; + } + else { + push @rows, $row; + } + } + } + } + + return @rows; +} + +# Aggregates a table. If $group_by is an arrayref of columns, the grouping key +# is the specified columns; otherwise it's just the empty string (e.g. +# everything is grouped as one group). +sub apply_group_by { + my ( $tbl, $group_by, @rows ) = @_; + my $meta = $tbl_meta{$tbl}; + my %is_group = map { $_ => 1 } @$group_by; + my @non_grp = grep { !$is_group{$_} } keys %{$meta->{cols}}; + + my %temp_table; + foreach my $row ( @rows ) { + my $group_key + = @$group_by + ? '{' . join('}{', map { defined $_ ? $_ : '' } @{$row}{@$group_by}) . '}' + : ''; + $temp_table{$group_key} ||= []; + push @{$temp_table{$group_key}}, $row; + } + + # Crush the rows together... + my @new_rows; + foreach my $key ( sort keys %temp_table ) { + my $group = $temp_table{$key}; + my %new_row; + @new_row{@$group_by} = @{$group->[0]}{@$group_by}; + foreach my $col ( @non_grp ) { + my $agg = $meta->{cols}->{$col}->{agg} || 'first'; + $new_row{$col} = $agg_funcs{$agg}->( map { $_->{$col} } @$group ); + } + push @new_rows, \%new_row; + } + return @new_rows; +} + +# set_to_tbl {{{3 +# Unifies all the work of filtering, sorting etc. Alters the input. +# TODO: pull all the little pieces out into subroutines and stick events in each of them. +sub set_to_tbl { + my ( $rows, $tbl ) = @_; + my $meta = $tbl_meta{$tbl} or die "No such table $tbl in tbl_meta"; + + if ( !$meta->{pivot} ) { + + # Hook in event listeners + foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_filter}} ) { + $listener->set_to_tbl_pre_filter($rows, $tbl); + } + + # Apply filters. Note that if the table is pivoted, filtering and sorting + # are applied later. + foreach my $filter ( @{$meta->{filters}} ) { + eval { + @$rows = grep { $filters{$filter}->{func}->($_) } @$rows; + }; + if ( $EVAL_ERROR && $config{debug}->{val} ) { + die $EVAL_ERROR; + } + } + + foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_sort}} ) { + $listener->set_to_tbl_pre_sort($rows, $tbl); + } + + # Sort. Note that if the table is pivoted, sorting might have the wrong + # columns and it could crash. This will only be an issue if it's possible + # to toggle pivoting on and off, which it's not at the moment. + if ( @$rows && $meta->{sort_func} && !$meta->{aggregate} ) { + if ( $meta->{sort_dir} > 0 ) { + @$rows = $meta->{sort_func}->( @$rows ); + } + else { + @$rows = reverse $meta->{sort_func}->( @$rows ); + } + } + + } + + # Stop altering arguments now. + my @rows = @$rows; + + foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_group}} ) { + $listener->set_to_tbl_pre_group(\@rows, $tbl); + } + + # Apply group-by. + if ( $meta->{aggregate} ) { + @rows = apply_group_by($tbl, $meta->{group_by}, @rows); + + # Sort. Note that if the table is pivoted, sorting might have the wrong + # columns and it could crash. This will only be an issue if it's possible + # to toggle pivoting on and off, which it's not at the moment. + if ( @rows && $meta->{sort_func} ) { + if ( $meta->{sort_dir} > 0 ) { + @rows = $meta->{sort_func}->( @rows ); + } + else { + @rows = reverse $meta->{sort_func}->( @rows ); + } + } + + } + + foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_colorize}} ) { + $listener->set_to_tbl_pre_colorize(\@rows, $tbl); + } + + if ( !$meta->{pivot} ) { + # Colorize. Adds a _color column to rows. + if ( @rows && $meta->{color_func} ) { + eval { + foreach my $row ( @rows ) { + $row->{_color} = $meta->{color_func}->($row); + } + }; + if ( $EVAL_ERROR ) { + pause($EVAL_ERROR); + } + } + } + + foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_transform}} ) { + $listener->set_to_tbl_pre_transform(\@rows, $tbl); + } + + # Apply_transformations. + if ( @rows ) { + my $cols = $meta->{cols}; + foreach my $col ( keys %{$rows->[0]} ) { + # Don't auto-vivify $tbl_meta{tbl}-{cols}->{_color}->{trans} + next if $col eq '_color'; + foreach my $trans ( @{$cols->{$col}->{trans}} ) { + map { $_->{$col} = $trans_funcs{$trans}->($_->{$col}) } @rows; + } + } + } + + my ($fmt_cols, $fmt_meta); + + # Pivot. + if ( $meta->{pivot} ) { + + foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_pivot}} ) { + $listener->set_to_tbl_pre_pivot(\@rows, $tbl); + } + + my @vars = @{$meta->{visible}}; + my @tmp = map { { name => $_ } } @vars; + my @cols = 'name'; + foreach my $i ( 0..@$rows-1 ) { + my $col = "set_$i"; + push @cols, $col; + foreach my $j ( 0..@vars-1 ) { + $tmp[$j]->{$col} = $rows[$i]->{$vars[$j]}; + } + } + $fmt_meta = { map { $_ => { hdr => $_, just => '-' } } @cols }; + $fmt_cols = \@cols; + @rows = @tmp; + + # Hook in event listeners + foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_filter}} ) { + $listener->set_to_tbl_pre_filter($rows, $tbl); + } + + # Apply filters. + foreach my $filter ( @{$meta->{filters}} ) { + eval { + @rows = grep { $filters{$filter}->{func}->($_) } @rows; + }; + if ( $EVAL_ERROR && $config{debug}->{val} ) { + die $EVAL_ERROR; + } + } + + foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_sort}} ) { + $listener->set_to_tbl_pre_sort($rows, $tbl); + } + + # Sort. + if ( @rows && $meta->{sort_func} ) { + if ( $meta->{sort_dir} > 0 ) { + @rows = $meta->{sort_func}->( @rows ); + } + else { + @rows = reverse $meta->{sort_func}->( @rows ); + } + } + + } + else { + # If the table isn't pivoted, just show all columns that are supposed to + # be shown; but eliminate aggonly columns if the table isn't aggregated. + my $aggregated = $meta->{aggregate}; + $fmt_cols = [ grep { $aggregated || !$meta->{cols}->{$_}->{aggonly} } @{$meta->{visible}} ]; + $fmt_meta = { map { $_ => $meta->{cols}->{$_} } @$fmt_cols }; + + # If the table is aggregated, re-order the group_by columns to the left of + # the display. + if ( $aggregated ) { + my %is_group = map { $_ => 1 } @{$meta->{group_by}}; + $fmt_cols = [ @{$meta->{group_by}}, grep { !$is_group{$_} } @$fmt_cols ]; + } + } + + foreach my $listener ( @{$event_listener_for{set_to_tbl_pre_create}} ) { + $listener->set_to_tbl_pre_create(\@rows, $tbl); + } + + @rows = create_table( $fmt_cols, $fmt_meta, \@rows); + if ( !$meta->{hide_caption} && !$opts{n} && $config{display_table_captions}->{val} ) { + @rows = create_caption($meta->{capt}, @rows) + } + + foreach my $listener ( @{$event_listener_for{set_to_tbl_post_create}} ) { + $listener->set_to_tbl_post_create(\@rows, $tbl); + } + + return @rows; +} + +# meta_to_hdr {{{3 +sub meta_to_hdr { + my $tbl = shift; + my $meta = $tbl_meta{$tbl}; + my %labels = map { $_ => $meta->{cols}->{$_}->{hdr} } @{$meta->{visible}}; + return \%labels; +} + +# commify {{{3 +# From perlfaq5: add commas. +sub commify { + my ( $num ) = @_; + $num = 0 unless defined $num; + $num =~ s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\d))/$1,/g; + return $num; +} + +# set_precision {{{3 +# Trim to desired precision. +sub set_precision { + my ( $num, $precision ) = @_; + $precision = $config{num_digits}->{val} if !defined $precision; + sprintf("%.${precision}f", $num); +} + +# percent {{{3 +# Convert to percent +sub percent { + my ( $num ) = @_; + $num = 0 unless defined $num; + my $digits = $config{num_digits}->{val}; + return sprintf("%.${digits}f", $num * 100) + . ($config{show_percent}->{val} ? '%' : ''); +} + +# shorten {{{3 +sub shorten { + my ( $num, $opts ) = @_; + + return $num if !defined($num) || $opts{n} || $num !~ m/$num_regex/; + + $opts ||= {}; + my $pad = defined $opts->{pad} ? $opts->{pad} : ''; + my $num_digits = defined $opts->{num_digits} + ? $opts->{num_digits} + : $config{num_digits}->{val}; + my $force = defined $opts->{force}; + + my $n = 0; + while ( $num >= 1_024 ) { + $num /= 1_024; + ++$n; + } + return sprintf( + $num =~ m/\./ || $n || $force + ? "%.${num_digits}f%s" + : '%d', + $num, ($pad,'k','M','G', 'T')[$n]); + +} + +# Utility functions {{{2 +# unique {{{3 +sub unique { + my %seen; + return grep { !$seen{$_}++ } @_; +} + +# make_color_func {{{3 +sub make_color_func { + my ( $tbl ) = @_; + my @criteria; + foreach my $spec ( @{$tbl->{colors}} ) { + next unless exists $comp_ops{$spec->{op}}; + my $val = $spec->{op} =~ m/^(?:eq|ne|le|ge|lt|gt)$/ ? "'$spec->{arg}'" + : $spec->{op} =~ m/^(?:=~|!~)$/ ? "m/" . quotemeta($spec->{arg}) . "/" + : $spec->{arg}; + push @criteria, + "( defined \$set->{$spec->{col}} && \$set->{$spec->{col}} $spec->{op} $val ) { return '$spec->{color}'; }"; + } + return undef unless @criteria; + my $sub = eval 'sub { my ( $set ) = @_; if ' . join(" elsif ", @criteria) . '}'; + die if $EVAL_ERROR; + return $sub; +} + +# make_sort_func {{{3 +# Gets a list of sort columns from the table, like "+cxn -time" and returns a +# subroutine that will sort that way. +sub make_sort_func { + my ( $tbl ) = @_; + my @criteria; + + # Pivoted tables can be sorted by 'name' and set_x columns; others must be + # sorted by existing columns. TODO: this will crash if you toggle between + # pivoted and nonpivoted. I have several other 'crash' notes about this if + # this ever becomes possible. + + if ( $tbl->{pivot} ) { + # Sort type is not really possible on pivoted columns, because a 'column' + # contains data from an entire non-pivoted row, so there could be a mix of + # numeric and non-numeric data. Thus everything has to be 'cmp' type. + foreach my $col ( split(/\s+/, $tbl->{sort_cols} ) ) { + next unless $col; + my ( $dir, $name ) = $col =~ m/([+-])?(\w+)$/; + next unless $name && $name =~ m/^(?:name|set_\d+)$/; + $dir ||= '+'; + my $op = 'cmp'; + my $df = "''"; + push @criteria, + $dir eq '+' + ? "(\$a->{$name} || $df) $op (\$b->{$name} || $df)" + : "(\$b->{$name} || $df) $op (\$a->{$name} || $df)"; + } + } + else { + foreach my $col ( split(/\s+/, $tbl->{sort_cols} ) ) { + next unless $col; + my ( $dir, $name ) = $col =~ m/([+-])?(\w+)$/; + next unless $name && $tbl->{cols}->{$name}; + $dir ||= '+'; + my $op = $tbl->{cols}->{$name}->{num} ? "<=>" : "cmp"; + my $df = $tbl->{cols}->{$name}->{num} ? "0" : "''"; + push @criteria, + $dir eq '+' + ? "(\$a->{$name} || $df) $op (\$b->{$name} || $df)" + : "(\$b->{$name} || $df) $op (\$a->{$name} || $df)"; + } + } + return sub { return @_ } unless @criteria; + my $sub = eval 'sub { sort {' . join("||", @criteria) . '} @_; }'; + die if $EVAL_ERROR; + return $sub; +} + +# trunc {{{3 +# Shortens text to specified length. +sub trunc { + my ( $text, $len ) = @_; + if ( length($text) <= $len ) { + return $text; + } + return substr($text, 0, $len); +} + +# donut {{{3 +# Takes out the middle of text to shorten it. +sub donut { + my ( $text, $len ) = @_; + return $text if length($text) <= $len; + my $max = length($text) - $len; + my $min = $max - 1; + + # Try to remove a single "word" from somewhere in the center + if ( $text =~ s/_[^_]{$min,$max}_/_/ ) { + return $text; + } + + # Prefer removing the end of a "word" + if ( $text =~ s/([^_]+)[^_]{$max}_/$1_/ ) { + return $text; + } + + $text = substr($text, 0, int($len/2)) + . "_" + . substr($text, int($len/2) + $max + 1); + return $text; +} + +# crunch {{{3 +# Removes vowels and compacts repeated letters to shorten text. +sub crunch { + my ( $text, $len ) = @_; + return $text if $len && length($text) <= $len; + $text =~ s/^IB_\w\w_//; + $text =~ s/(?<![_ ])[aeiou]//g; + $text =~ s/(.)\1+/$1/g; + return $text; +} + +# collapse_ws {{{3 +# Collapses all whitespace to a single space. +sub collapse_ws { + my ( $text ) = @_; + return '' unless defined $text; + $text =~ s/\s+/ /g; + return $text; +} + +# Strips out non-printable characters within fields, which freak terminals out. +sub no_ctrl_char { + my ( $text ) = @_; + return '' unless defined $text; + my $charset = $config{charset}->{val}; + if ( $charset && $charset eq 'unicode' ) { + $text =~ s/ + ("(?:(?!(?<!\\)").)*" # Double-quoted string + |'(?:(?!(?<!\\)').)*') # Or single-quoted string + /$1 =~ m#\p{IsC}# ? "[BINARY]" : $1/egx; + } + elsif ( $charset && $charset eq 'none' ) { + $text =~ s/ + ("(?:(?!(?<!\\)").)*" + |'(?:(?!(?<!\\)').)*') + /[TEXT]/gx; + } + else { # The default is 'ascii' + $text =~ s/ + ("(?:(?!(?<!\\)").)*" + |'(?:(?!(?<!\\)').)*') + /$1 =~ m#[^\040-\176]# ? "[BINARY]" : $1/egx; + } + return $text; +} + +# word_wrap {{{3 +# Wraps text at word boundaries so it fits the screen. +sub word_wrap { + my ( $text, $width) = @_; + $width ||= $this_term_size[0]; + $text =~ s/(.{0,$width})(?:\s+|$)/$1\n/g; + $text =~ s/ +$//mg; + return $text; +} + +# draw_screen {{{3 +# Prints lines to the screen. The first argument is an arrayref. Each +# element of the array is either a string or an arrayref. If it's a string it +# just gets printed. If it's an arrayref, the first element is the string to +# print, and the second is args to colored(). +sub draw_screen { + my ( $display_lines, $prefs ) = @_; + if ( !$opts{n} && $config{show_statusbar}->{val} ) { + unshift @$display_lines, create_statusbar(); + } + + foreach my $listener ( @{$event_listener_for{draw_screen}} ) { + $listener->draw_screen($display_lines); + } + + $clear_screen_sub->() + if $prefs->{clear} || !$modes{$config{mode}->{val}}->{no_clear_screen}; + if ( $opts{n} || $prefs->{raw} ) { + my $num_lines = 0; + print join("\n", + map { + $num_lines++; + ref $_ + ? colored($_->[0], $_->[1]) + : $_; + } + grep { !$opts{n} || $_ } # Suppress empty lines + @$display_lines); + if ( $opts{n} && $num_lines ) { + print "\n"; + } + } + else { + my $max_lines = $prefs->{show_all} + ? scalar(@$display_lines)- 1 + : min(scalar(@$display_lines), $this_term_size[1]); + print join("\n", + map { + ref $_ + ? colored(substr($_->[0], 0, $this_term_size[0]), $_->[1]) + : substr($_, 0, $this_term_size[0]); + } @$display_lines[0..$max_lines - 1]); + } +} + +# secs_to_time {{{3 +sub secs_to_time { + my ( $secs, $fmt ) = @_; + $secs ||= 0; + return '00:00' unless $secs; + + # Decide what format to use, if not given + $fmt ||= $secs >= 86_400 ? 'd' + : $secs >= 3_600 ? 'h' + : 'm'; + + return + $fmt eq 'd' ? sprintf( + "%d+%02d:%02d:%02d", + int($secs / 86_400), + int(($secs % 86_400) / 3_600), + int(($secs % 3_600) / 60), + $secs % 60) + : $fmt eq 'h' ? sprintf( + "%02d:%02d:%02d", + int(($secs % 86_400) / 3_600), + int(($secs % 3_600) / 60), + $secs % 60) + : sprintf( + "%02d:%02d", + int(($secs % 3_600) / 60), + $secs % 60); +} + +# dulint_to_int {{{3 +# Takes a number that InnoDB formats as two ulint integers, like transaction IDs +# and such, and turns it into a single integer +sub dulint_to_int { + my $num = shift; + return 0 unless $num; + my ( $high, $low ) = $num =~ m/^(\d+) (\d+)$/; + return $low unless $high; + return $low + ( $high * $MAX_ULONG ); +} + +# create_statusbar {{{3 +sub create_statusbar { + my $mode = $config{mode}->{val}; + my @cxns = sort { $a cmp $b } get_connections(); + + my $modeline = ( $config{readonly}->{val} ? '[RO] ' : '' ) + . $modes{$mode}->{hdr} . " (? for help)"; + my $mode_width = length($modeline); + my $remaining_width = $this_term_size[0] - $mode_width - 1; + my $result; + + # The thingie in top-right that says what we're monitoring. + my $cxn = ''; + + if ( 1 == @cxns && $dbhs{$cxns[0]} && $dbhs{$cxns[0]}->{dbh} ) { + $cxn = $dbhs{$cxns[0]}->{dbh}->{mysql_serverinfo} || ''; + } + else { + if ( $modes{$mode}->{server_group} ) { + $cxn = "Servers: " . $modes{$mode}->{server_group}; + my $err_count = grep { $dbhs{$_} && $dbhs{$_}->{err_count} } @cxns; + if ( $err_count ) { + $cxn .= "(" . ( scalar(@cxns) - $err_count ) . "/" . scalar(@cxns) . ")"; + } + } + else { + $cxn = join(' ', map { ($dbhs{$_}->{err_count} ? '!' : '') . $_ } + grep { $dbhs{$_} } @cxns); + } + } + + if ( 1 == @cxns ) { + get_driver_status(@cxns); + my $vars = $vars{$cxns[0]}->{$clock}; + my $inc = inc(0, $cxns[0]); + + # Format server uptime human-readably, calculate QPS... + my $uptime = secs_to_time( $vars->{Uptime_hires} ); + my $qps = ($inc->{Questions}||0) / ($inc->{Uptime_hires}||1); + my $ibinfo = ''; + + if ( exists $vars->{IB_last_secs} ) { + $ibinfo .= "InnoDB $vars->{IB_last_secs}s "; + if ( $vars->{IB_got_all} ) { + if ( ($mode eq 'T' || $mode eq 'W') + && $vars->{IB_tx_is_truncated} ) { + $ibinfo .= ':^|'; + } + else { + $ibinfo .= ':-)'; + } + } + else { + $ibinfo .= ':-('; + } + } + $result = sprintf( + "%-${mode_width}s %${remaining_width}s", + $modeline, + join(', ', grep { $_ } ( + $cxns[0], + $uptime, + $ibinfo, + shorten($qps) . " QPS", + ($vars->{Threads} || 0) . " thd", + $cxn))); + } + else { + $result = sprintf( + "%-${mode_width}s %${remaining_width}s", + $modeline, + $cxn); + } + + return $config{color}->{val} ? [ $result, 'bold reverse' ] : $result; +} + +# Database connections {{{3 +sub add_new_dsn { + my ( $name ) = @_; + + if ( defined $name ) { + $name =~ s/[\s:;]//g; + } + + if ( !$name ) { + print word_wrap("Choose a name for the connection. It cannot contain " + . "whitespace, colons or semicolons."), "\n\n"; + do { + $name = prompt("Enter a name"); + $name =~ s/[\s:;]//g; + } until ( $name ); + } + + my $dsn; + do { + $clear_screen_sub->(); + print "Typical DSN strings look like\n DBI:mysql:;host=hostname;port=port\n" + . "The db and port are optional and can usually be omitted.\n" + . "If you specify 'mysql_read_default_group=mysql' many options can be read\n" + . "from your mysql options files (~/.my.cnf, /etc/my.cnf).\n\n"; + $dsn = prompt("Enter a DSN string", undef, "DBI:mysql:;mysql_read_default_group=mysql;host=$name"); + } until ( $dsn ); + + $clear_screen_sub->(); + my $dl_table = prompt("Optional: enter a table (must not exist) to use when resetting InnoDB deadlock information", + undef, 'test.innotop_dl'); + + $connections{$name} = { + dsn => $dsn, + dl_table => $dl_table, + }; +} + +sub add_new_server_group { + my ( $name ) = @_; + + if ( defined $name ) { + $name =~ s/[\s:;]//g; + } + + if ( !$name ) { + print word_wrap("Choose a name for the group. It cannot contain " + . "whitespace, colons or semicolons."), "\n\n"; + do { + $name = prompt("Enter a name"); + $name =~ s/[\s:;]//g; + } until ( $name ); + } + + my @cxns; + do { + $clear_screen_sub->(); + @cxns = select_cxn("Choose servers for $name", keys %connections); + } until ( @cxns ); + + $server_groups{$name} = \@cxns; + return $name; +} + +sub get_var_set { + my ( $name ) = @_; + while ( !$name || !exists($var_sets{$config{$name}->{val}}) ) { + $name = choose_var_set($name); + } + return $var_sets{$config{$name}->{val}}->{text}; +} + +sub add_new_var_set { + my ( $name ) = @_; + + if ( defined $name ) { + $name =~ s/\W//g; + } + + if ( !$name ) { + do { + $name = prompt("Enter a name"); + $name =~ s/\W//g; + } until ( $name ); + } + + my $variables; + do { + $clear_screen_sub->(); + $variables = prompt("Enter variables for $name", undef ); + } until ( $variables ); + + $var_sets{$name} = { text => $variables, user => 1 }; +} + +sub next_server { + my $mode = $config{mode}->{val}; + my @cxns = sort keys %connections; + my ($cur) = get_connections($mode); + $cur ||= $cxns[0]; + my $pos = grep { $_ lt $cur } @cxns; + my $newpos = ($pos + 1) % @cxns; + $modes{$mode}->{server_group} = ''; + $modes{$mode}->{connections} = [ $cxns[$newpos] ]; + $clear_screen_sub->(); +} + +sub next_server_group { + my $mode = shift || $config{mode}->{val}; + my @grps = sort keys %server_groups; + my $curr = $modes{$mode}->{server_group}; + + return unless @grps; + + if ( $curr ) { + # Find the current group's position. + my $pos = 0; + while ( $curr ne $grps[$pos] ) { + $pos++; + } + $modes{$mode}->{server_group} = $grps[ ($pos + 1) % @grps ]; + } + else { + $modes{$mode}->{server_group} = $grps[0]; + } +} + +# Get a list of connection names used in this mode. +sub get_connections { + if ( $file ) { + return qw(file); + } + my $mode = shift || $config{mode}->{val}; + my @connections = $modes{$mode}->{server_group} + ? @{$server_groups{$modes{$mode}->{server_group}}} + : @{$modes{$mode}->{connections}}; + if ( $modes{$mode}->{one_connection} ) { + @connections = @connections ? $connections[0] : (); + } + return unique(@connections); +} + +# Get a list of tables used in this mode. If innotop is running non-interactively, just use the first. +sub get_visible_tables { + my $mode = shift || $config{mode}->{val}; + my @tbls = @{$modes{$mode}->{visible_tables}}; + if ( $opts{n} ) { + return $tbls[0]; + } + else { + return @tbls; + } +} + +# Choose from among available connections or server groups. +# If the mode has a server set in use, prefers that instead. +sub choose_connections { + $clear_screen_sub->(); + my $mode = $config{mode}->{val}; + my $meta = { map { $_ => $connections{$_}->{dsn} } keys %connections }; + foreach my $group ( keys %server_groups ) { + $meta->{"#$group"} = join(' ', @{$server_groups{$group}}); + } + + my $choices = prompt_list("Choose connections or a group for $mode mode", + undef, sub { return keys %$meta }, $meta); + + my @choices = unique(grep { $_ } split(/\s+/, $choices)); + if ( @choices ) { + if ( $choices[0] =~ s/^#// && exists $server_groups{$choices[0]} ) { + $modes{$mode}->{server_group} = $choices[0]; + } + else { + $modes{$mode}->{connections} = [ grep { exists $connections{$_} } @choices ]; + } + } +} + +# Accepts a DB connection name and the name of a prepared query (e.g. status, kill). +# Also a list of params for the prepared query. This allows not storing prepared +# statements globally. Returns a $sth that's been executed. +# ERROR-HANDLING SEMANTICS: if the statement throws an error, propagate, but if the +# connection has gone away or can't connect, DO NOT. Just return undef. +sub do_stmt { + my ( $cxn, $stmt_name, @args ) = @_; + + return undef if $file; + + # Test if the cxn should not even be tried + return undef if $dbhs{$cxn} + && $dbhs{$cxn}->{err_count} + && ( !$dbhs{$cxn}->{dbh} || !$dbhs{$cxn}->{dbh}->{Active} || $dbhs{$cxn}->{mode} eq $config{mode}->{val} ) + && $dbhs{$cxn}->{wake_up} > $clock; + + my $sth; + my $retries = 1; + my $success = 0; + TRY: + while ( $retries-- >= 0 && !$success ) { + + eval { + my $dbh = connect_to_db($cxn); + + # If the prepared query doesn't exist, make it. + if ( !exists $dbhs{$cxn}->{stmts}->{$stmt_name} ) { + $dbhs{$cxn}->{stmts}->{$stmt_name} = $stmt_maker_for{$stmt_name}->($dbh); + } + + $sth = $dbhs{$cxn}->{stmts}->{$stmt_name}; + if ( $sth ) { + $sth->execute(@args); + } + $success = 1; + }; + if ( $EVAL_ERROR ) { + if ( $EVAL_ERROR =~ m/$nonfatal_errs/ ) { + handle_cxn_error($cxn, $EVAL_ERROR); + } + else { + die "$cxn $stmt_name: $EVAL_ERROR"; + } + if ( $retries < 0 ) { + $sth = undef; + } + } + } + + if ( $sth && $sth->{NUM_OF_FIELDS} ) { + sleep($stmt_sleep_time_for{$stmt_name}) if $stmt_sleep_time_for{$stmt_name}; + return $sth; + } +} + +# Keeps track of error count, sleep times till retries, etc etc. +# When there's an error we retry the connection every so often, increasing in +# Fibonacci series to prevent too much banging on the server. +sub handle_cxn_error { + my ( $cxn, $err ) = @_; + my $meta = $dbhs{$cxn}; + $meta->{err_count}++; + + # This is used so errors that have to do with permissions needed by the current + # mode will get displayed as long as we're in this mode, but get ignored if the + # mode changes. + $meta->{mode} = $config{mode}->{val}; + + # Strip garbage from the error text if possible. + $err =~ s/\s+/ /g; + if ( $err =~ m/failed: (.*?) at \S*innotop line/ ) { + $err = $1; + } + + $meta->{last_err} = $err; + my $sleep_time = $meta->{this_sleep} + $meta->{prev_sleep}; + $meta->{prev_sleep} = $meta->{this_sleep}; + $meta->{this_sleep} = $sleep_time; + $meta->{wake_up} = $clock + $sleep_time; + if ( $config{show_cxn_errors}->{val} ) { + print STDERR "Error at tick $clock $cxn $err" if $config{debug}->{val}; + } +} + +# Accepts a DB connection name and a (string) query. Returns a $sth that's been +# executed. +sub do_query { + my ( $cxn, $query ) = @_; + + return undef if $file; + + # Test if the cxn should not even be tried + return undef if $dbhs{$cxn} + && $dbhs{$cxn}->{err_count} + && ( !$dbhs{$cxn}->{dbh} || !$dbhs{$cxn}->{dbh}->{Active} || $dbhs{$cxn}->{mode} eq $config{mode}->{val} ) + && $dbhs{$cxn}->{wake_up} > $clock; + + my $sth; + my $retries = 1; + my $success = 0; + TRY: + while ( $retries-- >= 0 && !$success ) { + + eval { + my $dbh = connect_to_db($cxn); + + $sth = $dbh->prepare($query); + $sth->execute(); + $success = 1; + }; + if ( $EVAL_ERROR ) { + if ( $EVAL_ERROR =~ m/$nonfatal_errs/ ) { + handle_cxn_error($cxn, $EVAL_ERROR); + } + else { + die $EVAL_ERROR; + } + if ( $retries < 0 ) { + $sth = undef; + } + } + } + + return $sth; +} + +sub get_uptime { + my ( $cxn ) = @_; + $dbhs{$cxn}->{start_time} ||= time(); + # Avoid dividing by zero + return (time() - $dbhs{$cxn}->{start_time}) || .001; +} + +sub connect_to_db { + my ( $cxn ) = @_; + + $dbhs{$cxn} ||= { + stmts => {}, # bucket for prepared statements. + prev_sleep => 0, + this_sleep => 1, + wake_up => 0, + start_time => 0, + dbh => undef, + }; + my $href = $dbhs{$cxn}; + + if ( !$href->{dbh} || ref($href->{dbh}) !~ m/DBI/ || !$href->{dbh}->ping ) { + my $dbh = get_new_db_connection($cxn); + @{$href}{qw(dbh err_count wake_up this_sleep start_time prev_sleep)} + = ($dbh, 0, 0, 1, 0, 0); + + # Derive and store the server's start time in hi-res + my $uptime = $dbh->selectrow_hashref("show status like 'Uptime'")->{value}; + $href->{start_time} = time() - $uptime; + + # Set timeouts so an unused connection stays alive. + # For example, a connection might be used in Q mode but idle in T mode. + if ( version_ge($dbh, '4.0.3')) { + my $timeout = $config{cxn_timeout}->{val}; + $dbh->do("set session wait_timeout=$timeout, interactive_timeout=$timeout"); + } + } + return $href->{dbh}; +} + +# Compares versions like 5.0.27 and 4.1.15-standard-log +sub version_ge { + my ( $dbh, $target ) = @_; + my $version = sprintf('%03d%03d%03d', $dbh->{mysql_serverinfo} =~ m/(\d+)/g); + return $version ge sprintf('%03d%03d%03d', $target =~ m/(\d+)/g); +} + +# Extracts status values that can be gleaned from the DBD driver without doing a whole query. +sub get_driver_status { + my @cxns = @_; + if ( !$info_gotten{driver_status}++ ) { + foreach my $cxn ( @cxns ) { + next unless $dbhs{$cxn} && $dbhs{$cxn}->{dbh} && $dbhs{$cxn}->{dbh}->{Active}; + $vars{$cxn}->{$clock} ||= {}; + my $vars = $vars{$cxn}->{$clock}; + my %res = map { $_ =~ s/ +/_/g; $_ } $dbhs{$cxn}->{dbh}->{mysql_stat} =~ m/(\w[^:]+): ([\d\.]+)/g; + map { $vars->{$_} ||= $res{$_} } keys %res; + $vars->{Uptime_hires} ||= get_uptime($cxn); + $vars->{cxn} = $cxn; + } + } +} + +sub get_new_db_connection { + my ( $connection, $destroy ) = @_; + if ( $file ) { + die "You can't connect to a MySQL server while monitoring a file. This is probably a bug."; + } + + my $dsn = $connections{$connection} + or die "No connection named '$connection' is defined in your configuration"; + + if ( !defined $dsn->{have_user} ) { + my $answer = prompt("Do you want to specify a username for $connection?", undef, 'n'); + $dsn->{have_user} = $answer && $answer =~ m/1|y/i; + } + + if ( !defined $dsn->{have_pass} ) { + my $answer = prompt("Do you want to specify a password for $connection?", undef, 'n'); + $dsn->{have_pass} = $answer && $answer =~ m/1|y/i; + } + + if ( !$dsn->{user} && $dsn->{have_user} ) { + my $user = $ENV{USERNAME} || $ENV{USER} || getlogin() || getpwuid($REAL_USER_ID) || undef; + $dsn->{user} = prompt("Enter username for $connection", undef, $user); + } + + if ( !defined $dsn->{user} ) { + $dsn->{user} = ''; + } + + if ( !$dsn->{pass} && !$dsn->{savepass} && $dsn->{have_pass} ) { + $dsn->{pass} = prompt_noecho("Enter password for '$dsn->{user}' on $connection"); + print "\n"; + if ( !defined($dsn->{savepass}) ) { + my $answer = prompt("Save password in plain text in the config file?", undef, 'y'); + $dsn->{savepass} = $answer && $answer =~ m/1|y/i; + } + } + + my $dbh = DBI->connect( + $dsn->{dsn}, $dsn->{user}, $dsn->{pass}, + { RaiseError => 1, PrintError => 0, AutoCommit => 1 }); + $dbh->{InactiveDestroy} = 1 unless $destroy; # Can't be set in $db_options + $dbh->{FetchHashKeyName} = 'NAME_lc'; # Lowercases all column names for fetchrow_hashref + return $dbh; +} + +sub get_cxn_errors { + my @cxns = @_; + return () unless $config{show_cxn_errors_in_tbl}->{val}; + return + map { [ $_ . ': ' . $dbhs{$_}->{last_err}, 'red' ] } + grep { $dbhs{$_} && $dbhs{$_}->{err_count} && $dbhs{$_}->{mode} eq $config{mode}->{val} } + @cxns; +} + +# Setup and tear-down functions {{{2 + +# Takes a string and turns it into a hashref you can apply to %tbl_meta tables. The string +# can be in the form 'foo, bar, foo/bar, foo as bar' much like a SQL SELECT statement. +sub compile_select_stmt { + my ($str) = @_; + my @exps = $str =~ m/\s*([^,]+(?i:\s+as\s+[^,\s]+)?)\s*(?=,|$)/g; + my %cols; + my @visible; + foreach my $exp ( @exps ) { + my ( $text, $colname ); + if ( $exp =~ m/as\s+(\w+)\s*/ ) { + $colname = $1; + $exp =~ s/as\s+(\w+)\s*//; + $text = $exp; + } + else { + $text = $colname = $exp; + } + my ($func, $err) = compile_expr($text); + $cols{$colname} = { + src => $text, + hdr => $colname, + num => 0, + func => $func, + }; + push @visible, $colname; + } + return (\%cols, \@visible); +} + +# compile_filter {{{3 +sub compile_filter { + my ( $text ) = @_; + my ( $sub, $err ); + eval "\$sub = sub { my \$set = shift; $text }"; + if ( $EVAL_ERROR ) { + $EVAL_ERROR =~ s/at \(eval.*$//; + $sub = sub { return $EVAL_ERROR }; + $err = $EVAL_ERROR; + } + return ( $sub, $err ); +} + +# compile_expr {{{3 +sub compile_expr { + my ( $expr ) = @_; + # Leave built-in functions alone so they get called as Perl functions, unless + # they are the only word in $expr, in which case treat them as hash keys. + if ( $expr =~ m/\W/ ) { + $expr =~ s/(?<!\{|\$)\b([A-Za-z]\w{2,})\b/is_func($1) ? $1 : "\$set->{$1}"/eg; + } + else { + $expr = "\$set->{$expr}"; + } + my ( $sub, $err ); + my $quoted = quotemeta($expr); + eval qq{ + \$sub = sub { + my (\$set, \$cur, \$pre) = \@_; + my \$val = eval { $expr }; + if ( \$EVAL_ERROR && \$config{debug}->{val} ) { + \$EVAL_ERROR =~ s/ at \\(eval.*//s; + die "\$EVAL_ERROR in expression $quoted"; + } + return \$val; + } + }; + if ( $EVAL_ERROR ) { + if ( $config{debug}->{val} ) { + die $EVAL_ERROR; + } + $EVAL_ERROR =~ s/ at \(eval.*$//; + $sub = sub { return $EVAL_ERROR }; + $err = $EVAL_ERROR; + } + return ( $sub, $err ); +} + +# finish {{{3 +# This is a subroutine because it's called from a key to quit the program. +sub finish { + save_config(); + ReadMode('normal') unless $opts{n}; + print "\n"; + exit(0); +} + +# core_dump {{{3 +sub core_dump { + my $msg = shift; + if ($config{debugfile}->{val} && $config{debug}->{val}) { + eval { + open my $file, '>>', $config{debugfile}->{val}; + if ( %vars ) { + print $file "Current variables:\n" . Dumper(\%vars); + } + close $file; + }; + } + print $msg; +} + +# load_config {{{3 +sub load_config { + + my $filename = $opts{c} || "$homepath/.innotop/innotop.ini"; + my $dirname = dirname($filename); + if ( -f $dirname && !$opts{c} ) { + # innotop got upgraded and this is the old config file. + my $answer = pause("Innotop's default config location has moved to $filename. Move old config file $dirname there now? y/n"); + if ( lc $answer eq 'y' ) { + rename($dirname, "$homepath/innotop.ini") + or die "Can't rename '$dirname': $OS_ERROR"; + mkdir($dirname) or die "Can't create directory '$dirname': $OS_ERROR"; + mkdir("$dirname/plugins") or die "Can't create directory '$dirname/plugins': $OS_ERROR"; + rename("$homepath/innotop.ini", $filename) + or die "Can't rename '$homepath/innotop.ini' to '$filename': $OS_ERROR"; + } + else { + print "\nInnotop will now exit so you can fix the config file.\n"; + exit(0); + } + } + + if ( ! -d $dirname ) { + mkdir $dirname + or die "Can't create directory '$dirname': $OS_ERROR"; + } + if ( ! -d "$dirname/plugins" ) { + mkdir "$dirname/plugins" + or die "Can't create directory '$dirname/plugins': $OS_ERROR"; + } + + if ( -f $filename ) { + open my $file, "<", $filename or die("Can't open '$filename': $OS_ERROR"); + + # Check config file version. Just ignore if either innotop or the file has + # garbage in the version number. + if ( defined(my $line = <$file>) && $VERSION =~ m/\d/ ) { + chomp $line; + if ( my ($maj, $min, $rev) = $line =~ m/^version=(\d+)\.(\d+)(?:\.(\d+))?$/ ) { + $rev ||= 0; + my $cfg_ver = sprintf('%03d-%03d-%03d', $maj, $min, $rev); + ( $maj, $min, $rev ) = $VERSION =~ m/^(\d+)\.(\d+)(?:\.(\d+))?$/; + $rev ||= 0; + my $innotop_ver = sprintf('%03d-%03d-%03d', $maj, $min, $rev); + + if ( $cfg_ver gt $innotop_ver ) { + pause("The config file is for a newer version of innotop and may not be read correctly."); + } + else { + my @ver_history = @config_versions; + while ( my ($start, $end) = splice(@ver_history, 0, 2) ) { + # If the config file is between the endpoints and innotop is greater than + # the endpoint, innotop has a newer config file format than the file. + if ( $cfg_ver ge $start && $cfg_ver lt $end && $innotop_ver ge $end ) { + my $msg = "innotop's config file format has changed. Overwrite $filename? y or n"; + if ( pause($msg) eq 'n' ) { + $config{readonly}->{val} = 1; + print "\ninnotop will not save any configuration changes you make."; + pause(); + print "\n"; + } + close $file; + return; + } + } + } + } + } + + while ( my $line = <$file> ) { + chomp $line; + next unless $line =~ m/^\[([a-z_]+)\]$/; + if ( exists $config_file_sections{$1} ) { + $config_file_sections{$1}->{reader}->($file); + } + else { + warn "Unknown config file section '$1'"; + } + } + close $file or die("Can't close $filename: $OS_ERROR"); + } + +} + +# Do some post-processing on %tbl_meta: compile src properties into func etc. +sub post_process_tbl_meta { + foreach my $table ( values %tbl_meta ) { + foreach my $col_name ( keys %{$table->{cols}} ) { + my $col_def = $table->{cols}->{$col_name}; + my ( $sub, $err ) = compile_expr($col_def->{src}); + $col_def->{func} = $sub; + } + } +} + +# load_config_plugins {{{3 +sub load_config_plugins { + my ( $file ) = @_; + + # First, find a list of all plugins that exist on disk, and get information about them. + my $dir = $config{plugin_dir}->{val}; + foreach my $p_file ( <$dir/*.pm> ) { + my ($package, $desc); + eval { + open my $p_in, "<", $p_file or die $OS_ERROR; + while ( my $line = <$p_in> ) { + chomp $line; + if ( $line =~ m/^package\s+(.*?);/ ) { + $package = $1; + } + elsif ( $line =~ m/^# description: (.*)/ ) { + $desc = $1; + } + last if $package && $desc; + } + close $p_in; + }; + if ( $package ) { + $plugins{$package} = { + file => $p_file, + desc => $desc, + class => $package, + active => 0, + }; + if ( $config{debug}->{val} && $EVAL_ERROR ) { + die $EVAL_ERROR; + } + } + } + + # Now read which ones the user has activated. Each line simply represents an active plugin. + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + next unless $line && $plugins{$line}; + + my $obj; + eval { + require $plugins{$line}->{file}; + $obj = $line->new(%pluggable_vars); + foreach my $event ( $obj->register_for_events() ) { + my $queue = $event_listener_for{$event}; + if ( $queue ) { + push @$queue, $obj; + } + } + }; + if ( $config{debug}->{val} && $EVAL_ERROR ) { + die $EVAL_ERROR; + } + if ( $obj ) { + $plugins{$line}->{active} = 1; + $plugins{$line}->{object} = $obj; + } + } +} + +# save_config_plugins {{{3 +sub save_config_plugins { + my $file = shift; + foreach my $class ( sort keys %plugins ) { + next unless $plugins{$class}->{active}; + print $file "$class\n"; + } +} + +# load_config_active_server_groups {{{3 +sub load_config_active_server_groups { + my ( $file ) = @_; + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + my ( $mode, $group ) = $line =~ m/^(.*?)=(.*)$/; + next unless $mode && $group + && exists $modes{$mode} && exists $server_groups{$group}; + $modes{$mode}->{server_group} = $group; + } +} + +# save_config_active_server_groups {{{3 +sub save_config_active_server_groups { + my $file = shift; + foreach my $mode ( sort keys %modes ) { + print $file "$mode=$modes{$mode}->{server_group}\n"; + } +} + +# load_config_server_groups {{{3 +sub load_config_server_groups { + my ( $file ) = @_; + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + my ( $name, $rest ) = $line =~ m/^(.*?)=(.*)$/; + next unless $name && $rest; + my @vars = unique(grep { $_ && exists $connections{$_} } split(/\s+/, $rest)); + next unless @vars; + $server_groups{$name} = \@vars; + } +} + +# save_config_server_groups {{{3 +sub save_config_server_groups { + my $file = shift; + foreach my $set ( sort keys %server_groups ) { + print $file "$set=", join(' ', @{$server_groups{$set}}), "\n"; + } +} + +# load_config_varsets {{{3 +sub load_config_varsets { + my ( $file ) = @_; + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + my ( $name, $rest ) = $line =~ m/^(.*?)=(.*)$/; + next unless $name && $rest; + $var_sets{$name} = { + text => $rest, + user => 1, + }; + } +} + +# save_config_varsets {{{3 +sub save_config_varsets { + my $file = shift; + foreach my $varset ( sort keys %var_sets ) { + next unless $var_sets{$varset}->{user}; + print $file "$varset=$var_sets{$varset}->{text}\n"; + } +} + +# load_config_group_by {{{3 +sub load_config_group_by { + my ( $file ) = @_; + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + my ( $tbl , $rest ) = $line =~ m/^(.*?)=(.*)$/; + next unless $tbl && exists $tbl_meta{$tbl}; + my @parts = unique(grep { exists($tbl_meta{$tbl}->{cols}->{$_}) } split(/\s+/, $rest)); + $tbl_meta{$tbl}->{group_by} = [ @parts ]; + $tbl_meta{$tbl}->{cust}->{group_by} = 1; + } +} + +# save_config_group_by {{{3 +sub save_config_group_by { + my $file = shift; + foreach my $tbl ( sort keys %tbl_meta ) { + next if $tbl_meta{$tbl}->{temp}; + next unless $tbl_meta{$tbl}->{cust}->{group_by}; + my $aref = $tbl_meta{$tbl}->{group_by}; + print $file "$tbl=", join(' ', @$aref), "\n"; + } +} + +# load_config_filters {{{3 +sub load_config_filters { + my ( $file ) = @_; + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + my ( $key, $rest ) = $line =~ m/^(.+?)=(.*)$/; + next unless $key && $rest; + + my %parts = $rest =~ m/(\w+)='((?:(?!(?<!\\)').)*)'/g; # Properties are single-quoted + next unless $parts{text} && $parts{tbls}; + + foreach my $prop ( keys %parts ) { + # Un-escape escaping + $parts{$prop} =~ s/\\\\/\\/g; + $parts{$prop} =~ s/\\'/'/g; + } + + my ( $sub, $err ) = compile_filter($parts{text}); + my @tbls = unique(split(/\s+/, $parts{tbls})); + @tbls = grep { exists $tbl_meta{$_} } @tbls; + $filters{$key} = { + func => $sub, + text => $parts{text}, + user => 1, + name => $key, + note => 'User-defined filter', + tbls => \@tbls, + } + } +} + +# save_config_filters {{{3 +sub save_config_filters { + my $file = shift; + foreach my $key ( sort keys %filters ) { + next if !$filters{$key}->{user} || $filters{$key}->{quick}; + my $text = $filters{$key}->{text}; + $text =~ s/([\\'])/\\$1/g; + my $tbls = join(" ", @{$filters{$key}->{tbls}}); + print $file "$key=text='$text' tbls='$tbls'\n"; + } +} + +# load_config_visible_tables {{{3 +sub load_config_visible_tables { + my ( $file ) = @_; + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + my ( $mode, $rest ) = $line =~ m/^(.*?)=(.*)$/; + next unless $mode && exists $modes{$mode}; + $modes{$mode}->{visible_tables} = + [ unique(grep { $_ && exists $tbl_meta{$_} } split(/\s+/, $rest)) ]; + $modes{$mode}->{cust}->{visible_tables} = 1; + } +} + +# save_config_visible_tables {{{3 +sub save_config_visible_tables { + my $file = shift; + foreach my $mode ( sort keys %modes ) { + next unless $modes{$mode}->{cust}->{visible_tables}; + my $tables = $modes{$mode}->{visible_tables}; + print $file "$mode=", join(' ', @$tables), "\n"; + } +} + +# load_config_sort_cols {{{3 +sub load_config_sort_cols { + my ( $file ) = @_; + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + my ( $key , $rest ) = $line =~ m/^(.*?)=(.*)$/; + next unless $key && exists $tbl_meta{$key}; + $tbl_meta{$key}->{sort_cols} = $rest; + $tbl_meta{$key}->{cust}->{sort_cols} = 1; + $tbl_meta{$key}->{sort_func} = make_sort_func($tbl_meta{$key}); + } +} + +# save_config_sort_cols {{{3 +sub save_config_sort_cols { + my $file = shift; + foreach my $tbl ( sort keys %tbl_meta ) { + next unless $tbl_meta{$tbl}->{cust}->{sort_cols}; + my $col = $tbl_meta{$tbl}->{sort_cols}; + print $file "$tbl=$col\n"; + } +} + +# load_config_active_filters {{{3 +sub load_config_active_filters { + my ( $file ) = @_; + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + my ( $tbl , $rest ) = $line =~ m/^(.*?)=(.*)$/; + next unless $tbl && exists $tbl_meta{$tbl}; + my @parts = unique(grep { exists($filters{$_}) } split(/\s+/, $rest)); + @parts = grep { grep { $tbl eq $_ } @{$filters{$_}->{tbls}} } @parts; + $tbl_meta{$tbl}->{filters} = [ @parts ]; + $tbl_meta{$tbl}->{cust}->{filters} = 1; + } +} + +# save_config_active_filters {{{3 +sub save_config_active_filters { + my $file = shift; + foreach my $tbl ( sort keys %tbl_meta ) { + next if $tbl_meta{$tbl}->{temp}; + next unless $tbl_meta{$tbl}->{cust}->{filters}; + my $aref = $tbl_meta{$tbl}->{filters}; + print $file "$tbl=", join(' ', @$aref), "\n"; + } +} + +# load_config_active_columns {{{3 +sub load_config_active_columns { + my ( $file ) = @_; + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + my ( $key , $rest ) = $line =~ m/^(.*?)=(.*)$/; + next unless $key && exists $tbl_meta{$key}; + my @parts = grep { exists($tbl_meta{$key}->{cols}->{$_}) } unique split(/ /, $rest); + $tbl_meta{$key}->{visible} = [ @parts ]; + $tbl_meta{$key}->{cust}->{visible} = 1; + } +} + +# save_config_active_columns {{{3 +sub save_config_active_columns { + my $file = shift; + foreach my $tbl ( sort keys %tbl_meta ) { + next unless $tbl_meta{$tbl}->{cust}->{visible}; + my $aref = $tbl_meta{$tbl}->{visible}; + print $file "$tbl=", join(' ', @$aref), "\n"; + } +} + +# save_config_tbl_meta {{{3 +sub save_config_tbl_meta { + my $file = shift; + foreach my $tbl ( sort keys %tbl_meta ) { + foreach my $col ( keys %{$tbl_meta{$tbl}->{cols}} ) { + my $meta = $tbl_meta{$tbl}->{cols}->{$col}; + next unless $meta->{user}; + print $file "$col=", join( + " ", + map { + # Some properties (trans) are arrays, others scalars + my $val = ref($meta->{$_}) ? join(',', @{$meta->{$_}}) : $meta->{$_}; + $val =~ s/([\\'])/\\$1/g; # Escape backslashes and single quotes + "$_='$val'"; # Enclose in single quotes + } + grep { $_ ne 'func' } + keys %$meta + ), "\n"; + } + } +} + +# save_config_config {{{3 +sub save_config_config { + my $file = shift; + foreach my $key ( sort keys %config ) { + eval { + if ( $key ne 'password' || $config{savepass}->{val} ) { + print $file "# $config{$key}->{note}\n" + or die "Cannot print to file: $OS_ERROR"; + my $val = $config{$key}->{val}; + $val = '' unless defined($val); + if ( ref( $val ) eq 'ARRAY' ) { + print $file "$key=" + . join( " ", @$val ) . "\n" + or die "Cannot print to file: $OS_ERROR"; + } + elsif ( ref( $val ) eq 'HASH' ) { + print $file "$key=" + . join( " ", + map { "$_:$val->{$_}" } keys %$val + ) . "\n"; + } + else { + print $file "$key=$val\n"; + } + } + }; + if ( $EVAL_ERROR ) { print "$EVAL_ERROR in $key"; }; + } + +} + +# load_config_config {{{3 +sub load_config_config { + my ( $file ) = @_; + + # Look in the command-line parameters for things stored in the same slot. + my %cmdline = + map { $_->{c} => $opts{$_->{k}} } + grep { exists $_->{c} && exists $opts{$_->{k}} } + @opt_spec; + + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + my ( $name, $val ) = $line =~ m/^(.+?)=(.*)$/; + next unless defined $name && defined $val; + + # Values might already have been set at the command line. + $val = defined($cmdline{$name}) ? $cmdline{$name} : $val; + + # Validate the incoming values... + if ( $name && exists( $config{$name} ) ) { + if ( !$config{$name}->{pat} || $val =~ m/$config{$name}->{pat}/ ) { + $config{$name}->{val} = $val; + $config{$name}->{read} = 1; + } + } + } +} + +# load_config_tbl_meta {{{3 +sub load_config_tbl_meta { + my ( $file ) = @_; + + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + # Each tbl_meta section has all the properties defined in %col_props. + my ( $col , $rest ) = $line =~ m/^(.*?)=(.*)$/; + next unless $col; + my %parts = $rest =~ m/(\w+)='((?:(?!(?<!\\)').)*)'/g; # Properties are single-quoted + + # Each section read from the config file has one extra property: which table it + # goes in. + my $tbl = $parts{tbl} or die "There's no table for tbl_meta $col"; + my $meta = $tbl_meta{$tbl} or die "There's no table in tbl_meta named $tbl"; + + # The section is user-defined by definition (if that makes sense). + $parts{user} = 1; + + # The column may already exist in the table, in which case this is just a + # customization. + $meta->{cols}->{$col} ||= {}; + + foreach my $prop ( keys %col_props ) { + if ( !defined($parts{$prop}) ) { + die "Undefined property $prop for column $col in table $tbl"; + } + + # Un-escape escaping + $parts{$prop} =~ s/\\\\/\\/g; + $parts{$prop} =~ s/\\'/'/g; + + if ( ref $col_props{$prop} ) { + if ( $prop eq 'trans' ) { + $meta->{cols}->{$col}->{trans} + = [ unique(grep { exists $trans_funcs{$_} } split(',', $parts{$prop})) ]; + } + else { + $meta->{cols}->{$col}->{$prop} = [ split(',', $parts{$prop}) ]; + } + } + else { + $meta->{cols}->{$col}->{$prop} = $parts{$prop}; + } + } + + } +} + +# save_config {{{3 +sub save_config { + return if $config{readonly}->{val}; + # Save to a temp file first, so a crash doesn't destroy the main config file + my $newname = $opts{c} || "$homepath/.innotop/innotop.ini"; + my $filename = $newname . '_tmp'; + open my $file, "+>", $filename + or die("Can't write to $filename: $OS_ERROR"); + print $file "version=$VERSION\n"; + + foreach my $section ( @ordered_config_file_sections ) { + die "No such config file section $section" unless $config_file_sections{$section}; + print $file "\n[$section]\n\n"; + $config_file_sections{$section}->{writer}->($file); + print $file "\n[/$section]\n"; + } + + # Now clobber the main config file with the temp. + close $file or die("Can't close $filename: $OS_ERROR"); + rename($filename, $newname) or die("Can't rename $filename to $newname: $OS_ERROR"); +} + +# load_config_connections {{{3 +sub load_config_connections { + my ( $file ) = @_; + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + my ( $key , $rest ) = $line =~ m/^(.*?)=(.*)$/; + next unless $key; + my %parts = $rest =~ m/(\S+?)=(\S*)/g; + my %conn = map { $_ => $parts{$_} || '' } @conn_parts; + $connections{$key} = \%conn; + } +} + +# save_config_connections {{{3 +sub save_config_connections { + my $file = shift; + foreach my $conn ( sort keys %connections ) { + my $href = $connections{$conn}; + my @keys = $href->{savepass} ? @conn_parts : grep { $_ ne 'pass' } @conn_parts; + print $file "$conn=", join(' ', map { "$_=$href->{$_}" } grep { defined $href->{$_} } @keys), "\n"; + } +} + +sub load_config_colors { + my ( $file ) = @_; + my %rule_set_for; + + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + my ( $tbl, $rule ) = $line =~ m/^(.*?)=(.*)$/; + next unless $tbl && $rule; + next unless exists $tbl_meta{$tbl}; + my %parts = $rule =~ m/(\w+)='((?:(?!(?<!\\)').)*)'/g; # Properties are single-quoted + next unless $parts{col} && exists $tbl_meta{$tbl}->{cols}->{$parts{col}}; + next unless $parts{op} && exists $comp_ops{$parts{op}}; + next unless defined $parts{arg}; + next unless defined $parts{color}; + my @colors = unique(grep { exists $ansicolors{$_} } split(/\W+/, $parts{color})); + next unless @colors; + + # Finally! Enough validation... + $rule_set_for{$tbl} ||= []; + push @{$rule_set_for{$tbl}}, \%parts; + } + + foreach my $tbl ( keys %rule_set_for ) { + $tbl_meta{$tbl}->{colors} = $rule_set_for{$tbl}; + $tbl_meta{$tbl}->{color_func} = make_color_func($tbl_meta{$tbl}); + $tbl_meta{$tbl}->{cust}->{colors} = 1; + } +} + +# save_config_colors {{{3 +sub save_config_colors { + my $file = shift; + foreach my $tbl ( sort keys %tbl_meta ) { + my $meta = $tbl_meta{$tbl}; + next unless $meta->{cust}->{colors}; + foreach my $rule ( @{$meta->{colors}} ) { + print $file "$tbl=", join( + ' ', + map { + my $val = $rule->{$_}; + $val =~ s/([\\'])/\\$1/g; # Escape backslashes and single quotes + "$_='$val'"; # Enclose in single quotes + } + qw(col op arg color) + ), "\n"; + } + } +} + +# load_config_active_connections {{{3 +sub load_config_active_connections { + my ( $file ) = @_; + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + my ( $key , $rest ) = $line =~ m/^(.*?)=(.*)$/; + next unless $key && exists $modes{$key}; + my @parts = grep { exists $connections{$_} } split(/ /, $rest); + $modes{$key}->{connections} = [ @parts ] if exists $modes{$key}; + } +} + +# save_config_active_connections {{{3 +sub save_config_active_connections { + my $file = shift; + foreach my $mode ( sort keys %modes ) { + my @connections = get_connections($mode); + print $file "$mode=", join(' ', @connections), "\n"; + } +} + +# load_config_stmt_sleep_times {{{3 +sub load_config_stmt_sleep_times { + my ( $file ) = @_; + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + my ( $key , $val ) = split('=', $line); + next unless $key && defined $val && $val =~ m/$num_regex/; + $stmt_sleep_time_for{$key} = $val; + } +} + +# save_config_stmt_sleep_times {{{3 +sub save_config_stmt_sleep_times { + my $file = shift; + foreach my $key ( sort keys %stmt_sleep_time_for ) { + print $file "$key=$stmt_sleep_time_for{$key}\n"; + } +} + +# load_config_mvs {{{3 +sub load_config_mvs { + my ( $file ) = @_; + while ( my $line = <$file> ) { + chomp $line; + next if $line =~ m/^#/; + last if $line =~ m/^\[/; + + my ( $key , $val ) = split('=', $line); + next unless $key && defined $val && $val =~ m/$num_regex/; + $mvs{$key} = $val; + } +} + +# save_config_mvs {{{3 +sub save_config_mvs { + my $file = shift; + foreach my $key ( sort keys %mvs ) { + print $file "$key=$mvs{$key}\n"; + } +} + +# edit_configuration {{{3 +sub edit_configuration { + my $key = ''; + while ( $key ne 'q' ) { + $clear_screen_sub->(); + my @display_lines = ''; + + if ( $key && $cfg_editor_action{$key} ) { + $cfg_editor_action{$key}->{func}->(); + } + + # Show help + push @display_lines, create_caption('What configuration do you want to edit?', + create_table2( + [ sort keys %cfg_editor_action ], + { map { $_ => $_ } keys %cfg_editor_action }, + { map { $_ => $cfg_editor_action{$_}->{note} } keys %cfg_editor_action }, + { sep => ' ' })); + + draw_screen(\@display_lines); + $key = pause(''); + } +} + +# edit_configuration_variables {{{3 +sub edit_configuration_variables { + $clear_screen_sub->(); + my $mode = $config{mode}->{val}; + + my %config_choices + = map { $_ => $config{$_}->{note} || '' } + # Only config values that are marked as applying to this mode. + grep { + my $key = $_; + $config{$key}->{conf} && + ( $config{$key}->{conf} eq 'ALL' + || grep { $mode eq $_ } @{$config{$key}->{conf}} ) + } keys %config; + + my $key = prompt_list( + "Enter the name of the variable you wish to configure", + '', + sub{ return keys %config_choices }, + \%config_choices); + + if ( exists($config_choices{$key}) ) { + get_config_interactive($key); + } +} + +# edit_color_rules {{{3 +sub edit_color_rules { + my ( $tbl ) = @_; + $clear_screen_sub->(); + $tbl ||= choose_visible_table(); + if ( $tbl && exists($tbl_meta{$tbl}) ) { + my $meta = $tbl_meta{$tbl}; + my @cols = ('', qw(col op arg color)); + my $info = { map { $_ => { hdr => $_, just => '-', } } @cols }; + $info->{label}->{maxw} = 30; + my $key; + my $selected_rule; + + # This loop builds a tabular view of the rules. + do { + + # Show help + if ( $key && $key eq '?' ) { + my @display_lines = ''; + push @display_lines, create_caption('Editor key mappings', + create_table2( + [ sort keys %color_editor_action ], + { map { $_ => $_ } keys %color_editor_action }, + { map { $_ => $color_editor_action{$_}->{note} } keys %color_editor_action }, + { sep => ' ' })); + draw_screen(\@display_lines); + pause(); + $key = ''; + } + else { + + # Do the action specified + $selected_rule ||= 0; + if ( $key && $color_editor_action{$key} ) { + $selected_rule = $color_editor_action{$key}->{func}->($tbl, $selected_rule); + $selected_rule ||= 0; + } + + # Build the table of rules. If the terminal has color, the selected rule + # will be highlighted; otherwise a > at the left will indicate. + my $data = $meta->{colors} || []; + foreach my $i ( 0..@$data - 1 ) { + $data->[$i]->{''} = $i == $selected_rule ? '>' : ''; + } + my @display_lines = create_table(\@cols, $info, $data); + + # Highlight selected entry + for my $i ( 0 .. $#display_lines ) { + if ( $display_lines[$i] =~ m/^>/ ) { + $display_lines[$i] = [ $display_lines[$i], 'reverse' ]; + } + } + + # Draw the screen and wait for a command. + unshift @display_lines, '', + "Editing color rules for $meta->{capt}. Press ? for help, q to " + . "quit.", ''; + draw_screen(\@display_lines); + print "\n\n", word_wrap('Rules are applied in order from top to ' + . 'bottom. The first matching rule wins and prevents the ' + . 'rest of the rules from being applied.'); + $key = pause(''); + } + } while ( $key ne 'q' ); + $meta->{color_func} = make_color_func($meta); + } +} + +# add_quick_filter {{{3 +sub add_quick_filter { + my $tbl = choose_visible_table(); + if ( $tbl && exists($tbl_meta{$tbl}) ) { + print "\n"; + my $response = prompt_list( + "Enter column name and filter text", + '', + sub { return keys %{$tbl_meta{$tbl}->{cols}} }, + () + ); + my ( $col, $text ) = split(/\s+/, $response, 2); + + # You can't filter on a nonexistent column. But if you filter on a pivoted + # table, the columns are different, so on a pivoted table, allow filtering + # on the 'name' column. + # NOTE: if a table is pivoted and un-pivoted, this will likely cause crashes. + # Currently not an issue since there's no way to toggle pivot/nopivot. + return unless $col && $text && + (exists($tbl_meta{$tbl}->{cols}->{$col}) + || ($tbl_meta{$tbl}->{pivot} && $col eq 'name')); + + my ( $sub, $err ) = compile_filter( "defined \$set->{$col} && \$set->{$col} =~ m/$text/" ); + return if !$sub || $err; + my $name = "quick_$tbl.$col"; + $filters{$name} = { + func => $sub, + text => $text, + user => 1, + quick => 1, + name => $name, + note => 'Quick-filter', + tbls => [$tbl], + }; + push @{$tbl_meta{$tbl}->{filters}}, $name; + } +} + +# clear_quick_filters {{{3 +sub clear_quick_filters { + my $tbl = choose_visible_table( + # Only tables that have quick-filters + sub { + my ( $tbl ) = @_; + return scalar grep { $filters{$_}->{quick} } @{ $tbl_meta{$tbl}->{filters} }; + } + ); + if ( $tbl && exists($tbl_meta{$tbl}) ) { + my @current = @{$tbl_meta{$tbl}->{filters}}; + @current = grep { !$filters{$_}->{quick} } @current; + $tbl_meta{$tbl}->{filters} = \@current; + } +} + +sub edit_plugins { + $clear_screen_sub->(); + + my @cols = ('', qw(class desc active)); + my $info = { map { $_ => { hdr => $_, just => '-', } } @cols }; + my @rows = map { $plugins{$_} } sort keys %plugins; + my $key; + my $selected; + + # This loop builds a tabular view of the plugins. + do { + + # Show help + if ( $key && $key eq '?' ) { + my @display_lines = ''; + push @display_lines, create_caption('Editor key mappings', + create_table2( + [ sort keys %plugin_editor_action ], + { map { $_ => $_ } keys %plugin_editor_action }, + { map { $_ => $plugin_editor_action{$_}->{note} } keys %plugin_editor_action }, + { sep => ' ' })); + draw_screen(\@display_lines); + pause(); + $key = ''; + } + + # Do the action specified + else { + $selected ||= 0; + if ( $key && $plugin_editor_action{$key} ) { + $selected = $plugin_editor_action{$key}->{func}->(\@rows, $selected); + $selected ||= 0; + } + + # Build the table of plugins. + foreach my $row ( 0.. $#rows ) { + $rows[$row]->{''} = $row eq $selected ? '>' : ' '; + } + my @display_lines = create_table(\@cols, $info, \@rows); + + # Highlight selected entry + for my $i ( 0 .. $#display_lines ) { + if ( $display_lines[$i] =~ m/^>/ ) { + $display_lines[$i] = [ $display_lines[$i], 'reverse' ]; + } + } + + # Draw the screen and wait for a command. + unshift @display_lines, '', + "Plugin Management. Press ? for help, q to quit.", ''; + draw_screen(\@display_lines); + $key = pause(''); + } + } while ( $key ne 'q' ); +} + +# edit_table {{{3 +sub edit_table { + $clear_screen_sub->(); + my ( $tbl ) = @_; + $tbl ||= choose_visible_table(); + if ( $tbl && exists($tbl_meta{$tbl}) ) { + my $meta = $tbl_meta{$tbl}; + my @cols = ('', qw(name hdr label src)); + my $info = { map { $_ => { hdr => $_, just => '-', } } @cols }; + $info->{label}->{maxw} = 30; + my $key; + my $selected_column; + + # This loop builds a tabular view of the tbl_meta's structure, showing each column + # in the entry as a row. + do { + + # Show help + if ( $key && $key eq '?' ) { + my @display_lines = ''; + push @display_lines, create_caption('Editor key mappings', + create_table2( + [ sort keys %tbl_editor_action ], + { map { $_ => $_ } keys %tbl_editor_action }, + { map { $_ => $tbl_editor_action{$_}->{note} } keys %tbl_editor_action }, + { sep => ' ' })); + draw_screen(\@display_lines); + pause(); + $key = ''; + } + else { + + # Do the action specified + $selected_column ||= $meta->{visible}->[0]; + if ( $key && $tbl_editor_action{$key} ) { + $selected_column = $tbl_editor_action{$key}->{func}->($tbl, $selected_column); + $selected_column ||= $meta->{visible}->[0]; + } + + # Build the pivoted view of the table's meta-data. If the terminal has color, + # The selected row will be highlighted; otherwise a > at the left will indicate. + my $data = []; + foreach my $row ( @{$meta->{visible}} ) { + my %hash; + @hash{ @cols } = @{$meta->{cols}->{$row}}{@cols}; + $hash{src} = '' if ref $hash{src}; + $hash{name} = $row; + $hash{''} = $row eq $selected_column ? '>' : ' '; + push @$data, \%hash; + } + my @display_lines = create_table(\@cols, $info, $data); + + # Highlight selected entry + for my $i ( 0 .. $#display_lines ) { + if ( $display_lines[$i] =~ m/^>/ ) { + $display_lines[$i] = [ $display_lines[$i], 'reverse' ]; + } + } + + # Draw the screen and wait for a command. + unshift @display_lines, '', + "Editing table definition for $meta->{capt}. Press ? for help, q to quit.", ''; + draw_screen(\@display_lines, { clear => 1 }); + $key = pause(''); + } + } while ( $key ne 'q' ); + } +} + +# choose_mode_tables {{{3 +# Choose which table(s), and in what order, to display in a given mode. +sub choose_mode_tables { + my $mode = $config{mode}->{val}; + my @tbls = @{$modes{$mode}->{visible_tables}}; + my $new = prompt_list( + "Choose tables to display", + join(' ', @tbls), + sub { return @{$modes{$mode}->{tables}} }, + { map { $_ => $tbl_meta{$_}->{capt} } @{$modes{$mode}->{tables}} } + ); + $modes{$mode}->{visible_tables} = + [ unique(grep { $_ && exists $tbl_meta{$_} } split(/\s+/, $new)) ]; + $modes{$mode}->{cust}->{visible_tables} = 1; +} + +# choose_visible_table {{{3 +sub choose_visible_table { + my ( $grep_cond ) = @_; + my $mode = $config{mode}->{val}; + my @tbls + = grep { $grep_cond ? $grep_cond->($_) : 1 } + @{$modes{$mode}->{visible_tables}}; + my $tbl = $tbls[0]; + if ( @tbls > 1 ) { + $tbl = prompt_list( + "Choose a table", + '', + sub { return @tbls }, + { map { $_ => $tbl_meta{$_}->{capt} } @tbls } + ); + } + return $tbl; +} + +sub toggle_aggregate { + my ( $tbl ) = @_; + $tbl ||= choose_visible_table(); + return unless $tbl && exists $tbl_meta{$tbl}; + my $meta = $tbl_meta{$tbl}; + $meta->{aggregate} ^= 1; +} + +sub choose_filters { + my ( $tbl ) = @_; + $tbl ||= choose_visible_table(); + return unless $tbl && exists $tbl_meta{$tbl}; + my $meta = $tbl_meta{$tbl}; + $clear_screen_sub->(); + + print "Choose filters for $meta->{capt}:\n"; + + my $ini = join(' ', @{$meta->{filters}}); + my $val = prompt_list( + 'Choose filters', + $ini, + sub { return keys %filters }, + { + map { $_ => $filters{$_}->{note} } + grep { grep { $tbl eq $_ } @{$filters{$_}->{tbls}} } + keys %filters + } + ); + + my @choices = unique(split(/\s+/, $val)); + foreach my $new ( grep { !exists($filters{$_}) } @choices ) { + my $answer = prompt("There is no filter called '$new'. Create it?", undef, 'y'); + if ( $answer eq 'y' ) { + create_new_filter($new, $tbl); + } + } + @choices = grep { exists $filters{$_} } @choices; + @choices = grep { grep { $tbl eq $_ } @{$filters{$_}->{tbls}} } @choices; + $meta->{filters} = [ @choices ]; + $meta->{cust}->{filters} = 1; +} + +sub choose_group_cols { + my ( $tbl ) = @_; + $tbl ||= choose_visible_table(); + return unless $tbl && exists $tbl_meta{$tbl}; + $clear_screen_sub->(); + my $meta = $tbl_meta{$tbl}; + my $curr = join(', ', @{$meta->{group_by}}); + my $val = prompt_list( + 'Group-by columns', + $curr, + sub { return keys %{$meta->{cols}} }, + { map { $_ => $meta->{cols}->{$_}->{label} } keys %{$meta->{cols}} }); + if ( $curr ne $val ) { + $meta->{group_by} = [ grep { exists $meta->{cols}->{$_} } $val =~ m/(\w+)/g ]; + $meta->{cust}->{group_by} = 1; + } +} + +sub choose_sort_cols { + my ( $tbl ) = @_; + $tbl ||= choose_visible_table(); + return unless $tbl && exists $tbl_meta{$tbl}; + $clear_screen_sub->(); + my $meta = $tbl_meta{$tbl}; + + my ( $cols, $hints ); + if ( $meta->{pivot} ) { + $cols = sub { qw(name set_0) }; + $hints = { name => 'name', set_0 => 'set_0' }; + } + else { + $cols = sub { return keys %{$meta->{cols}} }; + $hints = { map { $_ => $meta->{cols}->{$_}->{label} } keys %{$meta->{cols}} }; + } + + my $val = prompt_list( + 'Sort columns (reverse sort with -col)', + $meta->{sort_cols}, + $cols, + $hints ); + if ( $meta->{sort_cols} ne $val ) { + $meta->{sort_cols} = $val; + $meta->{cust}->{sort_cols} = 1; + $tbl_meta{$tbl}->{sort_func} = make_sort_func($tbl_meta{$tbl}); + } +} + +# create_new_filter {{{3 +sub create_new_filter { + my ( $filter, $tbl ) = @_; + $clear_screen_sub->(); + + if ( !$filter || $filter =~ m/\W/ ) { + print word_wrap("Choose a name for the filter. This name is not displayed, and is only used " + . "for internal reference. It can only contain lowercase letters, numbers, and underscores."); + print "\n\n"; + do { + $filter = prompt("Enter filter name"); + } while ( !$filter || $filter =~ m/\W/ ); + } + + my $completion = sub { keys %{$tbl_meta{$tbl}->{cols}} }; + my ( $err, $sub, $body ); + do { + $clear_screen_sub->(); + print word_wrap("A filter is a Perl subroutine that accepts a hashref of columns " + . "called \$set, and returns a true value if the filter accepts the row. Example:\n" + . " \$set->{active_secs} > 5\n" + . "will only allow rows if their active_secs column is greater than 5."); + print "\n\n"; + if ( $err ) { + print "There's an error in your filter expression: $err\n\n"; + } + $body = prompt("Enter subroutine body", undef, undef, $completion); + ( $sub, $err ) = compile_filter($body); + } while ( $err ); + + $filters{$filter} = { + func => $sub, + text => $body, + user => 1, + name => $filter, + note => 'User-defined filter', + tbls => [$tbl], + }; +} + +# get_config_interactive {{{3 +sub get_config_interactive { + my $key = shift; + $clear_screen_sub->(); + + # Print help first. + print "Enter a new value for '$key' ($config{$key}->{note}).\n"; + + my $current = ref($config{$key}->{val}) ? join(" ", @{$config{$key}->{val}}) : $config{$key}->{val}; + + my $new_value = prompt('Enter a value', $config{$key}->{pat}, $current); + $config{$key}->{val} = $new_value; +} + +sub edit_current_var_set { + my $mode = $config{mode}->{val}; + my $name = $config{"${mode}_set"}->{val}; + my $variables = $var_sets{$name}->{text}; + + my $new = $variables; + do { + $clear_screen_sub->(); + $new = prompt("Enter variables for $name", undef, $variables); + } until ( $new ); + + if ( $new ne $variables ) { + @{$var_sets{$name}}{qw(text user)} = ( $new, 1); + } +} + + +sub choose_var_set { + my ( $key ) = @_; + $clear_screen_sub->(); + + my $new_value = prompt_list( + 'Choose a set of values to display, or enter the name of a new one', + $config{$key}->{val}, + sub { return keys %var_sets }, + { map { $_ => $var_sets{$_}->{text} } keys %var_sets }); + + if ( !exists $var_sets{$new_value} ) { + add_new_var_set($new_value); + } + + $config{$key}->{val} = $new_value if exists $var_sets{$new_value}; +} + +sub switch_var_set { + my ( $cfg_var, $dir ) = @_; + my @var_sets = sort keys %var_sets; + my $cur = $config{$cfg_var}->{val}; + my $pos = grep { $_ lt $cur } @var_sets; + my $newpos = ($pos + $dir) % @var_sets; + $config{$cfg_var}->{val} = $var_sets[$newpos]; + $clear_screen_sub->(); +} + +# Online configuration and prompting functions {{{2 + +# edit_stmt_sleep_times {{{3 +sub edit_stmt_sleep_times { + $clear_screen_sub->(); + my $stmt = prompt_list('Specify a statement', '', sub { return sort keys %stmt_maker_for }); + return unless $stmt && exists $stmt_maker_for{$stmt}; + $clear_screen_sub->(); + my $curr_val = $stmt_sleep_time_for{$stmt} || 0; + my $new_val = prompt('Specify a sleep delay after calling this SQL', $num_regex, $curr_val); + if ( $new_val ) { + $stmt_sleep_time_for{$stmt} = $new_val; + } + else { + delete $stmt_sleep_time_for{$stmt}; + } +} + +# edit_server_groups {{{3 +# Choose which server connections are in a server group. First choose a group, +# then choose which connections are in it. +sub edit_server_groups { + $clear_screen_sub->(); + my $mode = $config{mode}->{val}; + my $group = $modes{$mode}->{server_group}; + my %curr = %server_groups; + my $new = choose_or_create_server_group($group, 'to edit'); + $clear_screen_sub->(); + if ( exists $curr{$new} ) { + # Don't do this step if the user just created a new server group, + # because part of that process was to choose connections. + my $cxns = join(' ', @{$server_groups{$new}}); + my @conns = choose_or_create_connection($cxns, 'for this group'); + $server_groups{$new} = \@conns; + } +} + +# choose_server_groups {{{3 +sub choose_server_groups { + $clear_screen_sub->(); + my $mode = $config{mode}->{val}; + my $group = $modes{$mode}->{server_group}; + my $new = choose_or_create_server_group($group, 'for this mode'); + $modes{$mode}->{server_group} = $new if exists $server_groups{$new}; +} + +sub choose_or_create_server_group { + my ( $group, $prompt ) = @_; + my $new = ''; + + my @available = sort keys %server_groups; + + if ( @available ) { + print "You can enter the name of a new group to create it.\n"; + + $new = prompt_list( + "Choose a server group $prompt", + $group, + sub { return @available }, + { map { $_ => join(' ', @{$server_groups{$_}}) } @available }); + + $new =~ s/\s.*//; + + if ( !exists $server_groups{$new} ) { + my $answer = prompt("There is no server group called '$new'. Create it?", undef, "y"); + if ( $answer eq 'y' ) { + add_new_server_group($new); + } + } + } + else { + $new = add_new_server_group(); + } + return $new; +} + +sub choose_or_create_connection { + my ( $cxns, $prompt ) = @_; + print "You can enter the name of a new connection to create it.\n"; + + my @available = sort keys %connections; + my $new_cxns = prompt_list( + "Choose connections $prompt", + $cxns, + sub { return @available }, + { map { $_ => $connections{$_}->{dsn} } @available }); + + my @new = unique(grep { !exists $connections{$_} } split(/\s+/, $new_cxns)); + foreach my $new ( @new ) { + my $answer = prompt("There is no connection called '$new'. Create it?", undef, "y"); + if ( $answer eq 'y' ) { + add_new_dsn($new); + } + } + + return unique(grep { exists $connections{$_} } split(/\s+/, $new_cxns)); +} + +# choose_servers {{{3 +sub choose_servers { + $clear_screen_sub->(); + my $mode = $config{mode}->{val}; + my $cxns = join(' ', get_connections()); + my @chosen = choose_or_create_connection($cxns, 'for this mode'); + $modes{$mode}->{connections} = \@chosen; + $modes{$mode}->{server_group} = ''; # Clear this because it overrides {connections} +} + +# display_license {{{3 +sub display_license { + $clear_screen_sub->(); + + print $innotop_license; + + pause(); +} + +# Data-retrieval functions {{{2 +# get_status_info {{{3 +# Get SHOW STATUS and SHOW VARIABLES together. +sub get_status_info { + my @cxns = @_; + if ( !$info_gotten{status}++ ) { + foreach my $cxn ( @cxns ) { + $vars{$cxn}->{$clock} ||= {}; + my $vars = $vars{$cxn}->{$clock}; + + my $sth = do_stmt($cxn, 'SHOW_STATUS') or next; + my $res = $sth->fetchall_arrayref(); + map { $vars->{$_->[0]} = $_->[1] || 0 } @$res; + + # Calculate hi-res uptime and add cxn to the hash. This duplicates get_driver_status, + # but it's most important to have consistency. + $vars->{Uptime_hires} ||= get_uptime($cxn); + $vars->{cxn} = $cxn; + + # Add SHOW VARIABLES to the hash + $sth = do_stmt($cxn, 'SHOW_VARIABLES') or next; + $res = $sth->fetchall_arrayref(); + map { $vars->{$_->[0]} = $_->[1] || 0 } @$res; + } + } +} + +# Chooses a thread for explaining, killing, etc... +# First arg is a func that can be called in grep. +sub choose_thread { + my ( $grep_cond, $prompt ) = @_; + + # Narrow the list to queries that can be explained. + my %thread_for = map { + # Eliminate innotop's own threads. + $_ => $dbhs{$_}->{dbh} ? $dbhs{$_}->{dbh}->{mysql_thread_id} : 0 + } keys %connections; + + my @candidates = grep { + $_->{id} != $thread_for{$_->{cxn}} && $grep_cond->($_) + } @current_queries; + return unless @candidates; + + # Find out which server. + my @cxns = unique map { $_->{cxn} } @candidates; + my ( $cxn ) = select_cxn('On which server', @cxns); + return unless $cxn && exists($connections{$cxn}); + + # Re-filter the list of candidates to only those on this server + @candidates = grep { $_->{cxn} eq $cxn } @candidates; + + # Find out which thread to do. + my $info; + if ( @candidates > 1 ) { + + # Sort longest-active first, then longest-idle. + my $sort_func = sub { + my ( $a, $b ) = @_; + return $a->{query} && !$b->{query} ? 1 + : $b->{query} && !$a->{query} ? -1 + : ($a->{time} || 0) <=> ($b->{time} || 0); + }; + my @threads = map { $_->{id} } reverse sort { $sort_func->($a, $b) } @candidates; + + print "\n"; + my $thread = prompt_list($prompt, + $threads[0], + sub { return @threads }); + return unless $thread && $thread =~ m/$int_regex/; + + # Find the info hash of that query on that server. + ( $info ) = grep { $thread == $_->{id} } @candidates; + } + else { + $info = $candidates[0]; + } + return $info; +} + +# analyze_query {{{3 +# Allows the user to show fulltext, explain, show optimized... +sub analyze_query { + my ( $action ) = @_; + + my $info = choose_thread( + sub { $_[0]->{query} }, + 'Select a thread to analyze', + ); + return unless $info; + + my %actions = ( + e => \&display_explain, + f => \&show_full_query, + o => \&show_optimized_query, + ); + do { + $actions{$action}->($info); + print "\n"; + $action = pause('Press e to explain, f for full query, o for optimized query'); + } while ( exists($actions{$action}) ); +} + +# inc {{{3 +# Returns the difference between two sets of variables/status/innodb stuff. +sub inc { + my ( $offset, $cxn ) = @_; + my $vars = $vars{$cxn}; + if ( $offset < 0 ) { + return $vars->{$clock}; + } + elsif ( exists $vars{$clock - $offset} && !exists $vars->{$clock - $offset - 1} ) { + return $vars->{$clock - $offset}; + } + my $cur = $vars->{$clock - $offset}; + my $pre = $vars->{$clock - $offset - 1}; + return { + # Numeric variables get subtracted, non-numeric get passed straight through. + map { + $_ => + ( (defined $cur->{$_} && $cur->{$_} =~ m/$num_regex/) + ? $cur->{$_} - ($pre->{$_} || 0) + : $cur->{$_} ) + } keys %{$cur} + }; +} + +# extract_values {{{3 +# Arguments are a set of values (which may be incremental, derived from +# current and previous), current, and previous values. +# TODO: there are a few places that don't remember prev set so can't pass it. +sub extract_values { + my ( $set, $cur, $pre, $tbl ) = @_; + + # Hook in event listeners + foreach my $listener ( @{$event_listener_for{extract_values}} ) { + $listener->extract_values($set, $cur, $pre, $tbl); + } + + my $result = {}; + my $meta = $tbl_meta{$tbl}; + my $cols = $meta->{cols}; + foreach my $key ( keys %$cols ) { + my $info = $cols->{$key} + or die "Column '$key' doesn't exist in $tbl"; + die "No func defined for '$key' in $tbl" + unless $info->{func}; + eval { + $result->{$key} = $info->{func}->($set, $cur, $pre) + }; + if ( $EVAL_ERROR ) { + if ( $config{debug}->{val} ) { + die $EVAL_ERROR; + } + $result->{$key} = $info->{num} ? 0 : ''; + } + } + return $result; +} + +# get_full_processlist {{{3 +sub get_full_processlist { + my @cxns = @_; + my @result; + foreach my $cxn ( @cxns ) { + my $stmt = do_stmt($cxn, 'PROCESSLIST') or next; + my $arr = $stmt->fetchall_arrayref({}); + push @result, map { $_->{cxn} = $cxn; $_ } @$arr; + } + return @result; +} + +# get_open_tables {{{3 +sub get_open_tables { + my @cxns = @_; + my @result; + foreach my $cxn ( @cxns ) { + my $stmt = do_stmt($cxn, 'OPEN_TABLES') or next; + my $arr = $stmt->fetchall_arrayref({}); + push @result, map { $_->{cxn} = $cxn; $_ } @$arr; + } + return @result; +} + +# get_innodb_status {{{3 +sub get_innodb_status { + my ( $cxns, $addl_sections ) = @_; + if ( !$config{skip_innodb}->{val} && !$info_gotten{innodb_status}++ ) { + + # Determine which sections need to be parsed + my %sections_required = + map { $tbl_meta{$_}->{innodb} => 1 } + grep { $_ && $tbl_meta{$_}->{innodb} } + get_visible_tables(); + + # Add in any other sections the caller requested. + foreach my $sec ( @$addl_sections ) { + $sections_required{$sec} = 1; + } + + foreach my $cxn ( @$cxns ) { + my $innodb_status_text; + + if ( $file ) { # Try to fetch status text from the file. + my @stat = stat($file); + + # Initialize the file. + if ( !$file_mtime ) { + # Initialize to 130k from the end of the file (because the limit + # on the size of innodb status is 128k even with Google's patches) + # and try to grab the last status from the file. + sysseek($file, (-128 * 1_024), 2); + } + + # Read from the file. + my $buffer; + if ( !$file_mtime || $file_mtime != $stat[9] ) { + $file_data = ''; + while ( sysread($file, $buffer, 4096) ) { + $file_data .= $buffer; + } + $file_mtime = $stat[9]; + } + + # Delete everything but the last InnoDB status text from the file. + $file_data =~ s/\A.*(?=^=====================================\n...... ........ INNODB MONITOR OUTPUT)//ms; + $innodb_status_text = $file_data; + } + + else { + my $stmt = do_stmt($cxn, 'INNODB_STATUS') or next; + $innodb_status_text = $stmt->fetchrow_hashref()->{status}; + } + + next unless $innodb_status_text + && substr($innodb_status_text, 0, 100) =~ m/INNODB MONITOR OUTPUT/; + + # Parse and merge into %vars storage + my %innodb_status = ( + $innodb_parser->get_status_hash( + $innodb_status_text, + $config{debug}->{val}, + \%sections_required, + 0, # don't parse full lock information + ) + ); + if ( !$innodb_status{IB_got_all} && $config{auto_wipe_dl}->{val} ) { + clear_deadlock($cxn); + } + + # Merge using a hash slice, which is the fastest way + $vars{$cxn}->{$clock} ||= {}; + my $hash = $vars{$cxn}->{$clock}; + @{$hash}{ keys %innodb_status } = values %innodb_status; + $hash->{cxn} = $cxn; + $hash->{Uptime_hires} ||= get_uptime($cxn); + } + } +} + +# clear_deadlock {{{3 +sub clear_deadlock { + my ( $cxn ) = @_; + return if $clearing_deadlocks++; + my $tbl = $connections{$cxn}->{dl_table}; + return unless $tbl; + + eval { + # Set up the table for creating a deadlock. + my $engine = version_ge($dbhs{$cxn}->{dbh}, '4.1.2') ? 'engine' : 'type'; + return unless do_query($cxn, "drop table if exists $tbl"); + return unless do_query($cxn, "create table $tbl(a int) $engine=innodb"); + return unless do_query($cxn, "delete from $tbl"); + return unless do_query($cxn, "insert into $tbl(a) values(0), (1)"); + return unless do_query($cxn, "commit"); # Or the children will block against the parent + + # Fork off two children to deadlock against each other. + my %children; + foreach my $child ( 0..1 ) { + my $pid = fork(); + if ( defined($pid) && $pid == 0 ) { # I am a child + deadlock_thread( $child, $tbl, $cxn ); + } + elsif ( !defined($pid) ) { + die("Unable to fork for clearing deadlocks!\n"); + } + # I already exited if I'm a child, so I'm the parent. + $children{$child} = $pid; + } + + # Wait for the children to exit. + foreach my $child ( keys %children ) { + my $pid = waitpid($children{$child}, 0); + } + + # Clean up. + do_query($cxn, "drop table $tbl"); + }; + if ( $EVAL_ERROR ) { + print $EVAL_ERROR; + pause(); + } + + $clearing_deadlocks = 0; +} + +sub get_master_logs { + my @cxns = @_; + my @result; + if ( !$info_gotten{master_logs}++ ) { + foreach my $cxn ( @cxns ) { + my $stmt = do_stmt($cxn, 'SHOW_MASTER_LOGS') or next; + push @result, @{$stmt->fetchall_arrayref({})}; + } + } + return @result; +} + +# get_master_slave_status {{{3 +sub get_master_slave_status { + my @cxns = @_; + if ( !$info_gotten{replication_status}++ ) { + foreach my $cxn ( @cxns ) { + $vars{$cxn}->{$clock} ||= {}; + my $vars = $vars{$cxn}->{$clock}; + $vars->{cxn} = $cxn; + + my $stmt = do_stmt($cxn, 'SHOW_MASTER_STATUS') or next; + my $res = $stmt->fetchall_arrayref({})->[0]; + @{$vars}{ keys %$res } = values %$res; + $stmt = do_stmt($cxn, 'SHOW_SLAVE_STATUS') or next; + $res = $stmt->fetchall_arrayref({})->[0]; + @{$vars}{ keys %$res } = values %$res; + $vars->{Uptime_hires} ||= get_uptime($cxn); + } + } +} + +sub is_func { + my ( $word ) = @_; + return defined(&$word) + || eval "my \$x= sub { $word }; 1" + || $EVAL_ERROR !~ m/^Bareword/; +} + +# Documentation {{{1 +# ############################################################################ +# I put this last as per the Dog book. +# ############################################################################ +=pod + +=head1 NAME + +innotop - MySQL and InnoDB transaction/status monitor. + +=head1 SYNOPSIS + +To monitor servers normally: + + innotop + +To monitor InnoDB status information from a file: + + innotop /var/log/mysql/mysqld.err + +To run innotop non-interactively in a pipe-and-filter configuration: + + innotop --count 5 -d 1 -n + +=head1 DESCRIPTION + +innotop monitors MySQL servers. Each of its modes shows you a different aspect +of what's happening in the server. For example, there's a mode for monitoring +replication, one for queries, and one for transactions. innotop refreshes its +data periodically, so you see an updating view. + +innotop has lots of features for power users, but you can start and run it with +virtually no configuration. If you're just getting started, see +L<"QUICK-START">. Press '?' at any time while running innotop for +context-sensitive help. + +=head1 QUICK-START + +To start innotop, open a terminal or command prompt. If you have installed +innotop on your system, you should be able to just type "innotop" and press +Enter; otherwise, you will need to change to innotop's directory and type "perl +innotop". + +The first thing innotop needs to know is how to connect to a MySQL server. You +can just enter the hostname of the server, for example "localhost" or +"127.0.0.1" if the server is on the same machine as innotop. After this innotop +will prompt you for a DSN (data source name). You should be able to just accept +the defaults by pressing Enter. + +When innotop asks you about a table to use when resetting InnoDB deadlock +information, just accept the default for now. This is an advanced feature you +can configure later (see L<"D: InnoDB Deadlocks"> for more). + +If you have a .my.cnf file with your MySQL connection defaults, innotop can read +it, and you won't need to specify a username and password if it's in that file. +Otherwise, you should answer 'y' to the next couple of prompts. + +After this, you should be connected, and innotop should show you something like +the following: + + InnoDB Txns (? for help) localhost, 01:11:19, InnoDB 10s :-), 50 QPS, + + CXN History Versions Undo Dirty Buf Used Bufs Txns MaxTxn + localhost 7 2035 0 0 0.00% 92.19% 1 07:34 + + CXN ID User Host Txn Status Time Undo Query Tex + localhost 98379 user1 webserver ACTIVE 07:34 0 SELECT `c + localhost 98450 user1 webserver ACTIVE 01:06 0 INSERT IN + localhost 97750 user1 webserver not starte 00:00 0 + localhost 98375 user1 appserver not starte 00:00 0 + +(This sample is truncated at the right so it will fit on a terminal when running +'man innotop') + +This sample comes from a quiet server with few transactions active. If your +server is busy, you'll see more output. Notice the first line on the screen, +which tells you what mode you're in and what server you're connected to. You +can change to other modes with keystrokes; press 'Q' to switch to a list of +currently running queries. + +Press the '?' key to see what keys are active in the current mode. You can +press any of these keys and innotop will either take the requested action or +prompt you for more input. If your system has Term::ReadLine support, you can +use TAB and other keys to auto-complete and edit input. + +To quit innotop, press the 'q' key. + +=head1 OPTIONS + +innotop is mostly configured via its configuration file, but some of the +configuration options can come from the command line. You can also specify a +file to monitor for InnoDB status output; see L<"MONITORING A FILE"> for more +details. + +You can negate some options by prefixing the option name with --no. For +example, --noinc (or --no-inc) negates L<"--inc">. + +=over + +=item --help + +Print a summary of command-line usage and exit. + +=item --color + +Enable or disable terminal coloring. Corresponds to the L<"color"> config file +setting. + +=item --config + +Specifies a configuration file to read. This option is non-sticky, that is to +say it does not persist to the configuration file itself. + +=item --nonint + +Enable non-interactive operation. See L<"NON-INTERACTIVE OPERATION"> for more. + +=item --count + +Refresh only the specified number of times (ticks) before exiting. Each refresh +is a pause for L<"interval"> seconds, followed by requesting data from MySQL +connections and printing it to the terminal. + +=item --delay + +Specifies the amount of time to pause between ticks (refreshes). Corresponds to +the configuration option L<"interval">. + +=item --mode + +Specifies the mode in which innotop should start. Corresponds to the +configuration option L<"mode">. + +=item --inc + +Specifies whether innotop should display absolute numbers or relative numbers +(offsets from their previous values). Corresponds to the configuration option +L<"status_inc">. + +=item --version + +Output version information and exit. + +=back + +=head1 HOTKEYS + +innotop is interactive, and you control it with key-presses. + +=over + +=item * + +Uppercase keys switch between modes. + +=item * + +Lowercase keys initiate some action within the current mode. + +=item * + +Other keys do something special like change configuration or show the +innotop license. + +=back + +Press '?' at any time to see the currently active keys and what they do. + +=head1 MODES + +Each of innotop's modes retrieves and displays a particular type of data from +the servers you're monitoring. You switch between modes with uppercase keys. +The following is a brief description of each mode, in alphabetical order. To +switch to the mode, press the key listed in front of its heading in the +following list: + +=over + +=item B: InnoDB Buffers + +This mode displays information about the InnoDB buffer pool, page statistics, +insert buffer, and adaptive hash index. The data comes from SHOW INNODB STATUS. + +This mode contains the L<"buffer_pool">, L<"page_statistics">, +L<"insert_buffers">, and L<"adaptive_hash_index"> tables by default. + +=item C: Command Summary + +This mode is similar to mytop's Command Summary mode. It shows the +L<"cmd_summary"> table, which looks something like the following: + + Command Summary (? for help) localhost, 25+07:16:43, 2.45 QPS, 3 thd, 5.0.40 + _____________________ Command Summary _____________________ + Name Value Pct Last Incr Pct + Select_scan 3244858 69.89% 2 100.00% + Select_range 1354177 29.17% 0 0.00% + Select_full_join 39479 0.85% 0 0.00% + Select_full_range_join 4097 0.09% 0 0.00% + Select_range_check 0 0.00% 0 0.00% + +The command summary table is built by extracting variables from +L<"STATUS_VARIABLES">. The variables must be numeric and must match the prefix +given by the L<"cmd_filter"> configuration variable. The variables are then +sorted by value descending and compared to the last variable, as shown above. +The percentage columns are percentage of the total of all variables in the +table, so you can see the relative weight of the variables. + +The example shows what you see if the prefix is "Select_". The default +prefix is "Com_". You can choose a prefix with the 's' key. + +It's rather like running SHOW VARIABLES LIKE "prefix%" with memory and +nice formatting. + +Values are aggregated across all servers. The Pct columns are not correctly +aggregated across multiple servers. This is a known limitation of the grouping +algorithm that may be fixed in the future. + +=item D: InnoDB Deadlocks + +This mode shows the transactions involved in the last InnoDB deadlock. A second +table shows the locks each transaction held and waited for. A deadlock is +caused by a cycle in the waits-for graph, so there should be two locks held and +one waited for unless the deadlock information is truncated. + +InnoDB puts deadlock information before some other information in the SHOW +INNODB STATUS output. If there are a lot of locks, the deadlock information can +grow very large, and there is a limit on the size of the SHOW INNODB +STATUS output. A large deadlock can fill the entire output, or even be +truncated, and prevent you from seeing other information at all. If you are +running innotop in another mode, for example T mode, and suddenly you don't see +anything, you might want to check and see if a deadlock has wiped out the data +you need. + +If it has, you can create a small deadlock to replace the large one. Use the +'w' key to 'wipe' the large deadlock with a small one. This will not work +unless you have defined a deadlock table for the connection (see L<"SERVER +CONNECTIONS">). + +You can also configure innotop to automatically detect when a large deadlock +needs to be replaced with a small one (see L<"auto_wipe_dl">). + +This mode displays the L<"deadlock_transactions"> and L<"deadlock_locks"> tables +by default. + +=item F: InnoDB Foreign Key Errors + +This mode shows the last InnoDB foreign key error information, such as the +table where it happened, when and who and what query caused it, and so on. + +InnoDB has a huge variety of foreign key error messages, and many of them are +just hard to parse. innotop doesn't always do the best job here, but there's +so much code devoted to parsing this messy, unparseable output that innotop is +likely never to be perfect in this regard. If innotop doesn't show you what +you need to see, just look at the status text directly. + +This mode displays the L<"fk_error"> table by default. + +=item I: InnoDB I/O Info + +This mode shows InnoDB's I/O statistics, including the I/O threads, pending I/O, +file I/O miscellaneous, and log statistics. It displays the L<"io_threads">, +L<"pending_io">, L<"file_io_misc">, and L<"log_statistics"> tables by default. + +=item L: Locks + +This mode shows information about current locks. At the moment only InnoDB +locks are supported, and by default you'll only see locks for which transactions +are waiting. This information comes from the TRANSACTIONS section of the InnoDB +status text. If you have a very busy server, you may have frequent lock waits; +it helps to be able to see which tables and indexes are the "hot spot" for +locks. If your server is running pretty well, this mode should show nothing. + +You can configure MySQL and innotop to monitor not only locks for which a +transaction is waiting, but those currently held, too. You can do this with the +InnoDB Lock Monitor (L<http://dev.mysql.com/doc/en/innodb-monitor.html>). It's +not documented in the MySQL manual, but creating the lock monitor with the +following statement also affects the output of SHOW INNODB STATUS, which innotop +uses: + + CREATE TABLE innodb_lock_monitor(a int) ENGINE=INNODB; + +This causes InnoDB to print its output to the MySQL file every 16 seconds or so, +as stated in the manual, but it also makes the normal SHOW INNODB STATUS output +include lock information, which innotop can parse and display (that's the +undocumented feature). + +This means you can do what may have seemed impossible: to a limited extent +(InnoDB truncates some information in the output), you can see which transaction +holds the locks something else is waiting for. You can also enable and disable +the InnoDB Lock Monitor with the key mappings in this mode. + +This mode displays the L<"innodb_locks"> table by default. Here's a sample of +the screen when one connection is waiting for locks another connection holds: + + _________________________________ InnoDB Locks __________________________ + CXN ID Type Waiting Wait Active Mode DB Table Index + localhost 12 RECORD 1 00:10 00:10 X test t1 PRIMARY + localhost 12 TABLE 0 00:10 00:10 IX test t1 + localhost 12 RECORD 1 00:10 00:10 X test t1 PRIMARY + localhost 11 TABLE 0 00:00 00:25 IX test t1 + localhost 11 RECORD 0 00:00 00:25 X test t1 PRIMARY + +You can see the first connection, ID 12, is waiting for a lock on the PRIMARY +key on test.t1, and has been waiting for 10 seconds. The second connection +isn't waiting, because the Waiting column is 0, but it holds locks on the same +index. That tells you connection 11 is blocking connection 12. + +=item M: Master/Slave Replication Status + +This mode shows the output of SHOW SLAVE STATUS and SHOW MASTER STATUS in three +tables. The first two divide the slave's status into SQL and I/O thread status, +and the last shows master status. Filters are applied to eliminate non-slave +servers from the slave tables, and non-master servers from the master table. + +This mode displays the L<"slave_sql_status">, L<"slave_io_status">, and +L<"master_status"> tables by default. + +=item O: Open Tables + +This section comes from MySQL's SHOW OPEN TABLES command. By default it is +filtered to show tables which are in use by one or more queries, so you can +get a quick look at which tables are 'hot'. You can use this to guess which +tables might be locked implicitly. + +This mode displays the L<"open_tables"> mode by default. + +=item Q: Query List + +This mode displays the output from SHOW FULL PROCESSLIST, much like B<mytop>'s +query list mode. This mode does B<not> show InnoDB-related information. This +is probably one of the most useful modes for general usage. + +There is an informative header that shows general status information about +your server. You can toggle it on and off with the 'h' key. By default, +innotop hides inactive processes and its own process. You can toggle these on +and off with the 'i' and 'a' keys. + +You can EXPLAIN a query from this mode with the 'e' key. This displays the +query's full text, the results of EXPLAIN, and in newer MySQL versions, even +the optimized query resulting from EXPLAIN EXTENDED. innotop also tries to +rewrite certain queries to make them EXPLAIN-able. For example, INSERT/SELECT +statements are rewritable. + +This mode displays the L<"q_header"> and L<"processlist"> tables by default. + +=item R: InnoDB Row Operations and Semaphores + +This mode shows InnoDB row operations, row operation miscellaneous, semaphores, +and information from the wait array. It displays the L<"row_operations">, +L<"row_operation_misc">, L<"semaphores">, and L<"wait_array"> tables by default. + +=item S: Variables & Status + +This mode calculates statistics, such as queries per second, and prints them out +in several different styles. You can show absolute values, or incremental values +between ticks. + +You can switch between the views by pressing a key. The 's' key prints a +single line each time the screen updates, in the style of B<vmstat>. The 'g' +key changes the view to a graph of the same numbers, sort of like B<tload>. +The 'v' key changes the view to a pivoted table of variable names on the left, +with successive updates scrolling across the screen from left to right. You can +choose how many updates to put on the screen with the L<"num_status_sets"> +configuration variable. + +Headers may be abbreviated to fit on the screen in interactive operation. You +choose which variables to display with the 'c' key, which selects from +predefined sets, or lets you create your own sets. You can edit the current set +with the 'e' key. + +This mode doesn't really display any tables like other modes. Instead, it uses +a table definition to extract and format the data, but it then transforms the +result in special ways before outputting it. It uses the L<"var_status"> table +definition for this. + +=item T: InnoDB Transactions + +This mode shows transactions from the InnoDB monitor's output, in B<top>-like +format. This mode is the reason I wrote innotop. + +You can kill queries or processes with the 'k' and 'x' keys, and EXPLAIN a query +with the 'e' or 'f' keys. InnoDB doesn't print the full query in transactions, +so explaining may not work right if the query is truncated. + +The informational header can be toggled on and off with the 'h' key. By +default, innotop hides inactive transactions and its own transaction. You can +toggle this on and off with the 'i' and 'a' keys. + +This mode displays the L<"t_header"> and L<"innodb_transactions"> tables by +default. + +=back + +=head1 INNOTOP STATUS + +The first line innotop displays is a "status bar" of sorts. What it contains +depends on the mode you're in, and what servers you're monitoring. The first +few words are always the innotop mode, such as "InnoDB Txns" for T mode, +followed by a reminder to press '?' for help at any time. + +=head2 ONE SERVER + +The simplest case is when you're monitoring a single server. In this case, the +name of the connection is next on the status line. This is the name you gave +when you created the connection -- most likely the MySQL server's hostname. +This is followed by the server's uptime. + +If you're in an InnoDB mode, such as T or B, the next word is "InnoDB" followed +by some information about the SHOW INNODB STATUS output used to render the +screen. The first word is the number of seconds since the last SHOW INNODB +STATUS, which InnoDB uses to calculate some per-second statistics. The next is +a smiley face indicating whether the InnoDB output is truncated. If the smiley +face is a :-), all is well; there is no truncation. A :^| means the transaction +list is so long, InnoDB has only printed out some of the transactions. Finally, +a frown :-( means the output is incomplete, which is probably due to a deadlock +printing too much lock information (see L<"D: InnoDB Deadlocks">). + +The next two words indicate the server's queries per second (QPS) and how many +threads (connections) exist. Finally, the server's version number is the last +thing on the line. + +=head2 MULTIPLE SERVERS + +If you are monitoring multiple servers (see L<"SERVER CONNECTIONS">), the status +line does not show any details about individual servers. Instead, it shows the +names of the connections that are active. Again, these are connection names you +specified, which are likely to be the server's hostname. A connection that has +an error is prefixed with an exclamation point. + +If you are monitoring a group of servers (see L<"SERVER GROUPS">), the status +line shows the name of the group. If any connection in the group has an +error, the group's name is followed by the fraction of the connections that +don't have errors. + +See L<"ERROR HANDLING"> for more details about innotop's error handling. + +=head2 MONITORING A FILE + +If you give a filename on the command line, innotop will not connect to ANY +servers at all. It will watch the specified file for InnoDB status output and +use that as its data source. It will always show a single connection called +'file'. And since it can't connect to a server, it can't determine how long the +server it's monitoring has been up; so it calculates the server's uptime as time +since innotop started running. + +=head1 SERVER ADMINISTRATION + +While innotop is primarily a monitor that lets you watch and analyze your +servers, it can also send commands to servers. The most frequently useful +commands are killing queries and stopping or starting slaves. + +You can kill a connection, or in newer versions of MySQL kill a query but not a +connection, from L<"Q: Query List"> and L<"T: InnoDB Transactions"> modes. +Press 'k' to issue a KILL command, or 'x' to issue a KILL QUERY command. +innotop will prompt you for the server and/or connection ID to kill (innotop +does not prompt you if there is only one possible choice for any input). +innotop pre-selects the longest-running query, or the oldest connection. +Confirm the command with 'y'. + +In L<"M: Master/Slave Replication Status"> mode, you can start and stop slaves +with the 'a' and 'o' keys, respectively. You can send these commands to many +slaves at once. innotop fills in a default command of START SLAVE or STOP SLAVE +for you, but you can actually edit the command and send anything you wish, such +as SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1 to make the slave skip one binlog event +when it starts. + +You can also ask innotop to calculate the earliest binlog in use by any slave +and issue a PURGE MASTER LOGS on the master. Use the 'b' key for this. innotop +will prompt you for a master to run the command on, then prompt you for the +connection names of that master's slaves (there is no way for innotop to +determine this reliably itself). innotop will find the minimum binlog in use by +these slave connections and suggest it as the argument to PURGE MASTER LOGS. + +=head1 SERVER CONNECTIONS + +When you create a server connection, innotop asks you for a series of inputs, as +follows: + +=over + +=item DSN + +A DSN is a Data Source Name, which is the initial argument passed to the DBI +module for connecting to a server. It is usually of the form + + DBI:mysql:;mysql_read_default_group=mysql;host=HOSTNAME + +Since this DSN is passed to the DBD::mysql driver, you should read the driver's +documentation at L<"http://search.cpan.org/dist/DBD-mysql/lib/DBD/mysql.pm"> for +the exact details on all the options you can pass the driver in the DSN. You +can read more about DBI at L<http://dbi.perl.org/docs/>, and especially at +L<http://search.cpan.org/~timb/DBI/DBI.pm>. + +The mysql_read_default_group=mysql option lets the DBD driver read your MySQL +options files, such as ~/.my.cnf on UNIX-ish systems. You can use this to avoid +specifying a username or password for the connection. + +=item InnoDB Deadlock Table + +This optional item tells innotop a table name it can use to deliberately create +a small deadlock (see L<"D: InnoDB Deadlocks">). If you specify this option, +you just need to be sure the table doesn't exist, and that innotop can create +and drop the table with the InnoDB storage engine. You can safely omit or just +accept the default if you don't intend to use this. + +=item Username + +innotop will ask you if you want to specify a username. If you say 'y', it will +then prompt you for a user name. If you have a MySQL option file that specifies +your username, you don't have to specify a username. + +The username defaults to your login name on the system you're running innotop on. + +=item Password + +innotop will ask you if you want to specify a password. Like the username, the +password is optional, but there's an additional prompt that asks if you want to +save the password in the innotop configuration file. If you don't save it in +the configuration file, innotop will prompt you for a password each time it +starts. Passwords in the innotop configuration file are saved in plain text, +not encrypted in any way. + +=back + +Once you finish answering these questions, you should be connected to a server. +But innotop isn't limited to monitoring a single server; you can define many +server connections and switch between them by pressing the '@' key. See +L<"SWITCHING BETWEEN CONNECTIONS">. + +To create a new connection, press the '@' key and type the name of the new +connection, then follow the steps given above. + +=head1 SERVER GROUPS + +If you have multiple MySQL instances, you can put them into named groups, such +as 'all', 'masters', and 'slaves', which innotop can monitor all together. + +You can choose which group to monitor with the '#' key, and you can press the +TAB key to switch to the next group. If you're not currently monitoring a +group, pressing TAB selects the first group. + +To create a group, press the '#' key and type the name of your new group, then +type the names of the connections you want the group to contain. + +=head1 SWITCHING BETWEEN CONNECTIONS + +innotop lets you quickly switch which servers you're monitoring. The most basic +way is by pressing the '@' key and typing the name(s) of the connection(s) you +want to use. This setting is per-mode, so you can monitor different connections +in each mode, and innotop remembers which connections you choose. + +You can quickly switch to the 'next' connection in alphabetical order with the +'n' key. If you're monitoring a server group (see L<"SERVER GROUPS">) this will +switch to the first connection. + +You can also type many connection names, and innotop will fetch and display data +from them all. Just separate the connection names with spaces, for example +"server1 server2." Again, if you type the name of a connection that doesn't +exist, innotop will prompt you for connection information and create the +connection. + +Another way to monitor multiple connections at once is with server groups. You +can use the TAB key to switch to the 'next' group in alphabetical order, or if +you're not monitoring any groups, TAB will switch to the first group. + +innotop does not fetch data in parallel from connections, so if you are +monitoring a large group or many connections, you may notice increased delay +between ticks. + +When you monitor more than one connection, innotop's status bar changes. See +L<"INNOTOP STATUS">. + +=head1 ERROR HANDLING + +Error handling is not that important when monitoring a single connection, but is +crucial when you have many active connections. A crashed server or lost +connection should not crash innotop. As a result, innotop will continue to run +even when there is an error; it just won't display any information from the +connection that had an error. Because of this, innotop's behavior might confuse +you. It's a feature, not a bug! + +innotop does not continue to query connections that have errors, because they +may slow innotop and make it hard to use, especially if the error is a problem +connecting and causes a long time-out. Instead, innotop retries the connection +occasionally to see if the error still exists. If so, it will wait until some +point in the future. The wait time increases in ticks as the Fibonacci series, +so it tries less frequently as time passes. + +Since errors might only happen in certain modes because of the SQL commands +issued in those modes, innotop keeps track of which mode caused the error. If +you switch to a different mode, innotop will retry the connection instead of +waiting. + +By default innotop will display the problem in red text at the bottom of the +first table on the screen. You can disable this behavior with the +L<"show_cxn_errors_in_tbl"> configuration option, which is enabled by default. +If the L<"debug"> option is enabled, innotop will display the error at the +bottom of every table, not just the first. And if L<"show_cxn_errors"> is +enabled, innotop will print the error text to STDOUT as well. Error messages +might only display in the mode that caused the error, depending on the mode and +whether innotop is avoiding querying that connection. + +=head1 NON-INTERACTIVE OPERATION + +You can run innotop in non-interactive mode, in which case it is entirely +controlled from the configuration file and command-line options. To start +innotop in non-interactive mode, give the L"<--nonint"> command-line option. +This changes innotop's behavior in the following ways: + +=over + +=item * + +Certain Perl modules are not loaded. Term::Readline is not loaded, since +innotop doesn't prompt interactively. Term::ANSIColor and Win32::Console::ANSI +modules are not loaded. Term::ReadKey is still used, since innotop may have to +prompt for connection passwords when starting up. + +=item * + +innotop does not clear the screen after each tick. + +=item * + +innotop does not persist any changes to the configuration file. + +=item * + +If L<"--count"> is given and innotop is in incremental mode (see L<"status_inc"> +and L<"--inc">), innotop actually refreshes one more time than specified so it +can print incremental statistics. This suppresses output during the first +tick, so innotop may appear to hang. + +=item * + +innotop only displays the first table in each mode. This is so the output can +be easily processed with other command-line utilities such as awk and sed. To +change which tables display in each mode, see L<"TABLES">. Since L<"Q: Query +List"> mode is so important, innotop automatically disables the L<"q_header"> +table. This ensures you'll see the L<"processlist"> table, even if you have +innotop configured to show the q_header table during interactive operation. +Similarly, in L<"T: InnoDB Transactions"> mode, the L<"t_header"> table is +suppressed so you see only the L<"innodb_transactions"> table. + +=item * + +All output is tab-separated instead of being column-aligned with whitespace, and +innotop prints the full contents of each table instead of only printing one +screenful at a time. + +=item * + +innotop only prints column headers once instead of every tick (see +L<"hide_hdr">). innotop does not print table captions (see +L<"display_table_captions">). innotop ensures there are no empty lines in the +output. + +=item * + +innotop does not honor the L<"shorten"> transformation, which normally shortens +some numbers to human-readable formats. + +=item * + +innotop does not print a status line (see L<"INNOTOP STATUS">). + +=back + +=head1 CONFIGURING + +Nearly everything about innotop is configurable. Most things are possible to +change with built-in commands, but you can also edit the configuration file. + +While running innotop, press the '$' key to bring up the configuration editing +dialog. Press another key to select the type of data you want to edit: + +=over + +=item S: Statement Sleep Times + +Edits SQL statement sleep delays, which make innotop pause for the specified +amount of time after executing a statement. See L<"SQL STATEMENTS"> for a +definition of each statement and what it does. By default innotop does not +delay after any statements. + +This feature is included so you can customize the side-effects caused by +monitoring your server. You may not see any effects, but some innotop users +have noticed that certain MySQL versions under very high load with InnoDB +enabled take longer than usual to execute SHOW GLOBAL STATUS. If innotop calls +SHOW FULL PROCESSLIST immediately afterward, the processlist contains more +queries than the machine actually averages at any given moment. Configuring +innotop to pause briefly after calling SHOW GLOBAL STATUS alleviates this +effect. + +Sleep times are stored in the L<"stmt_sleep_times"> section of the configuration +file. Fractional-second sleeps are supported, subject to your hardware's +limitations. + +=item c: Edit Columns + +Starts the table editor on one of the displayed tables. See L<"TABLE EDITOR">. +An alternative way to start the table editor without entering the configuration +dialog is with the '^' key. + +=item g: General Configuration + +Starts the configuration editor to edit global and mode-specific configuration +variables (see L<"MODES">). innotop prompts you to choose a variable from among +the global and mode-specific ones depending on the current mode. + +=item k: Row-Coloring Rules + +Starts the row-coloring rules editor on one of the displayed table(s). See +L<"COLORS"> for details. + +=item p: Manage Plugins + +Starts the plugin configuration editor. See L<"PLUGINS"> for details. + +=item s: Server Groups + +Lets you create and edit server groups. See L<"SERVER GROUPS">. + +=item t: Choose Displayed Tables + +Lets you choose which tables to display in this mode. See L<"MODES"> and +L<"TABLES">. + +=back + +=head1 CONFIGURATION FILE + +innotop's default configuration file location is in $HOME/.innotop, but can be +overridden with the L<"--config"> command-line option. You can edit it by hand +safely. innotop reads the configuration file when it starts, and writes it out +again when it exits, so any changes you make while innotop is running will be +lost. + +innotop doesn't store its entire configuration in the configuration file. It +has a huge set of default configuration that it holds only in memory, and the +configuration file only overrides these defaults. When you customize a default +setting, innotop notices, and then stores the customizations into the file. +This keeps the file size down, makes it easier to edit, and makes upgrades +easier. + +A configuration file can be made read-only. See L<"readonly">. + +The configuration file is arranged into sections like an INI file. Each +section begins with [section-name] and ends with [/section-name]. Each +section's entries have a different syntax depending on the data they need to +store. You can put comments in the file; any line that begins with a # +character is a comment. innotop will not read the comments, so it won't write +them back out to the file when it exits. Comments in read-only configuration +files are still useful, though. + +The first line in the file is innotop's version number. This lets innotop +notice when the file format is not backwards-compatible, and upgrade smoothly +without destroying your customized configuration. + +The following list describes each section of the configuration file and the data +it contains: + +=over + +=item general + +The 'general' section contains global configuration variables and variables that +may be mode-specific, but don't belong in any other section. The syntax is a +simple key=value list. innotop writes a comment above each value to help you +edit the file by hand. + +=over + +=item S_func + +Controls S mode presentation (see L<"S: Variables & Status">). If g, values are +graphed; if s, values are like vmstat; if p, values are in a pivoted table. + +=item S_set + +Specifies which set of variables to display in L<"S: Variables & Status"> mode. +See L<"VARIABLE SETS">. + +=item auto_wipe_dl + +Instructs innotop to automatically wipe large deadlocks when it notices them. +When this happens you may notice a slight delay. At the next tick, you will +usually see the information that was being truncated by the large deadlock. + +=item charset + +Specifies what kind of characters to allow through the L<"no_ctrl_char"> +transformation. This keeps non-printable characters from confusing a +terminal when you monitor queries that contain binary data, such as images. + +The default is 'ascii', which considers anything outside normal ASCII to be a +control character. The other allowable values are 'unicode' and 'none'. 'none' +considers every character a control character, which can be useful for +collapsing ALL text fields in queries. + +=item cmd_filter + +This is the prefix that filters variables in L<"C: Command Summary"> mode. + +=item color + +Whether terminal coloring is permitted. + +=item cxn_timeout + +On MySQL versions 4.0.3 and newer, this variable is used to set the connection's +timeout, so MySQL doesn't close the connection if it is not used for a while. +This might happen because a connection isn't monitored in a particular mode, for +example. + +=item debug + +This option enables more verbose errors and makes innotop more strict in some +places. It can help in debugging filters and other user-defined code. It also +makes innotop write a lot of information to L<"debugfile"> when there is a +crash. + +=item debugfile + +A file to which innotop will write information when there is a crash. See +L<"FILES">. + +=item display_table_captions + +innotop displays a table caption above most tables. This variable suppresses or +shows captions on all tables globally. Some tables are configured with the +hide_caption property, which overrides this. + +=item global + +Whether to show GLOBAL variables and status. innotop only tries to do this on +servers which support the GLOBAL option to SHOW VARIABLES and SHOW STATUS. In +some MySQL versions, you need certain privileges to do this; if you don't have +them, innotop will not be able to fetch any variable and status data. This +configuration variable lets you run innotop and fetch what data you can even +without the elevated privileges. + +I can no longer find or reproduce the situation where GLOBAL wasn't allowed, but +I know there was one. + +=item graph_char + +Defines the character to use when drawing graphs in L<"S: Variables & Status"> +mode. + +=item header_highlight + +Defines how to highlight column headers. This only works if Term::ANSIColor is +available. Valid values are 'bold' and 'underline'. + +=item hide_hdr + +Hides column headers globally. + +=item interval + +The interval at which innotop will refresh its data (ticks). The interval is +implemented as a sleep time between ticks, so the true interval will vary +depending on how long it takes innotop to fetch and render data. + +This variable accepts fractions of a second. + +=item mode + +The mode in which innotop should start. Allowable arguments are the same as the +key presses that select a mode interactively. See L<"MODES">. + +=item num_digits + +How many digits to show in fractional numbers and percents. This variable's +range is between 0 and 9 and can be set directly from L<"S: Variables & Status"> +mode with the '+' and '-' keys. It is used in the L<"set_precision">, +L<"shorten">, and L<"percent"> transformations. + +=item num_status_sets + +Controls how many sets of status variables to display in pivoted L<"S: Variables +& Status"> mode. It also controls the number of old sets of variables innotop +keeps in its memory, so the larger this variable is, the more memory innotop +uses. + +=item plugin_dir + +Specifies where plugins can be found. By default, innotop stores plugins in the +'plugins' subdirectory of your innotop configuration directory. + +=item readonly + +Whether the configuration file is readonly. This cannot be set interactively, +because it would prevent itself from being written to the configuration file. + +=item show_cxn_errors + +Makes innotop print connection errors to STDOUT. See L<"ERROR HANDLING">. + +=item show_cxn_errors_in_tbl + +Makes innotop display connection errors as rows in the first table on screen. +See L<"ERROR HANDLING">. + +=item show_percent + +Adds a '%' character after the value returned by the L<"percent"> +transformation. + +=item show_statusbar + +Controls whether to show the status bar in the display. See L<"INNOTOP +STATUS">. + +=item skip_innodb + +Disables fetching SHOW INNODB STATUS, in case your server(s) do not have InnoDB +enabled and you don't want innotop to try to fetch it. This can also be useful +when you don't have the SUPER privilege, required to run SHOW INNODB STATUS. + +=item status_inc + +Whether to show absolute or incremental values for status variables. +Incremental values are calculated as an offset from the last value innotop saw +for that variable. This is a global setting, but will probably become +mode-specific at some point. Right now it is honored a bit inconsistently; some +modes don't pay attention to it. + +=back + +=item plugins + +This section holds a list of package names of active plugins. If the plugin +exists, innotop will activate it. See L<"PLUGINS"> for more information. + +=item filters + +This section holds user-defined filters (see L<"FILTERS">). Each line is in the +format filter_name=text='filter text' tbls='table list'. + +The filter text is the text of the subroutine's code. The table list is a list +of tables to which the filter can apply. By default, user-defined filters apply +to the table for which they were created, but you can manually override that by +editing the definition in the configuration file. + +=item active_filters + +This section stores which filters are active on each table. Each line is in the +format table_name=filter_list. + +=item tbl_meta + +This section stores user-defined or user-customized columns (see L<"COLUMNS">). +Each line is in the format col_name=properties, where the properties are a +name=quoted-value list. + +=item connections + +This section holds the server connections you have defined. Each line is in the +format name=properties, where the properties are a name=value list. The +properties are self-explanatory, and the only one that is treated specially is +'pass' which is only present if 'savepass' is set. See L<"SERVER CONNECTIONS">. + +=item active_connections + +This section holds a list of which connections are active in each mode. Each +line is in the format mode_name=connection_list. + +=item server_groups + +This section holds server groups. Each line is in the format +name=connection_list. See L<"SERVER GROUPS">. + +=item active_server_groups + +This section holds a list of which server group is active in each mode. Each +line is in the format mode_name=server_group. + +=item max_values_seen + +This section holds the maximum values seen for variables. This is used to scale +the graphs in L<"S: Variables & Status"> mode. Each line is in the format +name=value. + +=item active_columns + +This section holds table column lists. Each line is in the format +tbl_name=column_list. See L<"COLUMNS">. + +=item sort_cols + +This section holds the sort definition. Each line is in the format +tbl_name=column_list. If a column is prefixed with '-', that column sorts +descending. See L<"SORTING">. + +=item visible_tables + +This section defines which tables are visible in each mode. Each line is in the +format mode_name=table_list. See L<"TABLES">. + +=item varsets + +This section defines variable sets for use in L<"S: Status & Variables"> mode. +Each line is in the format name=variable_list. See L<"VARIABLE SETS">. + +=item colors + +This section defines colorization rules. Each line is in the format +tbl_name=property_list. See L<"COLORS">. + +=item stmt_sleep_times + +This section contains statement sleep times. Each line is in the format +statement_name=sleep_time. See L<"S: Statement Sleep Times">. + +=item group_by + +This section contains column lists for table group_by expressions. Each line is +in the format tbl_name=column_list. See L<"GROUPING">. + +=back + +=head1 CUSTOMIZING + +You can customize innotop a great deal. For example, you can: + +=over + +=item * + +Choose which tables to display, and in what order. + +=item * + +Choose which columns are in those tables, and create new columns. + +=item * + +Filter which rows display with built-in filters, user-defined filters, and +quick-filters. + +=item * + +Sort the rows to put important data first or group together related rows. + +=item * + +Highlight rows with color. + +=item * + +Customize the alignment, width, and formatting of columns, and apply +transformations to columns to extract parts of their values or format the values +as you wish (for example, shortening large numbers to familiar units). + +=item * + +Design your own expressions to extract and combine data as you need. This gives +you unlimited flexibility. + +=back + +All these and more are explained in the following sections. + +=head2 TABLES + +A table is what you'd expect: a collection of columns. It also has some other +properties, such as a caption. Filters, sorting rules, and colorization rules +belong to tables and are covered in later sections. + +Internally, table meta-data is defined in a data structure called %tbl_meta. +This hash holds all built-in table definitions, which contain a lot of default +instructions to innotop. The meta-data includes the caption, a list of columns +the user has customized, a list of columns, a list of visible columns, a list of +filters, color rules, a sort-column list, sort direction, and some information +about the table's data sources. Most of this is customizable via the table +editor (see L<"TABLE EDITOR">). + +You can choose which tables to show by pressing the '$' key. See L<"MODES"> and +L<"TABLES">. + +The table life-cycle is as follows: + +=over + +=item * + +Each table begins with a data source, which is an array of hashes. See below +for details on data sources. + +=item * + +Each element of the data source becomes a row in the final table. + +=item * + +For each element in the data source, innotop extracts values from the source and +creates a row. This row is another hash, which later steps will refer to as +$set. The values innotop extracts are determined by the table's columns. Each +column has an extraction subroutine, compiled from an expression (see +L<"EXPRESSIONS">). The resulting row is a hash whose keys are named the same as +the column name. + +=item * + +innotop filters the rows, removing those that don't need to be displayed. See +L<"FILTERS">. + +=item * + +innotop sorts the rows. See L<"SORTING">. + +=item * + +innotop groups the rows together, if specified. See L<"GROUPING">. + +=item * + +innotop colorizes the rows. See L<"COLORS">. + +=item * + +innotop transforms the column values in each row. See L<"TRANSFORMATIONS">. + +=item * + +innotop optionally pivots the rows (see L<"PIVOTING">), then filters and sorts +them. + +=item * + +innotop formats and justifies the rows as a table. During this step, innotop +applies further formatting to the column values, including alignment, maximum +and minimum widths. innotop also does final error checking to ensure there are +no crashes due to undefined values. innotop then adds a caption if specified, +and the table is ready to print. + +=back + +The lifecycle is slightly different if the table is pivoted, as noted above. To +clarify, if the table is pivoted, the process is extract, group, transform, +pivot, filter, sort, create. If it's not pivoted, the process is extract, +filter, sort, group, color, transform, create. This slightly convoluted process +doesn't map all that well to SQL, but pivoting complicates things pretty +thoroughly. Roughly speaking, filtering and sorting happen as late as needed to +effect the final result as you might expect, but as early as possible for +efficiency. + +Each built-in table is described below: + +=over + +=item adaptive_hash_index + +Displays data about InnoDB's adaptive hash index. Data source: +L<"STATUS_VARIABLES">. + +=item buffer_pool + +Displays data about InnoDB's buffer pool. Data source: L<"STATUS_VARIABLES">. + +=item cmd_summary + +Displays weighted status variables. Data source: L<"STATUS_VARIABLES">. + +=item deadlock_locks + +Shows which locks were held and waited for by the last detected deadlock. Data +source: L<"DEADLOCK_LOCKS">. + +=item deadlock_transactions + +Shows transactions involved in the last detected deadlock. Data source: +L<"DEADLOCK_TRANSACTIONS">. + +=item explain + +Shows the output of EXPLAIN. Data source: L<"EXPLAIN">. + +=item file_io_misc + +Displays data about InnoDB's file and I/O operations. Data source: +L<"STATUS_VARIABLES">. + +=item fk_error + +Displays various data about InnoDB's last foreign key error. Data source: +L<"STATUS_VARIABLES">. + +=item innodb_locks + +Displays InnoDB locks. Data source: L<"INNODB_LOCKS">. + +=item innodb_transactions + +Displays data about InnoDB's current transactions. Data source: +L<"INNODB_TRANSACTIONS">. + +=item insert_buffers + +Displays data about InnoDB's insert buffer. Data source: L<"STATUS_VARIABLES">. + +=item io_threads + +Displays data about InnoDB's I/O threads. Data source: L<"IO_THREADS">. + +=item log_statistics + +Displays data about InnoDB's logging system. Data source: L<"STATUS_VARIABLES">. + +=item master_status + +Displays replication master status. Data source: L<"STATUS_VARIABLES">. + +=item open_tables + +Displays open tables. Data source: L<"OPEN_TABLES">. + +=item page_statistics + +Displays InnoDB page statistics. Data source: L<"STATUS_VARIABLES">. + +=item pending_io + +Displays InnoDB pending I/O operations. Data source: L<"STATUS_VARIABLES">. + +=item processlist + +Displays current MySQL processes (threads/connections). Data source: +L<"PROCESSLIST">. + +=item q_header + +Displays various status values. Data source: L<"STATUS_VARIABLES">. + +=item row_operation_misc + +Displays data about InnoDB's row operations. Data source: +L<"STATUS_VARIABLES">. + +=item row_operations + +Displays data about InnoDB's row operations. Data source: +L<"STATUS_VARIABLES">. + +=item semaphores + +Displays data about InnoDB's semaphores and mutexes. Data source: +L<"STATUS_VARIABLES">. + +=item slave_io_status + +Displays data about the slave I/O thread. Data source: +L<"STATUS_VARIABLES">. + +=item slave_sql_status + +Displays data about the slave SQL thread. Data source: L<"STATUS_VARIABLES">. + +=item t_header + +Displays various InnoDB status values. Data source: L<"STATUS_VARIABLES">. + +=item var_status + +Displays user-configurable data. Data source: L<"STATUS_VARIABLES">. + +=item wait_array + +Displays data about InnoDB's OS wait array. Data source: L<"OS_WAIT_ARRAY">. + +=back + +=head2 COLUMNS + +Columns belong to tables. You can choose a table's columns by pressing the '^' +key, which starts the L<"TABLE EDITOR"> and lets you choose and edit columns. +Pressing 'e' from within the table editor lets you edit the column's properties: + +=over + +=item * + +hdr: a column header. This appears in the first row of the table. + +=item * + +just: justification. '-' means left-justified and '' means right-justified, +just as with printf formatting codes (not a coincidence). + +=item * + +dec: whether to further align the column on the decimal point. + +=item * + +num: whether the column is numeric. This affects how values are sorted +(lexically or numerically). + +=item * + +label: a small note about the column, which appears in dialogs that help the +user choose columns. + +=item * + +src: an expression that innotop uses to extract the column's data from its +source (see L<"DATA SOURCES">). See L<"EXPRESSIONS"> for more on expressions. + +=item * + +minw: specifies a minimum display width. This helps stabilize the display, +which makes it easier to read if the data is changing frequently. + +=item * + +maxw: similar to minw. + +=item * + +trans: a list of column transformations. See L<"TRANSFORMATIONS">. + +=item * + +agg: an aggregate function. See L<"GROUPING">. The default is L<"first">. + +=item * + +aggonly: controls whether the column only shows when grouping is enabled on the +table (see L<"GROUPING">). By default, this is disabled. This means columns +will always be shown by default, whether grouping is enabled or not. If a +column's aggonly is set true, the column will appear when you toggle grouping on +the table. Several columns are set this way, such as the count column on +L<"processlist"> and L<"innodb_transactions">, so you don't see a count when the +grouping isn't enabled, but you do when it is. + +=back + +=head2 FILTERS + +Filters remove rows from the display. They behave much like a WHERE clause in +SQL. innotop has several built-in filters, which remove irrelevant information +like inactive queries, but you can define your own as well. innotop also lets +you create quick-filters, which do not get saved to the configuration file, and +are just an easy way to quickly view only some rows. + +You can enable or disable a filter on any table. Press the '%' key (mnemonic: % +looks kind of like a line being filtered between two circles) and choose which +table you want to filter, if asked. You'll then see a list of possible filters +and a list of filters currently enabled for that table. Type the names of +filters you want to apply and press Enter. + +=head3 USER-DEFINED FILTERS + +If you type a name that doesn't exist, innotop will prompt you to create the +filter. Filters are easy to create if you know Perl, and not hard if you don't. +What you're doing is creating a subroutine that returns true if the row should +be displayed. The row is a hash reference passed to your subroutine as $set. + +For example, imagine you want to filter the processlist table so you only see +queries that have been running more than five minutes. Type a new name for your +filter, and when prompted for the subroutine body, press TAB to initiate your +terminal's auto-completion. You'll see the names of the columns in the +L<"processlist"> table (innotop generally tries to help you with auto-completion +lists). You want to filter on the 'time' column. Type the text "$set->{time} > +300" to return true when the query is more than five minutes old. That's all +you need to do. + +In other words, the code you're typing is surrounded by an implicit context, +which looks like this: + + sub filter { + my ( $set ) = @_; + # YOUR CODE HERE + } + +If your filter doesn't work, or if something else suddenly behaves differently, +you might have made an error in your filter, and innotop is silently catching +the error. Try enabling L<"debug"> to make innotop throw an error instead. + +=head3 QUICK-FILTERS + +innotop's quick-filters are a shortcut to create a temporary filter that doesn't +persist when you restart innotop. To create a quick-filter, press the '/' key. +innotop will prompt you for the column name and filter text. Again, you can use +auto-completion on column names. The filter text can be just the text you want +to "search for." For example, to filter the L<"processlist"> table on queries +that refer to the products table, type '/' and then 'info product'. + +The filter text can actually be any Perl regular expression, but of course a +literal string like 'product' works fine as a regular expression. + +Behind the scenes innotop compiles the quick-filter into a specially tagged +filter that is otherwise like any other filter. It just isn't saved to the +configuration file. + +To clear quick-filters, press the '\' key and innotop will clear them all at +once. + +=head2 SORTING + +innotop has sensible built-in defaults to sort the most important rows to the +top of the table. Like anything else in innotop, you can customize how any +table is sorted. + +To start the sort dialog, start the L<"TABLE EDITOR"> with the '^' key, choose a +table if necessary, and press the 's' key. You'll see a list of columns you can +use in the sort expression and the current sort expression, if any. Enter a +list of columns by which you want to sort and press Enter. If you want to +reverse sort, prefix the column name with a minus sign. For example, if you +want to sort by column a ascending, then column b descending, type 'a -b'. You +can also explicitly add a + in front of columns you want to sort ascending, but +it's not required. + +Some modes have keys mapped to open this dialog directly, and to quickly reverse +sort direction. Press '?' as usual to see which keys are mapped in any mode. + +=head2 GROUPING + +innotop can group, or aggregate, rows together (I use the terms +interchangeably). This is quite similar to an SQL GROUP BY clause. You can +specify to group on certain columns, or if you don't specify any, the entire set +of rows is treated as one group. This is quite like SQL so far, but unlike SQL, +you can also select un-grouped columns. innotop actually aggregates every +column. If you don't explicitly specify a grouping function, the default is +'first'. This is basically a convenience so you don't have to specify an +aggregate function for every column you want in the result. + +You can quickly toggle grouping on a table with the '=' key, which toggles its +aggregate property. This property doesn't persist to the config file. + +The columns by which the table is grouped are specified in its group_by +property. When you turn grouping on, innotop places the group_by columns at the +far left of the table, even if they're not supposed to be visible. The rest of +the visible columns appear in order after them. + +Two tables have default group_by lists and a count column built in: +L<"processlist"> and L<"innodb_transactions">. The grouping is by connection +and status, so you can quickly see how many queries or transactions are in a +given status on each server you're monitoring. The time columns are aggregated +as a sum; other columns are left at the default 'first' aggregation. + +By default, the table shown in L<"S: Variables & Status"> mode also uses +grouping so you can monitor variables and status across many servers. The +default aggregation function in this mode is 'avg'. + +Valid grouping functions are defined in the %agg_funcs hash. They include + +=over + +=item first + +Returns the first element in the group. + +=item count + +Returns the number of elements in the group, including undefined elements, much +like SQL's COUNT(*). + +=item avg + +Returns the average of defined elements in the group. + +=item sum + +Returns the sum of elements in the group. + +=back + +Here's an example of grouping at work. Suppose you have a very busy server with +hundreds of open connections, and you want to see how many connections are in +what status. Using the built-in grouping rules, you can press 'Q' to enter +L<"Q: Query List"> mode. Press '=' to toggle grouping (if necessary, select the +L<"processlist"> table when prompted). + +Your display might now look like the following: + + Query List (? for help) localhost, 32:33, 0.11 QPS, 1 thd, 5.0.38-log + + CXN Cmd Cnt ID User Host Time Query + localhost Query 49 12933 webusr localhost 19:38 SELECT * FROM + localhost Sending Da 23 2383 webusr localhost 12:43 SELECT col1, + localhost Sleep 120 140 webusr localhost 5:18:12 + localhost Statistics 12 19213 webusr localhost 01:19 SELECT * FROM + +That's actually quite a worrisome picture. You've got a lot of idle connections +(Sleep), and some connections executing queries (Query and Sending Data). +That's okay, but you also have a lot in Statistics status, collectively spending +over a minute. That means the query optimizer is having a really hard time +optimizing your statements. Something is wrong; it should normally take +milliseconds to optimize queries. You might not have seen this pattern if you +didn't look at your connections in aggregate. (This is a made-up example, but +it can happen in real life). + +=head2 PIVOTING + +innotop can pivot a table for more compact display, similar to a Pivot Table in +a spreadsheet (also known as a crosstab). Pivoting a table makes columns into +rows. Assume you start with this table: + + foo bar + === === + 1 3 + 2 4 + +After pivoting, the table will look like this: + + name set0 set1 + ==== ==== ==== + foo 1 2 + bar 3 4 + +To get reasonable results, you might need to group as well as pivoting. +innotop currently does this for L<"S: Variables & Status"> mode. + +=head2 COLORS + +By default, innotop highlights rows with color so you can see at a glance which +rows are more important. You can customize the colorization rules and add your +own to any table. Open the table editor with the '^' key, choose a table if +needed, and press 'o' to open the color editor dialog. + +The color editor dialog displays the rules applied to the table, in the order +they are evaluated. Each row is evaluated against each rule to see if the rule +matches the row; if it does, the row gets the specified color, and no further +rules are evaluated. The rules look like the following: + + state eq Locked black on_red + cmd eq Sleep white + user eq system user white + cmd eq Connect white + cmd eq Binlog Dump white + time > 600 red + time > 120 yellow + time > 60 green + time > 30 cyan + +This is the default rule set for the L<"processlist"> table. In order of +priority, these rules make locked queries black on a red background, "gray out" +connections from replication and sleeping queries, and make queries turn from +cyan to red as they run longer. + +(For some reason, the ANSI color code "white" is actually a light gray. Your +terminal's display may vary; experiment to find colors you like). + +You can use keystrokes to move the rules up and down, which re-orders their +priority. You can also delete rules and add new ones. If you add a new rule, +innotop prompts you for the column, an operator for the comparison, a value +against which to compare the column, and a color to assign if the rule matches. +There is auto-completion and prompting at each step. + +The value in the third step needs to be correctly quoted. innotop does not try +to quote the value because it doesn't know whether it should treat the value as +a string or a number. If you want to compare the column against a string, as +for example in the first rule above, you should enter 'Locked' surrounded by +quotes. If you get an error message about a bareword, you probably should have +quoted something. + +=head2 EXPRESSIONS + +Expressions are at the core of how innotop works, and are what enables you to +extend innotop as you wish. Recall the table lifecycle explained in +L<"TABLES">. Expressions are used in the earliest step, where it extracts +values from a data source to form rows. + +It does this by calling a subroutine for each column, passing it the source data +set, a set of current values, and a set of previous values. These are all +needed so the subroutine can calculate things like the difference between this +tick and the previous tick. + +The subroutines that extract the data from the set are compiled from +expressions. This gives significantly more power than just naming the values to +fill the columns, because it allows the column's value to be calculated from +whatever data is necessary, but avoids the need to write complicated and lengthy +Perl code. + +innotop begins with a string of text that can look as simple as a value's name +or as complicated as a full-fledged Perl expression. It looks at each +'bareword' token in the string and decides whether it's supposed to be a key +into the $set hash. A bareword is an unquoted value that isn't already +surrounded by code-ish things like dollar signs or curly brackets. If innotop +decides that the bareword isn't a function or other valid Perl code, it converts +it into a hash access. After the whole string is processed, innotop compiles a +subroutine, like this: + + sub compute_column_value { + my ( $set, $cur, $pre ) = @_; + my $val = # EXPANDED STRING GOES HERE + return $val; + } + +Here's a concrete example, taken from the header table L<"q_header"> in L<"Q: +Query List"> mode. This expression calculates the qps, or Queries Per Second, +column's values, from the values returned by SHOW STATUS: + + Questions/Uptime_hires + +innotop decides both words are barewords, and transforms this expression into +the following Perl code: + + $set->{Questions}/$set->{Uptime_hires} + +When surrounded by the rest of the subroutine's code, this is executable Perl +that calculates a high-resolution queries-per-second value. + +The arguments to the subroutine are named $set, $cur, and $pre. In most cases, +$set and $cur will be the same values. However, if L<"status_inc"> is set, $cur +will not be the same as $set, because $set will already contain values that are +the incremental difference between $cur and $pre. + +Every column in innotop is computed by subroutines compiled in the same fashion. +There is no difference between innotop's built-in columns and user-defined +columns. This keeps things consistent and predictable. + +=head2 TRANSFORMATIONS + +Transformations change how a value is rendered. For example, they can take a +number of seconds and display it in H:M:S format. The following transformations +are defined: + +=over + +=item commify + +Adds commas to large numbers every three decimal places. + +=item dulint_to_int + +Accepts two unsigned integers and converts them into a single longlong. This is +useful for certain operations with InnoDB, which uses two integers as +transaction identifiers, for example. + +=item no_ctrl_char + +Removes quoted control characters from the value. This is affected by the +L<"charset"> configuration variable. + +This transformation only operates within quoted strings, for example, values to +a SET clause in an UPDATE statement. It will not alter the UPDATE statement, +but will collapse the quoted string to [BINARY] or [TEXT], depending on the +charset. + +=item percent + +Converts a number to a percentage by multiplying it by two, formatting it with +L<"num_digits"> digits after the decimal point, and optionally adding a percent +sign (see L<"show_percent">). + +=item secs_to_time + +Formats a number of seconds as time in days+hours:minutes:seconds format. + +=item set_precision + +Formats numbers with L<"num_digits"> number of digits after the decimal point. + +=item shorten + +Formats a number as a unit of 1024 (k/M/G/T) and with L<"num_digits"> number of +digits after the decimal point. + +=back + +=head2 TABLE EDITOR + +The innotop table editor lets you customize tables with keystrokes. You start +the table editor with the '^' key. If there's more than one table on the +screen, it will prompt you to choose one of them. Once you do, innotop will +show you something like this: + + Editing table definition for Buffer Pool. Press ? for help, q to quit. + + name hdr label src + cxn CXN Connection from which cxn + buf_pool_size Size Buffer pool size IB_bp_buf_poo + buf_free Free Bufs Buffers free in the b IB_bp_buf_fre + pages_total Pages Pages total IB_bp_pages_t + pages_modified Dirty Pages Pages modified (dirty IB_bp_pages_m + buf_pool_hit_rate Hit Rate Buffer pool hit rate IB_bp_buf_poo + total_mem_alloc Memory Total memory allocate IB_bp_total_m + add_pool_alloc Add'l Pool Additonal pool alloca IB_bp_add_poo + +The first line shows which table you're editing, and reminds you again to press +'?' for a list of key mappings. The rest is a tabular representation of the +table's columns, because that's likely what you're trying to edit. However, you +can edit more than just the table's columns; this screen can start the filter +editor, color rule editor, and more. + +Each row in the display shows a single column in the table you're editing, along +with a couple of its properties such as its header and source expression (see +L<"EXPRESSIONS">). + +The key mappings are Vim-style, as in many other places. Pressing 'j' and 'k' +moves the highlight up or down. You can then (d)elete or (e)dit the highlighted +column. You can also (a)dd a column to the table. This actually just activates +one of the columns already defined for the table; it prompts you to choose from +among the columns available but not currently displayed. Finally, you can +re-order the columns with the '+' and '-' keys. + +You can do more than just edit the columns with the table editor, you can also +edit other properties, such as the table's sort expression and group-by +expression. Press '?' to see the full list, of course. + +If you want to really customize and create your own column, as opposed to just +activating a built-in one that's not currently displayed, press the (n)ew key, +and innotop will prompt you for the information it needs: + +=over + +=item * + +The column name: this needs to be a word without any funny characters, e.g. just +letters, numbers and underscores. + +=item * + +The column header: this is the label that appears at the top of the column, in +the table header. This can have spaces and funny characters, but be careful not +to make it too wide and waste space on-screen. + +=item * + +The column's data source: this is an expression that determines what data from +the source (see L<"TABLES">) innotop will put into the column. This can just be +the name of an item in the source, or it can be a more complex expression, as +described in L<"EXPRESSIONS">. + +=back + +Once you've entered the required data, your table has a new column. There is no +difference between this column and the built-in ones; it can have all the same +properties and behaviors. innotop will write the column's definition to the +configuration file, so it will persist across sessions. + +Here's an example: suppose you want to track how many times your slaves have +retried transactions. According to the MySQL manual, the +Slave_retried_transactions status variable gives you that data: "The total +number of times since startup that the replication slave SQL thread has retried +transactions. This variable was added in version 5.0.4." This is appropriate to +add to the L<"slave_sql_status"> table. + +To add the column, switch to the replication-monitoring mode with the 'M' key, +and press the '^' key to start the table editor. When prompted, choose +slave_sql_status as the table, then press 'n' to create the column. Type +'retries' as the column name, 'Retries' as the column header, and +'Slave_retried_transactions' as the source. Now the column is created, and you +see the table editor screen again. Press 'q' to exit the table editor, and +you'll see your column at the end of the table. + +=head1 VARIABLE SETS + +Variable sets are used in L<"S: Variables & Status"> mode to define more easily +what variables you want to monitor. Behind the scenes they are compiled to a +list of expressions, and then into a column list so they can be treated just +like columns in any other table, in terms of data extraction and +transformations. However, you're protected from the tedious details by a syntax +that ought to feel very natural to you: a SQL SELECT list. + +The data source for variable sets, and indeed the entire S mode, is the +combination of SHOW STATUS, SHOW VARIABLES, and SHOW INNODB STATUS. Imagine +that you had a huge table with one column per variable returned from those +statements. That's the data source for variable sets. You can now query this +data source just like you'd expect. For example: + + Questions, Uptime, Questions/Uptime as QPS + +Behind the scenes innotop will split that variable set into three expressions, +compile them and turn them into a table definition, then extract as usual. This +becomes a "variable set," or a "list of variables you want to monitor." + +innotop lets you name and save your variable sets, and writes them to the +configuration file. You can choose which variable set you want to see with the +'c' key, or activate the next and previous sets with the '>' and '<' keys. +There are many built-in variable sets as well, which should give you a good +start for creating your own. Press 'e' to edit the current variable set, or +just to see how it's defined. To create a new one, just press 'c' and type its +name. + +You may want to use some of the functions listed in L<"TRANSFORMATIONS"> to help +format the results. In particular, L<"set_precision"> is often useful to limit +the number of digits you see. Extending the above example, here's how: + + Questions, Uptime, set_precision(Questions/Uptime) as QPS + +Actually, this still needs a little more work. If your L<"interval"> is less +than one second, you might be dividing by zero because Uptime is incremental in +this mode by default. Instead, use Uptime_hires: + + Questions, Uptime, set_precision(Questions/Uptime_hires) as QPS + +This example is simple, but it shows how easy it is to choose which variables +you want to monitor. + +=head1 PLUGINS + +innotop has a simple but powerful plugin mechanism by which you can extend +or modify its existing functionality, and add new functionality. innotop's +plugin functionality is event-based: plugins register themselves to be called +when events happen. They then have a chance to influence the event. + +An innotop plugin is a Perl module placed in innotop's L<"plugin_dir"> +directory. On UNIX systems, you can place a symbolic link to the module instead +of putting the actual file there. innotop automatically discovers the file. If +there is a corresponding entry in the L<"plugins"> configuration file section, +innotop loads and activates the plugin. + +The module must conform to innotop's plugin interface. Additionally, the source +code of the module must be written in such a way that innotop can inspect the +file and determine the package name and description. + +=head2 Package Source Convention + +innotop inspects the plugin module's source to determine the Perl package name. +It looks for a line of the form "package Foo;" and if found, considers the +plugin's package name to be Foo. Of course the package name can be a valid Perl +package name, with double semicolons and so on. + +It also looks for a description in the source code, to make the plugin editor +more human-friendly. The description is a comment line of the form "# +description: Foo", where "Foo" is the text innotop will consider to be the +plugin's description. + +=head2 Plugin Interface + +The innotop plugin interface is quite simple: innotop expects the plugin to be +an object-oriented module it can call certain methods on. The methods are + +=over + +=item new(%variables) + +This is the plugin's constructor. It is passed a hash of innotop's variables, +which it can manipulate (see L<"Plugin Variables">). It must return a reference +to the newly created plugin object. + +At construction time, innotop has only loaded the general configuration and +created the default built-in variables with their default contents (which is +quite a lot). Therefore, the state of the program is exactly as in the innotop +source code, plus the configuration variables from the L<"general"> section in +the config file. + +If your plugin manipulates the variables, it is changing global data, which is +shared by innotop and all plugins. Plugins are loaded in the order they're +listed in the config file. Your plugin may load before or after another plugin, +so there is a potential for conflict or interaction between plugins if they +modify data other plugins use or modify. + +=item register_for_events() + +This method must return a list of events in which the plugin is interested, if +any. See L<"Plugin Events"> for the defined events. If the plugin returns an +event that's not defined, the event is ignored. + +=item event handlers + +The plugin must implement a method named the same as each event for which it has +registered. In other words, if the plugin returns qw(foo bar) from +register_for_events(), it must have foo() and bar() methods. These methods are +callbacks for the events. See L<"Plugin Events"> for more details about each +event. + +=back + +=head2 Plugin Variables + +The plugin's constructor is passed a hash of innotop's variables, which it can +manipulate. It is probably a good idea if the plugin object saves a copy of it +for later use. The variables are defined in the innotop variable +%pluggable_vars, and are as follows: + +=over + +=item action_for + +A hashref of key mappings. These are innotop's global hot-keys. + +=item agg_funcs + +A hashref of functions that can be used for grouping. See L<"GROUPING">. + +=item config + +The global configuration hash. + +=item connections + +A hashref of connection specifications. These are just specifications of how to +connect to a server. + +=item dbhs + +A hashref of innotop's database connections. These are actual DBI connection +objects. + +=item filters + +A hashref of filters applied to table rows. See L<"FILTERS"> for more. + +=item modes + +A hashref of modes. See L<"MODES"> for more. + +=item server_groups + +A hashref of server groups. See L<"SERVER GROUPS">. + +=item tbl_meta + +A hashref of innotop's table meta-data, with one entry per table (see +L<"TABLES"> for more information). + +=item trans_funcs + +A hashref of transformation functions. See L<"TRANSFORMATIONS">. + +=item var_sets + +A hashref of variable sets. See L<"VARIABLE SETS">. + +=back + +=head2 Plugin Events + +Each event is defined somewhere in the innotop source code. When innotop runs +that code, it executes the callback function for each plugin that expressed its +interest in the event. innotop passes some data for each event. The events are +defined in the %event_listener_for variable, and are as follows: + +=over + +=item extract_values($set, $cur, $pre, $tbl) + +This event occurs inside the function that extracts values from a data source. +The arguments are the set of values, the current values, the previous values, +and the table name. + +=item set_to_tbl + +Events are defined at many places in this subroutine, which is responsible for +turning an arrayref of hashrefs into an arrayref of lines that can be printed to +the screen. The events all pass the same data: an arrayref of rows and the name +of the table being created. The events are set_to_tbl_pre_filter, +set_to_tbl_pre_sort,set_to_tbl_pre_group, set_to_tbl_pre_colorize, +set_to_tbl_pre_transform, set_to_tbl_pre_pivot, set_to_tbl_pre_create, +set_to_tbl_post_create. + +=item draw_screen($lines) + +This event occurs inside the subroutine that prints the lines to the screen. +$lines is an arrayref of strings. + +=back + +=head2 Simple Plugin Example + +The easiest way to explain the plugin functionality is probably with a simple +example. The following module adds a column to the beginning of every table and +sets its value to 1. + + use strict; + use warnings FATAL => 'all'; + + package Innotop::Plugin::Example; + # description: Adds an 'example' column to every table + + sub new { + my ( $class, %vars ) = @_; + # Store reference to innotop's variables in $self + my $self = bless { %vars }, $class; + + # Design the example column + my $col = { + hdr => 'Example', + just => '', + dec => 0, + num => 1, + label => 'Example', + src => 'example', # Get data from this column in the data source + tbl => '', + trans => [], + }; + + # Add the column to every table. + my $tbl_meta = $vars{tbl_meta}; + foreach my $tbl ( values %$tbl_meta ) { + # Add the column to the list of defined columns + $tbl->{cols}->{example} = $col; + # Add the column to the list of visible columns + unshift @{$tbl->{visible}}, 'example'; + } + + # Be sure to return a reference to the object. + return $self; + } + + # I'd like to be called when a data set is being rendered into a table, please. + sub register_for_events { + my ( $self ) = @_; + return qw(set_to_tbl_pre_filter); + } + + # This method will be called when the event fires. + sub set_to_tbl_pre_filter { + my ( $self, $rows, $tbl ) = @_; + # Set the example column's data source to the value 1. + foreach my $row ( @$rows ) { + $row->{example} = 1; + } + } + + 1; + +=head2 Plugin Editor + +The plugin editor lets you view the plugins innotop discovered and activate or +deactivate them. Start the editor by pressing $ to start the configuration +editor from any mode. Press the 'p' key to start the plugin editor. You'll see +a list of plugins innotop discovered. You can use the 'j' and 'k' keys to move +the highlight to the desired one, then press the * key to toggle it active or +inactive. Exit the editor and restart innotop for the changes to take effect. + +=head1 SQL STATEMENTS + +innotop uses a limited set of SQL statements to retrieve data from MySQL for +display. The statements are customized depending on the server version against +which they are executed; for example, on MySQL 5 and newer, INNODB_STATUS +executes "SHOW ENGINE INNODB STATUS", while on earlier versions it executes +"SHOW INNODB STATUS". The statements are as follows: + + Statement SQL executed + =================== =============================== + INNODB_STATUS SHOW [ENGINE] INNODB STATUS + KILL_CONNECTION KILL + KILL_QUERY KILL QUERY + OPEN_TABLES SHOW OPEN TABLES + PROCESSLIST SHOW FULL PROCESSLIST + SHOW_MASTER_LOGS SHOW MASTER LOGS + SHOW_MASTER_STATUS SHOW MASTER STATUS + SHOW_SLAVE_STATUS SHOW SLAVE STATUS + SHOW_STATUS SHOW [GLOBAL] STATUS + SHOW_VARIABLES SHOW [GLOBAL] VARIABLES + +=head1 DATA SOURCES + +Each time innotop extracts values to create a table (see L<"EXPRESSIONS"> and +L<"TABLES">), it does so from a particular data source. Largely because of the +complex data extracted from SHOW INNODB STATUS, this is slightly messy. SHOW +INNODB STATUS contains a mixture of single values and repeated values that form +nested data sets. + +Whenever innotop fetches data from MySQL, it adds two extra bits to each set: +cxn and Uptime_hires. cxn is the name of the connection from which the data +came. Uptime_hires is a high-resolution version of the server's Uptime status +variable, which is important if your L<"interval"> setting is sub-second. + +Here are the kinds of data sources from which data is extracted: + +=over + +=item STATUS_VARIABLES + +This is the broadest category, into which the most kinds of data fall. It +begins with the combination of SHOW STATUS and SHOW VARIABLES, but other sources +may be included as needed, for example, SHOW MASTER STATUS and SHOW SLAVE +STATUS, as well as many of the non-repeated values from SHOW INNODB STATUS. + +=item DEADLOCK_LOCKS + +This data is extracted from the transaction list in the LATEST DETECTED DEADLOCK +section of SHOW INNODB STATUS. It is nested two levels deep: transactions, then +locks. + +=item DEADLOCK_TRANSACTIONS + +This data is from the transaction list in the LATEST DETECTED DEADLOCK +section of SHOW INNODB STATUS. It is nested one level deep. + +=item EXPLAIN + +This data is from the result set returned by EXPLAIN. + +=item INNODB_TRANSACTIONS + +This data is from the TRANSACTIONS section of SHOW INNODB STATUS. + +=item IO_THREADS + +This data is from the list of threads in the the FILE I/O section of SHOW INNODB +STATUS. + +=item INNODB_LOCKS + +This data is from the TRANSACTIONS section of SHOW INNODB STATUS and is nested +two levels deep. + +=item OPEN_TABLES + +This data is from SHOW OPEN TABLES. + +=item PROCESSLIST + +This data is from SHOW FULL PROCESSLIST. + +=item OS_WAIT_ARRAY + +This data is from the SEMAPHORES section of SHOW INNODB STATUS and is nested one +level deep. It comes from the lines that look like this: + + --Thread 1568861104 has waited at btr0cur.c line 424 .... + +=back + +=head1 MYSQL PRIVILEGES + +=over + +=item * + +You must connect to MySQL as a user who has the SUPER privilege for many of the +functions. + +=item * + +If you don't have the SUPER privilege, you can still run some functions, but you +won't necessarily see all the same data. + +=item * + +You need the PROCESS privilege to see the list of currently running queries in Q +mode. + +=item * + +You need special privileges to start and stop slave servers. + +=item * + +You need appropriate privileges to create and drop the deadlock tables if needed +(see L<"SERVER CONNECTIONS">). + +=back + +=head1 SYSTEM REQUIREMENTS + +You need Perl to run innotop, of course. You also need a few Perl modules: DBI, +DBD::mysql, Term::ReadKey, and Time::HiRes. These should be included with most +Perl distributions, but in case they are not, I recommend using versions +distributed with your operating system or Perl distribution, not from CPAN. +Term::ReadKey in particular has been known to cause problems if installed from +CPAN. + +If you have Term::ANSIColor, innotop will use it to format headers more readably +and compactly. (Under Microsoft Windows, you also need Win32::Console::ANSI for +terminal formatting codes to be honored). If you install Term::ReadLine, +preferably Term::ReadLine::Gnu, you'll get nice auto-completion support. + +I run innotop on Gentoo GNU/Linux, Debian and Ubuntu, and I've had feedback from +people successfully running it on Red Hat, CentOS, Solaris, and Mac OSX. I +don't see any reason why it won't work on other UNIX-ish operating systems, but +I don't know for sure. It also runs on Windows under ActivePerl without +problem. + +I use innotop on MySQL versions 3.23.58, 4.0.27, 4.1.0, 4.1.22, 5.0.26, 5.1.15, +and 5.2.3. If it doesn't run correctly for you, that is a bug and I hope you +report it. + +=head1 FILES + +$HOMEDIR/.innotop is used to store configuration information. Files include the +configuration file innotop.ini, the core_dump file which contains verbose error +messages if L<"debug"> is enabled, and the plugins/ subdirectory. + +=head1 GLOSSARY OF TERMS + +=over + +=item tick + +A tick is a refresh event, when innotop re-fetches data from connections and +displays it. + +=back + +=head1 ACKNOWLEDGEMENTS + +I'm grateful to the following people for various reasons, and hope I haven't +forgotten to include anyone: + +Allen K. Smith, +Aurimas Mikalauskas, +Bartosz Fenski, +Brian Miezejewski, +Christian Hammers, +Cyril Scetbon, +Dane Miller, +David Multer, +Dr. Frank Ullrich, +Giuseppe Maxia, +Google.com Site Reliability Engineers, +Jan Pieter Kunst, +Jari Aalto, +Jay Pipes, +Jeremy Zawodny, +Johan Idren, +Kristian Kohntopp, +Lenz Grimmer, +Maciej Dobrzanski, +Michiel Betel, +MySQL AB, +Paul McCullagh, +Sebastien Estienne, +Sourceforge.net, +Steven Kreuzer, +The Gentoo MySQL Team, +Trevor Price, +Yaar Schnitman, +and probably more people I've neglected to include. + +(If I misspelled your name, it's probably because I'm afraid of putting +international characters into this documentation; earlier versions of Perl might +not be able to compile it then). + +=head1 COPYRIGHT, LICENSE AND WARRANTY + +This program is copyright (c) 2006 Baron Schwartz. +Feedback and improvements are welcome. + +THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation, version 2; OR the Perl Artistic License. On UNIX and similar +systems, you can issue `man perlgpl' or `man perlartistic' to read these +licenses. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, MA 02111-1307 USA. + +Execute innotop and press '!' to see this information at any time. + +=head1 AUTHOR + +Baron Schwartz. + +=head1 BUGS + +You can report bugs, ask for improvements, and get other help and support at +L<http://sourceforge.net/projects/innotop>. There are mailing lists, forums, +a bug tracker, etc. Please use these instead of contacting me directly, as it +makes my job easier and benefits others if the discussions are permanent and +public. Of course, if you need to contact me in private, please do. + +=cut diff --git a/storage/xtradb/build/debian/additions/innotop/innotop.1 b/storage/xtradb/build/debian/additions/innotop/innotop.1 new file mode 100644 index 00000000000..ef708c3974c --- /dev/null +++ b/storage/xtradb/build/debian/additions/innotop/innotop.1 @@ -0,0 +1,2086 @@ +.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. \*(C+ will +.\" give a nicer C++. Capital omega is used to do unbreakable dashes and +.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, +.\" nothing in troff, for use with C<>. +.tr \(*W- +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.hy 0 +.if n .na +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "INNOTOP 1p" +.TH INNOTOP 1p "2007-11-09" "perl v5.8.8" "User Contributed Perl Documentation" +.SH "NAME" +innotop \- MySQL and InnoDB transaction/status monitor. +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +To monitor servers normally: +.PP +.Vb 1 +\& innotop +.Ve +.PP +To monitor InnoDB status information from a file: +.PP +.Vb 1 +\& innotop /var/log/mysql/mysqld.err +.Ve +.PP +To run innotop non-interactively in a pipe-and-filter configuration: +.PP +.Vb 1 +\& innotop \-\-count 5 \-d 1 \-n +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +innotop monitors MySQL servers. Each of its modes shows you a different aspect +of what's happening in the server. For example, there's a mode for monitoring +replication, one for queries, and one for transactions. innotop refreshes its +data periodically, so you see an updating view. +.PP +innotop has lots of features for power users, but you can start and run it with +virtually no configuration. If you're just getting started, see +\&\*(L"\s-1QUICK\-START\s0\*(R". Press '?' at any time while running innotop for +context-sensitive help. +.SH "QUICK-START" +.IX Header "QUICK-START" +To start innotop, open a terminal or command prompt. If you have installed +innotop on your system, you should be able to just type \*(L"innotop\*(R" and press +Enter; otherwise, you will need to change to innotop's directory and type \*(L"perl +innotop\*(R". +.PP +The first thing innotop needs to know is how to connect to a MySQL server. You +can just enter the hostname of the server, for example \*(L"localhost\*(R" or +\&\*(L"127.0.0.1\*(R" if the server is on the same machine as innotop. After this innotop +will prompt you for a \s-1DSN\s0 (data source name). You should be able to just accept +the defaults by pressing Enter. +.PP +When innotop asks you about a table to use when resetting InnoDB deadlock +information, just accept the default for now. This is an advanced feature you +can configure later (see \*(L"D: InnoDB Deadlocks\*(R" for more). +.PP +If you have a .my.cnf file with your MySQL connection defaults, innotop can read +it, and you won't need to specify a username and password if it's in that file. +Otherwise, you should answer 'y' to the next couple of prompts. +.PP +After this, you should be connected, and innotop should show you something like +the following: +.PP +.Vb 1 +\& InnoDB Txns (? for help) localhost, 01:11:19, InnoDB 10s :\-), 50 QPS, +.Ve +.PP +.Vb 2 +\& CXN History Versions Undo Dirty Buf Used Bufs Txns MaxTxn +\& localhost 7 2035 0 0 0.00% 92.19% 1 07:34 +.Ve +.PP +.Vb 5 +\& CXN ID User Host Txn Status Time Undo Query Tex +\& localhost 98379 user1 webserver ACTIVE 07:34 0 SELECT `c +\& localhost 98450 user1 webserver ACTIVE 01:06 0 INSERT IN +\& localhost 97750 user1 webserver not starte 00:00 0 +\& localhost 98375 user1 appserver not starte 00:00 0 +.Ve +.PP +(This sample is truncated at the right so it will fit on a terminal when running +\&'man innotop') +.PP +This sample comes from a quiet server with few transactions active. If your +server is busy, you'll see more output. Notice the first line on the screen, +which tells you what mode you're in and what server you're connected to. You +can change to other modes with keystrokes; press 'Q' to switch to a list of +currently running queries. +.PP +Press the '?' key to see what keys are active in the current mode. You can +press any of these keys and innotop will either take the requested action or +prompt you for more input. If your system has Term::ReadLine support, you can +use \s-1TAB\s0 and other keys to auto-complete and edit input. +.PP +To quit innotop, press the 'q' key. +.SH "OPTIONS" +.IX Header "OPTIONS" +innotop is mostly configured via its configuration file, but some of the +configuration options can come from the command line. You can also specify a +file to monitor for InnoDB status output; see \*(L"\s-1MONITORING\s0 A \s-1FILE\s0\*(R" for more +details. +.PP +You can negate some options by prefixing the option name with \-\-no. For +example, \-\-noinc (or \-\-no\-inc) negates \*(L"\-\-inc\*(R". +.IP "\-\-help" 4 +.IX Item "--help" +Print a summary of command-line usage and exit. +.IP "\-\-color" 4 +.IX Item "--color" +Enable or disable terminal coloring. Corresponds to the \*(L"color\*(R" config file +setting. +.IP "\-\-config" 4 +.IX Item "--config" +Specifies a configuration file to read. This option is non\-sticky, that is to +say it does not persist to the configuration file itself. +.IP "\-\-nonint" 4 +.IX Item "--nonint" +Enable non-interactive operation. See \*(L"\s-1NON\-INTERACTIVE\s0 \s-1OPERATION\s0\*(R" for more. +.IP "\-\-count" 4 +.IX Item "--count" +Refresh only the specified number of times (ticks) before exiting. Each refresh +is a pause for \*(L"interval\*(R" seconds, followed by requesting data from MySQL +connections and printing it to the terminal. +.IP "\-\-delay" 4 +.IX Item "--delay" +Specifies the amount of time to pause between ticks (refreshes). Corresponds to +the configuration option \*(L"interval\*(R". +.IP "\-\-mode" 4 +.IX Item "--mode" +Specifies the mode in which innotop should start. Corresponds to the +configuration option \*(L"mode\*(R". +.IP "\-\-inc" 4 +.IX Item "--inc" +Specifies whether innotop should display absolute numbers or relative numbers +(offsets from their previous values). Corresponds to the configuration option +\&\*(L"status_inc\*(R". +.IP "\-\-version" 4 +.IX Item "--version" +Output version information and exit. +.SH "HOTKEYS" +.IX Header "HOTKEYS" +innotop is interactive, and you control it with key\-presses. +.IP "\(bu" 4 +Uppercase keys switch between modes. +.IP "\(bu" 4 +Lowercase keys initiate some action within the current mode. +.IP "\(bu" 4 +Other keys do something special like change configuration or show the +innotop license. +.PP +Press '?' at any time to see the currently active keys and what they do. +.SH "MODES" +.IX Header "MODES" +Each of innotop's modes retrieves and displays a particular type of data from +the servers you're monitoring. You switch between modes with uppercase keys. +The following is a brief description of each mode, in alphabetical order. To +switch to the mode, press the key listed in front of its heading in the +following list: +.IP "B: InnoDB Buffers" 4 +.IX Item "B: InnoDB Buffers" +This mode displays information about the InnoDB buffer pool, page statistics, +insert buffer, and adaptive hash index. The data comes from \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0. +.Sp +This mode contains the \*(L"buffer_pool\*(R", \*(L"page_statistics\*(R", +\&\*(L"insert_buffers\*(R", and \*(L"adaptive_hash_index\*(R" tables by default. +.IP "C: Command Summary" 4 +.IX Item "C: Command Summary" +This mode is similar to mytop's Command Summary mode. It shows the +\&\*(L"cmd_summary\*(R" table, which looks something like the following: +.Sp +.Vb 8 +\& Command Summary (? for help) localhost, 25+07:16:43, 2.45 QPS, 3 thd, 5.0.40 +\& _____________________ Command Summary _____________________ +\& Name Value Pct Last Incr Pct +\& Select_scan 3244858 69.89% 2 100.00% +\& Select_range 1354177 29.17% 0 0.00% +\& Select_full_join 39479 0.85% 0 0.00% +\& Select_full_range_join 4097 0.09% 0 0.00% +\& Select_range_check 0 0.00% 0 0.00% +.Ve +.Sp +The command summary table is built by extracting variables from +\&\*(L"\s-1STATUS_VARIABLES\s0\*(R". The variables must be numeric and must match the prefix +given by the \*(L"cmd_filter\*(R" configuration variable. The variables are then +sorted by value descending and compared to the last variable, as shown above. +The percentage columns are percentage of the total of all variables in the +table, so you can see the relative weight of the variables. +.Sp +The example shows what you see if the prefix is \*(L"Select_\*(R". The default +prefix is \*(L"Com_\*(R". You can choose a prefix with the 's' key. +.Sp +It's rather like running \s-1SHOW\s0 \s-1VARIABLES\s0 \s-1LIKE\s0 \*(L"prefix%\*(R" with memory and +nice formatting. +.Sp +Values are aggregated across all servers. The Pct columns are not correctly +aggregated across multiple servers. This is a known limitation of the grouping +algorithm that may be fixed in the future. +.IP "D: InnoDB Deadlocks" 4 +.IX Item "D: InnoDB Deadlocks" +This mode shows the transactions involved in the last InnoDB deadlock. A second +table shows the locks each transaction held and waited for. A deadlock is +caused by a cycle in the waits-for graph, so there should be two locks held and +one waited for unless the deadlock information is truncated. +.Sp +InnoDB puts deadlock information before some other information in the \s-1SHOW\s0 +\&\s-1INNODB\s0 \s-1STATUS\s0 output. If there are a lot of locks, the deadlock information can +grow very large, and there is a limit on the size of the \s-1SHOW\s0 \s-1INNODB\s0 +\&\s-1STATUS\s0 output. A large deadlock can fill the entire output, or even be +truncated, and prevent you from seeing other information at all. If you are +running innotop in another mode, for example T mode, and suddenly you don't see +anything, you might want to check and see if a deadlock has wiped out the data +you need. +.Sp +If it has, you can create a small deadlock to replace the large one. Use the +\&'w' key to 'wipe' the large deadlock with a small one. This will not work +unless you have defined a deadlock table for the connection (see \*(L"\s-1SERVER\s0 \s-1CONNECTIONS\s0\*(R"). +.Sp +You can also configure innotop to automatically detect when a large deadlock +needs to be replaced with a small one (see \*(L"auto_wipe_dl\*(R"). +.Sp +This mode displays the \*(L"deadlock_transactions\*(R" and \*(L"deadlock_locks\*(R" tables +by default. +.IP "F: InnoDB Foreign Key Errors" 4 +.IX Item "F: InnoDB Foreign Key Errors" +This mode shows the last InnoDB foreign key error information, such as the +table where it happened, when and who and what query caused it, and so on. +.Sp +InnoDB has a huge variety of foreign key error messages, and many of them are +just hard to parse. innotop doesn't always do the best job here, but there's +so much code devoted to parsing this messy, unparseable output that innotop is +likely never to be perfect in this regard. If innotop doesn't show you what +you need to see, just look at the status text directly. +.Sp +This mode displays the \*(L"fk_error\*(R" table by default. +.IP "I: InnoDB I/O Info" 4 +.IX Item "I: InnoDB I/O Info" +This mode shows InnoDB's I/O statistics, including the I/O threads, pending I/O, +file I/O miscellaneous, and log statistics. It displays the \*(L"io_threads\*(R", +\&\*(L"pending_io\*(R", \*(L"file_io_misc\*(R", and \*(L"log_statistics\*(R" tables by default. +.IP "L: Locks" 4 +.IX Item "L: Locks" +This mode shows information about current locks. At the moment only InnoDB +locks are supported, and by default you'll only see locks for which transactions +are waiting. This information comes from the \s-1TRANSACTIONS\s0 section of the InnoDB +status text. If you have a very busy server, you may have frequent lock waits; +it helps to be able to see which tables and indexes are the \*(L"hot spot\*(R" for +locks. If your server is running pretty well, this mode should show nothing. +.Sp +You can configure MySQL and innotop to monitor not only locks for which a +transaction is waiting, but those currently held, too. You can do this with the +InnoDB Lock Monitor (<http://dev.mysql.com/doc/en/innodb\-monitor.html>). It's +not documented in the MySQL manual, but creating the lock monitor with the +following statement also affects the output of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0, which innotop +uses: +.Sp +.Vb 1 +\& CREATE TABLE innodb_lock_monitor(a int) ENGINE=INNODB; +.Ve +.Sp +This causes InnoDB to print its output to the MySQL file every 16 seconds or so, +as stated in the manual, but it also makes the normal \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0 output +include lock information, which innotop can parse and display (that's the +undocumented feature). +.Sp +This means you can do what may have seemed impossible: to a limited extent +(InnoDB truncates some information in the output), you can see which transaction +holds the locks something else is waiting for. You can also enable and disable +the InnoDB Lock Monitor with the key mappings in this mode. +.Sp +This mode displays the \*(L"innodb_locks\*(R" table by default. Here's a sample of +the screen when one connection is waiting for locks another connection holds: +.Sp +.Vb 7 +\& _________________________________ InnoDB Locks __________________________ +\& CXN ID Type Waiting Wait Active Mode DB Table Index +\& localhost 12 RECORD 1 00:10 00:10 X test t1 PRIMARY +\& localhost 12 TABLE 0 00:10 00:10 IX test t1 +\& localhost 12 RECORD 1 00:10 00:10 X test t1 PRIMARY +\& localhost 11 TABLE 0 00:00 00:25 IX test t1 +\& localhost 11 RECORD 0 00:00 00:25 X test t1 PRIMARY +.Ve +.Sp +You can see the first connection, \s-1ID\s0 12, is waiting for a lock on the \s-1PRIMARY\s0 +key on test.t1, and has been waiting for 10 seconds. The second connection +isn't waiting, because the Waiting column is 0, but it holds locks on the same +index. That tells you connection 11 is blocking connection 12. +.IP "M: Master/Slave Replication Status" 4 +.IX Item "M: Master/Slave Replication Status" +This mode shows the output of \s-1SHOW\s0 \s-1SLAVE\s0 \s-1STATUS\s0 and \s-1SHOW\s0 \s-1MASTER\s0 \s-1STATUS\s0 in three +tables. The first two divide the slave's status into \s-1SQL\s0 and I/O thread status, +and the last shows master status. Filters are applied to eliminate non-slave +servers from the slave tables, and non-master servers from the master table. +.Sp +This mode displays the \*(L"slave_sql_status\*(R", \*(L"slave_io_status\*(R", and +\&\*(L"master_status\*(R" tables by default. +.IP "O: Open Tables" 4 +.IX Item "O: Open Tables" +This section comes from MySQL's \s-1SHOW\s0 \s-1OPEN\s0 \s-1TABLES\s0 command. By default it is +filtered to show tables which are in use by one or more queries, so you can +get a quick look at which tables are 'hot'. You can use this to guess which +tables might be locked implicitly. +.Sp +This mode displays the \*(L"open_tables\*(R" mode by default. +.IP "Q: Query List" 4 +.IX Item "Q: Query List" +This mode displays the output from \s-1SHOW\s0 \s-1FULL\s0 \s-1PROCESSLIST\s0, much like \fBmytop\fR's +query list mode. This mode does \fBnot\fR show InnoDB-related information. This +is probably one of the most useful modes for general usage. +.Sp +There is an informative header that shows general status information about +your server. You can toggle it on and off with the 'h' key. By default, +innotop hides inactive processes and its own process. You can toggle these on +and off with the 'i' and 'a' keys. +.Sp +You can \s-1EXPLAIN\s0 a query from this mode with the 'e' key. This displays the +query's full text, the results of \s-1EXPLAIN\s0, and in newer MySQL versions, even +the optimized query resulting from \s-1EXPLAIN\s0 \s-1EXTENDED\s0. innotop also tries to +rewrite certain queries to make them EXPLAIN\-able. For example, \s-1INSERT/SELECT\s0 +statements are rewritable. +.Sp +This mode displays the \*(L"q_header\*(R" and \*(L"processlist\*(R" tables by default. +.IP "R: InnoDB Row Operations and Semaphores" 4 +.IX Item "R: InnoDB Row Operations and Semaphores" +This mode shows InnoDB row operations, row operation miscellaneous, semaphores, +and information from the wait array. It displays the \*(L"row_operations\*(R", +\&\*(L"row_operation_misc\*(R", \*(L"semaphores\*(R", and \*(L"wait_array\*(R" tables by default. +.IP "S: Variables & Status" 4 +.IX Item "S: Variables & Status" +This mode calculates statistics, such as queries per second, and prints them out +in several different styles. You can show absolute values, or incremental values +between ticks. +.Sp +You can switch between the views by pressing a key. The 's' key prints a +single line each time the screen updates, in the style of \fBvmstat\fR. The 'g' +key changes the view to a graph of the same numbers, sort of like \fBtload\fR. +The 'v' key changes the view to a pivoted table of variable names on the left, +with successive updates scrolling across the screen from left to right. You can +choose how many updates to put on the screen with the \*(L"num_status_sets\*(R" +configuration variable. +.Sp +Headers may be abbreviated to fit on the screen in interactive operation. You +choose which variables to display with the 'c' key, which selects from +predefined sets, or lets you create your own sets. You can edit the current set +with the 'e' key. +.Sp +This mode doesn't really display any tables like other modes. Instead, it uses +a table definition to extract and format the data, but it then transforms the +result in special ways before outputting it. It uses the \*(L"var_status\*(R" table +definition for this. +.IP "T: InnoDB Transactions" 4 +.IX Item "T: InnoDB Transactions" +This mode shows transactions from the InnoDB monitor's output, in \fBtop\fR\-like +format. This mode is the reason I wrote innotop. +.Sp +You can kill queries or processes with the 'k' and 'x' keys, and \s-1EXPLAIN\s0 a query +with the 'e' or 'f' keys. InnoDB doesn't print the full query in transactions, +so explaining may not work right if the query is truncated. +.Sp +The informational header can be toggled on and off with the 'h' key. By +default, innotop hides inactive transactions and its own transaction. You can +toggle this on and off with the 'i' and 'a' keys. +.Sp +This mode displays the \*(L"t_header\*(R" and \*(L"innodb_transactions\*(R" tables by +default. +.SH "INNOTOP STATUS" +.IX Header "INNOTOP STATUS" +The first line innotop displays is a \*(L"status bar\*(R" of sorts. What it contains +depends on the mode you're in, and what servers you're monitoring. The first +few words are always the innotop mode, such as \*(L"InnoDB Txns\*(R" for T mode, +followed by a reminder to press '?' for help at any time. +.Sh "\s-1ONE\s0 \s-1SERVER\s0" +.IX Subsection "ONE SERVER" +The simplest case is when you're monitoring a single server. In this case, the +name of the connection is next on the status line. This is the name you gave +when you created the connection \*(-- most likely the MySQL server's hostname. +This is followed by the server's uptime. +.PP +If you're in an InnoDB mode, such as T or B, the next word is \*(L"InnoDB\*(R" followed +by some information about the \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0 output used to render the +screen. The first word is the number of seconds since the last \s-1SHOW\s0 \s-1INNODB\s0 +\&\s-1STATUS\s0, which InnoDB uses to calculate some per-second statistics. The next is +a smiley face indicating whether the InnoDB output is truncated. If the smiley +face is a :\-), all is well; there is no truncation. A :^| means the transaction +list is so long, InnoDB has only printed out some of the transactions. Finally, +a frown :\-( means the output is incomplete, which is probably due to a deadlock +printing too much lock information (see \*(L"D: InnoDB Deadlocks\*(R"). +.PP +The next two words indicate the server's queries per second (\s-1QPS\s0) and how many +threads (connections) exist. Finally, the server's version number is the last +thing on the line. +.Sh "\s-1MULTIPLE\s0 \s-1SERVERS\s0" +.IX Subsection "MULTIPLE SERVERS" +If you are monitoring multiple servers (see \*(L"\s-1SERVER\s0 \s-1CONNECTIONS\s0\*(R"), the status +line does not show any details about individual servers. Instead, it shows the +names of the connections that are active. Again, these are connection names you +specified, which are likely to be the server's hostname. A connection that has +an error is prefixed with an exclamation point. +.PP +If you are monitoring a group of servers (see \*(L"\s-1SERVER\s0 \s-1GROUPS\s0\*(R"), the status +line shows the name of the group. If any connection in the group has an +error, the group's name is followed by the fraction of the connections that +don't have errors. +.PP +See \*(L"\s-1ERROR\s0 \s-1HANDLING\s0\*(R" for more details about innotop's error handling. +.Sh "\s-1MONITORING\s0 A \s-1FILE\s0" +.IX Subsection "MONITORING A FILE" +If you give a filename on the command line, innotop will not connect to \s-1ANY\s0 +servers at all. It will watch the specified file for InnoDB status output and +use that as its data source. It will always show a single connection called +\&'file'. And since it can't connect to a server, it can't determine how long the +server it's monitoring has been up; so it calculates the server's uptime as time +since innotop started running. +.SH "SERVER ADMINISTRATION" +.IX Header "SERVER ADMINISTRATION" +While innotop is primarily a monitor that lets you watch and analyze your +servers, it can also send commands to servers. The most frequently useful +commands are killing queries and stopping or starting slaves. +.PP +You can kill a connection, or in newer versions of MySQL kill a query but not a +connection, from \*(L"Q: Query List\*(R" and \*(L"T: InnoDB Transactions\*(R" modes. +Press 'k' to issue a \s-1KILL\s0 command, or 'x' to issue a \s-1KILL\s0 \s-1QUERY\s0 command. +innotop will prompt you for the server and/or connection \s-1ID\s0 to kill (innotop +does not prompt you if there is only one possible choice for any input). +innotop pre-selects the longest-running query, or the oldest connection. +Confirm the command with 'y'. +.PP +In \*(L"M: Master/Slave Replication Status\*(R" mode, you can start and stop slaves +with the 'a' and 'o' keys, respectively. You can send these commands to many +slaves at once. innotop fills in a default command of \s-1START\s0 \s-1SLAVE\s0 or \s-1STOP\s0 \s-1SLAVE\s0 +for you, but you can actually edit the command and send anything you wish, such +as \s-1SET\s0 \s-1GLOBAL\s0 SQL_SLAVE_SKIP_COUNTER=1 to make the slave skip one binlog event +when it starts. +.PP +You can also ask innotop to calculate the earliest binlog in use by any slave +and issue a \s-1PURGE\s0 \s-1MASTER\s0 \s-1LOGS\s0 on the master. Use the 'b' key for this. innotop +will prompt you for a master to run the command on, then prompt you for the +connection names of that master's slaves (there is no way for innotop to +determine this reliably itself). innotop will find the minimum binlog in use by +these slave connections and suggest it as the argument to \s-1PURGE\s0 \s-1MASTER\s0 \s-1LOGS\s0. +.SH "SERVER CONNECTIONS" +.IX Header "SERVER CONNECTIONS" +When you create a server connection, innotop asks you for a series of inputs, as +follows: +.IP "\s-1DSN\s0" 4 +.IX Item "DSN" +A \s-1DSN\s0 is a Data Source Name, which is the initial argument passed to the \s-1DBI\s0 +module for connecting to a server. It is usually of the form +.Sp +.Vb 1 +\& DBI:mysql:;mysql_read_default_group=mysql;host=HOSTNAME +.Ve +.Sp +Since this \s-1DSN\s0 is passed to the DBD::mysql driver, you should read the driver's +documentation at \*(L"http://search.cpan.org/dist/DBD\-mysql/lib/DBD/mysql.pm\*(R" for +the exact details on all the options you can pass the driver in the \s-1DSN\s0. You +can read more about \s-1DBI\s0 at <http://dbi.perl.org/docs/>, and especially at +<http://search.cpan.org/~timb/DBI/DBI.pm>. +.Sp +The mysql_read_default_group=mysql option lets the \s-1DBD\s0 driver read your MySQL +options files, such as ~/.my.cnf on UNIX-ish systems. You can use this to avoid +specifying a username or password for the connection. +.IP "InnoDB Deadlock Table" 4 +.IX Item "InnoDB Deadlock Table" +This optional item tells innotop a table name it can use to deliberately create +a small deadlock (see \*(L"D: InnoDB Deadlocks\*(R"). If you specify this option, +you just need to be sure the table doesn't exist, and that innotop can create +and drop the table with the InnoDB storage engine. You can safely omit or just +accept the default if you don't intend to use this. +.IP "Username" 4 +.IX Item "Username" +innotop will ask you if you want to specify a username. If you say 'y', it will +then prompt you for a user name. If you have a MySQL option file that specifies +your username, you don't have to specify a username. +.Sp +The username defaults to your login name on the system you're running innotop on. +.IP "Password" 4 +.IX Item "Password" +innotop will ask you if you want to specify a password. Like the username, the +password is optional, but there's an additional prompt that asks if you want to +save the password in the innotop configuration file. If you don't save it in +the configuration file, innotop will prompt you for a password each time it +starts. Passwords in the innotop configuration file are saved in plain text, +not encrypted in any way. +.PP +Once you finish answering these questions, you should be connected to a server. +But innotop isn't limited to monitoring a single server; you can define many +server connections and switch between them by pressing the '@' key. See +\&\*(L"\s-1SWITCHING\s0 \s-1BETWEEN\s0 \s-1CONNECTIONS\s0\*(R". +.PP +To create a new connection, press the '@' key and type the name of the new +connection, then follow the steps given above. +.SH "SERVER GROUPS" +.IX Header "SERVER GROUPS" +If you have multiple MySQL instances, you can put them into named groups, such +as 'all', 'masters', and 'slaves', which innotop can monitor all together. +.PP +You can choose which group to monitor with the '#' key, and you can press the +\&\s-1TAB\s0 key to switch to the next group. If you're not currently monitoring a +group, pressing \s-1TAB\s0 selects the first group. +.PP +To create a group, press the '#' key and type the name of your new group, then +type the names of the connections you want the group to contain. +.SH "SWITCHING BETWEEN CONNECTIONS" +.IX Header "SWITCHING BETWEEN CONNECTIONS" +innotop lets you quickly switch which servers you're monitoring. The most basic +way is by pressing the '@' key and typing the name(s) of the connection(s) you +want to use. This setting is per\-mode, so you can monitor different connections +in each mode, and innotop remembers which connections you choose. +.PP +You can quickly switch to the 'next' connection in alphabetical order with the +\&'n' key. If you're monitoring a server group (see \*(L"\s-1SERVER\s0 \s-1GROUPS\s0\*(R") this will +switch to the first connection. +.PP +You can also type many connection names, and innotop will fetch and display data +from them all. Just separate the connection names with spaces, for example +\&\*(L"server1 server2.\*(R" Again, if you type the name of a connection that doesn't +exist, innotop will prompt you for connection information and create the +connection. +.PP +Another way to monitor multiple connections at once is with server groups. You +can use the \s-1TAB\s0 key to switch to the 'next' group in alphabetical order, or if +you're not monitoring any groups, \s-1TAB\s0 will switch to the first group. +.PP +innotop does not fetch data in parallel from connections, so if you are +monitoring a large group or many connections, you may notice increased delay +between ticks. +.PP +When you monitor more than one connection, innotop's status bar changes. See +\&\*(L"\s-1INNOTOP\s0 \s-1STATUS\s0\*(R". +.SH "ERROR HANDLING" +.IX Header "ERROR HANDLING" +Error handling is not that important when monitoring a single connection, but is +crucial when you have many active connections. A crashed server or lost +connection should not crash innotop. As a result, innotop will continue to run +even when there is an error; it just won't display any information from the +connection that had an error. Because of this, innotop's behavior might confuse +you. It's a feature, not a bug! +.PP +innotop does not continue to query connections that have errors, because they +may slow innotop and make it hard to use, especially if the error is a problem +connecting and causes a long time\-out. Instead, innotop retries the connection +occasionally to see if the error still exists. If so, it will wait until some +point in the future. The wait time increases in ticks as the Fibonacci series, +so it tries less frequently as time passes. +.PP +Since errors might only happen in certain modes because of the \s-1SQL\s0 commands +issued in those modes, innotop keeps track of which mode caused the error. If +you switch to a different mode, innotop will retry the connection instead of +waiting. +.PP +By default innotop will display the problem in red text at the bottom of the +first table on the screen. You can disable this behavior with the +\&\*(L"show_cxn_errors_in_tbl\*(R" configuration option, which is enabled by default. +If the \*(L"debug\*(R" option is enabled, innotop will display the error at the +bottom of every table, not just the first. And if \*(L"show_cxn_errors\*(R" is +enabled, innotop will print the error text to \s-1STDOUT\s0 as well. Error messages +might only display in the mode that caused the error, depending on the mode and +whether innotop is avoiding querying that connection. +.SH "NON-INTERACTIVE OPERATION" +.IX Header "NON-INTERACTIVE OPERATION" +You can run innotop in non-interactive mode, in which case it is entirely +controlled from the configuration file and command-line options. To start +innotop in non-interactive mode, give the L\*(L"<\-\-nonint\*(R"> command-line option. +This changes innotop's behavior in the following ways: +.IP "\(bu" 4 +Certain Perl modules are not loaded. Term::Readline is not loaded, since +innotop doesn't prompt interactively. Term::ANSIColor and Win32::Console::ANSI +modules are not loaded. Term::ReadKey is still used, since innotop may have to +prompt for connection passwords when starting up. +.IP "\(bu" 4 +innotop does not clear the screen after each tick. +.IP "\(bu" 4 +innotop does not persist any changes to the configuration file. +.IP "\(bu" 4 +If \*(L"\-\-count\*(R" is given and innotop is in incremental mode (see \*(L"status_inc\*(R" +and \*(L"\-\-inc\*(R"), innotop actually refreshes one more time than specified so it +can print incremental statistics. This suppresses output during the first +tick, so innotop may appear to hang. +.IP "\(bu" 4 +innotop only displays the first table in each mode. This is so the output can +be easily processed with other command-line utilities such as awk and sed. To +change which tables display in each mode, see \*(L"\s-1TABLES\s0\*(R". Since \*(L"Q: Query List\*(R" mode is so important, innotop automatically disables the \*(L"q_header\*(R" +table. This ensures you'll see the \*(L"processlist\*(R" table, even if you have +innotop configured to show the q_header table during interactive operation. +Similarly, in \*(L"T: InnoDB Transactions\*(R" mode, the \*(L"t_header\*(R" table is +suppressed so you see only the \*(L"innodb_transactions\*(R" table. +.IP "\(bu" 4 +All output is tab-separated instead of being column-aligned with whitespace, and +innotop prints the full contents of each table instead of only printing one +screenful at a time. +.IP "\(bu" 4 +innotop only prints column headers once instead of every tick (see +\&\*(L"hide_hdr\*(R"). innotop does not print table captions (see +\&\*(L"display_table_captions\*(R"). innotop ensures there are no empty lines in the +output. +.IP "\(bu" 4 +innotop does not honor the \*(L"shorten\*(R" transformation, which normally shortens +some numbers to human-readable formats. +.IP "\(bu" 4 +innotop does not print a status line (see \*(L"\s-1INNOTOP\s0 \s-1STATUS\s0\*(R"). +.SH "CONFIGURING" +.IX Header "CONFIGURING" +Nearly everything about innotop is configurable. Most things are possible to +change with built-in commands, but you can also edit the configuration file. +.PP +While running innotop, press the '$' key to bring up the configuration editing +dialog. Press another key to select the type of data you want to edit: +.IP "S: Statement Sleep Times" 4 +.IX Item "S: Statement Sleep Times" +Edits \s-1SQL\s0 statement sleep delays, which make innotop pause for the specified +amount of time after executing a statement. See \*(L"\s-1SQL\s0 \s-1STATEMENTS\s0\*(R" for a +definition of each statement and what it does. By default innotop does not +delay after any statements. +.Sp +This feature is included so you can customize the side-effects caused by +monitoring your server. You may not see any effects, but some innotop users +have noticed that certain MySQL versions under very high load with InnoDB +enabled take longer than usual to execute \s-1SHOW\s0 \s-1GLOBAL\s0 \s-1STATUS\s0. If innotop calls +\&\s-1SHOW\s0 \s-1FULL\s0 \s-1PROCESSLIST\s0 immediately afterward, the processlist contains more +queries than the machine actually averages at any given moment. Configuring +innotop to pause briefly after calling \s-1SHOW\s0 \s-1GLOBAL\s0 \s-1STATUS\s0 alleviates this +effect. +.Sp +Sleep times are stored in the \*(L"stmt_sleep_times\*(R" section of the configuration +file. Fractional-second sleeps are supported, subject to your hardware's +limitations. +.IP "c: Edit Columns" 4 +.IX Item "c: Edit Columns" +Starts the table editor on one of the displayed tables. See \*(L"\s-1TABLE\s0 \s-1EDITOR\s0\*(R". +An alternative way to start the table editor without entering the configuration +dialog is with the '^' key. +.IP "g: General Configuration" 4 +.IX Item "g: General Configuration" +Starts the configuration editor to edit global and mode-specific configuration +variables (see \*(L"\s-1MODES\s0\*(R"). innotop prompts you to choose a variable from among +the global and mode-specific ones depending on the current mode. +.IP "k: Row-Coloring Rules" 4 +.IX Item "k: Row-Coloring Rules" +Starts the row-coloring rules editor on one of the displayed table(s). See +\&\*(L"\s-1COLORS\s0\*(R" for details. +.IP "p: Manage Plugins" 4 +.IX Item "p: Manage Plugins" +Starts the plugin configuration editor. See \*(L"\s-1PLUGINS\s0\*(R" for details. +.IP "s: Server Groups" 4 +.IX Item "s: Server Groups" +Lets you create and edit server groups. See \*(L"\s-1SERVER\s0 \s-1GROUPS\s0\*(R". +.IP "t: Choose Displayed Tables" 4 +.IX Item "t: Choose Displayed Tables" +Lets you choose which tables to display in this mode. See \*(L"\s-1MODES\s0\*(R" and +\&\*(L"\s-1TABLES\s0\*(R". +.SH "CONFIGURATION FILE" +.IX Header "CONFIGURATION FILE" +innotop's default configuration file location is in \f(CW$HOME\fR/.innotop, but can be +overridden with the \*(L"\-\-config\*(R" command-line option. You can edit it by hand +safely. innotop reads the configuration file when it starts, and writes it out +again when it exits, so any changes you make while innotop is running will be +lost. +.PP +innotop doesn't store its entire configuration in the configuration file. It +has a huge set of default configuration that it holds only in memory, and the +configuration file only overrides these defaults. When you customize a default +setting, innotop notices, and then stores the customizations into the file. +This keeps the file size down, makes it easier to edit, and makes upgrades +easier. +.PP +A configuration file can be made read\-only. See \*(L"readonly\*(R". +.PP +The configuration file is arranged into sections like an \s-1INI\s0 file. Each +section begins with [section\-name] and ends with [/section\-name]. Each +section's entries have a different syntax depending on the data they need to +store. You can put comments in the file; any line that begins with a # +character is a comment. innotop will not read the comments, so it won't write +them back out to the file when it exits. Comments in read-only configuration +files are still useful, though. +.PP +The first line in the file is innotop's version number. This lets innotop +notice when the file format is not backwards\-compatible, and upgrade smoothly +without destroying your customized configuration. +.PP +The following list describes each section of the configuration file and the data +it contains: +.IP "general" 4 +.IX Item "general" +The 'general' section contains global configuration variables and variables that +may be mode\-specific, but don't belong in any other section. The syntax is a +simple key=value list. innotop writes a comment above each value to help you +edit the file by hand. +.RS 4 +.IP "S_func" 4 +.IX Item "S_func" +Controls S mode presentation (see \*(L"S: Variables & Status\*(R"). If g, values are +graphed; if s, values are like vmstat; if p, values are in a pivoted table. +.IP "S_set" 4 +.IX Item "S_set" +Specifies which set of variables to display in \*(L"S: Variables & Status\*(R" mode. +See \*(L"\s-1VARIABLE\s0 \s-1SETS\s0\*(R". +.IP "auto_wipe_dl" 4 +.IX Item "auto_wipe_dl" +Instructs innotop to automatically wipe large deadlocks when it notices them. +When this happens you may notice a slight delay. At the next tick, you will +usually see the information that was being truncated by the large deadlock. +.IP "charset" 4 +.IX Item "charset" +Specifies what kind of characters to allow through the \*(L"no_ctrl_char\*(R" +transformation. This keeps non-printable characters from confusing a +terminal when you monitor queries that contain binary data, such as images. +.Sp +The default is 'ascii', which considers anything outside normal \s-1ASCII\s0 to be a +control character. The other allowable values are 'unicode' and 'none'. 'none' +considers every character a control character, which can be useful for +collapsing \s-1ALL\s0 text fields in queries. +.IP "cmd_filter" 4 +.IX Item "cmd_filter" +This is the prefix that filters variables in \*(L"C: Command Summary\*(R" mode. +.IP "color" 4 +.IX Item "color" +Whether terminal coloring is permitted. +.IP "cxn_timeout" 4 +.IX Item "cxn_timeout" +On MySQL versions 4.0.3 and newer, this variable is used to set the connection's +timeout, so MySQL doesn't close the connection if it is not used for a while. +This might happen because a connection isn't monitored in a particular mode, for +example. +.IP "debug" 4 +.IX Item "debug" +This option enables more verbose errors and makes innotop more strict in some +places. It can help in debugging filters and other user-defined code. It also +makes innotop write a lot of information to \*(L"debugfile\*(R" when there is a +crash. +.IP "debugfile" 4 +.IX Item "debugfile" +A file to which innotop will write information when there is a crash. See +\&\*(L"\s-1FILES\s0\*(R". +.IP "display_table_captions" 4 +.IX Item "display_table_captions" +innotop displays a table caption above most tables. This variable suppresses or +shows captions on all tables globally. Some tables are configured with the +hide_caption property, which overrides this. +.IP "global" 4 +.IX Item "global" +Whether to show \s-1GLOBAL\s0 variables and status. innotop only tries to do this on +servers which support the \s-1GLOBAL\s0 option to \s-1SHOW\s0 \s-1VARIABLES\s0 and \s-1SHOW\s0 \s-1STATUS\s0. In +some MySQL versions, you need certain privileges to do this; if you don't have +them, innotop will not be able to fetch any variable and status data. This +configuration variable lets you run innotop and fetch what data you can even +without the elevated privileges. +.Sp +I can no longer find or reproduce the situation where \s-1GLOBAL\s0 wasn't allowed, but +I know there was one. +.IP "graph_char" 4 +.IX Item "graph_char" +Defines the character to use when drawing graphs in \*(L"S: Variables & Status\*(R" +mode. +.IP "header_highlight" 4 +.IX Item "header_highlight" +Defines how to highlight column headers. This only works if Term::ANSIColor is +available. Valid values are 'bold' and 'underline'. +.IP "hide_hdr" 4 +.IX Item "hide_hdr" +Hides column headers globally. +.IP "interval" 4 +.IX Item "interval" +The interval at which innotop will refresh its data (ticks). The interval is +implemented as a sleep time between ticks, so the true interval will vary +depending on how long it takes innotop to fetch and render data. +.Sp +This variable accepts fractions of a second. +.IP "mode" 4 +.IX Item "mode" +The mode in which innotop should start. Allowable arguments are the same as the +key presses that select a mode interactively. See \*(L"\s-1MODES\s0\*(R". +.IP "num_digits" 4 +.IX Item "num_digits" +How many digits to show in fractional numbers and percents. This variable's +range is between 0 and 9 and can be set directly from \*(L"S: Variables & Status\*(R" +mode with the '+' and '\-' keys. It is used in the \*(L"set_precision\*(R", +\&\*(L"shorten\*(R", and \*(L"percent\*(R" transformations. +.IP "num_status_sets" 4 +.IX Item "num_status_sets" +Controls how many sets of status variables to display in pivoted \*(L"S: Variables & Status\*(R" mode. It also controls the number of old sets of variables innotop +keeps in its memory, so the larger this variable is, the more memory innotop +uses. +.IP "plugin_dir" 4 +.IX Item "plugin_dir" +Specifies where plugins can be found. By default, innotop stores plugins in the +\&'plugins' subdirectory of your innotop configuration directory. +.IP "readonly" 4 +.IX Item "readonly" +Whether the configuration file is readonly. This cannot be set interactively, +because it would prevent itself from being written to the configuration file. +.IP "show_cxn_errors" 4 +.IX Item "show_cxn_errors" +Makes innotop print connection errors to \s-1STDOUT\s0. See \*(L"\s-1ERROR\s0 \s-1HANDLING\s0\*(R". +.IP "show_cxn_errors_in_tbl" 4 +.IX Item "show_cxn_errors_in_tbl" +Makes innotop display connection errors as rows in the first table on screen. +See \*(L"\s-1ERROR\s0 \s-1HANDLING\s0\*(R". +.IP "show_percent" 4 +.IX Item "show_percent" +Adds a '%' character after the value returned by the \*(L"percent\*(R" +transformation. +.IP "show_statusbar" 4 +.IX Item "show_statusbar" +Controls whether to show the status bar in the display. See \*(L"\s-1INNOTOP\s0 \s-1STATUS\s0\*(R". +.IP "skip_innodb" 4 +.IX Item "skip_innodb" +Disables fetching \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0, in case your server(s) do not have InnoDB +enabled and you don't want innotop to try to fetch it. This can also be useful +when you don't have the \s-1SUPER\s0 privilege, required to run \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0. +.IP "status_inc" 4 +.IX Item "status_inc" +Whether to show absolute or incremental values for status variables. +Incremental values are calculated as an offset from the last value innotop saw +for that variable. This is a global setting, but will probably become +mode-specific at some point. Right now it is honored a bit inconsistently; some +modes don't pay attention to it. +.RE +.RS 4 +.RE +.IP "plugins" 4 +.IX Item "plugins" +This section holds a list of package names of active plugins. If the plugin +exists, innotop will activate it. See \*(L"\s-1PLUGINS\s0\*(R" for more information. +.IP "filters" 4 +.IX Item "filters" +This section holds user-defined filters (see \*(L"\s-1FILTERS\s0\*(R"). Each line is in the +format filter_name=text='filter text' tbls='table list'. +.Sp +The filter text is the text of the subroutine's code. The table list is a list +of tables to which the filter can apply. By default, user-defined filters apply +to the table for which they were created, but you can manually override that by +editing the definition in the configuration file. +.IP "active_filters" 4 +.IX Item "active_filters" +This section stores which filters are active on each table. Each line is in the +format table_name=filter_list. +.IP "tbl_meta" 4 +.IX Item "tbl_meta" +This section stores user-defined or user-customized columns (see \*(L"\s-1COLUMNS\s0\*(R"). +Each line is in the format col_name=properties, where the properties are a +name=quoted\-value list. +.IP "connections" 4 +.IX Item "connections" +This section holds the server connections you have defined. Each line is in the +format name=properties, where the properties are a name=value list. The +properties are self\-explanatory, and the only one that is treated specially is +\&'pass' which is only present if 'savepass' is set. See \*(L"\s-1SERVER\s0 \s-1CONNECTIONS\s0\*(R". +.IP "active_connections" 4 +.IX Item "active_connections" +This section holds a list of which connections are active in each mode. Each +line is in the format mode_name=connection_list. +.IP "server_groups" 4 +.IX Item "server_groups" +This section holds server groups. Each line is in the format +name=connection_list. See \*(L"\s-1SERVER\s0 \s-1GROUPS\s0\*(R". +.IP "active_server_groups" 4 +.IX Item "active_server_groups" +This section holds a list of which server group is active in each mode. Each +line is in the format mode_name=server_group. +.IP "max_values_seen" 4 +.IX Item "max_values_seen" +This section holds the maximum values seen for variables. This is used to scale +the graphs in \*(L"S: Variables & Status\*(R" mode. Each line is in the format +name=value. +.IP "active_columns" 4 +.IX Item "active_columns" +This section holds table column lists. Each line is in the format +tbl_name=column_list. See \*(L"\s-1COLUMNS\s0\*(R". +.IP "sort_cols" 4 +.IX Item "sort_cols" +This section holds the sort definition. Each line is in the format +tbl_name=column_list. If a column is prefixed with '\-', that column sorts +descending. See \*(L"\s-1SORTING\s0\*(R". +.IP "visible_tables" 4 +.IX Item "visible_tables" +This section defines which tables are visible in each mode. Each line is in the +format mode_name=table_list. See \*(L"\s-1TABLES\s0\*(R". +.IP "varsets" 4 +.IX Item "varsets" +This section defines variable sets for use in \*(L"S: Status & Variables\*(R" mode. +Each line is in the format name=variable_list. See \*(L"\s-1VARIABLE\s0 \s-1SETS\s0\*(R". +.IP "colors" 4 +.IX Item "colors" +This section defines colorization rules. Each line is in the format +tbl_name=property_list. See \*(L"\s-1COLORS\s0\*(R". +.IP "stmt_sleep_times" 4 +.IX Item "stmt_sleep_times" +This section contains statement sleep times. Each line is in the format +statement_name=sleep_time. See \*(L"S: Statement Sleep Times\*(R". +.IP "group_by" 4 +.IX Item "group_by" +This section contains column lists for table group_by expressions. Each line is +in the format tbl_name=column_list. See \*(L"\s-1GROUPING\s0\*(R". +.SH "CUSTOMIZING" +.IX Header "CUSTOMIZING" +You can customize innotop a great deal. For example, you can: +.IP "\(bu" 4 +Choose which tables to display, and in what order. +.IP "\(bu" 4 +Choose which columns are in those tables, and create new columns. +.IP "\(bu" 4 +Filter which rows display with built-in filters, user-defined filters, and +quick\-filters. +.IP "\(bu" 4 +Sort the rows to put important data first or group together related rows. +.IP "\(bu" 4 +Highlight rows with color. +.IP "\(bu" 4 +Customize the alignment, width, and formatting of columns, and apply +transformations to columns to extract parts of their values or format the values +as you wish (for example, shortening large numbers to familiar units). +.IP "\(bu" 4 +Design your own expressions to extract and combine data as you need. This gives +you unlimited flexibility. +.PP +All these and more are explained in the following sections. +.Sh "\s-1TABLES\s0" +.IX Subsection "TABLES" +A table is what you'd expect: a collection of columns. It also has some other +properties, such as a caption. Filters, sorting rules, and colorization rules +belong to tables and are covered in later sections. +.PP +Internally, table meta-data is defined in a data structure called \f(CW%tbl_meta\fR. +This hash holds all built-in table definitions, which contain a lot of default +instructions to innotop. The meta-data includes the caption, a list of columns +the user has customized, a list of columns, a list of visible columns, a list of +filters, color rules, a sort-column list, sort direction, and some information +about the table's data sources. Most of this is customizable via the table +editor (see \*(L"\s-1TABLE\s0 \s-1EDITOR\s0\*(R"). +.PP +You can choose which tables to show by pressing the '$' key. See \*(L"\s-1MODES\s0\*(R" and +\&\*(L"\s-1TABLES\s0\*(R". +.PP +The table life-cycle is as follows: +.IP "\(bu" 4 +Each table begins with a data source, which is an array of hashes. See below +for details on data sources. +.IP "\(bu" 4 +Each element of the data source becomes a row in the final table. +.IP "\(bu" 4 +For each element in the data source, innotop extracts values from the source and +creates a row. This row is another hash, which later steps will refer to as +\&\f(CW$set\fR. The values innotop extracts are determined by the table's columns. Each +column has an extraction subroutine, compiled from an expression (see +\&\*(L"\s-1EXPRESSIONS\s0\*(R"). The resulting row is a hash whose keys are named the same as +the column name. +.IP "\(bu" 4 +innotop filters the rows, removing those that don't need to be displayed. See +\&\*(L"\s-1FILTERS\s0\*(R". +.IP "\(bu" 4 +innotop sorts the rows. See \*(L"\s-1SORTING\s0\*(R". +.IP "\(bu" 4 +innotop groups the rows together, if specified. See \*(L"\s-1GROUPING\s0\*(R". +.IP "\(bu" 4 +innotop colorizes the rows. See \*(L"\s-1COLORS\s0\*(R". +.IP "\(bu" 4 +innotop transforms the column values in each row. See \*(L"\s-1TRANSFORMATIONS\s0\*(R". +.IP "\(bu" 4 +innotop optionally pivots the rows (see \*(L"\s-1PIVOTING\s0\*(R"), then filters and sorts +them. +.IP "\(bu" 4 +innotop formats and justifies the rows as a table. During this step, innotop +applies further formatting to the column values, including alignment, maximum +and minimum widths. innotop also does final error checking to ensure there are +no crashes due to undefined values. innotop then adds a caption if specified, +and the table is ready to print. +.PP +The lifecycle is slightly different if the table is pivoted, as noted above. To +clarify, if the table is pivoted, the process is extract, group, transform, +pivot, filter, sort, create. If it's not pivoted, the process is extract, +filter, sort, group, color, transform, create. This slightly convoluted process +doesn't map all that well to \s-1SQL\s0, but pivoting complicates things pretty +thoroughly. Roughly speaking, filtering and sorting happen as late as needed to +effect the final result as you might expect, but as early as possible for +efficiency. +.PP +Each built-in table is described below: +.IP "adaptive_hash_index" 4 +.IX Item "adaptive_hash_index" +Displays data about InnoDB's adaptive hash index. Data source: +\&\*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "buffer_pool" 4 +.IX Item "buffer_pool" +Displays data about InnoDB's buffer pool. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "cmd_summary" 4 +.IX Item "cmd_summary" +Displays weighted status variables. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "deadlock_locks" 4 +.IX Item "deadlock_locks" +Shows which locks were held and waited for by the last detected deadlock. Data +source: \*(L"\s-1DEADLOCK_LOCKS\s0\*(R". +.IP "deadlock_transactions" 4 +.IX Item "deadlock_transactions" +Shows transactions involved in the last detected deadlock. Data source: +\&\*(L"\s-1DEADLOCK_TRANSACTIONS\s0\*(R". +.IP "explain" 4 +.IX Item "explain" +Shows the output of \s-1EXPLAIN\s0. Data source: \*(L"\s-1EXPLAIN\s0\*(R". +.IP "file_io_misc" 4 +.IX Item "file_io_misc" +Displays data about InnoDB's file and I/O operations. Data source: +\&\*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "fk_error" 4 +.IX Item "fk_error" +Displays various data about InnoDB's last foreign key error. Data source: +\&\*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "innodb_locks" 4 +.IX Item "innodb_locks" +Displays InnoDB locks. Data source: \*(L"\s-1INNODB_LOCKS\s0\*(R". +.IP "innodb_transactions" 4 +.IX Item "innodb_transactions" +Displays data about InnoDB's current transactions. Data source: +\&\*(L"\s-1INNODB_TRANSACTIONS\s0\*(R". +.IP "insert_buffers" 4 +.IX Item "insert_buffers" +Displays data about InnoDB's insert buffer. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "io_threads" 4 +.IX Item "io_threads" +Displays data about InnoDB's I/O threads. Data source: \*(L"\s-1IO_THREADS\s0\*(R". +.IP "log_statistics" 4 +.IX Item "log_statistics" +Displays data about InnoDB's logging system. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "master_status" 4 +.IX Item "master_status" +Displays replication master status. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "open_tables" 4 +.IX Item "open_tables" +Displays open tables. Data source: \*(L"\s-1OPEN_TABLES\s0\*(R". +.IP "page_statistics" 4 +.IX Item "page_statistics" +Displays InnoDB page statistics. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "pending_io" 4 +.IX Item "pending_io" +Displays InnoDB pending I/O operations. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "processlist" 4 +.IX Item "processlist" +Displays current MySQL processes (threads/connections). Data source: +\&\*(L"\s-1PROCESSLIST\s0\*(R". +.IP "q_header" 4 +.IX Item "q_header" +Displays various status values. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "row_operation_misc" 4 +.IX Item "row_operation_misc" +Displays data about InnoDB's row operations. Data source: +\&\*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "row_operations" 4 +.IX Item "row_operations" +Displays data about InnoDB's row operations. Data source: +\&\*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "semaphores" 4 +.IX Item "semaphores" +Displays data about InnoDB's semaphores and mutexes. Data source: +\&\*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "slave_io_status" 4 +.IX Item "slave_io_status" +Displays data about the slave I/O thread. Data source: +\&\*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "slave_sql_status" 4 +.IX Item "slave_sql_status" +Displays data about the slave \s-1SQL\s0 thread. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "t_header" 4 +.IX Item "t_header" +Displays various InnoDB status values. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "var_status" 4 +.IX Item "var_status" +Displays user-configurable data. Data source: \*(L"\s-1STATUS_VARIABLES\s0\*(R". +.IP "wait_array" 4 +.IX Item "wait_array" +Displays data about InnoDB's \s-1OS\s0 wait array. Data source: \*(L"\s-1OS_WAIT_ARRAY\s0\*(R". +.Sh "\s-1COLUMNS\s0" +.IX Subsection "COLUMNS" +Columns belong to tables. You can choose a table's columns by pressing the '^' +key, which starts the \*(L"\s-1TABLE\s0 \s-1EDITOR\s0\*(R" and lets you choose and edit columns. +Pressing 'e' from within the table editor lets you edit the column's properties: +.IP "\(bu" 4 +hdr: a column header. This appears in the first row of the table. +.IP "\(bu" 4 +just: justification. '\-' means left-justified and '' means right\-justified, +just as with printf formatting codes (not a coincidence). +.IP "\(bu" 4 +dec: whether to further align the column on the decimal point. +.IP "\(bu" 4 +num: whether the column is numeric. This affects how values are sorted +(lexically or numerically). +.IP "\(bu" 4 +label: a small note about the column, which appears in dialogs that help the +user choose columns. +.IP "\(bu" 4 +src: an expression that innotop uses to extract the column's data from its +source (see \*(L"\s-1DATA\s0 \s-1SOURCES\s0\*(R"). See \*(L"\s-1EXPRESSIONS\s0\*(R" for more on expressions. +.IP "\(bu" 4 +minw: specifies a minimum display width. This helps stabilize the display, +which makes it easier to read if the data is changing frequently. +.IP "\(bu" 4 +maxw: similar to minw. +.IP "\(bu" 4 +trans: a list of column transformations. See \*(L"\s-1TRANSFORMATIONS\s0\*(R". +.IP "\(bu" 4 +agg: an aggregate function. See \*(L"\s-1GROUPING\s0\*(R". The default is \*(L"first\*(R". +.IP "\(bu" 4 +aggonly: controls whether the column only shows when grouping is enabled on the +table (see \*(L"\s-1GROUPING\s0\*(R"). By default, this is disabled. This means columns +will always be shown by default, whether grouping is enabled or not. If a +column's aggonly is set true, the column will appear when you toggle grouping on +the table. Several columns are set this way, such as the count column on +\&\*(L"processlist\*(R" and \*(L"innodb_transactions\*(R", so you don't see a count when the +grouping isn't enabled, but you do when it is. +.Sh "\s-1FILTERS\s0" +.IX Subsection "FILTERS" +Filters remove rows from the display. They behave much like a \s-1WHERE\s0 clause in +\&\s-1SQL\s0. innotop has several built-in filters, which remove irrelevant information +like inactive queries, but you can define your own as well. innotop also lets +you create quick\-filters, which do not get saved to the configuration file, and +are just an easy way to quickly view only some rows. +.PP +You can enable or disable a filter on any table. Press the '%' key (mnemonic: % +looks kind of like a line being filtered between two circles) and choose which +table you want to filter, if asked. You'll then see a list of possible filters +and a list of filters currently enabled for that table. Type the names of +filters you want to apply and press Enter. +.PP +\fIUSER-DEFINED \s-1FILTERS\s0\fR +.IX Subsection "USER-DEFINED FILTERS" +.PP +If you type a name that doesn't exist, innotop will prompt you to create the +filter. Filters are easy to create if you know Perl, and not hard if you don't. +What you're doing is creating a subroutine that returns true if the row should +be displayed. The row is a hash reference passed to your subroutine as \f(CW$set\fR. +.PP +For example, imagine you want to filter the processlist table so you only see +queries that have been running more than five minutes. Type a new name for your +filter, and when prompted for the subroutine body, press \s-1TAB\s0 to initiate your +terminal's auto\-completion. You'll see the names of the columns in the +\&\*(L"processlist\*(R" table (innotop generally tries to help you with auto-completion +lists). You want to filter on the 'time' column. Type the text \*(L"$set\->{time} > +300\*(R" to return true when the query is more than five minutes old. That's all +you need to do. +.PP +In other words, the code you're typing is surrounded by an implicit context, +which looks like this: +.PP +.Vb 4 +\& sub filter { +\& my ( $set ) = @_; +\& # YOUR CODE HERE +\& } +.Ve +.PP +If your filter doesn't work, or if something else suddenly behaves differently, +you might have made an error in your filter, and innotop is silently catching +the error. Try enabling \*(L"debug\*(R" to make innotop throw an error instead. +.PP +\fIQUICK-FILTERS\fR +.IX Subsection "QUICK-FILTERS" +.PP +innotop's quick-filters are a shortcut to create a temporary filter that doesn't +persist when you restart innotop. To create a quick\-filter, press the '/' key. +innotop will prompt you for the column name and filter text. Again, you can use +auto-completion on column names. The filter text can be just the text you want +to \*(L"search for.\*(R" For example, to filter the \*(L"processlist\*(R" table on queries +that refer to the products table, type '/' and then 'info product'. +.PP +The filter text can actually be any Perl regular expression, but of course a +literal string like 'product' works fine as a regular expression. +.PP +Behind the scenes innotop compiles the quick-filter into a specially tagged +filter that is otherwise like any other filter. It just isn't saved to the +configuration file. +.PP +To clear quick\-filters, press the '\e' key and innotop will clear them all at +once. +.Sh "\s-1SORTING\s0" +.IX Subsection "SORTING" +innotop has sensible built-in defaults to sort the most important rows to the +top of the table. Like anything else in innotop, you can customize how any +table is sorted. +.PP +To start the sort dialog, start the \*(L"\s-1TABLE\s0 \s-1EDITOR\s0\*(R" with the '^' key, choose a +table if necessary, and press the 's' key. You'll see a list of columns you can +use in the sort expression and the current sort expression, if any. Enter a +list of columns by which you want to sort and press Enter. If you want to +reverse sort, prefix the column name with a minus sign. For example, if you +want to sort by column a ascending, then column b descending, type 'a \-b'. You +can also explicitly add a + in front of columns you want to sort ascending, but +it's not required. +.PP +Some modes have keys mapped to open this dialog directly, and to quickly reverse +sort direction. Press '?' as usual to see which keys are mapped in any mode. +.Sh "\s-1GROUPING\s0" +.IX Subsection "GROUPING" +innotop can group, or aggregate, rows together (I use the terms +interchangeably). This is quite similar to an \s-1SQL\s0 \s-1GROUP\s0 \s-1BY\s0 clause. You can +specify to group on certain columns, or if you don't specify any, the entire set +of rows is treated as one group. This is quite like \s-1SQL\s0 so far, but unlike \s-1SQL\s0, +you can also select un-grouped columns. innotop actually aggregates every +column. If you don't explicitly specify a grouping function, the default is +\&'first'. This is basically a convenience so you don't have to specify an +aggregate function for every column you want in the result. +.PP +You can quickly toggle grouping on a table with the '=' key, which toggles its +aggregate property. This property doesn't persist to the config file. +.PP +The columns by which the table is grouped are specified in its group_by +property. When you turn grouping on, innotop places the group_by columns at the +far left of the table, even if they're not supposed to be visible. The rest of +the visible columns appear in order after them. +.PP +Two tables have default group_by lists and a count column built in: +\&\*(L"processlist\*(R" and \*(L"innodb_transactions\*(R". The grouping is by connection +and status, so you can quickly see how many queries or transactions are in a +given status on each server you're monitoring. The time columns are aggregated +as a sum; other columns are left at the default 'first' aggregation. +.PP +By default, the table shown in \*(L"S: Variables & Status\*(R" mode also uses +grouping so you can monitor variables and status across many servers. The +default aggregation function in this mode is 'avg'. +.PP +Valid grouping functions are defined in the \f(CW%agg_funcs\fR hash. They include +.IP "first" 4 +.IX Item "first" +Returns the first element in the group. +.IP "count" 4 +.IX Item "count" +Returns the number of elements in the group, including undefined elements, much +like \s-1SQL\s0's \s-1COUNT\s0(*). +.IP "avg" 4 +.IX Item "avg" +Returns the average of defined elements in the group. +.IP "sum" 4 +.IX Item "sum" +Returns the sum of elements in the group. +.PP +Here's an example of grouping at work. Suppose you have a very busy server with +hundreds of open connections, and you want to see how many connections are in +what status. Using the built-in grouping rules, you can press 'Q' to enter +\&\*(L"Q: Query List\*(R" mode. Press '=' to toggle grouping (if necessary, select the +\&\*(L"processlist\*(R" table when prompted). +.PP +Your display might now look like the following: +.PP +.Vb 1 +\& Query List (? for help) localhost, 32:33, 0.11 QPS, 1 thd, 5.0.38\-log +.Ve +.PP +.Vb 5 +\& CXN Cmd Cnt ID User Host Time Query +\& localhost Query 49 12933 webusr localhost 19:38 SELECT * FROM +\& localhost Sending Da 23 2383 webusr localhost 12:43 SELECT col1, +\& localhost Sleep 120 140 webusr localhost 5:18:12 +\& localhost Statistics 12 19213 webusr localhost 01:19 SELECT * FROM +.Ve +.PP +That's actually quite a worrisome picture. You've got a lot of idle connections +(Sleep), and some connections executing queries (Query and Sending Data). +That's okay, but you also have a lot in Statistics status, collectively spending +over a minute. That means the query optimizer is having a really hard time +optimizing your statements. Something is wrong; it should normally take +milliseconds to optimize queries. You might not have seen this pattern if you +didn't look at your connections in aggregate. (This is a made-up example, but +it can happen in real life). +.Sh "\s-1PIVOTING\s0" +.IX Subsection "PIVOTING" +innotop can pivot a table for more compact display, similar to a Pivot Table in +a spreadsheet (also known as a crosstab). Pivoting a table makes columns into +rows. Assume you start with this table: +.PP +.Vb 4 +\& foo bar +\& === === +\& 1 3 +\& 2 4 +.Ve +.PP +After pivoting, the table will look like this: +.PP +.Vb 4 +\& name set0 set1 +\& ==== ==== ==== +\& foo 1 2 +\& bar 3 4 +.Ve +.PP +To get reasonable results, you might need to group as well as pivoting. +innotop currently does this for \*(L"S: Variables & Status\*(R" mode. +.Sh "\s-1COLORS\s0" +.IX Subsection "COLORS" +By default, innotop highlights rows with color so you can see at a glance which +rows are more important. You can customize the colorization rules and add your +own to any table. Open the table editor with the '^' key, choose a table if +needed, and press 'o' to open the color editor dialog. +.PP +The color editor dialog displays the rules applied to the table, in the order +they are evaluated. Each row is evaluated against each rule to see if the rule +matches the row; if it does, the row gets the specified color, and no further +rules are evaluated. The rules look like the following: +.PP +.Vb 9 +\& state eq Locked black on_red +\& cmd eq Sleep white +\& user eq system user white +\& cmd eq Connect white +\& cmd eq Binlog Dump white +\& time > 600 red +\& time > 120 yellow +\& time > 60 green +\& time > 30 cyan +.Ve +.PP +This is the default rule set for the \*(L"processlist\*(R" table. In order of +priority, these rules make locked queries black on a red background, \*(L"gray out\*(R" +connections from replication and sleeping queries, and make queries turn from +cyan to red as they run longer. +.PP +(For some reason, the \s-1ANSI\s0 color code \*(L"white\*(R" is actually a light gray. Your +terminal's display may vary; experiment to find colors you like). +.PP +You can use keystrokes to move the rules up and down, which re-orders their +priority. You can also delete rules and add new ones. If you add a new rule, +innotop prompts you for the column, an operator for the comparison, a value +against which to compare the column, and a color to assign if the rule matches. +There is auto-completion and prompting at each step. +.PP +The value in the third step needs to be correctly quoted. innotop does not try +to quote the value because it doesn't know whether it should treat the value as +a string or a number. If you want to compare the column against a string, as +for example in the first rule above, you should enter 'Locked' surrounded by +quotes. If you get an error message about a bareword, you probably should have +quoted something. +.Sh "\s-1EXPRESSIONS\s0" +.IX Subsection "EXPRESSIONS" +Expressions are at the core of how innotop works, and are what enables you to +extend innotop as you wish. Recall the table lifecycle explained in +\&\*(L"\s-1TABLES\s0\*(R". Expressions are used in the earliest step, where it extracts +values from a data source to form rows. +.PP +It does this by calling a subroutine for each column, passing it the source data +set, a set of current values, and a set of previous values. These are all +needed so the subroutine can calculate things like the difference between this +tick and the previous tick. +.PP +The subroutines that extract the data from the set are compiled from +expressions. This gives significantly more power than just naming the values to +fill the columns, because it allows the column's value to be calculated from +whatever data is necessary, but avoids the need to write complicated and lengthy +Perl code. +.PP +innotop begins with a string of text that can look as simple as a value's name +or as complicated as a full-fledged Perl expression. It looks at each +\&'bareword' token in the string and decides whether it's supposed to be a key +into the \f(CW$set\fR hash. A bareword is an unquoted value that isn't already +surrounded by code-ish things like dollar signs or curly brackets. If innotop +decides that the bareword isn't a function or other valid Perl code, it converts +it into a hash access. After the whole string is processed, innotop compiles a +subroutine, like this: +.PP +.Vb 5 +\& sub compute_column_value { +\& my ( $set, $cur, $pre ) = @_; +\& my $val = # EXPANDED STRING GOES HERE +\& return $val; +\& } +.Ve +.PP +Here's a concrete example, taken from the header table \*(L"q_header\*(R" in \*(L"Q: Query List\*(R" mode. This expression calculates the qps, or Queries Per Second, +column's values, from the values returned by \s-1SHOW\s0 \s-1STATUS:\s0 +.PP +.Vb 1 +\& Questions/Uptime_hires +.Ve +.PP +innotop decides both words are barewords, and transforms this expression into +the following Perl code: +.PP +.Vb 1 +\& $set\->{Questions}/$set\->{Uptime_hires} +.Ve +.PP +When surrounded by the rest of the subroutine's code, this is executable Perl +that calculates a high-resolution queries-per-second value. +.PP +The arguments to the subroutine are named \f(CW$set\fR, \f(CW$cur\fR, and \f(CW$pre\fR. In most cases, +\&\f(CW$set\fR and \f(CW$cur\fR will be the same values. However, if \*(L"status_inc\*(R" is set, \f(CW$cur\fR +will not be the same as \f(CW$set\fR, because \f(CW$set\fR will already contain values that are +the incremental difference between \f(CW$cur\fR and \f(CW$pre\fR. +.PP +Every column in innotop is computed by subroutines compiled in the same fashion. +There is no difference between innotop's built-in columns and user-defined +columns. This keeps things consistent and predictable. +.Sh "\s-1TRANSFORMATIONS\s0" +.IX Subsection "TRANSFORMATIONS" +Transformations change how a value is rendered. For example, they can take a +number of seconds and display it in H:M:S format. The following transformations +are defined: +.IP "commify" 4 +.IX Item "commify" +Adds commas to large numbers every three decimal places. +.IP "dulint_to_int" 4 +.IX Item "dulint_to_int" +Accepts two unsigned integers and converts them into a single longlong. This is +useful for certain operations with InnoDB, which uses two integers as +transaction identifiers, for example. +.IP "no_ctrl_char" 4 +.IX Item "no_ctrl_char" +Removes quoted control characters from the value. This is affected by the +\&\*(L"charset\*(R" configuration variable. +.Sp +This transformation only operates within quoted strings, for example, values to +a \s-1SET\s0 clause in an \s-1UPDATE\s0 statement. It will not alter the \s-1UPDATE\s0 statement, +but will collapse the quoted string to [\s-1BINARY\s0] or [\s-1TEXT\s0], depending on the +charset. +.IP "percent" 4 +.IX Item "percent" +Converts a number to a percentage by multiplying it by two, formatting it with +\&\*(L"num_digits\*(R" digits after the decimal point, and optionally adding a percent +sign (see \*(L"show_percent\*(R"). +.IP "secs_to_time" 4 +.IX Item "secs_to_time" +Formats a number of seconds as time in days+hours:minutes:seconds format. +.IP "set_precision" 4 +.IX Item "set_precision" +Formats numbers with \*(L"num_digits\*(R" number of digits after the decimal point. +.IP "shorten" 4 +.IX Item "shorten" +Formats a number as a unit of 1024 (k/M/G/T) and with \*(L"num_digits\*(R" number of +digits after the decimal point. +.Sh "\s-1TABLE\s0 \s-1EDITOR\s0" +.IX Subsection "TABLE EDITOR" +The innotop table editor lets you customize tables with keystrokes. You start +the table editor with the '^' key. If there's more than one table on the +screen, it will prompt you to choose one of them. Once you do, innotop will +show you something like this: +.PP +.Vb 1 +\& Editing table definition for Buffer Pool. Press ? for help, q to quit. +.Ve +.PP +.Vb 9 +\& name hdr label src +\& cxn CXN Connection from which cxn +\& buf_pool_size Size Buffer pool size IB_bp_buf_poo +\& buf_free Free Bufs Buffers free in the b IB_bp_buf_fre +\& pages_total Pages Pages total IB_bp_pages_t +\& pages_modified Dirty Pages Pages modified (dirty IB_bp_pages_m +\& buf_pool_hit_rate Hit Rate Buffer pool hit rate IB_bp_buf_poo +\& total_mem_alloc Memory Total memory allocate IB_bp_total_m +\& add_pool_alloc Add\(aql Pool Additonal pool alloca IB_bp_add_poo +.Ve +.PP +The first line shows which table you're editing, and reminds you again to press +\&'?' for a list of key mappings. The rest is a tabular representation of the +table's columns, because that's likely what you're trying to edit. However, you +can edit more than just the table's columns; this screen can start the filter +editor, color rule editor, and more. +.PP +Each row in the display shows a single column in the table you're editing, along +with a couple of its properties such as its header and source expression (see +\&\*(L"\s-1EXPRESSIONS\s0\*(R"). +.PP +The key mappings are Vim\-style, as in many other places. Pressing 'j' and 'k' +moves the highlight up or down. You can then (d)elete or (e)dit the highlighted +column. You can also (a)dd a column to the table. This actually just activates +one of the columns already defined for the table; it prompts you to choose from +among the columns available but not currently displayed. Finally, you can +re-order the columns with the '+' and '\-' keys. +.PP +You can do more than just edit the columns with the table editor, you can also +edit other properties, such as the table's sort expression and group-by +expression. Press '?' to see the full list, of course. +.PP +If you want to really customize and create your own column, as opposed to just +activating a built-in one that's not currently displayed, press the (n)ew key, +and innotop will prompt you for the information it needs: +.IP "\(bu" 4 +The column name: this needs to be a word without any funny characters, e.g. just +letters, numbers and underscores. +.IP "\(bu" 4 +The column header: this is the label that appears at the top of the column, in +the table header. This can have spaces and funny characters, but be careful not +to make it too wide and waste space on\-screen. +.IP "\(bu" 4 +The column's data source: this is an expression that determines what data from +the source (see \*(L"\s-1TABLES\s0\*(R") innotop will put into the column. This can just be +the name of an item in the source, or it can be a more complex expression, as +described in \*(L"\s-1EXPRESSIONS\s0\*(R". +.PP +Once you've entered the required data, your table has a new column. There is no +difference between this column and the built-in ones; it can have all the same +properties and behaviors. innotop will write the column's definition to the +configuration file, so it will persist across sessions. +.PP +Here's an example: suppose you want to track how many times your slaves have +retried transactions. According to the MySQL manual, the +Slave_retried_transactions status variable gives you that data: \*(L"The total +number of times since startup that the replication slave \s-1SQL\s0 thread has retried +transactions. This variable was added in version 5.0.4.\*(R" This is appropriate to +add to the \*(L"slave_sql_status\*(R" table. +.PP +To add the column, switch to the replication-monitoring mode with the 'M' key, +and press the '^' key to start the table editor. When prompted, choose +slave_sql_status as the table, then press 'n' to create the column. Type +\&'retries' as the column name, 'Retries' as the column header, and +\&'Slave_retried_transactions' as the source. Now the column is created, and you +see the table editor screen again. Press 'q' to exit the table editor, and +you'll see your column at the end of the table. +.SH "VARIABLE SETS" +.IX Header "VARIABLE SETS" +Variable sets are used in \*(L"S: Variables & Status\*(R" mode to define more easily +what variables you want to monitor. Behind the scenes they are compiled to a +list of expressions, and then into a column list so they can be treated just +like columns in any other table, in terms of data extraction and +transformations. However, you're protected from the tedious details by a syntax +that ought to feel very natural to you: a \s-1SQL\s0 \s-1SELECT\s0 list. +.PP +The data source for variable sets, and indeed the entire S mode, is the +combination of \s-1SHOW\s0 \s-1STATUS\s0, \s-1SHOW\s0 \s-1VARIABLES\s0, and \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0. Imagine +that you had a huge table with one column per variable returned from those +statements. That's the data source for variable sets. You can now query this +data source just like you'd expect. For example: +.PP +.Vb 1 +\& Questions, Uptime, Questions/Uptime as QPS +.Ve +.PP +Behind the scenes innotop will split that variable set into three expressions, +compile them and turn them into a table definition, then extract as usual. This +becomes a \*(L"variable set,\*(R" or a \*(L"list of variables you want to monitor.\*(R" +.PP +innotop lets you name and save your variable sets, and writes them to the +configuration file. You can choose which variable set you want to see with the +\&'c' key, or activate the next and previous sets with the '>' and '<' keys. +There are many built-in variable sets as well, which should give you a good +start for creating your own. Press 'e' to edit the current variable set, or +just to see how it's defined. To create a new one, just press 'c' and type its +name. +.PP +You may want to use some of the functions listed in \*(L"\s-1TRANSFORMATIONS\s0\*(R" to help +format the results. In particular, \*(L"set_precision\*(R" is often useful to limit +the number of digits you see. Extending the above example, here's how: +.PP +.Vb 1 +\& Questions, Uptime, set_precision(Questions/Uptime) as QPS +.Ve +.PP +Actually, this still needs a little more work. If your \*(L"interval\*(R" is less +than one second, you might be dividing by zero because Uptime is incremental in +this mode by default. Instead, use Uptime_hires: +.PP +.Vb 1 +\& Questions, Uptime, set_precision(Questions/Uptime_hires) as QPS +.Ve +.PP +This example is simple, but it shows how easy it is to choose which variables +you want to monitor. +.SH "PLUGINS" +.IX Header "PLUGINS" +innotop has a simple but powerful plugin mechanism by which you can extend +or modify its existing functionality, and add new functionality. innotop's +plugin functionality is event\-based: plugins register themselves to be called +when events happen. They then have a chance to influence the event. +.PP +An innotop plugin is a Perl module placed in innotop's \*(L"plugin_dir\*(R" +directory. On \s-1UNIX\s0 systems, you can place a symbolic link to the module instead +of putting the actual file there. innotop automatically discovers the file. If +there is a corresponding entry in the \*(L"plugins\*(R" configuration file section, +innotop loads and activates the plugin. +.PP +The module must conform to innotop's plugin interface. Additionally, the source +code of the module must be written in such a way that innotop can inspect the +file and determine the package name and description. +.Sh "Package Source Convention" +.IX Subsection "Package Source Convention" +innotop inspects the plugin module's source to determine the Perl package name. +It looks for a line of the form \*(L"package Foo;\*(R" and if found, considers the +plugin's package name to be Foo. Of course the package name can be a valid Perl +package name, with double semicolons and so on. +.PP +It also looks for a description in the source code, to make the plugin editor +more human\-friendly. The description is a comment line of the form \*(L"# +description: Foo\*(R", where \*(L"Foo\*(R" is the text innotop will consider to be the +plugin's description. +.Sh "Plugin Interface" +.IX Subsection "Plugin Interface" +The innotop plugin interface is quite simple: innotop expects the plugin to be +an object-oriented module it can call certain methods on. The methods are +.IP "new(%variables)" 4 +.IX Item "new(%variables)" +This is the plugin's constructor. It is passed a hash of innotop's variables, +which it can manipulate (see \*(L"Plugin Variables\*(R"). It must return a reference +to the newly created plugin object. +.Sp +At construction time, innotop has only loaded the general configuration and +created the default built-in variables with their default contents (which is +quite a lot). Therefore, the state of the program is exactly as in the innotop +source code, plus the configuration variables from the \*(L"general\*(R" section in +the config file. +.Sp +If your plugin manipulates the variables, it is changing global data, which is +shared by innotop and all plugins. Plugins are loaded in the order they're +listed in the config file. Your plugin may load before or after another plugin, +so there is a potential for conflict or interaction between plugins if they +modify data other plugins use or modify. +.IP "\fIregister_for_events()\fR" 4 +.IX Item "register_for_events()" +This method must return a list of events in which the plugin is interested, if +any. See \*(L"Plugin Events\*(R" for the defined events. If the plugin returns an +event that's not defined, the event is ignored. +.IP "event handlers" 4 +.IX Item "event handlers" +The plugin must implement a method named the same as each event for which it has +registered. In other words, if the plugin returns qw(foo bar) from +\&\fIregister_for_events()\fR, it must have \fIfoo()\fR and \fIbar()\fR methods. These methods are +callbacks for the events. See \*(L"Plugin Events\*(R" for more details about each +event. +.Sh "Plugin Variables" +.IX Subsection "Plugin Variables" +The plugin's constructor is passed a hash of innotop's variables, which it can +manipulate. It is probably a good idea if the plugin object saves a copy of it +for later use. The variables are defined in the innotop variable +\&\f(CW%pluggable_vars\fR, and are as follows: +.IP "action_for" 4 +.IX Item "action_for" +A hashref of key mappings. These are innotop's global hot\-keys. +.IP "agg_funcs" 4 +.IX Item "agg_funcs" +A hashref of functions that can be used for grouping. See \*(L"\s-1GROUPING\s0\*(R". +.IP "config" 4 +.IX Item "config" +The global configuration hash. +.IP "connections" 4 +.IX Item "connections" +A hashref of connection specifications. These are just specifications of how to +connect to a server. +.IP "dbhs" 4 +.IX Item "dbhs" +A hashref of innotop's database connections. These are actual \s-1DBI\s0 connection +objects. +.IP "filters" 4 +.IX Item "filters" +A hashref of filters applied to table rows. See \*(L"\s-1FILTERS\s0\*(R" for more. +.IP "modes" 4 +.IX Item "modes" +A hashref of modes. See \*(L"\s-1MODES\s0\*(R" for more. +.IP "server_groups" 4 +.IX Item "server_groups" +A hashref of server groups. See \*(L"\s-1SERVER\s0 \s-1GROUPS\s0\*(R". +.IP "tbl_meta" 4 +.IX Item "tbl_meta" +A hashref of innotop's table meta\-data, with one entry per table (see +\&\*(L"\s-1TABLES\s0\*(R" for more information). +.IP "trans_funcs" 4 +.IX Item "trans_funcs" +A hashref of transformation functions. See \*(L"\s-1TRANSFORMATIONS\s0\*(R". +.IP "var_sets" 4 +.IX Item "var_sets" +A hashref of variable sets. See \*(L"\s-1VARIABLE\s0 \s-1SETS\s0\*(R". +.Sh "Plugin Events" +.IX Subsection "Plugin Events" +Each event is defined somewhere in the innotop source code. When innotop runs +that code, it executes the callback function for each plugin that expressed its +interest in the event. innotop passes some data for each event. The events are +defined in the \f(CW%event_listener_for\fR variable, and are as follows: +.ie n .IP "extract_values($set, $cur\fR, \f(CW$pre\fR, \f(CW$tbl)" 4 +.el .IP "extract_values($set, \f(CW$cur\fR, \f(CW$pre\fR, \f(CW$tbl\fR)" 4 +.IX Item "extract_values($set, $cur, $pre, $tbl)" +This event occurs inside the function that extracts values from a data source. +The arguments are the set of values, the current values, the previous values, +and the table name. +.IP "set_to_tbl" 4 +.IX Item "set_to_tbl" +Events are defined at many places in this subroutine, which is responsible for +turning an arrayref of hashrefs into an arrayref of lines that can be printed to +the screen. The events all pass the same data: an arrayref of rows and the name +of the table being created. The events are set_to_tbl_pre_filter, +set_to_tbl_pre_sort,set_to_tbl_pre_group, set_to_tbl_pre_colorize, +set_to_tbl_pre_transform, set_to_tbl_pre_pivot, set_to_tbl_pre_create, +set_to_tbl_post_create. +.IP "draw_screen($lines)" 4 +.IX Item "draw_screen($lines)" +This event occurs inside the subroutine that prints the lines to the screen. +\&\f(CW$lines\fR is an arrayref of strings. +.Sh "Simple Plugin Example" +.IX Subsection "Simple Plugin Example" +The easiest way to explain the plugin functionality is probably with a simple +example. The following module adds a column to the beginning of every table and +sets its value to 1. +.PP +.Vb 2 +\& use strict; +\& use warnings FATAL => \(aqall\(aq; +.Ve +.PP +.Vb 2 +\& package Innotop::Plugin::Example; +\& # description: Adds an \(aqexample\(aq column to every table +.Ve +.PP +.Vb 4 +\& sub new { +\& my ( $class, %vars ) = @_; +\& # Store reference to innotop\(aqs variables in $self +\& my $self = bless { %vars }, $class; +.Ve +.PP +.Vb 11 +\& # Design the example column +\& my $col = { +\& hdr => \(aqExample\(aq, +\& just => \(aq\(aq, +\& dec => 0, +\& num => 1, +\& label => \(aqExample\(aq, +\& src => \(aqexample\(aq, # Get data from this column in the data source +\& tbl => \(aq\(aq, +\& trans => [], +\& }; +.Ve +.PP +.Vb 8 +\& # Add the column to every table. +\& my $tbl_meta = $vars{tbl_meta}; +\& foreach my $tbl ( values %$tbl_meta ) { +\& # Add the column to the list of defined columns +\& $tbl\->{cols}\->{example} = $col; +\& # Add the column to the list of visible columns +\& unshift @{$tbl\->{visible}}, \(aqexample\(aq; +\& } +.Ve +.PP +.Vb 3 +\& # Be sure to return a reference to the object. +\& return $self; +\& } +.Ve +.PP +.Vb 5 +\& # I\(aqd like to be called when a data set is being rendered into a table, please. +\& sub register_for_events { +\& my ( $self ) = @_; +\& return qw(set_to_tbl_pre_filter); +\& } +.Ve +.PP +.Vb 8 +\& # This method will be called when the event fires. +\& sub set_to_tbl_pre_filter { +\& my ( $self, $rows, $tbl ) = @_; +\& # Set the example column\(aqs data source to the value 1. +\& foreach my $row ( @$rows ) { +\& $row\->{example} = 1; +\& } +\& } +.Ve +.PP +.Vb 1 +\& 1; +.Ve +.Sh "Plugin Editor" +.IX Subsection "Plugin Editor" +The plugin editor lets you view the plugins innotop discovered and activate or +deactivate them. Start the editor by pressing $ to start the configuration +editor from any mode. Press the 'p' key to start the plugin editor. You'll see +a list of plugins innotop discovered. You can use the 'j' and 'k' keys to move +the highlight to the desired one, then press the * key to toggle it active or +inactive. Exit the editor and restart innotop for the changes to take effect. +.SH "SQL STATEMENTS" +.IX Header "SQL STATEMENTS" +innotop uses a limited set of \s-1SQL\s0 statements to retrieve data from MySQL for +display. The statements are customized depending on the server version against +which they are executed; for example, on MySQL 5 and newer, \s-1INNODB_STATUS\s0 +executes \*(L"\s-1SHOW\s0 \s-1ENGINE\s0 \s-1INNODB\s0 \s-1STATUS\s0\*(R", while on earlier versions it executes +\&\*(L"\s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0\*(R". The statements are as follows: +.PP +.Vb 12 +\& Statement SQL executed +\& =================== =============================== +\& INNODB_STATUS SHOW [ENGINE] INNODB STATUS +\& KILL_CONNECTION KILL +\& KILL_QUERY KILL QUERY +\& OPEN_TABLES SHOW OPEN TABLES +\& PROCESSLIST SHOW FULL PROCESSLIST +\& SHOW_MASTER_LOGS SHOW MASTER LOGS +\& SHOW_MASTER_STATUS SHOW MASTER STATUS +\& SHOW_SLAVE_STATUS SHOW SLAVE STATUS +\& SHOW_STATUS SHOW [GLOBAL] STATUS +\& SHOW_VARIABLES SHOW [GLOBAL] VARIABLES +.Ve +.SH "DATA SOURCES" +.IX Header "DATA SOURCES" +Each time innotop extracts values to create a table (see \*(L"\s-1EXPRESSIONS\s0\*(R" and +\&\*(L"\s-1TABLES\s0\*(R"), it does so from a particular data source. Largely because of the +complex data extracted from \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0, this is slightly messy. \s-1SHOW\s0 +\&\s-1INNODB\s0 \s-1STATUS\s0 contains a mixture of single values and repeated values that form +nested data sets. +.PP +Whenever innotop fetches data from MySQL, it adds two extra bits to each set: +cxn and Uptime_hires. cxn is the name of the connection from which the data +came. Uptime_hires is a high-resolution version of the server's Uptime status +variable, which is important if your \*(L"interval\*(R" setting is sub\-second. +.PP +Here are the kinds of data sources from which data is extracted: +.IP "\s-1STATUS_VARIABLES\s0" 4 +.IX Item "STATUS_VARIABLES" +This is the broadest category, into which the most kinds of data fall. It +begins with the combination of \s-1SHOW\s0 \s-1STATUS\s0 and \s-1SHOW\s0 \s-1VARIABLES\s0, but other sources +may be included as needed, for example, \s-1SHOW\s0 \s-1MASTER\s0 \s-1STATUS\s0 and \s-1SHOW\s0 \s-1SLAVE\s0 +\&\s-1STATUS\s0, as well as many of the non-repeated values from \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0. +.IP "\s-1DEADLOCK_LOCKS\s0" 4 +.IX Item "DEADLOCK_LOCKS" +This data is extracted from the transaction list in the \s-1LATEST\s0 \s-1DETECTED\s0 \s-1DEADLOCK\s0 +section of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0. It is nested two levels deep: transactions, then +locks. +.IP "\s-1DEADLOCK_TRANSACTIONS\s0" 4 +.IX Item "DEADLOCK_TRANSACTIONS" +This data is from the transaction list in the \s-1LATEST\s0 \s-1DETECTED\s0 \s-1DEADLOCK\s0 +section of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0. It is nested one level deep. +.IP "\s-1EXPLAIN\s0" 4 +.IX Item "EXPLAIN" +This data is from the result set returned by \s-1EXPLAIN\s0. +.IP "\s-1INNODB_TRANSACTIONS\s0" 4 +.IX Item "INNODB_TRANSACTIONS" +This data is from the \s-1TRANSACTIONS\s0 section of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0. +.IP "\s-1IO_THREADS\s0" 4 +.IX Item "IO_THREADS" +This data is from the list of threads in the the \s-1FILE\s0 I/O section of \s-1SHOW\s0 \s-1INNODB\s0 +\&\s-1STATUS\s0. +.IP "\s-1INNODB_LOCKS\s0" 4 +.IX Item "INNODB_LOCKS" +This data is from the \s-1TRANSACTIONS\s0 section of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0 and is nested +two levels deep. +.IP "\s-1OPEN_TABLES\s0" 4 +.IX Item "OPEN_TABLES" +This data is from \s-1SHOW\s0 \s-1OPEN\s0 \s-1TABLES\s0. +.IP "\s-1PROCESSLIST\s0" 4 +.IX Item "PROCESSLIST" +This data is from \s-1SHOW\s0 \s-1FULL\s0 \s-1PROCESSLIST\s0. +.IP "\s-1OS_WAIT_ARRAY\s0" 4 +.IX Item "OS_WAIT_ARRAY" +This data is from the \s-1SEMAPHORES\s0 section of \s-1SHOW\s0 \s-1INNODB\s0 \s-1STATUS\s0 and is nested one +level deep. It comes from the lines that look like this: +.Sp +.Vb 1 +\& \-\-Thread 1568861104 has waited at btr0cur.c line 424 .... +.Ve +.SH "MYSQL PRIVILEGES" +.IX Header "MYSQL PRIVILEGES" +.IP "\(bu" 4 +You must connect to MySQL as a user who has the \s-1SUPER\s0 privilege for many of the +functions. +.IP "\(bu" 4 +If you don't have the \s-1SUPER\s0 privilege, you can still run some functions, but you +won't necessarily see all the same data. +.IP "\(bu" 4 +You need the \s-1PROCESS\s0 privilege to see the list of currently running queries in Q +mode. +.IP "\(bu" 4 +You need special privileges to start and stop slave servers. +.IP "\(bu" 4 +You need appropriate privileges to create and drop the deadlock tables if needed +(see \*(L"\s-1SERVER\s0 \s-1CONNECTIONS\s0\*(R"). +.SH "SYSTEM REQUIREMENTS" +.IX Header "SYSTEM REQUIREMENTS" +You need Perl to run innotop, of course. You also need a few Perl modules: \s-1DBI\s0, +DBD::mysql, Term::ReadKey, and Time::HiRes. These should be included with most +Perl distributions, but in case they are not, I recommend using versions +distributed with your operating system or Perl distribution, not from \s-1CPAN\s0. +Term::ReadKey in particular has been known to cause problems if installed from +\&\s-1CPAN\s0. +.PP +If you have Term::ANSIColor, innotop will use it to format headers more readably +and compactly. (Under Microsoft Windows, you also need Win32::Console::ANSI for +terminal formatting codes to be honored). If you install Term::ReadLine, +preferably Term::ReadLine::Gnu, you'll get nice auto-completion support. +.PP +I run innotop on Gentoo GNU/Linux, Debian and Ubuntu, and I've had feedback from +people successfully running it on Red Hat, CentOS, Solaris, and Mac \s-1OSX\s0. I +don't see any reason why it won't work on other UNIX-ish operating systems, but +I don't know for sure. It also runs on Windows under ActivePerl without +problem. +.PP +I use innotop on MySQL versions 3.23.58, 4.0.27, 4.1.0, 4.1.22, 5.0.26, 5.1.15, +and 5.2.3. If it doesn't run correctly for you, that is a bug and I hope you +report it. +.SH "FILES" +.IX Header "FILES" +$HOMEDIR/.innotop is used to store configuration information. Files include the +configuration file innotop.ini, the core_dump file which contains verbose error +messages if \*(L"debug\*(R" is enabled, and the plugins/ subdirectory. +.SH "GLOSSARY OF TERMS" +.IX Header "GLOSSARY OF TERMS" +.IP "tick" 4 +.IX Item "tick" +A tick is a refresh event, when innotop re-fetches data from connections and +displays it. +.SH "ACKNOWLEDGEMENTS" +.IX Header "ACKNOWLEDGEMENTS" +I'm grateful to the following people for various reasons, and hope I haven't +forgotten to include anyone: +.PP +Allen K. Smith, +Aurimas Mikalauskas, +Bartosz Fenski, +Brian Miezejewski, +Christian Hammers, +Cyril Scetbon, +Dane Miller, +David Multer, +Dr. Frank Ullrich, +Giuseppe Maxia, +Google.com Site Reliability Engineers, +Jan Pieter Kunst, +Jari Aalto, +Jay Pipes, +Jeremy Zawodny, +Johan Idren, +Kristian Kohntopp, +Lenz Grimmer, +Maciej Dobrzanski, +Michiel Betel, +MySQL \s-1AB\s0, +Paul McCullagh, +Sebastien Estienne, +Sourceforge.net, +Steven Kreuzer, +The Gentoo MySQL Team, +Trevor Price, +Yaar Schnitman, +and probably more people I've neglected to include. +.PP +(If I misspelled your name, it's probably because I'm afraid of putting +international characters into this documentation; earlier versions of Perl might +not be able to compile it then). +.SH "COPYRIGHT, LICENSE AND WARRANTY" +.IX Header "COPYRIGHT, LICENSE AND WARRANTY" +This program is copyright (c) 2006 Baron Schwartz. +Feedback and improvements are welcome. +.PP +\&\s-1THIS\s0 \s-1PROGRAM\s0 \s-1IS\s0 \s-1PROVIDED\s0 \*(L"\s-1AS\s0 \s-1IS\s0\*(R" \s-1AND\s0 \s-1WITHOUT\s0 \s-1ANY\s0 \s-1EXPRESS\s0 \s-1OR\s0 \s-1IMPLIED\s0 +\&\s-1WARRANTIES\s0, \s-1INCLUDING\s0, \s-1WITHOUT\s0 \s-1LIMITATION\s0, \s-1THE\s0 \s-1IMPLIED\s0 \s-1WARRANTIES\s0 \s-1OF\s0 +\&\s-1MERCHANTIBILITY\s0 \s-1AND\s0 \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. +.PP +This program is free software; you can redistribute it and/or modify it under +the terms of the \s-1GNU\s0 General Public License as published by the Free Software +Foundation, version 2; \s-1OR\s0 the Perl Artistic License. On \s-1UNIX\s0 and similar +systems, you can issue `man perlgpl' or `man perlartistic' to read these +licenses. +.PP +You should have received a copy of the \s-1GNU\s0 General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 59 Temple +Place, Suite 330, Boston, \s-1MA\s0 02111\-1307 \s-1USA\s0. +.PP +Execute innotop and press '!' to see this information at any time. +.SH "AUTHOR" +.IX Header "AUTHOR" +Baron Schwartz. +.SH "BUGS" +.IX Header "BUGS" +You can report bugs, ask for improvements, and get other help and support at +<http://sourceforge.net/projects/innotop>. There are mailing lists, forums, +a bug tracker, etc. Please use these instead of contacting me directly, as it +makes my job easier and benefits others if the discussions are permanent and +public. Of course, if you need to contact me in private, please do. diff --git a/storage/xtradb/build/debian/additions/msql2mysql.1 b/storage/xtradb/build/debian/additions/msql2mysql.1 new file mode 100644 index 00000000000..8fe05e7415d --- /dev/null +++ b/storage/xtradb/build/debian/additions/msql2mysql.1 @@ -0,0 +1,16 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +msql2mysql \- MySQL importer for msql style data. +.SH SYNOPSIS +msql2mysql [options] +.SH DESCRIPTION +This program imports old msql database files. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/my.cnf b/storage/xtradb/build/debian/additions/my.cnf new file mode 100644 index 00000000000..997523b9c2f --- /dev/null +++ b/storage/xtradb/build/debian/additions/my.cnf @@ -0,0 +1,129 @@ +# +# The MySQL database server configuration file. +# +# You can copy this to one of: +# - "/etc/mysql/my.cnf" to set global options, +# - "~/.my.cnf" to set user-specific options. +# +# One can use all long options that the program supports. +# Run program with --help to get a list of available options and with +# --print-defaults to see which it would actually understand and use. +# +# For explanations see +# http://dev.mysql.com/doc/mysql/en/server-system-variables.html + +# This will be passed to all mysql clients +# It has been reported that passwords should be enclosed with ticks/quotes +# escpecially if they contain "#" chars... +# Remember to edit /etc/mysql/debian.cnf when changing the socket location. +[client] +port = 3306 +socket = /var/run/mysqld/mysqld.sock + +# Here is entries for some specific programs +# The following values assume you have at least 32M ram + +# This was formally known as [safe_mysqld]. Both versions are currently parsed. +[mysqld_safe] +socket = /var/run/mysqld/mysqld.sock +nice = 0 + +[mysqld] +# +# * Basic Settings +# +user = mysql +pid-file = /var/run/mysqld/mysqld.pid +socket = /var/run/mysqld/mysqld.sock +port = 3306 +basedir = /usr +datadir = /var/lib/mysql +tmpdir = /tmp +language = /usr/share/mysql/english +skip-external-locking +# +# For compatibility to other Debian packages that still use +# libmysqlclient10 and libmysqlclient12. +old_passwords = 1 +# +# Instead of skip-networking the default is now to listen only on +# localhost which is more compatible and is not less secure. +bind-address = 127.0.0.1 +# +# * Fine Tuning +# +key_buffer = 16M +max_allowed_packet = 16M +thread_stack = 128K +thread_cache_size = 8 +# This replaces the startup script and checks MyISAM tables if needed +# the first time they are touched +myisam-recover = BACKUP +#max_connections = 100 +#table_cache = 64 +#thread_concurrency = 10 +# +# * Query Cache Configuration +# +query_cache_limit = 1M +query_cache_size = 16M +# +# * Logging and Replication +# +# Both location gets rotated by the cronjob. +# Be aware that this log type is a performance killer. +# As of 5.1 you can enable the at runtime! +#log_type = FILE +#general_log = /var/log/mysql/mysql.log +# +# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf. +# +# Here you can see queries with especially long duration +#log_slow_queries = /var/log/mysql/mysql-slow.log +#long_query_time = 2 +#log-queries-not-using-indexes +# +# The following can be used as easy to replay backup logs or for replication. +# note: if you are setting up a replication slave, see README.Debian about +# other settings you may need to change. +#server-id = 1 +#log_bin = /var/log/mysql/mysql-bin.log +expire_logs_days = 10 +max_binlog_size = 100M +#binlog_do_db = include_database_name +#binlog_ignore_db = include_database_name +# +# * InnoDB +# +# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. +# Read the manual for more InnoDB related options. There are many! +# +# * Security Features +# +# Read the manual, too, if you want chroot! +# chroot = /var/lib/mysql/ +# +# For generating SSL certificates I recommend the OpenSSL GUI "tinyca". +# +# ssl-ca=/etc/mysql/cacert.pem +# ssl-cert=/etc/mysql/server-cert.pem +# ssl-key=/etc/mysql/server-key.pem + + + +[mysqldump] +quick +quote-names +max_allowed_packet = 16M + +[mysql] +#no-auto-rehash # faster start of mysql but no tab completition + +[isamchk] +key_buffer = 16M + +# +# * IMPORTANT: Additional settings that can override those from this file! +# The files must end with '.cnf', otherwise they'll be ignored. +# +!includedir /etc/mysql/conf.d/ diff --git a/storage/xtradb/build/debian/additions/my_print_defaults.1 b/storage/xtradb/build/debian/additions/my_print_defaults.1 new file mode 100644 index 00000000000..ebef4157016 --- /dev/null +++ b/storage/xtradb/build/debian/additions/my_print_defaults.1 @@ -0,0 +1,16 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +my_print_defaults \- MySQL helper script that prints defaults. +.SH SYNOPSIS +my_print_defaults [options] +.SH DESCRIPTION +Prints all arguments that is give to some program using the default files. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/myisam_ftdump.1 b/storage/xtradb/build/debian/additions/myisam_ftdump.1 new file mode 100644 index 00000000000..e2de358efcc --- /dev/null +++ b/storage/xtradb/build/debian/additions/myisam_ftdump.1 @@ -0,0 +1,16 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +myisam_ftdump \- Dumps full text tables. +.SH SYNOPSIS +myisam_ftdump [options] +.SH DESCRIPTION +Dumps information and contents of full text tables. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/myisamchk.1 b/storage/xtradb/build/debian/additions/myisamchk.1 new file mode 100644 index 00000000000..fe7f34961e0 --- /dev/null +++ b/storage/xtradb/build/debian/additions/myisamchk.1 @@ -0,0 +1,17 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +myisamchk \- Checks MySQL myisam type databases. +.SH SYNOPSIS +myisamchk [options] +.SH DESCRIPTION +Description, check and repair of ISAM tables. +Used without options all tables on the command will be checked for errors + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/myisamlog.1 b/storage/xtradb/build/debian/additions/myisamlog.1 new file mode 100644 index 00000000000..959d547df94 --- /dev/null +++ b/storage/xtradb/build/debian/additions/myisamlog.1 @@ -0,0 +1,16 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +myisamlog \- MySQL helper script. +.SH SYNOPSIS +myisamlog [options] +.SH DESCRIPTION +Function unknown. Mail to ch@debian.org. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/myisampack.1 b/storage/xtradb/build/debian/additions/myisampack.1 new file mode 100644 index 00000000000..93168304a17 --- /dev/null +++ b/storage/xtradb/build/debian/additions/myisampack.1 @@ -0,0 +1,19 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +myisampack \- Compresses MySQL database files. +.SH SYNOPSIS +myisampack [options] +.SH DESCRIPTION +Pack a MyISAM-table to take much less space. +Keys are not updated, you must run myisamchk -rq on the datafile +afterwards to update the keys. +You should give the .MYI file as the filename argument. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/mysql-server.lintian-overrides b/storage/xtradb/build/debian/additions/mysql-server.lintian-overrides new file mode 100644 index 00000000000..ae589c2472e --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysql-server.lintian-overrides @@ -0,0 +1,2 @@ +W: mysql-dfsg source: maintainer-script-lacks-debhelper-token debian/percona-xtradb-server.postinst +W: percona-xtradb-server: possible-bashism-in-maintainer-script postinst:68 'p{("a".."z","A".."Z",0..9)[int(rand(62))]}' diff --git a/storage/xtradb/build/debian/additions/mysql_config.1 b/storage/xtradb/build/debian/additions/mysql_config.1 new file mode 100644 index 00000000000..88095e22b9e --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysql_config.1 @@ -0,0 +1,17 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +mysqlconfig \- MySQL compile settings. +.SH SYNOPSIS +mysqlconfig [options] +.SH DESCRIPTION +This program is only useful for people who want to compile agains +libmysqlclient. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/mysql_convert_table_format.1 b/storage/xtradb/build/debian/additions/mysql_convert_table_format.1 new file mode 100644 index 00000000000..3c23581df43 --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysql_convert_table_format.1 @@ -0,0 +1,17 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +mysql_convert_table_format \- MySQL table converter. +.SH SYNOPSIS +mysql_convert_table_format [options] +.SH DESCRIPTION +Conversion of a MySQL tables to other table types. +If no tables has been specifed, all tables in the database will be converted. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/mysql_find_rows.1 b/storage/xtradb/build/debian/additions/mysql_find_rows.1 new file mode 100644 index 00000000000..35a70b1f960 --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysql_find_rows.1 @@ -0,0 +1,18 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +mysql_find_rows \- MySQL shell skript for searching in update logs. +.SH SYNOPSIS +mysql_find_rows [options] +.SH DESCRIPTION +Prints all SQL queries that matches a regexp or contains a 'use +database' or 'set ..' command to stdout. A SQL query may contain +newlines. This is useful to find things in a MySQL update log. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/mysql_fix_extensions.1 b/storage/xtradb/build/debian/additions/mysql_fix_extensions.1 new file mode 100644 index 00000000000..3f0a028ca3f --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysql_fix_extensions.1 @@ -0,0 +1,18 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +mysql_fix_extensions \- Corrects MySQL database file names. +.SH SYNOPSIS +mysql_fix_extensions <datadir> +.SH DESCRIPTION +Makes .frm lowercase and .MYI/MYD/ISM/ISD uppercase +useful when datafiles are copied from windows. +Does not work with RAID, with InnoDB or BDB tables. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (8) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/mysql_install_db.1 b/storage/xtradb/build/debian/additions/mysql_install_db.1 new file mode 100644 index 00000000000..11f1f2967a2 --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysql_install_db.1 @@ -0,0 +1,16 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +mysql_install_db \- MySQL helper program. +.SH SYNOPSIS +mysql_install_db [options] +.SH DESCRIPTION +This program is normally not needed by any user. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/mysql_secure_installation.1 b/storage/xtradb/build/debian/additions/mysql_secure_installation.1 new file mode 100644 index 00000000000..d65b7f5d09d --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysql_secure_installation.1 @@ -0,0 +1,17 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +mysql_secure_installation \- Secures the MySQL access control lists. +.SH SYNOPSIS +mysql_secure_installation [options] +.SH DESCRIPTION +This interactive programm suggests changes like removing anonymous users that +are supposed to make your installation more secure. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (8) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/mysql_setpermission.1 b/storage/xtradb/build/debian/additions/mysql_setpermission.1 new file mode 100644 index 00000000000..77167e0d58f --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysql_setpermission.1 @@ -0,0 +1,23 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +mysql_setpermission \- Adds MySQL users or changes passwords. +.SH SYNOPSIS +mysql_setpermission [options] +.SH DESCRIPTION +The permission setter is a little program which can help you add users +or databases or change passwords in MySQL. Keep in mind that we don't +check permissions which already been set in MySQL. So if you can't +connect to MySQL using the permission you just added, take a look at +the permissions which have already been set in MySQL. + +The permission setter first reads your .my.cnf file in your Home +directory if it exists. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/mysql_tableinfo.1 b/storage/xtradb/build/debian/additions/mysql_tableinfo.1 new file mode 100644 index 00000000000..1de4f5d5943 --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysql_tableinfo.1 @@ -0,0 +1,322 @@ +.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13 +.\" +.\" Standard preamble: +.\" ======================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. | will give a +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to +.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' +.\" expand to `' in nroff, nothing in troff, for use with C<>. +.tr \(*W-|\(bv\*(Tr +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" If the F register is turned on, we'll generate index entries on stderr for +.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index +.\" entries marked with X<> in POD. Of course, you'll have to process the +.\" output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it makes +.\" way too many mistakes in technical documents. +.hy 0 +.if n .na +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ======================================================================== +.\" +.IX Title "MYSQL_TABLEINFO 1" +.TH MYSQL_TABLEINFO 1 "2003-04-05" "perl v5.8.0" "User Contributed Perl Documentation" +.SH "NAME" +mysql_tableinfo \- creates and populates information tables with +the output of SHOW DATABASES, SHOW TABLES (or SHOW TABLE STATUS), +SHOW COLUMNS and SHOW INDEX. +.PP +This is version 1.1. +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 1 +\& mysql_tableinfo [OPTIONS] database_to_write [database_like_wild] [table_like_wild] +.Ve +.PP +.Vb 2 +\& Do not backquote (``) database_to_write, +\& and do not quote ('') database_like_wild or table_like_wild +.Ve +.PP +.Vb 1 +\& Examples: +.Ve +.PP +.Vb 1 +\& mysql_tableinfo info +.Ve +.PP +.Vb 1 +\& mysql_tableinfo info this_db +.Ve +.PP +.Vb 1 +\& mysql_tableinfo info %a% b% +.Ve +.PP +.Vb 1 +\& mysql_tableinfo info --clear-only +.Ve +.PP +.Vb 1 +\& mysql_tableinfo info --col --idx --table-status +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +mysql_tableinfo asks a MySQL server information about its +databases, tables, table columns and index, and stores this +in tables called `db`, `tbl` (or `tbl_status`), `col`, `idx` +(with an optional prefix specified with \-\-prefix). +After that, you can query these information tables, for example +to build your admin scripts with \s-1SQL\s0 queries, like +.PP +\&\s-1SELECT\s0 \s-1CONCAT\s0(\*(L"\s-1CHECK\s0 \s-1TABLE\s0 \*(R",`database`,\*(L".\*(R",`table`,\*(L" \s-1EXTENDED\s0;\*(R") +\&\s-1FROM\s0 info.tbl \s-1WHERE\s0 ... ; +.PP +as people usually do with some other \s-1RDBMS\s0 +(note: to increase the speed of your queries on the info tables, +you may add some index on them). +.PP +The database_like_wild and table_like_wild instructs the program +to gather information only about databases and tables +whose names match these patterns. If the info +tables already exist, their rows matching the patterns are simply +deleted and replaced by the new ones. That is, +old rows not matching the patterns are not touched. +If the database_like_wild and table_like_wild arguments +are not specified on the command-line they default to \*(L"%\*(R". +.PP +The program : +.PP +\&\- does \s-1CREATE\s0 \s-1DATABASE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write +where database_to_write is the database name specified on the command\-line. +.PP +\&\- does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`db` +.PP +\&\- fills database_to_write.`db` with the output of +\&\s-1SHOW\s0 \s-1DATABASES\s0 \s-1LIKE\s0 database_like_wild +.PP +\&\- does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`tbl` +(respectively database_to_write.`tbl_status` +if the \-\-tbl\-status option is on) +.PP +\&\- for every found database, +fills database_to_write.`tbl` (respectively database_to_write.`tbl_status`) +with the output of +\&\s-1SHOW\s0 \s-1TABLES\s0 \s-1FROM\s0 found_db \s-1LIKE\s0 table_like_wild +(respectively \s-1SHOW\s0 \s-1TABLE\s0 \s-1STATUS\s0 \s-1FROM\s0 found_db \s-1LIKE\s0 table_like_wild) +.PP +\&\- if the \-\-col option is on, + * does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`col` + * for every found table, + fills database_to_write.`col` with the output of + \s-1SHOW\s0 \s-1COLUMNS\s0 \s-1FROM\s0 found_tbl \s-1FROM\s0 found_db +.PP +\&\- if the \-\-idx option is on, + * does \s-1CREATE\s0 \s-1TABLE\s0 \s-1IF\s0 \s-1NOT\s0 \s-1EXISTS\s0 database_to_write.`idx` + * for every found table, + fills database_to_write.`idx` with the output of + \s-1SHOW\s0 \s-1INDEX\s0 \s-1FROM\s0 found_tbl \s-1FROM\s0 found_db +.PP +Some options may modify this general scheme (see below). +.PP +As mentioned, the contents of the info tables are the output of +\&\s-1SHOW\s0 commands. In fact the contents are slightly more complete : +.PP +\&\- the `tbl` (or `tbl_status`) info table + has an extra column which contains the database name, +.PP +\&\- the `col` info table + has an extra column which contains the table name, + and an extra column which contains, for each described column, + the number of this column in the table owning it (this extra column + is called `Seq_in_table`). `Seq_in_table` makes it possible for you + to retrieve your columns in sorted order, when you are querying + the `col` table. +.PP +\&\- the `index` info table + has an extra column which contains the database name. +.PP +Caution: info tables contain certain columns (e.g. +Database, Table, Null...) whose names, as they are MySQL reserved words, +need to be backquoted (`...`) when used in \s-1SQL\s0 statements. +.PP +Caution: as information fetching and info tables filling happen at the +same time, info tables may contain inaccurate information about +themselves. +.SH "OPTIONS" +.IX Header "OPTIONS" +.IP "\-\-clear" 4 +.IX Item "--clear" +Does \s-1DROP\s0 \s-1TABLE\s0 on the info tables (only those that the program is +going to fill, for example if you do not use \-\-col it won't drop +the `col` table) and processes normally. Does not drop database_to_write. +.IP "\-\-clear\-only" 4 +.IX Item "--clear-only" +Same as \-\-clear but exits after the DROPs. +.IP "\-\-col" 4 +.IX Item "--col" +Adds columns information (into table `col`). +.IP "\-\-idx" 4 +.IX Item "--idx" +Adds index information (into table `idx`). +.IP "\-\-prefix prefix" 4 +.IX Item "--prefix prefix" +The info tables are named from the concatenation of prefix and, +respectively, db, tbl (or tbl_status), col, idx. Do not quote ('') +or backquote (``) prefix. +.IP "\-q, \-\-quiet" 4 +.IX Item "-q, --quiet" +Does not warn you about what the script is going to do (\s-1DROP\s0 \s-1TABLE\s0 etc) +and does not ask for a confirmation before starting. +.IP "\-\-tbl\-status" 4 +.IX Item "--tbl-status" +Instead of using \s-1SHOW\s0 \s-1TABLES\s0, uses \s-1SHOW\s0 \s-1TABLE\s0 \s-1STATUS\s0 +(much more complete information, but slower). +.IP "\-\-help" 4 +.IX Item "--help" +Display helpscreen and exit +.IP "\-u, \-\-user=#" 4 +.IX Item "-u, --user=#" +user for database login if not current user. Give a user +who has sufficient privileges (\s-1CREATE\s0, ...). +.IP "\-p, \-\-password=# (INSECURE)" 4 +.IX Item "-p, --password=# (INSECURE)" +password to use when connecting to server. +WARNING: Providing a password on command line is insecure as it is visible through /proc to anyone for a short time. +.IP "\-h, \-\-host=#" 4 +.IX Item "-h, --host=#" +host to connect to +.IP "\-P, \-\-port=#" 4 +.IX Item "-P, --port=#" +port to use when connecting to server +.IP "\-S, \-\-socket=#" 4 +.IX Item "-S, --socket=#" +\&\s-1UNIX\s0 domain socket to use when connecting to server +.SH "WARRANTY" +.IX Header "WARRANTY" +This software is free and comes without warranty of any kind. You +should never trust backup software without studying the code yourself. +Study the code inside this script and only rely on it if \fIyou\fR believe +that it does the right thing for you. +.Sp +Patches adding bug fixes, documentation and new features are welcome. +.SH "TO DO" +.IX Header "TO DO" +Use extended inserts to be faster (for servers with many databases +or tables). But to do that, must care about net\-buffer\-length. +.SH "AUTHOR" +.IX Header "AUTHOR" +2002\-06\-18 Guilhem Bichot (guilhem.bichot@mines\-paris.org) +.Sp +And all the authors of mysqlhotcopy, which served as a model for +the structure of the program. diff --git a/storage/xtradb/build/debian/additions/mysql_waitpid.1 b/storage/xtradb/build/debian/additions/mysql_waitpid.1 new file mode 100644 index 00000000000..f6877865ba8 --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysql_waitpid.1 @@ -0,0 +1,20 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +mysql_waitpid \- Waits a specified amount of seconds for a PID to terminate. +.SH SYNOPSIS +mysql_waitpid [options] <pid> <seconds> +.SH DESCRIPTION +Description: Waits for a program, which program id is #pid, to +terminate within #time seconds. If the program terminates within +this time, or if the #pid no longer exists, value 0 is returned. +Otherwise 1 is returned. Both #pid and #time must be positive +integer arguments. + +See mysql_waitpid for options. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/mysqlbinlog.1 b/storage/xtradb/build/debian/additions/mysqlbinlog.1 new file mode 100644 index 00000000000..fcdf2a083f4 --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysqlbinlog.1 @@ -0,0 +1,17 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +mysqlbinlog \- Dumps MySQL binary logs. +.SH SYNOPSIS +mysqlbinlog [options] +.SH DESCRIPTION +Dumps a MySQL binary log in a format usable for viewing or for pipeing to +the mysql command line client + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/mysqlbug.1 b/storage/xtradb/build/debian/additions/mysqlbug.1 new file mode 100644 index 00000000000..133330dd897 --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysqlbug.1 @@ -0,0 +1,14 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +mysqlbug \- MySQL bug reporting tool. +.SH SYNOPSIS +mysqlbug [options] +.SH DESCRIPTION +Interactive bug reporting tool. Use reportbug on Debian systems. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/mysqlcheck.1 b/storage/xtradb/build/debian/additions/mysqlcheck.1 new file mode 100644 index 00000000000..b36ba2d1eb1 --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysqlcheck.1 @@ -0,0 +1,28 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +mysqlcheck \- MySQL program for repairing, checking and optimizing tables. +.SH SYNOPSIS +mysqlcheck | mysqlanalyze | mysqloptimize [options] +.SH DESCRIPTION +This program can be used to CHECK (-c,-m,-C), REPAIR (-r), ANALYZE (-a) +or OPTIMIZE (-o) tables. Some of the options (like -e or -q) can be +used same time. It works on MyISAM and in some cases on BDB tables. +Please consult the MySQL manual for latest information about the +above. The options -c,-r,-a and -o are exclusive to each other, which +means that the last option will be used, if several was specified. + +The option -c will be used by default, if none was specified. You +can change the default behavior by making a symbolic link, or +copying this file somewhere with another name, the alternatives are: +mysqlrepair: The default option will be -r +mysqlanalyze: The default option will be -a +mysqloptimize: The default option will be -o + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (8) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/mysqld_safe_syslog.cnf b/storage/xtradb/build/debian/additions/mysqld_safe_syslog.cnf new file mode 100644 index 00000000000..3b0445d6bd8 --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysqld_safe_syslog.cnf @@ -0,0 +1,2 @@ +[mysqld_safe] +syslog diff --git a/storage/xtradb/build/debian/additions/mysqldumpslow.1 b/storage/xtradb/build/debian/additions/mysqldumpslow.1 new file mode 100644 index 00000000000..0431ef04cbb --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysqldumpslow.1 @@ -0,0 +1,50 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +mysqldumpslow \- Parse and summarize the MySQL slow query log. +.SH SYNOPSIS +mysqldumpslow [options] +.SH DESCRIPTION +This program parses and summarizes a 'slow query log'. + +.TP +\fB\-v\fR +verbose +.TP +\fB\-d\fR +debug +.TP +\fB\-s=WORD\fR +what to sort by (t, at, l, al, r, ar etc) +.TP +\fB\-r\fR +reverse the sort order (largest last instead of first) +.TP +\fB\-t=NUMBER\fR +just show the top n queries +.TP +\fB\-a\fR +don't abstract all numbers to N and strings to 'S' +.TP +\fB\-n=NUMBER\fR +abstract numbers with at least n digits within names +.TP +\fB\-g=WORD\fR +grep: only consider stmts that include this string +.TP +\fB\-h=WORD\fR +hostname of db server for *-slow.log filename (can be wildcard) +.TP +\fB\-i=WORD\fR +name of server instance (if using mysql.server startup script) +.TP +\fB\-l\fR +don't subtract lock time from total time + +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org> based on +the commends in the code. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/mysqlimport.1 b/storage/xtradb/build/debian/additions/mysqlimport.1 new file mode 100644 index 00000000000..9007307a328 --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysqlimport.1 @@ -0,0 +1,20 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +mysqlimport \- Imports text files with MySQL database queries. +.SH SYNOPSIS +mysqlimport [options] +.SH DESCRIPTION +Loads tables from text files in various formats. The base name of the +text file must be the name of the table that should be used. +If one uses sockets to connect to the MySQL server, the server will open and +read the text file directly. In other cases the client will open the text +file. The SQL command 'LOAD DATA INFILE' is used to import the rows. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/mysqlmanager.1 b/storage/xtradb/build/debian/additions/mysqlmanager.1 new file mode 100644 index 00000000000..ebb69adbd09 --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysqlmanager.1 @@ -0,0 +1,49 @@ +.TH mysql 1 "March 2005" "MySQL 4.1" "MySQL database" +.SH NAME +mysqlmanager \- Manages instances of MySQL server. +.SH SYNOPSIS +.B mysqlmanager +[\fIOPTIONS\fR] +.SH DESCRIPTION +Manages instances of MySQL server. +.TP +\-?, \fB\-\-help\fR +Display this help and exit. +.TP +\fB\-P\fR, \fB\-\-port=\fR# +Port number to listen on. +.TP +\fB\-l\fR, \fB\-\-log\fR=\fIname\fR +Path to log file. +.TP +\fB\-b\fR, \fB\-\-bind\-address=\fR# +Address to listen on. +.HP +\fB\-B\fR, \fB\-\-tcp\-backlog=\fR# Size of TCP/IP listen queue. +.HP +\fB\-g\fR, \fB\-\-greeting\fR=\fIname\fR Set greeting on connect. +.TP +\fB\-m\fR, \fB\-\-max\-command\-len=\fR# +Maximum command length. +.TP +\fB\-d\fR, \fB\-\-one\-thread\fR +Use one thread ( for debugging). +.TP +\fB\-C\fR, \fB\-\-connect\-retries=\fR# +Number of attempts to establish MySQL connection. +.TP +\fB\-p\fR, \fB\-\-password\-file\fR=\fIname\fR +Password file for manager. +.HP +\fB\-f\fR, \fB\-\-pid\-file\fR=\fIname\fR Pid file to use. +.TP +\fB\-V\fR, \fB\-\-version\fR +Output version information and exit. +.SH "SEE ALSO" +The full documentation for +.B mysqlmanager +is available in the package mysql-doc-4.1 or on the MySQL +homepage www.mysql.com. +.SH AUTHOR +This manpage was created by Christian Hammers <ch@debian.org> +using help2man. diff --git a/storage/xtradb/build/debian/additions/mysqlreport b/storage/xtradb/build/debian/additions/mysqlreport new file mode 100644 index 00000000000..402a5be835d --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysqlreport @@ -0,0 +1,1298 @@ +#!/usr/bin/perl -w + +# mysqlreport v3.5 Apr 16 2008 +# http://hackmysql.com/mysqlreport + +# mysqlreport makes an easy-to-read report of important MySQL status values. +# Copyright 2006-2008 Daniel Nichter +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# The GNU General Public License is available at: +# http://www.gnu.org/copyleft/gpl.html + +use strict; +use File::Temp qw(tempfile); +use DBI; +use Getopt::Long; +eval { require Term::ReadKey; }; +my $RK = ($@ ? 0 : 1); + +sub have_op; + +my $WIN = ($^O eq 'MSWin32' ? 1 : 0); +my %op; +my %mycnf; # ~/.my.cnf +my ($tmpfile_fh, $tmpfile); +my ($stat_name, $stat_val, $stat_label); +my $MySQL_version; +my (%stats, %vars); # SHOW STATUS, SHOW VARIABLES +my (%DMS_vals, %Com_vals, %ib_vals); +my ($dbh, $query); +my ($questions, $key_read_ratio, $key_write_ratio, $dms, $slow_query_t); +my ($key_cache_block_size, $key_buffer_used, $key_buffer_usage); +my ($qc_mem_used, $qc_hi_r, $qc_ip_r); # Query Cache +my $have_innodb_vals; +my ($ib_bp_used, $ib_bp_total, $ib_bp_read_ratio); +my ($relative_live, $relative_infiles); +my $real_uptime; +my (%stats_present, %stats_past); # For relative reports + +GetOptions ( + \%op, + "user=s", + "password:s", + "host=s", + "port=s", + "socket=s", + "no-mycnf", + "infile|in=s", + "outfile=s", + "flush-status", + "email=s", + "r|relative:i", + "c|report-count=i", + "detach", + "help|?", + "debug" +); + +show_help_and_exit() if $op{'help'}; + +get_user_mycnf() unless $op{'no-mycnf'}; + +# Command line options override ~/.my.cnf +$mycnf{'host'} = $op{'host'} if have_op 'host'; +$mycnf{'port'} = $op{'port'} if have_op 'port'; +$mycnf{'socket'} = $op{'socket'} if have_op 'socket'; +$mycnf{'user'} = $op{'user'} if have_op 'user'; + +$mycnf{'user'} ||= $ENV{'USER'}; + +if(exists $op{'password'}) +{ + if($op{'password'} eq '') # Prompt for password + { + Term::ReadKey::ReadMode(2) if $RK; + print "Password for database user $mycnf{'user'}: "; + chomp($mycnf{'pass'} = <STDIN>); + Term::ReadKey::ReadMode(0), print "\n" if $RK; + } + else { $mycnf{'pass'} = $op{'password'}; } # Use password given on command line +} + +$op{'com'} ||= 3; +$op{'c'} ||= 1; # Used in collect_reports() if --r given integer value + +$relative_live = 0; +$relative_infiles = 0; + +if(defined $op{'r'}) +{ + if($op{r}) { $relative_live = 1; } # if -r was given an integer value + else { $relative_infiles = 1; } +} + +# The report is written to a tmp file first. +# Later it will be moved to $op{'outfile'} or emailed $op{'email'} if needed. +($tmpfile_fh, $tmpfile) = tempfile() or die "Cannot open temporary file for writing: $!\n"; + +if($op{'detach'}) +{ + $SIG{'TERM'} = 'sig_handler'; + + if(fork()) + { + print "mysqlreport has forked and detached.\n"; + print "While running detached, mysqlreport writes reports to '$tmpfile'.\n"; + + exit; + } + + open(STDIN, "</dev/null"); + open(STDOUT, "> $tmpfile") or die "Cannot dup STDOUT: $!\n"; + open(STDERR, "> $tmpfile") or die "Cannot dup STDERR: $!\n"; +} + +select $tmpfile_fh; +$| = 1 if ($op{'detach'} || $relative_live); + +print "tmp file: $tmpfile\n" if $op{debug}; + +# Connect to MySQL +if(!$op{'infile'} && !$relative_infiles) +{ + connect_to_MySQL(); +} + +$have_innodb_vals = 1; # This might be set to 0 later in get_MySQL_version() + +if(defined $op{'r'}) +{ + if($relative_live) + { + print STDERR "mysqlreport is writing relative reports to '$tmpfile'.\n" unless $op{'detach'}; + get_MySQL_version(); + collect_reports(); + } + + if($relative_infiles) { read_relative_infiles(); } +} +else +{ + if(!$op{'infile'}) + { + get_MySQL_version(); + get_vals(); + get_vars(); + } + else + { + read_infile($op{'infile'}); + } + + get_Com_values(); + + set_myisam_vals(); + set_ib_vals() if $have_innodb_vals; + + write_report(); +} + +exit_tasks_and_cleanup(); + +exit; + +# +# Subroutines +# +sub show_help_and_exit +{ + print <<"HELP"; +mysqlreport v3.5 Apr 16 2008 +mysqlreport makes an easy-to-read report of important MySQL status values. + +Command line options (abbreviations work): + --user USER Connect to MySQL as USER + --password PASS Use PASS or prompt for MySQL user's password + --host ADDRESS Connect to MySQL at ADDRESS + --port PORT Connect to MySQL at PORT + --socket SOCKET Connect to MySQL at SOCKET + --no-mycnf Don't read ~/.my.cnf + --infile FILE Read status values from FILE instead of MySQL + --outfile FILE Write report to FILE + --email ADDRESS Email report to ADDRESS (doesn't work on Windows) + --flush-status Issue FLUSH STATUS; after getting current values + --relative X Generate relative reports. If X is an integer, + reports are live from the MySQL server X seconds apart. + If X is a list of infiles (file1 file2 etc.), + reports are generated from the infiles in the order + that they are given. + --report-count N Collect N number of live relative reports (default 1) + --detach Fork and detach from terminal (run in background) + --help Prints this + --debug Print debugging information + +Visit http://hackmysql.com/mysqlreport for more information. +HELP + + exit; +} + +sub get_user_mycnf +{ + print "get_user_mycnf\n" if $op{debug}; + + return if $WIN; + open MYCNF, "$ENV{HOME}/.my.cnf" or return; + while(<MYCNF>) + { + if(/^(.+?)\s*=\s*"?(.+?)"?\s*$/) + { + $mycnf{$1} = $2; + print "get_user_mycnf: read '$1 = $2'\n" if $op{debug}; + } + } + $mycnf{'pass'} ||= $mycnf{'password'} if exists $mycnf{'password'}; + close MYCNF; +} + +sub connect_to_MySQL +{ + print "connect_to_MySQL\n" if $op{debug}; + + my $dsn; + + if($mycnf{'socket'} && -S $mycnf{'socket'}) + { + $dsn = "DBI:mysql:mysql_socket=$mycnf{socket}"; + } + elsif($mycnf{'host'}) + { + $dsn = "DBI:mysql:host=$mycnf{host}" . ($mycnf{port} ? ";port=$mycnf{port}" : ""); + } + else + { + $dsn = "DBI:mysql:host=localhost"; + } + + print "connect_to_MySQL: DBI DSN: $dsn\n" if $op{debug}; + + $dbh = DBI->connect($dsn, $mycnf{'user'}, $mycnf{'pass'}) or die; +} + +sub collect_reports +{ + print "collect_reports\n" if $op{debug}; + + my $i; + + get_vals(); + get_vars(); + + get_Com_values(); + + %stats_past = %stats; + + set_myisam_vals(); + set_ib_vals() if $have_innodb_vals; + + print "#\n# Beginning report, 0 0:0:0\n#\n"; + + write_report(); + + for($i = 0; $i < $op{'c'}; $i++) + { + $dbh->disconnect(); + + sleep($op{'r'}); + + connect_to_MySQL(); + + print "\n#\n# Interval report " , $i + 1 , ", +", sec_to_dhms(($i + 1) * $op{'r'}), "\n#\n"; + + get_vals(); + + write_relative_report(); + } +} + +sub read_relative_infiles +{ + print "read_relative_infiles\n" if $op{debug}; + + my $slurp; # Used to check infiles for multiple sets of status values + my $n_stats; # Number of multiple sets of status values in an infile + my $infile; + my $report_n; # Report number + + $report_n = 1; + + foreach $infile (@ARGV) + { + # Read all of infile into $slurp + open INFILE, "< $infile" or warn and next; + $slurp = do { local $/; <INFILE> }; + close INFILE; + + $n_stats = 0; + + # Count number of status value sets + $n_stats++ while $slurp =~ /Aborted_clients/g; + + print "read_relative_infiles: found $n_stats sets of status values in file '$infile'\n" + if $op{debug}; + + if($n_stats == 1) + { + read_infile($infile); + relative_infile_report($report_n++); + } + + if($n_stats > 1) + { + my @tmpfile_fh; + my @tmpfile_name; + my $i; + my $stat_n; # Status value set number + + # Create a tmp file for each set of status values + for($i = 0; $i < $n_stats; $i++) + { + my ($fh, $name) = tempfile() + or die "read_relative_infiles: cannot open temporary file for writing: $!\n"; + + push(@tmpfile_fh, $fh); + push(@tmpfile_name, $name); + + print "read_relative_infiles: created tmp file '$name' for set $i\n" if $op{debug}; + } + + $i = 0; + $stat_n = 0; + + select $tmpfile_fh[$i]; + + # Read infile again and copy each set of status values to seperate tmp files + open INFILE, "< $infile" or warn and next; + while(<INFILE>) + { + next if /^\+/; + next if /^$/; + + # The infile must begin with the system variable values. + # Therefore, the first occurance of Aborted_clients indicates the beginning + # of the first set of status values if no sets have occured yet ($stat_n == 0). + # In this case, the following status values are printed to the current fh, + # along with the system variable values read thus far, until Aborted_clients + # occurs again. Then begins the second and subsequent sets of status values. + + if(/Aborted_clients/) + { + print and next if $stat_n++ == 0; + select $tmpfile_fh[++$i]; + } + + print; + } + close INFILE; + + # Re-select the main tmp file into which the reports are being written. + select $tmpfile_fh; + + for($i = 0; $i < $n_stats; $i++) + { + close $tmpfile_fh[$i]; + + print "read_relative_infiles: reading set $i tmp file '$tmpfile_name[$i]'\n" + if $op{debug}; + + read_infile($tmpfile_name[$i]); + relative_infile_report($report_n++); + + if($WIN) { `del $tmpfile_name[$i]`; } + else { `rm -f $tmpfile_name[$i]`; } + + print "read_relative_infiles: deleted set $i tmp file '$tmpfile_name[$i]'\n" + if $op{debug}; + } + + } # if($n_stats > 1) + } # foreach $infile (@files) +} + +sub relative_infile_report +{ + print "relative_infile_report\n" if $op{debug}; + + my $report_n = shift; + + if($report_n == 1) + { + get_Com_values(); + + %stats_past = %stats; + + set_myisam_vals(); + set_ib_vals() if $have_innodb_vals; + + print "#\n# Beginning report, 0 0:0:0\n#\n"; + + write_report(); + } + else + { + print "\n#\n# Interval report ", $report_n - 1, ", +", + sec_to_dhms($stats{Uptime} - $stats_past{Uptime}), + "\n#\n"; + + write_relative_report(); + } +} + +sub get_vals +{ + print "get_vals\n" if $op{debug}; + + my @row; + + # Get status values + if($MySQL_version >= 50002) + { + $query = $dbh->prepare("SHOW GLOBAL STATUS;"); + } + else + { + $query = $dbh->prepare("SHOW STATUS;"); + } + $query->execute(); + while(@row = $query->fetchrow_array()) { $stats{$row[0]} = $row[1]; } + + $real_uptime = $stats{'Uptime'}; +} + +sub get_vars +{ + print "get_vars\n" if $op{debug}; + + my @row; + + # Get server system variables + $query = $dbh->prepare("SHOW VARIABLES;"); + $query->execute(); + while(@row = $query->fetchrow_array()) { $vars{$row[0]} = $row[1]; } + + # table_cache was renamed to table_open_cache in MySQL 5.1.3 + if($MySQL_version >= 50103) + { + $vars{'table_cache'} = $vars{'table_open_cache'}; + } +} + +sub read_infile +{ + print "read_infile\n" if $op{debug}; + + my $infile = shift; + + # Default required system variable values if not set in INFILE. + # As of mysqlreport v3.5 the direct output from SHOW VARIABLES; + # can be put into INFILE instead. See http://hackmysql.com/mysqlreportdoc + # for details. + $vars{'version'} = "0.0.0" if !exists $vars{'version'}; + $vars{'table_cache'} = 64 if !exists $vars{'table_cache'}; + $vars{'max_connections'} = 100 if !exists $vars{'max_connections'}; + $vars{'key_buffer_size'} = 8388600 if !exists $vars{'key_buffer_size'}; # 8M + $vars{'thread_cache_size'} = 0 if !exists $vars{'thread_cache_size'}; + $vars{'tmp_table_size'} = 0 if !exists $vars{'tmp_table_size'}; + $vars{'long_query_time'} = '?' if !exists $vars{'long_query_time'}; + $vars{'log_slow_queries'} = '?' if !exists $vars{'log_slow_queries'}; + + # One should also add: + # key_cache_block_size + # query_cache_size + # to INFILE if needed. + + open INFILE, "< $infile" or die "Cannot open INFILE '$infile': $!\n"; + + while(<INFILE>) + { + last if !defined $_; + + next if /^\+/; # skip divider lines + next if /^$/; # skip blank lines + + next until /(Aborted_clients|back_log|=)/; + + if($1 eq 'Aborted_clients') # status values + { + print "read_infile: start stats\n" if $op{debug}; + + while($_) + { + chomp; + if(/([A-Za-z_]+)[\s\t|]+(\d+)/) + { + $stats{$1} = $2; + print "read_infile: save $1 = $2\n" if $op{debug}; + } + else { print "read_infile: ignore '$_'\n" if $op{debug}; } + + last if $1 eq 'Uptime'; # exit while() if end of status values + $_ = <INFILE>; # otherwise, read next line of status values + } + } + elsif($1 eq 'back_log') # system variable values + { + print "read_infile: start vars\n" if $op{debug}; + + while($_) + { + chomp; + if(/([A-Za-z_]+)[\s\t|]+([\w\.\-]+)/) # This will exclude some vars + { # like pid_file which we don't need + $vars{$1} = $2; + print "read_infile: save $1 = $2\n" if $op{debug}; + } + else { print "read_infile: ignore '$_'\n" if $op{debug}; } + + last if $1 eq 'wait_timeout'; # exit while() if end of vars + $_ = <INFILE>; # otherwise, read next line of vars + } + } + elsif($1 eq '=') # old style, manually added system variable values + { + print "read_infile: start old vars\n" if $op{debug}; + + while($_ && $_ =~ /=/) + { + chomp; + if(/^\s*(\w+)\s*=\s*([0-9.]+)(M*)\s*$/) # e.g.: key_buffer_size = 128M + { + $vars{$1} = ($3 ? $2 * 1024 * 1024 : $2); + print "read_infile: read '$_' as $1 = $vars{$1}\n" if $op{debug}; + } + else { print "read_infile: ignore '$_'\n" if $op{debug}; } + + $_ = <INFILE>; # otherwise, read next line of old vars + } + + redo; + } + else + { + print "read_infile: unrecognized line: '$_'\n" if $op{debug}; + } + } + + close INFILE; + + $real_uptime = $stats{'Uptime'}; + + $vars{'table_cache'} = $vars{'table_open_cache'} if exists $vars{'table_open_cache'}; + + get_MySQL_version(); +} + +sub get_MySQL_version +{ + print "get_MySQL_version\n" if $op{debug}; + + return if $MySQL_version; + + my ($major, $minor, $patch); + + if($op{'infile'} || $relative_infiles) + { + ($major, $minor, $patch) = ($vars{'version'} =~ /(\d{1,2})\.(\d{1,2})\.(\d{1,2})/); + } + else + { + my @row; + + $query = $dbh->prepare("SHOW VARIABLES LIKE 'version';"); + $query->execute(); + @row = $query->fetchrow_array(); + ($major, $minor, $patch) = ($row[1] =~ /(\d{1,2})\.(\d{1,2})\.(\d{1,2})/); + } + + $MySQL_version = sprintf("%d%02d%02d", $major, $minor, $patch); + + # Innodb_ status values were added in 5.0.2 + if($MySQL_version < 50002) + { + $have_innodb_vals = 0; + print "get_MySQL_version: no InnoDB reports because MySQL version is older than 5.0.2\n" if $op{debug}; + } +} + +sub set_myisam_vals +{ + print "set_myisam_vals\n" if $op{debug}; + + $questions = $stats{'Questions'}; + + $key_read_ratio = sprintf "%.2f", + ($stats{'Key_read_requests'} ? + 100 - ($stats{'Key_reads'} / $stats{'Key_read_requests'}) * 100 : + 0); + + $key_write_ratio = sprintf "%.2f", + ($stats{'Key_write_requests'} ? + 100 - ($stats{'Key_writes'} / $stats{'Key_write_requests'}) * 100 : + 0); + + $key_cache_block_size = (defined $vars{'key_cache_block_size'} ? + $vars{'key_cache_block_size'} : + 1024); + + $key_buffer_used = $stats{'Key_blocks_used'} * $key_cache_block_size; + + if(defined $stats{'Key_blocks_unused'}) # MySQL 4.1.2+ + { + $key_buffer_usage = $vars{'key_buffer_size'} - + ($stats{'Key_blocks_unused'} * $key_cache_block_size); + } + else { $key_buffer_usage = -1; } + + # Data Manipulation Statements: http://dev.mysql.com/doc/refman/5.0/en/data-manipulation.html + %DMS_vals = + ( + SELECT => $stats{'Com_select'}, + INSERT => $stats{'Com_insert'} + $stats{'Com_insert_select'}, + REPLACE => $stats{'Com_replace'} + $stats{'Com_replace_select'}, + UPDATE => $stats{'Com_update'} + + (exists $stats{'Com_update_multi'} ? $stats{'Com_update_multi'} : 0), + DELETE => $stats{'Com_delete'} + + (exists $stats{'Com_delete_multi'} ? $stats{'Com_delete_multi'} : 0) + ); + + $dms = $DMS_vals{SELECT} + $DMS_vals{INSERT} + $DMS_vals{REPLACE} + $DMS_vals{UPDATE} + $DMS_vals{DELETE}; + + $slow_query_t = format_u_time($vars{long_query_time}); + +} + +sub set_ib_vals +{ + print "set_ib_vals\n" if $op{debug}; + + $ib_bp_used = ($stats{'Innodb_buffer_pool_pages_total'} - + $stats{'Innodb_buffer_pool_pages_free'}) * + $stats{'Innodb_page_size'}; + + $ib_bp_total = $stats{'Innodb_buffer_pool_pages_total'} * $stats{'Innodb_page_size'}; + + $ib_bp_read_ratio = sprintf "%.2f", + ($stats{'Innodb_buffer_pool_read_requests'} ? + 100 - ($stats{'Innodb_buffer_pool_reads'} / + $stats{'Innodb_buffer_pool_read_requests'}) * 100 : + 0); +} + +sub write_relative_report +{ + print "write_relative_report\n" if $op{debug}; + + %stats_present = %stats; + + for(keys %stats) + { + if($stats_past{$_} =~ /\d+/) + { + if($stats_present{$_} >= $stats_past{$_}) # Avoid negative values + { + $stats{$_} = $stats_present{$_} - $stats_past{$_}; + } + } + } + + # These values are either "at present" or "high water marks". + # Therefore, it is more logical to not relativize these values. + # Doing otherwise causes strange and misleading values. + $stats{'Key_blocks_used'} = $stats_present{'Key_blocks_used'}; + $stats{'Open_tables'} = $stats_present{'Open_tables'}; + $stats{'Max_used_connections'} = $stats_present{'Max_used_connections'}; + $stats{'Threads_running'} = $stats_present{'Threads_running'}; + $stats{'Threads_connected'} = $stats_present{'Threads_connected'}; + $stats{'Threads_cached'} = $stats_present{'Threads_cached'}; + $stats{'Qcache_free_blocks'} = $stats_present{'Qcache_free_blocks'}; + $stats{'Qcache_total_blocks'} = $stats_present{'Qcache_total_blocks'}; + $stats{'Qcache_free_memory'} = $stats_present{'Qcache_free_memory'}; + if($have_innodb_vals) + { + $stats{'Innodb_page_size'} = $stats_present{'Innodb_page_size'}; + $stats{'Innodb_buffer_pool_pages_data'} = $stats_present{'Innodb_buffer_pool_pages_data'}; + $stats{'Innodb_buffer_pool_pages_dirty'} = $stats_present{'Innodb_buffer_pool_pages_dirty'}; + $stats{'Innodb_buffer_pool_pages_free'} = $stats_present{'Innodb_buffer_pool_pages_free'}; + $stats{'Innodb_buffer_pool_pages_latched'} = $stats_present{'Innodb_buffer_pool_pages_latched'}; + $stats{'Innodb_buffer_pool_pages_misc'} = $stats_present{'Innodb_buffer_pool_pages_misc'}; + $stats{'Innodb_buffer_pool_pages_total'} = $stats_present{'Innodb_buffer_pool_pages_total'}; + $stats{'Innodb_data_pending_fsyncs'} = $stats_present{'Innodb_data_pending_fsyncs'}; + $stats{'Innodb_data_pending_reads'} = $stats_present{'Innodb_data_pending_reads'}; + $stats{'Innodb_data_pending_writes'} = $stats_present{'Innodb_data_pending_writes'}; + + # Innodb_row_lock_ values were added in MySQL 5.0.3 + if($MySQL_version >= 50003) + { + $stats{'Innodb_row_lock_current_waits'} = $stats_present{'Innodb_row_lock_current_waits'}; + $stats{'Innodb_row_lock_time_avg'} = $stats_present{'Innodb_row_lock_time_avg'}; + $stats{'Innodb_row_lock_time_max'} = $stats_present{'Innodb_row_lock_time_max'}; + } + } + + get_Com_values(); + + %stats_past = %stats_present; + + set_myisam_vals(); + set_ib_vals() if $have_innodb_vals; + + write_report(); +} + +sub write_report +{ + print "write_report\n" if $op{debug}; + + $~ = 'MYSQL_TIME', write; + $~ = 'KEY_BUFF_MAX', write; + if($key_buffer_usage != -1) { $~ = 'KEY_BUFF_USAGE', write } + $~ = 'KEY_RATIOS', write; + write_DTQ(); + $~ = 'SLOW_DMS', write; + write_DMS(); + write_Com(); + $~ = 'SAS', write; + write_qcache(); + $~ = 'REPORT_END', write; + $~ = 'TAB', write; + + write_InnoDB() if $have_innodb_vals; +} + +sub sec_to_dhms # Seconds to days hours:minutes:seconds +{ + my $s = shift; + my ($d, $h, $m) = (0, 0, 0); + + return '0 0:0:0' if $s <= 0; + + if($s >= 86400) + { + $d = int $s / 86400; + $s -= $d * 86400; + } + + if($s >= 3600) + { + $h = int $s / 3600; + $s -= $h * 3600; + } + + $m = int $s / 60; + $s -= $m * 60; + + return "$d $h:$m:$s"; +} + +sub make_short +{ + my ($number, $kb, $d) = @_; + my $n = 0; + my $short; + + $d ||= 2; + + if($kb) { while ($number > 1023) { $number /= 1024; $n++; }; } + else { while ($number > 999) { $number /= 1000; $n++; }; } + + $short = sprintf "%.${d}f%s", $number, ('','k','M','G','T')[$n]; + if($short =~ /^(.+)\.(00)$/) { return $1; } # 12.00 -> 12 but not 12.00k -> 12k + + return $short; +} + +# What began as a simple but great idea has become the new standard: +# long_query_time in microseconds. For MySQL 5.1.21+ and 6.0.4+ this +# is now standard. For 4.1 and 5.0 patches, the architects of this +# idea provide: http://www.mysqlperformanceblog.com/mysql-patches/ +# Relevant notes in MySQL manual: +# http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html +# http://dev.mysql.com/doc/refman/6.0/en/slow-query-log.html +# +# The format_u_time sub simply beautifies long_query_time. + +sub format_u_time # format microsecond (µ) time value +{ + # 0.000000 - 0.000999 = 0 - 999 µ + # 0.001000 - 0.999999 = 1 ms - 999.999 ms + # 1.000000 - n.nnnnnn = 1 s - n.nnnnn s + + my $t = shift; + my $f; # formatted µ time + my $u = chr(($WIN ? 230 : 181)); + + $t = 0 if $t < 0; + + if($t > 0 && $t <= 0.000999) + { + $f = ($t * 1000000) . " $u"; + } + elsif($t >= 0.001000 && $t <= 0.999999) + { + $f = ($t * 1000) . ' ms'; + } + elsif($t >= 1) + { + $f = ($t * 1) . ' s'; # * 1 to remove insignificant zeros + } + else + { + $f = 0; # $t should = 0 at this point + } + + return $f; +} + +sub perc # Percentage +{ + my($is, $of) = @_; + $is = 0 if (not defined $is); + return sprintf "%.2f", ($is * 100) / ($of ||= 1); +} + +sub t # Time average per second +{ + my $val = shift; + return 0 if !$val; + return(make_short($val / $stats{'Uptime'}, 0, 1)); +} + +sub email_report # Email given report to $op{'email'} +{ + print "email_report\n" if $op{debug}; + + return if $WIN; + + my $report = shift; + + open SENDMAIL, "|/usr/sbin/sendmail -t"; + print SENDMAIL "From: mysqlreport\n"; + print SENDMAIL "To: $op{email}\n"; + print SENDMAIL "Subject: MySQL status report on " . ($mycnf{'host'} || 'localhost') . "\n\n"; + print SENDMAIL `cat $report`; + close SENDMAIL; +} + +sub cat_report # Print given report to screen +{ + print "cat_report\n" if $op{debug}; + + my $report = shift; + my @report; + + open REPORT, "< $report"; + @report = <REPORT>; + close REPORT; + print @report; +} + +sub get_Com_values +{ + print "get_Com_values\n" if $op{debug}; + + %Com_vals = (); + + # Make copy of just the Com_ values + for(keys %stats) + { + if(grep /^Com_/, $_ and $stats{$_} > 0) + { + /^Com_(.*)/; + $Com_vals{$1} = $stats{$_}; + } + } + + # Remove DMS values + delete $Com_vals{'select'}; + delete $Com_vals{'insert'}; + delete $Com_vals{'insert_select'}; + delete $Com_vals{'replace'}; + delete $Com_vals{'replace_select'}; + delete $Com_vals{'update'}; + delete $Com_vals{'update_multi'} if exists $Com_vals{'update_multi'}; + delete $Com_vals{'delete'}; + delete $Com_vals{'delete_multi'} if exists $Com_vals{'delete_multi'}; +} + +sub write_DTQ # Write DTQ report in descending order by values +{ + print "write_DTQ\n" if $op{debug}; + + $~ = 'DTQ'; + + my %DTQ; + my $first = 1; + + # Total Com values + $stat_val = 0; + for(values %Com_vals) { $stat_val += $_; } + $DTQ{'Com_'} = $stat_val; + + $DTQ{'DMS'} = $dms; + $DTQ{'QC Hits'} = $stats{'Qcache_hits'} if $stats{'Qcache_hits'} != 0; + $DTQ{'COM_QUIT'} = int (($stats{'Connections'} - 2) - ($stats{'Aborted_clients'} / 2)); + + $stat_val = 0; + for(values %DTQ) { $stat_val += $_; } + if($questions != $stat_val) + { + $DTQ{($questions > $stat_val ? '+Unknown' : '-Unknown')} = abs $questions - $stat_val; + } + + for(sort { $DTQ{$b} <=> $DTQ{$a} } keys(%DTQ)) + { + if($first) { $stat_label = '%Total:'; $first = 0; } + else { $stat_label = ''; } + + $stat_name = $_; + $stat_val = $DTQ{$_}; + write; + } +} + +sub write_DMS # Write DMS report in descending order by values +{ + print "write_DMS\n" if $op{debug}; + + $~ = 'DMS'; + + for(sort { $DMS_vals{$b} <=> $DMS_vals{$a} } keys(%DMS_vals)) + { + $stat_name = $_; + $stat_val = $DMS_vals{$_}; + write; + } +} + +sub write_Com # Write COM report in descending order by values +{ + print "write_Com\n" if $op{debug}; + + my $i = $op{'com'}; + + $~ = 'COM_1'; + + # Total Com values and write first line of COM report + $stat_label = '%Total:' unless $op{'dtq'}; + $stat_val = 0; + for(values %Com_vals) { $stat_val += $_; } + write; + + $~ = 'COM_2'; + + # Sort remaining Com values, print only the top $op{'com'} number of values + for(sort { $Com_vals{$b} <=> $Com_vals{$a} } keys(%Com_vals)) + { + $stat_name = $_; + $stat_val = $Com_vals{$_}; + write; + + last if !(--$i); + } +} + +sub write_qcache +{ + print "write_qcache\n" if $op{debug}; + + # Query cache was added in 4.0.1, but have_query_cache was added in 4.0.2, + # ergo this method is slightly more reliable + return if not exists $vars{'query_cache_size'}; + return if $vars{'query_cache_size'} == 0; + + $qc_mem_used = $vars{'query_cache_size'} - $stats{'Qcache_free_memory'}; + $qc_hi_r = sprintf "%.2f", $stats{'Qcache_hits'} / ($stats{'Qcache_inserts'} ||= 1); + $qc_ip_r = sprintf "%.2f", $stats{'Qcache_inserts'} / ($stats{'Qcache_lowmem_prunes'} ||= 1); + + $~ = 'QCACHE'; + write; +} + +sub write_InnoDB +{ + print "write_InnoDB\n" if $op{debug}; + + return if not defined $stats{'Innodb_page_size'}; + + $stats{'Innodb_buffer_pool_pages_latched'} = 0 if not defined $stats{'Innodb_buffer_pool_pages_latched'}; + + $~ = 'IB'; + write; + + # Innodb_row_lock_ values were added in MySQL 5.0.3 + if($MySQL_version >= 50003) + { + $~ = 'IB_LOCK'; + write; + } + + # Data, Pages, Rows + $~ = 'IB_DPR'; + write; +} + +sub have_op +{ + my $key = shift; + return 1 if (exists $op{$key} && $op{$key} ne ''); + return 0; +} + +sub sig_handler +{ + print "\nReceived signal at " , scalar localtime , "\n"; + exit_tasks_and_cleanup(); + exit; +} + +sub exit_tasks_and_cleanup +{ + print "exit_tasks_and_cleanup\n" if $op{debug}; + + close $tmpfile_fh; + select STDOUT unless $op{'detach'}; + + email_report($tmpfile) if $op{'email'}; + + cat_report($tmpfile) unless $op{'detach'}; + + if($op{'outfile'}) + { + if($WIN) { `move $tmpfile $op{outfile}`; } + else { `mv $tmpfile $op{outfile}`; } + } + else + { + if($WIN) { `del $tmpfile`; } + else { `rm -f $tmpfile`; } + } + + if(!$op{'infile'} && !$relative_infiles) + { + if($op{'flush-status'}) + { + $query = $dbh->prepare("FLUSH STATUS;"); + $query->execute(); + } + + $query->finish(); + $dbh->disconnect(); + } +} + +# +# Formats +# + +format MYSQL_TIME = +MySQL @<<<<<<<<<<<<<<<< uptime @<<<<<<<<<<< @>>>>>>>>>>>>>>>>>>>>>>>> +$vars{'version'}, sec_to_dhms($real_uptime), (($op{infile} || $relative_infiles) ? '' : scalar localtime) +. + +format KEY_BUFF_MAX = + +__ Key _________________________________________________________________ +Buffer used @>>>>>> of @>>>>>> %Used: @>>>>> +make_short($key_buffer_used, 1), make_short($vars{'key_buffer_size'}, 1), perc($key_buffer_used, $vars{'key_buffer_size'}) +. + +format KEY_BUFF_USAGE = + Current @>>>>>> %Usage: @>>>>> +make_short($key_buffer_usage, 1), perc($key_buffer_usage, $vars{'key_buffer_size'}) +. + +format KEY_RATIOS = +Write hit @>>>>>% +$key_write_ratio +Read hit @>>>>>% +$key_read_ratio + +__ Questions ___________________________________________________________ +Total @>>>>>>>> @>>>>>/s +make_short($questions), t($questions) +. + +format DTQ = + @<<<<<<< @>>>>>>>> @>>>>>/s @>>>>>> @>>>>> +$stat_name, make_short($stat_val), t($stat_val), $stat_label, perc($stat_val, $questions) +. + +format SLOW_DMS = +Slow @<<<<<<< @>>>>>> @>>>>>/s @>>>>> %DMS: @>>>>> Log: @>> +$slow_query_t, make_short($stats{'Slow_queries'}), t($stats{'Slow_queries'}), perc($stats{'Slow_queries'}, $questions), perc($stats{'Slow_queries'}, $dms), $vars{'log_slow_queries'} +DMS @>>>>>>>> @>>>>>/s @>>>>> +make_short($dms), t($dms), perc($dms, $questions) +. + +format DMS = + @<<<<<<< @>>>>>>>> @>>>>>/s @>>>>> @>>>>> +$stat_name, make_short($stat_val), t($stat_val), perc($stat_val, $questions), perc($stat_val, $dms) +. + +format COM_1 = +Com_ @>>>>>>>> @>>>>>/s @>>>>> +make_short($stat_val), t($stat_val), perc($stat_val, $questions) +. + +format COM_2 = + @<<<<<<<<<< @>>>>>> @>>>>>/s @>>>>> +$stat_name, make_short($stat_val), t($stat_val), perc($stat_val, $questions) +. + +format SAS = + +__ SELECT and Sort _____________________________________________________ +Scan @>>>>>> @>>>>/s %SELECT: @>>>>> +make_short($stats{'Select_scan'}), t($stats{'Select_scan'}), perc($stats{'Select_scan'}, $stats{'Com_select'}) +Range @>>>>>> @>>>>/s @>>>>> +make_short($stats{'Select_range'}), t($stats{'Select_range'}), perc($stats{'Select_range'}, $stats{'Com_select'}) +Full join @>>>>>> @>>>>/s @>>>>> +make_short($stats{'Select_full_join'}), t($stats{'Select_full_join'}), perc($stats{'Select_full_join'}, $stats{'Com_select'}) +Range check @>>>>>> @>>>>/s @>>>>> +make_short($stats{'Select_range_check'}), t($stats{'Select_range_check'}), perc($stats{'Select_range_check'}, $stats{'Com_select'}) +Full rng join @>>>>>> @>>>>/s @>>>>> +make_short($stats{'Select_full_range_join'}), t($stats{'Select_full_range_join'}), perc($stats{'Select_full_range_join'}, $stats{'Com_select'}) +Sort scan @>>>>>> @>>>>/s +make_short($stats{'Sort_scan'}), t($stats{'Sort_scan'}) +Sort range @>>>>>> @>>>>/s +make_short($stats{'Sort_range'}), t($stats{'Sort_range'}) +Sort mrg pass @>>>>>> @>>>>/s +make_short($stats{'Sort_merge_passes'}), t($stats{'Sort_merge_passes'}) +. + +format QCACHE = + +__ Query Cache _________________________________________________________ +Memory usage @>>>>>> of @>>>>>> %Used: @>>>>> +make_short($qc_mem_used, 1), make_short($vars{'query_cache_size'}, 1), perc($qc_mem_used, $vars{'query_cache_size'}) +Block Fragmnt @>>>>>% +perc($stats{'Qcache_free_blocks'}, $stats{'Qcache_total_blocks'}) +Hits @>>>>>> @>>>>/s +make_short($stats{'Qcache_hits'}), t($stats{'Qcache_hits'}) +Inserts @>>>>>> @>>>>/s +make_short($stats{'Qcache_inserts'}), t($stats{'Qcache_inserts'}) +Insrt:Prune @>>>>>>:1 @>>>>/s +make_short($qc_ip_r), t($stats{'Qcache_inserts'} - $stats{'Qcache_lowmem_prunes'}) +Hit:Insert @>>>>>>:1 +$qc_hi_r, t($qc_hi_r) +. + +# Not really the end... +format REPORT_END = + +__ Table Locks _________________________________________________________ +Waited @>>>>>>>> @>>>>>/s %Total: @>>>>> +make_short($stats{'Table_locks_waited'}), t($stats{'Table_locks_waited'}), perc($stats{'Table_locks_waited'}, $stats{'Table_locks_waited'} + $stats{'Table_locks_immediate'}); +Immediate @>>>>>>>> @>>>>>/s +make_short($stats{'Table_locks_immediate'}), t($stats{'Table_locks_immediate'}) + +__ Tables ______________________________________________________________ +Open @>>>>>>>> of @>>> %Cache: @>>>>> +$stats{'Open_tables'}, $vars{'table_cache'}, perc($stats{'Open_tables'}, $vars{'table_cache'}) +Opened @>>>>>>>> @>>>>>/s +make_short($stats{'Opened_tables'}), t($stats{'Opened_tables'}) + +__ Connections _________________________________________________________ +Max used @>>>>>>>> of @>>> %Max: @>>>>> +$stats{'Max_used_connections'}, $vars{'max_connections'}, perc($stats{'Max_used_connections'}, $vars{'max_connections'}) +Total @>>>>>>>> @>>>>>/s +make_short($stats{'Connections'}), t($stats{'Connections'}) + +__ Created Temp ________________________________________________________ +Disk table @>>>>>>>> @>>>>>/s +make_short($stats{'Created_tmp_disk_tables'}), t($stats{'Created_tmp_disk_tables'}) +Table @>>>>>>>> @>>>>>/s Size: @>>>>> +make_short($stats{'Created_tmp_tables'}), t($stats{'Created_tmp_tables'}), make_short($vars{'tmp_table_size'}, 1, 1) +File @>>>>>>>> @>>>>>/s +make_short($stats{'Created_tmp_files'}), t($stats{'Created_tmp_files'}) +. + +format TAB = + +__ Threads _____________________________________________________________ +Running @>>>>>>>> of @>>> +$stats{'Threads_running'}, $stats{'Threads_connected'} +Cached @>>>>>>>> of @>>> %Hit: @>>>>> +$stats{'Threads_cached'}, $vars{'thread_cache_size'}, make_short(100 - perc($stats{'Threads_created'}, $stats{'Connections'})) +Created @>>>>>>>> @>>>>>/s +make_short($stats{'Threads_created'}), t($stats{'Threads_created'}) +Slow @>>>>>>>> @>>>>>/s +$stats{'Slow_launch_threads'}, t($stats{'Slow_launch_threads'}) + +__ Aborted _____________________________________________________________ +Clients @>>>>>>>> @>>>>>/s +make_short($stats{'Aborted_clients'}), t($stats{'Aborted_clients'}) +Connects @>>>>>>>> @>>>>>/s +make_short($stats{'Aborted_connects'}), t($stats{'Aborted_connects'}) + +__ Bytes _______________________________________________________________ +Sent @>>>>>>>> @>>>>>/s +make_short($stats{'Bytes_sent'}), t($stats{'Bytes_sent'}) +Received @>>>>>>>> @>>>>>/s +make_short($stats{'Bytes_received'}), t($stats{'Bytes_received'}) +. + +format IB = + +__ InnoDB Buffer Pool __________________________________________________ +Usage @>>>>>> of @>>>>>> %Used: @>>>>> +make_short($ib_bp_used, 1), make_short($ib_bp_total, 1), perc($ib_bp_used, $ib_bp_total) +Read hit @>>>>>% +$ib_bp_read_ratio; +Pages + Free @>>>>>>>> %Total: @>>>>> +make_short($stats{'Innodb_buffer_pool_pages_free'}), perc($stats{'Innodb_buffer_pool_pages_free'}, $stats{'Innodb_buffer_pool_pages_total'}) + Data @>>>>>>>> @>>>>> %Drty: @>>>>> +make_short($stats{'Innodb_buffer_pool_pages_data'}), perc($stats{'Innodb_buffer_pool_pages_data'}, $stats{'Innodb_buffer_pool_pages_total'}), perc($stats{'Innodb_buffer_pool_pages_dirty'}, $stats{'Innodb_buffer_pool_pages_data'}) + Misc @>>>>>>>> @>>>>> + $stats{'Innodb_buffer_pool_pages_misc'}, perc($stats{'Innodb_buffer_pool_pages_misc'}, $stats{'Innodb_buffer_pool_pages_total'}) + Latched @>>>>>>>> @>>>>> +$stats{'Innodb_buffer_pool_pages_latched'}, perc($stats{'Innodb_buffer_pool_pages_latched'}, $stats{'Innodb_buffer_pool_pages_total'}) +Reads @>>>>>>>> @>>>>>/s +make_short($stats{'Innodb_buffer_pool_read_requests'}), t($stats{'Innodb_buffer_pool_read_requests'}) + From file @>>>>>>>> @>>>>>/s @>>>>> +make_short($stats{'Innodb_buffer_pool_reads'}), t($stats{'Innodb_buffer_pool_reads'}), perc($stats{'Innodb_buffer_pool_reads'}, $stats{'Innodb_buffer_pool_read_requests'}) + Ahead Rnd @>>>>>>>> @>>>>>/s +$stats{'Innodb_buffer_pool_read_ahead_rnd'}, t($stats{'Innodb_buffer_pool_read_ahead_rnd'}) + Ahead Sql @>>>>>>>> @>>>>>/s +$stats{'Innodb_buffer_pool_read_ahead_seq'}, t($stats{'Innodb_buffer_pool_read_ahead_seq'}) +Writes @>>>>>>>> @>>>>>/s +make_short($stats{'Innodb_buffer_pool_write_requests'}), t($stats{'Innodb_buffer_pool_write_requests'}) +Flushes @>>>>>>>> @>>>>>/s +make_short($stats{'Innodb_buffer_pool_pages_flushed'}), t($stats{'Innodb_buffer_pool_pages_flushed'}) +Wait Free @>>>>>>>> @>>>>>/s +$stats{'Innodb_buffer_pool_wait_free'}, t($stats{'Innodb_buffer_pool_wait_free'}) +. + +format IB_LOCK = + +__ InnoDB Lock _________________________________________________________ +Waits @>>>>>>>> @>>>>>/s +$stats{'Innodb_row_lock_waits'}, t($stats{'Innodb_row_lock_waits'}) +Current @>>>>>>>> +$stats{'Innodb_row_lock_current_waits'} +Time acquiring + Total @>>>>>>>> ms +$stats{'Innodb_row_lock_time'} + Average @>>>>>>>> ms +$stats{'Innodb_row_lock_time_avg'} + Max @>>>>>>>> ms +$stats{'Innodb_row_lock_time_max'} +. + +format IB_DPR = + +__ InnoDB Data, Pages, Rows ____________________________________________ +Data + Reads @>>>>>>>> @>>>>>/s +make_short($stats{'Innodb_data_reads'}), t($stats{'Innodb_data_reads'}) + Writes @>>>>>>>> @>>>>>/s +make_short($stats{'Innodb_data_writes'}), t($stats{'Innodb_data_writes'}) + fsync @>>>>>>>> @>>>>>/s +make_short($stats{'Innodb_data_fsyncs'}), t($stats{'Innodb_data_fsyncs'}) + Pending + Reads @>>>>>>>> +$stats{'Innodb_data_pending_reads'}, t($stats{'Innodb_data_pending_reads'}) + Writes @>>>>>>>> +$stats{'Innodb_data_pending_writes'}, t($stats{'Innodb_data_pending_writes'}) + fsync @>>>>>>>> +$stats{'Innodb_data_pending_fsyncs'}, t($stats{'Innodb_data_pending_fsyncs'}) + +Pages + Created @>>>>>>>> @>>>>>/s +make_short($stats{'Innodb_pages_created'}), t($stats{'Innodb_pages_created'}) + Read @>>>>>>>> @>>>>>/s +make_short($stats{'Innodb_pages_read'}), t($stats{'Innodb_pages_read'}) + Written @>>>>>>>> @>>>>>/s +make_short($stats{'Innodb_pages_written'}), t($stats{'Innodb_pages_written'}) + +Rows + Deleted @>>>>>>>> @>>>>>/s +make_short($stats{'Innodb_rows_deleted'}), t($stats{'Innodb_rows_deleted'}) + Inserted @>>>>>>>> @>>>>>/s +make_short($stats{'Innodb_rows_inserted'}), t($stats{'Innodb_rows_inserted'}) + Read @>>>>>>>> @>>>>>/s +make_short($stats{'Innodb_rows_read'}), t($stats{'Innodb_rows_read'}) + Updated @>>>>>>>> @>>>>>/s +make_short($stats{'Innodb_rows_updated'}), t($stats{'Innodb_rows_updated'}) +. diff --git a/storage/xtradb/build/debian/additions/mysqlreport.1 b/storage/xtradb/build/debian/additions/mysqlreport.1 new file mode 100644 index 00000000000..5ae6b9e3b92 --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysqlreport.1 @@ -0,0 +1,180 @@ +.TH "mysqlreport" "1" "2.5 2006-09-01 (docrev 2006-05-19)" "Daniel Nichter" "MYSQL" +.SH "NAME" +.LP +mysqlreport \- Makes a friendly report of important MySQL status values +.SH "SYNTAX" +.LP +mysqlreport [\fIoptions\fP] +.SH "DESCRIPTION" +.LP +mysqlreport makes a friendly report of important MySQL status values. Actually, +it makes a friendly report of nearly every status value from SHOW STATUS. +Unlike SHOW STATUS which simply dumps over 100 values to screen in one long +list, mysqlreport interprets and formats the values and presents the basic +values and many more inferred values in a human\-readable format. Numerous +example reports are available at the mysqlreport web page at +http://hackmysql.com/mysqlreport. + +The benefit of mysqlreport is that it allows you to very quickly see a wide +array of performance indicators for your MySQL server which would otherwise +need to be calculated by hand from all the various SHOW STATUS values. For +example, the Index Read Ratio is an important value but it's not present in +SHOW STATUS; it's an inferred value (the ratio of Key_reads to +Key_read_requests). + +This documentation outlines all the command line options in mysqlreport, most +of which control which reports are printed. This document does not address +how to interpret these reports; that topic is covered in the document Guide +To Understanding mysqlreport at http://hackmysql.com/mysqlreportguide. + +.SH "OPTIONS" +Technically, command line options are in the form \-\-option, but \-option works +too. All options can be abbreviated if the abbreviation is unique. For example, +option \-\-host can be abbreviated \-\-ho but not \-\-h because \-\-h is ambiguous: it +could mean \-\-host or \-\-help. + +.LP + +.TP +\fB\-\-help\fR +Output help information and exit. + +.TP +\fB\-\-user USER\fR + +.TP +\fB\-\-password\fR +As of version 2.3 \-\-password can take the password on the +command line like "\-\-password FOO". Using \-\-password +alone without giving a password on the command line +causes mysqlreport to prompt for a password. + +.TP +\fB\-\-host ADDRESS\fR + +.TP +\fB\-\-port PORT\fR + +.TP +\fB\-\-socket SOCKET\fR + +.TP +\fB\-\-no\-mycnf\fR +\-\-no\-mycnf makes mysqlreport not read ~/.my.cnf which it does by default +otherwise. \-\-user and \-\-password always override values from ~/.my.cnf. + +.TP +\fB\-\-dtq\fR +Print Distribution of Total Queries (DTQ) report (under +Total in Questions report). Queries (or Questions) can +be divided into four main areas: DMS (see \-\-dms below), +Com_ (see \-\-com below), COM_QUIT (see COM_QUIT and +Questions at http://hackmysql.com/com_quit), and +Unknown. \-\-dtq lists the number of queries in each of +these areas in descending order. + +.TP +\fB\-\-dms\fR +Print Data Manipulation Statements (DMS) report (under +DMS in Questions report). DMS are those from the MySQL +manual section 13.2. Data Manipulation Statements. +(Currently, mysqlreport considers only SELECT, INSERT, +REPLACE, UPDATE, and DELETE.) Each DMS is listed in +descending order by count. + +.TP +\fB\-\-com N\fR +Print top N number of non\-DMS Com_ status values in +descending order (after DMS in Questions report). If N +is not given, default is 3. Such non\-DMS Com_ values +include Com_change_db, Com_show_tables, Com_rollback, +etc. + +.TP +\fB\-\-sas\fR +Print report for Select_ and Sort_ status values (after +Questions report). See MySQL Select and Sort Status +Variables at http://hackmysql.com/selectandsort. + +.TP +\fB\-\-tab\fR +Print Threads, Aborted, and Bytes status reports (after +Created temp report). As of mysqlreport v2.3 the +Threads report reports on all Threads_ status values. + +.TP +\fB\-\-qcache\fR +Print Query Cache report. +.TP +\fB\-\-all\fR +Equivalent to "\-\-dtq \-\-dms \-\-com 3 \-\-sas \-\-qcache". +(Notice \-\-tab is not invoked by \-\-all.) + +.TP +\fB\-\-infile FILE\fR +Instead of getting SHOW STATUS values from MySQL, read +values from FILE. FILE is often a copy of the output of +SHOW STATUS including formatting characters (|, +, \-). +mysqlreport expects FILE to have the format +" value number " where value is only alpha and +underscore characters (A\-Z and _) and number is a +positive integer. Anything before, between, or after +value and number is ignored. mysqlreport also needs +the following MySQL server variables: version, +table_cache, max_connections, key_buffer_size, +query_cache_size. These values can be specified in +INFILE in the format "name = value" where name is one +of the aforementioned server variables and value is a +positive integer with or without a trailing M and +possible periods (for version). For example, to specify +an 18M key_buffer_size: key_buffer_size = 18M. Or, a +256 table_cache: table_cache = 256. The M implies +Megabytes not million, so 18M means 18,874,368 not +18,000,000. If these server variables are not specified +the following defaults are used (respectively) which +may cause strange values to be reported: 0.0.0, 64, +100, 8M, 0. + +.TP +\fB\-\-outfile FILE\fR +After printing the report to screen, print the report +to FILE too. Internally, mysqlreport always writes the +report to a temp file first: /tmp/mysqlreport.PID on +*nix, c:\mysqlreport.PID on Windows (PID is the +script's process ID). Then it prints the temp file to +screen. Then if \-\-outfile is specified, the temp file +is copied to OUTFILE. After \-\-email (below), the temp +file is deleted. + +.TP +\fB\-\-email ADDRESS\fR +After printing the report to screen, email the report +to ADDRESS. This option requires sendmail in +/usr/sbin/, therefore it does not work on Windows. +/usr/sbin/sendmail can be a sym link to qmail, for +example, or any MTA that emulates sendmail's \-t +command line option and operation. The FROM: field is +"mysqlreport", SUBJECT: is "MySQL status report". + +.TP +\fB\-\-flush\-status\fR +Execute a "FLUSH STATUS;" after generating the reports. +If you do not have permissions in MySQL to do this an +error from DBD::mysql::st will be printed after the +reports. + +.SH "AUTHORS" +.LP +Daniel Nichter + +If mysqlreport breaks, send me a message from +http://hackmysql.com/feedback +with the error. + +.SH "SEE ALSO" +.LP +mytop(1) +.LP +The comprehensive Guide To Understanding mysqlreport at +http://hackmysql.com/mysqlreportguide. + diff --git a/storage/xtradb/build/debian/additions/mysqltest.1 b/storage/xtradb/build/debian/additions/mysqltest.1 new file mode 100644 index 00000000000..3469765fe3b --- /dev/null +++ b/storage/xtradb/build/debian/additions/mysqltest.1 @@ -0,0 +1,16 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +mysqltest \- Regressiontest program for MySQL. +.SH SYNOPSIS +mysqltest [options] +.SH DESCRIPTION +Runs a test against the mysql server and compares output with a results file. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/pack_isam.1 b/storage/xtradb/build/debian/additions/pack_isam.1 new file mode 100644 index 00000000000..cad153eedee --- /dev/null +++ b/storage/xtradb/build/debian/additions/pack_isam.1 @@ -0,0 +1,19 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +myisampack \- Compresses MySQL database files. +.SH SYNOPSIS +myisampack [options] +.SH DESCRIPTION +Pack a ISAM-table to take much smaller space +Keys are not updated, so you must run isamchk -rq on any table +that has keys after you have compressed it +You should give the .ISM file as the filename argument + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/resolve_stack_dump.1 b/storage/xtradb/build/debian/additions/resolve_stack_dump.1 new file mode 100644 index 00000000000..2a1e2770275 --- /dev/null +++ b/storage/xtradb/build/debian/additions/resolve_stack_dump.1 @@ -0,0 +1,16 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +resolve_stack_dump \- MySQL helper program for reporting bugs. +.SH SYNOPSIS +resolve_stack_dump [options] +.SH DESCRIPTION +Resolve numeric stack strace dump into symbols. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/additions/resolveip.1 b/storage/xtradb/build/debian/additions/resolveip.1 new file mode 100644 index 00000000000..7aa9439394d --- /dev/null +++ b/storage/xtradb/build/debian/additions/resolveip.1 @@ -0,0 +1,16 @@ +.TH mysql 1 "17 March 2003" "MySQL 3.23" "MySQL database" +.SH NAME +resolveip \- MySQL helper program to retrive IP addresses. +.SH SYNOPSIS +resolveip [options] +.SH DESCRIPTION +Get hostname based on IP-address or IP-address based on hostname. + +For more information start the program with '--help'. +.SH "SEE ALSO" +mysql (1), mysqld (1) +.SH AUTHOR +This manpage was written by Christian Hammers <ch@debian.org>. + +MySQL is available at http://www.mysql.com/. +.\" end of man page diff --git a/storage/xtradb/build/debian/changelog b/storage/xtradb/build/debian/changelog new file mode 100644 index 00000000000..6dc9b561634 --- /dev/null +++ b/storage/xtradb/build/debian/changelog @@ -0,0 +1,4186 @@ +percona-xtradb-dfsg-5.1 (5.1.36-1) experimental; urgency=low + + [TODO] + * Link libmysqlclient.so to libmysqlclient_r.so to help applications + like Apache where some modules, like libaprutil, want to use the thread + safe library and some, like PHP, do not. As the client library just copies + data between client and server, we do not expect significant performance + losses. (thanks to Stefan Fritsch). Closes: #450535 + + Add the following to libmysqlclient16.links: + usr/lib/libmysqlclient_r.so.16.0.0 usr/lib/libmysqlclient.so.16.0.0 + + * Ex-maintainer upload :) + * New upstream release. + * SECURITY: Upstream fix for "mysql client does not escape strings in + --html mode." (CVE-2008-4456) Closes: #526254 + * Upstream fixes REPEAT() function. Closes: #447028 + * Upstream fixes problems when mixing ORDER and GROUP BY. Closes: #470854 + * There were many innodb fixes in the last two years, probably + also for this unreproducible crash. CLoses: #447713 + * Removed amd64 specific -fPIC compiler option that was introduced + especially for building the NDB cluster module which is no longer + part of this package (thanks to Modestas Vainius). Closes: #508406 + * Put /etc/mysql/conf.d to mysql-server-5.1.dirs (thanks to Alexander + Gerasiov). Closes: #515145 + * Fixed mysql-test suite by adding 50_mysql-test__db_test.dpatch. + It now passes 100% of the tests again. Also Closes: #533999 + * Preinst now prevents Installation if NDB configuration is detected. + * Applied Ubuntu patch that fixes privilege bootstrapping in postinst + (thanks to Mathias Gug). Closes: #535492 + * Applied Ubuntu patch that sets the debconf prio for the root password + question to high and prevents it from being asked on 5.0 -> 5.1 upgrades + (thanks to Mathias Gug). Closes: #535500 + * Removed the check for ISAM tables as the only supported upgrade path is + from lenny's MySQL-5.0. + * Added /etc/mysql/conf.d/mysqld_safe_syslog.cnf which enables mysqld_safe + to pipe all mysqld output into the syslog. The reason for not letting dpkg + handle it via a normal config file change was that my.cnf is usually + heavily tuned by the admin so the setting would go lost too easily. + * Updated mysqlreport to version 3.5 (including two minor patches by me). + + -- Christian Hammers <ch@debian.org> Wed, 01 Jul 2009 20:54:58 +0200 + +mysql-dfsg-5.1 (5.1.34-1) experimental; urgency=low + + * New upstream release. + + -- Norbert Tretkowski <nobse@debian.org> Mon, 20 Apr 2009 20:23:10 +0200 + +mysql-dfsg-5.1 (5.1.33-2) experimental; urgency=low + + * Remove no longer active developers from uploaders field. + * Drop workaround for upgrades from MySQL 3.23, not necessary any more. + + -- Norbert Tretkowski <nobse@debian.org> Tue, 07 Apr 2009 11:23:25 +0200 + +mysql-dfsg-5.1 (5.1.33-1) experimental; urgency=low + + * New upstream release. + + -- Norbert Tretkowski <nobse@debian.org> Thu, 02 Apr 2009 21:12:23 +0200 + +mysql-dfsg-5.1 (5.1.32-1) experimental; urgency=low + + * New upstream release. + + -- Norbert Tretkowski <nobse@debian.org> Fri, 06 Mar 2009 18:48:23 +0100 + +mysql-dfsg-5.1 (5.1.31-2) experimental; urgency=low + + * Update SSL certificates, and re-enable SSL related tests when running + the testsuite. + + -- Norbert Tretkowski <nobse@debian.org> Tue, 10 Feb 2009 16:08:42 +0100 + +mysql-dfsg-5.1 (5.1.31-1) experimental; urgency=low + + * New upstream release. + + -- Norbert Tretkowski <nobse@debian.org> Sun, 08 Feb 2009 17:07:11 +0100 + +mysql-dfsg-5.1 (5.1.30-2) experimental; urgency=low + + * Drop MySQL Cluster support, it's deprecated since 5.1.24-RC. + * Fix FTBFS if build twice in a row. (closes: #487091) + + -- Norbert Tretkowski <nobse@debian.org> Fri, 05 Dec 2008 21:04:55 +0100 + +mysql-dfsg-5.1 (5.1.30-1) experimental; urgency=low + + * New upstream release. + + -- Norbert Tretkowski <nobse@debian.org> Thu, 27 Nov 2008 09:09:55 +0100 + +mysql-dfsg-5.1 (5.1.29rc-1) experimental; urgency=low + + * New upstream release. + + -- Norbert Tretkowski <nobse@debian.org> Mon, 27 Oct 2008 20:00:43 +0100 + +mysql-dfsg-5.1 (5.1.26rc-1) experimental; urgency=low + + * New upstream release. + + -- Norbert Tretkowski <nobse@debian.org> Mon, 14 Jul 2008 21:46:59 +0200 + +mysql-dfsg-5.1 (5.1.25rc-1) experimental; urgency=low + + * New upstream release. + + -- Norbert Tretkowski <nobse@debian.org> Sat, 21 Jun 2008 13:55:02 +0200 + +mysql-dfsg-5.1 (5.1.24rc-1) experimental; urgency=low + + * New upstream release. + * Ignore errors in testsuite on ia64 and s390. + + -- Norbert Tretkowski <nobse@debian.org> Wed, 16 Apr 2008 22:03:44 +0200 + +mysql-dfsg-5.1 (5.1.23rc-1) experimental; urgency=low + + * New upstream release. + + [ Christian Hammers ] + * Add PIC support for NDB libraries on amd64 (thanks to Monty Taylor). + * Add extra information when aborting due to a detected downgrade (thanks to + Raphael Pinson). + * Move libndbclient.so.3 to its own package as it now has a version != 0 + (thanks to Raphael Pinson for reminding me). + + [ Monty Taylor ] + * Remove 85_ndb__staticlib.dpatch since we have a libndbclient package now. + * Add myself to the uploaders so that I don't get complaints about package + signing. + * Add libndbclient-dev package to go with libndbclient3. + + [ Norbert Tretkowski ] + * Update patches: + + 41_scripts__mysql_install_db.sh__no_test.dpatch + * Drop patches: + + 70_upstream_debian__configure.dpatch + + 71_upstream_debian__Makefile.in.dpatch + + 99_TEMP_minmax.dpatch + * Remove Adam Conrad from uploaders on his request. Thanks for your work in + the past! + * Ignore errors in testsuite on amd64 and i386. + + -- Norbert Tretkowski <nobse@debian.org> Fri, 29 Feb 2008 10:38:27 +0100 + +mysql-dfsg-5.1 (5.1.22rc-1) experimental; urgency=low + + * New upstream version. + * Let mysql-server-5.1 pre-depend on debconf as it uses it in the preinst. + * Fixed mysql-client-5.1 menu entry for upcoming menu policy 1.4. + + -- Christian Hammers <ch@debian.org> Tue, 02 Oct 2007 22:45:37 +0200 + +mysql-dfsg-5.1 (5.1.21beta-1) experimental; urgency=low + + * My "Greetings from FrOSCon!" release. + * New upstream version. + * libmysqlclient.so.15 has been superseded by libmysqlclient.so.16. + * Renamed libmysqlclient15-dev to libmysqlclient-dev but added an empty + package libmysqlclient15-dev to ease the transition for packages with + a versioned build-dep to libmysqlclient15-dev which is something that + currently does not work with "Provides:". + * Synced with 5.0 branch up to subversion release r909. + * Commented out most of the compile conditionals in the hope that + all architectures can be build the same way. + * Added a lot of new binaries and manpages. + * Switched to plugin based engines. + + -- Christian Hammers <ch@debian.org> Sat, 25 Aug 2007 14:24:40 +0200 + +mysql-dfsg-5.1 (5.1.19beta-1) experimental; urgency=low + + * New upstream release. + + -- Christian Hammers <ch@debian.org> Mon, 11 Jun 2007 23:18:35 +0200 + +mysql-dfsg-5.1 (5.1.16beta-4) experimental; urgency=high + + * Merged with 5.0 r850: + * SECURITY: + In some previous versions mysql_install_db was not idempotent and did + always create passwordless root accounts although it should only on + initial installs (thanks to Olaf van der Spek). Closes: #418672 + * Added check for passwordless root accounts to debian-start. + * As MySQL-5.0 is, at least currently, incompatible with Kernel 2.4 the + installation is aborted for such old kernels. Debian Etch does not + support them anyway according to the release notes but this might be + unexpected and many production servers still have self build ones + installed (thanks to Marc-Christian Petersen). See: #416841 + * Adjusted TeX build-deps to texlive. + * Added innotop. + * Changed maintainer email address to + pkg-mysql-commits@lists.alioth.debian.org + + -- Christian Hammers <ch@debian.org> Thu, 19 Apr 2007 19:29:29 +0200 + +mysql-dfsg-5.1 (5.1.16beta-3) experimental; urgency=low + + * Merged with 5.0 r837: + * Activated the blackhole engine as it's needed for replicating partition + designs (thanks to Cyril SCETBON). + * Fixed segfault on i486 systems without cpuid instruction (thanks to + Lennart Sorensen). Closes: #410474 + * Only use of the non-essential debconf package in postrm if it is + still installed (thanks to Michael Ablassmeier). Closes: #416838 + + -- Christian Hammers <ch@debian.org> Sun, 18 Mar 2007 21:48:11 +0100 + +mysql-dfsg-5.1 (5.1.16beta-2) experimental; urgency=low + + * Merged with 5.0 r818: + * Fixed FTBFS on Sparc introduced with the "make -j" trick in + 5.0.32-8 (thanks to Frank Lichtenheld). Closes: #415026 + + -- Christian Hammers <ch@debian.org> Sun, 18 Mar 2007 21:20:11 +0100 + +mysql-dfsg-5.1 (5.1.16beta-1) experimental; urgency=low + + * New upstream release. + * SECURITY: Using an INFORMATION_SCHEMA table with ORDER BY in a subquery + could cause a server crash (CVE-2007-1420). + * Added temporary patch 90_TEMP_sqlparse-ifdef to avoid build problems. + * Merged with 5.0 r809: + * Updated mysqlreport to latest upstream (and patched --help usage + message and "return if qcache_size==0"). + * Merged with 5.0 r798: + * Adapt MAKE_J to use the -j option with the number of available + processors. (thanks to Raphael Pinson). + * Merged with 5.0 r758: + * Changed minimum required version in dh_makeshlibs to 5.0.27-1 as + 5.0.26 had an ABI breakage in it! + This is the cause for Perl programs crashing with the following error: + Transactions not supported by database at /usr/lib/perl5/DBI.pm line 672 + * Added some more comments to the default my.cnf. + * Added support for /etc/mysql/conf.d/. + * The debian-start script that runs on every server start now first upgrades + the system tables (if neccessary) and then check them as it sometimes did + not work the other way around (e.g. for MediaWiki). The script now uses + mysql_update instead of mysql_update_script as recommended. See: 409780 + + -- Christian Hammers <ch@debian.org> Fri, 2 Mar 2007 01:00:55 +0100 + +mysql-dfsg-5.1 (5.1.15beta-1) experimental; urgency=low + + * New upstream release. + [Monty Taylor] + * Removed patches/25_mysys__default.c - fixed upstream. + * Removed patches/26_client__mysql_upgrade.c - fixed upstream. + * Removed patches/29_scripts__mysqlbug.sh - fixed upstream. + * Removed patches/39_scripts__mysqld_safe.sh__port_dir - fixed upstream. + * Removed patches/42_scripts__mysqldumpslow__slowdir - fixed upstream. + * Removed patches/45_warn-CLI-passwords - fixed upstream. + * Removed patches/89_ndb__records.dpatch - fixed upstream. + * Removed patches/86_ndbapi_tc_selection.dpatch - fixed upstream. + [Christian Hammers] + * Synced with 5.0.32-4. + * mysql-server-5.0 pre-depends on adduser now and has --disabled-login + explicitly added to be on the safe side (thanks to the puiparts team). + Closes: #408362 + * Corrections the terminology regarding NDB in the comments of all config + files and init scripts (thanks to Geert Vanderkelen of MySQL). + + -- Christian Hammers <ch@debian.org> Wed, 7 Feb 2007 11:34:52 -0200 + +mysql-dfsg-5.1 (5.1.14beta-2) experimental; urgency=low + + [Christian Hammers] + * Readded 85_ndb__staticlib.dpatch with slight modifications. + * Backported debian-start scripts from 5.0. + [Monty Taylor] + * Now build-depends on bison. + * Updated to standards 3.7.2. + * Removed references to comp_err. + * build-depend on automake1.9 to match upstream + * Merged runlevel changes from 5.0. + * Added 26_client__mysql_upgrade.c.dpatch to fix a segfault in mysql_upgrade + when using a password. It's been fixed upstream in 5.1.15. + * Moved BDB check to sanity_checks() and added a note about deprecation. + * Use my_print_defaults instead of mysqld --print-defaults + * Changed NDB Data and Management node startup seqence. Prevented both + from restarting on upgrade to address rolling upgrade issues. + * Added a "start-initial" option to the Data Node init script to support + initial node starts. + * Added 86_ndbapi_tc_selection.dpatch to fix a bug that causes a segfault + when using the NdbApi. http://bugs.mysql.com/bug.php?id=24914 + Fixed in 5.1.15 + * Added 89_ndb__records.dpatch to fix + http://bugs.mysql.com/bug.php?id=25567, which causes a table scan per + table per query. + + -- Christian Hammers <ch@debian.org> Wed, 31 Jan 2007 01:17:35 +0100 + +mysql-dfsg-5.1 (5.1.14beta-1) experimental; urgency=low + + * New upstream. + * Removed references to mysql_explain_log + * Changed context for patch to mysqld_multi.1 + * Removed 70_kfreebsd.dpatch - applied to upstream + * Removed 87_ps_Hurd - applied to upstream + * Replaced --without-readline to --with-libedit to configure options, as + --without-readline doesn't seem to do the right thing anymore. + + -- Monty Taylor <mordred@inaugust.com> Wed, 10 Jan 2007 12:59:55 -0800 + +mysql-dfsg-5.1 (5.1.11beta-1) experimental; urgency=low + + * Starting new 5.1 branch! + * FIXME: Following patch couldn't be applied: + ## 85_ndb__staticlib.dpatch by <ch@debian.org> + * FIXME: Following patch couldn't be applied: + ## 86_PATH_MAX.dpatch + + -- Christian Hammers <ch@debian.org> Sat, 29 Jul 2006 11:35:42 +0200 + +mysql-dfsg-5.0 (5.0.51a-19) UNRELEASED; urgency=low + + * New patch 50_fix_mysqldump2.dpatch from 5.0.60 to fix dumping databases + from mysql 4.0 server. (closes: #507789) + * Don't create a guest account during bootstrap. (closes: #463704) + + -- Norbert Tretkowski <nobse@debian.org> Thu, 04 Dec 2008 23:07:19 +0100 + +mysql-dfsg-5.0 (5.0.51a-18) testing-proposed-updates; urgency=high + + * SECURITY: + Fix for CVE-2008-4098: Inadequate validation of paths used in DATA + DIRECTORY and INDEX DIRECTORY clauses of CREATE TABLE statements enabled + attackers to write to tables in other databases to which they could not + ordinarily have access. + + -- Devin Carraway <devin@debian.org> Tue, 25 Nov 2008 05:38:45 +0000 + +mysql-dfsg-5.0 (5.0.51a-17) testing-proposed-updates; urgency=low + + * Don't use commented out passwords from debian.cnf. (closes: #453820) + * Update watch file to recognize releases > 5.0.45. + + -- Norbert Tretkowski <nobse@debian.org> Sun, 02 Nov 2008 13:31:32 +0100 + +mysql-dfsg-5.0 (5.0.51a-16) unstable; urgency=low + + * New patch 60_rpl_test_failure.dpatch from 5.0.54 to fix a race condition + with the rpl_packet test in some cases. (closes: #501413) + + -- Norbert Tretkowski <nobse@debian.org> Thu, 09 Oct 2008 08:50:43 +0200 + +mysql-dfsg-5.0 (5.0.51a-15) unstable; urgency=high + + * SECURITY: + Fix for CVE-2008-3963: An empty bit-string literal (b'') caused a server + crash. Now the value is parsed as an empty bit value (which is treated as + an empty string in string context or 0 in numeric context). + (closes: #498362) + + -- Norbert Tretkowski <nobse@debian.org> Sun, 14 Sep 2008 18:27:46 +0200 + +mysql-dfsg-5.0 (5.0.51a-14) unstable; urgency=low + + * Update debconf translations: + - Swedish, from Martin Bagge. (closes: #491688) + - Netherlands, from Thijs Kinkhorst. (closes: #492723) + + -- Norbert Tretkowski <nobse@debian.org> Sun, 07 Sep 2008 20:18:31 +0200 + +mysql-dfsg-5.0 (5.0.51a-13) unstable; urgency=medium + + * New patch 59_fix_relay_logs_corruption.dpatch from 5.0.56 to fix + corruption in relay logs. (closes: #463515) + + -- Norbert Tretkowski <nobse@debian.org> Wed, 03 Sep 2008 09:13:46 +0200 + +mysql-dfsg-5.0 (5.0.51a-12) unstable; urgency=low + + * Disable rpl_ndb_innodb_trans test when running the testsuite, fails + randomly on i386. (closes: #494238) + + -- Norbert Tretkowski <nobse@debian.org> Sat, 09 Aug 2008 15:56:45 +0200 + +mysql-dfsg-5.0 (5.0.51a-11) unstable; urgency=low + + * Disable innodb_handler test when running the testsuite, fails randomly + on s390. (closes: #491363) + + -- Norbert Tretkowski <nobse@debian.org> Wed, 23 Jul 2008 08:34:51 +0200 + +mysql-dfsg-5.0 (5.0.51a-10) unstable; urgency=high + + * Merge testing-security upload to finally fix CVE-2008-2079, thanks to + Devin Carraway and Steffen Joeris. (closes: #480292) + * New patch 58_disable-ndb-backup-print.dpatch from 5.0.54 to disable + ndb_backup_print, ndb_alter_table and ndb_replace tests when running the + testsuite. (closes: #474893) + * Reenable error handling in testsuite on i386, disabling it was just a + workaround for the problem which is now fixed with the above patch. + * Update debconf translations: + - Vietnamese, from Clytie Siddall. (closes: #486443) + - Spanish, from Javier Fernández-Sanguino Peña. (closes: #488740) + - Slovak, from helix84. (closes: #489266) + * Make lintian happy: + - Fix build-dependency on -1 revision. + - Fix deprecated chown usage. + - Fix spelling error in description. + + -- Norbert Tretkowski <nobse@debian.org> Tue, 15 Jul 2008 19:37:35 +0200 + +mysql-dfsg-5.0 (5.0.51a-9+lenny2) testing-security; urgency=high + + * Non-maintainer upload by the security team. + * Correct error number in symlink.test to avoid FTBFS on some archs. + + -- Steffen Joeris <white@debian.org> Sun, 13 Jul 2008 11:44:57 +0000 + +mysql-dfsg-5.0 (5.0.51a-9+lenny1) testing-security; urgency=high + + * Non-maintainer upload by the security team. + * Correct and expand 92_SECURITY_CVE-2008-2079.dpatch to cover all symlinks + and check the output of fn_format(). (closes: #480292) + Fixes: CVE-2008-2079 + + -- Steffen Joeris <white@debian.org> Sat, 12 Jul 2008 05:30:39 +0000 + +mysql-dfsg-5.0 (5.0.51a-9) unstable; urgency=low + + * Ignore errors in testsuite on i386. (workaround for #474893) + + -- Norbert Tretkowski <nobse@debian.org> Wed, 25 Jun 2008 15:07:03 +0200 + +mysql-dfsg-5.0 (5.0.51a-8) unstable; urgency=low + + * New patch 80_fix_user_setup_on_localhost.dpatch from Daniel Hahler to fix + a duplicate key error when install MySQL server on a host with hostname + localhost. (closes: #478319) + * Really fix build on non-linux systems, this time without producing a build + error on some architectures. (closes: #485971) + * Update debconf translations: + - French, from Christian Perrier. (closes: #478553) + - German, from Alwin Meschede. (closes: #478672) + - Italian, from Luca Monducci. (closes: #479363) + - Czech, from Miroslav Kure. (closes: #480924) + - Galician, from Jacobo Tarrio. (closes: #480965) + - Basque, from Piarres Beobide. (closes: #481840) + - Swedish, from Martin Bagge. (closes: #482466, #486307) + - Turkish, from Mert Dirik. (closes: #484704) + - Russian, from Yuri Kozlov. (closes: #486149) + - Finnish, from Esko Arajärvi. (closes: #486554) + - Portuguese, from Miguel Figueiredo. (closes: #486709) + - Romanian, from Eddy PetriÈ™or. (closes: #486944) + - Japanese, from Hideki Yamane. (closes: #487270) + + -- Norbert Tretkowski <nobse@debian.org> Sat, 21 Jun 2008 19:20:48 +0200 + +mysql-dfsg-5.0 (5.0.51a-7) unstable; urgency=high + + [ Norbert Tretkowski ] + * SECURITY: + Fix for CVE-2008-2079: It was possible to circumvent privileges through + the creation of MyISAM tables employing the DATA DIRECTORY and INDEX + DIRECTORY options to overwrite existing table files in the MySQL data + directory. Use of the MySQL data directory in DATA DIRECTORY and INDEX + DIRECTORY is now disallowed. Patch from openSUSE 11.0, thanks to Michal + Marek. (closes: #480292) + * Fix build on non-linux systems, like hurd-i386. (closes: #480362) + * Include symlinks for mysqlcheck. (closes: #480647) + + [ Monty Taylor ] + * Remove ndb_cpcd, as it is only for the NDB test suite and not useful as a + public program. + * Fix debian-start.inc.sh for table names with characters needing quotes. + Thanks Felix Rublack! (closes: #480525, #481154, #481303, #484012) + * Delete mysql-common.README.Debian. Nothing in it was relevant, and the + useful information is in mysql-server anyway. (closes: #480940) + * Remove a spurious HOME= in logrotate script. + + -- Norbert Tretkowski <nobse@debian.org> Thu, 05 Jun 2008 11:49:45 +0200 + +mysql-dfsg-5.0 (5.0.51a-6) unstable; urgency=low + + * Fix debian-start.inc.sh to not print the row counts of the tables + queried. (closes: #478256, #479697) + + -- Monty Taylor <mordred@inaugust.com> Wed, 14 May 2008 00:47:46 -0700 + +mysql-dfsg-5.0 (5.0.51a-5) unstable; urgency=medium + + * New patch 57_fix_mysql_replication.dpatch from 5.0.54 to fix directory for + relay logs when using replication. + + -- Norbert Tretkowski <nobse@debian.org> Sun, 27 Apr 2008 13:55:04 +0200 + +mysql-dfsg-5.0 (5.0.51a-4) unstable; urgency=low + + [ Monty Taylor ] + * Remove build of ndb docs, since they are not installed. Removed build deps + on TeX and doxygen since that's all they were there for. + * Replace script in check_for_crashed_tables with a myisam-recover option + and a script to trigger a check of those tables. (thanks HarrisonF and + kolbe) + * Replace direct calls to test suite with calls to the make targets used by + the MySQL build and qa teams for releases. + * Add --skip-ndbcluster to the postinst bootstrap command. It's really a + workaround for a bug in 5.1, but it's probably a good idea anyway since we + certainly don't need cluster to spin up, and if people have enabled + cluster in their my.cnf file, there could be postinst issues if cluster + isn't running. + * Remove reference to configure options that no longer exist. + * Add myself to uploaders. + + [ Norbert Tretkowski ] + * New patch 56_fix_order_by.dpatch from Ubuntu to fix ORDER BY not working + with GROUP BY. (closes: #471737) + * Add note about filename extensions in the /etc/mysql/conf.d/ directory in + my.cnf. (closes: #461759) + * Confirm password on install, patch from Nicolas Valcárcel. + (closes: #471887) + * Remove Adam Conrad from uploaders on his request. Thanks for your work in + the past! + * Use lsb_release to detect distribution. + + -- Norbert Tretkowski <nobse@debian.org> Sat, 05 Apr 2008 21:51:43 +0200 + +mysql-dfsg-5.0 (5.0.51a-3) unstable; urgency=low + + * Disable patch 60_raise-max-keylength.dpatch in default build, but still + ship it in the source package. + + -- Norbert Tretkowski <nobse@debian.org> Sun, 17 Feb 2008 18:54:42 +0100 + +mysql-dfsg-5.0 (5.0.51a-2) unstable; urgency=low + + * Replace 54_ssl-client-support.dpatch added in 5.0.51-2 with patch from + upstream. + * Ignore errors in testsuite on powerpc. + + -- Norbert Tretkowski <nobse@debian.org> Sun, 17 Feb 2008 12:42:58 +0100 + +mysql-dfsg-5.0 (5.0.51a-1) unstable; urgency=low + + [ Norbert Tretkowski ] + * New upstream security hotfix release. Low priority upload anyway because + 5.0.51-3 already contained all security fixes. + * Remove patches: + + debian/patches/51_mysqlcheck-result.dpatch + + debian/patches/92_SECURITY_CVE-2007-6303.dpatch + + debian/patches/93_SECURITY_CVE-2007-6304.dpatch + + debian/patches/94_SECURITY_CVE-2008-0226+0227.dpatch + * Add recommendation on libhtml-template-perl to -server package, used by + ndb_size. (closes: #462265) + * New patch 60_raise-max-keylength.dpatch to raise the maximum key length to + 4005 bytes or 1335 UTF-8 characters. (closes: #463137) + * New patch 51_sort-order.dpatch from 5.0.52 to fix incorrect order when + using range conditions on 2 tables or more. + * Support DEB_BUILD_OPTIONS option 'nocheck' to skip tests. + * Update mysqlreport to 3.4a release. + + [ Luk Claes ] + * Updated Japanese debconf translation. (closes: #462158) + + -- Norbert Tretkowski <nobse@debian.org> Wed, 06 Feb 2008 11:57:45 +0100 + +mysql-dfsg-5.0 (5.0.51-3) unstable; urgency=high + + * SECURITY: + Fix for CVE-2008-0226 and CVE-2008-0227: Three vulnerabilities in yaSSL + versions 1.7.5 and earlier were discovered that could lead to a server + crash or execution of unauthorized code. The exploit requires a server + with yaSSL enabled and TCP/IP connections enabled, but does not require + valid MySQL account credentials. The exploit does not apply to OpenSSL. + (closes: #460873) + * Fix LSB header in init scripts (patch from Petter Reinholdtsen). + (closes: #458798) + * Run testsuite on all archs, but ignore errors on alpha, arm, armel, hppa, + mipsel and sparc. (closes: #460402) + + -- Norbert Tretkowski <nobse@debian.org> Wed, 23 Jan 2008 11:37:11 +0100 + +mysql-dfsg-5.0 (5.0.51-2) unstable; urgency=low + + [ Monty Taylor ] + * Added --with-system-type to set the version_compile_os field. + * Cleaned up some lintian warnings. + * Removed 43_scripts__mysql_update__password.dpatch since we don't use + mysql_upgrade_shell anymore and use mysql_upgrade instead. + * Removed 88_mctype_attrib.dpatch, http://bugs.mysql.com/bug.php?id=25118 is + closed with http://lists.mysql.com/commits/24337 + * Added mysql-community/mysql-enterprise virtual packages in provides and + conflicts to ease transitions between versions. + + [ Norbert Tretkowski ] + * Add -fPIC to CFLAGS to allow other packages to be built against + libmysqld.a on amd64. (closes: #457915) + * New patch 55_testsuite-2008.dpatch to fix FTBFS in testsuite. + (closes: #458695) + * New patch 54_ssl-client-support.dpatch to fix SSL client support. + * Don't run testsuite on alpha, arm, hppa, mipsel and sparc. + + -- Norbert Tretkowski <nobse@debian.org> Wed, 02 Jan 2008 18:40:04 +0100 + +mysql-dfsg-5.0 (5.0.51-1) unstable; urgency=low + + * New upstream release. + + Fix a crash in mysql_client_test due to gcc 4.x optimizations. + (closes: #452558) + * Update patches: + + debian/patches/41_scripts__mysql_install_db.sh__no_test.dpatch + + debian/patches/89_ndb__staticlib.dpatch + * Run testsuite after build. + * Re-add manpages, they are licensed under GPL now and redistribution is + permitted. + * Drop linux-libc-dev build-dependency, it's now being pulled by libc-dev + which is build-essential. (closes: #431018) + * Remove old optimizations for MySQL 3.23.x, they are no longer required. + (closes: #436552) + * Don't fail when upgrading mysql-common if $datadir is empty or not defined + (patch from Edward Allcutt). (closes: #453127) + * New patch from 5.0.52 to fix mysqldump because 'null' is shown as type of + fields for view with bad definer. (closes: #454227) + * New patch from 5.0.52 to fix mysqlcheck test result. + * New patch from 5.0.52 to fix wrong optimization in ndb code when building + with gcc 4.2.x. + * New patch from 5.0.54 to fix wrong number output due to integer overflow + when building with gcc 4.2.x. + * New Finnish debconf translation from Esko Arajärvi. (closes: #448776) + * Update Basque debconf translation from Aitor Ibañez. (closes: #456193) + * Add Vcs-* and Homepage fields to source stanza in control file. + * Update mysqlreport to 3.2 release. + * Let mysql-server-5.0 pre-depend on debconf, because it's preinst is using + it. + * Drop menu item for innotop. + + -- Norbert Tretkowski <nobse@debian.org> Fri, 14 Dec 2007 09:59:36 +0100 + +mysql-dfsg-5.0 (5.0.45-5) unstable; urgency=high + + * SECURITY: + Fix for CVE-2007-6303: ALTER VIEW retained the original DEFINER value, + even when altered by another user, which could allow that user to gain the + access rights of the view. Now ALTER VIEW is allowed only to the original + definer or users with the SUPER privilege. (closes: #455737) + * SECURITY: + Fix for CVE-2007-6304: When using a FEDERATED table, the local server can + be forced to crash if the remote server returns a result with fewer columns + than expected. + + -- Norbert Tretkowski <nobse@debian.org> Wed, 12 Dec 2007 20:23:43 +0100 + +mysql-dfsg-5.0 (5.0.45-4) unstable; urgency=high + + * SECURITY: + Fix for CVE-2007-5969: Using RENAME TABLE against a table with explicit + DATA DIRECTORY and INDEX DIRECTORY options can be used to overwrite system + table information by replacing the file to which the symlink points. + (closes: #455010) + + -- Norbert Tretkowski <nobse@debian.org> Sun, 09 Dec 2007 12:29:54 +0100 + +mysql-dfsg-5.0 (5.0.45-3) unstable; urgency=high + + * SECURITY: + Fix for CVE-2007-5925: The convert_search_mode_to_innobase function in + ha_innodb.cc in the InnoDB engine in MySQL 5.1.23-BK and earlier allows + remote authenticated users to cause a denial of service (database crash) + via a certain CONTAINS operation on an indexed column, which triggers an + assertion error. (closes: #451235) + + -- Norbert Tretkowski <nobse@debian.org> Thu, 15 Nov 2007 18:40:11 +0100 + +mysql-dfsg-5.0 (5.0.45-2) unstable; urgency=low + + * Package is now team-maintained. (closes: #421026) + + [ Sean Finney ] + * New/updated debconf translations: + - Spanish, from Javier Fernández-Sanguino Peña (closes: #426442). + - German, from Alwin Meschede (closes: #426545). + - Danish, from Claus Hindsgaul (closes: #426783). + - French, from Christian Perrier (closes: #430944). + * Add Recommends on libterm-readkey-perl for mysql-client-5.0 package, used + by mysqlreport add-on to mask password entry (closes: #438375). + + [ Norbert Tretkowski ] + * Add myself to uploaders. + * Suggest usage of an update statement on the user table to change the mysql + root user password instead using mysqladmin, to catch all root users from + all hosts. (closes: #435744) + * Remove informations about a crash in the server during flush-logs when + having expire_logs_days enabled but log-bin not, this bug was fixed in + 5.0.32 already. (closes: #368547) + * Disable log_bin option in default config file and add a note to the NEWS + file. (closes: #349661) + * Fix FTBFS if build twice in a row. (closes: #442684) + * Remove check for buggy options from init script. + * Update innotop to 1.6.0 release. + * Add mysqlreport and innotop to mysql-client description. + * Use shorter server version string. + + -- Norbert Tretkowski <nobse@debian.org> Wed, 14 Nov 2007 20:00:06 +0100 + +mysql-dfsg-5.0 (5.0.45-1) unstable; urgency=low + + * New upstream release. + + [sean finney] + * removed patches that are incorporated into the latest release: + - 70_cpuid_on_i486.dpatch + - 91_SECURITY_CVE-2007-2691_alter-drop + * new patch 90_upstreamdebiandir.dpatch to keep a few lingering references + to the upstream ./debian dir out of the build, at least until we find + a nice way to collaborate on sharing the directory. + * updated CRUFT list to fix double-build breakage (closes: #424590). + * add conditional build-deps for linux-libc-dev to fix FTBFS for + non-linux arch's (closes: #431018). + * added notes to my.cnf and README.Debian about setting tmpdir when + configuring a replication slave. thanks to Rudy Gevaert for pointing + this out (closes: #431825). + + -- sean finney <seanius@debian.org> Tue, 17 Jul 2007 23:50:33 +0200 + +mysql-dfsg-5.0 (5.0.41a-1) unstable; urgency=high + + [sean finney] + * SECURITY: + Fix for CVE-2007-2691: DROP/RENAME TABLE statements (closes: #424778). + [Christian Hammers] + * Removed all manpages from the source (therefore the "41a") as they + are not licensed under the GPL and redistribution is not permitted + (thanks to Mathias Gug). Closes: #430018 + * Added linux-libc-dev to the build-depends as else an illegal dependency to + asm/atomic.h is generated in /usr/include/mysql/my_global.h. Closes: 424276 + [Christian Perrier] + * Debconf templates and debian/control reviewed by the debian-l10n- + english team as part of the Smith review project. Closes: #419974 + * Debconf translation updates: + - French. Closes: #422187 + - Galician. Closes: #420118 + - Italian. Closes: #421349 + - Brazilian Portuguese. Closes: #421516 + - Arabic. Closes: #421751 + - Czech. Closes: #421766 + - Portuguese. Closes: #422428 + + -- Christian Hammers <ch@debian.org> Sun, 24 Jun 2007 21:12:42 +0200 + +mysql-dfsg-5.0 (5.0.41-2) unstable; urgency=low + + * the previous "translation changes" inadvertently introduced unrelated + changes in the package control file. + + -- sean finney <seanius@debian.org> Sun, 13 May 2007 12:32:45 +0200 + +mysql-dfsg-5.0 (5.0.41-1) unstable; urgency=low + + * New upstream release + [sean finney] + * Bump the priority of the debconf prompt for the root password to high, to + ensure the question shows up in a default installation (closes: #418672). + * Debconf templates and debian/control reviewed by the debian-l10n- + english team as part of the Smith review project. Closes: #419974 + * Debconf translation updates: + - French. Closes: #422187 + - Galician. Closes: #420118 + - Italian. Closes: #421349 + - Brazilian Portuguese. Closes: #421516 + - Arabic. Closes: #421751 + - Czech. Closes: #421766 + - Portuguese. Closes: #422428 + * massaged the local PATH_MAX patch. + * removed temp sql parsing patch which has been incorporated upstream + * upstream no longer includes the mysql_create_system_tables command, + so removed our local patches for it. + * the following issues may have been fixed in a previous version of + mysql-server-5.0, but the exact version is not clear so they will be + marked as fixed in this version. + * lots of NDB-related fixes, including those related to problems with + AUTO_INCREMENT (closes: #310878). + * fix for "connections remaining in sleep state" (closes: #318011). + * fix for "denies queries randomly" (closes: #399602). + * problems indexing on char() binary fields were ISAM specific, which is + no longer supported (closes: #326698). + * fix for problems with "complicated joins" (closes: 348682). + * fix for problems with "flushing logs, server crash" (closes: #348682). + * fix for AUTO_INCREMENT and duplicate keys (closes: #416145). + * fix for "DROP FUNCTIONS doesn't work" (closes: #290670). + + -- sean finney <seanius@debian.org> Sat, 12 May 2007 12:10:20 +0200 + +mysql-dfsg-5.0 (5.0.38-3) unstable; urgency=low + + * Added innotop. + * Changed maintainer email address to + pkg-mysql-commits@lists.alioth.debian.org + + -- Christian Hammers <ch@debian.org> Thu, 19 Apr 2007 19:21:15 +0200 + +mysql-dfsg-5.0 (5.0.38-2) unstable; urgency=high + + * SECURITY: + In some previous versions mysql_install_db was not idempotent and did + always create passwordless root accounts although it should only on + initial installs (thanks to Olaf van der Spek). Closes: #418672 + * Added check for passwordless root accounts to debian-start. + * As MySQL-5.0 is, at least currently, incompatible with Kernel 2.4 the + installation is aborted for such old kernels. Debian Etch does not support + them anyway according to the release notes but this might be unexpected + and many production servers still have self build ones installed (thanks + to Marc-Christian Petersen). See: #416841 + * Adjusted TeX build-deps to texlive. + + -- Christian Hammers <ch@debian.org> Tue, 17 Apr 2007 01:00:41 +0200 + +mysql-dfsg-5.0 (5.0.38-1) unstable; urgency=low + + * New upstream release. + * Activated the blackhole engine as it's needed for replicating partition + designs (thanks to Cyril SCETBON). + * Fixed segfault on i486 systems without cpuid instruction (thanks to + Lennart Sorensen). Closes: #410474 + * Only use of the non-essential debconf package in postrm if it is still + installed (thanks to Michael Ablassmeier). Closes: #416838 + + -- Christian Hammers <ch@debian.org> Thu, 5 Apr 2007 22:43:41 +0200 + +mysql-dfsg-5.0 (5.0.36-1) unstable; urgency=low + + * New upstream release. + Closes: #400460, #408159, #408533 + + -- Christian Hammers <ch@debian.org> Thu, 22 Mar 2007 22:16:31 +0100 + +mysql-dfsg-5.0 (5.0.32-10) unstable; urgency=high + + * Really fixed FTBFS on Sparc introduced with the "make -j" trick in + 5.0.32-8 (thanks to Frank Lichtenheld). Closes: #415026 + + -- Christian Hammers <ch@debian.org> Sun, 18 Mar 2007 20:52:33 +0100 + +mysql-dfsg-5.0 (5.0.32-9) unstable; urgency=high + + * Fixed FTBFS on Sparc introduced with the "make -j" trick in 5.0.32-8 + (thanks to Frank Lichtenheld). Closes: #415026 + + -- Christian Hammers <ch@debian.org> Tue, 15 Mar 2007 18:55:42 +0100 + +mysql-dfsg-5.0 (5.0.32-8) unstable; urgency=high + + [Sean Finney] + * SECURITY: + - CVE-2007-1420: Single Row Subselect DoS. Specially crafted subselect + queries could crash the mysql server. Patch backported from upstream + changeset 19685 (46_CVE-2007-1420_subselect_dos.dpatch) + closes: #414790. + [Christian Hammers] + * Adapt MAKE_J to use the -j option with the number of available processors. + (thanks to Raphael Pinson). + * Updated mysqlreport to latest upstream (and patched --help usage message + and "return if qcache_size==0"). + + -- sean finney <seanius@debian.org> Wed, 14 Mar 2007 20:19:08 +0100 + +mysql-dfsg-5.0 (5.0.32-7) unstable; urgency=low + + * Updated French Debconf translation (thanks to Christian Perrier). + Closes: #411330 + * Updated Danish Debconf translation (thanks to Claus Hindsgaul). + Closes: #411328 + * Updated Portuguese Debconf translation (thanks to "Traduz"). + Closes: #411339 + * Updated Czech Debconf translation (thanks to Miroslav Kure). + Closes: #411341 + * Added Norwegian Debconf translation (thanks to Bjorn Steensrud). + Closes: #411345 + * Updated Spanish Debconf translation (thanks to Javier Fernandez-Sanguino + Pena). Closes: #411347 + * Updated Japanese Debconf translation (thanks to Hideki Yamane). + Closes: #411368 + * Updated Swedish Debconf translation (thanks to Andreas Henriksson). + Closes: #411370 + * Updated Italian Debconf translation (thanks to Luca Monducci). + Closes: #411377 + * Updated Galician Debconf translation (thanks to Jacobo Tarrio). + Closes: #411379 + * Updated Russian Debconf translation (thanks to Yuriy Talakan). + Closes: #411442 + * Updated Basque Debconf translation (thanks to Piarres Beobide). + Closes: #411457 + * Updated German Debconf translation (thanks to Alwin Meschede). + Closes: #411480 + * Updated Dutch Debconf translation (thanks to Thijs Kinkhorst). + * Updated Brazilian Portuguese translation (thanks to Andre Luis Lopes). + Closes: #411536 + * Updated Romanian Debconf translation (thanks to Stan Ioan-Eugen). + Closes: #411764 + + -- Christian Hammers <ch@debian.org> Fri, 16 Feb 2007 23:20:42 +0100 + +mysql-dfsg-5.0 (5.0.32-6) unstable; urgency=low + + * Changed wording in Debconf templates to better fit to the graphical + interface (thanks to Frank Kuester). Closes: #411165 + * Lintian suggested style changes to some other Debconf questions. + * Removed accidently stdout output from init script. + + -- Christian Hammers <ch@debian.org> Fri, 16 Feb 2007 20:29:18 +0100 + +mysql-dfsg-5.0 (5.0.32-5) unstable; urgency=medium + + * Backported upstream patch for a bug that crashed the server when using + certain join/group/limit combinations. + Users of the Joomla CMS seemed to be affected by this. Closes: #403721 + * The debian-start script that runs on every server start now first upgrades + the system tables (if neccessary) and then check them as it sometimes did + not work the other way around (e.g. for MediaWiki). The script now uses + mysql_update instead of mysql_update_script as recommended. Closes: 409780 + * Remove the Debconf generated config file in postrm. + + -- Christian Hammers <ch@debian.org> Thu, 15 Feb 2007 04:47:04 +0100 + +mysql-dfsg-5.0 (5.0.32-4) unstable; urgency=high + + [Christian Hammers] + * Changed minimum required version in dh_makeshlibs to 5.0.27-1 as + 5.0.26 had an ABI breakage in it! + This is the cause for Perl programs crashing with the following error: + "Transactions not supported by database at /usr/lib/perl5/DBI.pm line 672" + * The old_passwords setting that is set according to a Debconf question is + now written to /etc/mysql/conf.d/old_passwords.cnf instead directly to the + conffile /etc/mysql/my.cnf which would be fobidden by policy (thanks to + Robert Bihlmeyer). Closes: #409750 + * Added some more comments to the default my.cnf. + [Monty Taylor] + * Added bison to build dependencies. + * Added a "start-initial" option to the Data Node init script to support + initial node starts. + * Changed NDB Data and Management node startup seqence. Prevented both from + restarting on upgrade to address rolling upgrade issues. + * Updated build-depends to depend on automake1.9 instead of automake1.8 + to match what upstream uses. + + -- Christian Hammers <ch@debian.org> Wed, 31 Jan 2007 01:14:09 +0100 + +mysql-dfsg-5.0 (5.0.32-3) unstable; urgency=high + + * mysql-server-5.0 pre-depends on adduser now and has --disabled-login + explicitly added to be on the safe side (thanks to the puiparts team). + Closes: #408362 + * Corrections the terminology regarding NDB in the comments of all config + files and init scripts (thanks to Geert Vanderkelen of MySQL). + * Updated Swedish Debconf translation (thanks to Andreas Henriksson). + Closes: #407859 + * Updated Czech Debconf translation (thanks to Miroslav Kure). + Closes: #407809 + + -- Christian Hammers <ch@debian.org> Thu, 11 Jan 2007 11:18:47 +0100 + +mysql-dfsg-5.0 (5.0.32-2) unstable; urgency=high + + * The last upload suffered from a regression that made NDB totally + unusable and caused a dependency to libmysqlclient15-dev in the + mysql-server-5.0 package. The relevant 85_* patch was re-added again. + Closes: #406435 + * Added lintian-overrides for an error that does not affect our packages. + There are now only warnings and not errors left. + + -- Christian Hammers <ch@debian.org> Tue, 9 Jan 2007 23:55:10 +0100 + +mysql-dfsg-5.0 (5.0.32-1) unstable; urgency=high + + * New upstream version. + * SECURITY: mysql_fix_privilege_tables.sql altered the + table_privs.table_priv column to contain too few privileges, causing + loss of the CREATE VIEW and SHOW VIEW privileges. (MySQL Bug#20589) + * SECURITY (DoS): ALTER TABLE statements that performed both RENAME TO + and {ENABLE|DISABLE} KEYS operations caused a server crash. (MySQL + Bug#24089) + * SECURITY (DoS): LAST_DAY('0000-00-00') could cause a server crash. + (MySQL Bug#23653) + * SECURITY (DoS): Using EXPLAIN caused a server crash for queries that + selected from INFORMATION_SCHEMA in a subquery in the FROM clause. + (MySQL Bug#22413) + * SECURITY (DoS): Invalidating the query cache (e.g. when using stored procedures) + caused a server crash for INSERT INTO ... SELECT statements that + selected from a view. (MySQL Bug#20045) + * Using mysql_upgrade with a password crashed the server. Closes: #406229 + * yaSSL crashed on pre-Pentium Intel and Cyrix CPUs. (MySQL Bug#21765) + Closes: #383759 + * Lots of small fixes to the NDB cluster storage engine. + * Updated Japanese Debconf template (thanks to Hideki Yamane). + Closes: #405793 + * Fixed comment regarding "mycheck" in debian-start (thanks to + Enrico Zini). Closes: #405787 + + -- Christian Hammers <ch@debian.org> Sat, 6 Jan 2007 14:26:20 +0100 + +mysql-dfsg-5.0 (5.0.30-3) unstable; urgency=low + + * Updated Brazilian Debconf translation (thanks to Andre Luis Lopes). + Closes: #403821 + * Added Romanian Debconf translation (thanks to Stan Ioan-Eugen). + Closes: #403943 + * Updated Spanish Debconf translation (thanks to Javier Fernandez-Sanguino + Pena). Closes: #404084 + * Updated Galician Debconf translation (thanks to Jacobo Tarrio). + Closes: #404318 + * Updated Dutch Debconf translation (thanks to Vincent Zweije). + Closes: #404566 + * Updated Danish Debconf translation (thanks to Claus Hindsgaul). + Closes: #405018 + + -- Christian Hammers <ch@debian.org> Thu, 21 Dec 2006 21:35:09 +0100 + +mysql-dfsg-5.0 (5.0.30-2) unstable; urgency=high + + * Fixed upstream regression in header files that lead to FTBFS for + mysql-admin, mysql-query-browser and probably other pacakges. + (thanks to Andreas Henriksson). Closes: #403081, #403082 + * Fixed some upstream scripts by replacing /etc by /etc/mysql (thanks to + Julien Antony). Closes: #401083 + * Updated French Debconf translation (thanks to Christian Perrier). + Closes: #401434 + * Added Spanish Debconf translation (thanks to Javier Fernandez-Sanguino + Pena). Closes: #401953 + * Marked a Debconf question that is just a dummy and only internally + used as not-needing-translation. Closes: #403163 + * Fixed mysqlslowdump patch to not remove the usage() function (thanks + to Monty Tailor). + + -- Christian Hammers <ch@debian.org> Sun, 3 Dec 2006 19:20:10 +0100 + +mysql-dfsg-5.0 (5.0.30-1) unstable; urgency=low + + * New upstream version (switch to the MySQL Enterprise branch). + * Upstream bugfix for the Innodb performance bug: + "Very poor performance with multiple queries running + concurrently (Bug#15815)". + * Upstream bugfix for a possible server crash: + "Selecting from a MERGE table could result in a server crash if the + underlying tables had fewer indexes than the MERGE table itself + (Bug#22937)" + * Upstream bugfies for *lot* of NDB problems. + * Upstream bugfix for Innodb optimizer bug. Closes: #397597 + * Updated Italian Debconf translation (thanks to Luca Monducci). + Closes: #401305 + * Updated debian/watch file to MySQL Enterprise branch. + + -- Christian Hammers <ch@debian.org> Sat, 2 Dec 2006 16:36:38 +0100 + +mysql-dfsg-5.0 (5.0.27-2) unstable; urgency=medium + + * Disabled YaSSL x86 assembler as it was reported to crash applications + like pam-mysql or proftpd-mysql which are linked against libmysqlclient + on i486 and Cyrix (i586) CPUs. Closes: #385147 + * Adjusted mysql-server-4.1 priority to extra and section to oldlibs + according to the ftp masters overrides. + * Updated German Debconf translation (thanks to Alwin Meschede). + Closes: #400809 + + -- Christian Hammers <ch@debian.org> Wed, 22 Nov 2006 13:36:31 +0100 + +mysql-dfsg-5.0 (5.0.27-1) unstable; urgency=medium + + * New upstream version (but no codechange, the only difference to 5.0.26 + was a patch to the ABI change which Debian already included. + * When dist-upgrading from mysql-server-4.1/sarge dpkg does not longer + ask unnecessary "config file has changed" questions regarding + /etc/init.d/mysql, /etc/logrotate.d/mysql-server and + /etc/mysql/debian-start just because these files previously belonged + to mysql-server-4.1 and not to mysql-server-5.0. + To archive this mysql-server-5.0 now pre-depends on mysql-common which + provides current versions of those files. + * The automatic run mysql_upgrade now works with non-standard datadir + settings, too (thanks to Benjami Villoslada). Closes: #394607 + * Debconf now asks if the old_passwords option is really needed. + * Improved explanations of the old_passwords variable in my.cnf. + * Removed possibly leftover cron script from MySQL-4.1 (thanks to + Mario Oyorzabal Salgado). Closes: #390889 + * Postrm ignores failed "userdel mysql". + * Updated Danish Debconf translation (thanks to Claus Hindsgaul). + Closes: #398784 + * Added Euskarian Debconf translation (thanks to Piarres Beobide). + Closes: #399045 + * Updated Japanese Debconf translation (thanks to Hideki Yamane). + Closes: #399074 + * Updated German Debconf translation (thanks to Alwin Meschede). + Closes: #399087 + * New Portuguese debconf translations from Miguel Figueiredo. + Closes: #398186 + + -- Christian Hammers <ch@debian.org> Tue, 7 Nov 2006 21:26:25 +0100 + +mysql-dfsg-5.0 (5.0.26-3) unstable; urgency=high + + [sean finney] + * Fix for the deadly ISAM trap. Now during upgrades we will do our + very best to convert pre-existing ISAM format tables using the + binaries from the previous package. Success is not guaranteed, but + this is probably as good as it gets. Note that this also necessitates + re-introducing an (empty transitional) mysql-server-4.1 package. + Closes: #354544, #354850 + * Remove a couple spurious and wrongly placed WARNING statements from + 45_warn-CLI-passwords.dpatch. thanks to Dan Jacobsen for pointing these + out. Closes: #394262 + + -- sean finney <seanius@debian.org> Fri, 03 Nov 2006 18:34:46 +0100 + +mysql-dfsg-5.0 (5.0.26-2) unstable; urgency=high + + * Fixed FTBFS for Alpha by applying an upstream patch (thanks to Falk + Hueffner). Closes: #395921 + + -- Christian Hammers <ch@debian.org> Sat, 28 Oct 2006 20:13:46 +0200 + +mysql-dfsg-5.0 (5.0.26-1) unstable; urgency=high + + * SECURITY: + This combined release of 5.0.25 and 5.0.26 fixes lot of possible server + crashs so it should get into Etch. Quoting the changelog (bug numbers are + bugs.mysql.com ones): + - character_set_results can be NULL to signify no conversion, but some + code did not check for NULL, resulting in a server crash. (Bug#21913) + - Using cursors with READ COMMITTED isolation level could cause InnoDB to + crash. (Bug#19834) + - Some prepared statements caused a server crash when executed a second + time. (Bug#21166) + - When DROP DATABASE or SHOW OPEN TABLES was issued while concurrently + issuing DROP TABLE (or RENAME TABLE, CREATE TABLE LIKE or any other + statement that required a name lock) in another connection, the server + crashed. (Bug#21216) + - Use of zero-length variable names caused a server crash. (Bug#20908) + - For InnoDB tables, the server could crash when executing NOT IN () + subqueries. (Bug#21077) + - Repeated DROP TABLE statements in a stored procedure could sometimes + cause the server to crash. (Bug#19399) + - Performing an INSERT on a view that was defined using a SELECT that + specified a collation and a column alias caused the server to crash + (Bug#21086). + - A query of the form shown here caused the server to crash. (Bug#21007) + - NDB Cluster: Some queries involving joins on very large NDB tables could + crash the MySQL server. (Bug#21059) + - The character set was not being properly initialized for CAST() with a + type like CHAR(2) BINARY, which resulted in incorrect results or even a + server crash. (Bug#17903) + - For certain queries, the server incorrectly resolved a reference to an + aggregate function and crashed. (Bug#20868) + - The server crashed when using the range access method to execut a + subquery with a ORDER BY DESC clause. (Bug#20869) + - Triggers on tables in the mysql database caused a server crash. Triggers + for tables in this database now are disallowed. (Bug#18361) + - Using SELECT on a corrupt MyISAM table using the dynamic record format + could cause a server crash. (Bug#19835) + - Use of MIN() or MAX() with GROUP BY on a ucs2 column could cause a + server crash. (Bug#20076) + - Selecting from a MERGE table could result in a server crash if the + underlying tables had fewer indexes than the MERGE table itself. + (Bug#21617, Bug#22937) + + * New upstream release. + - This bug would cause trouble for Sarge->Etch upgrades, it was supposed to + have been fixed in 5.0.16 but that apparently did not fix the whole + problem: + Using tables from MySQL 4.x in MySQL 5.x, in particular those with VARCHAR + fields and using INSERT DELAYED to update data in the table would result in + either data corruption or a server crash. (Bug#16611, Bug#16218, Bug#17294) + Closes: #386337 + - Fixes data corruption as an automatic client reconnect used to set + the wrong character set. Closes: #365050 + - Fixes an undefined ulong type in an include file. Closes: #389102 + - Fixes wrong output format when using Unicode characters. Closes: #355302 + - Fixes mysql_upgrade when using a password. Closes: #371841 + + [Christian Hammers] + * Removed --sysconfdir from debian/rules as it puts /etc/mysql/ at the + end of the my.cnf search patch thus overriding $HOME/my.cnf + (thanks to Christoph Biedl). Closes: #394992 + * The provided patch from bug #385947 was wrong, the variable is called + BLOCKSIZE not BLOCK_SIZE according to "strings `which df`" (thanks to + Bruno Muller). Closes: #385947 + + [sean finney] + * new dutch debconf translations from Vincent Zweije (closes: #392809). + * new japanese debconf translations from Hideki Yamane (closes: #391625). + * new italian debconf translations from Luca Monducci (closes: #391741). + * new french debconf translations from Christian Perrier (closes: #393334). + * ran debconf-updatepo to merge the fuzzies into svn. + * massage the following patches so they continue to apply cleanly: + - 44_scripts__mysql_config__libs.dpatch to cleanly apply. + - 45_warn-CLI-passwords.dpatch + - 96_TEMP__libmysqlclient_ssl_symbols.dpatch (note, this patch might + no longer be needed, but is retained "just in case" after massaging it) + * the following patches have been incorporated upstream: + - 70_kfreebsd.dpatch + - 80_hurd_mach.dpatch + - 87_ps_Hurd.dpatch + - 90_TEMP__client__mysql_upgrade__O_EXEC.dpatch + - 91_TEMP__client__mysql_upgrade__password.dpatch + - 92_TEMP__client__mysql_upgrade__defaultgroups.dpatch + - 94_TEMP__CVE-2006-4227.dpatch + - 95_TEMP__CVE-2006-4226.dpatch + * the udf_example.cc has disappeared from the source code, but there's + a udf_example.c which seems to be a good example to use instead :) + * update documentation in the configuration to no longer reference + using my.cnf in the DATADIR, as it's never been the recommended + method for debian systems and hasn't worked since 5.0 was released + anyway (closes: #393868). + + -- Christian Hammers <ch@debian.org> Wed, 25 Oct 2006 19:54:04 +0200 + +mysql-dfsg-5.0 (5.0.24a-9) unstable; urgency=medium + + * Having expire_logs_days enabled but log-bin not crashes the server. Using + both or none of those options is safe. To prevent this happening during the + nightly log rotation via /etc/logrotate.d/mysql the initscript checks for + malicious combination of options. See: #368547 + * The Sarge package "mysql-server" which used to include the mysqld daemon + may still be in unselected-configured state (i.e. after a remove but not + purge) in which case its now obsolete cronscript has to be moved away + (thanks to Charles Lepple). Closes: #385669 + * Updated Danish Debconf translation (thanks to Claus Hindsgaul). + Closes: #390315 + * Updated Frensh Debconf translation (thanks to Christian Perrier). + Closes: #390980 + + -- Christian Hammers <ch@debian.org> Tue, 3 Oct 2006 14:55:31 +0200 + +mysql-dfsg-5.0 (5.0.24a-8) unstable; urgency=low + + * (broken upload) + + -- Christian Hammers <ch@debian.org> Tue, 3 Oct 2006 14:55:31 +0200 + +mysql-dfsg-5.0 (5.0.24a-7) unstable; urgency=low + + * Stopped mysql_config from announcing unnecessary library dependencies + which until now cause "NEEDED" dependencies in the "readelf -d" output + of libraries who only depend on libmysqlclient.so (thanks to Michal + Cihar). Closes: #390692 + + -- Christian Hammers <ch@debian.org> Sun, 1 Oct 2006 23:59:43 +0200 + +mysql-dfsg-5.0 (5.0.24a-6) unstable; urgency=low + + [sean finney] + * finally add support for setting a root password at install. + while this is not a random password as requested in one bug + report, we believe it is the best solution and provides a + means to set a random password via preseeding if it's really + desired (Closes: #316127, #298295). + + -- sean finney <seanius@debian.org> Sun, 01 Oct 2006 23:34:30 +0200 + +mysql-dfsg-5.0 (5.0.24a-5) unstable; urgency=low + + * Added ${shlibs:Depends} to debian/control section libmysqlclient-dev as it + contains the experimental /usr/lib/mysql/libndbclient.so.0.0.0. + * Bumped standards version to 3.7.2. + * Added LSB info section to init scripts. + * Rephrased Debconf templates as suggested by lintian. + * Added benchmark suite in /usr/share/mysql/sql-bench/. + * The mysql.timezone* tables are now filled by the postinst script (thanks + to Mark Sheppard). Closes: #388491 + * Moved Debconf install notes to README.Debian. Displaying them with + medium priority was a bug anyway. Closes: #388941 + * Replaced /usr/bin/mysql_upgrade by /usr/bin/mysql_upgrade_shell in + /etc/mysql/debian-start.sh as it works without errors (thanks to Javier + Kohen). Closes: #389443 + + -- Christian Hammers <ch@debian.org> Wed, 20 Sep 2006 15:01:42 +0200 + +mysql-dfsg-5.0 (5.0.24a-4) unstable; urgency=high + + * libmysqlclient.so.15 from 5.0.24 accidentaly exports some symbols that are + historically exported by OpenSSL's libcrypto.so. This bug was supposed to + be fixed in 5.0.24a bug according to the mysql bug tracking system will + only be fixed in 5.0.25 so I backported the patch. People already reported + crashing apps due to this (thanks to Duncan Simpson). See also: #385348 + Closes: #388262 + * Fixed BLOCKSIZE to BLOCK_SIZE in initscript (thanks to Bruno Muller). + Closes: #385947 + * Added hint to "--extended-insert=0" to mysqldump manpage (thanks to Martin + Schulze). + * Documented the meaning of "NDB" in README.Debian (thanks to Dan Jacobson). + Closes: #386274 + * Added patch to build on hurd-i386 (thanks to Cyril Brulebois). Closes: #387369 + * Fixed debian-start script to work together with the recend LSB modifications in + the initscript (thanks to wens). Closes: #387481 + * Reverted tmpdir change in my.cnf back to /tmp to comply with FHS (thanks + to Alessandro Valente). Closes: #382778 + * Added logcheck filter rule (thanks to Paul Wise). Closes: #381043 + * I will definetly not disable InnoDB but added a note to the default my.cnf + that disabling it saves about 100MB virtual memory (thanks to Olivier + Berger). Closes: #384399 + * Added thread_cache_size=8 to default my.cnf as this variable seems to have + a negligible memory footprint but can improve performance when lots of + threads connect simultaneously as often seen on web servers. + + -- Christian Hammers <ch@debian.org> Mon, 4 Sep 2006 00:21:50 +0200 + +mysql-dfsg-5.0 (5.0.24a-3) unstable; urgency=low + + * Fixed potential tempfile problem in the newly added mysqlreport script. + + -- Christian Hammers <ch@debian.org> Sun, 3 Sep 2006 23:17:24 +0200 + +mysql-dfsg-5.0 (5.0.24a-2) unstable; urgency=low + + * Added "mysqlreport" (GPL'ed) from hackmysql.com. + * Temporarily disabled expire_days option as it causes the server + to crash. See #368547 + * Made output of init scripts LSB compliant (thanks to David Haerdeman). + Closes: #385874 + + -- Christian Hammers <ch@debian.org> Sun, 3 Sep 2006 19:06:53 +0200 + +mysql-dfsg-5.0 (5.0.24a-1) unstable; urgency=high + + * New upstream version. + * The shared library in the 5.0.24 upstream release accidently exported + some symbols that are also exported by the OpenSSL libraries (notably + BN_bin2bn) causing unexpected behaviour in applications using these + functions (thanks to Peter Cernak). Closes: #385348 + * Added note about possible crash on certain i486 clone CPUs. + * Made recipient address of startup mysqlcheck output configurable + (thanks to Mattias Guns). Closes: #385119 + + -- Christian Hammers <ch@debian.org> Mon, 28 Aug 2006 01:22:12 +0200 + +mysql-dfsg-5.0 (5.0.24-3) unstable; urgency=high + + * SECURITY: + CVE-2006-4226: + When run on case-sensitive filesystems, MySQL allows remote + authenticated users to create or access a database when the database + name differs only in case from a database for which they have + permissions. + CVE-2006-4227: + MySQL evaluates arguments of suid routines in the security context of + the routine's definer instead of the routine's caller, which allows + remote authenticated users to gain privileges through a routine that + has been made available using GRANT EXECUTE. + Thanks to Stefan Fritsch for reporting. Closes: #384798 + + -- Christian Hammers <ch@debian.org> Sat, 26 Aug 2006 04:55:17 +0200 + +mysql-dfsg-5.0 (5.0.24-2) unstable; urgency=high + + * 5.0.24-1 introduced an ABI incompatibility, which this patch reverts. + Programs compiled against 5.0.24-1 are not compatible with any other + version and needs a rebuild. + This bug already caused a lot of segfaults and crashes in various + programs. Thanks to Chad MILLER from MySQL for quickly providing a patch. + The shlibdeps version has been increased to 5.0.24-2. + Closes: #384047, #384221, #383700 + + -- Christian Hammers <ch@debian.org> Fri, 25 Aug 2006 21:47:35 +0200 + +mysql-dfsg-5.0 (5.0.24-1) unstable; urgency=high + + * SECURITY: Upstream fixes a security bug which allows a user to continue + accessing a table using a MERGE TABLE after the right to direct access to + the database has been revoked (CVE-2006-4031, MySQL bug #15195). + (Well they did not exactly fixed it, they documented the behaviour and + allow the admin to disable merge table alltogether...). Closes: #380271 + * SECURITY: Applied patch that fixes a possibly insecure filehandling + in the recently added mysql_upgrade binary file (MySQL bug #10320). + * New upstream version. + - Fixes nasty MySQL bug #19618 that leads to crashes when using + "SELECT ... WHERE ... not in (1, -1)" (e.g. vbulletin was affected). + - Fixes upstream bug #16803 so that linking ~/.mysql_history to /dev/null + now has the desired effect of having no history. + * Really fixed the runlevels. Closes: #377651 + * Added patch for broken upstream handling of "host=" to mysql_upgrade.c. + * Adjusted /etc/mysql/debian-start to new mysql_upgrade.c + + -- Christian Hammers <ch@debian.org> Tue, 8 Aug 2006 00:44:13 +0200 + +mysql-dfsg-5.0 (5.0.22-5) unstable; urgency=low + + * Added further line to the logcheck ignore files (thanks to Paul Wise). + Closes: #381038 + + -- Christian Hammers <ch@debian.org> Wed, 2 Aug 2006 00:28:50 +0200 + +mysql-dfsg-5.0 (5.0.22-4) unstable; urgency=low + + * Upstream fixes a bug in the (never released) version 5.0.23 which could + maybe used to crash the server if the mysqlmanager daemon is in use + which is not yet the default in Debian. (CVE-2006-3486 *DISPUTED*) + * Changed runlevel priority of mysqld from 20 to 19 so that it gets started + before apache and proftpd etc. which might depend on an already running + database server (thanks to Martin Gruner). Closes: #377651 + * Added patch which sets PATH_MAX in ndb (thanks to Cyril Brulebois). + Closes: #378949 + * Activated YaSSL as licence issues are settled according to: + http://bugs.mysql.com/?id=16755. This also closes the FTBFS bug + regarding OpenSSL as it is discouraged to use now. Closes: #368639 + * Removed SSL-MINI-HOWTO as the official documentation is good enough now. + * mysql_upgrade no longer gives --password on the commandline which would + be insecure (thanks to Dean Gaudet). Closes: #379199 + * Adjusted debian/patches/45* to make consecutive builds in the same source + tree possible (thanks to Bob Tanner). Closes: #368661 + * mysql-server-5.0 is now suggesting tinyca as yaSSL is enabled and tinyca + was found to be really cool :) + * Moved tempdir from /tmp to /var/tmp as it will more likely have enough + free space as /tmp is often on the root partition and /var or at least + /var/tmp is on a bigger one. + + -- Christian Hammers <ch@debian.org> Mon, 10 Jul 2006 23:30:26 +0200 + +mysql-dfsg-5.0 (5.0.22-3) unstable; urgency=low + + * Added patch for MySQL bug #19618: "select x from x + where x not in(1,-1)" may crash the server" (thanks to + Ruben Puettmann). + + -- Christian Hammers <ch@debian.org> Fri, 9 Jun 2006 01:41:44 +0200 + +mysql-dfsg-5.0 (5.0.22-2) unstable; urgency=high + + * Fixed debian-sys-maint related bug in postinst (thanks to + Jean-Christophe Dubacq). Closes: #369970 + * The last upload was a security patch (which I did not know as I + uploaded before the announcement came). I now added the CVE id for + reference and set urgency to high as the last entry did not. + + -- Christian Hammers <ch@debian.org> Wed, 31 May 2006 01:04:11 +0200 + +mysql-dfsg-5.0 (5.0.22-1) unstable; urgency=low + + * SECURITY: This upstream release fixes an SQL-injection with multibyte + encoding problem. (CVE-2006-2753) + * New upstream release. + * Upstream fixes REPAIR TABLE problem. Closes: #354300 + * Upstream fixes problem that empty strings in varchar and text columns + are displayed as NULL. Closes: #368663 + + -- Christian Hammers <ch@debian.org> Tue, 30 May 2006 23:43:24 +0200 + +mysql-dfsg-5.0 (5.0.21-4) unstable; urgency=low + + * Added "BLOCKSIZE=" to the diskfree check (thanks to Farzad FARID). + Closes: #367027, #367083 + * Further fixed mysql_upgrade upstream script (thanks to Andreas Pakulat) + Closes: #366155 + * Adjusted the /proc test in debian/rules from /proc/1 to /proc/self + to make building on grsec systems possible (thanks to K. Rosenegger). + Closes: #366824 + * Updated Russion Debconf translation (thanks to Yuriy Talakan). + Closes: #367141 + * Updated Czech Debconf translation (thanks to Kiroslav Kure). + Closes: #367160 + * Updated Galician Debconf translation (thanks to Jacobo Tarrio). + Closes: #367384 + * Updated Swedish Debconf translation (thanks to Daniel Nylander). + Closes: #368186 + + -- Christian Hammers <ch@debian.org> Wed, 10 May 2006 08:45:42 +0200 + +mysql-dfsg-5.0 (5.0.21-3) unstable; urgency=low + + * Fixed FTBFS problem which was caused by a patch that modifies Makefile.am + as well as Makefile.in and was not deteced because my desktop was fast + enough to patch both files within the same second and so fooled automake. + (thanks to Blars Blarson for notifying me). Closes: #366534 + + -- Christian Hammers <ch@debian.org> Sat, 6 May 2006 19:03:58 +0200 + +mysql-dfsg-5.0 (5.0.21-2) unstable; urgency=low + + * Fixed bug in postinst that did not correctly rewrite + /etc/mysql/debian.cnf (thanks to Daniel Leidert). + Closes: #365433, #366155 + + -- Christian Hammers <ch@debian.org> Thu, 4 May 2006 02:37:03 +0200 + +mysql-dfsg-5.0 (5.0.21-1) unstable; urgency=high + + * SECURITY: New upstream release with some security relevant bugfixes: + * "Buffer over-read in check_connection with usernames lacking a + trailing null byte" (CVE-2006-1516) + * "Anonymous Login Handshake - Information Leakage" (CVE-2006-1517) + * "COM_TABLE_DUMP Information Leakage and Arbitrary command execution" + (CVE-2006-1518) + Closes: #365938, #365939 + * Added diskfree check to the init script (thanks to Tim Baverstock). + Closes: #365460 + * First amd64 upload! + + -- Christian Hammers <ch@debian.org> Sat, 29 Apr 2006 04:31:27 +0200 + +mysql-dfsg-5.0 (5.0.20a-2) unstable; urgency=low + + * The new mysql-upgrade which is started from /etc/mysql/debian-start + does now use the debian-sys-maint user for authentication (thanks to + Philipp). Closes: #364991 + * Wrote patch debian/patches/43* which adds a password option to + mysql_update. See MySQL bug #19400. + * Added "Provides: libmysqlclient-dev" to libmysqlclient15-dev as I saw no + obvious reasons against it (problems should be documented in + debian/README.Maintainer!) (thanks to Olaf van der Spek). Closes: #364899 + * Updated Netherlands debconf translation (thanks to Vincent Zweije) + Closes: #364464 + * Updated French debconf translation (thanks to Christian Perrier) + Closes: #364401 + * Updated Danish debconf translation (thanks to Claus Hindsgaul) + Closes: #365135 + + -- Christian Hammers <ch@debian.org> Wed, 26 Apr 2006 01:14:53 +0200 + +mysql-dfsg-5.0 (5.0.20a-1) unstable; urgency=low + + * New upstream release. + * Added the new mysql_upgrade script and added it to + /etc/mysql/debian-start (thanks to Alessandro Polverini). + The script is currently very noise that is a known bug and will be + fixed in the next release! + Closes: #363458 + * No longer creates the "test" database. This actuallay had been tried + to archive before (at least patches) exists but apparently was not the + case in the last versions (thanks to Olaf van der Spek). Closes: #362126 + * Reformatted libmysqlclient15off.NEWS.Debian to changelog format + (thanks to Peter Palfrader). Closes: #363062 + + -- Christian Hammers <ch@debian.org> Sat, 15 Apr 2006 13:05:22 +0200 + +mysql-dfsg-5.0 (5.0.20-1) unstable; urgency=high + + * Upstream contains a fix for a nasty bug (MySQL#18153) that users + already experienced and that caused corrupted triggers after + REPAIR/OPTIMIZE/ALTER TABLE statements. + (thanks to Jerome Despatis for pointing out) + * Added patch for the "updates on multiple tables is buggy after + upgrading from 4.1 to 5.0" problem which MySQL has been committed + for the upcoming 5.0.21 release. Closes #352704 + * Added Netherlands debconf translation (thanks to Vincent Zweije). + Closes: #360443 + * Added Galician debconf translation (thanks to Jacobo Tarrio). + Closes: #361257 + + -- Christian Hammers <ch@debian.org> Fri, 7 Apr 2006 00:00:43 +0200 + +mysql-dfsg-5.0 (5.0.19-3) unstable; urgency=high + + [ Christian Hammers ] + * Fixed libmysqlclient15.README.Debian regarding package name changes + (thanks to Leppo). + * Moved libheap.a etc. back to /usr/lib/mysql/ as their names are just + too generic. Closes: #353924 + [ Sean Finney ] + * updated danish debconf translation, thanks to Claus Hindsgaul + (closes: #357424). + [ Adam Conrad ] + * Send stderr from 'find' in preinst to /dev/null to tidy up chatter. + * Backport patch for CVE-2006-0903 from the upcoming release to resolve + a log bypass vulnerability when using non-binary logs (closes: #359701) + + -- Adam Conrad <adconrad@0c3.net> Tue, 4 Apr 2006 15:23:18 +1000 + +mysql-dfsg-5.0 (5.0.19-2) unstable; urgency=medium + + * New upstream release. + * Renamed package libmysqlclient15 to libmysqlclient15off due to + binary incompatible changes. + See /usr/share/doc/libmysqlclient15off/README.Debian + * Updated Czech debconf translation (thanks to Miroslav Kure). + Closes: #356503 + * Updated French debconf translation (thanks to Christian Perrier). + Closes: #356332 + * Improved README.Debian (thanks to Olaf van der Spek). Closes: #355702 + * Fixed 5.0.18-8 changelog by saying in which package the NEWS.Debian + file is (thanks to Ross Boylan). Closes: #355978 + + -- Christian Hammers <ch@debian.org> Fri, 17 Mar 2006 02:32:19 +0100 + +mysql-dfsg-5.0 (5.0.19-1) experimental; urgency=medium + + * New upstream release. + * SECURITY: CVE-2006-3081: A bug where str_to_date(1,NULL) lead to a + server crash has been fixed. + (this note has been added subsequently for reference) + * Renamed package libmysqlclient15 to libmysqlclient15off. + See /usr/share/doc/libmysqlclient15off/NEWS.Debian + * Updated Czech debconf translation (thanks to Miroslav Kure). + Closes: #356503 + * Updated French debconf translation (thanks to Christian Perrier). + Closes: #356332 + * Improved README.Debian (thanks to Olaf van der Spek). Closes: #355702 + * Fixed 5.0.18-8 changelog by saying in which package the NEWS.Debian + file is (thanks to Ross Boylan). Closes: #355978 + + -- Christian Hammers <ch@debian.org> Tue, 14 Mar 2006 22:56:13 +0100 + +mysql-dfsg-5.0 (5.0.18-9) unstable; urgency=medium + + [ Christian Hammers ] + * When using apt-get the check for left-over ISAM tables can abort the + installation of mysql-server-5.0 but not prevent the mysql-server-4.1 + package from getting removed. The only thing I can do is reflect this + in the Debconf notice that is shown and suggest to reinstall + mysql-server-4.1 for converting. See: #354850 + * Suggests removing of /etc/cron.daily/mysql-server in last NEWS message + (thanks to Mourad De Clerck). Closes: #354111 + * Added versioned symbols for kfreebsd and Hurd, too (thanks to Aurelien + Jarno and Michael Bank). Closes: #353971 + * Added versioned symbols for kfreebsd, too (thanks to Aurelien Jarno). + Closes: #353971 + [ Adam Conrad ] + * Add 39_scripts__mysqld_safe.sh__port_dir.dpatch to ensure that the + permissions on /var/run/mysqld are always correct, even on a tmpfs. + + -- Christian Hammers <ch@debian.org> Mon, 6 Mar 2006 21:42:13 +0100 + +mysql-dfsg-5.0 (5.0.18-8) unstable; urgency=low + + * The rotation of the binary logs is now configured via + expire-logs-days in /etc/mysql/my.cnf and handled completely + by the server and no longer in configured in debian-log-rotate.conf + and handled by a cron job. Thanks to David Johnson. + See /usr/share/doc/mysql-server-5.0/NEWS.Debian + * Ran aspell over some files in debian/ and learned a lot :) + * debian/rules: Added check if versioned symbols are really there. + * Updated SSL-MINI-HOWTO. + * Updated copyright (removed the parts regarding the now removed + BerkeleyDB table handler and mysql-doc package). + * Relocated a variable in preinst (thanks to Michael Heldebrant). + Closes: #349258, #352587, #351216 + * Updated Danish debconf translation (thanks to Claus Hindsgaul). + Closes: #349013 + * Updated Swedish debconf translation (thanks to Daniel Nylander). + Closes: #349522 + * Updated French debconf translation (thanks to Christian Perrier). + Closes: #349592 + * Fixed typo in README.Debian (thanks to Vincent Ricard). + * Prolonged waiting time for mysqld in the init script. Closes: #352070 + + -- Christian Hammers <ch@debian.org> Mon, 23 Jan 2006 23:13:46 +0100 + +mysql-dfsg-5.0 (5.0.18-7) unstable; urgency=low + + * Made mailx in debian-start.inc.sh optional and changed the dependency on it + on it to a mere recommendation. Closes: #316297 + * the previous FTBFS patches for GNU/Hurd inadvertently led to configure + being regenerating, losing a couple trivial things like our versioned + symbols patch, causing many nasty problems (closes: #348854). + + -- sean finney <seanius@debian.org> Fri, 20 Jan 2006 20:59:27 +0100 + +mysql-dfsg-5.0 (5.0.18-6) unstable; urgency=low + + * Added version comment (thanks to Daniel van Eeden). + * Added two patches to build on GNU/Hurd (thanks to Michael Bank). + Closes: #348182 + * Abort upgrade if old and now unsupported ISAM tables are present + (thanks to David Coe). Closes: #345895 + + -- Christian Hammers <ch@debian.org> Tue, 17 Jan 2006 19:25:59 +0100 + +mysql-dfsg-5.0 (5.0.18-5) unstable; urgency=low + + * Bump shlibdeps for libmysqlclient15 to (>= 5.0.15-1), which was + the first non-beta release from upstream, as well as being shortly + after we broke the ABI in Debian by introducing versioned symbols. + + -- Adam Conrad <adconrad@0c3.net> Fri, 13 Jan 2006 13:18:03 +1100 + +mysql-dfsg-5.0 (5.0.18-4) unstable; urgency=low + + * Munge our dependencies further to smooth upgrades even more, noting + that we really need 5.0 to conflict with 4.1, and stealing a page from + the book of mysql-common, it doesn't hurt to hint package managers in + the direction of "hey, this stuff is a complete replacement for 4.1" + * Change the description of mysql-server and mysql-client to remove the + references to it being "transition", and instead point out that it's + the way to get the "current best version" of each package installed. + + -- Adam Conrad <adconrad@0c3.net> Wed, 11 Jan 2006 11:39:45 +1100 + +mysql-dfsg-5.0 (5.0.18-3) unstable; urgency=low + + * Make the mysql-{client,server}-5.0 conflict against mysql-{client,server} + versioned, so they can be installed side-by-side and upgrade properly. + * Add myself to Uploaders; since I have access to the alioth repository. + + -- Adam Conrad <adconrad@0c3.net> Tue, 10 Jan 2006 19:15:48 +1100 + +mysql-dfsg-5.0 (5.0.18-2) unstable; urgency=low + + * Removed the transitional package that forced an upgrade from + mysql-server-4.1 to mysql-server-5.0 as I was convinced that + having a general "mysql-server" package with adjusted dependencies + is enough (thanks to Adam Conrad). + * Updated logcheck.ignore files (thanks to Jamie McCarthy). Closes: #340193 + + -- Christian Hammers <ch@debian.org> Mon, 9 Jan 2006 21:54:53 +0100 + +mysql-dfsg-5.0 (5.0.18-1) unstable; urgency=low + + * New upstream version. + * Added empty transitional packages that force an upgrade from the + server and client packages that have been present in Sarge. + * Fixed SSL-MINI-HOWTO (thanks to Jonas Smedegaard). Closes: #340589 + + -- Christian Hammers <ch@debian.org> Mon, 2 Jan 2006 21:17:51 +0100 + +mysql-dfsg-5.0 (5.0.17-1) unstable; urgency=low + + * Never released as Debian package. + + -- Christian Hammers <ch@debian.org> Thu, 22 Dec 2005 07:49:52 +0100 + +mysql-dfsg-5.0 (5.0.16-1) unstable; urgency=low + + * New upstream version. + * Removed the error logs from the logrotate script as Debian does + not use them anymore. Closes: #339628 + + -- Christian Hammers <ch@debian.org> Tue, 22 Nov 2005 01:19:11 +0100 + +mysql-dfsg-5.0 (5.0.15-2) unstable; urgency=medium + + * Added 14_configure__gcc-atomic.h.diff to fix FTBFS on m68k + (thanks to Stephen R Marenka). Closes: #337082 + * Removed dynamic linking against libstdc++ as it was not really + needed (thanks to Adam Conrad). Closes: #328613 + * Fixed the "/var/lib/mysql is a symlink" workaround that accidently + left a stalled symlink (thanks to Thomas Lamy). Closes: #336759 + * As the init script cannot distinguish between a broken startup and + one that just takes very long the "failed" message now says + "or took more than 6s" (thanks to Olaf van der Spek). Closes: #335547 + + -- Christian Hammers <ch@debian.org> Thu, 3 Nov 2005 22:00:15 +0100 + +mysql-dfsg-5.0 (5.0.15-1) unstable; urgency=low + + * New upstream version. 5.0 has finally been declared STABLE! + * Added small patch to debian/rules that fixed sporadic build errors + where stdout and stderr were piped together, got mixed up and broke + * Added --with-big-tables to ./configure (thanks to tj.trevelyan). + Closes: #333090 + * Added capability to parse "-rc" to debian/watch. + * Fixed cronscript (thanks to Andrew Deason). Closes: #335244 + * Added Swedish debconf translation (thanks to Daniel Nylander). + Closes: #333670 + * Added comment to README.Debian regarding applications that manually + set new-style passwords... Closes: #334444 + * Sean Finney: + - Fix duplicate reference to [-e|--extended-insert]. Closes: #334957 + - Fix default behavior for mysqldumpslow. Closes: #334517 + - Reference documentation issue in mysql manpage. Closes: #335219 + + -- Christian Hammers <ch@debian.org> Fri, 30 Sep 2005 00:10:39 +0200 + +mysql-dfsg-5.0 (5.0.13rc-1) unstable; urgency=low + + * New upstream release. Now "release-candidate"! + * Removed any dynamic link dependencies to libndbclient.so.0 which + is due to its version only distributed as a static library. + * Sean Finney: + - FTBFS fix related to stripping rpath in debian/rules + + -- Christian Hammers <ch@debian.org> Mon, 26 Sep 2005 22:09:26 +0200 + +mysql-dfsg-5.0 (5.0.12beta-5) unstable; urgency=low + + * The recent FTBFS were probably result of a timing bug in the + debian/patches/75_*.dpatch file where Makefile.in got patched just + before the Makefile.shared which it depended on. For that reason + only some of the autobuilders failed. Closes: #330149 + * Fixed chrpath removal (option -k had to be added). + * Corrected debconf dependency as requested by Joey Hess. + + -- Christian Hammers <ch@debian.org> Mon, 26 Sep 2005 18:37:07 +0200 + +mysql-dfsg-5.0 (5.0.12beta-4) unstable; urgency=low + + * Removed experimental shared library libndbclient.so.0.0.0 as it + is doomed to cause trouble as long as it is present in both MySQL 4.1 + and 5.0 without real soname and its own package. We still have + libndbclient.a for developers. (thanks to Adam Conrad and + mediaforest.net). Closes: #329772 + + -- Christian Hammers <ch@debian.org> Fri, 23 Sep 2005 12:36:48 +0200 + +mysql-dfsg-5.0 (5.0.12beta-3) unstable; urgency=medium + + * Symbol versioning support! wooooohoooooo! + (thanks to Steve Langasek) Closes: #236288 + * Moved libndbcclient.so.0 to the -dev package as it is provided by + libmysqlclient14 and -15 which must be installable simultaneously. + * Removed mysql-*-doc suggestions. + + -- Christian Hammers <ch@debian.org> Tue, 20 Sep 2005 00:07:03 +0200 + +mysql-dfsg-5.0 (5.0.12beta-2) unstable; urgency=low + + * Added patch to build on GNU/kFreeBSD (thanks to Aurelien Jarno). + Closes: #327702 + * Added patch that was already been present on the 4.1 branch which + makes the "status" command of the init script more sensible + (thanks to Stephen Gildea). Closes: #311836 + * Added Vietnamese Debconf translation (thanks to Clytie Siddal). + Closes: #313006 + * Updated German Debconf translation (thanks to Jens Seidel). + Closes: #313957 + * Corrected commends in example debian-log-rotate.conf. The default is + unlike the mysql-sever-4.1 package which needed to stay backwards + compatible now 2 to avoid filling up the disk endlessly. + * Fixed watch file to be "-beta" aware. + + -- Christian Hammers <ch@debian.org> Thu, 15 Sep 2005 20:50:19 +0200 + +mysql-dfsg-5.0 (5.0.12beta-1) unstable; urgency=medium + + * Christian Hammers: + - New upstream release. + - Changed build-dep to libreadline5-dev as requested by Matthias Klose. + Closes: #326316 + - Applied fix for changed output format of SHOW MASTER LOGS for + binary log rotation (thanks to Martin Krueger). Closes: #326427, #326427 + - Removed explicit setting of $PATH as I saw no sense in it and + it introduced a bug (thanks to Quim Calpe). Closes: #326769 + - Removed PID file creation from /etc/init.d/mysql-ndb as it does + not work with this daemon (thanks to Quim Calpe). + - Updated French Debconf translation (thanks to Christian Perrier). + Closes: #324805 + - Moved conflicts line in debian/control from libmysqlclient15 to + libmysqlclient15-dev and removed some pre-sarge conflicts as + suggested by Adam Majer. Closes: #324623 + * Sean Finney: + - For posterity, CAN-2005-2558 has been fixed since 5.0.7beta. + + -- Christian Hammers <ch@debian.org> Thu, 15 Sep 2005 19:58:22 +0200 + +mysql-dfsg-5.0 (5.0.11beta-3) unstable; urgency=low + + * Temporarily build only with -O2 to circumvent gcc internal errors + (thanks to Matthias Klose). Related to: #321165 + + -- Christian Hammers <ch@debian.org> Thu, 18 Aug 2005 15:44:04 +0200 + +mysql-dfsg-5.0 (5.0.11beta-2) unstable; urgency=low + + * Fixed README.Debian regarding the status of mysql-doc. + * Added "set +e" around chgrp in mysql-server-5.0.preinst to + not fail on .journal files (thanks to Christophe Nowicki). + Closes: #318435 + + -- Christian Hammers <ch@debian.org> Sun, 14 Aug 2005 18:02:08 +0200 + +mysql-dfsg-5.0 (5.0.11beta-1) unstable; urgency=low + + * New upstream version. + * Added Danish Debconf translations (thanks to Claus Hindsgaul). + Closes: #322384 + * Updated Czech Debconf translations (thanks to Miroslav Kure). + Closes: #321765 + + -- Christian Hammers <ch@debian.org> Sat, 13 Aug 2005 11:56:15 +0000 + +mysql-dfsg-5.0 (5.0.10beta-1) unstable; urgency=low + + * New upstream release. + * Christian Hammers: + - Added check for mounted /proc to debian/rules. + * Sean Finney: + - fix for fix_mysql_privilege_tables/mysql_fix_privilege_tables typo + in mysql-server-5.0's README.Debian (see #319838). + + -- Christian Hammers <ch@debian.org> Sun, 31 Jul 2005 00:30:45 +0200 + +mysql-dfsg-5.0 (5.0.7beta-1) unstable; urgency=low + + * Second try for new upstream release. + * Renamed mysql-common-5.0 to mysql-common as future libmysqlclient16 + from e.g. MySQL-5.1 would else introduce mysql-common-5.1 which makes + a simultanous installation of libmysqlclient14 impossible as that + depends on either mysql-common or mysql-common-5.0 but not on future + versions. Thus we decided to always let the newest MySQL version + provide mysql-common. + * Added ${misc:Depends} as suggested by debhelper manpage. + * Raised standard in control file to 3.6.2. + * Removed DH_COMPAT from rules in faviour of debian/compat. + * Checkes for presence of init script before executing it in preinst. + Referres: 315959 + * Added 60_includes_mysys.h__gcc40.dpatch for GCC-4.0 compatibility. + + -- Christian Hammers <ch@debian.org> Wed, 29 Jun 2005 00:39:05 +0200 + +mysql-dfsg-5.0 (5.0.5beta-1) unstable; urgency=low + + * New major release! Still beta so be carefull... + * Added federated storage engine. + + -- Christian Hammers <ch@debian.org> Wed, 8 Jun 2005 19:29:45 +0200 + +mysql-dfsg-4.1 (4.1.12-1) unstable; urgency=low + + * Christian Hammers: + - New upstream release. + - Disabled BerkeleyDB finally. It has been obsoleted by InnoDB. + * Sean Finney: + - Updated French translation from Christian Perrier (Closes: #310526). + - Updated Japanese translation from Hideki Yamane (Closes: #310263). + - Updated Russian translation from Yuriy Talakan (Closes: #310197). + + -- Christian Hammers <ch@debian.org> Sat, 4 Jun 2005 05:49:11 +0200 + +mysql-dfsg-4.1 (4.1.11a-4) unstable; urgency=high + + * Fixed FTBFS problem which was caused due to the fact that last uploads + BerkeleyDB patch was tried to applied on all architectures and not only + on those where BerkeleyDB is actually beeing built. Closes: #310296 + + -- Christian Hammers <ch@debian.org> Mon, 23 May 2005 00:54:51 +0200 + +mysql-dfsg-4.1 (4.1.11a-3) unstable; urgency=high + + * Added patch from Piotr Roszatycki to compile the bundled db3 library + that is needed for the BerkeleyDB support with versioned symbols so + that mysqld no longer crashes when it gets linked together with the + Debian db3 version which happens when e.g. using libnss-db. + Closes: #308966 + + -- Christian Hammers <ch@debian.org> Thu, 19 May 2005 01:41:14 +0200 + +mysql-dfsg-4.1 (4.1.11a-2) unstable; urgency=high + + * Okay, the hackery with /var/lib/dpkg/info/mysql-server.list will not + stand and is removed from the preinst of mysql-server. + * New workaround for the symlink problem that does not involve mucking + with dpkg's file lists is storing the symlinks in a temporary location + across upgrades. + As this sometimes fails since apt-get does not always call new.preinst + before old.postrm, some remarks were added to README.Debian and the + Debconf installation notes to minimize the inconvinience this causes. + + -- sean finney <seanius@debian.org> Sun, 15 May 2005 10:25:31 -0400 + +mysql-dfsg-4.1 (4.1.11a-1) unstable; urgency=high + + * Added the "a" to the version number to be able to upload a new + .orig.tar.gz file which now has the non-free Docs/ directory removed + as this has been forgotten in the 4.1.11 release (thanks to Goeran + Weinholt). Closes: #308691 + * The Woody package listed /var/lib/mysql and /var/log/mysql in its + /var/lib/dpkg/info/mysql-server.list. These directories are often + replaced by symlinks to data partitions which triggers a dpkg bug + that causes these symlinks to be removed on upgrades. The new preinst + prevents this by removing the two lines from the .list file + (thanks to Andreas Barth and Jamin W. Collins). See dpkg bug #287978. + * Updated French Debconf translation (thanks to Christian Perrier). + Closes: #308353 + + -- Christian Hammers <ch@debian.org> Thu, 12 May 2005 21:52:46 +0200 + +mysql-dfsg-4.1 (4.1.11-3) unstable; urgency=high + + * The "do you want to remove /var/lib/mysql when purging the package" flag + from old versions is removed once this package is beeing installed so + that purging an old Woody mysql-server package while having a + mysql-server-4.1 package installed can no longer lead to the removal of + all databases. Additionaly clarified the wording of this versions Debconf + template and added a check that skips this purge in the postrm script + if another mysql-server* package has /usr/sbin/mysqld installed. + (thanks to Adrian Bunk for spotting that problem) Closes: #307473 + * Cronfile was not beeing installed as the filename was not in the + correct format for "dh_installcron --name" (thanks to Tomislav + Gountchev). Closes: #302712 + + -- Christian Hammers <ch@debian.org> Sat, 23 Apr 2005 22:55:15 +0200 + +mysql-dfsg-4.1 (4.1.11-2) unstable; urgency=low + + * Sean Finney: + - don't freak out if we can't remove /etc/mysql during purge. + - debian/rules clean works again. + * Christian Hammers: + - Fixed typo in README.Debian (thanks to Joerg Rieger). Closes: #304897 + - Completely removed the passwordless test user as it was not only + insecure but also lead to irritations as MySQL checks first the + permissions of this user and then those of a password having one. + See bug report from Hilko Bengen for details. Closes: #301741 + + -- Christian Hammers <ch@debian.org> Sat, 16 Apr 2005 15:55:00 +0200 + +mysql-dfsg-4.1 (4.1.11-1) unstable; urgency=low + + * New upstream version. + * Upstream fix for charset/collation problem. Closes: #282256 + * Upstream fix for subselect crash. Closes: #297687 + * Corrected minor issue in Debconf template regarding skip-networking + (thanks to Isaac Clerencia). Closes: #303417 + * Made dependency to gawk unnecessary (thanks to Zoran Dzelajlija). + Closes: #302284 + * Removed obsolete 50_innodb_mixlen.dpatch. + * Removed obsolete 51_CAN-2004-0957_db_grant_underscore.dpatch. + + -- Christian Hammers <ch@debian.org> Fri, 8 Apr 2005 00:23:53 +0200 + +mysql-dfsg-4.1 (4.1.10a-7) unstable; urgency=low + + * Sean Finney: + - fix for the mysteriously disappeared cronjob. thanks to + Peter Palfrader <weasel@debian.org> for pointing out this omission. + (closes: #302712). + + -- sean finney <seanius@debian.org> Sat, 02 Apr 2005 16:54:13 -0500 + +mysql-dfsg-4.1 (4.1.10a-6) unstable; urgency=high + + * Sean Finney: + - the previous upload did not completely address the issue. this one + should do so. d'oh. + + -- sean finney <seanius@debian.org> Thu, 31 Mar 2005 03:35:50 +0000 + +mysql-dfsg-4.1 (4.1.10a-5) unstable; urgency=high + + * Sean Finney: + - the following security issue is addressed in this upload: + CAN-2004-0957 (grant privilege escalation on tables with underscores) + thanks to sergei at mysql for all his help with this. + + -- sean finney <seanius@debian.org> Wed, 30 Mar 2005 21:19:26 -0500 + +mysql-dfsg-4.1 (4.1.10a-4) unstable; urgency=low + + * Sean Finney: + - FTBFS fix for amd64/gcc-4.0. Thanks to Andreas Jochens <aj@andaco.de> + for reporting this (closes: #301807). + - ANSI-compatible quoting fix in daily cron job. thanks to + Karl Hammar <karl@aspodata.se> for pointing out the problem in + the 4.0 branch. + - Added myself as a co-maintainer in the control file (closes: #295312). + + -- sean finney <seanius@debian.org> Tue, 29 Mar 2005 18:54:42 -0500 + +mysql-dfsg-4.1 (4.1.10a-3) unstable; urgency=low + + * BerkeleyDB is now disabled by default as its use is discouraged by MySQL. + * Added embedded server libraries as they finally do compile. + They are currently in libmysqlclient-dev as they are still + experimental and only available as .a library (thanks to Keith Packard). + Closes: #297062 + * Fixed obsolete "tail" syntax (thanks to Sven Mueller). Closes: #301413 + * Added CAN numbers for the latest security bugfix upload. + * Updated manpage of mysqlmanager (thanks to Justin Pryzby). Closes: #299844 + * Added comments to default configuration. + + -- Christian Hammers <ch@debian.org> Sun, 20 Mar 2005 17:40:18 +0100 + +mysql-dfsg-4.1 (4.1.10a-2) unstable; urgency=low + + * Disabled "--with-mysqld-ldflags=-all-static" as it causes sig11 crashes + if LDAP is used for groups in /etc/nsswitch.conf. Confirmed by Sean Finney + and Daniel Dehennin. Closes: #299382 + + -- Christian Hammers <ch@debian.org> Mon, 14 Mar 2005 03:01:03 +0100 + +mysql-dfsg-4.1 (4.1.10a-1) unstable; urgency=high + + * SECURITY: + - The following security related updates are addressed: + CAN-2005-0711 (temporary file creation with "CREATE TEMPORARY TABLE") + CAN-2005-0709 (arbitrary library injection in udf_init()) + CAN-2005-0710 (arbitrary code execution via "CREATE FUNCTION") + Closes: #299029, #299031, #299065 + * New Upstream Release. + - Fixes some server crash conditions. + - Upstream includes fix for TMPDIR overriding my.cnf tmpdir setting + Closes: #294347 + - Fixes InnoDB error message. Closes: #298875 + - Fixes resouce limiting. Closes: #285044 + * Improved checking whether or not the server is alive in the init script + which should make it possible to run several mysqld instances in + different chroot environments. Closes: #297772 + * Fixed cron script name as dots are not allowed (thanks to Michel + v/d Ven). Closes: #298447 + * Added -O3 and --with-mysqld-ldflags=-all-static as MySQL recommends to + build the server binary statically in order to gain about 13% more + performance (thanks to Marcin Kowalski). + * Added patch to let mysqld_safe react to signals (thanks to Erich + Schubert). Closes: #208364 + * (Thanks to Sean Finney for doing a great share of work for this release!) + + -- Christian Hammers <ch@debian.org> Thu, 3 Mar 2005 02:36:39 +0100 + +mysql-dfsg-4.1 (4.1.10-4) unstable; urgency=medium + + * Fixed bug that prevented MySQL from starting after upgrades. + Closes: #297198, #296403 + * Added comment about logging to syslog to the default my.cnf + and the logrotate script (thanks to Ryszard Lach). Closes: #295507 + + -- Christian Hammers <ch@debian.org> Thu, 3 Mar 2005 00:28:02 +0100 + +mysql-dfsg-4.1 (4.1.10-3) unstable; urgency=low + + * Sean Finney: Cronjobs now exit silently when the server package + has been removed but not purged (thanks to Vineet Kumar). + Closes: #297404 + * Fixed comments of /etc/mysql/debian-log-rotate.conf (thanks to + Philip Ross). Closes: #297467 + * Made mysqld_safe reacting sane on signals (thanks to Erich Schubert). + Closes: #208364 + + -- Christian Hammers <ch@debian.org> Tue, 1 Mar 2005 19:44:34 +0100 + +mysql-dfsg-4.1 (4.1.10-2) unstable; urgency=low + + * Converted to dpatch. + * debian/ is now maintained via Subversion on svn.debian.org. + + -- Christian Hammers <ch@debian.org> Tue, 1 Mar 2005 02:16:36 +0100 + +mysql-dfsg-4.1 (4.1.10-1) unstable; urgency=low + + * New upstream version. + * Upstream fixed memleak bug. Closes: #205587 + * Added debian/copyright.more for personal reference. + * Lowered default query cache size as suggested by Arjen from MySQL. + * Switched from log to log-bin as suggested by Arjen from MySQL. + * Fixed typo in my.cnf (thanks to Sebastian Feltel). Closes: #295247 + * Replaced --defaults-extra-file by --defaults-file in Debian scripts + as former lets password/host etc be overwriteable by /root/.my.cnf. + Added socket to /etc/mysql/debian.cnf to let it work. (thanks to + SATOH Fumiyasu). Closes: #295170 + + -- Christian Hammers <ch@debian.org> Tue, 15 Feb 2005 23:47:02 +0100 + +mysql-dfsg-4.1 (4.1.9-4) unstable; urgency=low + + * Improved the way mysqld is started and registered with update-rc.d + in cases where the admin modifies the runlevel configuration. + Most notably removed the debconf question whether or not mysql should + start on when booting. Closes: #274264 + * Renamed configuration option old-passwords to the more preferred + naming convention old_passwords. Same for some others (thanks to + Patrice Pawlak). Closes: #293983 + + -- Christian Hammers <ch@debian.org> Tue, 8 Feb 2005 02:21:18 +0100 + +mysql-dfsg-4.1 (4.1.9-3) unstable; urgency=low + + * Renamed ca_ES.po to ca.po to reach a broader audience (thanks to + Christian Perrier). Closes: #293786 + * Expicitly disabled mysqlfs support as it has never been enabled by + configure during the autodetection but fails due to broken upstream + code when users try to build the package theirselves while having + liborbit-dev installed which triggers the mysqlfs autodetection + (thanks to Max Kellermann). Closes: #293431 + * Added dependencies to gawk as one script does not work with original-awk + (thanks to Petr Ferschmann). Closes: #291634 + + -- Christian Hammers <ch@debian.org> Sun, 6 Feb 2005 23:33:11 +0100 + +mysql-dfsg-4.1 (4.1.9-2) unstable; urgency=high + + * SECURITY: + For historical reasons /usr/share/mysql/ was owned and writable by + the user "mysql". This is a security problem as some scripts that + are run by root are in this directory and could be modified and used + by a malicious user who already has mysql privileges to gain full root + rights (thanks to Matt Brubeck). Closes: #293345 + * Changed "skip-networking" to "bind-address 127.0.0.1" which is more + compatible and not less secure but maybe even more, as less people enable + networking for all interfaces (thanks to Arjen Lentz). + * Enabled InnoDB by default as recommended by Arjen Lentz from MySQL. + * Added remarks about hosts.allow to README.Debian (thanks to David + Chappell). Closes: #291300 + * mysql-server-4.1 now provides mysql-server (thanks to Paul van den Berg). + Closes: #287735 + + -- Christian Hammers <ch@debian.org> Wed, 2 Feb 2005 23:31:55 +0100 + +mysql-dfsg-4.1 (4.1.9-1) unstable; urgency=low + + * New upstream version. + * mysql-client-4.1 now provides "mysql-client" so that packages depending + on mysql-client (ca. 40) can now be used with MySQL-4.1, too. + + -- Christian Hammers <ch@debian.org> Sun, 23 Jan 2005 22:52:48 +0100 + +mysql-dfsg-4.1 (4.1.8a-6) unstable; urgency=high + + * SECURITY: + Javier Fernandez-Sanguino Pena from the Debian Security Audit Project + discovered a temporary file vulnerability in the mysqlaccess script of + MySQL that could allow an unprivileged user to let root overwrite + arbitrary files via a symlink attack and could also could unveil the + contents of a temporary file which might contain sensitive information. + (CAN-2005-0004, http://lists.mysql.com/internals/20600) Closes: #291122 + + -- Christian Hammers <ch@debian.org> Tue, 18 Jan 2005 23:11:48 +0100 + +mysql-dfsg-4.1 (4.1.8a-5) unstable; urgency=medium + + * Fixed important upstream bug that causes from_unixtime(0) to return + NULL instead of "1970-01-01 00:00:00" which fails on NOT NULL columns. + Closes: #287792 + * Fixes upstream bug in mysql_list_fields() . Closes: #282486 + * Fixes bug that lead to double rotated logfiles when mysql-server 4.0 + was previously installed (thanks to Olaf van der Spek). Closes: #289851 + * Fixed typo in README.Debian (thanks to Mark Nipper). Closes: #289131 + * Changed max_allowed_packet in my.cnf to 16M as in 4.0.x (thanks to + Olaf van der Spek). Closes: #289840 + * Updated French debconf translation (thanks to Christian Perrier). + Closes: #287955 + + -- Christian Hammers <ch@debian.org> Thu, 13 Jan 2005 01:29:05 +0100 + +mysql-dfsg-4.1 (4.1.8a-4) unstable; urgency=low + + * Broken patch again :-( + + -- Christian Hammers <ch@debian.org> Sun, 9 Jan 2005 23:47:55 +0100 + +mysql-dfsg-4.1 (4.1.8a-3) unstable; urgency=low + + * The mutex patch was a bit too x86 centric. This broke the alpha build. + + -- Christian Hammers <ch@debian.org> Sun, 9 Jan 2005 14:18:49 +0100 + +mysql-dfsg-4.1 (4.1.8a-2) unstable; urgency=medium + + * Some Makefiles that were patched by me got overwritten by the GNU + autotools, probably because I also patched ./configure. Fixed now, + the critical mutex patch is now back in again. Closes: #286961 + * Added patch to make MySQL compile on ARM (thanks to Adam Majer). + Closes: #285071 + + -- Christian Hammers <ch@debian.org> Thu, 6 Jan 2005 09:30:13 +0100 + +mysql-dfsg-4.1 (4.1.8a-1) unstable; urgency=medium + + * Upstream 4.1.8 had some problems in their GNU Autotools files so they + released 4.1.8a. Debian's 4.1.8 was fixed by running autoreconf but this + again overwrote MySQL changes to ltmain.sh which are supposed to fix some + problems on uncommon architectures (maybe the FTBFS on alpha, arm, m68k + and sparc?). + * libmysqlclient_r.so.14 from 4.1.8-3 also missed a link dependency to + libz which lead to unresolved symbols visible with "ldd -r" (thanks + to Laurent Bonnaud). Closes: #287573 + + -- Christian Hammers <ch@debian.org> Wed, 29 Dec 2004 14:26:33 +0100 + +mysql-dfsg-4.1 (4.1.8-3) unstable; urgency=low + + * Fixed checking for error messages by forcing english language + output by adding LC_ALL=C to debian-start (thanks to Rene + Konasz) Closes: #285709 + * Fixed bashisms in Debian scripts. Closes: #286863 + * Updated Japanese Debconf translation (thanks to Hideki Yamane). + Closes: #287003 + * Improved 4.0 to 4.1 upgrade if /var/lib/mysql is a symlink + (thanks to Thomas Lamy). Closes: #286560 + * Added patch for FTBFS problem where no LinuxThreads can be found. + I don't know if this still applies but it should not hurt. + The patch is debian/patches/configure__AMD64-LinuxThreads-vs-NPTL.diff + + -- Christian Hammers <ch@debian.org> Sun, 26 Dec 2004 14:04:20 +0100 + +mysql-dfsg-4.1 (4.1.8-2) unstable; urgency=low + + * If /var/lib/mysql is a symlink then it is kept as such. + * Added the old-passwords option to the default my.cnf to stay + compatible to clients that are still compiled to libmysqlclient10 + and libmysqlclient12 for licence reasons. + * Adjusted tetex build-deps to ease backporting (thanks to Norbert + Tretkowski from backports.org). + + -- Christian Hammers <ch@debian.org> Tue, 21 Dec 2004 01:00:27 +0100 + +mysql-dfsg-4.1 (4.1.8-1) unstable; urgency=medium + + * New upstream version. Closes: #286175 + * Added conflict to libmysqlclient-dev (thanks to Adam Majer). + Closes: #286538 + * Added debconf-updatepo to debian/rules:clean. + * Updated Japanese Debconf translation (thanks to Hideki Yamane). + Closes: #285107 + * Updated French Debconf translation (thanks to Christian Perrier). + Closes: #285977 + * Renamed cz.po to cs.po (thanks to Miroslav Kure). Closes: #285438 + * Aplied patch for changed server notice to debian-start (thanks to + Adam Majer). Closes: #286035 + * Changed nice value in default my.cnf as nohup changed its behaviour + (thanks to Dariush Pietrzak). Closes: #285446 + * Increased verbosity of preinst script in cases where it cannot stop + a running server (thanks to Jan Minar). Closes: #285982 + * Splitted the code parts of /etc/mysql/debian-start to + /usr/share/mysql/debian-start.inc.sh (thanks to Jan Minar). + Closes: #285988 + + -- Christian Hammers <ch@debian.org> Mon, 20 Dec 2004 00:33:21 +0100 + +mysql-dfsg-4.1 (4.1.7-4) unstable; urgency=medium + + * Removed OpenSSL support. + After a short discussion with MySQL, I decided to drop OpenSSL support as + 1. MySQL started shipping their binaries without it, too and do not + seem to support it in favour of using a different library somewhen. + 2. MySQL did not adjust their licence to grant permission to link + against OpenSSL. + 3. Even if they did, third parties who use libmysqlclient.so often + do not realise licencing problems or even do not want OpenSSL. + (thanks to Jordi Mallach and the responders to MySQL bug #6924) + Closes: #283786 + * debian/control: Improved depends and conflicts to mysql-4.0. + + -- Christian Hammers <ch@debian.org> Thu, 2 Dec 2004 22:02:28 +0100 + +mysql-dfsg-4.1 (4.1.7-3) unstable; urgency=low + + * Raised version to make it higher as the one in experimental. + + -- Christian Hammers <ch@debian.org> Wed, 1 Dec 2004 21:09:20 +0100 + +mysql-dfsg-4.1 (4.1.7-2) unstable; urgency=low + + * Patched scripts/mysql_install_db so that it no longer creates a + passwordless test database during installation (thanks to Patrick + Schnorbus). Closes: #281158 + * Added Czech debconf translation (thanks to Miroslav Kure). + Closes: #283222 + + -- Christian Hammers <ch@debian.org> Wed, 1 Dec 2004 01:29:31 +0100 + +mysql-dfsg-4.1 (4.1.7-1) unstable; urgency=low + + * New upstream branch! + * Adjusted debian/control to make this package suitable to get parallel + to version 4.0.x into unstable and sarge. The package names are + different so that "mysql-server" still defaults to the rock-stable + 4.0 instead to this announced-to-be-stable 4.1. + * Added --with-mutex=i86/gcc-assemler to the Berkeley-DB configure + to prevent the use of NPLT threads when compiling under kernel 2.6 + because the binaries are else not runable on kernel 2.4 hosts. + Closes: #278638, #274598 + + -- Christian Hammers <ch@debian.org> Sun, 31 Oct 2004 20:15:03 +0100 + +mysql-dfsg (4.1.6-1) experimental; urgency=low + + * New upstream version. + * Fixed symlinks in libmysqlclient-dev package. Closes: #277028 + * This time I did not update the libtool files as they were pretty + up to date and I want to have a shorter diff file. + + -- Christian Hammers <ch@debian.org> Wed, 20 Oct 2004 00:07:58 +0200 + +mysql-dfsg (4.1.5-3) experimental; urgency=low + + * debian/postinst: mysql_install_db changed parameter from --IN-RPM + to --rpm which caused problems during installs. Closes: #276320 + + -- Christian Hammers <ch@debian.org> Sat, 16 Oct 2004 20:36:46 +0200 + +mysql-dfsg (4.1.5-2) experimental; urgency=low + + * Activated support for ndb clustering (thanks to Kevin M. Rosenberg). + Closes: #275109 + + -- Christian Hammers <ch@debian.org> Wed, 6 Oct 2004 01:58:00 +0200 + +mysql-dfsg (4.1.5-1) experimental; urgency=low + + * WARNING: + The upstream branch 4.1 is still considered BETA. + The Debian packages for 4.1 were done without big testing. If you miss + a new functionality or binary, contact me and I check add the relevant + configure option or include the program. + * New MAJOR upstream version. + Thanks to the great demand here's now the first MySQL 4.1 experimental + release. FEEDBACK IS WELCOME. + * 4.0->4.1 notes: + - debian/patches/alpha.diff could not be applied, I fix that later + - debian/patches/scripts__mysql_install_db.sh.diff was obsolete + - debian/patches/scripts__Makefile.in was neccessary due to a dependency + to the removed non-free Docs/ directory. Upstream has been contacted. + - Build-Deps: += automake1.7 + - debian/rules: embedded servers examples did not compile, removed + + -- Christian Hammers <ch@debian.org> Sun, 26 Sep 2004 19:46:47 +0200 + +mysql-dfsg (4.0.21-3) unstable; urgency=low + + * Upstream tried to fix a security bug in mysqlhotcopy and broke it :-) + Applied a patch (see debian/patches) from Martin Pitt. Closes: #271632 + * Between 4.0.20 and 4.0.21 the Debian specific changes in + /usr/bin/mysqld_safe that piped the error log to syslog got lost + and are now back again. + * Fixed capitalization in debconf headings. + * Changed wording of the initscript status message to make heartbeat + happier. Closes: #271591 + + -- Christian Hammers <ch@debian.org> Fri, 17 Sep 2004 18:42:25 +0200 + +mysql-dfsg (4.0.21-2) unstable; urgency=medium + + * The dependencies between mysql-client and libmysqlclient12 were + too loose, when upgrading only the client this can lead to non working + binaries due to relocation errors (thanks to Dominic Cleal). + Closes: #271803 + * Fixed typo in mysqldump.1 manpage (thanks to Nicolas Francois). + Closes: #271334 + + -- Christian Hammers <ch@debian.org> Wed, 15 Sep 2004 15:38:11 +0200 + +mysql-dfsg (4.0.21-1) unstable; urgency=high + + * SECURITY: + This upstream version fixes some security problems that might at least + allow a DoS attack on the server. + * Fixed an old bug in concurrent accesses to `MERGE' tables (even + one `MERGE' table and `MyISAM' tables), that could've resulted in + a crash or hang of the server. (Bug #2408) + * Fixed bug in privilege checking where, under some conditions, one + was able to grant privileges on the database, he has no privileges + on. (Bug #3933) + * Fixed crash in `MATCH ... AGAINST()' on a phrase search operator + with a missing closing double quote. (Bug #3870) + * Fixed potential memory overrun in `mysql_real_connect()' (which + required a compromised DNS server and certain operating systems). + (Bug #4017) + * New upstream version. + * Fixes bug that made x="foo" in WHERE sometimes the same as x="foo ". + Closes: #211618 + * Updated Japanese Debconf translation (thanks to Hideki Yamane). + Closes: #271097 + + -- Christian Hammers <ch@debian.org> Sat, 11 Sep 2004 23:15:44 +0200 + +mysql-dfsg (4.0.20-14) unstable; urgency=low + + * Dave Rolsky spottet that -DBIG_JOINS was not properly enabled. + It allowes joining 64 instead of an 32 tables to join. + + -- Christian Hammers <ch@debian.org> Thu, 9 Sep 2004 20:24:02 +0200 + +mysql-dfsg (4.0.20-13) unstable; urgency=medium + + * Fixed a bug in the initscript which caused the check for not properly + closed i.e. corrupt tables that is executed when the server starts + not to run in background as supposed. + Although the check does not repair anything on servers with several + thousand tables the script was reported to take some minutes which + is quite annoying. (Thanks to Jakob Goldbach). Closes: #270800 + + -- Christian Hammers <ch@debian.org> Thu, 9 Sep 2004 17:11:05 +0200 + +mysql-dfsg (4.0.20-12) unstable; urgency=medium + + * Filter messages regarding table handles that do not support CHECK TABLE + in the script that checks for corrupted tables on every start which lead + to unnecessary mails (thanks to David Everly). Closes: #269811 + * Added a note to the corrupt-table-check mail which notes that a + false-positive is reported in the case that immediately after starting + the server a client starts using a table (thanks to Uwe Kappe). + Closes: #269985 + * Added "quote-names" as default to the [mysqldump] section in + /etc/mysql/my.cnf as too many users stumble over dump files that + could not be read in again due to the valid use of reserved words + as table names. This has also be done by upstream in 4.1.1 and has + no known drawbacks. Closes: #269865 + * Binary logs can now be rotated as well. Defaults to off, though, for + compatibilty reasons (thanks to Mark Ferlatte). Closes: #94230, #269110 + * The mysql user "debian-sys-maint" now gets all possible rights which + makes binary logging possible and helps other package maintainer who + wants to use it to create package specific databases and users. + * Added example how to change daemon nice level via /etc/mysql/my.cnf + * Updated French debconf translations (thanks to Christian Perrier). + Closes: #265811 + * Renamed options in the default config file that still had old names + (thanks to Yves Kreis). Closes: #266445 + * Fixed spelling in debconf note. + * Added -l and -L to dh_shlibdeps. + + -- Christian Hammers <ch@debian.org> Fri, 3 Sep 2004 20:10:46 +0200 + +mysql-dfsg (4.0.20-11) unstable; urgency=high + + * SECURITY + This version fixes a security flaw in mysqlhotcopy which created + temporary files in /tmp which had predictable filenames and such + could be used for a tempfile run attack. + The issue has been recorded as CAN-2004-0457. + + -- Christian Hammers <ch@debian.org> Sat, 14 Aug 2004 18:27:19 +0200 + +mysql-dfsg (4.0.20-10) unstable; urgency=low + + * MySQL finally updated their copyright page and installed v1.5 of + the "Free/Libre and Open Source Software License (FLOSS) - Exception" + which will hopefully end the license hell they created by putting the + client libraries under GPL instead of LGPL which conflicts with PHP and + other software that used to link against MySQL. + The license text is not yet in any release MySQL version but visible + on their web site and copied into the debian/copyright file. + Special thanks to Zak Greant <zak@mysql.com> and the debian-legal list + for helping to solve this release critical problem. + Closes: #242449 + * Updated Brazil debconf translation (thanks to Andre Luis Lopes). + Closes: #264233 + * Updated Japanese debconf translation (thanks to Hideki Yamane). + Closes: #264620 + * Fixed minor typo in debconf description (thanks to TROJETTE Mohammed + Adnene). Closes: #264840 + * Improved init and preinst script which now detects stalled servers which + do no longer communicate but are present in the process list (thanks to + Henrik Johansson). Closes: #263215 + + -- Christian Hammers <ch@debian.org> Mon, 9 Aug 2004 19:44:28 +0200 + +mysql-dfsg (4.0.20-9) unstable; urgency=medium + + * Partly reverted the last patch which gave the mysql-user + "debian-sys-maint" more rights as there are old versions of MySQL which + have fewer privlige columns. Now only those are set (thanks to Alan Tam). + Closes: #263111 + + -- Christian Hammers <ch@debian.org> Tue, 3 Aug 2004 13:03:02 +0200 + +mysql-dfsg (4.0.20-8) unstable; urgency=low + + * The mysqlcheck that is started from the initscript will now be + backgrounded because it might else prevent the boot process to continue. + It also now notifies root by mail and syslog if a table is corrupt. + * The "debian-sys-maint" MySQL user now has almost full rights so that other + packages might use this account to create databases and user (thanks to + Andreas Barth). Closes: #262541 + * Added paranoid rules for logcheck. + + -- Christian Hammers <ch@debian.org> Sun, 1 Aug 2004 21:00:55 +0200 + +mysql-dfsg (4.0.20-8) unstable; urgency=low + + * Upload stalled. Not released. + + -- Christian Hammers <ch@debian.org> Sun, 1 Aug 2004 20:27:55 +0200 + +mysql-dfsg (4.0.20-7) unstable; urgency=medium + + * Solved the upstream bug that error messages of the server are written + in a file that is then rotated away leaving mysqld logging effectively + to /dev/null. It now logs to a /usr/bin/logger process which puts the + messages into the syslog. + Modified files: /etc/init.d/mysql, /usr/bin/mysqld_safe and the + logchecker files. Closes: #254070 + * The initscript does no longer call mysqlcheck directly but via + /etc/mysql/debian-start which is a user customizable config script. + * Splitted the debconf "install and update notes" and only show them + when it is appropriate (thanks to Steve Langasek). Closes: #240515 + * Added NEWS.Debian. + * Added hint to -DBIG_ROWS, which is currently not used, to README.Debian. + * Corrected typo in myisampack manpage (thanks to Marc Lehmann). + Closes: #207090 + * Added Catalan debconf translation (thanks to Aleix Badia i Bosch). + Closes: #236651 + + -- Christian Hammers <ch@debian.org> Wed, 28 Jul 2004 01:41:51 +0200 + +mysql-dfsg (4.0.20-6) unstable; urgency=low + + * The build arch detected by configure was "pc-linux-gnu (i686)" + instead of "pc-linux-gnu (i386)". Was no problem AFAIK but + Adam Majer asked me to explicitly change it to i386. Closes: #261382 + * Removed some unused shell scripts from /usr/share/mysql. + * Added lintian overrides. + * Removed rpath by using chrpath. + + -- Christian Hammers <ch@debian.org> Mon, 26 Jul 2004 00:17:12 +0200 + +mysql-dfsg (4.0.20-5) unstable; urgency=medium + + * The mysqlcheck in the init script is only called when the server + is really alive. Also, the mysql-user 'debian-sys-maint' now has + global select rights (thanks to Nathan Poznick). Closes: #261130 + * Moved the debconf question whether to remove the databases or not + from mysql-server.config to mysql-server.postrm so that it shows + up on purge time and not months earlier (thanks to Wouter Verhelst). + Closes: #251838 + + -- Christian Hammers <ch@debian.org> Fri, 23 Jul 2004 22:41:13 +0200 + +mysql-dfsg (4.0.20-4) unstable; urgency=low + + * Added a "mysqlcheck -A --fast" to the 'start' section of the + init script to help admins detect corrupt tables after a server crash. + Currently it exists with an error message but leaves the server + running. Feedback appreciated! + * Made postinst script more robust by calling db_stop earlier and + so prevent pipe-deadlocks. + * Fixed minor typos in initscript (thanks to "C.Y.M."). Closes: 259518 + * Added the undocumented "-DBIG_JOINS" that MySQL apparently uses in + their MAX binaries. It enables 62 instead of 30 tables in a "join". + (thanks to Dave Rolsky). Closes: #260843 + * Added a "df --portability /var/lib/mysql/." check to the preinst + script as users experienced hard to kill hanging mysqlds in such + a situation (thanks to Vaidas Pilkauskas). Closes: #260306 + + -- Christian Hammers <ch@debian.org> Fri, 23 Jul 2004 00:51:32 +0200 + +mysql-dfsg (4.0.20-3) unstable; urgency=low + + * Improved tolerance if the init script has been deleted (thanks to + Leonid Shulov for spotting the problem). + * Minor wording changes to README.Debian generalizing /root/ by $HOME + (thanks to Santiago Vila). Closes: #257725 + * Added Japanese debconf translation (thanks to Hideki Yamane). + Closes: #256485 + * Fixed commend in my.cnf regarding logfile directory (thanks to Jayen + Ashar). Closes: #253434 + * Correted "ease to" by "ease of" in package description (thanks to + Johannes Berg). Closes: #253510 + + -- Christian Hammers <ch@debian.org> Fri, 9 Jul 2004 00:57:42 +0200 + +mysql-dfsg (4.0.20-2) unstable; urgency=low + + * Removed RPM .spec file from the included documentation as it is pretty + useless (thanks to Loic Minier). + * Added turkish debconf translation (thanks to Recai Oktas). Closes: #252802 + + -- Christian Hammers <ch@debian.org> Sun, 6 Jun 2004 14:48:26 +0200 + +mysql-dfsg (4.0.20-1) unstable; urgency=low + + * New upstream version. + + -- Christian Hammers <ch@debian.org> Mon, 31 May 2004 23:36:39 +0200 + +mysql-dfsg (4.0.18-8) unstable; urgency=low + + * Updated french translation (thanks to Christian Perrier). Closes: #246789 + + -- Christian Hammers <ch@debian.org> Tue, 4 May 2004 23:26:54 +0200 + +mysql-dfsg (4.0.18-7) unstable; urgency=low + + * Added CVE ids for the recent security fixes. + 4.0.18-4 is CAN-2004-0381 (mysqlbug) and + 4.0.18-6 is CAN-2004-0388 (mysql_multi) + + -- Christian Hammers <ch@debian.org> Mon, 19 Apr 2004 18:32:03 +0200 + +mysql-dfsg (4.0.18-6) unstable; urgency=medium + + * SECURITY: + Fixed minor tempfile-run security problem in mysqld_multi. + Unprivileged users could create symlinks to files which were then + unknowingly overwritten by run when this script gets executed. + Upstream informed. Thanks to Martin Schulze for finding this. + + -- Christian Hammers <ch@debian.org> Wed, 7 Apr 2004 01:28:22 +0200 + +mysql-dfsg (4.0.18-5) unstable; urgency=low + + * Little improvements in debian scripts for last upload. + * Added check to logrotate script for the case that a mysql + server is running but not be accessible with the username and + password from /etc/mysql/debian.conf (thanks to Jeffrey W. Baker). + Closes: 239421 + + -- Christian Hammers <ch@debian.org> Sun, 4 Apr 2004 15:27:40 +0200 + +mysql-dfsg (4.0.18-4) unstable; urgency=medium + + * SECURITY: + Aplied fix for unprobable tempfile-symlink security problem in + mysqlbug reported by Shaun Colley on bugtraq on 2004-03-24. + * Updated french debconf translation (thanks to Christian Perrier). + Closes: #236878 + * Updated portugesian debconf translation (thanks to Nuno Senica). + Closes: #239168 + * Updated german debconf translation (thanks to Alwin Meschede). + Closes: #241749 + * Improved debconf template regarding fix_privileges_tables (thanks + to Matt Zimmermann for suggestions). Closes: #219400 + * Improved README.Debian regarding to password settings (thanks to + Yann Dirson). Closes: #241328 + + -- Christian Hammers <ch@debian.org> Sat, 3 Apr 2004 19:52:15 +0200 + +mysql-dfsg (4.0.18-3) unstable; urgency=medium + + * Added Build-Depend to po-debconf to let it build everywhere. + + -- Christian Hammers <ch@debian.org> Wed, 31 Mar 2004 23:43:33 +0200 + +mysql-dfsg (4.0.18-2) unstable; urgency=low + + * Added a "2>/dev/null" to a "which" command as there are two + "which" versions in Debian of which one needs it. Closes: #235363 + + -- Christian Hammers <ch@debian.org> Tue, 2 Mar 2004 23:31:28 +0100 + +mysql-dfsg (4.0.18-1) unstable; urgency=low + + * New upstream version. + * Should now compile and run on ia64 (thanks to Thorsten Werner and + David Mosberger-Tang). Closes: #226863 #228834 + * Converted init scripts to invoce-rc.d (thanks to Erich Schubert). + Closes: 232118 + * Secondlast upload changed logfile location. Closes: #182655 + * Updated Brasilian translation (thanks to Andre Luis Lopes). Closes: + #219847 + + -- Christian Hammers <ch@debian.org> Tue, 17 Feb 2004 23:44:58 +0100 + +mysql-dfsg (4.0.17-2) unstable; urgency=low + + * Improved manpage for mysqldumpslow.1 (thanks to Anthony DeRobertis). + Closes: #231039 + * Improved stopping of crashed daemons in init script (thanks to + Matthias Urlichs). Closes: #230327 + + -- Christian Hammers <ch@debian.org> Mon, 9 Feb 2004 21:54:29 +0100 + +mysql-dfsg (4.0.17-1) unstable; urgency=low + + * Made logging into /var/log/mysql/ the default. Closes: #225206 + + * New upstream version. Closes: #225028 + * Turned on a 25MB query cache by default (thanks to Cyril Bouthors). + Closes: #226789 + * Updated russian translation (thanks to Ilgiz Kalmetev). Closes: #219263 + * Upstream fixes the problem that AND was not commutative (thanks for + Iain D Broadfoot for mentioning). Closes: #227927 + * Fixed minor typo in my.cnf comments (thanks to James Renken). + Closes: #221496 + * Better documents regex. Closes: #214952 + * Fixed minor germanism in debconf template (thanks to Marc Haber). + Closes: #224148 + * Added explaining comment to my.cnf regarding quoted passwords + (Thanks to Patrick von der Hagen). Closes: #224906 + * Changed "find -exec" to "find -print0 | xargs -0" in preinst to + speed it up. Thanks to Cyril Bouthors. Closes: #220229 + + -- Christian Hammers <ch@debian.org> Sun, 18 Jan 2004 16:16:25 +0100 + +mysql-dfsg (4.0.16-2) unstable; urgency=low + + * Tried to repair undefined weak symbols by adding a little Makefile + patch. Closes: #215973 + + -- Christian Hammers <ch@debian.org> Mon, 27 Oct 2003 22:52:10 +0100 + +mysql-dfsg (4.0.16-1) unstable; urgency=low + + * New upstream release. + (Mostly little memory problems and other bugfixes it seems) + * Replaced "." by ":" in chown calls to comply with the env setting + "_POSIX2_VERSION=2000112" (thanks to Robert Luberda). Closes: #217399 + * Adjusted syntax in my.cnf to 4.x standard (thanks to Guillaume Plessis). + Closes: #217273 + * Improved README.Debian password instructions (thanks to Levi Waldron). + Closes: #215046 + * Improved NIS warning debconf-template (thanks to Jeff Breidenbach). + Closes: #215791 + * Explicitly added libssl-dev to the libmysqlclient-dev package as it + is needed for mysql_config and the libmysqlclient package only depends + on libssl which has no unnumbered .so version (thanks to Simon Peter + and Davor Ocelic). Closes: #214436, #216162 + * Added "-lwrap" to "mysql_config --libmysqld-libs" and filed it as + upstream bug #1650 (thanks to Noah Levitt). Closes: #214636 + + -- Christian Hammers <ch@debian.org> Sat, 25 Oct 2003 01:09:27 +0200 + +mysql-dfsg (4.0.15a-1) unstable; urgency=low + + * Same package as 4.0.15-2 but I could not convince the Debian + installer to move the packages out of incoming. + + -- Christian Hammers <ch@debian.org> Tue, 7 Oct 2003 15:10:26 +0200 + +mysql-dfsg (4.0.15-2) unstable; urgency=low + + * Updated package description (thanks to Adrian Bunk). Closes: #210988 + * Fixed small typos in manpages (thanks to Nicolas Francois). + Closes: #211983 + * More updates to package description (thanks to Matthias Lutz/ddtp). + Closes: #213456 + * Updated standards to 3.6.1. + * Closes "new 4.0.15 available" bug. Closes: #213349 + * Updated README.Debian with notes regarding the MySQL manual section + "2.4 Post-installation Setup and Testing" (thanks to Daniel B.). + Closes: #210841 + + -- Christian Hammers <ch@debian.org> Fri, 3 Oct 2003 15:59:39 +0200 + +mysql-dfsg (4.0.15-1) unstable; urgency=high + + * SECURITY: + Users who are able to use the "ALTER TABLE" command on the "mysql" + database may be able to exploit this vulnerability to gain a shell with + the privileges of the mysql server (usually running as the 'mysql' user). + Closes: #210403 + * Fixes small description typos (thanks to Oscar Jarkvik). + * Updated Brazilian Portuguese debconf translation. (thanks to Andre Luis + Lopes). Closes: 208030 + * Replaced depricated '.' by ':' in chown (thanks to Matt Zimmerman). + * Fixed manpage typo (thanks to Marc Lehmann). Closes: #207090 + + -- Christian Hammers <ch@debian.org> Fri, 3 Oct 2003 15:59:35 +0200 + +mysql-dfsg (4.0.14-1) unstable; urgency=low + + * New upstream version. + + -- Christian Hammers <ch@debian.org> Sun, 24 Aug 2003 16:40:36 +0200 + +mysql-dfsg (4.0.13-3) unstable; urgency=low + + * Now start mysqld as default unless you choose not when configurig + with debconf priority low. So packages depending on the server when + installing can access it. Thanks Matt Zimmermann (Closes: #200277) + * Made mysql-server de-installable if the config and database files were + removed by hand before. Thanks to Ard van Breemen (Closes: #200304) + + -- Christian Hammers <ch@debian.org> Tue, 8 Jul 2003 22:30:40 +0200 + +mysql-dfsg (4.0.13-2) unstable; urgency=low + + * Added "nice" option for mysqld_safe to give mysqld a different priority. + Submitted to upstream as MySQL Bug #627. Closes: #192087 + * Fixed possible unbound variable in init script. Closes: #194621 + * Fixed french debconf translation (thx Christian Perrier) Closes: #194739 + * Get rid of automake1.5 (for Eric Dorland). + + -- Christian Hammers <ch@debian.org> Wed, 11 Jun 2003 18:58:32 +0200 + +mysql-dfsg (4.0.13-1) unstable; urgency=medium + + * New upstream version. + !!! Fixes a very bad natural join bug which justifies the urgency=medium. + !!! http://bugs.mysql.com/bug.php?id=291 + * Fixed mysql_fix_privileges manpage (Frederic Briere) Closes: #191776 + * preinst: "which" is more chatty normal executable than as builtin. + (Thanks to David B Harris). Closes: #188659 + + -- Christian Hammers <ch@debian.org> Tue, 6 May 2003 22:03:45 +0200 + +mysql-dfsg (4.0.12-3) unstable; urgency=medium + + * Reincluded new way of creating my debian-sys-maint user from + an old release from experimental. Now works again with old + and new privilege table format. (Thanks to Vincent Danjean + for spotting the problem) Closes: #188201 + * Reincluded hurd build dependency fix from 3.23 branch. + (Thanks to Robert Millan). Closes: #185929 + * Fixed soname in libmysqlclient-dev. Closes: #188160 + * Remove /var/log/mysql/ when purging the package. Closes: #188064 + * Removed /usr/share/doc/mysql/ from mysql-server. Closes: #188066 + * Let group "adm" be able to read logfiles. Closes: #188067 + * Do not call usermod on every upgrade. Closes: #188248 + (Thanks to Philippe Troin for the last three) + * Fixed mysql-server.preinst so that it works on shells where + which is a builtin, too. (Thanks to Erich Schubert) Closes: #181525 + + -- Christian Hammers <ch@debian.org> Fri, 11 Apr 2003 11:32:45 +0200 + +mysql-dfsg (4.0.12-2) unstable; urgency=low + + * + * NEW MAJOR UPSTREAM RELEASE: + * + MySQL 4 has finally been declared as 'stable'. Hurray! Read changelogs. + Thanks to all testers, esp. Jose Luis Tallon, of the versions + that were in the "experimental" section before. + * Modified postinst script to run mysql_fix_privileges on every update. + IMPORTANT: Please report if this breaks anything, it is not supposed to. + * Wrote a SSL-MINI-HOWTO.txt! + * Added zlib1g-dev to libmysqlclient12-dev. Closes: 186656 + * Changed section of libmysqlclient12-dev to libdevel. + * Added even more selfwritten manpages. + * Fixed typos. + + -- Christian Hammers <ch@debian.org> Sun, 6 Apr 2003 13:47:32 +0200 + +mysql-dfsg (4.0.10.gamma-1) experimental; urgency=low + + * New upstream version. + * They merged some of my patches from debian/patches. Whoa! + * This release should fix the error-logfile problem where mysqld + keeps the error.log open while logrotate removes it. + + -- Christian Hammers <ch@debian.org> Wed, 12 Feb 2003 22:39:48 +0100 + +mysql-dfsg (4.0.9.gamma-1) experimental; urgency=low + + * New upstream version. + * Updated the GNU autoconf files to make building on MIPS work. + See bug #176829. + + -- Christian Hammers <ch@debian.org> Wed, 29 Jan 2003 22:07:44 +0100 + +mysql-dfsg (4.0.8.gamma-1) experimental; urgency=low + + * New upstream release. + * Improved logging of init script. Closes: #174790 + * We have now libmysqlclient.so.12 instead of .11. + + -- Christian Hammers <ch@debian.org> Thu, 9 Jan 2003 20:14:11 +0100 + +mysql-dfsg (4.0.7.gamma-1) experimental; urgency=high + + * SECURITY: This version fixes an upstream security release that is only + present in the 4.x branch which is currently only in the + experimental distribution and therefore will not get a DSA. + * New upstream release. + + -- Christian Hammers <ch@debian.org> Sat, 28 Dec 2002 15:51:39 +0100 + +mysql-dfsg (4.0.6.gamma-2) experimental; urgency=low + + * Added --system to addgroup. Closes: #173866 + + -- Christian Hammers <ch@debian.org> Sat, 21 Dec 2002 15:28:26 +0100 + +mysql-dfsg (4.0.6.gamma-1) experimental; urgency=low + + * New upstream version. Now Gamma! + * There are no longer changes to the .orig.tar.gz neccessary to make diff + happy. docs/ has still to be deleted, although, as it is non-free. + * Incorporated patches from unstable. + * Added mysqlmanager and a couple of other new scripts. + * Enabled libmysqld embedded server library. + * Enabled SSL and Virtual-IO support. + (CORBA based MySQL-FS seems to be not existing..) + + -- Christian Hammers <ch@debian.org> Fri, 20 Dec 2002 22:30:51 +0100 + +mysql-dfsg (4.0.5a.beta-3) experimental; urgency=low + + * Modified postinst to work with old and new mysql.user table format + and fixed spelling typo in postinst. Thanks to Roger Aich. + * Updated config.{guess,sub} to make the mipsel porters happy. + Thanks to Ryan Murray. Closes: #173553 + + -- Christian Hammers <ch@debian.org> Wed, 18 Dec 2002 15:56:34 +0100 + +mysql-dfsg (4.0.5a.beta-2) experimental; urgency=low + + * Upstream removed option "--skip-gemini". So did I. Closes: 173142 + + -- Christian Hammers <ch@debian.org> Tue, 17 Dec 2002 10:35:49 +0100 + +mysql-dfsg (4.0.5a.beta-1) experimental; urgency=low + + * First 4.x experimental package due to continuous user requests :-) + Please test and report! + * upstream: safe_mysqld has been renamed to mysqld_safe + * upstream: new library soname version libmysqlclient.so.11 + * Renamed libmysqlclientXX-dev to libmysqlclient-dev as I don't plan to + support more than one development environment and this makes the + dependencies easier. + * FIXME: Skipped parts of the debian/patches/alpha patch as the global.h + is not existing. + * FIXME: How to get rid this? Old ltconfig patch already applied. + "lintian: binary-or-shlib-defines-rpath ./usr/bin/mysql /usr/lib/mysql" + + -- Christian Hammers <ch@debian.org> Sun, 1 Dec 2002 18:32:32 +0100 + +mysql-dfsg (3.23.53-4) unstable; urgency=medium + + * Fixed errno.h problem. Closes: #168533, #168535 + + -- Christian Hammers <ch@debian.org> Sun, 10 Nov 2002 18:32:08 +0100 + +mysql-dfsg (3.23.53-3) unstable; urgency=medium + + * Changed automake build-dep to unversioned automake1.4. Closes: #166391 + * Fixed description. Closes: #167270 + (Thanks to Soren Boll Overgaard) + + -- Christian Hammers <ch@debian.org> Tue, 5 Nov 2002 01:25:01 +0100 + +mysql-dfsg (3.23.53-2) unstable; urgency=low + + * Reverted user creation in init scripts. Closes: #166432 + (Thanks to Birzan George Cristian) + + -- Christian Hammers <ch@debian.org> Thu, 31 Oct 2002 15:36:25 +0100 + +mysql-dfsg (3.23.53-1) unstable; urgency=low + + * New upstream release. + + -- Christian Hammers <ch@debian.org> Thu, 24 Oct 2002 23:04:16 +0200 + +mysql-dfsg (3.23.52-3) unstable; urgency=low + + * Substituted the first-install 'debian-sys-maint' user creation by + something ANSI SQL compliant. Closes: #163497 + (Thanks to Karl Hammar) + * Tightend dependency to debhelper (>= 4.0.12) to be sure that + debconf-utils gets installed, too, as I use dh_installdebconf. + * Fixed upstream manpage bug in mysqldump.1. Closes: #159779 + (Thanks to Colin Watson) + * Added comment about MIN_WORD_LEN to mysql-server.README.Debian + (Thanks to Philipp Dreimann) + * Added a dependency for zlib1g-dev to libmysqlclient10-dev. + (Thanks to Jordi Mallach) + + -- Christian Hammers <ch@debian.org> Sun, 15 Sep 2002 17:14:44 +0200 + +mysql-dfsg (3.23.52-2) unstable; urgency=low + + * Fixed typo in preinst scripts. + * Removed bashism in init script. + * Fixed ambiguous debconf example. Closes: #158884 + + -- Christian Hammers <ch@debian.org> Fri, 30 Aug 2002 00:51:29 +0200 + +mysql-dfsg (3.23.52-1) unstable; urgency=low + + * New upstream version. Closes: #157731 + * Clearified the meaning of the debian-sys-maint special user in the + README.Debian file. Closes: #153702 + * Wrote some words regarding the skip-networking in README.Debian. + Closes: #157038 + * Added dependency to passwd. + * Fixes typo and unnecessarily complication in is_mysql_alive(). + * Added check for /etc/mysql/my.cnf in init script. + + -- Christian Hammers <ch@debian.org> Tue, 27 Aug 2002 01:53:32 +0200 + +mysql-dfsg (3.23.51-4) unstable; urgency=low + + * Added a compressed "nm mysqld" output to allow people to trace + core dumps with /usr/bin/resolve_stack_dump as suggested in the + INSTALL-SOURCE file. Thanks to atudor@labs.agilent.com for the hint. + + -- Christian Hammers <ch@debian.org> Wed, 24 Jul 2002 20:44:55 +0200 + +mysql-dfsg (3.23.51-3) unstable; urgency=low + + * Corrected copyright file: the MySQL client library is licenced under + the LGPL-2 not the GPL. From version 4.x it actually will be GPL this + is why parts of http://www.mysql.com/ already say so. Closes: #153591 + * Corrected german translation. + Thanks to Roland Rosenfeld <roland@spinnaker.de>. Closes: #151903 + + -- Christian Hammers <ch@debian.org> Thu, 11 Jul 2002 20:32:28 +0200 + +mysql-dfsg (3.23.51-2) unstable; urgency=low + + * Improved NIS tolerance in preinst script. + + -- Christian Hammers <ch@debian.org> Sun, 7 Jul 2002 04:43:28 +0200 + +mysql-dfsg (3.23.51-1) unstable; urgency=medium + + * New upstream version. + * I applied a patch that fixes a binary imcompatibility in + the shared libary libmysqlclient.so.10 between 3.23.50 and + some versions earlier. Upstream has been contacted and asked + for clarification. Closes: #149952 + * Added support for NIS i.e. it shows a warning and fails if the + needed 'mysql' user does not exists but works if it does. + Closes: #143282, #147869 + * Substituted $0 in init scripts by something really weird so that + "./S20mysql restart" works now, too. (BTW: S20? install file-rc!!!) + Closes: #148658 + * Now postinst works even if /etc/init.d/mysql is removed. Closes: #151021 + * Decided to leave "set +x" in postinst but wrote comment. Closes: #151022 + + -- Christian Hammers <ch@debian.org> Sun, 7 Jul 2002 04:43:25 +0200 + +mysql-dfsg (3.23.50-1) unstable; urgency=medium + + * New upstream version. + Fixes a very annoying and important bug that lets all mysql programs + including perl scripts etc. segfault when using the read_default_group() + function. 3.23.50 is currently a pre-release and expected to be released + next week. I plan to propose it for woody as soon as its stability has + been proven. The following bug reports are all regarding this issue. + Closes: #144960, #145322, #136798, #138143, + + -- Christian Hammers <ch@debian.org> Sat, 18 May 2002 21:14:01 +0200 + +mysql-dfsg (3.23.49x-1) unstable; urgency=low + + * I had to split the package to seperate the manual as it is not GPL + like the rest of the software and docs but under a license that + e.g. forbids selling printed versions. + . + The upstream authors were contacted a while ago but did not like to + change the situation. + . + The names of the resulting packages have not changed as the manual + already was in a seperate mysql-doc package due to it's size. + The source packages are now splitted from one "mysql" to + "mysql-dfsg" in main and "mysql-nonfree" in non-free. + * No code change! + The "x" at the end of the version number ist just to be able to + upload a new source package. ("a" was already taken by upstream + for their binary upload correction) + + -- Christian Hammers <ch@debian.org> Wed, 8 May 2002 02:01:41 +0200 + +mysql (3.23.49-8) unstable; urgency=low + + * Substituted $0 in init script to let e.g. "/etc# ./init.d/mysql restart" + works, too. Closes: #141555 + + -- Christian Hammers <ch@debian.org> Sun, 7 Apr 2002 15:00:44 +0200 + +mysql (3.23.49-7) unstable; urgency=low + + * The Makefiles are totally broken for the --enable-local-infile + option. I now patched libmysql/libmysql.c#mysql_init() manually. + Closes: #138347 + + -- Christian Hammers <ch@debian.org> Fri, 29 Mar 2002 23:55:15 +0100 + +mysql (3.23.49-6) unstable; urgency=low + + * Moved mysqlcheck from server to client package. Closes: #139799 + * Added manpage for mysqlhotcopy. Regarding: #87097 + * Added 'sharedscripts' directive to the logrotate script. + * Replaced grep by /usr/bin/getent to let the group/user checking work + on NIS/LDAP systems, too. Closes: #115677, #101529 + + -- Christian Hammers <ch@debian.org> Fri, 22 Mar 2002 22:40:51 +0100 + +mysql (3.23.49-5) unstable; urgency=low + + * Added skip-innodb to default my.cnf. + * Enabled --enable-local-infile, it seems to be a new option that + defaults to disable a formerly enabled feaure. Closes: #137115 + + -- Christian Hammers <ch@debian.org> Sat, 16 Mar 2002 00:29:10 +0100 + +mysql (3.23.49-4) unstable; urgency=medium + + * Recompiled against fixed libz. + + * Enabled --enable-local-infile, it seems to be a new option that + defaults to disable a formerly enabled feaure. Closes: #137115 + * Fixed README.compile_on_potato. Closes: #136529 + * Now a ext3 .jounal file in /var/lib/mysql does not prevent the + installation (happens when creating a jounal on an already mounted + partition). Closes: #137146 + + -- Christian Hammers <ch@debian.org> Wed, 13 Mar 2002 13:34:24 +0100 + +mysql (3.23.49-3) unstable; urgency=low + + * Added Russian translation. Closes: #135846 + * Fixed installation of .info documents. Closes: #135030 + + -- Christian Hammers <ch@debian.org> Wed, 27 Feb 2002 23:36:35 +0100 + +mysql (3.23.49-2) unstable; urgency=low + + * Updated french translation and split template files. Closes: #134754 + * Fixed a small debian.cnf related bug in mysql-server.postinst. + + -- Christian Hammers <ch@debian.org> Tue, 19 Feb 2002 23:13:58 +0100 + +mysql (3.23.49-1) unstable; urgency=low + + * New upstream release. + (Mainly InnoDB related fixes) + * Exported a $HOME variable in the scripts so that /root/.my.cnf + is not read anymore. This will avoid problems when admins put + only passwords but no usernames in this file. Closes: #132048 + * New debian-sys-maint password algorithm (now ~96bit :-)) Closes: #133863 + * Recreating debian-sys-main pwd on every install to help people who + accidently delete user or password files... + * Added /var/log/mysql so that user can put the binary logs in there as + mysql cannot write the .001 etc files itself in /var/log which is + owned by root. + + -- Christian Hammers <ch@debian.org> Thu, 14 Feb 2002 22:17:45 +0100 + +mysql (3.23.47-6) unstable; urgency=low + + * Dropped a sentence about the new debian-sys-maint user in the + debconf note and updated the README.Debian. Related: #132048 + * Added more french translation. Closes: #132390 + + -- Christian Hammers <ch@debian.org> Wed, 6 Feb 2002 09:41:29 +0100 + +mysql (3.23.47-5) unstable; urgency=low + + * Fixed grammar error in template. Closes: #132238 + * Really fixed typo in logrotate script. Closes: #131711 + + -- Christian Hammers <ch@debian.org> Tue, 5 Feb 2002 14:20:08 +0100 + +mysql (3.23.47-4) unstable; urgency=medium + + * Fixes typo in postinst that let init script fail. Closes: #131743 + * Fixed bashism bug that failed on ash. Closes: #131697 + * Fixed typo in logrotate script. Closes: #131711 + + -- Christian Hammers <ch@debian.org> Thu, 31 Jan 2002 23:58:46 +0100 + +mysql (3.23.47-3) unstable; urgency=low + + * Added new Debian specific mysql user called 'debian-sys-maint' which + is used for pinging the server status, flushing the logs or shutting + down the server in maintenance scripts. The credentials of this user + are stored in the UID0-only readable file /etc/mysql/debian.cnf. + Closes: #129887, #130326, #99274 + * Fixed unintended server startup at boottime. Closes: #122676, #130105 + * New upstream fixes command line parsing bug: Closes: #128473 + * Fixed manpage headers to let apropos work: Closes: #119122 + * Added "status" options for /etc/init.d/mysql. Closes: #129020 + + -- Christian Hammers <ch@debian.org> Sun, 27 Jan 2002 19:46:11 +0100 + +mysql (3.23.47-2) unstable; urgency=low + + * Enhanced init scripts by using mysqladmin instead of kill $pid. + Thanks to Aaron Brick. + + -- Christian Hammers <ch@debian.org> Fri, 18 Jan 2002 01:42:23 +0100 + +mysql (3.23.47-1) unstable; urgency=low + + * New upstream release. + * Updated brazilian translation of debconf descriptions. Closes: #123332 + + -- Christian Hammers <ch@debian.org> Sun, 6 Jan 2002 21:11:17 +0100 + +mysql (3.23.46-3) unstable; urgency=low + + * Fixed bug in postinst where a script was accidently called with + "bash -c <script> -IN_RPM" prevting the first argument to take effect + and then leading to failures on hosts with unresolvable hostnames. + Closes: #126147 + * Small changes and comments in postinst. + + -- Christian Hammers <ch@debian.org> Sat, 22 Dec 2001 14:03:02 +0100 + +mysql (3.23.46-2) unstable; urgency=low + + * Start/stop behaviour now configurable via debconf. Closes: #112174 + + -- Christian Hammers <ch@debian.org> Sun, 9 Dec 2001 21:38:54 +0100 + +mysql (3.23.46-1) unstable; urgency=low + + * New upstream release. + Only few fixes, mainly innodb related. + + -- Christian Hammers <ch@debian.org> Sun, 2 Dec 2001 03:08:48 +0100 + +mysql (3.23.45-1) unstable; urgency=low + + * New upstream version. + Only few fixes, mainly innodb related. + * Added debconf note regarding the skip-networking option. + + -- Christian Hammers <ch@debian.org> Sun, 25 Nov 2001 16:50:37 +0100 + +mysql (3.23.44-2) unstable; urgency=low + + * Finally removed debconf toggled "skip-networking" line add/remove + code for /etc/mysql/my.cnf. I don't like editing a file that's tagged + as configuration file. + I disabled networking by default for security reasons. Better ideas? + + -- Christian Hammers <ch@debian.org> Fri, 16 Nov 2001 02:11:02 +0100 + +mysql (3.23.44-1) unstable; urgency=low + + * New upstream release. + - fixes replication bug (core dump) + * Made description better english :) Thanks to D. Welton. + + -- Christian Hammers <ch@debian.org> Sun, 11 Nov 2001 15:44:07 +0100 + +mysql (3.23.43-4) unstable; urgency=low + + * Disabled statically linking. + + -- Christian Hammers <ch@debian.org> Sat, 10 Nov 2001 03:15:56 +0100 + +mysql (3.23.43-3) unstable; urgency=low + + * Changed compiler settings after one user reported instabilities. + See #116631 for more information. + + -- Christian Hammers <ch@debian.org> Tue, 30 Oct 2001 21:39:17 +0100 + +mysql (3.23.43-2) unstable; urgency=low + + * Patched sparc mutexes again. Closes: #113430 + + -- Christian Hammers <ch@debian.org> Sun, 7 Oct 2001 15:09:00 +0200 + +mysql (3.23.43-1) unstable; urgency=low + + * New upstream version. + - Fixed some unlikely(sic!) bugs and core dumps. + - Fixed a bug with BDB tables and UNIQUE columns that are NULL. + - [more minor bugs were fixed; see changelog] + * Adjusted build depends on libwrap0 for IA-64. Closes: #114582 + * Added the mysqlcheck binary. Closes: #114490 + * Fixed rules for arm architecture. Closes: #88186 + * Renamed mysql_print_defaults to the original name my_print_defaults. + Isn't as descriptive but else I'd have to patch too much. Closes: #114492 + + -- Christian Hammers <ch@debian.org> Fri, 5 Oct 2001 22:24:40 +0200 + +mysql (3.23.42-2) unstable; urgency=low + + * Applied patch for m68k compile. Closes: #112904 + + -- Christian Hammers <ch@debian.org> Sun, 23 Sep 2001 21:32:57 +0200 + +mysql (3.23.42-1) unstable; urgency=low + + * New upstream releae. + Fixes critical bug with InnoDB and large BLOBs. + + -- Christian Hammers <ch@debian.org> Tue, 18 Sep 2001 22:25:47 +0200 + +mysql (3.23.41-2) unstable; urgency=low + + * Fixed shlibs.local problem. Closes: #111573 + * Replaced emacs by sensible-editor in mysqlbug.sh. Thanks Hans Ginzel. + + -- Christian Hammers <ch@debian.org> Sun, 9 Sep 2001 17:16:42 +0200 + +mysql (3.23.41-1) unstable; urgency=low + + * New upstream release + * Fixed build problem on ia64. Closes: #110624 + + -- Christian Hammers <ch@debian.org> Tue, 14 Aug 2001 23:20:35 +0200 + +mysql (3.23.40-1) unstable; urgency=low + + * New upstream release + + -- Christian Hammers <ch@debian.org> Sun, 5 Aug 2001 19:46:18 +0200 + +mysql (3.23.39-5) unstable; urgency=low + + * Added debconf template for brazil. Closes: #106934, #106752 + * Tightened dependencies on debconf. + * Adjusted mysql.err permissions in logrotate script to 0600. Closes: #105672 + + -- Christian Hammers <ch@debian.org> Mon, 30 Jul 2001 00:10:12 +0200 + +mysql (3.23.39-4.1) unstable; urgency=low + + * Maintainer-requested NMU. + * Fixing thread mutexes on Sparc and Alpha + (closes: Bug#101783) + * Added --enable-assembler for sparc. This should + allow mysql on sparc to use assembler versions of + some string functions (read: should speed up a bit). + + -- Christopher C. Chimelis <chris@debian.org> Fri, 13 Jul 2001 15:09:30 -0400 + +mysql (3.23.39-4) unstable; urgency=low + + * Porting fixes. + + -- Christian Hammers <ch@debian.org> Mon, 9 Jul 2001 17:56:54 +0200 + +mysql (3.23.39-3.1) unstable; urgency=low + + * NMU (for porting) + * Update config.sub and config.guess for hppa, sh & s390. + * Add --with-client-ldflags=-lstdc++ to configure line. Closes: #100884 + + -- Matthew Wilcox <willy@debian.org> Sun, 8 Jul 2001 19:26:59 -0600 + +mysql (3.23.39-3) unstable; urgency=low + + * Disabled berkeley-db on sparc again. Mutexes aren't working again :-( + + -- Christian Hammers <ch@debian.org> Sat, 7 Jul 2001 18:30:08 +0200 + +mysql (3.23.39-2) unstable; urgency=low + + * Bugfixed the m68k mutex patch. Thanks to Michael Fedrowitz. Closes: #103145 + * Removed config.cache files in bdb/ and innobase/. Closes: #103143 + + -- Christian Hammers <ch@debian.org> Wed, 4 Jul 2001 22:06:58 +0200 + +mysql (3.23.39-1) unstable; urgency=low + + * New upstream release. Minor bugfixes only. + + -- Christian Hammers <ch@debian.org> Thu, 14 Jun 2001 13:53:03 +0200 + +mysql (3.23.38-4) unstable; urgency=low + + * Added logcheck files. Closes: #99131 + (I can't let the usermod away since I don't know of an easy way to + retrive "passwd" information in a shell script considering that + people use different storage methods like LDAP/NIS instead of passwd.) + + -- Christian Hammers <ch@debian.org> Fri, 8 Jun 2001 21:04:25 +0200 + +mysql (3.23.38-3) unstable; urgency=low + + * Explicit pointet to /root/.my.cnf to let /etc/init.d/mysql stop + work in sudo environments with $HOME!=/root work, too. Closes: #98324 + * Removes empty /etc/mysql on purge. Closes: #98164 + + -- Christian Hammers <ch@debian.org> Tue, 22 May 2001 10:13:06 +0200 + +mysql (3.23.38-2) unstable; urgency=low + + * Added depends to libdbd-mysql-perl for mysql-server. Closes: #94306 + + -- Christian Hammers <ch@debian.org> Sat, 19 May 2001 19:43:26 +0200 + +mysql (3.23.38-1) unstable; urgency=low + + * New upstream release. + * Added Build-Depends to procps. Closes: #96768 + + -- Christian Hammers <ch@debian.org> Sun, 13 May 2001 17:30:15 +0200 + +mysql (3.23.37-5) unstable; urgency=low + + * Applied mutex patch for bdb support on m68k. + Thanks to Michael Fedrowitz for the patch. + + -- Christian Hammers <ch@debian.org> Mon, 7 May 2001 12:30:40 +0200 + +mysql (3.23.37-4) unstable; urgency=low + + * Enable bdb support for m68k architecture. + + -- Christian Hammers <ch@debian.org> Sat, 5 May 2001 16:47:36 +0200 + +mysql (3.23.37-3) unstable; urgency=low + + * Added thread-safe client library. Thanks to Shane Wegner. Closes: #95441 + + -- Christian Hammers <ch@debian.org> Sat, 28 Apr 2001 09:45:00 -0400 + +mysql (3.23.37-2) unstable; urgency=low + + * Added sparc to the list of BDB supporting architectures after some + tests on vore.debian.org and mails with Ben Collons. + + -- Christian Hammers <ch@debian.org> Fri, 27 Apr 2001 09:30:09 -0400 + +mysql (3.23.37-1) unstable; urgency=low + + * New upstream version. + * Added gemini table support. + * Does anybody know how to enable SSL? + * Fixed ARM compilation problem. Closes: #88186 + + -- Christian Hammers <ch@debian.org> Sat, 21 Apr 2001 11:48:46 -0400 + +mysql (3.23.36-2) unstable; urgency=low + + * Added patch by Christopher C. Chimelis <chris@debian.org> to make + Berkeley db3 work again on Alpha architecture. Closes: #92787 + + -- Christian Hammers <ch@debian.org> Tue, 3 Apr 2001 23:41:46 +0200 + +mysql (3.23.36-1) unstable; urgency=high + + * New upstream version. + * SECURITY FIX: One could place database tables outside the database + directory by using '..' in one of the mysql helper programs where the + table name was not checked correctly. This could lead to root compromise + if the server would be running as root else you could at least do bad + things as user mysql. + * upstream: Fixed bug when thread creation failed. + * upstream: Fixed problem in Innobase with non-latin1 charsets + * upstream: Fixed a core-dump bug when using very complex query with DISTINGT + * upstream: many others so called minor bugs... + * fixes bug in init script. Closes: #90257 + (this report was agains some older problem that has been fixed too in .33) + + -- Christian Hammers <ch@debian.org> Fri, 30 Mar 2001 02:55:12 +0200 + +mysql (3.23.35-1) unstable; urgency=medium + + * New upstream relase. + * Fixes problem in ORDER BY clause. People using 3.33.34 should upgrade! + * Includes innobase support. + (Hope this is not such a catastrophe like berkeley db...) + + -- Christian Hammers <ch@debian.org> Fri, 16 Mar 2001 23:30:30 +0100 + +mysql (3.23.33-3) unstable; urgency=low + + * Forgot #!/bin/sh at top of mysql-doc.postinst. Closes: #89801 + + -- Christian Hammers <ch@vore.debian.org> Thu, 15 Mar 2001 20:38:35 -0500 + +mysql (3.23.33-2) unstable; urgency=low + + * Added some missing scripts and manpages. Closes: #84068 + * Added dependency to perl-5.6. Closes: #81942 + * Added french templates somewhen ago. Closes: #83790 + * Added patch to get db3 working on Alpha. Closes: #86033 + Thanks to Christopher C. Chimelis <chris@debian.org>. The patch + itself is included as debian/patch.alpha, too. + + -- Christian Hammers <ch@debian.org> Sun, 18 Feb 2001 06:40:40 +0100 + +mysql (3.23.33-1) unstable; urgency=high + + * Fixes two security bugs that allowes crashing the server and maybe + gaining the UID of the process that is linked against libmysqlclient! + + -- Christian Hammers <ch@debian.org> Tue, 13 Feb 2001 23:01:18 +0100 + +mysql (3.23.32-1) unstable; urgency=low + + * New upstream releaes. + (just minor fixes) + * Added french and german debconf templates. + + -- Christian Hammers <ch@debian.org> Sun, 4 Feb 2001 17:27:07 +0100 + +mysql (3.23.31-1) unstable; urgency=high + + * New upstream release. + * Fixes security bug that was announced at BUGTRAQ mailing list. + (Disappointingly not by mysql.com!). And allows a buffer overflow + and therefore access to the mysql UID and all databases when already + having a valid account. Closes: #82881 + + -- Christian Hammers <ch@debian.org> Sat, 20 Jan 2001 11:14:36 +0100 + +mysql (3.23.30-2) unstable; urgency=low + + * Recompiled with new dpkg-dev. + + -- Christian Hammers <ch@debian.org> Sun, 14 Jan 2001 22:20:55 +0100 + +mysql (3.23.30-1) unstable; urgency=low + + * New upstream release. + + -- Christian Hammers <ch@debian.org> Sun, 7 Jan 2001 22:10:18 +0100 + +mysql (3.23.28-10) testing unstable; urgency=low + + * I must upload to "testing" to get it into woody, right?! + + -- Christian Hammers <ch@debian.org> Fri, 29 Dec 2000 14:43:57 +0100 + +mysql (3.23.28-9) unstable; urgency=low + + * Made it a replacement for libmysqlclient9. + + -- Christian Hammers <ch@westend.com> Mon, 25 Dec 2000 19:15:04 +0100 + +mysql (3.23.28-8) unstable; urgency=low + + * Applied patch from a user to get the skip-networking option working! + Approved from a mysql employee but please test anyways. + This finally: Closes: #79672, #78634, #79660, #79658 + + -- Christian Hammers <ch@debian.org> Sat, 16 Dec 2000 14:01:36 +0100 + +mysql (3.23.28-6) unstable; urgency=medium + + * Fixed error in postinst. Closes: #79392, #79400, #79451, #79550 + * Added .info files again on user request. Closes: #78988, #75737 + + -- Christian Hammers <ch@debian.org> Wed, 13 Dec 2000 21:18:24 +0100 + +mysql (3.23.28-5) unstable; urgency=low + + * Fixed a stupid bug in mysql-server.postinst regarding the + configuration of skip-networking. Closes: #78639, 78634 + * Used patched bdb which hopefully enables mutexes on Alpha. Closes: #78197 + * Added dependency to adduser. Closes: #76798 + + -- Christian Hammers <ch@debian.org> Sun, 10 Dec 2000 16:55:48 +0100 + +mysql (3.23.28-4) unstable; urgency=low + + [never uploaded] + * Fixed a stupid bug in mysql-server.postinst regarding the + configuration of skip-networking. Closes: #78639, 78634 + * Used patched bdb which hopefully enables mutexes on Alpha. Closes: #78197 + + -- Christian Hammers <ch@debian.org> Sun, 3 Dec 2000 17:49:44 +0100 + +mysql (3.23.28-3) unstable; urgency=low + + * This time really fixed m68k build error. Closes: #78235 + + -- Christian Hammers <ch@debian.org> Sun, 3 Dec 2000 15:02:55 +0100 + +mysql (3.23.28-2) unstable; urgency=low + + * Adjusted rules file to make it buildable on m86k. Closes: #78235 + + -- Christian Hammers <ch@debian.org> Fri, 1 Dec 2000 20:07:26 +0100 + +mysql (3.23.28-1) unstable; urgency=low + + * New upstream vesrion. Now gamma! + * Changed umask of mysql.log making it o-rw + * Disabled listening on network reachable TCP ports by default due to + security considerations. + + -- Christian Hammers <ch@debian.org> Thu, 23 Nov 2000 20:12:50 +0100 + +mysql (3.23.27-1) unstable; urgency=low + + * New upstream version. + * Closes: #75711 + + -- Christian Hammers <ch@debian.org> Sun, 29 Oct 2000 14:29:51 +0100 + +mysql (3.23.25-4) unstable; urgency=low + + * Recompiled to get rid of the dependency for zlib1 (libc5). + Closes: #74952, #74939 + + -- Christian Hammers <ch@debian.org> Tue, 17 Oct 2000 14:34:52 +0200 + +mysql (3.23.25-3.1) unstable; urgency=low + + * Maintainer-approved NMU. + * Includes patch to fix and enable db3 support on Alpha. + * Enable support for thread mutexes in db3 on sparc + (it works after all, according to Ben Collins) + * Removed atomic_ functions for Alpha since they are no + longer supported in the current glibc in woody. + * Cleaned up rules file a bit. + + -- Christopher C. Chimelis <chris@debian.org> Sat, 14 Oct 2000 04:22:02 -0400 + +mysql (3.23.25-3) unstable; urgency=low + + * Upstream decided not to include my_config.h,my_dir.h into the installed + header files. As this file contains at least informative material + and more important is checked by several autoconf scripts I + included it by hand again. + * Made building of berkeley db conditional to architecture until + I get response whether it works on sparc/alpha now. + + -- Christian Hammers <ch@debian.org> Wed, 11 Oct 2000 23:58:38 +0200 + +mysql (3.23.25-2) unstable; urgency=medium + + * Last build went terrible wrong.. Here's the changelog again: + * New upstream release. + * Shared library version was raised from 9 to 10. + Maintainers of packets using libmysqlclient9 must recompile! + + -- Christian Hammers <ch@debian.org> Wed, 11 Oct 2000 01:16:34 +0200 + +mysql (3.23.25-1) unstable; urgency=low + + * New upstream release. + * Shared library version was raised from 9 to 10. + Maintainers of packets using libmysqlclient9 must recompile! + + -- Christian Hammers <ch@debian.org> Sat, 7 Oct 2000 18:21:51 +0200 + +mysql (3.23.24-2) unstable; urgency=low + + * Applied upstream patch regarding quoting of mysqldump. + * Updated to db-3.1.17-patched (from www.mysql.com) + + -- Christian Hammers <ch@debian.org> Fri, 15 Sep 2000 18:58:14 +0200 + +mysql (3.23.24-1) unstable; urgency=medium + + * New upstream version with some important fixes. + * upstream: Last version corrupted CHAR/VARCHAR/BLOB columns with + chararacters above ASCII 128! Check and repair all these tables. + * upstream: fixed small memory leak + * upstream: fixed problem with BDB tables and reading on unique + (not primary) key. + * Disabled BDB tables on all architectures except i386 due to many + bug reports (see #71206). -> HELP APPRECIATED <- + + -- Christian Hammers <ch@debian.org> Tue, 12 Sep 2000 06:18:54 +0200 + +mysql (3.23.23-2) unstable; urgency=low + + * Strange... "nohup nice" gives differnet results and let therefore + crash safe_mysqld when starting up. Apparently it seems to be + kernel dependand. Now fixed by another conditional. This + more or less Closes: #71057 + * This bug was reported (accidently) in the following identical reports: + Closes: #71253, #71254, #71257, #71258, #71259, #71262, #71266, #71267 + Closes: #71268, #71271, #71275, #71277, #71278, #71283, #71291 + + -- Christian Hammers <ch@debian.org> Sat, 9 Sep 2000 20:13:50 +0200 + +mysql (3.23.23-1) unstable; urgency=low + + * New upstream version. Feature freeze! + * Fixed source build problem. Closes: #70707 + + -- Christian Hammers <ch@debian.org> Thu, 31 Aug 2000 10:03:35 +0200 + +mysql (3.23.22b-1) unstable; urgency=low + + * Reorganised docs. Now we have several small html files instead of + one with almost 2M. Closes: 70431 + * Removed pdf,ps and html from source package shrinked it about 3M + (therefore the .orig.tar.gz is called 3.23.22b!) + * -> Last upload failed due to problems at the FTP site so here the + -> changelog again: + * Fixes memory leak, commit/rollback, reserved word "MASTER" ... + * Added Berkeley DB3 source code to the Debian diff to be able to + compile with bdb transaction support! (Great feature!!!) + * Upstream correction of error message. Closes: #68939 + * Upstream correction of reserved word "source". + + -- Christian Hammers <ch@debian.org> Fri, 25 Aug 2000 19:21:24 +0200 + +mysql (3.23.22-1) unstable; urgency=low + + * New upstream version. + * Fixes memory leak, commit/rollback, reserved word "MASTER" ... + * Added Berkeley DB3 source code to the Debian diff to be able to + compile with bdb transaction support! (Great feature!!!) + * Upstream correction of error message. Closes: #68939 + * Upstream correction of reserved word "source". + + -- Christian Hammers <ch@debian.org> Sun, 20 Aug 2000 09:05:48 +0200 + +mysql (3.23.21-4) unstable; urgency=low + + * Added libmysqlclient9.shlibs and shlibs.local file. Closes: #68669 + + -- Christian Hammers <ch@debian.org> Wed, 9 Aug 2000 14:22:49 +0200 + +mysql (3.23.21-3) unstable; urgency=low + + * Let "/etc/init.d/mysql restart" wait until the pid has been + removed before (but max 6 seconds) before restarting. Closes: 65070 + * Added build dependencies. + + -- Christian Hammers <ch@debian.org> Sun, 30 Jul 2000 16:16:48 +0200 + +mysql (3.23.21-2) unstable; urgency=low + + * Typo in safe_mysqld prevents start. + + -- Christian Hammers <ch@debian.org> Sat, 29 Jul 2000 13:40:50 +0200 + +mysql (3.23.21-1) unstable; urgency=low + + * New upstream version. + + -- Christian Hammers <ch@debian.org> Mon, 10 Jul 2000 22:54:17 +0200 + +mysql (3.23.20-1) unstable; urgency=low + + * MySQL finally got fully GPL'ed! This means that there is only one + souce package and only main/* binary packages from now on. + * Fixed symlink in libmysqlclient9-dev. Closes: 66452 + * Apart from that the usual bug fixes for BETA software. + + -- Christian Hammers <ch@debian.org> Mon, 3 Jul 2000 20:05:38 +0200 + +mysql-pd (3.23.16-1) unstable; urgency=low + + * New upstream release. (Actually a brand new upstream branch!) + * Added mysql-common package as the configuration file can be used + by all versions of the mysql client library. + Did some more package reorganisations, too. See README.Debian file! + * libmysqlclient.so raised major version from 6 to 9. + * Minor beautifications in the debian/ directory. + + -- Christian Hammers <ch@debian.org> Sat, 27 May 2000 20:30:01 +0200 + +mysql-gpl (3.22.30-2) frozen unstable; urgency=low + + * Fixed path in libmysqlclient.la. Closes: #58875 + + -- Christian Hammers <ch@debian.org> Sat, 25 Jan 2000 20:27:29 -0700 + +mysql-gpl (3.22.30-1) frozen unstable; urgency=low + + * A small change in the libmysqlclient6 causes mysqladmin to print an + shared library error when displaying the defaults. Everything else + works fine so this error wasn't detected untill now. Closes: #58033 + * TcX released a new MySQL version that includes another security patch, + this time against mysqlaccess. The author told me that it would be + fine if I just included the new .c in this source since I don't want + go to 3.22.32 in frozen. + * ->Release Manager: Although the version number increased there is + no new coded except for the shared library. The rest is the same + as in mysql-server and mysql-client. + + -- Christian Hammers <ch@debian.org> Tue, 15 Feb 2000 23:26:54 +0100 + +mysql-gpl (3.22.29-1) unstable; urgency=low + + * New upstream version. + + -- Christian Hammers <ch@debian.org> Thu, 6 Jan 2000 20:37:23 +0100 + +mysql-gpl (3.22.27a-3) unstable; urgency=low + + * Use system readline instead of bundled version. Closes: #50069 + Any objections ? + + -- Christian Hammers <ch@debian.org> Sun, 14 Nov 1999 18:09:48 +0100 + +mysql-gpl (3.22.27a-2) unstable; urgency=low + + * Now building mysql-gpl-doc in binary-indep. + + -- Christian Hammers <ch@debian.org> Sat, 23 Oct 1999 04:22:36 +0200 + +mysql-gpl (3.22.27a-1) unstable; urgency=low + + * Adjusted version number to allow new orig.tar.gz. + The old seems broken :-( People reported compilation problems. + * Changed mysql-gpl-doc to "Architecture: all". + + -- Christian Hammers <ch@debian.org> Sun, 17 Oct 1999 13:01:35 +0200 + +mysql-gpl (3.22.27-1) unstable; urgency=low + + * New upstream release. Fixes charset problem. + + -- Christian Hammers <ch@debian.org> Mon, 11 Oct 1999 18:01:40 +0200 + +mysql-gpl (3.22.26a-1) unstable; urgency=low + + * New upstream version. Just some small bug fixes. + * FHS compliance. + + -- Christian Hammers <ch@debian.org> Sun, 3 Oct 1999 10:16:14 +0200 + +mysql-gpl (3.22.25-2) unstable; urgency=low + + * Added conflict to all old mysql-dev packages. (fixes: #42966) + + -- Christian Hammers <ch@debian.org> Sun, 15 Aug 1999 11:35:46 +0200 + +mysql-gpl (3.22.25-1) unstable; urgency=low + + * New upstream version. (We are waiting for 3.23.x !) + * Fixes some upstream small bugs. + + -- Christian Hammers <ch@debian.org> Sun, 18 Jul 1999 22:02:06 +0200 + +mysql-gpl (3.22.23b-4) unstable; urgency=low + + * Rebuild for new perl. + + -- Christian Hammers <ch@debian.org> Thu, 8 Jul 1999 01:09:57 +0200 + +mysql-gpl (3.22.23b-3) unstable; urgency=low + + * libmysqlclient had the wrong socket path. + + -- Christian Hammers <ch@debian.org> Sun, 03 Jul 1999 23:13:30 +0200 + +mysql-gpl (3.22.23b-2) unstable; urgency=low + + * Missed one replace tag to an very old version of mysql-devel. + + -- Christian Hammers <ch@debian.org> Sun, 27 Jun 1999 19:13:30 +0200 + +mysql-gpl (3.22.23b-1) unstable; urgency=low + + * New upstream minor version. + * Cleaned up the dependencies a bit. + + -- Christian Hammers <ch@debian.org> Sun, 27 Jun 1999 19:13:30 +0200 + +mysql-gpl (3.22.22-1) unstable; urgency=low + + * New upstream version. (closes Bug#36493,37340) + * New maintainer upload. + * Package reorganisation: We prepare for the GPL'ed server which will + * be released soon and make the structure more clear to the user. + + -- Christian Hammers <ch@debian.org> Mon, 3 May 1999 20:43:41 +0200 + +mysql (3.22.21-1) unstable; urgency=low + + * Never released. TcX was too fast :-) + + -- Christian Hammers <ch@debian.org> Tue, 20 Apr 1999 17:22:04 +0200 + +mysql-freebits (3.21.33b-3) unstable; urgency=low + + * Recompile with libncurses + + -- Scott Hanson <shanson@debian.org> Sat, 31 Oct 1998 15:04:39 +0100 + +mysql-freebits (3.21.33b-2) unstable; urgency=low + + * Recompile with libstdc++2.9 (fixes #27792) + + -- Scott Hanson <shanson@debian.org> Mon, 12 Oct 1998 18:47:25 +0200 + +mysql-freebits (3.21.33b-1) unstable; urgency=low + + * New upstream version (probably the last for 3.21) + + -- Scott Hanson <shanson@debian.org> Tue, 8 Sep 1998 18:59:37 +0200 + +mysql-freebits (3.21.33-4) unstable; urgency=low + + * Separate out non-free source files, move mysql-base, mysql-dev, and + * mysql-doc to main distribution + * Locale files /usr/share/mysql/ now in server, not base; therefore... + * Add conflict to mysql-server <=3.21.33-3 + + -- Scott Hanson <shanson@debian.org> Fri, 31 Jul 1998 19:16:08 +0200 + +mysql (3.21.33-3) unstable; urgency=low + + * Release to unstable with moved socket (fixes #24574) + * Add conflict to old libdbd-mysql-perl package + + -- Scott Hanson <shanson@debian.org> Wed, 22 Jul 1998 22:17:43 +0200 + +mysql (3.21.33-2) experimental; urgency=low + + * Move socket from /tmp to /var/run (see #24574) + * Release to experimental, since this breaks everything statically + * linked to libmysqlclient! + + -- Scott Hanson <shanson@debian.org> Wed, 15 Jul 1998 19:37:01 +0200 + +mysql (3.21.33-1) unstable; urgency=low + + * New upstream release + + -- Scott Hanson <shanson@debian.org> Sun, 12 Jul 1998 08:18:18 +0200 + +mysql (3.21.32a-1) unstable; urgency=low + + * New upstream release + * Lintian bugs: ldconfig, missing manpage, call to perl5 + * Lintian bug shlib-with-non-pic-code _not_ yet fixed + + -- Scott Hanson <shanson@debian.org> Sat, 4 Jul 1998 07:57:13 +0200 + +mysql (3.21.31-1) unstable frozen; urgency=low + + * New upstream release for hamm and slink (bug fixes only) + * Fix unsecure use of temp file in mysqlbug (fixes #23606) + * Added brief licensing information to control file + + -- Scott Hanson <shanson@debian.org> Tue, 16 Jun 1998 10:52:44 +0200 + +mysql (3.21.30-3) unstable; urgency=low + + * Restore missing shared library dependencies for mysql-server + + -- Scott Hanson <shanson@debian.org> Mon, 15 Jun 1998 07:51:58 +0200 + +mysql (3.21.30-2) unstable; urgency=low + + * Simplify debian/rules (fixes #17662) + * Edit manual.texi to add "Debian notes" to documentation + * Add note about passwords on command line (fixes #16471) + * Add note about getting privleges for users (fixes #22891) + * Correct "Possible license changes" heading (fixes #22711) + * Add uninstalled header files to /usr/doc/mysql-dev/examples (fixes #22627) + * Add udf_example.cc to /usr/doc/mysql-dev/examples (fixes #22710) + + -- Scott Hanson <shanson@debian.org> Sun, 7 Jun 1998 13:05:37 +0200 + +mysql (3.21.30-1) unstable; urgency=low + + * Stable upstream release + + -- Scott Hanson <shanson@debian.org> Tue, 12 May 1998 22:13:25 +0200 + +mysql (3.21.29gamma-1) unstable; urgency=low + + * New upstream release + * Do not create 'mysql' subdirectory for libs and headers (fixes #19020) + * Remove 'CXX=gcc' flag from configure (g++ now standard) + + -- Scott Hanson <shanson@debian.org> Sun, 12 Apr 1998 18:38:03 +0200 + +mysql (3.21.28gamma-1) unstable; urgency=low + + * New upstream release + * Unstable-only release; hamm stays at 3.21.25 for now + + -- Scott Hanson <shanson@debian.org> Thu, 2 Apr 1998 21:33:51 +0200 + +mysql (3.21.25gamma-3) unstable frozen; urgency=low + + * Have mysql-base suggest perl >= 5.004 for mysqlaccess (fixes #19593) + * Fix shlibs to refer to mysql-base rather than the no-longer-existant mysql + + -- Scott Hanson <shanson@debian.org> Thu, 26 Mar 1998 18:22:59 +0100 + +mysql (3.21.25gamma-2) unstable; urgency=low + + * Restore libmysqlclient.so symlink to mysql-dev (fixes #19036) + + -- Scott Hanson <shanson@debian.org> Sun, 8 Mar 1998 10:46:43 +0100 + +mysql (3.21.25gamma-1) unstable; urgency=low + + * Check if running as root in init.d script (fixes #18577) + * New upstream release + + -- Scott Hanson <shanson@debian.org> Fri, 27 Feb 1998 20:01:30 +0100 + +mysql (3.21.24gamma-1) unstable; urgency=low + + * New upstream release + + -- Scott Hanson <shanson@debian.org> Mon, 23 Feb 1998 08:14:17 +0100 + +mysql (3.21.23beta-3) unstable; urgency=low + + * Squashed errors found by lintian + + -- Scott Hanson <shanson@debian.org> Tue, 17 Feb 1998 20:19:01 +0100 + +mysql (3.21.23beta-2) unstable; urgency=low + + * Fixed overlaps with old mysql package (fixes #17843) + + -- Scott Hanson <shanson@debian.org> Thu, 5 Feb 1998 22:55:00 +0100 + +mysql (3.21.23beta-1) unstable; urgency=low + + * New upstream release + * Fix include lines in mysql.h (fixes #17827) + * Move /usr/include/mysql to mysql-dev + + -- Scott Hanson <shanson@debian.org> Wed, 4 Feb 1998 19:59:14 +0100 + +mysql (3.21.22beta-3) unstable; urgency=low + + * Correct descriptions in control file (fixes #17698) + * Clean up output of shutdown script + + -- Scott Hanson <shanson@debian.org> Sat, 31 Jan 1998 19:04:29 +0100 + +mysql (3.21.22beta-2) unstable; urgency=low + + * Split out mysql-dev and mysql-bench subpackages + + -- Scott Hanson <shanson@debian.org> Wed, 28 Jan 1998 19:52:27 +0100 + +mysql (3.21.22beta-1) unstable; urgency=low + + * New upstream release + + -- Scott Hanson <shanson@debian.org> Wed, 28 Jan 1998 18:59:09 +0100 + +mysql (3.21.21a.beta-2) unstable; urgency=low + + * Compile with libpthreads from libc6-dev_2.0.6-3 rather than statically + linking to patched libpthreads (see changes to 3.20.29-2) + + -- Scott Hanson <shanson@debian.org> Sun, 25 Jan 1998 13:17:15 +0100 + +mysql (3.21.21a.beta-1) unstable; urgency=low + + * Put initial database, mysql_install_db, safe_mysqld, isamlog and + isamchk in mysql-server + * Correct upstream release number so source packages are correctly built + + -- Scott Hanson <shanson@debian.org> Mon, 19 Jan 1998 07:52:48 +0100 + +mysql (3.21.21.beta-1) unstable; urgency=low + + * Use debhelper where possible in rules + * Split binary packages into mysql-base, mysql-client, mysql-doc + * New upstream release + + -- Scott Hanson <shanson@debian.org> Thu, 15 Jan 1998 08:12:17 +0100 + +mysql (3.21.19.beta-1) unstable; urgency=low + + * Offer to set root password in mysql_install_db + * Kill `pidof mysqld` on shutdown rather than use mysqladmin + * New upstream version + + -- Scott Hanson <shanson@debian.org> Fri, 9 Jan 1998 20:06:35 +0100 + +mysql (3.21.17a.beta-2) unstable; urgency=low + + * Remove perl stuff (it's going back into libdbd-mysql-perl) + * Remove conflict with libdbd-mysql-perl + * Do not compress *html files (fixes #16314) + + -- Scott Hanson <shanson@debian.org> Tue, 30 Dec 1997 07:34:20 +0100 + +mysql (3.21.17a.beta-1) unstable; urgency=low + + * Add conflict to libdbd-mysql-perl + * Use --pid-file option to place pid file in /var/run rather than patching + * Add install-info to postinst and postrm + * Add filename to message shown by mysql_install_db (fixes #16621) + * New upstream version + + -- Scott Hanson <shanson@debian.org> Sun, 21 Dec 1997 19:41:45 +0100 + +mysql (3.20.32a-5) unstable; urgency=low + + * Move mysqld to /usr/lib/mysql, per policy discussion + * Adjust makefiles so perl libs get installed + + -- Scott Hanson <shanson@debian.org> Wed, 3 Dec 1997 22:37:45 +0100 + +mysql (3.20.32a-4) unstable; urgency=low + + * Move mysqld to /usr/sbin to comply with FSSTND + + -- Scott Hanson <shanson@debian.org> Mon, 3 Nov 1997 20:12:29 +0100 + +mysql (3.20.32a-3) unstable; urgency=low + + * Comment out tests in mysql_install_db... for real this time! + + -- Scott Hanson <shanson@debian.org> Mon, 3 Nov 1997 07:32:53 +0100 + +mysql (3.20.32a-2) unstable; urgency=low + + * Comment out tests in mysql_install_db (fixes #14304) + + -- Scott Hanson <shanson@debian.org> Sat, 1 Nov 1997 18:45:25 +0100 + +mysql (3.20.32a-1) unstable; urgency=low + + * New upstream version + + -- Scott Hanson <shanson@debian.org> Wed, 29 Oct 1997 07:11:42 +0100 + +mysql (3.20.29-2) unstable; urgency=low + + * New maintainer + * Statically link mysqld to patched glibc-2.0.5 libpthread + (works around #13586; see README.debian.glibc-2.0.5) + * Conflict with libpthread0 (fixes #13448) + * Don't link libg++, avoiding problems with glibc libpthread + + -- Scott Hanson <shanson@debian.org> Thu, 16 Oct 1997 19:25:23 +0200 + +mysql (3.20.29-1) unstable; urgency=low + + * New upstream version + * Recompiled with libc6 + * Include mysql-faq_toc.html (fixes #10885) + * Reworked /etc/init.d/mysql script (thanks to Heiko) + * Remove file /usr/lib/libmysqlclient.so.4 when package is removed. + * Use absolute path specification for conffile + * Use /usr/bin/perl instead of /bin/perl (fixes #10654) + * Do not depend on mysql (fixes #12427) + * Installed missing manpage for Mysql perl module + * Don't use debstd anymore + * Pristine source + * Set section to `non-free/devel' + * Upgraded to standards version 2.3.0.0 + + -- Christian Schwarz <schwarz@debian.org> Fri, 12 Sep 1997 02:12:58 +0200 + +mysql (3.20.16beta-2) unstable; urgency=low + + * Uses /usr/bin/perl instead of /bin/perl (fixes bug #9731) + * Don't run mysqld with --log option + * Don't install regex manual pages + * Suggest package mysql-manual + * Fixed typo in changelog + * Upgrade to policy 2.1.3.2 + + -- Christian Schwarz <schwarz@debian.org> Sun, 11 May 1997 14:19:26 +0200 + +mysql (3.20.16beta-1) unstable; urgency=low + + * Initial Release. + + -- Christian Schwarz <schwarz@debian.org> Sat, 12 Apr 1997 13:51:28 +0200 diff --git a/storage/xtradb/build/debian/compat b/storage/xtradb/build/debian/compat new file mode 100644 index 00000000000..b8626c4cff2 --- /dev/null +++ b/storage/xtradb/build/debian/compat @@ -0,0 +1 @@ +4 diff --git a/storage/xtradb/build/debian/control b/storage/xtradb/build/debian/control new file mode 100644 index 00000000000..4d229f20a2d --- /dev/null +++ b/storage/xtradb/build/debian/control @@ -0,0 +1,118 @@ +Source: percona-xtradb-dfsg-5.1 +Section: misc +Priority: optional +Maintainer: Percona SQL Development Team <mysql-dev@percona.com> +Uploaders: Aleksandr Kuzminsky <aleksandr.kuzminsky@percona.com> +Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper (>= 4.1.16), file (>= 3.28-1), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), libreadline5-dev | libreadline-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, gs, dpatch, gawk, bison, lsb-release, fakeroot +Standards-Version: 3.8.0 +Homepage: http://www.percona.com/ +Vcs-Browser: http://bazaar.launchpad.net/~percona-dev/percona-xtradb/release-1.0/files +Vcs-Bzr: bzr+ssh://bazaar.launchpad.net/~percona-dev/percona-xtradb/release-1.0/ + +Package: libpercona-xtradb-client16 +Section: libs +Architecture: any +Depends: percona-xtradb-common (>= ${source:Version}), ${shlibs:Depends} +Description: Percona SQL database client library + Percona SQL is a fast, stable and true multi-user, multi-threaded SQL database + server. SQL (Structured Query Language) is the most popular database query + language in the world. The main goals of Percona SQL are speed, robustness and + ease of use. + . + This package includes the client library. + +Package: libpercona-xtradb-client15-dev +Architecture: all +Section: libdevel +Depends: libpercona-xtradb-client-dev (>= ${source:Version}) +Description: Percona SQL database development files - empty transitional package + This is an empty package that depends on libpercona-xtradb-client-dev to ease the + transition for packages with versioned build-deps on libpercona-xtradb-client15-dev. + +Package: libpercona-xtradb-client-dev +Architecture: any +Section: libdevel +Depends: libpercona-xtradb-client16 (>= ${source:Version}), zlib1g-dev, , ${shlibs:Depends} +Conflicts: libmysqlclient14-dev, libmysqlclient12-dev, libmysqlclient10-dev, libmysqlclient15-dev, libmysqlclient16-dev +Replaces: libmysqlclient14-dev, libmysqlclient12-dev, libmysqlclient10-dev, libmysqlclient15-dev, libmysqlclient16-dev +Description: Percona SQL database development files + Percona SQL is a fast, stable and true multi-user, multi-threaded SQL database + server. SQL (Structured Query Language) is the most popular database query + language in the world. The main goals of Percona SQL are speed, robustness and + ease of use. + . + This package includes development libraries and header files. + +Package: percona-xtradb-common +Section: database +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends} +Conflicts: mysql-common-4.1, mysql-common-5.0, mysql-common-5.1, mysql-common +Provides: mysql-common +Replaces: mysql-common-4.1, mysql-common-5.0, mysql-common-5.1, mysql-common +Description: Percona SQL database common files (e.g. /etc/mysql/my.cnf) + Percona SQL is a fast, stable and true multi-user, multi-threaded SQL database + server. SQL (Structured Query Language) is the most popular database query + language in the world. The main goals of Percona SQL are speed, robustness and + ease of use. + . + This package includes files needed by all versions of the client library + (e.g. /etc/mysql/my.cnf). + +Package: percona-xtradb-client-5.1 +Architecture: any +Depends: debianutils (>=1.6), libdbi-perl, percona-xtradb-common (>= ${source:Version}), libpercona-xtradb-client16 (>= ${source:Version}), ${perl:Depends}, ${shlibs:Depends}, ${misc:Depends} +Provides: virtual-mysql-client, mysql-client, mysql-client-4.1, percona-xtradb-client, percona-xtradb-client-5.1 +Conflicts: mysql-client (<< ${source:Version}), mysql-client-5.0, mysql-client-5.1, percona-xtradb-client-5.0 +Replaces: mysql-client (<< ${source:Version}), mysql-client-5.0, mysql-client-5.1, percona-xtradb-client-5.0 +Description: Percona SQL database client binaries + Percona SQL is a fast, stable and true multi-user, multi-threaded SQL database + server. SQL (Structured Query Language) is the most popular database query + language in the world. The main goals of Percona SQL are speed, robustness and + ease of use. + . + This package includes the client binaries and the additional tools + innotop and mysqlreport. + +Package: percona-xtradb-server-5.1 +Architecture: any +Suggests: tinyca +Recommends: mailx, libhtml-template-perl +Pre-Depends: percona-xtradb-common (>= ${source:Version}), adduser (>= 3.40), debconf +Depends: percona-xtradb-client-5.1 (>= ${source:Version}), libdbi-perl, perl (>= 5.6), ${shlibs:Depends}, ${misc:Depends}, psmisc, passwd, lsb-base (>= 3.0-10) +Conflicts: mysql-server (<< ${source:Version}), mysql-server-4.1, percona-xtradb-server-5.0 +Provides: mysql-server, virtual-mysql-server, mysql-server-5.0, percona-xtradb-server-5.1 +Replaces: mysql-server (<< ${source:Version}), mysql-server-5.0, percona-xtradb-server-5.0 +Description: Percona SQL database server binaries + Percona SQL is a fast, stable and true multi-user, multi-threaded SQL database + server. SQL (Structured Query Language) is the most popular database query + language in the world. The main goals of Percona SQL are speed, robustness and + ease of use. + . + This package includes the server binaries. + +Package: percona-xtradb-server +Section: database +Architecture: all +Depends: percona-xtradb-server-5.1 +Description: Percona SQL database server (metapackage depending on the latest version) + This is an empty package that depends on the current "best" version of + percona-xtradb-server (currently percona-xtradb-server-5.1), as determined by the Percona SQL + maintainers. Install this package if in doubt about which Percona SQL + version you need. That will install the version recommended by the + package maintainers. + . + Percona SQL is a fast, stable and true multi-user, multi-threaded SQL database + server. SQL (Structured Query Language) is the most popular database query + language in the world. The main goals of Percona SQL are speed, robustness and + ease of use. + +Package: percona-xtradb-client +Section: database +Architecture: all +Depends: percona-xtradb-client-5.1 +Description: Percona SQL database client (metapackage depending on the latest version) + This is an empty package that depends on the current "best" version of + percona-xtradb-client (currently percona-xtradb-client-5.1), as determined by the Percona SQL + maintainers. Install this package if in doubt about which Percona SQL version + you want, as this is the one we consider to be in the best shape. diff --git a/storage/xtradb/build/debian/copyright b/storage/xtradb/build/debian/copyright new file mode 100644 index 00000000000..47fab54fc59 --- /dev/null +++ b/storage/xtradb/build/debian/copyright @@ -0,0 +1,169 @@ + +== MySQL == + +The Debian package of MySQL was first debianzed on 1997-04-12 by Christian +Schwarz <schwarz@debian.org> and ist maintained since 1999-04-20 by +Christian Hammers <ch@debian.org>. + +It can be downloaded from http://www.mysql.com/ + +Copyright: + +According to the file "COPYING" all parts of this package are licenced +under the terms of the GNU GPL Version 2 of which a copy is available +in /usr/share/common-licenses. + +To allow free software with other licences than the GPL to link against the +shared library, special terms for "derived works" are defined in the file +"EXCEPTIONS-CLIENT" which is quoted below. + +More information can be found on http://www.mysql.com/company/legal/licensing/ + +The manual had to be removed as it is not free in the sense of the +Debian Free Software Guidelines (DFSG). + +> Appendix I MySQL FLOSS License Exception +> **************************************** +> +> Version 0.3, 10 February 2005 +> +> The MySQL AB Exception for Free/Libre and Open Source Software-only +> Applications Using MySQL Client Libraries (the "FLOSS Exception"). +> +> Exception Intent +> ================ +> +> We want specified Free/Libre and Open Source Software ("FLOSS") +> applications to be able to use specified GPL-licensed MySQL client +> libraries (the "Program") despite the fact that not all FLOSS licenses +> are compatible with version 2 of the GNU General Public License (the +> "GPL"). +> +> Legal Terms and Conditions +> ========================== +> +> As a special exception to the terms and conditions of version 2.0 of the +> GPL: +> +> 1. You are free to distribute a Derivative Work that is formed +> entirely from the Program and one or more works (each, a "FLOSS +> Work") licensed under one or more of the licenses listed below in +> section 1, as long as: +> +> a. You obey the GPL in all respects for the Program and the +> Derivative Work, except for identifiable sections of the +> Derivative Work which are not derived from the Program, and +> which can reasonably be considered independent and separate +> works in themselves, +> +> b. all identifiable sections of the Derivative Work which are not +> derived from the Program, and which can reasonably be +> considered independent and separate works in themselves, +> +> i +> are distributed subject to one of the FLOSS licenses +> listed below, and +> +> ii +> the object code or executable form of those sections are +> accompanied by the complete corresponding +> machine-readable source code for those sections on the +> same medium and under the same FLOSS license as the +> corresponding object code or executable forms of those +> sections, and +> +> c. any works which are aggregated with the Program or with a +> Derivative Work on a volume of a storage or distribution +> medium in accordance with the GPL, can reasonably be +> considered independent and separate works in themselves which +> are not derivatives of either the Program, a Derivative Work +> or a FLOSS Work. +> +> If the above conditions are not met, then the Program may only be +> copied, modified, distributed or used under the terms and +> conditions of the GPL or another valid licensing option from MySQL +> AB. +> +> 2. FLOSS License List +> +> *License name* *Version(s)/Copyright Date* +> Academic Free License 2.0 +> Apache Software License 1.0/1.1/2.0 +> Apple Public Source License 2.0 +> Artistic license From Perl 5.8.0 +> BSD license "July 22 1999" +> Common Public License 1.0 +> GNU Library or "Lesser" General Public 2.0/2.1 +> License (LGPL) +> Jabber Open Source License 1.0 +> MIT license - +> Mozilla Public License (MPL) 1.0/1.1 +> Open Software License 2.0 +> OpenSSL license (with original SSLeay "2003" ("1998") +> license) +> PHP License 3.0 +> Python license (CNRI Python License) - +> Python Software Foundation License 2.1.1 +> Sleepycat License "1999" +> W3C License "2001" +> X11 License "2001" +> Zlib/libpng License - +> Zope Public License 2.0 +> +> Due to the many variants of some of the above licenses, we require +> that any version follow the 2003 version of the Free Software +> Foundation's Free Software Definition +> (`http://www.gnu.org/philosophy/free-sw.html') or version 1.9 of +> the Open Source Definition by the Open Source Initiative +> (`http://www.opensource.org/docs/definition.php'). +> +> 3. Definitions +> +> a. Terms used, but not defined, herein shall have the meaning +> provided in the GPL. +> +> b. Derivative Work means a derivative work under copyright law. +> +> 4. Applicability This FLOSS Exception applies to all Programs that +> contain a notice placed by MySQL AB saying that the Program may be +> distributed under the terms of this FLOSS Exception. If you +> create or distribute a work which is a Derivative Work of both the +> Program and any other work licensed under the GPL, then this FLOSS +> Exception is not available for that work; thus, you must remove +> the FLOSS Exception notice from that work and comply with the GPL +> in all respects, including by retaining all GPL notices. You may +> choose to redistribute a copy of the Program exclusively under the +> terms of the GPL by removing the FLOSS Exception notice from that +> copy of the Program, provided that the copy has never been +> modified by you or any third party. + + +== innotop == + +Author: Baron Schwartz <baron@xaprb.com> +URL: http://innotop.sourceforge.net + +License: +> This software is dual licensed, either GPL version 2 or Artistic License. +> +> This package is free software; you can redistribute it and/or modify +> it under the terms of the GNU General Public License as published by +> the Free Software Foundation; either version 2 of the License, or +> (at your option) any later version. +> +> This package is distributed in the hope that it will be useful, +> but WITHOUT ANY WARRANTY; without even the implied warranty of +> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +> GNU General Public License for more details. +> +> You should have received a copy of the GNU General Public License +> along with this package; if not, write to the Free Software +> Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General Public License and the +Artistic License can be found in `/usr/share/common-licenses/'. + +The upstream author explained here: http://bugs.gentoo.org/show_bug.cgi?id=14760 +that these licenses also apply to the following files: +- innotop.html +- InnoDBParser.pm diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.README.Maintainer b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.README.Maintainer new file mode 100644 index 00000000000..f24cdcd519d --- /dev/null +++ b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.README.Maintainer @@ -0,0 +1,4 @@ +The examples directory includes files that might be needed by some +developers: +- header files not installed by default +- the example file udf_example.c diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.dirs b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.dirs new file mode 100644 index 00000000000..f6ad2870431 --- /dev/null +++ b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.dirs @@ -0,0 +1,2 @@ +usr/include/ +usr/lib/ diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.docs b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.docs new file mode 100644 index 00000000000..eccf2c9c565 --- /dev/null +++ b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.docs @@ -0,0 +1 @@ +EXCEPTIONS-CLIENT diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.examples b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.examples new file mode 100644 index 00000000000..f1649c311c4 --- /dev/null +++ b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.examples @@ -0,0 +1 @@ +sql/udf_example.c diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.files b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.files new file mode 100644 index 00000000000..6803365b5ea --- /dev/null +++ b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.files @@ -0,0 +1,7 @@ +usr/bin/mysql_config +usr/include/mysql/*.h +usr/lib/libmysqlclient.a +usr/lib/libmysqlclient.la +usr/lib/mysql/*.a +usr/lib/mysql/*.la +usr/share/man/man1/mysql_config.1 diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client-dev.links b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.links new file mode 100644 index 00000000000..0481d1a0020 --- /dev/null +++ b/storage/xtradb/build/debian/libpercona-xtradb-client-dev.links @@ -0,0 +1,2 @@ +usr/lib/libmysqlclient.so.16 usr/lib/libmysqlclient.so +usr/lib/libmysqlclient_r.so.16 usr/lib/libmysqlclient_r.so diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client16.dirs b/storage/xtradb/build/debian/libpercona-xtradb-client16.dirs new file mode 100644 index 00000000000..2964de6141b --- /dev/null +++ b/storage/xtradb/build/debian/libpercona-xtradb-client16.dirs @@ -0,0 +1 @@ +usr/lib/ diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client16.docs b/storage/xtradb/build/debian/libpercona-xtradb-client16.docs new file mode 100644 index 00000000000..eccf2c9c565 --- /dev/null +++ b/storage/xtradb/build/debian/libpercona-xtradb-client16.docs @@ -0,0 +1 @@ +EXCEPTIONS-CLIENT diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client16.files b/storage/xtradb/build/debian/libpercona-xtradb-client16.files new file mode 100644 index 00000000000..5162b7b9639 --- /dev/null +++ b/storage/xtradb/build/debian/libpercona-xtradb-client16.files @@ -0,0 +1 @@ +usr/lib/libmysqlclient*.so.* diff --git a/storage/xtradb/build/debian/libpercona-xtradb-client16.postinst b/storage/xtradb/build/debian/libpercona-xtradb-client16.postinst new file mode 100644 index 00000000000..29d3b86f978 --- /dev/null +++ b/storage/xtradb/build/debian/libpercona-xtradb-client16.postinst @@ -0,0 +1,12 @@ +#!/bin/bash -e + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + +# vim: ts=4 + + diff --git a/storage/xtradb/build/debian/patches/00list b/storage/xtradb/build/debian/patches/00list new file mode 100644 index 00000000000..5c50ab1ba53 --- /dev/null +++ b/storage/xtradb/build/debian/patches/00list @@ -0,0 +1,6 @@ +33_scripts__mysql_create_system_tables__no_test.dpatch +38_scripts__mysqld_safe.sh__signals.dpatch +41_scripts__mysql_install_db.sh__no_test.dpatch +44_scripts__mysql_config__libs.dpatch +50_mysql-test__db_test.dpatch +60_percona_support.dpatch diff --git a/storage/xtradb/build/debian/patches/01_MAKEFILES__Docs_Images_Makefile.in.dpatch b/storage/xtradb/build/debian/patches/01_MAKEFILES__Docs_Images_Makefile.in.dpatch new file mode 100644 index 00000000000..ca138afa746 --- /dev/null +++ b/storage/xtradb/build/debian/patches/01_MAKEFILES__Docs_Images_Makefile.in.dpatch @@ -0,0 +1,776 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01_MAKEFILES__Docs_Makefile.in.dpatch by <ch@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Creates Docs/Makefile.in + +@DPATCH@ + +--- old/Docs/Images/Makefile.in 2005-03-01 02:08:01.877429040 +0100 ++++ new/Docs/Images/Makefile.in 2005-02-28 21:21:24.000000000 +0100 +@@ -0,0 +1,765 @@ ++# Makefile.in generated by automake 1.7.9 from Makefile.am. ++# @configure_input@ ++ ++# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 ++# Free Software Foundation, Inc. ++# This Makefile.in is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without ++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A ++# PARTICULAR PURPOSE. ++ ++@SET_MAKE@ ++ ++# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ ++# Process this file with automake to create Makefile.in ++ ++srcdir = @srcdir@ ++top_srcdir = @top_srcdir@ ++VPATH = @srcdir@ ++pkgdatadir = $(datadir)/@PACKAGE@ ++pkglibdir = $(libdir)/@PACKAGE@ ++pkgincludedir = $(includedir)/@PACKAGE@ ++top_builddir = . ++ ++am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd ++INSTALL = @INSTALL@ ++install_sh_DATA = $(install_sh) -c -m 644 ++install_sh_PROGRAM = $(install_sh) -c ++install_sh_SCRIPT = $(install_sh) -c ++INSTALL_HEADER = $(INSTALL_DATA) ++transform = $(program_transform_name) ++NORMAL_INSTALL = : ++PRE_INSTALL = : ++POST_INSTALL = : ++NORMAL_UNINSTALL = : ++PRE_UNINSTALL = : ++POST_UNINSTALL = : ++build_triplet = @build@ ++host_triplet = @host@ ++target_triplet = @target@ ++ACLOCAL = @ACLOCAL@ ++ALLOCA = @ALLOCA@ ++AMDEP_FALSE = @AMDEP_FALSE@ ++AMDEP_TRUE = @AMDEP_TRUE@ ++AMTAR = @AMTAR@ ++AR = @AR@ ++AS = @AS@ ++ASSEMBLER_FALSE = @ASSEMBLER_FALSE@ ++ASSEMBLER_TRUE = @ASSEMBLER_TRUE@ ++ASSEMBLER_sparc32_FALSE = @ASSEMBLER_sparc32_FALSE@ ++ASSEMBLER_sparc32_TRUE = @ASSEMBLER_sparc32_TRUE@ ++ASSEMBLER_sparc64_FALSE = @ASSEMBLER_sparc64_FALSE@ ++ASSEMBLER_sparc64_TRUE = @ASSEMBLER_sparc64_TRUE@ ++ASSEMBLER_x86_FALSE = @ASSEMBLER_x86_FALSE@ ++ASSEMBLER_x86_TRUE = @ASSEMBLER_x86_TRUE@ ++AUTOCONF = @AUTOCONF@ ++AUTOHEADER = @AUTOHEADER@ ++AUTOMAKE = @AUTOMAKE@ ++AVAILABLE_LANGUAGES = @AVAILABLE_LANGUAGES@ ++AVAILABLE_LANGUAGES_ERRORS = @AVAILABLE_LANGUAGES_ERRORS@ ++AWK = @AWK@ ++CC = @CC@ ++CCAS = @CCAS@ ++CCASFLAGS = @CCASFLAGS@ ++CCDEPMODE = @CCDEPMODE@ ++CC_VERSION = @CC_VERSION@ ++CFLAGS = @CFLAGS@ ++CHARSETS_NEED_SOURCE = @CHARSETS_NEED_SOURCE@ ++CHARSET_OBJS = @CHARSET_OBJS@ ++CHARSET_SRCS = @CHARSET_SRCS@ ++CHECK_PID = @CHECK_PID@ ++CHMOD = @CHMOD@ ++CLIENT_EXTRA_LDFLAGS = @CLIENT_EXTRA_LDFLAGS@ ++CLIENT_LIBS = @CLIENT_LIBS@ ++CMP = @CMP@ ++COMPILATION_COMMENT = @COMPILATION_COMMENT@ ++COMPILE_PSTACK_FALSE = @COMPILE_PSTACK_FALSE@ ++COMPILE_PSTACK_TRUE = @COMPILE_PSTACK_TRUE@ ++CONF_COMMAND = @CONF_COMMAND@ ++CP = @CP@ ++CPP = @CPP@ ++CPPFLAGS = @CPPFLAGS@ ++CXX = @CXX@ ++CXXCPP = @CXXCPP@ ++CXXDEPMODE = @CXXDEPMODE@ ++CXXFLAGS = @CXXFLAGS@ ++CXXLDFLAGS = @CXXLDFLAGS@ ++CXX_VERSION = @CXX_VERSION@ ++CYGPATH_W = @CYGPATH_W@ ++DEFS = @DEFS@ ++DEPDIR = @DEPDIR@ ++DOT_FRM_VERSION = @DOT_FRM_VERSION@ ++DVIS = @DVIS@ ++ECHO = @ECHO@ ++ECHO_C = @ECHO_C@ ++ECHO_N = @ECHO_N@ ++ECHO_T = @ECHO_T@ ++EGREP = @EGREP@ ++EXEEXT = @EXEEXT@ ++F77 = @F77@ ++FFLAGS = @FFLAGS@ ++FIND_PROC = @FIND_PROC@ ++GETCONF = @GETCONF@ ++GXX = @GXX@ ++HAVE_NETWARE_FALSE = @HAVE_NETWARE_FALSE@ ++HAVE_NETWARE_TRUE = @HAVE_NETWARE_TRUE@ ++HOSTNAME = @HOSTNAME@ ++INSTALL_DATA = @INSTALL_DATA@ ++INSTALL_PROGRAM = @INSTALL_PROGRAM@ ++INSTALL_SCRIPT = @INSTALL_SCRIPT@ ++INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ ++IS_LINUX = @IS_LINUX@ ++KILL = @KILL@ ++LD = @LD@ ++LDFLAGS = @LDFLAGS@ ++LIBDL = @LIBDL@ ++LIBOBJS = @LIBOBJS@ ++LIBS = @LIBS@ ++LIBTOOL = @LIBTOOL@ ++LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@ ++LM_CFLAGS = @LM_CFLAGS@ ++LN = @LN@ ++LN_CP_F = @LN_CP_F@ ++LN_S = @LN_S@ ++LOCAL_FALSE = @LOCAL_FALSE@ ++LOCAL_TRUE = @LOCAL_TRUE@ ++LTLIBOBJS = @LTLIBOBJS@ ++MACHINE_TYPE = @MACHINE_TYPE@ ++MAINT = @MAINT@ ++MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ ++MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ ++MAKEINFO = @MAKEINFO@ ++MAKE_BINARY_DISTRIBUTION_OPTIONS = @MAKE_BINARY_DISTRIBUTION_OPTIONS@ ++MAKE_SHELL = @MAKE_SHELL@ ++MT_INCLUDES = @MT_INCLUDES@ ++MT_LD_ADD = @MT_LD_ADD@ ++MV = @MV@ ++MYSQLD_DEFAULT_SWITCHES = @MYSQLD_DEFAULT_SWITCHES@ ++MYSQLD_EXTRA_LDFLAGS = @MYSQLD_EXTRA_LDFLAGS@ ++MYSQLD_USER = @MYSQLD_USER@ ++MYSQL_BASE_VERSION = @MYSQL_BASE_VERSION@ ++MYSQL_NO_DASH_VERSION = @MYSQL_NO_DASH_VERSION@ ++MYSQL_SERVER_SUFFIX = @MYSQL_SERVER_SUFFIX@ ++MYSQL_TCP_PORT = @MYSQL_TCP_PORT@ ++MYSQL_TCP_PORT_DEFAULT = @MYSQL_TCP_PORT_DEFAULT@ ++MYSQL_UNIX_ADDR = @MYSQL_UNIX_ADDR@ ++MYSQL_VERSION_ID = @MYSQL_VERSION_ID@ ++NOINST_LDFLAGS = @NOINST_LDFLAGS@ ++OBJEXT = @OBJEXT@ ++PACKAGE = @PACKAGE@ ++PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ ++PACKAGE_NAME = @PACKAGE_NAME@ ++PACKAGE_STRING = @PACKAGE_STRING@ ++PACKAGE_TARNAME = @PACKAGE_TARNAME@ ++PACKAGE_VERSION = @PACKAGE_VERSION@ ++PATH_SEPARATOR = @PATH_SEPARATOR@ ++PDFMANUAL = @PDFMANUAL@ ++PERL = @PERL@ ++PERL5 = @PERL5@ ++PROTOCOL_VERSION = @PROTOCOL_VERSION@ ++PS = @PS@ ++RANLIB = @RANLIB@ ++RM = @RM@ ++SAVE_ASFLAGS = @SAVE_ASFLAGS@ ++SAVE_CFLAGS = @SAVE_CFLAGS@ ++SAVE_CXXFLAGS = @SAVE_CXXFLAGS@ ++SAVE_CXXLDFLAGS = @SAVE_CXXLDFLAGS@ ++SAVE_LDFLAGS = @SAVE_LDFLAGS@ ++SED = @SED@ ++SET_MAKE = @SET_MAKE@ ++SHARED_LIB_VERSION = @SHARED_LIB_VERSION@ ++SHELL = @SHELL@ ++STRIP = @STRIP@ ++SYSTEM_TYPE = @SYSTEM_TYPE@ ++TAR = @TAR@ ++TERMCAP_LIB = @TERMCAP_LIB@ ++THREAD_LOBJECTS = @THREAD_LOBJECTS@ ++THREAD_LPROGRAMS = @THREAD_LPROGRAMS@ ++VERSION = @VERSION@ ++WRAPLIBS = @WRAPLIBS@ ++YACC = @YACC@ ++ac_ct_AR = @ac_ct_AR@ ++ac_ct_CC = @ac_ct_CC@ ++ac_ct_CXX = @ac_ct_CXX@ ++ac_ct_F77 = @ac_ct_F77@ ++ac_ct_GETCONF = @ac_ct_GETCONF@ ++ac_ct_RANLIB = @ac_ct_RANLIB@ ++ac_ct_STRIP = @ac_ct_STRIP@ ++am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ ++am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ ++am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ ++am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ ++am__include = @am__include@ ++am__leading_dot = @am__leading_dot@ ++am__quote = @am__quote@ ++bdb_includes = @bdb_includes@ ++bdb_libs = @bdb_libs@ ++bdb_libs_with_path = @bdb_libs_with_path@ ++bench_dirs = @bench_dirs@ ++bindir = @bindir@ ++build = @build@ ++build_alias = @build_alias@ ++build_cpu = @build_cpu@ ++build_os = @build_os@ ++build_vendor = @build_vendor@ ++datadir = @datadir@ ++default_charset = @default_charset@ ++docs_dirs = @docs_dirs@ ++exec_prefix = @exec_prefix@ ++host = @host@ ++host_alias = @host_alias@ ++host_cpu = @host_cpu@ ++host_os = @host_os@ ++host_vendor = @host_vendor@ ++includedir = @includedir@ ++infodir = @infodir@ ++innodb_includes = @innodb_includes@ ++innodb_libs = @innodb_libs@ ++innodb_system_libs = @innodb_system_libs@ ++install_sh = @install_sh@ ++isam_libs = @isam_libs@ ++libdir = @libdir@ ++libexecdir = @libexecdir@ ++libmysqld_dirs = @libmysqld_dirs@ ++linked_client_targets = @linked_client_targets@ ++linked_netware_sources = @linked_netware_sources@ ++localstatedir = @localstatedir@ ++man_dirs = @man_dirs@ ++mandir = @mandir@ ++netware_dir = @netware_dir@ ++oldincludedir = @oldincludedir@ ++openssl_includes = @openssl_includes@ ++openssl_libs = @openssl_libs@ ++orbit_idl = @orbit_idl@ ++orbit_includes = @orbit_includes@ ++orbit_libs = @orbit_libs@ ++prefix = @prefix@ ++program_transform_name = @program_transform_name@ ++pstack_dirs = @pstack_dirs@ ++pstack_libs = @pstack_libs@ ++readline_dir = @readline_dir@ ++readline_link = @readline_link@ ++sbindir = @sbindir@ ++server_scripts = @server_scripts@ ++sharedstatedir = @sharedstatedir@ ++sql_client_dirs = @sql_client_dirs@ ++sql_server_dirs = @sql_server_dirs@ ++sysconfdir = @sysconfdir@ ++target = @target@ ++target_alias = @target_alias@ ++target_cpu = @target_cpu@ ++target_os = @target_os@ ++target_vendor = @target_vendor@ ++thread_dirs = @thread_dirs@ ++tools_dirs = @tools_dirs@ ++uname_prog = @uname_prog@ ++vio_dir = @vio_dir@ ++vio_libs = @vio_libs@ ++ ++AUTOMAKE_OPTIONS = foreign ++ ++# These are built from source in the Docs directory ++EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT ++SUBDIRS = . include @docs_dirs@ @readline_dir@ \ ++ @thread_dirs@ pstack @sql_client_dirs@ \ ++ @sql_server_dirs@ scripts @man_dirs@ tests \ ++ BUILD netware os2 @libmysqld_dirs@ \ ++ @bench_dirs@ support-files @tools_dirs@ ++ ++ ++# Relink after clean ++linked_sources = linked_client_sources linked_server_sources \ ++ linked_libmysql_sources linked_libmysql_r_sources \ ++ linked_libmysqld_sources linked_libmysqldex_sources \ ++ linked_include_sources @linked_netware_sources@ ++ ++ ++CLEANFILES = $(linked_sources) ++subdir = . ++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = config.h ++CONFIG_CLEAN_FILES = bdb/Makefile ++DIST_SOURCES = ++ ++RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ ++ ps-recursive install-info-recursive uninstall-info-recursive \ ++ all-recursive install-data-recursive install-exec-recursive \ ++ installdirs-recursive install-recursive uninstall-recursive \ ++ check-recursive installcheck-recursive ++DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure COPYING \ ++ ChangeLog Makefile.am acconfig.h acinclude.m4 aclocal.m4 \ ++ config.guess config.h.in config.sub configure configure.in \ ++ depcomp install-sh ltconfig ltmain.sh missing mkinstalldirs ++DIST_SUBDIRS = $(SUBDIRS) ++all: config.h ++ $(MAKE) $(AM_MAKEFLAGS) all-recursive ++ ++.SUFFIXES: ++ ++am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ ++ configure.lineno ++$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ++ cd $(top_srcdir) && \ ++ $(AUTOMAKE) --foreign Makefile ++Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status ++ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) ++ ++$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) ++ $(SHELL) ./config.status --recheck ++$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) ++ cd $(srcdir) && $(AUTOCONF) ++ ++$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4 ++ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) ++ ++stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status ++ @rm -f stamp-h1 ++ cd $(top_builddir) && $(SHELL) ./config.status config.h ++ ++$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h ++ cd $(top_srcdir) && $(AUTOHEADER) ++ touch $(srcdir)/config.h.in ++ ++distclean-hdr: ++ -rm -f config.h stamp-h1 ++bdb/Makefile: $(top_builddir)/config.status $(top_srcdir)/bdb/Makefile.in ++ cd $(top_builddir) && $(SHELL) ./config.status $@ ++ ++mostlyclean-libtool: ++ -rm -f *.lo ++ ++clean-libtool: ++ -rm -rf .libs _libs ++ ++distclean-libtool: ++ -rm -f libtool ++uninstall-info-am: ++ ++# This directory's subdirectories are mostly independent; you can cd ++# into them and run `make' without going through this Makefile. ++# To change the values of `make' variables: instead of editing Makefiles, ++# (1) if the variable is set in `config.status', edit `config.status' ++# (which will cause the Makefiles to be regenerated when you run `make'); ++# (2) otherwise, pass the desired values on the `make' command line. ++$(RECURSIVE_TARGETS): ++ @set fnord $$MAKEFLAGS; amf=$$2; \ ++ dot_seen=no; \ ++ target=`echo $@ | sed s/-recursive//`; \ ++ list='$(SUBDIRS)'; for subdir in $$list; do \ ++ echo "Making $$target in $$subdir"; \ ++ if test "$$subdir" = "."; then \ ++ dot_seen=yes; \ ++ local_target="$$target-am"; \ ++ else \ ++ local_target="$$target"; \ ++ fi; \ ++ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ ++ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ ++ done; \ ++ if test "$$dot_seen" = "no"; then \ ++ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ ++ fi; test -z "$$fail" ++ ++mostlyclean-recursive clean-recursive distclean-recursive \ ++maintainer-clean-recursive: ++ @set fnord $$MAKEFLAGS; amf=$$2; \ ++ dot_seen=no; \ ++ case "$@" in \ ++ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ ++ *) list='$(SUBDIRS)' ;; \ ++ esac; \ ++ rev=''; for subdir in $$list; do \ ++ if test "$$subdir" = "."; then :; else \ ++ rev="$$subdir $$rev"; \ ++ fi; \ ++ done; \ ++ rev="$$rev ."; \ ++ target=`echo $@ | sed s/-recursive//`; \ ++ for subdir in $$rev; do \ ++ echo "Making $$target in $$subdir"; \ ++ if test "$$subdir" = "."; then \ ++ local_target="$$target-am"; \ ++ else \ ++ local_target="$$target"; \ ++ fi; \ ++ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ ++ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ ++ done && test -z "$$fail" ++tags-recursive: ++ list='$(SUBDIRS)'; for subdir in $$list; do \ ++ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ ++ done ++ctags-recursive: ++ list='$(SUBDIRS)'; for subdir in $$list; do \ ++ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ ++ done ++ ++ETAGS = etags ++ETAGSFLAGS = ++ ++CTAGS = ctags ++CTAGSFLAGS = ++ ++ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) ++ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ ++ unique=`for i in $$list; do \ ++ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ ++ done | \ ++ $(AWK) ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ mkid -fID $$unique ++ ++TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ ++ $(TAGS_FILES) $(LISP) ++ tags=; \ ++ here=`pwd`; \ ++ if (etags --etags-include --version) >/dev/null 2>&1; then \ ++ include_option=--etags-include; \ ++ else \ ++ include_option=--include; \ ++ fi; \ ++ list='$(SUBDIRS)'; for subdir in $$list; do \ ++ if test "$$subdir" = .; then :; else \ ++ test -f $$subdir/TAGS && \ ++ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ ++ fi; \ ++ done; \ ++ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ ++ unique=`for i in $$list; do \ ++ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ ++ done | \ ++ $(AWK) ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ test -z "$(ETAGS_ARGS)$$tags$$unique" \ ++ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ ++ $$tags $$unique ++ ++ctags: CTAGS ++CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ ++ $(TAGS_FILES) $(LISP) ++ tags=; \ ++ here=`pwd`; \ ++ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ ++ unique=`for i in $$list; do \ ++ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ ++ done | \ ++ $(AWK) ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ test -z "$(CTAGS_ARGS)$$tags$$unique" \ ++ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ ++ $$tags $$unique ++ ++GTAGS: ++ here=`$(am__cd) $(top_builddir) && pwd` \ ++ && cd $(top_srcdir) \ ++ && gtags -i $(GTAGS_ARGS) $$here ++ ++distclean-tags: ++ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags ++DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ++ ++top_distdir = . ++distdir = $(PACKAGE)-$(VERSION) ++ ++am__remove_distdir = \ ++ { test ! -d $(distdir) \ ++ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ ++ && rm -fr $(distdir); }; } ++ ++GZIP_ENV = --best ++distuninstallcheck_listfiles = find . -type f -print ++distcleancheck_listfiles = find . -type f -print ++ ++distdir: $(DISTFILES) ++ $(am__remove_distdir) ++ mkdir $(distdir) ++ $(mkinstalldirs) $(distdir)/bdb $(distdir)/include ++ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ ++ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ ++ list='$(DISTFILES)'; for file in $$list; do \ ++ case $$file in \ ++ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ ++ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ ++ esac; \ ++ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ ++ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ ++ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ ++ dir="/$$dir"; \ ++ $(mkinstalldirs) "$(distdir)$$dir"; \ ++ else \ ++ dir=''; \ ++ fi; \ ++ if test -d $$d/$$file; then \ ++ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ ++ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ ++ fi; \ ++ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ ++ else \ ++ test -f $(distdir)/$$file \ ++ || cp -p $$d/$$file $(distdir)/$$file \ ++ || exit 1; \ ++ fi; \ ++ done ++ list='$(SUBDIRS)'; for subdir in $$list; do \ ++ if test "$$subdir" = .; then :; else \ ++ test -d $(distdir)/$$subdir \ ++ || mkdir $(distdir)/$$subdir \ ++ || exit 1; \ ++ (cd $$subdir && \ ++ $(MAKE) $(AM_MAKEFLAGS) \ ++ top_distdir="$(top_distdir)" \ ++ distdir=../$(distdir)/$$subdir \ ++ distdir) \ ++ || exit 1; \ ++ fi; \ ++ done ++ $(MAKE) $(AM_MAKEFLAGS) \ ++ top_distdir="$(top_distdir)" distdir="$(distdir)" \ ++ dist-hook ++ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ++ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ++ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ++ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ ++ || chmod -R a+r $(distdir) ++dist-gzip: distdir ++ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz ++ $(am__remove_distdir) ++ ++dist dist-all: distdir ++ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz ++ $(am__remove_distdir) ++ ++# This target untars the dist file and tries a VPATH configuration. Then ++# it guarantees that the distribution is self-contained by making another ++# tarfile. ++distcheck: dist ++ $(am__remove_distdir) ++ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ++ chmod -R a-w $(distdir); chmod a+w $(distdir) ++ mkdir $(distdir)/_build ++ mkdir $(distdir)/_inst ++ chmod a-w $(distdir) ++ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ ++ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ ++ && cd $(distdir)/_build \ ++ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ ++ $(DISTCHECK_CONFIGURE_FLAGS) \ ++ && $(MAKE) $(AM_MAKEFLAGS) \ ++ && $(MAKE) $(AM_MAKEFLAGS) dvi \ ++ && $(MAKE) $(AM_MAKEFLAGS) check \ ++ && $(MAKE) $(AM_MAKEFLAGS) install \ ++ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ ++ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ ++ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ ++ distuninstallcheck \ ++ && chmod -R a-w "$$dc_install_base" \ ++ && ({ \ ++ (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ ++ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ ++ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ ++ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ ++ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ ++ } || { rm -rf "$$dc_destdir"; exit 1; }) \ ++ && rm -rf "$$dc_destdir" \ ++ && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ ++ && rm -f $(distdir).tar.gz \ ++ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck ++ $(am__remove_distdir) ++ @echo "$(distdir).tar.gz is ready for distribution" | \ ++ sed 'h;s/./=/g;p;x;p;x' ++distuninstallcheck: ++ @cd $(distuninstallcheck_dir) \ ++ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ ++ || { echo "ERROR: files left after uninstall:" ; \ ++ if test -n "$(DESTDIR)"; then \ ++ echo " (check DESTDIR support)"; \ ++ fi ; \ ++ $(distuninstallcheck_listfiles) ; \ ++ exit 1; } >&2 ++distcleancheck: distclean ++ @if test '$(srcdir)' = . ; then \ ++ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ ++ exit 1 ; \ ++ fi ++ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ ++ || { echo "ERROR: files left in build directory after distclean:" ; \ ++ $(distcleancheck_listfiles) ; \ ++ exit 1; } >&2 ++check-am: all-am ++check: check-recursive ++all-am: Makefile config.h ++installdirs: installdirs-recursive ++installdirs-am: ++ ++install: install-recursive ++install-exec: install-exec-recursive ++install-data: install-data-recursive ++uninstall: uninstall-recursive ++ ++install-am: all-am ++ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am ++ ++installcheck: installcheck-recursive ++install-strip: ++ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ ++ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ ++ `test -z '$(STRIP)' || \ ++ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install ++mostlyclean-generic: ++ ++clean-generic: ++ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) ++ ++distclean-generic: ++ -rm -f $(CONFIG_CLEAN_FILES) ++ ++maintainer-clean-generic: ++ @echo "This command is intended for maintainers to use" ++ @echo "it deletes files that may require special tools to rebuild." ++clean: clean-recursive ++ ++clean-am: clean-generic clean-libtool mostlyclean-am ++ ++distclean: distclean-recursive ++ -rm -f $(am__CONFIG_DISTCLEAN_FILES) ++ -rm -f Makefile ++distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \ ++ distclean-tags ++ ++dvi: dvi-recursive ++ ++dvi-am: ++ ++info: info-recursive ++ ++info-am: ++ ++install-data-am: ++ ++install-exec-am: ++ ++install-info: install-info-recursive ++ ++install-man: ++ ++installcheck-am: ++ ++maintainer-clean: maintainer-clean-recursive ++ -rm -f $(am__CONFIG_DISTCLEAN_FILES) ++ -rm -rf $(top_srcdir)/autom4te.cache ++ -rm -f Makefile ++maintainer-clean-am: distclean-am maintainer-clean-generic ++ ++mostlyclean: mostlyclean-recursive ++ ++mostlyclean-am: mostlyclean-generic mostlyclean-libtool ++ ++pdf: pdf-recursive ++ ++pdf-am: ++ ++ps: ps-recursive ++ ++ps-am: ++ ++uninstall-am: uninstall-info-am ++ ++uninstall-info: uninstall-info-recursive ++ ++.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ ++ clean-generic clean-libtool clean-recursive ctags \ ++ ctags-recursive dist dist-all dist-gzip distcheck distclean \ ++ distclean-generic distclean-hdr distclean-libtool \ ++ distclean-recursive distclean-tags distcleancheck distdir \ ++ distuninstallcheck dvi dvi-am dvi-recursive info info-am \ ++ info-recursive install install-am install-data install-data-am \ ++ install-data-recursive install-exec install-exec-am \ ++ install-exec-recursive install-info install-info-am \ ++ install-info-recursive install-man install-recursive \ ++ install-strip installcheck installcheck-am installdirs \ ++ installdirs-am installdirs-recursive maintainer-clean \ ++ maintainer-clean-generic maintainer-clean-recursive mostlyclean \ ++ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ ++ pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ ++ tags-recursive uninstall uninstall-am uninstall-info-am \ ++ uninstall-info-recursive uninstall-recursive ++ ++ ++# This is just so that the linking is done early. ++config.h: $(linked_sources) ++ ++linked_include_sources: ++ cd include; $(MAKE) link_sources ++ echo timestamp > linked_include_sources ++ ++linked_client_sources: @linked_client_targets@ ++ cd client; $(MAKE) link_sources ++ echo timestamp > linked_client_sources ++ ++linked_libmysql_sources: ++ cd libmysql; $(MAKE) link_sources ++ echo timestamp > linked_libmysql_sources ++ ++linked_libmysql_r_sources: linked_libmysql_sources ++ cd libmysql_r; $(MAKE) link_sources ++ echo timestamp > linked_libmysql_r_sources ++ ++linked_libmysqld_sources: ++ cd libmysqld; $(MAKE) link_sources ++ echo timestamp > linked_libmysqld_sources ++ ++linked_libmysqldex_sources: ++ cd libmysqld/examples; $(MAKE) link_sources ++ echo timestamp > linked_libmysqldex_sources ++ ++linked_netware_sources: ++ cd @netware_dir@; $(MAKE) link_sources ++ echo timestamp > linked_netware_sources ++ ++#avoid recursive make calls in sql directory ++linked_server_sources: ++ cd sql; rm -f mini_client_errors.c;@LN_CP_F@ ../libmysql/errmsg.c mini_client_errors.c ++ echo timestamp > linked_server_sources ++ ++# Create permission databases ++init-db: all ++ $(top_builddir)/scripts/mysql_install_db ++ ++bin-dist: all ++ $(top_builddir)/scripts/make_binary_distribution @MAKE_BINARY_DISTRIBUTION_OPTIONS@ ++ ++# Remove BK's "SCCS" subdirectories from source distribution ++dist-hook: ++ rm -rf `find $(distdir) -type d -name SCCS` ++ ++tags: ++ support-files/build-tags ++.PHONY: init-db bin-dist ++ ++# Test installation ++ ++test: ++ cd mysql-test ; ./mysql-test-run ++# Tell versions [3.59,3.63) of GNU make to not export all variables. ++# Otherwise a system limit (for SysV at least) may be exceeded. ++.NOEXPORT: diff --git a/storage/xtradb/build/debian/patches/01_MAKEFILES__Docs_Makefile.in.dpatch b/storage/xtradb/build/debian/patches/01_MAKEFILES__Docs_Makefile.in.dpatch new file mode 100644 index 00000000000..6440697bc02 --- /dev/null +++ b/storage/xtradb/build/debian/patches/01_MAKEFILES__Docs_Makefile.in.dpatch @@ -0,0 +1,776 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 01_MAKEFILES__Docs_Makefile.in.dpatch by <ch@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Creates Docs/Makefile.in + +@DPATCH@ + +--- old/Docs/Makefile.in 2005-03-01 02:08:01.877429040 +0100 ++++ new/Docs/Makefile.in 2005-02-28 21:21:24.000000000 +0100 +@@ -0,0 +1,765 @@ ++# Makefile.in generated by automake 1.7.9 from Makefile.am. ++# @configure_input@ ++ ++# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 ++# Free Software Foundation, Inc. ++# This Makefile.in is free software; the Free Software Foundation ++# gives unlimited permission to copy and/or distribute it, ++# with or without modifications, as long as this notice is preserved. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY, to the extent permitted by law; without ++# even the implied warranty of MERCHANTABILITY or FITNESS FOR A ++# PARTICULAR PURPOSE. ++ ++@SET_MAKE@ ++ ++# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ ++# Process this file with automake to create Makefile.in ++ ++srcdir = @srcdir@ ++top_srcdir = @top_srcdir@ ++VPATH = @srcdir@ ++pkgdatadir = $(datadir)/@PACKAGE@ ++pkglibdir = $(libdir)/@PACKAGE@ ++pkgincludedir = $(includedir)/@PACKAGE@ ++top_builddir = . ++ ++am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd ++INSTALL = @INSTALL@ ++install_sh_DATA = $(install_sh) -c -m 644 ++install_sh_PROGRAM = $(install_sh) -c ++install_sh_SCRIPT = $(install_sh) -c ++INSTALL_HEADER = $(INSTALL_DATA) ++transform = $(program_transform_name) ++NORMAL_INSTALL = : ++PRE_INSTALL = : ++POST_INSTALL = : ++NORMAL_UNINSTALL = : ++PRE_UNINSTALL = : ++POST_UNINSTALL = : ++build_triplet = @build@ ++host_triplet = @host@ ++target_triplet = @target@ ++ACLOCAL = @ACLOCAL@ ++ALLOCA = @ALLOCA@ ++AMDEP_FALSE = @AMDEP_FALSE@ ++AMDEP_TRUE = @AMDEP_TRUE@ ++AMTAR = @AMTAR@ ++AR = @AR@ ++AS = @AS@ ++ASSEMBLER_FALSE = @ASSEMBLER_FALSE@ ++ASSEMBLER_TRUE = @ASSEMBLER_TRUE@ ++ASSEMBLER_sparc32_FALSE = @ASSEMBLER_sparc32_FALSE@ ++ASSEMBLER_sparc32_TRUE = @ASSEMBLER_sparc32_TRUE@ ++ASSEMBLER_sparc64_FALSE = @ASSEMBLER_sparc64_FALSE@ ++ASSEMBLER_sparc64_TRUE = @ASSEMBLER_sparc64_TRUE@ ++ASSEMBLER_x86_FALSE = @ASSEMBLER_x86_FALSE@ ++ASSEMBLER_x86_TRUE = @ASSEMBLER_x86_TRUE@ ++AUTOCONF = @AUTOCONF@ ++AUTOHEADER = @AUTOHEADER@ ++AUTOMAKE = @AUTOMAKE@ ++AVAILABLE_LANGUAGES = @AVAILABLE_LANGUAGES@ ++AVAILABLE_LANGUAGES_ERRORS = @AVAILABLE_LANGUAGES_ERRORS@ ++AWK = @AWK@ ++CC = @CC@ ++CCAS = @CCAS@ ++CCASFLAGS = @CCASFLAGS@ ++CCDEPMODE = @CCDEPMODE@ ++CC_VERSION = @CC_VERSION@ ++CFLAGS = @CFLAGS@ ++CHARSETS_NEED_SOURCE = @CHARSETS_NEED_SOURCE@ ++CHARSET_OBJS = @CHARSET_OBJS@ ++CHARSET_SRCS = @CHARSET_SRCS@ ++CHECK_PID = @CHECK_PID@ ++CHMOD = @CHMOD@ ++CLIENT_EXTRA_LDFLAGS = @CLIENT_EXTRA_LDFLAGS@ ++CLIENT_LIBS = @CLIENT_LIBS@ ++CMP = @CMP@ ++COMPILATION_COMMENT = @COMPILATION_COMMENT@ ++COMPILE_PSTACK_FALSE = @COMPILE_PSTACK_FALSE@ ++COMPILE_PSTACK_TRUE = @COMPILE_PSTACK_TRUE@ ++CONF_COMMAND = @CONF_COMMAND@ ++CP = @CP@ ++CPP = @CPP@ ++CPPFLAGS = @CPPFLAGS@ ++CXX = @CXX@ ++CXXCPP = @CXXCPP@ ++CXXDEPMODE = @CXXDEPMODE@ ++CXXFLAGS = @CXXFLAGS@ ++CXXLDFLAGS = @CXXLDFLAGS@ ++CXX_VERSION = @CXX_VERSION@ ++CYGPATH_W = @CYGPATH_W@ ++DEFS = @DEFS@ ++DEPDIR = @DEPDIR@ ++DOT_FRM_VERSION = @DOT_FRM_VERSION@ ++DVIS = @DVIS@ ++ECHO = @ECHO@ ++ECHO_C = @ECHO_C@ ++ECHO_N = @ECHO_N@ ++ECHO_T = @ECHO_T@ ++EGREP = @EGREP@ ++EXEEXT = @EXEEXT@ ++F77 = @F77@ ++FFLAGS = @FFLAGS@ ++FIND_PROC = @FIND_PROC@ ++GETCONF = @GETCONF@ ++GXX = @GXX@ ++HAVE_NETWARE_FALSE = @HAVE_NETWARE_FALSE@ ++HAVE_NETWARE_TRUE = @HAVE_NETWARE_TRUE@ ++HOSTNAME = @HOSTNAME@ ++INSTALL_DATA = @INSTALL_DATA@ ++INSTALL_PROGRAM = @INSTALL_PROGRAM@ ++INSTALL_SCRIPT = @INSTALL_SCRIPT@ ++INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ ++IS_LINUX = @IS_LINUX@ ++KILL = @KILL@ ++LD = @LD@ ++LDFLAGS = @LDFLAGS@ ++LIBDL = @LIBDL@ ++LIBOBJS = @LIBOBJS@ ++LIBS = @LIBS@ ++LIBTOOL = @LIBTOOL@ ++LIB_EXTRA_CCFLAGS = @LIB_EXTRA_CCFLAGS@ ++LM_CFLAGS = @LM_CFLAGS@ ++LN = @LN@ ++LN_CP_F = @LN_CP_F@ ++LN_S = @LN_S@ ++LOCAL_FALSE = @LOCAL_FALSE@ ++LOCAL_TRUE = @LOCAL_TRUE@ ++LTLIBOBJS = @LTLIBOBJS@ ++MACHINE_TYPE = @MACHINE_TYPE@ ++MAINT = @MAINT@ ++MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ ++MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ ++MAKEINFO = @MAKEINFO@ ++MAKE_BINARY_DISTRIBUTION_OPTIONS = @MAKE_BINARY_DISTRIBUTION_OPTIONS@ ++MAKE_SHELL = @MAKE_SHELL@ ++MT_INCLUDES = @MT_INCLUDES@ ++MT_LD_ADD = @MT_LD_ADD@ ++MV = @MV@ ++MYSQLD_DEFAULT_SWITCHES = @MYSQLD_DEFAULT_SWITCHES@ ++MYSQLD_EXTRA_LDFLAGS = @MYSQLD_EXTRA_LDFLAGS@ ++MYSQLD_USER = @MYSQLD_USER@ ++MYSQL_BASE_VERSION = @MYSQL_BASE_VERSION@ ++MYSQL_NO_DASH_VERSION = @MYSQL_NO_DASH_VERSION@ ++MYSQL_SERVER_SUFFIX = @MYSQL_SERVER_SUFFIX@ ++MYSQL_TCP_PORT = @MYSQL_TCP_PORT@ ++MYSQL_TCP_PORT_DEFAULT = @MYSQL_TCP_PORT_DEFAULT@ ++MYSQL_UNIX_ADDR = @MYSQL_UNIX_ADDR@ ++MYSQL_VERSION_ID = @MYSQL_VERSION_ID@ ++NOINST_LDFLAGS = @NOINST_LDFLAGS@ ++OBJEXT = @OBJEXT@ ++PACKAGE = @PACKAGE@ ++PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ ++PACKAGE_NAME = @PACKAGE_NAME@ ++PACKAGE_STRING = @PACKAGE_STRING@ ++PACKAGE_TARNAME = @PACKAGE_TARNAME@ ++PACKAGE_VERSION = @PACKAGE_VERSION@ ++PATH_SEPARATOR = @PATH_SEPARATOR@ ++PDFMANUAL = @PDFMANUAL@ ++PERL = @PERL@ ++PERL5 = @PERL5@ ++PROTOCOL_VERSION = @PROTOCOL_VERSION@ ++PS = @PS@ ++RANLIB = @RANLIB@ ++RM = @RM@ ++SAVE_ASFLAGS = @SAVE_ASFLAGS@ ++SAVE_CFLAGS = @SAVE_CFLAGS@ ++SAVE_CXXFLAGS = @SAVE_CXXFLAGS@ ++SAVE_CXXLDFLAGS = @SAVE_CXXLDFLAGS@ ++SAVE_LDFLAGS = @SAVE_LDFLAGS@ ++SED = @SED@ ++SET_MAKE = @SET_MAKE@ ++SHARED_LIB_VERSION = @SHARED_LIB_VERSION@ ++SHELL = @SHELL@ ++STRIP = @STRIP@ ++SYSTEM_TYPE = @SYSTEM_TYPE@ ++TAR = @TAR@ ++TERMCAP_LIB = @TERMCAP_LIB@ ++THREAD_LOBJECTS = @THREAD_LOBJECTS@ ++THREAD_LPROGRAMS = @THREAD_LPROGRAMS@ ++VERSION = @VERSION@ ++WRAPLIBS = @WRAPLIBS@ ++YACC = @YACC@ ++ac_ct_AR = @ac_ct_AR@ ++ac_ct_CC = @ac_ct_CC@ ++ac_ct_CXX = @ac_ct_CXX@ ++ac_ct_F77 = @ac_ct_F77@ ++ac_ct_GETCONF = @ac_ct_GETCONF@ ++ac_ct_RANLIB = @ac_ct_RANLIB@ ++ac_ct_STRIP = @ac_ct_STRIP@ ++am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ ++am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ ++am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ ++am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ ++am__include = @am__include@ ++am__leading_dot = @am__leading_dot@ ++am__quote = @am__quote@ ++bdb_includes = @bdb_includes@ ++bdb_libs = @bdb_libs@ ++bdb_libs_with_path = @bdb_libs_with_path@ ++bench_dirs = @bench_dirs@ ++bindir = @bindir@ ++build = @build@ ++build_alias = @build_alias@ ++build_cpu = @build_cpu@ ++build_os = @build_os@ ++build_vendor = @build_vendor@ ++datadir = @datadir@ ++default_charset = @default_charset@ ++docs_dirs = @docs_dirs@ ++exec_prefix = @exec_prefix@ ++host = @host@ ++host_alias = @host_alias@ ++host_cpu = @host_cpu@ ++host_os = @host_os@ ++host_vendor = @host_vendor@ ++includedir = @includedir@ ++infodir = @infodir@ ++innodb_includes = @innodb_includes@ ++innodb_libs = @innodb_libs@ ++innodb_system_libs = @innodb_system_libs@ ++install_sh = @install_sh@ ++isam_libs = @isam_libs@ ++libdir = @libdir@ ++libexecdir = @libexecdir@ ++libmysqld_dirs = @libmysqld_dirs@ ++linked_client_targets = @linked_client_targets@ ++linked_netware_sources = @linked_netware_sources@ ++localstatedir = @localstatedir@ ++man_dirs = @man_dirs@ ++mandir = @mandir@ ++netware_dir = @netware_dir@ ++oldincludedir = @oldincludedir@ ++openssl_includes = @openssl_includes@ ++openssl_libs = @openssl_libs@ ++orbit_idl = @orbit_idl@ ++orbit_includes = @orbit_includes@ ++orbit_libs = @orbit_libs@ ++prefix = @prefix@ ++program_transform_name = @program_transform_name@ ++pstack_dirs = @pstack_dirs@ ++pstack_libs = @pstack_libs@ ++readline_dir = @readline_dir@ ++readline_link = @readline_link@ ++sbindir = @sbindir@ ++server_scripts = @server_scripts@ ++sharedstatedir = @sharedstatedir@ ++sql_client_dirs = @sql_client_dirs@ ++sql_server_dirs = @sql_server_dirs@ ++sysconfdir = @sysconfdir@ ++target = @target@ ++target_alias = @target_alias@ ++target_cpu = @target_cpu@ ++target_os = @target_os@ ++target_vendor = @target_vendor@ ++thread_dirs = @thread_dirs@ ++tools_dirs = @tools_dirs@ ++uname_prog = @uname_prog@ ++vio_dir = @vio_dir@ ++vio_libs = @vio_libs@ ++ ++AUTOMAKE_OPTIONS = foreign ++ ++# These are built from source in the Docs directory ++EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT ++SUBDIRS = . include @docs_dirs@ @readline_dir@ \ ++ @thread_dirs@ pstack @sql_client_dirs@ \ ++ @sql_server_dirs@ scripts @man_dirs@ tests \ ++ BUILD netware os2 @libmysqld_dirs@ \ ++ @bench_dirs@ support-files @tools_dirs@ ++ ++ ++# Relink after clean ++linked_sources = linked_client_sources linked_server_sources \ ++ linked_libmysql_sources linked_libmysql_r_sources \ ++ linked_libmysqld_sources linked_libmysqldex_sources \ ++ linked_include_sources @linked_netware_sources@ ++ ++ ++CLEANFILES = $(linked_sources) ++subdir = . ++ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ++mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs ++CONFIG_HEADER = config.h ++CONFIG_CLEAN_FILES = bdb/Makefile ++DIST_SOURCES = ++ ++RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ ++ ps-recursive install-info-recursive uninstall-info-recursive \ ++ all-recursive install-data-recursive install-exec-recursive \ ++ installdirs-recursive install-recursive uninstall-recursive \ ++ check-recursive installcheck-recursive ++DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure COPYING \ ++ ChangeLog Makefile.am acconfig.h acinclude.m4 aclocal.m4 \ ++ config.guess config.h.in config.sub configure configure.in \ ++ depcomp install-sh ltconfig ltmain.sh missing mkinstalldirs ++DIST_SUBDIRS = $(SUBDIRS) ++all: config.h ++ $(MAKE) $(AM_MAKEFLAGS) all-recursive ++ ++.SUFFIXES: ++ ++am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ ++ configure.lineno ++$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) ++ cd $(top_srcdir) && \ ++ $(AUTOMAKE) --foreign Makefile ++Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status ++ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) ++ ++$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) ++ $(SHELL) ./config.status --recheck ++$(srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) ++ cd $(srcdir) && $(AUTOCONF) ++ ++$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ configure.in acinclude.m4 ++ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) ++ ++stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status ++ @rm -f stamp-h1 ++ cd $(top_builddir) && $(SHELL) ./config.status config.h ++ ++$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h ++ cd $(top_srcdir) && $(AUTOHEADER) ++ touch $(srcdir)/config.h.in ++ ++distclean-hdr: ++ -rm -f config.h stamp-h1 ++bdb/Makefile: $(top_builddir)/config.status $(top_srcdir)/bdb/Makefile.in ++ cd $(top_builddir) && $(SHELL) ./config.status $@ ++ ++mostlyclean-libtool: ++ -rm -f *.lo ++ ++clean-libtool: ++ -rm -rf .libs _libs ++ ++distclean-libtool: ++ -rm -f libtool ++uninstall-info-am: ++ ++# This directory's subdirectories are mostly independent; you can cd ++# into them and run `make' without going through this Makefile. ++# To change the values of `make' variables: instead of editing Makefiles, ++# (1) if the variable is set in `config.status', edit `config.status' ++# (which will cause the Makefiles to be regenerated when you run `make'); ++# (2) otherwise, pass the desired values on the `make' command line. ++$(RECURSIVE_TARGETS): ++ @set fnord $$MAKEFLAGS; amf=$$2; \ ++ dot_seen=no; \ ++ target=`echo $@ | sed s/-recursive//`; \ ++ list='$(SUBDIRS)'; for subdir in $$list; do \ ++ echo "Making $$target in $$subdir"; \ ++ if test "$$subdir" = "."; then \ ++ dot_seen=yes; \ ++ local_target="$$target-am"; \ ++ else \ ++ local_target="$$target"; \ ++ fi; \ ++ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ ++ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ ++ done; \ ++ if test "$$dot_seen" = "no"; then \ ++ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ ++ fi; test -z "$$fail" ++ ++mostlyclean-recursive clean-recursive distclean-recursive \ ++maintainer-clean-recursive: ++ @set fnord $$MAKEFLAGS; amf=$$2; \ ++ dot_seen=no; \ ++ case "$@" in \ ++ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ ++ *) list='$(SUBDIRS)' ;; \ ++ esac; \ ++ rev=''; for subdir in $$list; do \ ++ if test "$$subdir" = "."; then :; else \ ++ rev="$$subdir $$rev"; \ ++ fi; \ ++ done; \ ++ rev="$$rev ."; \ ++ target=`echo $@ | sed s/-recursive//`; \ ++ for subdir in $$rev; do \ ++ echo "Making $$target in $$subdir"; \ ++ if test "$$subdir" = "."; then \ ++ local_target="$$target-am"; \ ++ else \ ++ local_target="$$target"; \ ++ fi; \ ++ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ ++ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ ++ done && test -z "$$fail" ++tags-recursive: ++ list='$(SUBDIRS)'; for subdir in $$list; do \ ++ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ ++ done ++ctags-recursive: ++ list='$(SUBDIRS)'; for subdir in $$list; do \ ++ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ ++ done ++ ++ETAGS = etags ++ETAGSFLAGS = ++ ++CTAGS = ctags ++CTAGSFLAGS = ++ ++ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) ++ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ ++ unique=`for i in $$list; do \ ++ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ ++ done | \ ++ $(AWK) ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ mkid -fID $$unique ++ ++TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ ++ $(TAGS_FILES) $(LISP) ++ tags=; \ ++ here=`pwd`; \ ++ if (etags --etags-include --version) >/dev/null 2>&1; then \ ++ include_option=--etags-include; \ ++ else \ ++ include_option=--include; \ ++ fi; \ ++ list='$(SUBDIRS)'; for subdir in $$list; do \ ++ if test "$$subdir" = .; then :; else \ ++ test -f $$subdir/TAGS && \ ++ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ ++ fi; \ ++ done; \ ++ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ ++ unique=`for i in $$list; do \ ++ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ ++ done | \ ++ $(AWK) ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ test -z "$(ETAGS_ARGS)$$tags$$unique" \ ++ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ ++ $$tags $$unique ++ ++ctags: CTAGS ++CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ ++ $(TAGS_FILES) $(LISP) ++ tags=; \ ++ here=`pwd`; \ ++ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ ++ unique=`for i in $$list; do \ ++ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ ++ done | \ ++ $(AWK) ' { files[$$0] = 1; } \ ++ END { for (i in files) print i; }'`; \ ++ test -z "$(CTAGS_ARGS)$$tags$$unique" \ ++ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ ++ $$tags $$unique ++ ++GTAGS: ++ here=`$(am__cd) $(top_builddir) && pwd` \ ++ && cd $(top_srcdir) \ ++ && gtags -i $(GTAGS_ARGS) $$here ++ ++distclean-tags: ++ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags ++DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ++ ++top_distdir = . ++distdir = $(PACKAGE)-$(VERSION) ++ ++am__remove_distdir = \ ++ { test ! -d $(distdir) \ ++ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ ++ && rm -fr $(distdir); }; } ++ ++GZIP_ENV = --best ++distuninstallcheck_listfiles = find . -type f -print ++distcleancheck_listfiles = find . -type f -print ++ ++distdir: $(DISTFILES) ++ $(am__remove_distdir) ++ mkdir $(distdir) ++ $(mkinstalldirs) $(distdir)/bdb $(distdir)/include ++ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ ++ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ ++ list='$(DISTFILES)'; for file in $$list; do \ ++ case $$file in \ ++ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ ++ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ ++ esac; \ ++ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ ++ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ ++ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ ++ dir="/$$dir"; \ ++ $(mkinstalldirs) "$(distdir)$$dir"; \ ++ else \ ++ dir=''; \ ++ fi; \ ++ if test -d $$d/$$file; then \ ++ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ ++ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ ++ fi; \ ++ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ ++ else \ ++ test -f $(distdir)/$$file \ ++ || cp -p $$d/$$file $(distdir)/$$file \ ++ || exit 1; \ ++ fi; \ ++ done ++ list='$(SUBDIRS)'; for subdir in $$list; do \ ++ if test "$$subdir" = .; then :; else \ ++ test -d $(distdir)/$$subdir \ ++ || mkdir $(distdir)/$$subdir \ ++ || exit 1; \ ++ (cd $$subdir && \ ++ $(MAKE) $(AM_MAKEFLAGS) \ ++ top_distdir="$(top_distdir)" \ ++ distdir=../$(distdir)/$$subdir \ ++ distdir) \ ++ || exit 1; \ ++ fi; \ ++ done ++ $(MAKE) $(AM_MAKEFLAGS) \ ++ top_distdir="$(top_distdir)" distdir="$(distdir)" \ ++ dist-hook ++ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ++ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ++ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ++ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ ++ || chmod -R a+r $(distdir) ++dist-gzip: distdir ++ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz ++ $(am__remove_distdir) ++ ++dist dist-all: distdir ++ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz ++ $(am__remove_distdir) ++ ++# This target untars the dist file and tries a VPATH configuration. Then ++# it guarantees that the distribution is self-contained by making another ++# tarfile. ++distcheck: dist ++ $(am__remove_distdir) ++ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ++ chmod -R a-w $(distdir); chmod a+w $(distdir) ++ mkdir $(distdir)/_build ++ mkdir $(distdir)/_inst ++ chmod a-w $(distdir) ++ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ ++ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ ++ && cd $(distdir)/_build \ ++ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ ++ $(DISTCHECK_CONFIGURE_FLAGS) \ ++ && $(MAKE) $(AM_MAKEFLAGS) \ ++ && $(MAKE) $(AM_MAKEFLAGS) dvi \ ++ && $(MAKE) $(AM_MAKEFLAGS) check \ ++ && $(MAKE) $(AM_MAKEFLAGS) install \ ++ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ ++ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ ++ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ ++ distuninstallcheck \ ++ && chmod -R a-w "$$dc_install_base" \ ++ && ({ \ ++ (cd ../.. && $(mkinstalldirs) "$$dc_destdir") \ ++ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ ++ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ ++ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ ++ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ ++ } || { rm -rf "$$dc_destdir"; exit 1; }) \ ++ && rm -rf "$$dc_destdir" \ ++ && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ ++ && rm -f $(distdir).tar.gz \ ++ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck ++ $(am__remove_distdir) ++ @echo "$(distdir).tar.gz is ready for distribution" | \ ++ sed 'h;s/./=/g;p;x;p;x' ++distuninstallcheck: ++ @cd $(distuninstallcheck_dir) \ ++ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ ++ || { echo "ERROR: files left after uninstall:" ; \ ++ if test -n "$(DESTDIR)"; then \ ++ echo " (check DESTDIR support)"; \ ++ fi ; \ ++ $(distuninstallcheck_listfiles) ; \ ++ exit 1; } >&2 ++distcleancheck: distclean ++ @if test '$(srcdir)' = . ; then \ ++ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ ++ exit 1 ; \ ++ fi ++ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ ++ || { echo "ERROR: files left in build directory after distclean:" ; \ ++ $(distcleancheck_listfiles) ; \ ++ exit 1; } >&2 ++check-am: all-am ++check: check-recursive ++all-am: Makefile config.h ++installdirs: installdirs-recursive ++installdirs-am: ++ ++install: install-recursive ++install-exec: install-exec-recursive ++install-data: install-data-recursive ++uninstall: uninstall-recursive ++ ++install-am: all-am ++ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am ++ ++installcheck: installcheck-recursive ++install-strip: ++ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ ++ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ ++ `test -z '$(STRIP)' || \ ++ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install ++mostlyclean-generic: ++ ++clean-generic: ++ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) ++ ++distclean-generic: ++ -rm -f $(CONFIG_CLEAN_FILES) ++ ++maintainer-clean-generic: ++ @echo "This command is intended for maintainers to use" ++ @echo "it deletes files that may require special tools to rebuild." ++clean: clean-recursive ++ ++clean-am: clean-generic clean-libtool mostlyclean-am ++ ++distclean: distclean-recursive ++ -rm -f $(am__CONFIG_DISTCLEAN_FILES) ++ -rm -f Makefile ++distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \ ++ distclean-tags ++ ++dvi: dvi-recursive ++ ++dvi-am: ++ ++info: info-recursive ++ ++info-am: ++ ++install-data-am: ++ ++install-exec-am: ++ ++install-info: install-info-recursive ++ ++install-man: ++ ++installcheck-am: ++ ++maintainer-clean: maintainer-clean-recursive ++ -rm -f $(am__CONFIG_DISTCLEAN_FILES) ++ -rm -rf $(top_srcdir)/autom4te.cache ++ -rm -f Makefile ++maintainer-clean-am: distclean-am maintainer-clean-generic ++ ++mostlyclean: mostlyclean-recursive ++ ++mostlyclean-am: mostlyclean-generic mostlyclean-libtool ++ ++pdf: pdf-recursive ++ ++pdf-am: ++ ++ps: ps-recursive ++ ++ps-am: ++ ++uninstall-am: uninstall-info-am ++ ++uninstall-info: uninstall-info-recursive ++ ++.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ ++ clean-generic clean-libtool clean-recursive ctags \ ++ ctags-recursive dist dist-all dist-gzip distcheck distclean \ ++ distclean-generic distclean-hdr distclean-libtool \ ++ distclean-recursive distclean-tags distcleancheck distdir \ ++ distuninstallcheck dvi dvi-am dvi-recursive info info-am \ ++ info-recursive install install-am install-data install-data-am \ ++ install-data-recursive install-exec install-exec-am \ ++ install-exec-recursive install-info install-info-am \ ++ install-info-recursive install-man install-recursive \ ++ install-strip installcheck installcheck-am installdirs \ ++ installdirs-am installdirs-recursive maintainer-clean \ ++ maintainer-clean-generic maintainer-clean-recursive mostlyclean \ ++ mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ ++ pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ ++ tags-recursive uninstall uninstall-am uninstall-info-am \ ++ uninstall-info-recursive uninstall-recursive ++ ++ ++# This is just so that the linking is done early. ++config.h: $(linked_sources) ++ ++linked_include_sources: ++ cd include; $(MAKE) link_sources ++ echo timestamp > linked_include_sources ++ ++linked_client_sources: @linked_client_targets@ ++ cd client; $(MAKE) link_sources ++ echo timestamp > linked_client_sources ++ ++linked_libmysql_sources: ++ cd libmysql; $(MAKE) link_sources ++ echo timestamp > linked_libmysql_sources ++ ++linked_libmysql_r_sources: linked_libmysql_sources ++ cd libmysql_r; $(MAKE) link_sources ++ echo timestamp > linked_libmysql_r_sources ++ ++linked_libmysqld_sources: ++ cd libmysqld; $(MAKE) link_sources ++ echo timestamp > linked_libmysqld_sources ++ ++linked_libmysqldex_sources: ++ cd libmysqld/examples; $(MAKE) link_sources ++ echo timestamp > linked_libmysqldex_sources ++ ++linked_netware_sources: ++ cd @netware_dir@; $(MAKE) link_sources ++ echo timestamp > linked_netware_sources ++ ++#avoid recursive make calls in sql directory ++linked_server_sources: ++ cd sql; rm -f mini_client_errors.c;@LN_CP_F@ ../libmysql/errmsg.c mini_client_errors.c ++ echo timestamp > linked_server_sources ++ ++# Create permission databases ++init-db: all ++ $(top_builddir)/scripts/mysql_install_db ++ ++bin-dist: all ++ $(top_builddir)/scripts/make_binary_distribution @MAKE_BINARY_DISTRIBUTION_OPTIONS@ ++ ++# Remove BK's "SCCS" subdirectories from source distribution ++dist-hook: ++ rm -rf `find $(distdir) -type d -name SCCS` ++ ++tags: ++ support-files/build-tags ++.PHONY: init-db bin-dist ++ ++# Test installation ++ ++test: ++ cd mysql-test ; ./mysql-test-run ++# Tell versions [3.59,3.63) of GNU make to not export all variables. ++# Otherwise a system limit (for SysV at least) may be exceeded. ++.NOEXPORT: diff --git a/storage/xtradb/build/debian/patches/33_scripts__mysql_create_system_tables__no_test.dpatch b/storage/xtradb/build/debian/patches/33_scripts__mysql_create_system_tables__no_test.dpatch new file mode 100644 index 00000000000..0fd166d1fc7 --- /dev/null +++ b/storage/xtradb/build/debian/patches/33_scripts__mysql_create_system_tables__no_test.dpatch @@ -0,0 +1,29 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 33_scripts__mysql_create_system_tables__no_test.dpatch by <ch@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: scripts__mysql_create_system_tables__no_test +## DP: A user with no password prevents a normal user from login under certain +## DP: circumstances as it is checked first. See #301741. +## DP: http://bugs.mysql.com/bug.php?id=6901 + +@DPATCH@ +--- old/scripts/mysql_system_tables_data.sql 2008-12-04 22:59:44.000000000 +0100 ++++ new/scripts/mysql_system_tables_data.sql 2008-12-04 23:00:07.000000000 +0100 +@@ -11,8 +11,6 @@ + -- Fill "db" table with default grants for anyone to + -- access database 'test' and 'test_%' if "db" table didn't exist + CREATE TEMPORARY TABLE tmp_db LIKE db; +-INSERT INTO tmp_db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y'); +-INSERT INTO tmp_db VALUES ('%','test\_%','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y'); + INSERT INTO db SELECT * FROM tmp_db WHERE @had_db_table=0; + DROP TABLE tmp_db; + +@@ -24,7 +22,5 @@ + INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); + REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0 FROM dual WHERE LOWER( @current_hostname) != 'localhost'; + REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0); +-INSERT INTO tmp_user (host,user) VALUES ('localhost',''); +-INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE LOWER(@current_hostname ) != 'localhost'; + INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0; + DROP TABLE tmp_user; diff --git a/storage/xtradb/build/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch b/storage/xtradb/build/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch new file mode 100644 index 00000000000..154bc0ad1c4 --- /dev/null +++ b/storage/xtradb/build/debian/patches/38_scripts__mysqld_safe.sh__signals.dpatch @@ -0,0 +1,43 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 38_scripts__mysqld_safe.sh__signals.dpatch by <ch@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Executes /etc/init.d/mysql on signals +## DP: Reported as http://bugs.mysql.com/bug.php?id=31361 + +@DPATCH@ + +--- old/scripts/mysqld_safe.sh 2006-07-29 13:12:34.000000000 +0200 ++++ old/scripts/mysqld_safe.sh 2006-07-29 13:14:08.000000000 +0200 +@@ -16,8 +16,6 @@ + # This command can be used as pipe to syslog. With "-s" it also logs to stderr. + ERR_LOGGER="logger -p daemon.err -t mysqld_safe -i" + +-trap '' 1 2 3 15 # we shouldn't let anyone kill us +- + umask 007 + + defaults= +@@ -122,7 +122,7 @@ + # sed buffers output (only GNU sed supports a -u (unbuffered) option) + # which means that messages may not get sent to syslog until the + # mysqld process quits. +- cmd="$cmd 2>&1 | logger -t '$syslog_tag_mysqld' -p daemon.error" ++ cmd="$cmd 2>&1 | logger -t '$syslog_tag_mysqld' -p daemon.error & wait" + ;; + *) + echo "Internal program error (non-fatal):" \ +@@ -352,6 +350,13 @@ + fi + + # ++# From now on, we catch signals to do a proper shutdown of mysqld ++# when signalled to do so. ++# ++trap '/usr/bin/mysqladmin --defaults-extra-file=/etc/mysql/debian.cnf refresh' 1 # HUP ++trap '/usr/bin/mysqladmin --defaults-extra-file=/etc/mysql/debian.cnf shutdown' 2 3 15 # INT QUIT and TERM ++ ++# + # Uncomment the following lines if you want all tables to be automatically + # checked and repaired during startup. You should add sensible key_buffer + # and sort_buffer values to my.cnf to improve check performance or require diff --git a/storage/xtradb/build/debian/patches/41_scripts__mysql_install_db.sh__no_test.dpatch b/storage/xtradb/build/debian/patches/41_scripts__mysql_install_db.sh__no_test.dpatch new file mode 100644 index 00000000000..e79ac71cc7b --- /dev/null +++ b/storage/xtradb/build/debian/patches/41_scripts__mysql_install_db.sh__no_test.dpatch @@ -0,0 +1,20 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 41_scripts__mysql_install_db.sh__no_test.dpatch by <ch@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: scripts__mysql_install_db.sh__no_test +## DP: http://bugs.mysql.com/bug.php?id=6901 + +@DPATCH@ + +--- mysql-dfsg-5.1-5.1.23rc.orig/scripts/mysql_install_db.sh 2008-01-29 22:41:20.000000000 +0100 ++++ mysql-dfsg-5.1-5.1.23rc/scripts/mysql_install_db.sh 2008-02-28 10:08:11.000000000 +0100 +@@ -306,7 +306,7 @@ + fi + + # Create database directories +-for dir in $ldata $ldata/mysql $ldata/test ++for dir in $ldata $ldata/mysql + do + if test ! -d $dir + then diff --git a/storage/xtradb/build/debian/patches/44_scripts__mysql_config__libs.dpatch b/storage/xtradb/build/debian/patches/44_scripts__mysql_config__libs.dpatch new file mode 100644 index 00000000000..b35ba4912f3 --- /dev/null +++ b/storage/xtradb/build/debian/patches/44_scripts__mysql_config__libs.dpatch @@ -0,0 +1,24 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 99-unnamed.dpatch by <ch@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Removes unnecessary library dependencies. See #390692 + +@DPATCH@ +diff -Nur mysql-dfsg-5.1-5.1.31.orig/scripts/mysql_config.sh mysql-dfsg-5.1-5.1.31/scripts/mysql_config.sh +--- mysql-dfsg-5.1-5.1.31.orig/scripts/mysql_config.sh 2009-01-19 17:30:55.000000000 +0100 ++++ mysql-dfsg-5.1-5.1.31/scripts/mysql_config.sh 2009-02-08 17:17:48.000000000 +0100 +@@ -104,10 +104,10 @@ + + # Create options + # We intentionally add a space to the beginning and end of lib strings, simplifies replace later +-libs=" $ldflags -L$pkglibdir -lmysqlclient @ZLIB_DEPS@ @NON_THREADED_LIBS@" ++libs=" $ldflags -L$pkglibdir -lmysqlclient" + libs="$libs @openssl_libs@ @STATIC_NSS_FLAGS@ " +-libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @ZLIB_DEPS@ @LIBS@ @openssl_libs@ " +-embedded_libs=" $ldflags -L$pkglibdir -lmysqld @LIBDL@ @ZLIB_DEPS@ @LIBS@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@ " ++libs_r=" $ldflags -L$pkglibdir -lmysqlclient_r @openssl_libs@ " ++embedded_libs=" $ldflags -L$pkglibdir -lmysqld @LIBDL@ @WRAPLIBS@ @innodb_system_libs@ @openssl_libs@ " + + if [ -r "$pkglibdir/libmygcc.a" ]; then + # When linking against the static library with a different version of GCC diff --git a/storage/xtradb/build/debian/patches/50_mysql-test__db_test.dpatch b/storage/xtradb/build/debian/patches/50_mysql-test__db_test.dpatch new file mode 100644 index 00000000000..6a5cab91c39 --- /dev/null +++ b/storage/xtradb/build/debian/patches/50_mysql-test__db_test.dpatch @@ -0,0 +1,23 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 50_mysql-test__db_test.dpatch by Christian Hammers <ch@debian.org> +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Patch 33_scripts__mysql_create_system_tables__no_test removes the +## DP: rights for anybody to connect to the test database but the test +## DP: suite depends on them. + +@DPATCH@ + +--- old/mysql-test/mysql-test-run.pl 2009-06-16 14:24:09.000000000 +0200 ++++ new/mysql-test/mysql-test-run.pl 2009-07-04 00:03:34.000000000 +0200 +@@ -2717,6 +2717,10 @@ + mtr_appendfile_to_file("$sql_dir/mysql_system_tables_data.sql", + $bootstrap_sql_file); + ++ mtr_tofile($bootstrap_sql_file, "-- Debian removed the default privileges on the 'test' database\n"); ++ mtr_tofile($bootstrap_sql_file, "INSERT INTO mysql.db VALUES ('%','test','','Y','Y','Y','Y','Y','Y','N','Y','Y','Y','Y','Y','Y','Y','Y','N','N','Y','Y');\n"); ++ ++ + # Add test data for timezone - this is just a subset, on a real + # system these tables will be populated either by mysql_tzinfo_to_sql + # or by downloading the timezone table package from our website diff --git a/storage/xtradb/build/debian/patches/60_percona_support.dpatch b/storage/xtradb/build/debian/patches/60_percona_support.dpatch new file mode 100644 index 00000000000..e69d0dd5f76 --- /dev/null +++ b/storage/xtradb/build/debian/patches/60_percona_support.dpatch @@ -0,0 +1,16 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run + +@DPATCH@ + +--- a/scripts/mysql_install_db.sh 2009-08-08 09:20:07.000000000 +0000 ++++ b/scripts/mysql_install_db.sh 2009-08-08 09:29:23.000000000 +0000 +@@ -469,6 +469,9 @@ + echo + echo "Please report any problems with the $scriptdir/mysqlbug script!" + echo ++ echo "For commercial support please contact Percona at http://www.percona.com/contacts.html" ++ echo ++ + fi + + exit 0 diff --git a/storage/xtradb/build/debian/percona-xtradb-client-5.1.README.Debian b/storage/xtradb/build/debian/percona-xtradb-client-5.1.README.Debian new file mode 100644 index 00000000000..b245638f9c9 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-client-5.1.README.Debian @@ -0,0 +1,4 @@ +FAQ: + +Q: My <tab> completition is gone, why? +A: You have "no-auto-rehash" in the "[mysql]" section of /etc/mysql/my.cnf! diff --git a/storage/xtradb/build/debian/percona-xtradb-client-5.1.dirs b/storage/xtradb/build/debian/percona-xtradb-client-5.1.dirs new file mode 100644 index 00000000000..ceda5922c5d --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-client-5.1.dirs @@ -0,0 +1,3 @@ +usr/bin/ +usr/share/man/man1/ +usr/share/perl5/ diff --git a/storage/xtradb/build/debian/percona-xtradb-client-5.1.docs b/storage/xtradb/build/debian/percona-xtradb-client-5.1.docs new file mode 100644 index 00000000000..8b8692f0d90 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-client-5.1.docs @@ -0,0 +1,3 @@ +debian/additions/innotop/changelog.innotop +EXCEPTIONS-CLIENT +README diff --git a/storage/xtradb/build/debian/percona-xtradb-client-5.1.files b/storage/xtradb/build/debian/percona-xtradb-client-5.1.files new file mode 100644 index 00000000000..9ba5fe35054 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-client-5.1.files @@ -0,0 +1,39 @@ +usr/bin/innotop +usr/bin/myisam_ftdump +usr/bin/mysql +usr/bin/mysqlaccess +usr/bin/mysqladmin +usr/bin/mysqlbug +usr/bin/mysqlcheck +usr/bin/mysql_client_test +usr/bin/mysqldump +usr/bin/mysqldumpslow +usr/bin/mysql_find_rows +usr/bin/mysql_fix_extensions +usr/bin/mysqlimport +usr/bin/mysqlreport +usr/bin/mysqlshow +usr/bin/mysql_waitpid +usr/sbin/mysqlmanager +usr/share/lintian/overrides/percona-xtradb-client-5.1 +usr/share/man/man1/innotop.1 +usr/share/man/man1/myisam_ftdump.1 +usr/share/man/man1/mysql.1 +usr/share/man/man1/mysqlaccess.1 +usr/share/man/man1/mysqladmin.1 +usr/share/man/man1/mysqlbug.1 +usr/share/man/man1/mysqlcheck.1 +usr/share/man/man1/mysqldump.1 +usr/share/man/man1/mysqldumpslow.1 +usr/share/man/man1/mysql_find_rows.1 +usr/share/man/man1/mysql_fix_extensions.1 +usr/share/man/man1/mysqlimport.1 +usr/share/man/man1/mysqlmanager.1 +usr/share/man/man1/mysqlmanagerc.1 +usr/share/man/man1/mysqlmanager-pwgen.1 +usr/share/man/man1/mysqlreport.1 +usr/share/man/man1/mysqlshow.1 +usr/share/man/man1/mysql_tableinfo.1 +usr/share/man/man1/mysql_waitpid.1 +usr/share/man/man1/mysql_client_test.1 +usr/share/perl5/InnoDBParser.pm diff --git a/storage/xtradb/build/debian/percona-xtradb-client-5.1.links b/storage/xtradb/build/debian/percona-xtradb-client-5.1.links new file mode 100644 index 00000000000..247369fa218 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-client-5.1.links @@ -0,0 +1,3 @@ +usr/bin/mysqlcheck usr/bin/mysqlrepair +usr/bin/mysqlcheck usr/bin/mysqlanalyze +usr/bin/mysqlcheck usr/bin/mysqloptimize diff --git a/storage/xtradb/build/debian/percona-xtradb-client-5.1.lintian-overrides b/storage/xtradb/build/debian/percona-xtradb-client-5.1.lintian-overrides new file mode 100644 index 00000000000..d36909f47f2 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-client-5.1.lintian-overrides @@ -0,0 +1,3 @@ +percona-xtradb-client-5.1: package-has-a-duplicate-relation +percona-xtradb-client-5.1: wrong-name-for-upstream-changelog usr/share/doc/percona-xtradb-client-5.1/changelog.innotop.gz +percona-xtradb-client-5.1: pkg-not-in-package-test innotop diff --git a/storage/xtradb/build/debian/percona-xtradb-client-5.1.menu b/storage/xtradb/build/debian/percona-xtradb-client-5.1.menu new file mode 100644 index 00000000000..1378555c423 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-client-5.1.menu @@ -0,0 +1,3 @@ +# According to /usr/share/menu/ policy 1.4, not /usr/share/doc/debian-policy/ +?package(innotop):needs="text" section="Applications/Data Management"\ + title="innotop" command="/usr/bin/innotop" diff --git a/storage/xtradb/build/debian/percona-xtradb-common.dirs b/storage/xtradb/build/debian/percona-xtradb-common.dirs new file mode 100644 index 00000000000..a5a88ede9c1 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-common.dirs @@ -0,0 +1 @@ +etc/mysql/conf.d/ diff --git a/storage/xtradb/build/debian/percona-xtradb-common.files b/storage/xtradb/build/debian/percona-xtradb-common.files new file mode 100644 index 00000000000..931f37a0237 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-common.files @@ -0,0 +1,2 @@ +etc/mysql/my.cnf +usr/share/percona-xtradb-common/internal-use-only diff --git a/storage/xtradb/build/debian/percona-xtradb-common.lintian-overrides b/storage/xtradb/build/debian/percona-xtradb-common.lintian-overrides new file mode 100644 index 00000000000..7f58feb498d --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-common.lintian-overrides @@ -0,0 +1,2 @@ +script-not-executable ./usr/share/percona-xtradb-common/internal-use-only/_etc_init.d_mysql +script-not-executable ./usr/share/percona-xtradb-common/internal-use-only/_etc_mysql_debian-start diff --git a/storage/xtradb/build/debian/percona-xtradb-common.postrm b/storage/xtradb/build/debian/percona-xtradb-common.postrm new file mode 100644 index 00000000000..3ca45870165 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-common.postrm @@ -0,0 +1,7 @@ +#!/bin/bash + +if [ "$1" = "purge" ]; then + rmdir /etc/mysql 2>/dev/null || true +fi + +#DEBHELPER# diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.NEWS b/storage/xtradb/build/debian/percona-xtradb-server-5.1.NEWS new file mode 100644 index 00000000000..a3042dc2918 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.NEWS @@ -0,0 +1,34 @@ +mysql-dfsg-5.1 (5.1.38-1) unstable; urgency=low + + * Please read http://dev.mysql.com/doc/refman/5.1/en/upgrading-from-5-0.html + * Make sure to do a REPAIR TABLE on all tables that use UTF-8 and have a + FULLTEXT index. + + -- Christian Hammers <ch@debian.org> Sat, 4 Jul 2009 02:31:21 +0200 + +mysql-dfsg-5.0 (5.1.14beta-2) unstable; urgency=low + + * The BerkeleyDB Storage Engine is no longer supported. If the options + have-bdb or skip-bdb are found, MySQL will not start. If you have BDB + tables, you should change them to use another storage engine before + upgrading to 5.1. + + -- Monty Taylor <mordred@inaugust.com> Thu, 18 Jan 2007 12:28:21 -0800 + +mysql-dfsg-5.0 (5.0.45-2) unstable; urgency=low + + * Binary logging is now disabled by default. If you really need it (e.g. on + a replication master), remove the comment from the log_bin line in my.cnf. + + -- Norbert Tretkowski <nobse@debian.org> Sat, 10 Nov 2007 16:26:35 +0100 + +mysql-dfsg-5.0 (5.0.18-9) unstable; urgency=low + + * Rotation of the binary logs is now configured in /etc/mysql/my.cnf with + "expire-logs-days" which defaults to 20 days. The old file + /etc/mysql/debian-log-rotate.conf should be removed together with + /etc/cron.daily/mysql-server after this value has been adjusted. Note that + the old variable defined the number of files whereas the new one defines + a time span in days. + + -- Christian Hammers <ch@debian.org> Tue, 24 Jan 2006 22:18:21 +0100 diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.README.Debian b/storage/xtradb/build/debian/percona-xtradb-server-5.1.README.Debian new file mode 100644 index 00000000000..741243f1ec3 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.README.Debian @@ -0,0 +1,109 @@ +* MYSQL WON'T START OR STOP?: +============================= +You may never ever delete the special mysql user "debian-sys-maint". This +user together with the credentials in /etc/mysql/debian.cnf are used by the +init scripts to stop the server as they would require knowledge of the mysql +root users password else. +So in most of the times you can fix the situation by making sure that the +debian.cnf file contains the right password, e.g. by setting a new one +(remember to do a "flush privileges" then). + +* WHAT TO DO AFTER UPGRADES: +============================ +The privilege tables are automatically updated so all there is left is read +the changelogs on dev.mysql.com to see if any changes affect custom apps. + +* WHAT TO DO AFTER INSTALLATION: +================================ +The MySQL manual describes certain steps to do at this stage in a separate +chapter. They are not necessary as the Debian packages does them +automatically. + +The only thing that is left over for the admin is + - setting the passwords + - creating new users and databases + - read the rest of this text + +* DOWNGRADING TO 4.0 or 4.1: +============================ +Unsupported. Period. +But if you do and get problems or make interesting experiences, mail me, it +might help others. +Ok, if you really want, I would recommend to "mysqldump --opt" all tables, +then purge 4.1, delete /var/lib/mysql, install 4.0 and insert the dumps. Be +carefully, though, with the "mysql" table, you might not simply overwrite that +one as the password for the mysql "debian-sys-maint" user is stored in +/etc/mysql/debian.cnf and needed by /etc/init.d/ to start mysql and check if +it's alive. + +* SOME APPLICATION CAN NO LONGER CONNECT: +========================================= +This application is probably linked against libmysqlclient12 or below and +somebody has created a mysql user with new-style passwords. +The old_passwords=1 option in /etc/mysql/my.cnf might help. If not the +application that inserted the user has to be changed or the application that +tries to connect updated to libmysqlclient14 or -15. + +* NETWORKING: +============= +For security reasons, the Debian package has enabled networking only on the +loop-back device using "bind-address" in /etc/mysql/my.cnf. Check with +"netstat -tlnp" where it is listening. If your connection is aborted +immediately see if "mysqld: all" or similar is in /etc/hosts.allow and read +hosts_access(5). + +* WHERE IS THE DOCUMENTATION?: +============================== +Unfortunately due to licensing restrictions, debian currently not able +to provide the mysql-doc package in any format. For the most up to date +documentation, please go to http://dev.mysql.com/doc. + +* PASSWORDS: +============ +It is strongly recommended to set a password for the mysql root user (which + /usr/bin/mysql -u root -D mysql -e "update user set password=password('new-password') where user='root'" + /usr/bin/mysql -u root -e "flush privileges" +If you already had a password set add "-p" before "-u" to the lines above. + + +If you are tired to type the password in every time or want to automate your +scripts you can store it in the file $HOME/.my.cnf. It should be chmod 0600 +(-rw------- username username .my.cnf) to ensure that nobody else can read +it. Every other configuration parameter can be stored there, too. You will +find an example below and more information in the MySQL manual in +/usr/share/doc/mysql-doc or www.mysql.com. + +ATTENTION: It is necessary, that a .my.cnf from root always contains a "user" +line wherever there is a "password" line, else, the Debian maintenance +scripts, that use /etc/mysql/debian.cnf, will use the username +"debian-sys-maint" but the password that is in root's .my.cnf. Also note, +that every change you make in the /root/.my.cnf will affect the mysql cron +script, too. + + # an example of $HOME/.my.cnf + [client] + user = your-mysql-username + password = enter-your-good-new-password-here + +* BIG_ROWS FOR EVEN MORE ROWS IN A TABLE: +========================================= +If you ever run out of rows in a table there is the possibility of building +the package with "-DBIG_ROWS" which, according to a MySQL employee on +packagers@lists.mysql.com should lead to a 64bit row index (I guess > 2^32 +rows) but also to an approx. 5% performance loss. + +* BerkeleyDB Storage Engine +=========================== +Support for BerkeleyDB has been removed in 5.1, and consequently both the +have-bdb and skip-bdb configuration options will cause the server to fail. +Removing the options from /etc/mysql/my.cnf will fix this problem. + +* FURTHER NOTES ON REPLICATION +=============================== +If the MySQL server is acting as a replication slave, you should not +set --tmpdir to point to a directory on a memory-based filesystem or to +a directory that is cleared when the server host restarts. A replication +slave needs some of its temporary files to survive a machine restart so +that it can replicate temporary tables or LOAD DATA INFILE operations. If +files in the temporary file directory are lost when the server restarts, +replication fails. diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.config b/storage/xtradb/build/debian/percona-xtradb-server-5.1.config new file mode 100644 index 00000000000..75f81c4e4d1 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.config @@ -0,0 +1,46 @@ +#!/bin/bash -e + +. /usr/share/debconf/confmodule + +if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi +${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } + +CNF=/etc/mysql/my.cnf + +# Beware that there are two ypwhich one of them needs the 2>/dev/null! +if test -n "`which ypwhich 2>/dev/null`" && ypwhich >/dev/null 2>&1; then + db_input high percona-xtradb-server-5.1/nis_warning || true + db_go +fi + +# only ask this question on fresh installs, during "reconfiguration" and when +# not upgrading from an existing 5.0 installation. +# there is also an additional check for empty root passwords in the +# postinst script when the tools are available for us to use. +if [ "$1" = "configure" ] && ([ -z "$2" ] && [ ! -e "/var/lib/mysql/debian-5.0.flag" ] ) || [ "$1" = "reconfigure" ]; then + while :; do + RET="" + db_input high percona-xtradb-server/root_password || true + db_go + db_get percona-xtradb-server/root_password + # if password isn't empty we ask for password verification + if [ -z "$RET" ]; then + db_fset percona-xtradb-server/root_password seen false + db_fset percona-xtradb-server/root_password_again seen false + break + fi + ROOT_PW="$RET" + db_input high percona-xtradb-server/root_password_again || true + db_go + db_get percona-xtradb-server/root_password_again + if [ "$RET" == "$ROOT_PW" ]; then + ROOT_PW='' + break + fi + db_fset percona-xtradb-server/password_mismatch seen false + db_input critical percona-xtradb-server/password_mismatch + db_set percona-xtradb-server/root_password "" + db_set percona-xtradb-server/root_password_again "" + db_go + done +fi diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.dirs b/storage/xtradb/build/debian/percona-xtradb-server-5.1.dirs new file mode 100644 index 00000000000..29c2e756a00 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.dirs @@ -0,0 +1,9 @@ +etc/init.d +etc/logrotate.d +etc/mysql/conf.d +usr/bin +usr/sbin +usr/share/man/man8 +usr/share/mysql +var/run/mysqld +var/lib/mysql-upgrade diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.docs b/storage/xtradb/build/debian/percona-xtradb-server-5.1.docs new file mode 100644 index 00000000000..eccf2c9c565 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.docs @@ -0,0 +1 @@ +EXCEPTIONS-CLIENT diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.files b/storage/xtradb/build/debian/percona-xtradb-server-5.1.files new file mode 100644 index 00000000000..4741b588136 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.files @@ -0,0 +1,53 @@ +usr/lib/mysql/*so* +etc/mysql/debian-start +etc/mysql/conf.d/mysqld_safe_syslog.cnf +usr/bin/msql2mysql +usr/bin/my_print_defaults +usr/bin/myisamchk +usr/bin/myisamlog +usr/bin/myisampack +usr/bin/mysql_convert_table_format +usr/bin/mysql_fix_privilege_tables +usr/bin/mysql_install_db +usr/bin/mysql_secure_installation +usr/bin/mysql_setpermission +usr/bin/mysql_tzinfo_to_sql +usr/bin/mysql_upgrade +usr/bin/mysql_zap +usr/bin/mysqlbinlog +usr/bin/mysqld_multi +usr/bin/mysqld_safe +usr/bin/mysqlhotcopy +usr/bin/mysqltest +usr/bin/perror +usr/bin/replace +usr/bin/resolve_stack_dump +usr/bin/resolveip +usr/sbin/mysqld +usr/share/doc/percona-xtradb-server-5.1/ +usr/share/lintian/overrides/percona-xtradb-server-5.1 +usr/share/man/man1/msql2mysql.1 +usr/share/man/man1/myisamchk.1 +usr/share/man/man1/myisamlog.1 +usr/share/man/man1/myisampack.1 +usr/share/man/man1/my_print_defaults.1 +usr/share/man/man1/mysqlbinlog.1 +usr/share/man/man1/mysql_convert_table_format.1 +usr/share/man/man1/mysqld_multi.1 +usr/share/man/man1/mysqld_safe.1 +usr/share/man/man1/mysql_fix_privilege_tables.1 +usr/share/man/man1/mysqlhotcopy.1 +usr/share/man/man1/mysql_install_db.1 +usr/share/man/man1/mysql_secure_installation.1 +usr/share/man/man1/mysql_setpermission.1 +usr/share/man/man1/mysql_upgrade.1 +usr/share/man/man1/mysqltest.1 +usr/share/man/man1/mysql_zap.1 +usr/share/man/man1/perror.1 +usr/share/man/man1/replace.1 +usr/share/man/man1/resolveip.1 +usr/share/man/man1/resolve_stack_dump.1 +usr/share/man/man1/innochecksum.1 +usr/share/man/man1/mysql_tzinfo_to_sql.1 +usr/share/man/man8/mysqld.8 +usr/share/mysql/ diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.links b/storage/xtradb/build/debian/percona-xtradb-server-5.1.links new file mode 100644 index 00000000000..082680fe5ed --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.links @@ -0,0 +1,2 @@ +usr/share/mysql/mysql-test/mysql-test-run.pl usr/share/mysql/mysql-test/mysql-test-run +usr/share/mysql/mysql-test/mysql-test-run.pl usr/share/mysql/mysql-test/mtr diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.lintian-overrides b/storage/xtradb/build/debian/percona-xtradb-server-5.1.lintian-overrides new file mode 100644 index 00000000000..a3ffb465fd5 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.lintian-overrides @@ -0,0 +1,4 @@ +percona-xtradb-server-5.1: possible-bashism-in-maintainer-script postinst:81 'p{("a".."z","A".."Z",0..9)[int(rand(62))]}' +percona-xtradb-server-5.1: possible-bashism-in-maintainer-script preinst:33 '${cmd/ */}' +percona-xtradb-server-5.1: statically-linked-binary ./usr/bin/mysql_tzinfo_to_sql +percona-xtradb-server-5.1: statically-linked-binary ./usr/sbin/mysqld diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.paranoid b/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.paranoid new file mode 100644 index 00000000000..00cc5c3e29d --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.paranoid @@ -0,0 +1,9 @@ +/etc/init.d/mysql\[[0-9]+\]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists\!$ +/etc/init.d/mysql\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$ +/etc/mysql/debian-start\[[0-9]+\]: Checking for crashed MySQL tables\.$ +mysqld\[[0-9]+\]: $ +mysqld\[[0-9]+\]: Version: .* socket: '/var/run/mysqld/mysqld.sock' port: 3306$ +mysqld\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$ +mysqld_safe\[[0-9]+\]: started$ +usermod\[[0-9]+\]: change user `mysql' GID from `([0-9]+)' to `\1'$ +usermod\[[0-9]+\]: change user `mysql' shell from `/bin/false' to `/bin/false'$ diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.server b/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.server new file mode 100644 index 00000000000..37f25cb01ea --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.server @@ -0,0 +1,32 @@ +/etc/init.d/mysql\[[0-9]+\]: [0-9]+ processes alive and '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$ +/etc/init.d/mysql\[[0-9]+\]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists\!$ +/etc/init.d/mysql\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$ +/etc/mysql/debian-start\[[0-9]+\]: Checking for crashed MySQL tables\.$ +mysqld\[[0-9]+\]: ?$ +mysqld\[[0-9]+\]: .*InnoDB: Shutdown completed +mysqld\[[0-9]+\]: .*InnoDB: Started; +mysqld\[[0-9]+\]: .*InnoDB: Starting shutdown\.\.\.$ +mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Normal shutdown$ +mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: ready for connections\.$ +mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Shutdown complete$ +mysqld\[[0-9]+\]: /usr/sbin/mysqld: ready for connections\.$ +mysqld\[[0-9]+\]: .*/usr/sbin/mysqld: Shutdown Complete$ +mysqld\[[0-9]+\]: Version: .* socket +mysqld\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$ +mysqld_safe\[[0-9]+\]: ?$ +mysqld_safe\[[0-9]+\]: able to use the new GRANT command!$ +mysqld_safe\[[0-9]+\]: ended$ +mysqld_safe\[[0-9]+\]: http://www.mysql.com$ +mysqld_safe\[[0-9]+\]: NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run$ +mysqld_safe\[[0-9]+\]: PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !$ +mysqld_safe\[[0-9]+\]: Please report any problems with the /usr/bin/mysqlbug script!$ +mysqld_safe\[[0-9]+\]: See the manual for more instructions.$ +mysqld_safe\[[0-9]+\]: started$ +mysqld_safe\[[0-9]+\]: Support MySQL by buying support/licenses at https://order.mysql.com$ +mysqld_safe\[[0-9]+\]: The latest information about MySQL is available on the web at$ +mysqld_safe\[[0-9]+\]: the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be$ +mysqld_safe\[[0-9]+\]: To do so, start the server, then issue the following commands:$ +mysqld_safe\[[0-9]+\]: /usr/bin/mysqladmin -u root -h app109 password 'new-password'$ +mysqld_safe\[[0-9]+\]: /usr/bin/mysqladmin -u root password 'new-password'$ +usermod\[[0-9]+\]: change user `mysql' GID from `([0-9]+)' to `\1'$ +usermod\[[0-9]+\]: change user `mysql' shell from `/bin/false' to `/bin/false'$ diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.workstation b/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.workstation new file mode 100644 index 00000000000..37f25cb01ea --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.logcheck.ignore.workstation @@ -0,0 +1,32 @@ +/etc/init.d/mysql\[[0-9]+\]: [0-9]+ processes alive and '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$ +/etc/init.d/mysql\[[0-9]+\]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists\!$ +/etc/init.d/mysql\[[0-9]+\]: '/usr/bin/mysqladmin --defaults-(extra-)?file=/etc/mysql/debian.cnf ping' resulted in$ +/etc/mysql/debian-start\[[0-9]+\]: Checking for crashed MySQL tables\.$ +mysqld\[[0-9]+\]: ?$ +mysqld\[[0-9]+\]: .*InnoDB: Shutdown completed +mysqld\[[0-9]+\]: .*InnoDB: Started; +mysqld\[[0-9]+\]: .*InnoDB: Starting shutdown\.\.\.$ +mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Normal shutdown$ +mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: ready for connections\.$ +mysqld\[[0-9]+\]: .*\[Note\] /usr/sbin/mysqld: Shutdown complete$ +mysqld\[[0-9]+\]: /usr/sbin/mysqld: ready for connections\.$ +mysqld\[[0-9]+\]: .*/usr/sbin/mysqld: Shutdown Complete$ +mysqld\[[0-9]+\]: Version: .* socket +mysqld\[[0-9]+\]: Warning: Ignoring user change to 'mysql' because the user was set to 'mysql' earlier on the command line$ +mysqld_safe\[[0-9]+\]: ?$ +mysqld_safe\[[0-9]+\]: able to use the new GRANT command!$ +mysqld_safe\[[0-9]+\]: ended$ +mysqld_safe\[[0-9]+\]: http://www.mysql.com$ +mysqld_safe\[[0-9]+\]: NOTE: If you are upgrading from a MySQL <= 3.22.10 you should run$ +mysqld_safe\[[0-9]+\]: PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !$ +mysqld_safe\[[0-9]+\]: Please report any problems with the /usr/bin/mysqlbug script!$ +mysqld_safe\[[0-9]+\]: See the manual for more instructions.$ +mysqld_safe\[[0-9]+\]: started$ +mysqld_safe\[[0-9]+\]: Support MySQL by buying support/licenses at https://order.mysql.com$ +mysqld_safe\[[0-9]+\]: The latest information about MySQL is available on the web at$ +mysqld_safe\[[0-9]+\]: the /usr/bin/mysql_fix_privilege_tables. Otherwise you will not be$ +mysqld_safe\[[0-9]+\]: To do so, start the server, then issue the following commands:$ +mysqld_safe\[[0-9]+\]: /usr/bin/mysqladmin -u root -h app109 password 'new-password'$ +mysqld_safe\[[0-9]+\]: /usr/bin/mysqladmin -u root password 'new-password'$ +usermod\[[0-9]+\]: change user `mysql' GID from `([0-9]+)' to `\1'$ +usermod\[[0-9]+\]: change user `mysql' shell from `/bin/false' to `/bin/false'$ diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.mysql.init b/storage/xtradb/build/debian/percona-xtradb-server-5.1.mysql.init new file mode 100644 index 00000000000..0e0d4f9987f --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.mysql.init @@ -0,0 +1,182 @@ +#!/bin/bash +# +### BEGIN INIT INFO +# Provides: mysql +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Should-Start: $network $named $time +# Should-Stop: $network $named $time +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start and stop the mysql database server daemon +# Description: Controls the main MySQL database server daemon "mysqld" +# and its wrapper script "mysqld_safe". +### END INIT INFO +# +set -e +set -u +${DEBIAN_SCRIPT_DEBUG:+ set -v -x} + +test -x /usr/sbin/mysqld || exit 0 + +. /lib/lsb/init-functions + +SELF=$(cd $(dirname $0); pwd -P)/$(basename $0) +CONF=/etc/mysql/my.cnf +MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" + +# priority can be overriden and "-s" adds output to stderr +ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql -i" + +# Safeguard (relative paths, core dumps..) +cd / +umask 077 + +# mysqladmin likes to read /root/.my.cnf. This is usually not what I want +# as many admins e.g. only store a password without a username there and +# so break my scripts. +export HOME=/etc/mysql/ + +## Fetch a particular option from mysql's invocation. +# +# Usage: void mysqld_get_param option +mysqld_get_param() { + /usr/sbin/mysqld --print-defaults \ + | tr " " "\n" \ + | grep -- "--$1" \ + | tail -n 1 \ + | cut -d= -f2 +} + +## Do some sanity checks before even trying to start mysqld. +sanity_checks() { + # check for config file + if [ ! -r /etc/mysql/my.cnf ]; then + log_warning_msg "$0: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz" + echo "WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz" | $ERR_LOGGER + fi + + # check for diskspace shortage + datadir=`mysqld_get_param datadir` + if LC_ALL=C BLOCKSIZE= df --portability $datadir/. | tail -n 1 | awk '{ exit ($4>4096) }'; then + log_failure_msg "$0: ERROR: The partition with $datadir is too full!" + echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER + exit 1 + fi +} + +## Checks if there is a server running and if so if it is accessible. +# +# check_alive insists on a pingable server +# check_dead also fails if there is a lost mysqld in the process list +# +# Usage: boolean mysqld_status [check_alive|check_dead] [warn|nowarn] +mysqld_status () { + ping_output=`$MYADMIN ping 2>&1`; ping_alive=$(( ! $? )) + + ps_alive=0 + pidfile=`mysqld_get_param pid-file` + if [ -f "$pidfile" ] && ps `cat $pidfile` >/dev/null 2>&1; then ps_alive=1; fi + + if [ "$1" = "check_alive" -a $ping_alive = 1 ] || + [ "$1" = "check_dead" -a $ping_alive = 0 -a $ps_alive = 0 ]; then + return 0 # EXIT_SUCCESS + else + if [ "$2" = "warn" ]; then + echo -e "$ps_alive processes alive and '$MYADMIN ping' resulted in\n$ping_output\n" | $ERR_LOGGER -p daemon.debug + fi + return 1 # EXIT_FAILURE + fi +} + +# +# main() +# + +case "${1:-''}" in + 'start') + sanity_checks; + # Start daemon + log_daemon_msg "Starting MySQL database server" "mysqld" + if mysqld_status check_alive nowarn; then + log_progress_msg "already running" + log_end_msg 0 + else + /usr/bin/mysqld_safe > /dev/null 2>&1 & + # 6s was reported in #352070 to be too few when using ndbcluster + for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do + sleep 1 + if mysqld_status check_alive nowarn ; then break; fi + log_progress_msg "." + done + if mysqld_status check_alive warn; then + log_end_msg 0 + # Now start mysqlcheck or whatever the admin wants. + output=$(/etc/mysql/debian-start) + [ -n "$output" ] && log_action_msg "$output" + else + log_end_msg 1 + log_failure_msg "Please take a look at the syslog" + fi + fi + ;; + + 'stop') + # * As a passwordless mysqladmin (e.g. via ~/.my.cnf) must be possible + # at least for cron, we can rely on it here, too. (although we have + # to specify it explicit as e.g. sudo environments points to the normal + # users home and not /root) + log_daemon_msg "Stopping MySQL database server" "mysqld" + if ! mysqld_status check_dead nowarn; then + set +e + shutdown_out=`$MYADMIN shutdown 2>&1`; r=$? + set -e + if [ "$r" -ne 0 ]; then + log_end_msg 1 + [ "$VERBOSE" != "no" ] && log_failure_msg "Error: $shutdown_out" + log_daemon_msg "Killing MySQL database server by signal" "mysqld" + killall -15 mysqld + server_down= + for i in 1 2 3 4 5 6 7 8 9 10; do + sleep 1 + if mysqld_status check_dead nowarn; then server_down=1; break; fi + done + if test -z "$server_down"; then killall -9 mysqld; fi + fi + fi + + if ! mysqld_status check_dead warn; then + log_end_msg 1 + log_failure_msg "Please stop MySQL manually and read /usr/share/doc/percona-xtradb-server-5.1/README.Debian.gz!" + exit -1 + else + log_end_msg 0 + fi + ;; + + 'restart') + set +e; $SELF stop; set -e + $SELF start + ;; + + 'reload'|'force-reload') + log_daemon_msg "Reloading MySQL database server" "mysqld" + $MYADMIN reload + log_end_msg 0 + ;; + + 'status') + if mysqld_status check_alive nowarn; then + log_action_msg "$($MYADMIN version)" + else + log_action_msg "MySQL is stopped." + exit 3 + fi + ;; + + *) + echo "Usage: $SELF start|stop|restart|reload|force-reload|status" + exit 1 + ;; +esac + diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.percona-xtradb-server.logrotate b/storage/xtradb/build/debian/percona-xtradb-server-5.1.percona-xtradb-server.logrotate new file mode 100644 index 00000000000..0f0de516b13 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.percona-xtradb-server.logrotate @@ -0,0 +1,27 @@ +# - I put everything in one block and added sharedscripts, so that mysql gets +# flush-logs'd only once. +# Else the binary logs would automatically increase by n times every day. +# - The error log is obsolete, messages go to syslog now. +/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log { + daily + rotate 7 + missingok + create 640 mysql adm + compress + sharedscripts + postrotate + test -x /usr/bin/mysqladmin || exit 0 + + # If this fails, check debian.conf! + MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" + if [ -z "`$MYADMIN ping 2>/dev/null`" ]; then + # Really no mysqld or rather a missing debian-sys-maint user? + # If this occurs and is not a error please report a bug. + if ps cax | grep -q mysqld; then + exit 1 + fi + else + $MYADMIN flush-logs + fi + endscript +} diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.postinst b/storage/xtradb/build/debian/percona-xtradb-server-5.1.postinst new file mode 100644 index 00000000000..24a3f37c646 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.postinst @@ -0,0 +1,277 @@ +#!/bin/bash -e + +. /usr/share/debconf/confmodule + +if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi +${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } + +export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin + +# This command can be used as pipe to syslog. With "-s" it also logs to stderr. +ERR_LOGGER="logger -p daemon.err -t mysqld_safe -i" + +invoke() { + if [ -x /usr/sbin/invoke-rc.d ]; then + invoke-rc.d mysql $1 + else + /etc/init.d/mysql $1 + fi +} + +MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables" + +test_mysql_access() { + mysql --no-defaults -u root -h localhost </dev/null >/dev/null 2>&1 +} + +# call with $1 = "online" to connect to the server, otherwise it bootstraps +set_mysql_rootpw() { + # forget we ever saw the password. don't use reset to keep the seen status + db_set percona-xtradb-server/root_password "" + + tfile=`mktemp` + if [ ! -f "$tfile" ]; then + return 1 + fi + + # this avoids us having to call "test" or "[" on $rootpw + cat << EOF > $tfile +USE mysql; +UPDATE user SET password=PASSWORD("$rootpw") WHERE user='root'; +FLUSH PRIVILEGES; +EOF + if grep -q 'PASSWORD("")' $tfile; then + retval=0 + elif [ "$1" = "online" ]; then + mysql --no-defaults -u root -h localhost <$tfile >/dev/null + retval=$? + else + $MYSQL_BOOTSTRAP <$tfile + retval=$? + fi + rm -f $tfile + return $retval +} + +# This is necessary because mysql_install_db removes the pid file in /var/run +# and because changed configuration options should take effect immediately. +# In case the server wasn't running at all it should be ok if the stop +# script fails. I can't tell at this point because of the cleaned /var/run. +set +e; invoke stop; set -e + +case "$1" in + configure) + mysql_datadir=/usr/share/mysql + mysql_statedir=/var/lib/mysql + mysql_rundir=/var/run/mysqld + mysql_logdir=/var/log + mysql_cfgdir=/etc/mysql + mysql_newlogdir=/var/log/mysql + mysql_upgradedir=/var/lib/mysql-upgrade + + # first things first, if the following symlink exists, it is a preserved + # copy the old data dir from a mysql upgrade that would have otherwise + # been replaced by an empty mysql dir. this should restore it. + for dir in DATADIR LOGDIR; do + if [ "$dir" = "DATADIR" ]; then targetdir=$mysql_statedir; else targetdir=$mysql_newlogdir; fi + savelink="$mysql_upgradedir/$dir.link" + if [ -L "$savelink" ]; then + # If the targetdir was a symlink before we upgraded it is supposed + # to be either still be present or not existing anymore now. + if [ -L "$targetdir" ]; then + rm "$savelink" + elif [ ! -d "$targetdir" ]; then + mv "$savelink" "$targetdir" + else + # this should never even happen, but just in case... + mysql_tmp=`mktemp -d -t mysql-symlink-restore-XXXXXX` + echo "this is very strange! see $mysql_tmp/README..." >&2 + mv "$targetdir" "$mysql_tmp" + cat << EOF > "$mysql_tmp/README" + +if you're reading this, it's most likely because you had replaced /var/lib/mysql +with a symlink, then upgraded to a new version of mysql, and then dpkg +removed your symlink (see #182747 and others). the mysql packages noticed +that this happened, and as a workaround have restored it. however, because +/var/lib/mysql seems to have been re-created in the meantime, and because +we don't want to rm -rf something we don't know as much about, we're going +to leave this unexpected directory here. if your database looks normal, +and this is not a symlink to your database, you should be able to blow +this all away. + +EOF + fi + fi + rmdir $mysql_upgradedir 2>/dev/null || true + done + + # Ensure the existence and right permissions for the database and + # log files. + if [ ! -d "$mysql_statedir" -a ! -L "$mysql_statedir" ]; then mkdir "$mysql_statedir"; fi + if [ ! -d "$mysql_statedir/mysql" -a ! -L "$mysql_statedir/mysql" ]; then mkdir "$mysql_statedir/mysql"; fi + if [ ! -d "$mysql_newlogdir" -a ! -L "$mysql_newlogdir" ]; then mkdir "$mysql_newlogdir"; fi + # When creating an ext3 jounal on an already mounted filesystem like e.g. + # /var/lib/mysql, you get a .journal file that is not modifyable by chown. + # The mysql_datadir must not be writable by the mysql user under any + # circumstances as it contains scripts that are executed by root. + set +e + chown -R 0:0 $mysql_datadir + chown -R mysql $mysql_statedir + chown -R mysql $mysql_rundir + chown -R mysql:adm $mysql_newlogdir; chmod 2750 $mysql_newlogdir; + for i in log err; do + touch $mysql_logdir/mysql.$i + chown mysql:adm $mysql_logdir/mysql.$i + chmod 0640 $mysql_logdir/mysql.$i + done + set -e + + # This is important to avoid dataloss when there is a removed + # percona-xtradb-server version from Woody lying around which used the same + # data directory and then somewhen gets purged by the admin. + db_set percona-xtradb-server/postrm_remove_database false || true + + # To avoid downgrades. + touch $mysql_statedir/debian-5.1.flag + + # initiate databases. Output is not allowed by debconf :-( + # Debian: beware of the bashisms... + # Debian: can safely run on upgrades with existing databases + set +e + /bin/bash /usr/bin/mysql_install_db --rpm 2>&1 | $ERR_LOGGER + if [ "$?" != "0" ]; then + echo "ATTENTION: An error has occured. More info is in the syslog!" + fi + set -e + + ## On every reconfiguration the maintenance user is recreated. + # + # - It is easier to regenerate the password every time but as people + # use fancy rsync scripts and file alteration monitors, the existing + # password is used and existing files not touched. + # - The mysqld statement is like that in mysql_install_db because the + # server is not already running. This has some implications: + # - The amount of newlines and semicolons in the query is important! + # - GRANT is not possible with --skip-grant-tables and "INSERT + # (user,host..) VALUES" is not --ansi compliant + # - The echo is just for readability. ash's buildin has no "-e" so use /bin/echo. + # - The Super_priv, Show_db_priv, Create_tmp_table_priv and Lock_tables_priv + # may not be present as old Woody 3.23 databases did not have it and the + # admin might not already have run mysql_upgrade which adds them. + # As the binlog cron scripts to need at least the Super_priv, I do first + # the old query which always succeeds and then the new which may or may not. + + # recreate the credentials file if not present or without mysql_upgrade stanza + dc=$mysql_cfgdir/debian.cnf; + if [ -e "$dc" -a -n "`fgrep mysql_upgrade $dc 2>/dev/null`" ]; then + pass="`sed -n 's/^[ ]*password *= *// p' $dc | head -n 1`" + else + pass=`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)'`; + if [ ! -d "$mysql_cfgdir" ]; then install -o 0 -g 0 -m 0755 -d $mysql_cfgdir; fi + cat /dev/null > $dc + echo "# Automatically generated for Debian scripts. DO NOT TOUCH!" >>$dc + echo "[client]" >>$dc + echo "host = localhost" >>$dc + echo "user = debian-sys-maint" >>$dc + echo "password = $pass" >>$dc + echo "socket = $mysql_rundir/mysqld.sock" >>$dc + echo "[mysql_upgrade]" >>$dc + echo "host = localhost" >>$dc + echo "user = debian-sys-maint" >>$dc + echo "password = $pass" >>$dc + echo "socket = $mysql_rundir/mysqld.sock" >>$dc + echo "basedir = /usr" >>$dc + fi + # If this dir chmod go+w then the admin did it. But this file should not. + chown 0:0 $dc + chmod 0600 $dc + + # update privilege tables + password_column_fix_query=`/bin/echo -e \ + "USE mysql\n" \ + "ALTER TABLE user CHANGE Password Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL"`; + replace_query=`/bin/echo -e \ + "USE mysql\n" \ + "REPLACE INTO user SET " \ + " host='localhost', user='debian-sys-maint', password=password('$pass'), " \ + " Select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', " \ + " Create_priv='Y', Drop_priv='Y', Reload_priv='Y', Shutdown_priv='Y', " \ + " Process_priv='Y', File_priv='Y', Grant_priv='Y', References_priv='Y', " \ + " Index_priv='Y', Alter_priv='Y', Super_priv='Y', Show_db_priv='Y', "\ + " Create_tmp_table_priv='Y', Lock_tables_priv='Y', Execute_priv='Y', "\ + " Repl_slave_priv='Y', Repl_client_priv='Y', Create_view_priv='Y', "\ + " Show_view_priv='Y', Create_routine_priv='Y', Alter_routine_priv='Y', "\ + " Create_user_priv='Y', Event_priv='Y', Trigger_priv='Y' "`; + fix_privs=`/bin/echo -e \ + "USE mysql;\n" \ + "ALTER TABLE user ADD column Create_view_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \ + "ALTER TABLE user ADD column Show_view_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \ + "ALTER TABLE user ADD column Create_routine_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \ + "ALTER TABLE user ADD column Alter_routine_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \ + "ALTER TABLE user ADD column Create_user_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \ + "ALTER TABLE user ADD column Event_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " \ + "ALTER TABLE user ADD column Trigger_priv enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N'; " ` + # Engines supported by etch should be installed per default. The query sequence is supposed + # to be aborted if the CREATE TABLE fails due to an already existent table in which case the + # admin might already have chosen to remove one or more plugins. Newlines are necessary. + install_plugins=`/bin/echo -e \ + "USE mysql;\n" \ + "CREATE TABLE plugin (name char(64) COLLATE utf8_bin NOT NULL DEFAULT '', " \ + " dl char(128) COLLATE utf8_bin NOT NULL DEFAULT '', " \ + " PRIMARY KEY (name)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='MySQL plugins';\n" \ + "INSERT INTO plugin VALUES ('innodb', 'ha_innodb.so');\n" \ + "INSERT INTO plugin VALUES ('federated', 'ha_federated.so');\n" \ + "INSERT INTO plugin VALUES ('blackhole', 'ha_blackhole.so');\n" \ + "INSERT INTO plugin VALUES ('archive', 'ha_archive.so');" ` + + # Upgrade password column format before the root password gets set. + echo "$password_column_fix_query" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER + + db_get percona-xtradb-server/root_password && rootpw="$RET" + if ! set_mysql_rootpw; then + password_error="yes" + fi + + echo "$fix_privs" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER + echo "$replace_query" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER + set +e + echo "$install_plugins" | $MYSQL_BOOTSTRAP 2>&1 | $ERR_LOGGER + set -e + ;; + + abort-upgrade|abort-remove|abort-configure) + ;; + + *) + echo "postinst called with unknown argument '$1'" 1>&2 + exit 1 + ;; +esac + +# here we check to see if we can connect as root without a password +# this should catch upgrades from previous versions where the root +# password wasn't set. if there is a password, or if the connection +# fails for any other reason, nothing happens. +if [ "$1" = "configure" ]; then + if test_mysql_access; then + db_input medium percona-xtradb-server/root_password || true + db_go + db_get percona-xtradb-server/root_password && rootpw="$RET" + + if ! set_mysql_rootpw "online"; then + password_error="yes" + fi + fi + + if [ "$password_error" = "yes" ]; then + db_input high percona-xtradb-server/error_setting_password || true + db_go + fi + +fi + +db_stop # in case invoke failes + +#DEBHELPER# + +exit 0 diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.postrm b/storage/xtradb/build/debian/percona-xtradb-server-5.1.postrm new file mode 100644 index 00000000000..083a42bd861 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.postrm @@ -0,0 +1,83 @@ +#!/bin/bash -e + +# It is possible that Debconf has already been removed, too. +if [ -f /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule +fi + +if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi +${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } + +MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" + +# Try to stop the server in a sane way. If it does not success let the admin +# do it himself. No database directories should be removed while the server +# is running! +stop_server() { + set +e + if [ -x /usr/sbin/invoke-rc.d ]; then + invoke-rc.d mysql stop + else + /etc/init.d/mysql stop + fi + errno=$? + set -e + + if [ "$?" != 0 ]; then + echo "Trying to stop the MySQL server resulted in exitcode $?." 1>&2 + echo "Stop it yourself and try again!" 1>&2 + exit 1 + fi +} + +case "$1" in + purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + if [ -n "`$MYADMIN ping 2>/dev/null`" ]; then + stop_server + sleep 2 + fi + ;; + *) + echo "postrm called with unknown argument '$1'" 1>&2 + exit 1 + ;; +esac + +# +# - Do NOT purge logs or data if another percona-xtradb-server* package is installed (#307473) +# - Remove the mysql user only after all his owned files are purged. +# +if [ "$1" = "purge" -a ! \( -x /usr/sbin/mysqld -o -L /usr/sbin/mysqld \) ]; then + # we remove the mysql user only after all his owned files are purged + rm -f /var/log/mysql.{log,err}{,.0,.[1234567].gz} + rm -rf /var/log/mysql + + db_input high percona-xtradb-server-5.1/postrm_remove_databases || true + db_go || true + db_get percona-xtradb-server-5.1/postrm_remove_databases || true + if [ "$RET" = "true" ]; then + # never remove the debian.cnf when the databases are still existing + # else we ran into big trouble on the next install! + rm -f /etc/mysql/debian.cnf + rm -rf /var/lib/mysql + rm -rf /var/run/mysqld + userdel mysql || true + fi + + # (normally) Automatically added by dh_installinit + if [ "$1" = "purge" ] ; then + update-rc.d mysql remove >/dev/null || exit 0 + fi + # (normally) End automatically added section +fi + +# (normally) Automatically added by dh_installdebconf +if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule + db_purge +fi +# (normally) End automatically added section + +# no DEBHELPER here, "update-rc.d remove" fails if percona-xtradb-server-5.1 is installed + +exit 0 diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.preinst b/storage/xtradb/build/debian/percona-xtradb-server-5.1.preinst new file mode 100644 index 00000000000..a338e4edd8f --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.preinst @@ -0,0 +1,186 @@ +#!/bin/bash -e +# +# summary of how this script can be called: +# * <new-preinst> install +# * <new-preinst> install <old-version> +# * <new-preinst> upgrade <old-version> +# * <old-preinst> abort-upgrade <new-version> +# + +. /usr/share/debconf/confmodule + +if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi +${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } + +export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin +MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" +DATADIR=/var/lib/mysql +LOGDIR=/var/log/mysql +UPGRADEDIR=/var/lib/mysql-upgrade + +# Try to stop the server in a sane way. If it does not success let the admin +# do it himself. No database directories should be removed while the server +# is running! Another mysqld in e.g. a different chroot is fine for us. +stop_server() { + if [ ! -x /etc/init.d/mysql ]; then return; fi + + set +e + if [ -x /usr/sbin/invoke-rc.d ]; then + cmd="invoke-rc.d mysql stop" + else + cmd="/etc/init.d/mysql stop" + fi + $cmd + errno=$? + set -e + + # 0=ok, 100=no init script (fresh install) + if [ "$errno" != 0 -a "$errno" != 100 ]; then + echo "${cmd/ */} returned $errno" 1>&2 + echo "There is a MySQL server running, but we failed in our attempts to stop it." 1>&2 + echo "Stop it yourself and try again!" 1>&2 + db_stop + exit 1 + fi +} + +################################ main() ########################## + +this_version=5.1 + +# Check kernel version +if dpkg --compare-versions `uname -r` lt 2.6; then + /bin/echo -e "\nPROBLEM: MySQL-5.x is currently incompatible with kernel 2.4. Aborting."; + /bin/echo -e "See http://bugs.debian.org/416841 for more information.\n" + exit 1 +fi + +# Abort if an NDB cluster is in use. +if egrep -q -r '^[^#]*ndb.connectstring' /etc/mysql/; then + db_fset percona-xtradb-server/no_upgrade_when_using_ndb seen false || true + db_input high percona-xtradb-server/no_upgrade_when_using_ndb || true + db_go + db_stop + exit 1 +fi + +# Safe the user from stupidities. +show_downgrade_warning=0 +for i in `ls $DATADIR/debian-*.flag 2>/dev/null`; do + found_version=`echo $i | sed 's/.*debian-\([0-9\.]\+\).flag/\1/'` + if dpkg --compare-versions "$this_version" '<<' "$found_version"; then + show_downgrade_warning=1 + break; + fi +done +if [ "$show_downgrade_warning" = 1 ]; then + db_fset percona-xtradb-server-$this_version/really_downgrade seen false || true + db_input medium percona-xtradb-server-$this_version/really_downgrade || true + db_go + db_get percona-xtradb-server-$this_version/really_downgrade || true + if [ "$RET" = "true" ]; then + rm -f $DATADIR/debian-*.flag + touch $DATADIR/debian-$this_version.flag + else + echo "Aborting downgrade from (at least) $found_version to $this_version." 1>&2 + echo "If are sure you want to downgrade to $this_version, remove the file" 1>&2 + echo "$DATADIR/debian-*.flag and try installing again." 1>&2 + db_stop + exit 1 + fi +fi + +# to be sure +stop_server + +# If we use NIS then errors should be tolerated. It's up to the +# user to ensure that the mysql user is correctly setup. +# Beware that there are two ypwhich one of them needs the 2>/dev/null! +if test -n "`which ypwhich 2>/dev/null`" && ypwhich >/dev/null 2>&1; then + set +e +fi + +# +# Now we have to ensure the following state: +# /etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false +# /etc/group: mysql:x:101: +# +# Sadly there could any state be present on the system so we have to +# modify everything carefully i.e. not doing a chown before creating +# the user etc... +# + +# creating mysql group if he isn't already there +if ! getent group mysql >/dev/null; then + # Adding system group: mysql. + addgroup --system mysql >/dev/null +fi + +# creating mysql user if he isn't already there +if ! getent passwd mysql >/dev/null; then + # Adding system user: mysql. + adduser \ + --system \ + --disabled-login \ + --ingroup mysql \ + --home $DATADIR \ + --gecos "MySQL Server" \ + --shell /bin/false \ + mysql >/dev/null +fi + +# end of NIS tolerance zone +set -e + +# if there's a symlink, let's store where it's pointing, because otherwise +# it's going to be lost in some situations +for dir in DATADIR LOGDIR; do + checkdir=`eval echo "$"$dir` + if [ -L "$checkdir" ]; then + mkdir -p "$UPGRADEDIR" + cp -d "$checkdir" "$UPGRADEDIR/$dir.link" + fi +done + +# creating mysql home directory +if [ ! -d $DATADIR -a ! -L $DATADIR ]; then + mkdir $DATADIR +fi + +# checking disc space +if LC_ALL=C BLOCKSIZE= df --portability $DATADIR/. | tail -n 1 | awk '{ exit ($4>1000) }'; then + echo "ERROR: There's not enough space in $DATADIR/" 1>&2 + db_stop + exit 1 +fi + +# Since the home directory was created before putting the user into +# the mysql group and moreover we cannot guarantee that the +# permissions were correctly *before* calling this script, we fix them now. +# In case we use NIS and no mysql user is present then this script should +# better fail now than later.. +# The "set +e" is necessary as e.g. a ".journal" of a ext3 partition is +# not chgrp'able (#318435). +set +e +chown mysql:mysql $DATADIR +find $DATADIR -follow -not -group mysql -print0 2>/dev/null \ + | xargs -0 --no-run-if-empty chgrp mysql +set -e + +# Some files below /etc/ were possibly in the percona-xtradb-server-5.0/etch package +# before. They get overwritten by current ones to avoid unnecessary dpkg questions. +while read md5 file; do + if [ "`md5sum $file 2>/dev/null`" = "$md5 $file" ]; then + cp /usr/share/percona-xtradb-common/internal-use-only/`echo $file | sed 's°/°_°g'` $file + fi +done <<EOT +6691f2fdc5c6d27ff0260eb79813e1bc /etc/init.d/mysql +b53b9552d44661361d39157c3c7c51d3 /etc/logrotate.d/percona-xtradb-server +57f3e58f72582ca55100dc1ba0f1a8ae /etc/mysql/debian-start +EOT + +db_stop + +#DEBHELPER# + +exit 0 diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.prerm b/storage/xtradb/build/debian/percona-xtradb-server-5.1.prerm new file mode 100644 index 00000000000..03e9ea37420 --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.prerm @@ -0,0 +1,8 @@ +#!/bin/bash -e + +. /usr/share/debconf/confmodule + +if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi +${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } + +#DEBHELPER# diff --git a/storage/xtradb/build/debian/percona-xtradb-server-5.1.templates b/storage/xtradb/build/debian/percona-xtradb-server-5.1.templates new file mode 100644 index 00000000000..efa318640db --- /dev/null +++ b/storage/xtradb/build/debian/percona-xtradb-server-5.1.templates @@ -0,0 +1,90 @@ +# These templates have been reviewed by the debian-l10n-english +# team +# +# If modifications/additions/rewording are needed, please ask +# for an advice to debian-l10n-english@lists.debian.org +# +# Even minor modifications require translation updates and such +# changes should be coordinated with translators and reviewers. + +Template: percona-xtradb-server-5.1/really_downgrade +Type: boolean +Default: false +_Description: Really proceed with downgrade? + A file named /var/lib/mysql/debian-*.flag exists on this system. + . + Such file is an indication that a percona-xtradb-server package with a higher + version has been installed earlier. + . + There is no guarantee that the version you're currently installing + will be able to use the current databases. + +Template: percona-xtradb-server-5.1/nis_warning +Type: note +#flag:translate!:3,5 +_Description: Important note for NIS/YP users + To use MySQL, the following entries for users and groups should be added + to the system: + . + /etc/passwd : mysql:x:100:101:Percona SQL Server:/var/lib/mysql:/bin/false + /etc/group : mysql:x:101: + . + You should also check the permissions and the owner of the + /var/lib/mysql directory: + . + /var/lib/mysql: drwxr-xr-x mysql mysql + +Template: percona-xtradb-server-5.1/postrm_remove_databases +Type: boolean +Default: false +_Description: Remove all Percona SQL databases? + The /var/lib/mysql directory which contains the Percona SQL databases is about + to be removed. + . + If you're removing the Percona SQL package in order to later install a more + recent version or if a different percona-xtradb-server package is already + using it, the data should be kept. + +Template: percona-xtradb-server-5.1/start_on_boot +Type: boolean +Default: true +_Description: Start the Percona SQL server on boot? + The Percona SQL server can be launched automatically at boot time or manually + with the '/etc/init.d/mysql start' command. + +Template: percona-xtradb-server/root_password +Type: password +_Description: New password for the Percona SQL "root" user: + While not mandatory, it is highly recommended that you set a password + for the Percona SQL administrative "root" user. + . + If that field is left blank, the password will not be changed. + +Template: percona-xtradb-server/root_password_again +Type: password +_Description: Repeat password for the Percona SQL "root" user: + +Template: percona-xtradb-server/error_setting_password +Type: error +_Description: Unable to set password for the Percona SQL "root" user + An error occurred while setting the password for the Percona SQL + administrative user. This may have happened because the account + already has a password, or because of a communication problem with + the Percona SQL server. + . + You should check the account's password after the package installation. + . + Please read the /usr/share/doc/percona-xtradb-server-5.1/README.Debian file + for more information. + +Template: percona-xtradb-server/password_mismatch +Type: error +_Description: Password input error + The two passwords you entered were not the same. Please try again. + +Template: percona-xtradb-server/no_upgrade_when_using_ndb +Type: error +_Description: NDB Cluster seems to be in use + Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new + mysql-cluster package and remove all lines starting with "ndb" from + all config files below /etc/mysql/. diff --git a/storage/xtradb/build/debian/po/POTFILES.in b/storage/xtradb/build/debian/po/POTFILES.in new file mode 100644 index 00000000000..b3a73d17bd1 --- /dev/null +++ b/storage/xtradb/build/debian/po/POTFILES.in @@ -0,0 +1 @@ +[type: gettext/rfc822deb] percona-xtradb-server-5.1.templates diff --git a/storage/xtradb/build/debian/po/ar.po b/storage/xtradb/build/debian/po/ar.po new file mode 100644 index 00000000000..6a51c1f8919 --- /dev/null +++ b/storage/xtradb/build/debian/po/ar.po @@ -0,0 +1,267 @@ +# translation of templates.po to Arabic +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Ossama M. Khayat <okhayat@yahoo.com>, 2007. +msgid "" +msgstr "" +"Project-Id-Version: templates\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2007-05-01 13:04+0300\n" +"Last-Translator: Ossama M. Khayat <okhayat@yahoo.com>\n" +"Language-Team: Arabic <support@arabeyes.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" +"Plural-Forms: nplurals=6; plural=n==1 ? 0 : n==0 ? 1 : n==2 ? 2: n%100>=3 && " +"n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n" +": n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n" +": n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n" +": n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n" +": n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n" +": n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n" +": n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "Really proceed with downgrade?" +msgstr "هل Ùعلاً تريد التثبيط؟" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "هناك مل٠مسمى /var/lib/mysql/debian-*.flag موجود على هذا النظام." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"هذا المل٠دلالة على أن نسخة Ø£Øدث من Øزمة mysql-server تم تثبيتها مسبقاً." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" +"ليست هناك أية ضمانة أن النسخة التي تقوم بتثبيتها ستكون قادرة على استخدام " +"قواعد البيانات الØالية." + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "Important note for NIS/YP users" +msgstr "ملاØظة هامة لمستخدمي NIS/YP" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" +"كي تستخدم MySQLØŒ يجب إضاÙØ© المÙدخلات التالية الخاصة بالمستخدمين والمجموعات " +"إلى النظام:" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "عليك أيضاً أن تقوم بالتأكد من صلاØيات مالك المل٠/var/lib/mysql: " + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "Remove all MySQL databases?" +msgid "Remove all Percona SQL databases?" +msgstr "إزالة جميع قواعد بيانات MySQLØŸ" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The /var/lib/mysql directory which contains the MySQL databases is about " +#| "to be removed." +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "الدليل /var/lib/mysql الذي ÙŠØتوي قواعد بيانات MySQL ستتم إزالته." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "If you're removing the MySQL package in order to later install a more " +#| "recent version or if a different mysql-server package is already using " +#| "it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"إن كنت تقوم بإزالة Øزمة MySQL كي تقوم لاØقاً بتثبيت نسخة Ø£Øدث أو إن كانت Øزمة " +"mysql-server مختلÙØ© تستخدمها، Ùيجب إبقاء البيانات." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Start the MySQL server on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "تشغيل خادم MySQL عند الإقلاع؟" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL server can be launched automatically at boot time or manually " +#| "with the '/etc/init.d/mysql start' command." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"يمكن تشغيل خادم MySQL آلياً وقت الإقلاع أو يدوياً باستخدام الأمر '/etc/init.d/" +"mysql start'." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "كلمة المرور الجديدة لمستخد \"root\" الخاص بـMySQL:" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "While not mandatory, it is highly recommended that you set a password for " +#| "the MySQL administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"مع أنه ليس إجبارياً، ولكن من المستØسن أن تقوم بتعيين كلمة مرور خاصة بمستخدم " +"MySQL الإداري \"root\"." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "إن ترك الØقل Ùارغاً، Ùلن يتم تغيير كلمة المرور." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "كلمة المرور الجديدة لمستخد \"root\" الخاص بـMySQL:" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for the MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "تعذر تعيين كلمة مرور للمستخدم \"root\" الخاص بـMySQL." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "An error occurred while setting the password for the MySQL administrative " +#| "user. This may have happened because the account already has a password, " +#| "or because of a communication problem with the MySQL server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"Øدث خطأ أثناء تعيين كلمة المرور لمستخدم MySQL الإداري. قد يكون هذا Øدث بسبب " +"أن Øساب المستخدم له كلمة مرور معيّنة مسبقاً، أو بسبب مشكلة ÙÙŠ الاتصال مع خادم " +"MySQL." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "You should check the account's password after tha package installation." +msgid "You should check the account's password after the package installation." +msgstr "يجب عليك التØقق من كلمة مرور الØساب عقب تثبيت الØزمة." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " +#| "more information." +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" +"الرجاء قراءة المل٠/usr/share/doc/mysql-server-5.1/README.Debian للمزيد من " +"المعلومات." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "هل تريد دعم اتصالات MySQL من الأجهزة التي تعمل على ديبيان \"sarge\" أو " +#~ "أقدم؟" + +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "ÙÙŠ إصدارات عملاء MySQL القديمة من ديبيان، لم تكن كلمات المرور تØÙظ بشكل " +#~ "آمن. ولقد ØÙ„ هذه المشكلة بعدها، غير أن العملاء (مثل PHP) المتصلين من " +#~ "أجهزة تعمل على ديبيان Sarge 3.1 لن يكونوا قادرين على الاتصال باستخدام " +#~ "الØسابات الØديثة أو الØسابات التي تم تغيير كلمة مرورها." diff --git a/storage/xtradb/build/debian/po/ca.po b/storage/xtradb/build/debian/po/ca.po new file mode 100644 index 00000000000..94fadb6d5df --- /dev/null +++ b/storage/xtradb/build/debian/po/ca.po @@ -0,0 +1,342 @@ +# mysql-dfsg (debconf) translation to Catalan. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. +# Aleix Badia i Bosch <abadia@ica.es> 2004 +# +msgid "" +msgstr "" +"Project-Id-Version: mysql-dfsg-4.1\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2004-01-31 19:20GMT\n" +"Last-Translator: Aleix Badia i Bosch <abadia@ica.es>\n" +"Language-Team: Debian L10n Catalan <debian-l10n-catalan@lists.debian.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "Really proceed with downgrade?" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +#, fuzzy +#| msgid "Important note for NIS/YP users!" +msgid "Important note for NIS/YP users" +msgstr "Nota important pels usuaris de NIS/YP" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "Remove all Percona SQL databases?" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Should MySQL start on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "Voleu que el MySQL s'iniciï a l'arrencada ?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"El MySQL es pot executar a l'arrencada o només si executeu manualment '/etc/" +"init.d/mysql start'. Seleccioneu 'sí' si voleu que s'inicialitzi " +"automàticament." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "New password for the Percona SQL \"root\" user:" +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "You should check the account's password after the package installation." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#, fuzzy +#~ msgid "" +#~ "To use mysql you must install an equivalent user and group to the " +#~ "following and ensure yourself that /var/lib/mysql has the right " +#~ "permissions (the uid/gid may be different)." +#~ msgstr "" +#~ "Per utilitzar la base de dades de MySQL heu d'afegir un usuari i grup " +#~ "equivalent al següent i assegurar-vos que el directori /var/lib/mysql " +#~ "tingui els permisos correctes." + +#~ msgid "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" +#~ msgstr "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" + +#~ msgid "/etc/group: mysql:x:101:" +#~ msgstr "/etc/group: mysql:x:101:" + +#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql" +#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql" + +#, fuzzy +#~ msgid "Please also read http://www.mysql.com/doc/en/Upgrade.html" +#~ msgstr "" +#~ "Feu una ullada al document: http://www.mysql.com/doc/en/Upgrade.html" + +#, fuzzy +#~ msgid "" +#~ "MySQL will only install if you have a non-numeric hostname that is " +#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command " +#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 " +#~ "myhostname\"." +#~ msgstr "" +#~ "El MySQL només s'instal·la en cas de tenir un nom d'ordinador central que " +#~ "no sigui numèric i que es pugui resoldre a través del fitxer /etc/hosts. " +#~ "Ex. si l'ordre \"hostname\" retorna \"myhostname\", llavors hi ha d'haver " +#~ "una línia com la següent \"10.0.0.1 myhostname\"." + +#, fuzzy +#~ msgid "" +#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account " +#~ "is used in the start/stop and cron scripts. Don't delete." +#~ msgstr "" +#~ "Es crea un nou usuari de mysql \"debian-sys-maint\". S'utilitza per les " +#~ "seqüències d'inicialització i aturada del cron, no el suprimiu." + +#, fuzzy +#~ msgid "" +#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /" +#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in " +#~ "there, never only the password!" +#~ msgstr "" +#~ "Recordeu posar una contrasenya al superusuari del MySQL. Si utilitzeu un " +#~ "fitxer /root/.my.cnf, escriviu sempre allà les línies \"user\" i " +#~ "\"password\".; mai només la contrasenya. Per a més informació feu una " +#~ "ullada a /usr/share/doc/mysql-server/README.Debian." + +#, fuzzy +#~ msgid "" +#~ "Should I remove all databases below /var/lib/mysql as you are purging the " +#~ "mysql-server package?" +#~ msgstr "" +#~ "Voleu suprimir totes les bases de dades en purgar el paquet mysql-server ?" + +#~ msgid "" +#~ "Networking is disabled by default for security reasons. You can enable it " +#~ "by commenting out the skip-networking option in /etc/mysql/my.cnf." +#~ msgstr "" +#~ "La xarxa està inhabilitada per defecte per a raons de seguretat. La podeu " +#~ "habilitar descomentant l'opció de skip-networking del fitxer /etc/mysql/" +#~ "my.cnf." + +#~ msgid "security and update notice" +#~ msgstr "Avís de seguretat i actualització" + +#~ msgid "Please run mysql_fix_privilege_tables !" +#~ msgstr "Executeu mysql_fix_privilege_tables" + +#~ msgid "" +#~ "I will ensure secure permissions of /var/lib/mysql by replacing GIDs " +#~ "other than root and mysql with mysql." +#~ msgstr "" +#~ "S'asseguren els permisos de seguretat de /var/lib/mysql canviant a mysql " +#~ "tots els GIDs diferents a root i mysql." + +#~ msgid "" +#~ "Instructions how to enable SSL support are in /usr/share/doc/mysql-server/" +#~ msgstr "" +#~ "Per habilitar el suport de SSL podeu seguir les instruccions de /usr/" +#~ "share/doc/mysql-server/" + +#~ msgid "mysql_fix_privileges_tables will be executed" +#~ msgstr "s'executa mysql_fix_privileges_tables" + +#~ msgid "" +#~ "The latest MySQL versions have an enhanced, more fine grained, privilege " +#~ "system. To make use of it, some new fields must be added to the tables " +#~ "in the \"mysql\" database. This is done by the " +#~ "mysql_fix_privilege_tables script during this upgrade regardless of if " +#~ "the server is currently running or not!" +#~ msgstr "" +#~ "Les últimes versions de MySQL tenen un sistema de privilegis més " +#~ "elaborat. Per utilitzar-lo cal afegir nous camps a les taules de la base " +#~ "de dades \"mysql\". Aquesta tasca la realitza la seqüència " +#~ "mysql_fix_privilege_tables durant l'actualització independentment de si " +#~ "el servidor s'està executant o no!" + +#~ msgid "" +#~ "This script is not supposed to give any user more rights that he had " +#~ "before, if you encounter such a case, please contact me." +#~ msgstr "" +#~ "Aquesta seqüència no assigna privilegis d'usuari diferents als que ja " +#~ "tenia, en cas que us trobéssiu en aquesta situació, poseu-vos en contacte " +#~ "amb mi." + +#~ msgid "" +#~ "Should I remove everything below /var/lib/mysql when you purge the mysql-" +#~ "server package with the \"dpkg --purge mysql-server\" command (i.e. " +#~ "remove everything including the configuration) somewhen? (default is not)" +#~ msgstr "" +#~ "Voleu suprimir tots els continguts de /var/lib/mysql quan es purgui el " +#~ "paquet mysql-server amb l'ordre \"dpkg --purge mysql-server\". (ex. " +#~ "suprimir-ho tot inclòs la configuració) ? (per defecte no)" + +#~ msgid "Make MySQL reachable via network?" +#~ msgstr "Voleu fer accessible el MySQL via xarxa ?" + +#~ msgid "" +#~ "Should MySQL listen on a network reachable TCP port? This is not " +#~ "necessary for use on a single computer and could be a security problem." +#~ msgstr "" +#~ "Voleu que el MySQL escolti a un port TCP accessible des de la xarxa ? " +#~ "Aquesta opció no és imprescindible en ordinadors aïllats i podria " +#~ "provocar un problema de seguretat." + +#~ msgid "Enable chroot mode?" +#~ msgstr "Permetre el mode chroot ?" + +#~ msgid "" +#~ "MySQL is able to jail itself into the /var/lib/mysql_jail directory so " +#~ "that users cannot modify any files outside this directory. This improves " +#~ "resistence against crackers, too, as they are not able to modify system " +#~ "files." +#~ msgstr "" +#~ "El MySQL es pot executar en una entorn tancat al directori /var/lib/" +#~ "mysql_jail perquè els usuaris no puguin modificar cap fitxer fora del " +#~ "directori.Aquesta opció també augmenta la seguretat envers els crackers, " +#~ "jaque no poden modificar els fitxers del sistema." diff --git a/storage/xtradb/build/debian/po/cs.po b/storage/xtradb/build/debian/po/cs.po new file mode 100644 index 00000000000..01d95723aa9 --- /dev/null +++ b/storage/xtradb/build/debian/po/cs.po @@ -0,0 +1,361 @@ +# +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans +# +# Developers do not need to manually edit POT or PO files. +# +msgid "" +msgstr "" +"Project-Id-Version: mysql-dfsg-5.1\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2007-05-01 13:01+0200\n" +"Last-Translator: Miroslav Kure <kurem@debian.cz>\n" +"Language-Team: Czech <debian-l10n-czech@lists.debian.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "Really proceed with downgrade?" +msgstr "Opravdu pokraÄovat v degradaci?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "V systému existuje soubor /var/lib/mysql/debian-*.flag." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "To znamená, že již byl nainstalován balÃk mysql-server s vyÅ¡Å¡Ã verzÃ." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" +"Neexistuje žádná záruka, že momentálnÄ› instalovaná verze bude umÄ›t pracovat " +"se stávajÃcÃmi databázemi." + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "Important note for NIS/YP users" +msgstr "Důležitá poznámka pro uživatele NIS/YP" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" +"Abyste mohli MySQL použÃvat, musÃte v systému založit následujÃcà uživatele " +"a skupiny:" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" +"Také byste mÄ›li zkontrolovat vlastnÃka a oprávnÄ›nà adresáře /var/lib/mysql:" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "Remove all MySQL databases?" +msgid "Remove all Percona SQL databases?" +msgstr "Odstranit vÅ¡echny MySQL databáze?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The /var/lib/mysql directory which contains the MySQL databases is about " +#| "to be removed." +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" +"Adresář /var/lib/mysql, ve kterém se nacházà MySQL databáze, bude odstranÄ›n." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "If you're removing the MySQL package in order to later install a more " +#| "recent version or if a different mysql-server package is already using " +#| "it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"Jestliže odstraňujete balÃk MySQL za úÄelem instalace novÄ›jÅ¡Ã verze MySQL, " +"nebo pokud tato data souběžnÄ› využÃvá jiný balÃk mysql-server, mÄ›li byste " +"data ponechat." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Start the MySQL server on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "Spustit MySQL server pÅ™i startu systému?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL server can be launched automatically at boot time or manually " +#| "with the '/etc/init.d/mysql start' command." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"MySQL se může spouÅ¡tÄ›t automaticky pÅ™i startu systému, nebo ruÄnÄ› pÅ™Ãkazem '/" +"etc/init.d/mysql start'." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "Nové heslo MySQL uživatele \"root\":" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "While not mandatory, it is highly recommended that you set a password for " +#| "the MySQL administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"PÅ™estože to nenà nezbytné, je silnÄ› doporuÄeno nastavit heslo u " +"správcovského MySQL úÄtu \"root\"." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "Ponecháte-li pole prázdné, heslo se nezmÄ›nÃ." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "Nové heslo MySQL uživatele \"root\":" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for the MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "Nelze nastavit heslo MySQL uživatele \"root\"" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "An error occurred while setting the password for the MySQL administrative " +#| "user. This may have happened because the account already has a password, " +#| "or because of a communication problem with the MySQL server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"BÄ›hem nastavovánà hesla pro správcovského uživatele MySQL se vyskytla chyba. " +"To se mohlo stát tÅ™eba proto, protože uživatel již mÄ›l heslo nastaveno, nebo " +"protože nastal problém v komunikaci s MySQL serverem." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "You should check the account's password after tha package installation." +msgid "You should check the account's password after the package installation." +msgstr "Po instalaci balÃku byste mÄ›li heslo ověřit." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " +#| "more information." +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" +"VÃce informacà naleznete v /usr/share/doc/mysql-server-5.1/README.Debian." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "Cannot upgrade if ISAM tables are present!" +#~ msgstr "Aktualizace nelze provést pokud jsou pÅ™Ãtomny tabulky ISAM!" + +#~ msgid "" +#~ "Recent versions of MySQL can no longer use the old ISAM table format and " +#~ "it is necessary to convert your tables to e.g. MyISAM before upgrading by " +#~ "using \"mysql_convert_table_format\" or \"ALTER TABLE x ENGINE=MyISAM\". " +#~ "The installation of mysql-server-5.1 will now abort. In case your old " +#~ "mysql-server-4.1 gets removed nevertheless just reinstall it to convert " +#~ "those tables." +#~ msgstr "" +#~ "Poslednà verze MySQL již nemohou použÃvat starý formát tabulek ISAM a " +#~ "pÅ™ed aktualizacà je nutné pÅ™evést tyto tabulky napÅ™. do formátu MyISAM " +#~ "pomocà \"mysql_convert_table_format\" nebo \"ALTER TABLE x ENGINE=MyISAM" +#~ "\". Instalace mysql-server-5.1 se nynà pÅ™eruÅ¡Ã. V pÅ™ÃpadÄ›, že se mezitÃm " +#~ "odinstaloval původnà mysql-server-4.1, jednoduÅ¡e jej znovu nainstalujte a " +#~ "tabulky pÅ™eveÄte." + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "Podporovat MySQL pÅ™ipojenà z poÄÃtaÄů použÃvajÃcÃch Debian Sarge nebo " +#~ "starÅ¡Ã?" + +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "Způsob, jakým se dÅ™Ãve ukládala hesla, nebyl pÅ™ÃliÅ¡ bezpeÄný. To se nynà " +#~ "zlepÅ¡ilo, ale nevýhodou je, že se klienti z Debianu 3.1 Sarge (napÅ™. PHP) " +#~ "nebudou moci pÅ™ipojit na nové úÄty, nebo na úÄty, u nichž se heslo " +#~ "zmÄ›nilo." + +#~ msgid "" +#~ "To use mysql you must install an equivalent user and group to the " +#~ "following and ensure yourself that /var/lib/mysql has the right " +#~ "permissions (the uid/gid may be different)." +#~ msgstr "" +#~ "Abyste mohli mysql použÃvat, musÃte do následujÃcÃch souborů pÅ™idat " +#~ "ekvivalentnÃho uživatele a skupinu a zajistit, že /var/lib/mysql má " +#~ "správná práva (uid/gid se mohou liÅ¡it)." + +#~ msgid "Remove the databases used by all MySQL versions?" +#~ msgstr "Odstranit databáze použÃvané vÅ¡emi verzemi MySQL?" + +#~ msgid "" +#~ "If you do not provide a password no changes will be made to the account." +#~ msgstr "Nezadáte-li heslo, žádné zmÄ›ny se s úÄtem neprovedou." + +#~ msgid "" +#~ "When installation finishes, you should verify that the account is " +#~ "properly protected with a password (see README.Debian for more " +#~ "information)." +#~ msgstr "" +#~ "Po skonÄenà instalace byste mÄ›li ověřit, že je úÄet chránÄ›n heslem (vÃce " +#~ "informacà naleznete v souboru README.Debian)." + +#~ msgid "Update Hints" +#~ msgstr "Poznámky k aktualizaci" + +#~ msgid "" +#~ "You have to run \"mysql_upgrade\" after the upgrade, else tables can be " +#~ "corrupted! This script also enhances the privilege tables but is not " +#~ "supposed to give any user more rights that he had before," +#~ msgstr "" +#~ "Po aktualizaci jeÅ¡tÄ› musÃte spustit \"mysql_upgrade\", protože jinak by " +#~ "se tabulky mohly naruÅ¡it! Tento skript také rozÅ¡iÅ™uje tabulky privilegiÃ, " +#~ "ovÅ¡em nemÄ›l by uživatelům pÅ™idat vÃce práv, než mÄ›li dosud." + +#~ msgid "Please also read http://www.mysql.com/doc/en/Upgrade.html" +#~ msgstr "Také si pÅ™eÄtÄ›te http://www.mysql.com/doc/en/Upgrade.html" + +#~ msgid "" +#~ "MySQL will only install if you have a non-numeric hostname that is " +#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command " +#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 " +#~ "myhostname\"." +#~ msgstr "" +#~ "MySQL se nainstaluje pouze v pÅ™ÃpadÄ›, že použÃváte nenumerické jméno " +#~ "poÄÃtaÄe, které se dá pÅ™eložit pÅ™es soubor /etc/hosts. NapÅ™. když pÅ™Ãkaz " +#~ "\"hostname\" vrátà \"diamond\", tak v /etc/hosts musà existovat obdobný " +#~ "řádek jako \"10.0.0.1 diamond\"." + +#~ msgid "" +#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account " +#~ "is used in the start/stop and cron scripts. Don't delete." +#~ msgstr "" +#~ "Bude vytvoÅ™en nový mysql uživatel \"debian-sys-maint\". Tento mysql úÄet " +#~ "se použÃvá ve startovacÃch, ukonÄovacÃch a cronových skriptech. Nemažte " +#~ "jej." + +#~ msgid "" +#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /" +#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in " +#~ "there, never only the password!" +#~ msgstr "" +#~ "Nezapomeňte nastavit heslo pro úÄet administrátora MySQL! PoužÃváte-li /" +#~ "root/.my.cnf, vždy zde zadejte jak řádek \"user\", tak řádek \"password" +#~ "\". Nikdy zde nezadávejte jenom heslo!" + +#~ msgid "" +#~ "Should I remove the complete /var/lib/mysql directory tree which is used " +#~ "by all MySQL versions, not necessarily only the one you are about to " +#~ "purge?" +#~ msgstr "" +#~ "Mám odstranit kompletnà adresářový strom /var/lib/mysql, který se použÃvá " +#~ "pro vÅ¡echny verze MySQL, tedy ne nutnÄ› pouze pro verzi, kterou se " +#~ "chystáte vyÄistit?" diff --git a/storage/xtradb/build/debian/po/da.po b/storage/xtradb/build/debian/po/da.po new file mode 100644 index 00000000000..a44088472a6 --- /dev/null +++ b/storage/xtradb/build/debian/po/da.po @@ -0,0 +1,397 @@ +# +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans# +# Developers do not need to manually edit POT or PO files. +# +# Claus Hindsgaul <claus_h@image.dk>, 2005, 2006. +# Claus Hindsgaul <claus.hindsgaul@gmail.com>, 2006, 2007. +msgid "" +msgstr "" +"Project-Id-Version: mysql-dfsg-4.1\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2007-05-30 22:41+0200\n" +"Last-Translator: Claus Hindsgaul <claus.hindsgaul@gmail.com>\n" +"Language-Team: Danish\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ISO-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "Really proceed with downgrade?" +msgstr "Ønsker du virkelig at fortsætte nedgraderingen?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "" +"Der er en fil med navnet /var/lib/mysql/debian-*.flag på dette system." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"Sådan en fil tyder på at der tidligere har været installeret en højere " +"version af mysql-server-pakken." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" +"Det kan ikke garanteres at den version, du er ved at installere, kan benytte " +"data fra de eksisterende databaser." + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "Important note for NIS/YP users" +msgstr "Vigtig oplysning til NIS/YP-brugere" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" +"Nedenstående linjer for brugere og grupper skal tilføjes dette system for at " +"benytte MySQL:" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" +"Du bør også tjekke filrettighederne og ejerskabet af mappen /var/lib/mysql:" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "Remove all MySQL databases?" +msgid "Remove all Percona SQL databases?" +msgstr "Fjern alle MySQL-databaser?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The /var/lib/mysql directory which contains the MySQL databases is about " +#| "to be removed." +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" +"Mappen /var/lib/mysql, der indeholder MySQL-databaserne, er ved at blive " +"fjernet." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "If you're removing the MySQL package in order to later install a more " +#| "recent version or if a different mysql-server package is already using " +#| "it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"Hvis du fjerner MySQL-pakken for senere at installere en nyere version, " +"eller hvis en anden mysql-server-pakke allerede benytter den, bør dataene " +"bevares." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Start the MySQL server on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "Start MySQL-serveren under systemopstart?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL server can be launched automatically at boot time or manually " +#| "with the '/etc/init.d/mysql start' command." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"MySQL-serveren kan enten startes op automatisk under systemopstarten, eller " +"manuelt med kommandoen '/etc/init.d/mysql start'." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "Ny adgangskode for MySQL's \"root\"-bruger:" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "While not mandatory, it is highly recommended that you set a password for " +#| "the MySQL administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"Selvom det ikke kræves, anbefales det kraftigt, at du sætter en adgangskode " +"for MySQL's administrationsbruger \"root\"." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "Hvis du lader dette felt stå tomt, vil adgangskoden ikke blive ændret." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "Ny adgangskode for MySQL's \"root\"-bruger:" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for the MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "Kunne ikke sætte adgangskoden for MySQL's \"root\"-bruger" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "An error occurred while setting the password for the MySQL administrative " +#| "user. This may have happened because the account already has a password, " +#| "or because of a communication problem with the MySQL server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"Der opstod en fejl, da adgangskoden for MySQL's administrationsbruger blev " +"forsøgt ændret. Dette kan være sket, fordi brugeren allerede har en " +"adgangskode, eller fordi der var problemer med at kommunikere med MySQL-" +"serveren." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "You should check the account's password after the package installation." +msgstr "Du bør tjekke kontoens adgangskode efter pakkeinstallationen." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " +#| "more information." +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" +"Se filen /usr/share/doc/mysql-server-5.1/README.Debian for yderligere " +"oplysninger." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "Cannot upgrade if ISAM tables are present!" +#~ msgstr "Kan ikke opgradere hvis der er ISAM-tabeller!" + +#~ msgid "" +#~ "Recent versions of MySQL can no longer use the old ISAM table format and " +#~ "it is necessary to convert your tables to e.g. MyISAM before upgrading by " +#~ "using \"mysql_convert_table_format\" or \"ALTER TABLE x ENGINE=MyISAM\". " +#~ "The installation of mysql-server-5.1 will now abort. In case your old " +#~ "mysql-server-4.1 gets removed nevertheless just reinstall it to convert " +#~ "those tables." +#~ msgstr "" +#~ "Nyere versioner af MySQL kan ikke længere benytte det gamle ISAM-" +#~ "tabelformat, og det er derfor nødvendigt at konvertere dine tabeller til " +#~ "f.eks. MyISAM forud for opgraderingen med \"mysql_convert_table_format\" " +#~ "eller \"ALTER TABLE x ENGINE=MyISAM\". Installationen af mysql-server-5.1 " +#~ "afbrydes nu. Skulle din gamle mysql-server-4.1 alligevel bliver " +#~ "afinstalleret, så geninstallér den blot og konverter tabellerne." + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "Understøt MySQL-forbindelser fra maskiner, der kører Debian \"Sarge\" " +#~ "eller ældre?" + +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "Gamle udgaver af MySQL-klienter på Debian gemte ikke adgangskoderne " +#~ "sikkert. Dette er blevet forbedret siden da, men klienter (f.eks. PHP) " +#~ "fra maskiner, der kører Debian 3.1 Sarge vil ikke kunne forbinde til " +#~ "nyere konti eller konti, hvis adgangskode er blevet ændret." + +#~ msgid "" +#~ "To use mysql you must install an equivalent user and group to the " +#~ "following and ensure yourself that /var/lib/mysql has the right " +#~ "permissions (the uid/gid may be different)." +#~ msgstr "" +#~ "For at kunne bruge mysql skal du installere en bruger og en gruppe, der " +#~ "svarer til nedenstående, og sikre dig at /var/lib/mysql har de rigtige " +#~ "adgangsrettigheder (uid/gid kan afvige)." + +#~ msgid "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" +#~ msgstr "" +#~ "etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" + +#~ msgid "/etc/group: mysql:x:101:" +#~ msgstr "/etc/group: mysql:x:101:" + +#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql" +#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql" + +#~ msgid "Remove the databases used by all MySQL versions?" +#~ msgstr "Fjern de databaser, der benyttes af samtlige MySQL-versioner?" + +#~ msgid "" +#~ "If you do not provide a password no changes will be made to the account." +#~ msgstr "Hvis du ikke angiver en adgangskode, vil kontoen ikke blive ændret." + +#~ msgid "" +#~ "When installation finishes, you should verify that the account is " +#~ "properly protected with a password (see README.Debian for more " +#~ "information)." +#~ msgstr "" +#~ "Når installationen afsluttes, bør du tjekke at kontoen er ordentligt " +#~ "beskyttet med en adgangskode (se README.Debian for yderligere " +#~ "oplysninger)." + +#~ msgid "Update Hints" +#~ msgstr "Opdateringstips" + +#~ msgid "" +#~ "You have to run \"mysql_upgrade\" after the upgrade, else tables can be " +#~ "corrupted! This script also enhances the privilege tables but is not " +#~ "supposed to give any user more rights that he had before," +#~ msgstr "" +#~ "Du skal køre \"mysql_upgrade\" efter opgraderingen, da tabellerne eller " +#~ "kan blive ødelagt! Dette script forbedrer også rettighedstabellerne, men " +#~ "burde ikke give nogen bruger flere rettigheder, end han havde tidligere," + +#~ msgid "Please also read http://www.mysql.com/doc/en/Upgrade.html" +#~ msgstr "Læs også http://www.mysql.com/doc/en/Upgrade.html" + +#~ msgid "Install Hints" +#~ msgstr "Installationstips" + +#~ msgid "" +#~ "On upgrades from MySQL 3.23, as shipped with Debian Woody, symlinks in " +#~ "place of /var/lib/mysql or /var/log/mysql gets accidently removed and " +#~ "have manually be restored." +#~ msgstr "" +#~ "Ved opgraderinger fra MySQL 3.23, der fulgte med Debian Woody, kan de " +#~ "symbolske /var/lib/mysql or /var/log/mysql blive fjernet ved et uheld, og " +#~ "må genskabes manuelt." + +#~ msgid "" +#~ "MySQL will only install if you have a non-numeric hostname that is " +#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command " +#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 " +#~ "myhostname\"." +#~ msgstr "" +#~ "MySQL vil kun blive installeret, hvis du har et ikke-numerisk værtsnavn, " +#~ "som kan slås op i filen /ets/hosts. Hvis f.eks. kommandoen \"hostname\" " +#~ "svarer med \"mitvaertsnavn\", skal du have en linje a'la \"10.0.0.1 " +#~ "mitvaertsnavn\" i /etc/hosts." + +#~ msgid "" +#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account " +#~ "is used in the start/stop and cron scripts. Don't delete." +#~ msgstr "" +#~ "Det vil blive oprettet en ny mysql-bruger, \"debian-sys-maint\". Denne " +#~ "mysql-konto bruges i start/stop-cron-scripterne. Slet den ikke." + +#~ msgid "" +#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /" +#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in " +#~ "there, never only the password!" +#~ msgstr "" +#~ "Husk at sætte en ADGANGSKODE for MySQLs root-bruger! Hvis du bruger en /" +#~ "etc/.my.cnf, så skriv altid \"user\"- og \"password\"-linjer ind her, " +#~ "ikke kun adgangskoden!" + +#~ msgid "" +#~ "Should I remove the complete /var/lib/mysql directory tree which is used " +#~ "by all MySQL versions, not necessarily only the one you are about to " +#~ "purge?" +#~ msgstr "" +#~ "Skal jeg fjerne hele mappetræet /var/lib/mysql, som benyttes af alle " +#~ "MySQL-versioner, ikke kun den version, du er ved at slette?" + +#~ msgid "" +#~ "Rarely, e.g. on new major versions, the privilege system is improved. To " +#~ "make use of it mysql_fix_privilege_tables must be executed manually. The " +#~ "script is not supposed to give any user more rights that he had before," +#~ msgstr "" +#~ "En sjælden gang imellem, f.eks. ved nye hovedversioner, sker det at " +#~ "rettighedssystemet forbedres. For at gøre brug af dette, skal " +#~ "mysql_fix_privilege_tables køres manuelt. Scriptet vil ikke give nogen " +#~ "bruger flere rettigheder, end vedkommende havde tidligere," diff --git a/storage/xtradb/build/debian/po/de.po b/storage/xtradb/build/debian/po/de.po new file mode 100644 index 00000000000..c5dcdaff234 --- /dev/null +++ b/storage/xtradb/build/debian/po/de.po @@ -0,0 +1,277 @@ +# translation of mysql-dfsg-5.1_5.0.41-2_de.po to german +# +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans# +# Developers do not need to manually edit POT or PO files. +# +# Alwin Meschede <ameschede@gmx.de>, 2006, 2007. +msgid "" +msgstr "" +"Project-Id-Version: mysql-dfsg-5.1_5.0.41-2_de\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2007-05-29 16:05+0200\n" +"Last-Translator: Alwin Meschede <ameschede@gmx.de>\n" +"Language-Team: german <debian-l10n-german@lists.debian.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "Really proceed with downgrade?" +msgstr "Möchten Sie wirklich eine ältere Version einspielen?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "" +"Auf diesem System existiert eine Datei mit dem Namen /var/lib/mysql/debian-*." +"flag" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"Diese Datei ist ein Hinweis darauf, dass früher ein MySQL-Server-Paket mit " +"einer höheren Version installiert war." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" +"Es kann nicht garantiert werden, dass die gegenwärtig zu installierende " +"Version dessen Daten benutzen kann." + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "Important note for NIS/YP users" +msgstr "Wichtige Anmerkung für NIS/YP-Benutzer!" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" +"Um MySQL benutzen zu können, sollten die folgenden Benutzer und Gruppen dem " +"System hinzugefügt werden:" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" +"Sie sollten außerdem Besitzer und Zugriffsrechte des Verzeichnisses /var/lib/" +"mysql überprüfen:" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "Remove all MySQL databases?" +msgid "Remove all Percona SQL databases?" +msgstr "Alle MySQL-Datenbanken entfernen?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The /var/lib/mysql directory which contains the MySQL databases is about " +#| "to be removed." +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" +"Das Verzeichnis /var/lib/mysql mit den MySQL-Datenbanken soll entfernt " +"werden." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "If you're removing the MySQL package in order to later install a more " +#| "recent version or if a different mysql-server package is already using " +#| "it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"Falls geplant ist, nur eine höhere Version von MySQL zu installieren oder " +"ein anderes mysql-server-Paket dieses bereits benutzt, sollten die Daten " +"behalten werden." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Start the MySQL server on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "Soll MySQL automatisch beim Booten starten?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL server can be launched automatically at boot time or manually " +#| "with the '/etc/init.d/mysql start' command." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"Der MySQL-Dienst kann entweder automatisch beim Systemstart oder manuell " +"durch Eingabe des Befehls »/etc/init.d/mysql start« gestartet werden." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "Neues Passwort für den MySQL »root«-Benutzer:" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "While not mandatory, it is highly recommended that you set a password for " +#| "the MySQL administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"Obwohl es nicht zwingend erforderlich ist, wird nachdrücklich empfohlen für " +"den administrativen MySQL »root«-Benutzer ein Passwort zu setzen." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "Wenn dieses Feld freigelassen wird, wird das Passwort nicht geändert." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "Neues Passwort für den MySQL »root«-Benutzer:" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for the MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "Konnte für den MySQL-»root«-Benutzer kein Passwort setzen" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "An error occurred while setting the password for the MySQL administrative " +#| "user. This may have happened because the account already has a password, " +#| "or because of a communication problem with the MySQL server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"Beim setzen des Passworts für den administrativen MySQL-Benutzer ist ein " +"Fehler aufgetreten. Dies könnte daran liegen, dass der Benutzer bereits ein " +"Passwort hat oder dass es ein Problem mit der Kommunikation mit dem MySQL-" +"Server gibt." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "You should check the account's password after the package installation." +msgstr "" +"Sie sollten das Passwort des administrativen Benutzers nach der " +"Paketinstallation prüfen." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " +#| "more information." +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" +"Für weitere Informationen lesen Sie /usr/share/doc/mysql-server-5.1/README." +"Debian" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "Sollen MySQL-Verbindungen von Rechnern mit Debian »Sarge« oder älter " +#~ "unterstützt werden?" + +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "Alte Versionen der MySQL-Clients für Debian speicherten Passwörter nicht " +#~ "sehr sicher. Dies wurde verbessert, allerdings werden Clients (z. B. PHP) " +#~ "von Hosts mit Debian 3.1 Sarge sich nicht mehr mit MySQL-Konten verbinden " +#~ "können, die neu angelegt werden oder deren Passwort geändert wird. Siehe " +#~ "auch /usr/share/doc/mysql-server-5.1/README.Debian." diff --git a/storage/xtradb/build/debian/po/es.po b/storage/xtradb/build/debian/po/es.po new file mode 100644 index 00000000000..a37942fd59d --- /dev/null +++ b/storage/xtradb/build/debian/po/es.po @@ -0,0 +1,405 @@ +# mysql-dfsg-5 translation to spanish +# Copyright (C) 2005-2007 Software in the Public Interest, SPI Inc. +# This file is distributed under the same license as the XXXX package. +# +# Changes: +# - Initial translation +# Jesus Aneiros, 2006 +# - Updated +# Javier Fernandez-Sanguino, 2006-2007 +# - Revision +# Nacho Barrientos Arias +# Fernando Cerezal +# David MartÃnez Moreno +# Ricardo Mones +# Carlos Galisteo +# Javier Fernandez-Sanguino +# +# +# Traductores, si no conoce el formato PO, merece la pena leer la +# documentación de gettext, especialmente las secciones dedicadas a este +# formato, por ejemplo ejecutando: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# +# Equipo de traducción al español, por favor lean antes de traducir +# los siguientes documentos: +# +# - El proyecto de traducción de Debian al español +# http://www.debian.org/intl/spanish/ +# especialmente las notas y normas de traducción en +# http://www.debian.org/intl/spanish/notas +# +# - La guÃa de traducción de po's de debconf: +# /usr/share/doc/po-debconf/README-trans +# o http://www.debian.org/intl/l10n/po-debconf/README-trans +# +# Si tiene dudas o consultas sobre esta traducción consulte con el último +# traductor (campo Last-Translator) y ponga en copia a la lista de +# traducción de Debian al español (<debian-l10n-spanish@lists.debian.org>) +msgid "" +msgstr "" +"Project-Id-Version: mysql-dfsg-5.1_5.0.24-3\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2007-05-28 22:21+0200\n" +"Last-Translator: Javier Fernández-Sanguino <jfs@debian.org>\n" +"Language-Team: Debian l10 Spanish <debian-l10n-spanish@lists.debian.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "Really proceed with downgrade?" +msgstr "¿Desea realmente continuar con la desactualización?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "" +"Existe un archivo con el nombre /var/lib/mysql/debian-*.flag en este sistema." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"Este fichero indica que se instaló previamente una versión superior del " +"paquete mysql-server." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" +"No se puede garantizar que la versión que está instalando pueda usar la base " +"de datos actual." + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "Important note for NIS/YP users" +msgstr "Nota importante para los usuarios de NIS/YP" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" +"Deben añadirse las siguientes entradas para usuarios y grupos en el sistema " +"para poder utilizar MySQL:" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" +"También deberÃa comprobar los permisos y el propietario del directorio /var/" +"lib/mysql:" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "Remove all MySQL databases?" +msgid "Remove all Percona SQL databases?" +msgstr "¿Desea eliminar todas las bases de datos MySQL?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The /var/lib/mysql directory which contains the MySQL databases is about " +#| "to be removed." +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" +"El directorio /var/lib/mysql contiene bases de datos MySQL que van a " +"eliminarse." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "If you're removing the MySQL package in order to later install a more " +#| "recent version or if a different mysql-server package is already using " +#| "it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"DeberÃa mantener los datos si tiene planificado instalar una versión de " +"MySQL más reciente o si hay un paquete «mysql-server» distinto que los está " +"utilizando." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Start the MySQL server on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "¿DeberÃa ejecutarse el servidor MySQL al iniciarse el sistema?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL server can be launched automatically at boot time or manually " +#| "with the '/etc/init.d/mysql start' command." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"El servidor MySQL puede iniciarse en el momento de arranque del sistema o " +"manualmente si escribe la orden «/etc/init.d/mysql start»." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "Nueva contraseña para el usuario «root» de MySQL:" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "While not mandatory, it is highly recommended that you set a password for " +#| "the MySQL administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"Se recomienda que configure una contraseña para el usuario " +"«root» (administrador) de MySQL, aunque no es obligatorio." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "No se modificará la contraseña si deja el espacio en blanco." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "Nueva contraseña para el usuario «root» de MySQL:" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for the MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "No se pudo fijar la contraseña para el usuario «root» de MySQL" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "An error occurred while setting the password for the MySQL administrative " +#| "user. This may have happened because the account already has a password, " +#| "or because of a communication problem with the MySQL server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"Se produjo un error mientras intentaba fijar la contraseña para el usuario " +"administrador de MySQL. Esto puede haber sucedido porque la cuenta ya tenÃa " +"una contraseña o porque se produjo un error de comunicación con el servidor " +"MySQL." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "You should check the account's password after the package installation." +msgstr "" +"DeberÃa comprobar la contraseña de la cuenta después de la instalación del " +"paquete." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " +#| "more information." +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" +"Consulte /usr/share/doc/mysql-server-5.1/README.Debian para más información." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "Cannot upgrade if ISAM tables are present!" +#~ msgstr "¡No se puede actualizar si ya hay tablas ISAM!" + +#~ msgid "" +#~ "Recent versions of MySQL can no longer use the old ISAM table format and " +#~ "it is necessary to convert your tables to e.g. MyISAM before upgrading by " +#~ "using \"mysql_convert_table_format\" or \"ALTER TABLE x ENGINE=MyISAM\". " +#~ "The installation of mysql-server-5.1 will now abort. In case your old " +#~ "mysql-server-4.1 gets removed nevertheless just reinstall it to convert " +#~ "those tables." +#~ msgstr "" +#~ "Las versiones recientes de MySQL ya no soportan el antiguo formato de " +#~ "tabla ISAM. Antes de realizar la actualización es necesario convertir sus " +#~ "tablas a por ejemplo, MyISAM, usando «mysql_convert_table_format» o «ALTER " +#~ "TABLE x ENGINE=MyISAM». Se va a interrumpir ahora la instalación de mysql-" +#~ "server-5.1. Si aún asà su mysql-server-4.1 se elimina aún asÃ, puede " +#~ "reinstalarlo para convertir ese tipo de tablas." + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "¿Soportar las conexiones MySQL establecidadas desde sistemas que ejecutan " +#~ "Debian Sarge o versiones anteriores?" + +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "No era muy segura la forma en la que se almacenaban las contraseñas en " +#~ "versiones anteriores del cliente de MySQL en Debian. Este problema se ha " +#~ "mejorado posteriormente con el inconveniente, sin embargo, de que " +#~ "clientes (por ejemplo, PHP) en sistemas que ejecutan Debian 3.1 «Sarge» no " +#~ "podrán conectarse a cuentas que son nuevas o a las que se le haya " +#~ "cambiado la contraseña." + +#~ msgid "" +#~ "To use mysql you must install an equivalent user and group to the " +#~ "following and ensure yourself that /var/lib/mysql has the right " +#~ "permissions (the uid/gid may be different)." +#~ msgstr "" +#~ "Para utilizar mysql debe instalar un usuario y grupo equivalente al " +#~ "siguiente y asegurarse de que /var/lib/mysql tiene los permisos correctos " +#~ "(los valores del «uid» y del «gid» pueden ser diferentes)." + +#~ msgid "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" +#~ msgstr "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" + +#~ msgid "/etc/group: mysql:x:101:" +#~ msgstr "/etc/group: mysql:x:101:" + +#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql" +#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql" + +#~ msgid "Remove the databases used by all MySQL versions?" +#~ msgstr "" +#~ "¿Eliminar las bases de datos utilizadas por todas las versiones de MySQL?" + +#~ msgid "" +#~ "If you do not provide a password no changes will be made to the account." +#~ msgstr "" +#~ "No se hará ningún cambio en la cuenta si no introduce una contraseña." + +#~ msgid "" +#~ "When installation finishes, you should verify that the account is " +#~ "properly protected with a password (see README.Debian for more " +#~ "information)." +#~ msgstr "" +#~ "DeberÃa confirmar que la contraseña está correctamente protegida con una " +#~ "contraseña cuando termine la instalación (consulte el fichero README." +#~ "Debian si desea más información)." + +#~ msgid "Install Hints" +#~ msgstr "Sugerencias para la instalación" + +#~ msgid "" +#~ "On upgrades from MySQL 3.23, as shipped with Debian Woody, symlinks in " +#~ "place of /var/lib/mysql or /var/log/mysql gets accidently removed and " +#~ "have manually be restored." +#~ msgstr "" +#~ "Al actualizar a la versión de MySQL 3.23, la vrsión proporcionada en " +#~ "Debian Woody, se eliminan de manera accidental, los enlaces simbólicos a «/" +#~ "var/lib/mysql» o «/var/log/mysql» y tienen que restaurarse manualmente." + +#~ msgid "" +#~ "MySQL will only install if you have a non-numeric hostname that is " +#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command " +#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 " +#~ "myhostname\"." +#~ msgstr "" +#~ "Sólo se instalará MySQL si tiene un nombre de equipo que no sea una " +#~ "dirección IP y pueda resolverse a través del archivo /etc/hosts. Por " +#~ "ejemplo, si la orden «hostname» devuelve «MiNombreEquipo» entonces deberá " +#~ "existir una lÃnea «10.0.0.1 MiNombreEquipo» en dicho archivo." + +#~ msgid "" +#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account " +#~ "is used in the start/stop and cron scripts. Don't delete." +#~ msgstr "" +#~ "Se creará un nuevo usuario «debian-sys-maint». Esta cuenta de mysql se " +#~ "utilizará en los scripts de inicio y parada y en los scripts «cron». No la " +#~ "elimine." + +#~ msgid "" +#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /" +#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in " +#~ "there, never only the password!" +#~ msgstr "" +#~ "¡Por favor, recuerde crear una CONTRASEÑA para el usuario «root» de MySQL! " +#~ "¡Si utiliza /root/.my.cnf debe escribir las lÃneas «user» y «password» en " +#~ "dicho archivo, no incluya sólo la contraseña!" + +#~ msgid "" +#~ "Should I remove the complete /var/lib/mysql directory tree which is used " +#~ "by all MySQL versions, not necessarily only the one you are about to " +#~ "purge?" +#~ msgstr "" +#~ "¿DeberÃa eliminar el árbol de directorio /var/lib/mysql completo? Tenga " +#~ "en cuenta que lo utilizan todas las versiones de MySQL y no sólo la que " +#~ "está a punto de purgar." diff --git a/storage/xtradb/build/debian/po/eu.po b/storage/xtradb/build/debian/po/eu.po new file mode 100644 index 00000000000..b091e6c01cf --- /dev/null +++ b/storage/xtradb/build/debian/po/eu.po @@ -0,0 +1,295 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Piarres BEobide <pi@beobide.net>, 2006. +msgid "" +msgstr "" +"Project-Id-Version: mysql-dfsg-5.1_5.0.26-3-debconf_eu\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2007-02-19 09:33+0100\n" +"Last-Translator: Piarres Beobide <pi@beobide.net>\n" +"Language-Team: Euskara <Librezale@librezale.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Pootle 0.10.1\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +#, fuzzy +#| msgid "Do you really want to downgrade?" +msgid "Really proceed with downgrade?" +msgstr "Benetan bertsio zaharragora itzuli nahi duzu?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +#, fuzzy +#| msgid "" +#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates " +#| "that a mysql-server package with a higher version has been installed " +#| "before. It can not be guaranteed that this version can use its data." +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"Oharra: /var/lib/mysql/debian-*.flag dago.. Honek aurretik bertsio " +"berriagoko mysql-zerbitzari bat instalatu dela adierazten du. Ezin da " +"ziurtatu bertsio honek datu horiek erabili ahal izango dituenik." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +#, fuzzy +#| msgid "Important note for NIS/YP users!" +msgid "Important note for NIS/YP users" +msgstr "NIS/YP erabiltzaileentzat ohar garrantzitsua!" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "Remove all Percona SQL databases?" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The script is about to remove the data directory /var/lib/mysql. If it is " +#| "planned to just install a higher MySQL version or if a different mysql-" +#| "server package is already using it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"Script-a /var/lib/mysql data direktorioa ezabatzera doa. MySQL bertsio " +"berriago bat instalatu behar bada edo beste mysql-server pakete bat berau " +"erabiltzen ari bada, datuak mantendu egingo dira." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Should MySQL start on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "Sistema abiaraztean MySQL abiarazi behar al da?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL can start automatically on boot time or only if you manually " +#| "type '/etc/init.d/mysql start'." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"MySQL abiaraztean automatikoki abiarazi daiteke edo eskuz /etc/init.d/mysql " +"start' eginaz." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "MySQL \"root\" erabiltzailearen pasahitz berria:" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "It is highly recommended that you set a password for the MySQL " +#| "administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"Oso gomendagarria da MySQL administratzaile \"root\" erabiltzaileari " +"pasahitz bat ezartzea." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "MySQL \"root\" erabiltzailearen pasahitz berria:" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "Ezinda MySQL \"root\" erabiltzailearen pasahitza ezarri" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "It seems an error occurred while setting the password for the MySQL " +#| "administrative user. This may have happened because the user already has " +#| "a password, or because there was a problem communicating with the MySQL " +#| "server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"Dirudienez errore bat gertatu da MySQL administratzaile kontuaren pasahitza " +"ezartzean. Hau erabiltzaileak dagoeneko pasahitz bat duelako edo MySQL " +"zerbitzariarekiko konexioan erroreak daudelako gertatu daiteke." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "You should check the account's password after the package installation." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "Debian \"sarge\" edo zaharragoak erabiltzen duten ostalarietatik MySQL " +#~ "konexioak onartu?" + +#, fuzzy +#~| msgid "" +#~| "The way passwords were stored was not very secure. This has been " +#~| "improved with the drawback that clients (e.g. PHP) from hosts running " +#~| "Debian 3.1 Sarge will not be able to connect to account which are new or " +#~| "whose password have been changed. See /usr/share/doc/mysql-server-5.1/" +#~| "README.Debian." +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "Pasahitzak biltegiratzeko modua ez da oso ziurra. Hau hobetua izan da " +#~ "baina Debian 3.1 Sarge erabiltzaileak ezingo dira kontu berri edo " +#~ "pasahitza aldatu duten kontuetara konektatu. Begiratu /usr/share/doc/" +#~ "mysql-server-5.1/README.Debian argibide gehiagorako." + +#~ msgid "" +#~ "To use mysql you must install an equivalent user and group to the " +#~ "following and ensure yourself that /var/lib/mysql has the right " +#~ "permissions (the uid/gid may be different)." +#~ msgstr "" +#~ "Mysql erabili ahal izateko beharrezko erabiltzaile eta taldea sortu eta /" +#~ "var/lib/mysql-ek beharrezko baimenak dituela ziurtatu behar duzu (uid/gid-" +#~ "a ezberdina izan daiteke)" + +#~ msgid "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" +#~ msgstr "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" + +#~ msgid "/etc/group: mysql:x:101:" +#~ msgstr "/etc/group: mysql:x:101:" + +#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql" +#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql" + +#~ msgid "Remove the databases used by all MySQL versions?" +#~ msgstr "MySQL bertsio guztiek erabilitako databaseak ezabatu?" + +#~ msgid "" +#~ "If you do not provide a password no changes will be made to the account." +#~ msgstr "Ez baduzu pasahitzik ezartzen ez da aldaketarik egingo kontuan." + +#~ msgid "" +#~ "When installation finishes, you should verify that the account is " +#~ "properly protected with a password (see README.Debian for more " +#~ "information)." +#~ msgstr "" +#~ "Instalazio amaitzean, kontua pasahitzez babesturik dagoela ziurtatu " +#~ "beharko zenuke (README.Debian irakurri xehetasun gehiagotarako)" diff --git a/storage/xtradb/build/debian/po/fr.po b/storage/xtradb/build/debian/po/fr.po new file mode 100644 index 00000000000..b4dcce8658b --- /dev/null +++ b/storage/xtradb/build/debian/po/fr.po @@ -0,0 +1,274 @@ +# translation of fr.po to French +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans +# +# Developers do not need to manually edit POT or PO files. +# +# Christian Perrier <bubulle@debian.org>, 2004, 2006, 2007. +msgid "" +msgstr "" +"Project-Id-Version: fr\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2007-04-19 22:43+0200\n" +"Last-Translator: Christian Perrier <bubulle@debian.org>\n" +"Language-Team: French <debian-l10n-french@lists.debian.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"debian.org>\n" +"X-Generator: KBabel 1.11.4\n" +"Plural-Forms: Plural-Forms: nplurals=2; plural=n>1;\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "Really proceed with downgrade?" +msgstr "Faut-il vraiment revenir à la version précédente ?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "Un fichier /var/lib/mysql/debian-*.flag est présent sur ce système." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"Cela indique qu'une version plus récente du paquet mysql-server a été " +"précédemment installée." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "Il n'est pas garanti que cette version puisse en utiliser les données." + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "Important note for NIS/YP users" +msgstr "Note importante pour les utilisateurs NIS/YP" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" +"Pour pouvoir utiliser MySQL, les utilisateurs et les groupes suivants " +"doivent être ajoutés au système :" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" +"Vous devez également vérifier le propriétaire et les permissions du " +"répertoire /var/lib/mysql :" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "Remove all MySQL databases?" +msgid "Remove all Percona SQL databases?" +msgstr "Faut-il supprimer toutes les bases de données MySQL ?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The /var/lib/mysql directory which contains the MySQL databases is about " +#| "to be removed." +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" +"Le répertoire /var/lib/mysql qui contient les bases de données de MySQL va " +"être supprimé." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "If you're removing the MySQL package in order to later install a more " +#| "recent version or if a different mysql-server package is already using " +#| "it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"Si vous prévoyez d'installer une version plus récente de MySQL ou si un " +"autre paquet mysql-server les utilise déjà , vous devriez les conserver." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Start the MySQL server on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "Faut-il lancer MySQL au démarrage ?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL server can be launched automatically at boot time or manually " +#| "with the '/etc/init.d/mysql start' command." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"MySQL peut être lancé soit au démarrage, soit en entrant la commande « /etc/" +"init.d/mysql start »." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "Nouveau mot de passe du superutilisateur de MySQL :" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "While not mandatory, it is highly recommended that you set a password for " +#| "the MySQL administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"Il est très fortement recommandé d'établir un mot de passe pour le compte " +"d'administration de MySQL (« root »)." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "Si ce champ est laissé vide, le mot de passe ne sera pas changé." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "Nouveau mot de passe du superutilisateur de MySQL :" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for the MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "" +"Impossible de changer le mot de passe de l'utilisateur « root » de MySQL" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "An error occurred while setting the password for the MySQL administrative " +#| "user. This may have happened because the account already has a password, " +#| "or because of a communication problem with the MySQL server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"Une erreur s'est produite lors du changement de mot de passe du compte " +"d'administration. Un mot de passe existait peut-être déjà ou il n'a pas été " +"possible de communiquer avec le serveur MySQL." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "You should check the account's password after the package installation." +msgstr "" +"Vous devriez vérifier le mot de passe de ce compte après l'installation du " +"paquet." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " +#| "more information." +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" +"Veuillez consulter le fichier /usr/share/doc/mysql-server-5.1/README.Debian " +"pour plus d'informations." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "Gérer les connexions d'hôtes qui utilisent les versions Debian « sarge » " +#~ "ou antérieures  ?" + +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "La méthode de stockage des mots de passe n'était pas très sûre dans les " +#~ "version précédentes de ce paquet. Cette méthode a été améliorée mais les " +#~ "modifications empêchent la connexion avec de nouveaux comptes ou des " +#~ "comptes dont le mot de passe a été modifié, pour les clients (p. ex. PHP) " +#~ "depuis des hôtes qui utilisent Debian 3.1 « sarge »." diff --git a/storage/xtradb/build/debian/po/gl.po b/storage/xtradb/build/debian/po/gl.po new file mode 100644 index 00000000000..ef845649f18 --- /dev/null +++ b/storage/xtradb/build/debian/po/gl.po @@ -0,0 +1,264 @@ +# Galician translation of mysql-dfsg-5.1's debconf templates +# This file is distributed under the same license as the mysql-dfsg-5.1 package. +# Jacobo Tarrio <jtarrio@debian.org>, 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: mysql-dfsg-5.1\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2007-04-20 09:44+0200\n" +"Last-Translator: Jacobo Tarrio <jtarrio@debian.org>\n" +"Language-Team: Galician <proxecto@trasno.net>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "Really proceed with downgrade?" +msgstr "¿Quere pasar a unha versión anterior?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "Neste sistema hai un ficheiro chamado /var/lib/mysql/debian-*.flag." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"Este ficheiro indica que antes se instalou un paquete mysql-server cunha " +"versión superior." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" +"Non se pode garantir que a versión que está a instalar poida empregar as " +"bases de datos actuais." + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "Important note for NIS/YP users" +msgstr "Nota importante para os usuarios de NIS/YP" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" +"Para empregar MySQL deberÃan engadirse ao sistema as seguintes entradas de " +"usuarios e grupos:" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" +"Tamén deberÃa comprobar os permisos e o propietario do directorio /var/lib/" +"mysql:" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "Remove all MySQL databases?" +msgid "Remove all Percona SQL databases?" +msgstr "¿Eliminar tódalas bases de datos de MySQL?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The /var/lib/mysql directory which contains the MySQL databases is about " +#| "to be removed." +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" +"Hase eliminar o directorio /var/lib/mysql, que contén as bases de datos de " +"MySQL." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "If you're removing the MySQL package in order to later install a more " +#| "recent version or if a different mysql-server package is already using " +#| "it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"Se está a eliminar o paquete MySQL para instalar despois unha versión máis " +"recente ou se xa hai un paquete mysql-server diferente a empregalo, deberÃa " +"conservar os datos." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Start the MySQL server on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "¿Iniciar o servidor MySQL co ordenador?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL server can be launched automatically at boot time or manually " +#| "with the '/etc/init.d/mysql start' command." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"Pódese iniciar automaticamente o servidor MySQL ao iniciar o ordenador, ou " +"manualmente coa orde \"/etc/init.d/mysql start\"." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "Novo contrasinal para o usuario \"root\" de MySQL:" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "While not mandatory, it is highly recommended that you set a password for " +#| "the MySQL administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"AÃnda que non é obrigatorio, recoméndase encarecidamente que estableza un " +"contrasinal para o usuario administrativo \"root\" de MySQL." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "Se deixa o campo en branco, non se ha cambiar o contrasinal." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "Novo contrasinal para o usuario \"root\" de MySQL:" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for the MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "Non se puido establecer o contrasinal do usuario \"root\" de MySQL" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "An error occurred while setting the password for the MySQL administrative " +#| "user. This may have happened because the account already has a password, " +#| "or because of a communication problem with the MySQL server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"Houbo un erro ao establecer o contrasinal do usuario administrativo de " +"MySQL. Puido ocorrer porque o usuario xa teña un contrasinal ou debido a un " +"problema de comunicacións co servidor MySQL." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "You should check the account's password after tha package installation." +msgid "You should check the account's password after the package installation." +msgstr "DeberÃa comprobar o contrasinal da conta trala instalación do paquete." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " +#| "more information." +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" +"Consulte o ficheiro /usr/share/doc/mysql-server-5.1/README.Debian para máis " +"información." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "¿Soportar as conexións a MySQL de máquinas que empreguen Debian \"sarge\" " +#~ "ou anterior?" + +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "Nas versións antigas dos clientes MySQL de Debian, os contrasinais non se " +#~ "armacenaban de xeito seguro. Isto mellorouse desde aquela; nembargantes, " +#~ "os clientes (tales coma PHP) das máquinas que executen Debian 3.1 Sarge " +#~ "non se han poder conectar a contas recentes ou a contas nas que se " +#~ "cambiara o contrasinal." diff --git a/storage/xtradb/build/debian/po/it.po b/storage/xtradb/build/debian/po/it.po new file mode 100644 index 00000000000..405709d60c3 --- /dev/null +++ b/storage/xtradb/build/debian/po/it.po @@ -0,0 +1,266 @@ +# Italian (it) translation of debconf templates for mysql-dfsg-5.1 +# Copyright (C) 2006 Software in the Public Interest +# This file is distributed under the same license as the mysql-dfsg-5.1 package. +# Luca Monducci <luca.mo@tiscali.it>, 2006, 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: mysql-dfsg-5.1 5.0.38 italian debconf templates\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2007-04-22 15:43+0200\n" +"Last-Translator: Luca Monducci <luca.mo@tiscali.it>\n" +"Language-Team: Italian <debian-l10n-italian@lists.debian.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "Really proceed with downgrade?" +msgstr "Procedere realmente con l'abbassamento di versione?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "" +"Su questo sistema esiste un file con nome /var/lib/mysql/debian-*.flag." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"Quel file indica che in precedenza è stata installata una versione superiore " +"del pacchetto mysql-server." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" +"Non è garantito che la versione che si sta installando sia in grado di usare " +"i database presenti." + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "Important note for NIS/YP users" +msgstr "Nota importante per gli utenti NIS/YP" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" +"Per usare MySQL i seguenti utenti e gruppi devono essere aggiunti al sistema:" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" +"Inoltre si devono verificare i permessi e il proprietario della directory /" +"var/lib/mysql:" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "Remove all MySQL databases?" +msgid "Remove all Percona SQL databases?" +msgstr "Eliminare tutti i database MySQL?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The /var/lib/mysql directory which contains the MySQL databases is about " +#| "to be removed." +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" +"La directory /var/lib/mysql contenente i database di MySQL sta per essere " +"eliminata." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "If you're removing the MySQL package in order to later install a more " +#| "recent version or if a different mysql-server package is already using " +#| "it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"Se si rimuove il pacchetto MySQL per poi installare una versione più recente " +"oppure se sono già in uso da un altro pacchetto mysql-server, i dati non " +"devono essere eliminati." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Start the MySQL server on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "Lanciare il server MySQL all'avvio?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL server can be launched automatically at boot time or manually " +#| "with the '/etc/init.d/mysql start' command." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"Il server MySQL può essere lanciato automaticamente all'avvio del sistema " +"oppure manualmente con il comando «/etc/init.d/mysql start»." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "Nuova password per l'utente «root» di MySQL:" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "While not mandatory, it is highly recommended that you set a password for " +#| "the MySQL administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"Sebbene non sia obbligatoria, si raccomanda d'impostare una password per " +"l'utente d'amministrazione «root» di MySQL." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "Se questo campo è lasciato vuoto, la password non viene cambiata." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "Nuova password per l'utente «root» di MySQL:" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for the MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "Impossibile impostare la password per l'utente «root» di MySQL" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "An error occurred while setting the password for the MySQL administrative " +#| "user. This may have happened because the account already has a password, " +#| "or because of a communication problem with the MySQL server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"Si è verificato un errore durante l'impostazione della password per l'utente " +"d'amministrazione di MySQL. Questo può essere accaduto perché l'utente ha " +"già una password oppure a causa di un problema di connessione con il server " +"MySQL." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "You should check the account's password after tha package installation." +msgid "You should check the account's password after the package installation." +msgstr "" +"Al termine dell'installazione si deve verificare la password dell'account." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " +#| "more information." +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" +"Per maggiori informazioni si consulti il file /usr/share/doc/mysql-server-" +"5.1/README.Debian." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "Supporto a connessioni MySQL da macchine con Debian «sarge» o antecedente" + +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "Nelle precedenti versioni dei client MySQL su Debian le password non " +#~ "erano memorizzate in modo sicuro. Questo è stato migliorato ma i client " +#~ "(per esempio PHP) presenti su una macchina con Debian 3.1 Sarge non sono " +#~ "più in grado di connettersi a un nuovo account né ad account le cui " +#~ "password siano state cambiate." diff --git a/storage/xtradb/build/debian/po/ja.po b/storage/xtradb/build/debian/po/ja.po new file mode 100644 index 00000000000..16af16b4d9f --- /dev/null +++ b/storage/xtradb/build/debian/po/ja.po @@ -0,0 +1,394 @@ +# +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans +# +# Developers do not need to manually edit POT or PO files. +# +# +msgid "" +msgstr "" +"Project-Id-Version: mysql-dfsg-5.1 5.0.32-6\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2007-02-18 22:25+0900\n" +"Last-Translator: Hideki Yamane (Debian-JP) <henrich@debian.or.jp>\n" +"Language-Team: Japanese <debian-japanese@lists.debian.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +#, fuzzy +#| msgid "Do you really want to downgrade?" +msgid "Really proceed with downgrade?" +msgstr "本当ã«ãƒ€ã‚¦ãƒ³ã‚°ãƒ¬ãƒ¼ãƒ‰ã—ã¾ã™ã‹?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +#, fuzzy +#| msgid "" +#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates " +#| "that a mysql-server package with a higher version has been installed " +#| "before. It can not be guaranteed that this version can use its data." +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"è¦å‘Š: /var/lib/mysql/debian-*.flag ファイルãŒå˜åœ¨ã—ã¦ã„ã¾ã™ã€‚ã“ã‚Œã¯ã€ä»¥å‰ã«ã‚ˆ" +"ã‚Šæ–°ã—ã„ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® mysql-server パッケージãŒã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•ã‚Œã¦ã„ãŸã“ã¨ã‚’示" +"ã—ã¾ã™ã€‚データをã“ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã§ä½¿ãˆã‚‹ã‹ã©ã†ã‹ã€ä¿è¨¼ã§ãã¾ã›ã‚“。" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +#, fuzzy +#| msgid "Important note for NIS/YP users!" +msgid "Important note for NIS/YP users" +msgstr "NIS/YP ユーザã¸é‡è¦ãªæ³¨æ„!" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "Remove all Percona SQL databases?" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The script is about to remove the data directory /var/lib/mysql. If it is " +#| "planned to just install a higher MySQL version or if a different mysql-" +#| "server package is already using it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"ã“ã®ã‚¹ã‚¯ãƒªãƒ—トã¯ãƒ‡ãƒ¼ã‚¿ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒª /var/lib/mysql を削除ã™ã‚‹ãŸã‚ã®ã‚‚ã®ã§" +"ã™ã€‚å˜ã«æ–°ã—ã„ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® MySQL をインストールã—よã†ã¨ã—ã¦ã„ã‚‹ã€ã‚ã‚‹ã„ã¯åˆ¥" +"ã® mysql-server パッケージを既ã«ä½¿ã£ã¦ã„ã‚‹å ´åˆã€ãƒ‡ãƒ¼ã‚¿ã¯ä¿æŒã™ã‚‹å¿…è¦ãŒã‚ã‚Šã¾" +"ã™ã€‚" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Should MySQL start on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "MySQL をシステム起動時ã«é–‹å§‹ã—ã¾ã™ã‹?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL can start automatically on boot time or only if you manually " +#| "type '/etc/init.d/mysql start'." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"MySQL ã®èµ·å‹•æ–¹æ³•ã«ã¤ã„ã¦ã€ã‚·ã‚¹ãƒ†ãƒ 起動時ã«è‡ªå‹•çš„ã«é–‹å§‹ã™ã‚‹ã‹ã€ã‚ã‚‹ã„㯠'/etc/" +"init.d/mysql start' ã¨æ‰‹ã§å…¥åŠ›ã—ãŸæ™‚ã®ã¿èµ·å‹•ã™ã‚‹ã‹ã‚’é¸ã¹ã¾ã™ã€‚" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "MySQL ã® \"root\" ユーザã«å¯¾ã™ã‚‹æ–°ã—ã„パスワード:" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "It is highly recommended that you set a password for the MySQL " +#| "administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"MySQL を管ç†ã™ã‚‹ \"root\" ユーザã®ãƒ‘スワードをè¨å®šã™ã‚‹ã“ã¨ã‚’å¼·ããŠå‹§ã‚ã—ã¾" +"ã™ã€‚" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "MySQL ã® \"root\" ユーザã«å¯¾ã™ã‚‹æ–°ã—ã„パスワード:" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "MySQL ã® \"root\" ユーザã®ãƒ‘スワードをè¨å®šã§ãã¾ã›ã‚“" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "It seems an error occurred while setting the password for the MySQL " +#| "administrative user. This may have happened because the user already has " +#| "a password, or because there was a problem communicating with the MySQL " +#| "server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"MySQL ã®ç®¡ç†è€…ユーザã«å¯¾ã—ã¦ãƒ‘スワードをè¨å®šã—よã†ã¨ã—ãŸéš›ã€ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ãŸ" +"よã†ã§ã™ã€‚ã“ã‚Œã¯æ—¢ã«ç®¡ç†è€…ユーザã«ãƒ‘スワードãŒè¨å®šã•ã‚Œã¦ã„ãŸã‹ã€MySQL サーãƒ" +"ã¨ã®æŽ¥ç¶šã«å•é¡ŒãŒã‚ã£ãŸãŸã‚ã ã¨æ€ã‚ã‚Œã¾ã™ã€‚" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "You should check the account's password after the package installation." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "See /usr/share/doc/mysql-server-5.1/README.Debian for more information." +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" +"詳細㯠/usr/share/doc/mysql-server-5.1/README.Debian ã‚’å‚ç…§ã—ã¦ãã ã•ã„。" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "Cannot upgrade if ISAM tables are present!" +#~ msgstr "ISAM テーブルãŒã‚ã‚‹å ´åˆã¯ã‚¢ãƒƒãƒ—グレードã§ãã¾ã›ã‚“!" + +#~ msgid "" +#~ "Recent versions of MySQL can no longer use the old ISAM table format and " +#~ "it is necessary to convert your tables to e.g. MyISAM before upgrading by " +#~ "using \"mysql_convert_table_format\" or \"ALTER TABLE x ENGINE=MyISAM\". " +#~ "The installation of mysql-server-5.1 will now abort. In case your old " +#~ "mysql-server-4.1 gets removed nevertheless just reinstall it to convert " +#~ "those tables." +#~ msgstr "" +#~ "MySQL ã®æœ€è¿‘ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã§ã¯ä»¥å‰ã® ISAM テーブル形å¼ã¯åˆ©ç”¨ã§ããªããªã£ã¦ã„" +#~ "ã¾ã™ã€‚ãã®ãŸã‚ã€ä¾‹ãˆã° \"mysql_convert_table_format\" ã‚ã‚‹ã„㯠\"ALTER " +#~ "TABLE x ENGINE=MyISAM\" ã¨ã—ã¦ã‚¢ãƒƒãƒ—グレードå‰ã« MyISAM ã«ã‚³ãƒ³ãƒãƒ¼ãƒˆã™ã‚‹ã“" +#~ "ã¨ãªã©ãŒå¿…è¦ã§ã™ã€‚mysql-server-5.1 ã®ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã‚’ä¸æ–ã—ã¾ã™ã€‚以å‰ã® " +#~ "mysql-server-4.1 ãŒå‰Šé™¤ã•ã‚Œã¦ã—ã¾ã£ãŸå ´åˆã§ã‚ã£ã¦ã‚‚ã€ãƒ†ãƒ¼ãƒ–ルをコンãƒãƒ¼ãƒˆ" +#~ "ã™ã‚‹ãŸã‚ã«å†ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã‚’ã—ã¦ãã ã•ã„。" + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "Debian \"Sarge\" ã‚ã‚‹ã„ã¯ãれよりもå¤ã„ãƒãƒ¼ã‚¸ãƒ§ãƒ³ãŒç¨¼åƒã—ã¦ã„るホストã‹ã‚‰" +#~ "ã® MySQL 接続をサãƒãƒ¼ãƒˆã—ã¾ã™ã‹?" + +#, fuzzy +#~| msgid "" +#~| "The way passwords were stored was not very secure. This has been " +#~| "improved with the drawback that clients (e.g. PHP) from hosts running " +#~| "Debian 3.1 Sarge will not be able to connect to account which are new or " +#~| "whose password have been changed. See /usr/share/doc/mysql-server-5.1/" +#~| "README.Debian." +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "パスワードã®ä¿å˜æ–¹æ³•ã¯ã€ã‚ã¾ã‚Šå®‰å…¨ãªæ–¹æ³•ã§è¡Œã‚ã‚Œã¦ã„ã¾ã›ã‚“ã§ã—ãŸã€‚ã“ã‚Œã¯æ”¹" +#~ "å–„ã•ã‚Œã¾ã—ãŸãŒã€Debian 3.1 Sarge ãŒç¨¼åƒã—ã¦ã„るホストã‹ã‚‰ã‚¯ãƒ©ã‚¤ã‚¢ãƒ³ãƒˆ " +#~ "(PHP ãªã©) ãŒæ–°ã—ã„アカウントやパスワードãŒå¤‰æ›´ã•ã‚ŒãŸã‚¢ã‚«ã‚¦ãƒ³ãƒˆã«ã¯æŽ¥ç¶šã§" +#~ "ããªããªã‚‹ã¨ã„ã†æ¬ 点もã§ã¦ã„ã¾ã™ã€‚詳細ã«ã¤ã„ã¦ã¯ /usr/share/doc/mysql-" +#~ "server-5.1/README.Debian ã‚’å‚ç…§ã—ã¦ãã ã•ã„。" + +#~ msgid "" +#~ "To use mysql you must install an equivalent user and group to the " +#~ "following and ensure yourself that /var/lib/mysql has the right " +#~ "permissions (the uid/gid may be different)." +#~ msgstr "" +#~ "mysql を利用ã™ã‚‹ã«ã¯ 以下ã®ãƒ¦ãƒ¼ã‚¶ã¨ã‚°ãƒ«ãƒ¼ãƒ—を作æˆã—ã€/var/lib/mysql ãŒæ£ã—" +#~ "ã„権é™ã«ãªã£ã¦ã„ã‚‹ã‹ã©ã†ã‹ã‚’確èªã™ã‚‹å¿…è¦ãŒã‚ã‚Šã¾ã™ (ãŠãらã uid/gid ãŒé•" +#~ "ã„ã¾ã™)。" + +#~ msgid "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" +#~ msgstr "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" + +#~ msgid "/etc/group: mysql:x:101:" +#~ msgstr "/etc/group: mysql:x:101:" + +#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql" +#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql" + +#~ msgid "Remove the databases used by all MySQL versions?" +#~ msgstr "å…¨ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® MySQL ã§åˆ©ç”¨ã•ã‚Œã¦ã„るデータベースを削除ã—ã¾ã™ã‹?" + +#~ msgid "" +#~ "If you do not provide a password no changes will be made to the account." +#~ msgstr "" +#~ "パスワードを入力ã—ãªã„å ´åˆã€ã‚¢ã‚«ã‚¦ãƒ³ãƒˆã«å¯¾ã—ã¦å¤‰æ›´ã¯åŠ ãˆã‚‰ã‚Œã¾ã›ã‚“。" + +#~ msgid "" +#~ "When installation finishes, you should verify that the account is " +#~ "properly protected with a password (see README.Debian for more " +#~ "information)." +#~ msgstr "" +#~ "インストールãŒçµ‚了ã—ãŸéš›ã€ã‚¢ã‚«ã‚¦ãƒ³ãƒˆãŒãƒ‘スワードã§ãã¡ã‚“ã¨ä¿è·ã•ã‚Œã¦ã„ã‚‹ã‹" +#~ "ã©ã†ã‹ã‚’確èªã—ã¦ãã ã•ã„ (詳細ã«ã¤ã„ã¦ã¯ README.Debian ã‚’å‚ç…§ã—ã¦ãã ã•" +#~ "ã„)。" + +#~ msgid "Install Hints" +#~ msgstr "インストールã®ãƒ’ント" + +#~ msgid "" +#~ "On upgrades from MySQL 3.23, as shipped with Debian Woody, symlinks in " +#~ "place of /var/lib/mysql or /var/log/mysql gets accidently removed and " +#~ "have manually be restored." +#~ msgstr "" +#~ "Debian Woody ã§ãƒªãƒªãƒ¼ã‚¹ã•ã‚ŒãŸ MySQL 3.23 ã‹ã‚‰ã®ã‚¢ãƒƒãƒ—グレードã§ã¯ã€/var/" +#~ "lib/mysql ã‚ã‚‹ã„㯠/var/log/mysql ã®ä»£ã‚ã‚Šã«ã‚·ãƒ³ãƒœãƒªãƒƒã‚¯ãƒªãƒ³ã‚¯ã¯å¶ç„¶ã«ã‚‚削" +#~ "除ã•ã‚Œã¦ã—ã¾ã£ã¦ã„ã‚‹ã®ã§ã€æ‰‹å‹•ã§ã®ãƒªã‚¹ãƒˆã‚¢ãŒå¿…è¦ã«ãªã‚Šã¾ã™ã€‚" + +#~ msgid "" +#~ "MySQL will only install if you have a non-numeric hostname that is " +#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command " +#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 " +#~ "myhostname\"." +#~ msgstr "" +#~ "MySQL 㯠/etc/hosts ファイル経由ã§è§£æ±ºã§ãる「数å—ã®ã¿ã§æ§‹æˆã•ã‚Œã¦ãªã„ã€ãƒ›" +#~ "ストåã®å ´åˆã®ã¿ã€ã‚¤ãƒ³ã‚¹ãƒˆãƒ¼ãƒ«ã•ã‚Œã¾ã™ã€‚ã¤ã¾ã‚Šã€\"hostname\" コマンド㌠" +#~ "\"myhostname\" ã‚’è¿”ã™ãªã‚‰ã€\"10.0.0.1 myhostname\" ã¨ã„ã†è¡ŒãŒ /etc/hosts " +#~ "ファイルã«ã‚ã‚‹ã¯ãšã§ã™ã€‚" + +#~ msgid "" +#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account " +#~ "is used in the start/stop and cron scripts. Don't delete." +#~ msgstr "" +#~ "æ–°è¦ã« mysql ユーザã¨ã—㦠\"debian-sys-maint\" ãŒä½œæˆã•ã‚Œã¾ã™ã€‚ã“ã® mysql " +#~ "アカウント㯠start/stop 時㨠cron スクリプトã§åˆ©ç”¨ã•ã‚Œã¾ã™ã€‚消ã•ãªã„ã§ãã " +#~ "ã•ã„。" + +#~ msgid "" +#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /" +#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in " +#~ "there, never only the password!" +#~ msgstr "" +#~ "MySQL ã® root ユーザã«å¯¾ã—ã¦ã€Œãƒ‘スワードã®è¨å®šã€ã‚’忘れãªã„ã§ãã ã•ã„! /" +#~ "root/.my.cnf を使ã£ã¦ã„ã‚‹å ´åˆã€ã“ã®ãƒ•ã‚¡ã‚¤ãƒ«ä¸ã® \"user\" 行㨠\"password" +#~ "\" 行を記述ã—ã¦ãã ã•ã„。決ã—ã¦ãƒ‘スワードã ã‘ã§ã¯ã„ã‘ã¾ã›ã‚“!" + +#~ msgid "" +#~ "Should I remove the complete /var/lib/mysql directory tree which is used " +#~ "by all MySQL versions, not necessarily only the one you are about to " +#~ "purge?" +#~ msgstr "" +#~ "ã“ã‚Œã‹ã‚‰ purge ã—よã†ã¨ã—ã¦ã„ã‚‹ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã ã‘ã§ã¯ç„¡ãã€å…¨ã¦ã®ãƒãƒ¼ã‚¸ãƒ§ãƒ³ã® " +#~ "MySQL ㌠/var/lib/mysql ディレクトリを使用ã—ã¦ã„ã¾ã™ã€‚ã“ã®ãƒ‡ã‚£ãƒ¬ã‚¯ãƒˆãƒªã‚’完" +#~ "å…¨ã«å‰Šé™¤ã—ã¾ã™ã‹?" + +#~ msgid "Update Hints" +#~ msgstr "æ›´æ–°ã®ãƒ’ント" + +#~ msgid "" +#~ "Rarely, e.g. on new major versions, the privilege system is improved. To " +#~ "make use of it mysql_fix_privilege_tables must be executed manually. The " +#~ "script is not supposed to give any user more rights that he had before," +#~ msgstr "" +#~ "ã¾ã‚Œã«ã€ã¤ã¾ã‚Šã¯æ–°ã—ã„メジャーãƒãƒ¼ã‚¸ãƒ§ãƒ³ã«ãŠã„ã¦ã€ç‰¹æ¨©ã‚·ã‚¹ãƒ†ãƒ ãŒæ”¹å–„ã•ã‚Œã¾" +#~ "ã™ã€‚ã“れを行ã†ã«ã¯ã€mysql_fix_privilege_table を手動ã§å®Ÿè¡Œã™ã‚‹å¿…è¦ãŒã‚ã‚Šã¾" +#~ "ã™ã€‚スクリプトã¯ã€ã©ã®ã‚ˆã†ãªãƒ¦ãƒ¼ã‚¶ã«å¯¾ã—ã¦ã‚‚ã€ä»¥å‰ã«ä¿æŒã—ã¦ã„ãŸä»¥ä¸Šã®æ¨©é™" +#~ "を与ãˆã‚‹ã‚ˆã†ã«ã¯ãªã£ã¦ã„ã¾ã›ã‚“。" + +#~ msgid "Please also read http://www.mysql.com/doc/en/Upgrade.html" +#~ msgstr "http://www.mysql.com/doc/ja/Upgrade.html ã‚‚å‚ç…§ã—ã¦ãã ã•ã„" diff --git a/storage/xtradb/build/debian/po/nb.po b/storage/xtradb/build/debian/po/nb.po new file mode 100644 index 00000000000..1235cdc1b2c --- /dev/null +++ b/storage/xtradb/build/debian/po/nb.po @@ -0,0 +1,297 @@ +# translation of mysql_nb.po to Norwegian BokmÃ¥l +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Bjørn Steensrud <bjornst@powertech.no>, 2007. +msgid "" +msgstr "" +"Project-Id-Version: mysql_nb\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2007-02-18 12:13+0100\n" +"Last-Translator: Bjørn Steensrud <bjornst@powertech.no>\n" +"Language-Team: Norwegian BokmÃ¥l <i18n-nb@lister.ping.uio.no>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.2\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +#, fuzzy +#| msgid "Do you really want to downgrade?" +msgid "Really proceed with downgrade?" +msgstr "Er du sikker pÃ¥ at du vil nedgradere?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +#, fuzzy +#| msgid "" +#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates " +#| "that a mysql-server package with a higher version has been installed " +#| "before. It can not be guaranteed that this version can use its data." +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"ADVARSEL: Fila /var/lib/mysql/debian-*.flag finnes. Dette viser at en mysql-" +"server-pakke med et høyere versjonsnummer har vært installert før. Det kan " +"ikke garanteres at denne versjonen kan bruke data fra den høyere versjonen." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +#, fuzzy +#| msgid "Important note for NIS/YP users!" +msgid "Important note for NIS/YP users" +msgstr "Viktig merknad for NIS/YP-brukere!" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "Remove all Percona SQL databases?" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The script is about to remove the data directory /var/lib/mysql. If it is " +#| "planned to just install a higher MySQL version or if a different mysql-" +#| "server package is already using it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"Dette skriptet skal til Ã¥ fjerne data-mappa /var/lib/mysql. Denne mappa bør " +"beholdes hvis det bare skal installeres en høyere MySQL-versjon, eller hvis " +"en annen mysql-server-pakke allerede bruker den." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Should MySQL start on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "Skal MySQL startes ved maskinoppstart?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL can start automatically on boot time or only if you manually " +#| "type '/etc/init.d/mysql start'." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"MySQL kan startes automatisk nÃ¥r maskinen starter, eller bare hvis du " +"skriver «/etc/init.d/mysql start»." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "Nytt passord for MySQLs «root»-bruker:" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "It is highly recommended that you set a password for the MySQL " +#| "administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"Det anbefales sterkt at du oppgir et passord for den administrative «root»-" +"brukeren i MySQl." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "Nytt passord for MySQLs «root»-bruker:" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "Klarer ikke angi passord for MySQLs «root»-bruker" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "It seems an error occurred while setting the password for the MySQL " +#| "administrative user. This may have happened because the user already has " +#| "a password, or because there was a problem communicating with the MySQL " +#| "server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"Det ser ut til at det oppsto en feil mens det ble satt et passord for MySQLs " +"administrative bruker. Dette kan være fordi brukeren allerede har et " +"passord, eller fordi det var et kommunikasjonsproblem med MySQL-tjeneren." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "You should check the account's password after the package installation." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "Skal MySQL-tilkoblinger støttes fra vertsmaskiner som kjører Debian " +#~ "«sarge» eller eldre?" + +#, fuzzy +#~| msgid "" +#~| "The way passwords were stored was not very secure. This has been " +#~| "improved with the drawback that clients (e.g. PHP) from hosts running " +#~| "Debian 3.1 Sarge will not be able to connect to account which are new or " +#~| "whose password have been changed. See /usr/share/doc/mysql-server-5.1/" +#~| "README.Debian." +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "Passord ble tidligere lagret pÃ¥ en lite sikker mÃ¥te. Dette er nÃ¥ " +#~ "forbedret, med den ulempen at klienter (f.eks. PHP) fra verter som kjører " +#~ "Debian 3.1 Sarge ikke vil kunne koble til en konto som er ny eller har " +#~ "fÃ¥tt endret passordet. Se /usr/share/doc/mysql-server-5.1/README.Debian." + +#~ msgid "" +#~ "To use mysql you must install an equivalent user and group to the " +#~ "following and ensure yourself that /var/lib/mysql has the right " +#~ "permissions (the uid/gid may be different)." +#~ msgstr "" +#~ "For Ã¥ bruke MySQL mÃ¥ du installere en bruker og gruppe tilsvarende den " +#~ "nedenfor og se til at /var/lib/mysql har riktige rettigheter (uid/gid kan " +#~ "være forskjellig)." + +#~ msgid "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" +#~ msgstr "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" + +#~ msgid "/etc/group: mysql:x:101:" +#~ msgstr "/etc/group: mysql:x:101:" + +#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql" +#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql" + +#~ msgid "Remove the databases used by all MySQL versions?" +#~ msgstr "Skal databasene brukt av alle MySQL-versjoner fjernes?" + +#~ msgid "" +#~ "If you do not provide a password no changes will be made to the account." +#~ msgstr "" +#~ "Hvis du ikke oppgir et passord blir det ikke gjort noen endringer med " +#~ "kontoen." + +#~ msgid "" +#~ "When installation finishes, you should verify that the account is " +#~ "properly protected with a password (see README.Debian for more " +#~ "information)." +#~ msgstr "" +#~ "NÃ¥r installasjonen er ferdig bør det sjekkes at kontoen er ordentlig " +#~ "beskyttet med et passord (mer informasjon finnes i README.Debian)." diff --git a/storage/xtradb/build/debian/po/nl.po b/storage/xtradb/build/debian/po/nl.po new file mode 100644 index 00000000000..bfe418117e6 --- /dev/null +++ b/storage/xtradb/build/debian/po/nl.po @@ -0,0 +1,302 @@ +# Dutch mysql-dfsg-5.1 po-debconf translation, +# Copyright (C) 2006 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the mysql-dfsg-5.1 package. +# Vincent Zweije <zweije@xs4all.nl>, 2006. +# +msgid "" +msgstr "" +"Project-Id-Version: mysql-dfsg-5.1 5.0.30-1\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2006-02-19 10:20+0100\n" +"Last-Translator: Thijs Kinkhorst <thijs@debian.org>\n" +"Language-Team: Debian-Dutch <debian-l10n-dutch@lists.debian.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +#, fuzzy +#| msgid "Do you really want to downgrade?" +msgid "Really proceed with downgrade?" +msgstr "Wilt u echt een oude versie herstellen?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +#, fuzzy +#| msgid "" +#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates " +#| "that a mysql-server package with a higher version has been installed " +#| "before. It can not be guaranteed that this version can use its data." +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"Waarschuwing: waarschijnlijk is een hogere versie van het mysql-server " +"pakket geïnstalleerd geweest (het bestand /var/lib/mysql/debian-*.flag " +"bestaat). Er is geen garantie dat de gegevensbestanden, bewerkt met die " +"hogere versie, kunnen worden gebruikt met de versie van mysql die u nu " +"installeert." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +#, fuzzy +#| msgid "Important note for NIS/YP users!" +msgid "Important note for NIS/YP users" +msgstr "Belangrijke opmerking voor gebruikers van NIS/YP!" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "Remove all Percona SQL databases?" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The script is about to remove the data directory /var/lib/mysql. If it is " +#| "planned to just install a higher MySQL version or if a different mysql-" +#| "server package is already using it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"Het script staat op het punt de datamap /var/lib/mysql te verwijderen. Als " +"het plan alleen maar is om een hogere MySQL versie te installeren, of als " +"een ander mysql-serverpakket de datamap al gebruikt, dan zou de data moeten " +"worden behouden." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Should MySQL start on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "Moet MySQL starten als de computer start?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL can start automatically on boot time or only if you manually " +#| "type '/etc/init.d/mysql start'." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"MySQL kan automatisch starten bij het starten van de computer, of slechts " +"wanneer u '/etc/init.d/mysql start' handmatig uitvoert." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "Nieuw wachtwoord voor de MySQL \"root\"-gebruiker:" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "It is highly recommended that you set a password for the MySQL " +#| "administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"Het wordt sterk aangeraden een wachtwoord in te stellen voor de " +"administratieve MySQL \"root\"-gebruiker." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "Nieuw wachtwoord voor de MySQL \"root\"-gebruiker:" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "Kan het wachtwoord voor de MySQL \"root\"-gebruiker niet instellen" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "It seems an error occurred while setting the password for the MySQL " +#| "administrative user. This may have happened because the user already has " +#| "a password, or because there was a problem communicating with the MySQL " +#| "server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"Er lijkt een fout te zijn opgetreden bij het instellen van het wachtwoord " +"van de MySQL administratieve gebruiker. Dat kan komen doordat de gebruiker " +"al een wachtwoord heeft, of omdat er een probleem was bij het communiceren " +"met de MySQL server." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "You should check the account's password after the package installation." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "Moet u MySQL-verbindingen accepteren van computers die Debian \"sarge\" " +#~ "of ouder draaien?" + +#, fuzzy +#~| msgid "" +#~| "The way passwords were stored was not very secure. This has been " +#~| "improved with the drawback that clients (e.g. PHP) from hosts running " +#~| "Debian 3.1 Sarge will not be able to connect to account which are new or " +#~| "whose password have been changed. See /usr/share/doc/mysql-server-5.1/" +#~| "README.Debian." +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "De wijze waarop wachtwoorden werden bewaard was niet erg veilig. Dit is " +#~ "verbeterd, maar helaas zullen programma's van computers die Debian 3.1 " +#~ "Sarge draaien, geen verbinding meer kunnen maken met accounts die nieuw " +#~ "zijn, of waarvan het wachtwoord is gewijzigd. Zie /usr/share/doc/mysql-" +#~ "server-5.1/README.Debian." + +#~ msgid "" +#~ "To use mysql you must install an equivalent user and group to the " +#~ "following and ensure yourself that /var/lib/mysql has the right " +#~ "permissions (the uid/gid may be different)." +#~ msgstr "" +#~ "Om mysql te gebruiken dient u een gebruiker en groep aan te maken, " +#~ "gelijkwaardig aan onderstaand voorbeeld, en u dient ervoor te zorgen dat /" +#~ "var/lib/mysql de bijbehorende toegangsrechten heeft (uid en gid mogen " +#~ "anders zijn)." + +#~ msgid "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" +#~ msgstr "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" + +#~ msgid "/etc/group: mysql:x:101:" +#~ msgstr "/etc/group: mysql:x:101:" + +#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql" +#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql" + +#~ msgid "Remove the databases used by all MySQL versions?" +#~ msgstr "Databases verwijderen die door alle MySQL versies worden gebruikt?" + +#~ msgid "" +#~ "If you do not provide a password no changes will be made to the account." +#~ msgstr "" +#~ "Indien u geen wachtwoord opgeeft zal het account niet worden gewijzigd." + +#~ msgid "" +#~ "When installation finishes, you should verify that the account is " +#~ "properly protected with a password (see README.Debian for more " +#~ "information)." +#~ msgstr "" +#~ "Wanneer de installatie klaar is, dient u te verifiëren dat het account " +#~ "netjes beschermd is met een wachtwoord (zie README.Debian voor meer " +#~ "informatie)." diff --git a/storage/xtradb/build/debian/po/pt.po b/storage/xtradb/build/debian/po/pt.po new file mode 100644 index 00000000000..3372b11b06b --- /dev/null +++ b/storage/xtradb/build/debian/po/pt.po @@ -0,0 +1,322 @@ +# Portuguese translation for mysql-dfsg-5.1's debconf messages +# Copyright (C) 2006 Miguel Figueiredo <elmig@debianpt.org> +# This file is distributed under the same license as the mysql-dfsg-5.1 package. +# Miguel Figueiredo <elmig@debianpt.org> +# +msgid "" +msgstr "" +"Project-Id-Version: mysql-dfsg-5.1\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2007-05-05 21:01+0100\n" +"Last-Translator: Miguel Figueiredo <elmig@debianpt.org>\n" +"Language-Team: Portuguese <traduz@debianpt.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "Really proceed with downgrade?" +msgstr "Deseja mesmo fazer downgrade?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "Existe um ficheiro chamado /var/lib/mysql/debian-*.flag neste sistema." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"Tal ficheiro significa que anteriormente foi instalado um pacote mysql-" +"server com um número de versão superior." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" +"Não existe nenhuma garantia que a versão que está actualmente a instalar " +"seja capaz de utilizar as bases de dados actuais." + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "Important note for NIS/YP users" +msgstr "Nota importante para utilizadores de NIS/YP" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" +"Para utilizar o MySQL, têm de ser acrescentadas as seguintes entradas para " +"os utilizadores e grupos:" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" +"Deve também verificar as permissões e o dono do directório /var/lib/mysql :" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "Remove all MySQL databases?" +msgid "Remove all Percona SQL databases?" +msgstr "Remover todas as bases de dados MySQL?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The /var/lib/mysql directory which contains the MySQL databases is about " +#| "to be removed." +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" +"O directório /var/lib/mysql que contém as bases de dados MySQL está prestes " +"a ser removido." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "If you're removing the MySQL package in order to later install a more " +#| "recent version or if a different mysql-server package is already using " +#| "it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"Se está a remover o pacote MySQL de modo a posteriormente instalar uma " +"versão mais recente ou se um pacote mysq-server já está os está a utilizar, " +"os dados devem ser mantidos." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Start the MySQL server on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "Iniciar o servidor MySQL no arranque?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL server can be launched automatically at boot time or manually " +#| "with the '/etc/init.d/mysql start' command." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"O MySQL pode ser automaticamente lançado no arranque ou manualmente através " +"do comando '/etc/init.d/mysql start'." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "Nova palavra-passe para o utilizador \"root\" do MySQL:" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "While not mandatory, it is highly recommended that you set a password for " +#| "the MySQL administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"Embora não seja mandatório, É fortemente recomendado que defina uma palavra-" +"passe para o utilizador administrativo \"root\" do MySQL." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "" +"Se esse campo for deixado em branco, a palavra-passe não irá ser alterada." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "Nova palavra-passe para o utilizador \"root\" do MySQL:" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for the MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "" +"Não foi possÃvel definir a palavra-passe para o utilizador \"root\" do MySQL" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "An error occurred while setting the password for the MySQL administrative " +#| "user. This may have happened because the account already has a password, " +#| "or because of a communication problem with the MySQL server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"Ocorreu um erro enquanto era definida a palavra-passe para o utilizador " +"administrativo do MySQL. Isto pode ter acontecido porque a cona já tem uma " +"palavra-passe, ou porque ocorreu um problema ao comunicação com o servidor " +"MySQL." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "You should check the account's password after tha package installation." +msgid "You should check the account's password after the package installation." +msgstr "" +"Você deve verificar a palavra-passe da conta após a instalação do pacote." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " +#| "more information." +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" +"Para mais informação por favor leia o ficheiro /usr/share/doc/mysql-server-" +"5.1/README.Debian." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "Cannot upgrade if ISAM tables are present!" +#~ msgstr "Não é possÃvel actualizar se estiverem presentes tabelas ISAM!" + +#~ msgid "" +#~ "Recent versions of MySQL can no longer use the old ISAM table format and " +#~ "it is necessary to convert your tables to e.g. MyISAM before upgrading by " +#~ "using \"mysql_convert_table_format\" or \"ALTER TABLE x ENGINE=MyISAM\". " +#~ "The installation of mysql-server-5.1 will now abort. In case your old " +#~ "mysql-server-4.1 gets removed nevertheless just reinstall it to convert " +#~ "those tables." +#~ msgstr "" +#~ "As versões recentes de MySQL já não podem utilizar o antigo formato de " +#~ "tabelas ISAM e é por isso necessário converter as suas tabelas pra e.g. " +#~ "MyISAM antes da actualização, utilizando \"mysql_convert_table_format\" " +#~ "ou \"ALTER TABLE x ENGINE=MyISAM\". A instalação de mysql-server-5.1 irá " +#~ "agora ser cancelada. Se o seu antigo mysql-server-4.1 for removido apenas " +#~ "reinstale para converter essas tabelas." + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "Suportar ligações MySQL de máquinas que corram Debian \"sarge\" ou mais " +#~ "antigos?" + +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "Nas versões antigas de clientes de MySQL em Debian, as palavras-passe não " +#~ "eram guardadas de forma segura. Isto foi melhorado desde aÃ, no entanto " +#~ "os clientes (como o PHP) de máquinas que corram Debian 3.1 Sarge não irão " +#~ "conseguir ligar-se a contas novas ou cuja palavra-passe foi alterada." + +#~ msgid "" +#~ "To use mysql you must install an equivalent user and group to the " +#~ "following and ensure yourself that /var/lib/mysql has the right " +#~ "permissions (the uid/gid may be different)." +#~ msgstr "" +#~ "Para utilizar mysql e instalar um utilizador e grupo equivalentes para o " +#~ "seguinte e assegurar-se que /var/lib/mysql têm as permissões correctas (o " +#~ "uid/gid podem ser diferentes)." + +#~ msgid "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" +#~ msgstr "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" + +#~ msgid "/etc/group: mysql:x:101:" +#~ msgstr "/etc/group: mysql:x:101:" + +#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql" +#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql" + +#~ msgid "Remove the databases used by all MySQL versions?" +#~ msgstr "Remover as bases de dados utilizadas por todas as versões de MySQL?" + +#~ msgid "" +#~ "If you do not provide a password no changes will be made to the account." +#~ msgstr "" +#~ "Se não disponibilizar uma password não serão feitas alterações nesta " +#~ "conta." + +#~ msgid "" +#~ "When installation finishes, you should verify that the account is " +#~ "properly protected with a password (see README.Debian for more " +#~ "information)." +#~ msgstr "" +#~ "Quando terminar a instalação, deve verificar se a conta está devidamente " +#~ "protegida com uma password (para mais informações veja README.Debian)." diff --git a/storage/xtradb/build/debian/po/pt_BR.po b/storage/xtradb/build/debian/po/pt_BR.po new file mode 100644 index 00000000000..e04a5a2393d --- /dev/null +++ b/storage/xtradb/build/debian/po/pt_BR.po @@ -0,0 +1,458 @@ +# Brazilian Portuguese (pt_BR) debconf template translation for +# Debian's mysql-dfsg source package. +# Debian-BR Project <debian-l10n-portuguese@lists.debian.org> +# André LuÃs Lopes, <andrelop@debian.org> , 2004 +# André LuÃs Lopes, <andrelop@debian.org> , 2006 +# André LuÃs Lopes, <andrelop@debian.org> , 2007 +# +msgid "" +msgstr "" +"Project-Id-Version: mysql-dfsg-5.1\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2007-04-21 15:59-0300\n" +"Last-Translator: André LuÃs Lopes <andrelop@debian.org>\n" +"Language-Team: Debian-BR Project <debian-l10n-portuguese@lists.debian.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"pt_BR utf-8\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "Really proceed with downgrade?" +msgstr "Realmente proceder com o rebaixamento de versão?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "Um arquivo de nome /var/lib/mysql/debian-*.flag existe no sistema." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"A presença de um arquivo como este é uma indicação de que um pacote mysql-" +"server com um número de versão mais alto já foi instalado anteriormente." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" +"Não há garantias de que a versão que você está instalando no momento " +"conseguirá utilizar as bases de dados existentes." + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "Important note for NIS/YP users" +msgstr "Aviso importante para usuários NIS/YP" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" +"Para utilizar o MySQL, as seguintes entradas para usuários e grupos devem " +"ser adicionadas ao sistema:" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" +"Você deverá também checar as permissões e o dono do diretório /var/lib/mysql:" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "Remove all MySQL databases?" +msgid "Remove all Percona SQL databases?" +msgstr "Remover todas as bases de dados do MySQL?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The /var/lib/mysql directory which contains the MySQL databases is about " +#| "to be removed." +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" +"O diretório /var/lib/mysql, o qual contém as bases de dados do MySQL, está " +"prestes a ser removido." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "If you're removing the MySQL package in order to later install a more " +#| "recent version or if a different mysql-server package is already using " +#| "it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"Caso você esteja removendo o pacote MySQL para posteriormente instalar uma " +"versão mais recente ou, caso uma versão diferente do pacote mysql-server " +"esteja sendo utilizada, os dados deverão ser mantidos." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Start the MySQL server on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "Iniciar o servidor MySQL junto a inicialização da máquina?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL server can be launched automatically at boot time or manually " +#| "with the '/etc/init.d/mysql start' command." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"O servidor MySQL pode ser iniciado automaticamente junto a inicialização da " +"máquina ou manualmente com o comando '/etc/init.d/mysql start'." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "Nova senha para o usuário \"root\" do MySQL:" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "While not mandatory, it is highly recommended that you set a password for " +#| "the MySQL administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"Apesar de não ser mandatório, é altamente recomendado que você defina uma " +"senha para o usuário administrativo \"root\" do MySQL." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "Caso este campo seja deixado em branco, a senha não sera mudada." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for the MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "Nova senha para o usuário \"root\" do MySQL:" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for the MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "ImpossÃvel definir senha para o usuário \"root\" do MySQL" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "An error occurred while setting the password for the MySQL administrative " +#| "user. This may have happened because the account already has a password, " +#| "or because of a communication problem with the MySQL server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"Um erro ocorreu durante a definição da senha para o usuário administrativo " +"do MySQL. Isso pode ter acontecido devido a esse usuário já possuir uma " +"senha definida ou devido a ocorrência de um problema de comunicação com o " +"servidor MySQL." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "You should check the account's password after tha package installation." +msgid "You should check the account's password after the package installation." +msgstr "Você deverá checar a senha dessa conta após a instalação deste pacote." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for " +#| "more information." +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" +"Por favor, leia o arquivo /usr/share/doc/mysql-server-5.1/README.Debian para " +"maiores informações." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "Suportar conexões MySQL originadas de hosts executando o Debian \"sarge\" " +#~ "ou mais antigos ?" + +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "Em versões antigas dos clientes MySQL no Debian, as senhas não eram " +#~ "armazenadas de forma segura. Isto foi corrigido desde então, porém, " +#~ "clientes (como o PHP) em hosts executando o Debian 3.1 Sarge não serão " +#~ "capazes de conectar em contas recentes ou contas as quais as senhas " +#~ "tenham sido modificadas." + +#~ msgid "" +#~ "To use mysql you must install an equivalent user and group to the " +#~ "following and ensure yourself that /var/lib/mysql has the right " +#~ "permissions (the uid/gid may be different)." +#~ msgstr "" +#~ "Para utilizar o MySQL, você deve instalar um usuário e um grupo " +#~ "equivalentes ao usuário e grupo a seguir para se certificar de que o " +#~ "diretório /var/lib/mysql possua as permissões correctas (o uid/gid podem " +#~ "ser diferentes)." + +#~ msgid "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" +#~ msgstr "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" + +#~ msgid "/etc/group: mysql:x:101:" +#~ msgstr "/etc/group: mysql:x:101:" + +#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql" +#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql" + +#~ msgid "Remove the databases used by all MySQL versions?" +#~ msgstr "Remover as bases de dados utilizadas por todas as versões do MySQL?" + +#~ msgid "" +#~ "If you do not provide a password no changes will be made to the account." +#~ msgstr "" +#~ "Caso você não forneça uma senha, nenhuma mudança será feita na conta." + +#~ msgid "" +#~ "When installation finishes, you should verify that the account is " +#~ "properly protected with a password (see README.Debian for more " +#~ "information)." +#~ msgstr "" +#~ "Quando a instalação finalizar, você deverá verificar se a conta está " +#~ "apropriadamente protegida com uma senha (consulte o arquivo README.Debian " +#~ "para maiores informações)." + +#~ msgid "internal" +#~ msgstr "interno" + +#~ msgid "Only internally used." +#~ msgstr "Somente utilizado internamente." + +#, fuzzy +#~ msgid "Update Hints" +#~ msgstr "Dicas de atualização" + +#, fuzzy +#~ msgid "" +#~ "Rarely, e.g. on new major versions, the privilege system is improved. To " +#~ "make use of it mysql_fix_privilege_tables must be executed manually. The " +#~ "script is not supposed to give any user more rights that he had before," +#~ msgstr "" +#~ "Raramente, por exemplo, em novas versões maiores, o sistema de " +#~ "privilégios é melhorado. Para fazer uso disso, o script " +#~ "mysql_fix_privilege_tables deve ser executado manualmente. O script não " +#~ "atribuirá a nenhum usuário mais direitos do que os mesmos já possuÃam " +#~ "anteriormente." + +#~ msgid "Please also read http://www.mysql.com/doc/en/Upgrade.html" +#~ msgstr "Por favor, leia http://www.mysql.com/doc/en/Upgrade.html" + +#, fuzzy +#~ msgid "Install Hints" +#~ msgstr "Dicas de instalação" + +#, fuzzy +#~ msgid "" +#~ "MySQL will only install if you have a non-numeric hostname that is " +#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command " +#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 " +#~ "myhostname\"." +#~ msgstr "" +#~ "O MySQL será instalado somente caso você possua um nome de host NÃO " +#~ "NUMÉRICO que possa ser resolvido através do arquivo /etc/hosts, ou seja, " +#~ "caso o comando \"hostname\" retorne \"myhostname\", uma linha como " +#~ "\"10.0.0.1 myhostname\" deverá existir no arquivo /etc/hosts." + +#~ msgid "" +#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account " +#~ "is used in the start/stop and cron scripts. Don't delete." +#~ msgstr "" +#~ "Um novo usuário MySQL de nome \"debian-sys-maint\" será criado. Essa " +#~ "conta MySQL é utilizada pelos scripts de inicialização/parada e pelos " +#~ "scripts cron. Não remova esse usuário." + +#, fuzzy +#~ msgid "" +#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /" +#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in " +#~ "there, never only the password!" +#~ msgstr "" +#~ "Por favor, lembre-se de definir uma SENHA para o usuário root do MySQL ! " +#~ "Caso você utilize um arquivo /root/.my.cnf, sempre inclua as linhas \"user" +#~ "\" e \"password\" nesse arquivo, nunca somente a senha ! Consulte o " +#~ "arquivo /usr/share/doc/mysql-server/README.Debian para mais informações." + +#~ msgid "" +#~ "Should I remove all databases below /var/lib/mysql as you are purging the " +#~ "mysql-server package?" +#~ msgstr "" +#~ "Todas as base de dados sob o diretório /var/lib/mysql devem ser removidas " +#~ "quando você remover o pacote pacote mysql-server ?" + +#~ msgid "" +#~ "Networking is disabled by default for security reasons. You can enable it " +#~ "by commenting out the skip-networking option in /etc/mysql/my.cnf." +#~ msgstr "" +#~ "O suporte ao funcionamento em rede está desativado por padrão por " +#~ "questões de segurança. Você poderá ativá-lo comentando a opção 'skip-" +#~ "networking' no arquivo /etc/mysql/my.cnf." + +#~ msgid "security and update notice" +#~ msgstr "aviso de segurança e actualização" + +#~ msgid "" +#~ "Should I remove everything below /var/lib/mysql when you purge the mysql-" +#~ "server package with the \"dpkg --purge mysql-server\" command (i.e. " +#~ "remove everything including the configuration) somewhen? (default is not)" +#~ msgstr "" +#~ "Devo remover tudo abaixo de /var/lib/mysql quando fizer o purge do pacote " +#~ "mysql-server com o comando \"dpkg --purge mysql-server\" (ou seja, " +#~ "remover tudo incluÃndo a configuração)? (o padrão é não remover)" + +#~ msgid "Make MySQL reachable via network?" +#~ msgstr "Fazer com que o MySQL seja acessÃvel via rede?" + +#~ msgid "" +#~ "Should MySQL listen on a network reachable TCP port? This is not " +#~ "necessary for use on a single computer and could be a security problem." +#~ msgstr "" +#~ "O MySQL deve aguardar ligações numa porta TCP acessÃvel via rede? Isto " +#~ "não é necessário para uso num único computador e pode ser um problema de " +#~ "segurança." + +#~ msgid "Enable chroot mode?" +#~ msgstr "Activar o modo chroot?" + +#~ msgid "" +#~ "MySQL is able to jail itself into the /var/lib/mysql_jail directory so " +#~ "that users cannot modify any files outside this directory. This improves " +#~ "resistence against crackers, too, as they are not able to modify system " +#~ "files." +#~ msgstr "" +#~ "O MySQL é capaz de se prender no diretório /var/lib/mysql_jail, assim os " +#~ "utilizadores não poderão modificar ficheiros fora deste directório. Isto " +#~ "aumenta também a resistência contra crackers, pois eles não poderão " +#~ "modificar arquivos de sistema." + +#~ msgid "Please run mysql_fix_privilege_tables !" +#~ msgstr "Por favor execute mysql_fix_privilege_tables !" + +#~ msgid "" +#~ "I will ensure secure permissions of /var/lib/mysql by replacing GIDs " +#~ "other than root and mysql with mysql." +#~ msgstr "" +#~ "Permissões seguras para o diretório /var/lib/mysql serão asseguradas " +#~ "substituÃndo GIDs diferentes de root e mysql por mysql." + +#~ msgid "" +#~ "Instructions how to enable SSL support are in /usr/share/doc/mysql-server/" +#~ msgstr "" +#~ "Instruções sobre como activar o suporte de SSL estão disponÃveis no " +#~ "directório /usr/share/doc/mysql-server/." + +#, fuzzy +#~ msgid "mysql_fix_privileges_tables should be executed" +#~ msgstr "mysql_fix_privileges_tables será executado" + +#, fuzzy +#~ msgid "" +#~ "The latest MySQL versions have an enhanced, more fine grained, privilege " +#~ "system. To make use of it, some new fields must be added to the tables " +#~ "in the \"mysql\" database. This will not happen automatically." +#~ msgstr "" +#~ "As últimas versões do MySQL possuem um sistema de privilégios melhorado e " +#~ "mais refinado. Para utilizá-lo, alguns novos campos devem ser adicionados " +#~ "as tabelas na base de dados \"mysql\". Isto é feito pelo script " +#~ "mysql_fix_privileges_tables durante esta actualização independente do " +#~ "servidor estar a correr ou não !" + +#~ msgid "" +#~ "This script is not supposed to give any user more rights that he had " +#~ "before, if you encounter such a case, please contact me." +#~ msgstr "" +#~ "Este script não deverá fornecer mais direitos a um utilizador além dos " +#~ "quais ele já possua anteriormente. SE encontrar um caso desses, por favor " +#~ "entre em contacto com o mantainer deste pacote Debian." diff --git a/storage/xtradb/build/debian/po/ro.po b/storage/xtradb/build/debian/po/ro.po new file mode 100644 index 00000000000..37902bfd913 --- /dev/null +++ b/storage/xtradb/build/debian/po/ro.po @@ -0,0 +1,319 @@ +# Romanian translation of mysql-dfsg. +# Copyright (C) 2006 THE mysql-dfsg'S COPYRIGHT HOLDER +# This file is distributed under the same license as the mysql-dfsg package. +# +# Stan Ioan-Eugen <stan.ieugen@gmail.com>, 2006. +msgid "" +msgstr "" +"Project-Id-Version: po-debconf://mysql-dfsg\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2006-12-20 21:27+0200\n" +"Last-Translator: stan ioan-eugen <stan.ieugen@gmail.com>\n" +"Language-Team: romanian <debian-l10n-romanian@lists.debian.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +#, fuzzy +#| msgid "Do you really want to downgrade?" +msgid "Really proceed with downgrade?" +msgstr "SunteÅ£i sigur că doriÅ£i să instalaÅ£i o versiune mai veche?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +#, fuzzy +#| msgid "" +#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates " +#| "that a mysql-server package with a higher version has been installed " +#| "before. It can not be guaranteed that this version can use its data." +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"AVERTISMENT: FiÅŸierul /var/lib/mysql/debian-*.flag există. Acest lucru " +"indică faptul că anterior a fost instalată o versiune nouă a pachetului " +"mysql-server. Nu se poate garanta că versiunea instalată acum poate folosi " +"datele versiunii instalate anterior." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +#, fuzzy +#| msgid "Important note for NIS/YP users!" +msgid "Important note for NIS/YP users" +msgstr "Notă importantă pentru utilizatorii NIS/YP!" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "Remove all Percona SQL databases?" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The script is about to remove the data directory /var/lib/mysql. If it is " +#| "planned to just install a higher MySQL version or if a different mysql-" +#| "server package is already using it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"Scriptul urmează să ÅŸteargă directorul de date /var/lib/mysql. Dacă plănuiÅ£i " +"doar să instalaÅ£i o versiune nouă MySQL sau datele sunt folosite de către un " +"alt pachet mysql-server, atunci ar trebui păstraÅ£i datele." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Should MySQL start on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "DoriÅ£i ca MySQL să pornească la initializarea sistemului?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL can start automatically on boot time or only if you manually " +#| "type '/etc/init.d/mysql start'." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"MySQL poate porni automat la iniÅ£ializarea sistemului sau doar dacă rulaÅ£i " +"comanda „/etc/init.d/mysql startâ€." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "Noua parolă pentru utilizatorul „root†al MySQL:" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "It is highly recommended that you set a password for the MySQL " +#| "administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"Este recomandat să stabiliÅ£i o parolă pentru utilizatorul administrativ " +"„root†al MySQL." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "Noua parolă pentru utilizatorul „root†al MySQL:" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "Nu s-a putut stabili parola pentru utilizatorul „root†al MySQL" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "It seems an error occurred while setting the password for the MySQL " +#| "administrative user. This may have happened because the user already has " +#| "a password, or because there was a problem communicating with the MySQL " +#| "server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"Se pare că a intervenit o eroare în stabilirea parolei pentru utilizatorul " +"administrativ al MySQL. Acest lucru se poate întâmpla dacă utilizatorul are " +"deja o parolă, sau a existat o problemă în comunicarea cu serverul MySQL." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "You should check the account's password after the package installation." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "Cannot upgrade if ISAM tables are present!" +#~ msgstr "Nu se poate face actualizarea dacă sunt prezente tabele ISAM!" + +#~ msgid "" +#~ "Recent versions of MySQL can no longer use the old ISAM table format and " +#~ "it is necessary to convert your tables to e.g. MyISAM before upgrading by " +#~ "using \"mysql_convert_table_format\" or \"ALTER TABLE x ENGINE=MyISAM\". " +#~ "The installation of mysql-server-5.1 will now abort. In case your old " +#~ "mysql-server-4.1 gets removed nevertheless just reinstall it to convert " +#~ "those tables." +#~ msgstr "" +#~ "Versiunile recente MySQL nu mai pot folosi vechiul format de tabele ISAM " +#~ "ÅŸieste necesar să convertiÅ£i tabelele dumneavoastră de ex. la formatul " +#~ "MyISAM înainte de a face actualizarea folosind comanda " +#~ "„mysql_convert_table_format†sau „ALTER TABLE x ENGINE=MyISAMâ€. " +#~ "Instalarea mysql-server-5.1 va eÅŸua. ÃŽn caz că ÅŸtergeÅ£iversiunea " +#~ "anterioară mysql-server-4.1 va trebui reinstalată pentru a converti " +#~ "tabelele." + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "SuportaÅ£i conexiuni MySQL de la staÅ£ii ce rulează sistemul Debian „sarge†" +#~ "sau mai vechi?" + +#, fuzzy +#~| msgid "" +#~| "The way passwords were stored was not very secure. This has been " +#~| "improved with the drawback that clients (e.g. PHP) from hosts running " +#~| "Debian 3.1 Sarge will not be able to connect to account which are new or " +#~| "whose password have been changed. See /usr/share/doc/mysql-server-5.1/" +#~| "README.Debian." +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "Modul în care erau păstrate parolele nu era foarte sigur. Acest lucru a " +#~ "fost îmbunătăţitcu dezajantajul că clienÅ£ii (de ex. PHP) de pe staÅ£ii ce " +#~ "rulează sistemul Debian 3.1 Sargenu se vor putea conecta la conturi noi " +#~ "sau ale căror parole au fost schimbate. CitiÅ£i /usr/share/doc/mysql-" +#~ "server-5.1/README.Debian." + +#~ msgid "" +#~ "To use mysql you must install an equivalent user and group to the " +#~ "following and ensure yourself that /var/lib/mysql has the right " +#~ "permissions (the uid/gid may be different)." +#~ msgstr "" +#~ "Pentru a folosi mysql trebuie să adăugaÅ£i un utilizator ÅŸi grup " +#~ "echivalent ÅŸi să vă asiguraÅ£i că /var/lib/mysql are permisiunile " +#~ "stabilite corect (uid/gid pot aveavalori diferite)." + +#~ msgid "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" +#~ msgstr "" +#~ "/etc/passwd:\tmysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" + +#~ msgid "/etc/group: mysql:x:101:" +#~ msgstr "/etc/group:\tmysql:x:101:" + +#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql" +#~ msgstr "/var/lib/mysql:\tdrwxr-xr-x\tmysql\tmysql" + +#~ msgid "Remove the databases used by all MySQL versions?" +#~ msgstr "DoriÅ£i să ÅŸtergeÅ£i bazele de date folosite de toate versiune MySQL?" + +#~ msgid "" +#~ "If you do not provide a password no changes will be made to the account." +#~ msgstr "" +#~ "Dacă nu introduceÅ£i nici o parolă, nici o schimbare nu va fi luată în " +#~ "considerare." + +#~ msgid "" +#~ "When installation finishes, you should verify that the account is " +#~ "properly protected with a password (see README.Debian for more " +#~ "information)." +#~ msgstr "" +#~ "După finalizarea instalării, ar trebui să verificaÅ£i dacă contul este " +#~ "protejat cu o parolă (citiÅ£i fiÅŸierul README.Debian pentru informaÅ£ii " +#~ "suplimentare)." diff --git a/storage/xtradb/build/debian/po/ru.po b/storage/xtradb/build/debian/po/ru.po new file mode 100644 index 00000000000..14867533070 --- /dev/null +++ b/storage/xtradb/build/debian/po/ru.po @@ -0,0 +1,305 @@ +# translation of mysql-dfsg-5.1_5.0.32-6_ru.po to Russian +# Russian messages: +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry'# +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans# +# Developers do not need to manually edit POT or PO files. +# Ilgiz Kalmetev <translator@ilgiz.pp.ru>, 2003. +# Yuriy Talakan' <yt@amur.elektra.ru>, 2005, 2006. +# Yuriy Talakan' <yt@drsk.ru>, 2007. +# +msgid "" +msgstr "" +"Project-Id-Version: mysql-dfsg-5.1_5.0.32-6_ru\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2007-02-19 11:28+0900\n" +"Last-Translator: Yuriy Talakan' <yt@drsk.ru>\n" +"Language-Team: Russian <debian-l10n-russian@lists.debian.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.9.1\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +#, fuzzy +#| msgid "Do you really want to downgrade?" +msgid "Really proceed with downgrade?" +msgstr "Ð’Ñ‹ дейÑтвительно желаете понизить верÑию?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +#, fuzzy +#| msgid "" +#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates " +#| "that a mysql-server package with a higher version has been installed " +#| "before. It can not be guaranteed that this version can use its data." +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"Ð’ÐИМÐÐИЕ: Ðайден файл /var/lib/mysql/debian-*.flag. Ðто означает, что ранее " +"был уÑтановлен пакет mysql-server более выÑокой верÑии. Ðевозможно " +"гарантировать, что Ñ‚ÐµÐºÑƒÑ‰Ð°Ñ Ð²ÐµÑ€ÑÐ¸Ñ Ñможет иÑпользовать его данные." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +#, fuzzy +#| msgid "Important note for NIS/YP users!" +msgid "Important note for NIS/YP users" +msgstr "Важное замечание Ð´Ð»Ñ Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»ÐµÐ¹ NIS/YP!" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "Remove all Percona SQL databases?" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The script is about to remove the data directory /var/lib/mysql. If it is " +#| "planned to just install a higher MySQL version or if a different mysql-" +#| "server package is already using it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"Сценарий ÑобираетÑÑ ÑƒÐ´Ð°Ð»Ð¸Ñ‚ÑŒ директорию данных /var/lib/mysql. ЕÑли " +"планируетÑÑ ÑƒÑтановить новую верÑию MySQL или еÑÑ‚ÑŒ другие пакеты mysql-" +"server, иÑпользующие Ñту директорию, то данные надо Ñохранить." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Should MySQL start on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "ЗапуÑкать MySQL при загрузке ÑиÑтемы?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL can start automatically on boot time or only if you manually " +#| "type '/etc/init.d/mysql start'." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"MySQL может запуÑкатьÑÑ Ð¿Ñ€Ð¸ загрузке ÑиÑтемы, либо только еÑли вы вручную " +"введете команду '/etc/init.d/mysql start'. " + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "Ðовый пароль Ð´Ð»Ñ MySQL Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ \"root\":" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "It is highly recommended that you set a password for the MySQL " +#| "administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"Крайне рекомендуетÑÑ ÑƒÑтановить пароль Ð´Ð»Ñ Ð°Ð´Ð¼Ð¸Ð½Ð¸Ñтративного MySQL " +"Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ \"root\"." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "Ðовый пароль Ð´Ð»Ñ MySQL Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ \"root\":" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "Ðевозможно задать пароль MySQL пользователю \"root\"" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "It seems an error occurred while setting the password for the MySQL " +#| "administrative user. This may have happened because the user already has " +#| "a password, or because there was a problem communicating with the MySQL " +#| "server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"Ð’ процеÑÑе Ð·Ð°Ð´Ð°Ð½Ð¸Ñ Ð¿Ð°Ñ€Ð¾Ð»Ñ Ð°Ð´Ð¼Ð¸Ð½Ð¸Ñтративного MySQL Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ Ð¿Ñ€Ð¾Ð¸Ð·Ð¾ÑˆÐ»Ð° " +"ошибка. Ðто могло произойти еÑли у Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ ÑƒÐ¶Ðµ был задан пароль, или " +"из-за проблем ÑÐ¾ÐµÐ´Ð¸Ð½ÐµÐ½Ð¸Ñ Ñ Ñервером MySQL." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "You should check the account's password after the package installation." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "Ðужна поддержка подключений к MySQL Ñ Ð¼Ð°ÑˆÐ¸Ð½, работающих под Debian \"sarge" +#~ "\" или Ñтарше?" + +#, fuzzy +#~| msgid "" +#~| "The way passwords were stored was not very secure. This has been " +#~| "improved with the drawback that clients (e.g. PHP) from hosts running " +#~| "Debian 3.1 Sarge will not be able to connect to account which are new or " +#~| "whose password have been changed. See /usr/share/doc/mysql-server-5.1/" +#~| "README.Debian." +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "Метод Ñ…Ñ€Ð°Ð½ÐµÐ½Ð¸Ñ Ð¿Ð°Ñ€Ð¾Ð»Ñ Ð±Ñ‹Ð» не очень безопаÑен. Ðто было Ñделано из-за " +#~ "того, клиенты (например, PHP) Ñ Ð¼Ð°ÑˆÐ¸Ð½, работающих под Debian 3.1 Sarge не " +#~ "Ñмогут подключитьÑÑ Ðº учетной запиÑи еÑли она новаÑ, или пароль был " +#~ "изменен. См. /usr/share/doc/mysql-server-5.1/README.Debian." + +#~ msgid "" +#~ "To use mysql you must install an equivalent user and group to the " +#~ "following and ensure yourself that /var/lib/mysql has the right " +#~ "permissions (the uid/gid may be different)." +#~ msgstr "" +#~ "Чтобы иÑпользовать mysql, Ð’Ñ‹ должны уÑтановить Ñквивалентные Ð¿Ð¾Ð»ÑŒÐ·Ð¾Ð²Ð°Ñ‚ÐµÐ»Ñ " +#~ "и группу, как указано ниже и убедитьÑÑ, что /var/lib/mysql имеет " +#~ "правильные права (uid/gid могут отличатьÑÑ)." + +#~ msgid "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" +#~ msgstr "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" + +#~ msgid "/etc/group: mysql:x:101:" +#~ msgstr "/etc/group: mysql:x:101:" + +#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql" +#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql" + +#~ msgid "Remove the databases used by all MySQL versions?" +#~ msgstr "Удалить базы данных, иÑпользуемые вÑеми верÑиÑми MySQL?" + +#~ msgid "" +#~ "If you do not provide a password no changes will be made to the account." +#~ msgstr "ЕÑли вы не зададите пароль, то ÑƒÑ‡ÐµÑ‚Ð½Ð°Ñ Ð·Ð°Ð¿Ð¸ÑÑŒ не будет изменена." + +#~ msgid "" +#~ "When installation finishes, you should verify that the account is " +#~ "properly protected with a password (see README.Debian for more " +#~ "information)." +#~ msgstr "" +#~ "Когда уÑтановка завершитÑÑ, вы должны убедитьÑÑ, что ÑƒÑ‡ÐµÑ‚Ð½Ð°Ñ Ð·Ð°Ð¿Ð¸ÑÑŒ " +#~ "защищена паролем (подробную информацию Ñм. в README.Debian)." diff --git a/storage/xtradb/build/debian/po/sv.po b/storage/xtradb/build/debian/po/sv.po new file mode 100644 index 00000000000..ea9da131e58 --- /dev/null +++ b/storage/xtradb/build/debian/po/sv.po @@ -0,0 +1,400 @@ +# Translators, if you are not familiar with the PO format, gettext +# documentation is worth reading, especially sections dedicated to +# this format, e.g. by running: +# info -n '(gettext)PO Files' +# info -n '(gettext)Header Entry' +# Some information specific to po-debconf are available at +# /usr/share/doc/po-debconf/README-trans +# or http://www.debian.org/intl/l10n/po-debconf/README-trans +# Developers do not need to manually edit POT or PO files. +# , fuzzy +# +# +msgid "" +msgstr "" +"Project-Id-Version: mysql-dfsg-5.1 5.0.21-3\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2007-02-18 14:48+0100\n" +"Last-Translator: Andreas Henriksson <andreas@fatal.se>\n" +"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Poedit-Language: Swedish\n" +"X-Poedit-Country: SWEDEN\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +#, fuzzy +#| msgid "Do you really want to downgrade?" +msgid "Really proceed with downgrade?" +msgstr "Vill du verkligen nedgradera?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +#, fuzzy +#| msgid "" +#| "WARNING: The file /var/lib/mysql/debian-*.flag exists. This indicates " +#| "that a mysql-server package with a higher version has been installed " +#| "before. It can not be guaranteed that this version can use its data." +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" +"VARNING: Filen /var/lib/mysql/debian-*.flag existerar. Detta betyder att " +"paketet mysql-server med högre versionsnummer har installerats tidigare. Det " +"kan inte garanteras att denna version kan använda dess data." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +#, fuzzy +#| msgid "Important note for NIS/YP users!" +msgid "Important note for NIS/YP users" +msgstr "Viktig notering för NIS/YP-användare!" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "Remove all Percona SQL databases?" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +#, fuzzy +#| msgid "" +#| "The script is about to remove the data directory /var/lib/mysql. If it is " +#| "planned to just install a higher MySQL version or if a different mysql-" +#| "server package is already using it, the data should be kept." +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" +"Scriptet kommer strax ta bort data-katalogen /var/lib/mysql. Om det " +"planerade var att bara installera en högre MySQL-version eller om ett annan " +"mysql-server paket redan använde det, skall datan sparas." + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Should MySQL start on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "Ska MySQL startas när systemet startar upp?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "" +#| "The MySQL can start automatically on boot time or only if you manually " +#| "type '/etc/init.d/mysql start'." +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"MySQL kan startas när systemet startas upp eller endast om du manuellt " +"skriver '/etc/init.d/mysql start'." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "New password for MySQL \"root\" user:" +msgid "New password for the Percona SQL \"root\" user:" +msgstr "Nytt lösenord för MySQLs \"root\"-användare:" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +#, fuzzy +#| msgid "" +#| "It is highly recommended that you set a password for the MySQL " +#| "administrative \"root\" user." +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" +"Det är starkt rekommenderat att du sätter ett lösenord för MySQLs " +"administrativa \"root\"-användare." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +#, fuzzy +#| msgid "New password for MySQL \"root\" user:" +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "Nytt lösenord för MySQLs \"root\"-användare:" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "Unable to set password for MySQL \"root\" user" +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "Lyckades inte sätta lösenord för MySQLs \"root\"-användare" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "It seems an error occurred while setting the password for the MySQL " +#| "administrative user. This may have happened because the user already has " +#| "a password, or because there was a problem communicating with the MySQL " +#| "server." +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" +"Det verkar som ett fel uppstod när det skulle sättas ett lösenord för MySQLs " +"administrativa användare. Detta kan ha skett för att användaren redan har " +"ett lösenord satt, eller på grund av problem med att kommunicera med MySQL-" +"servern." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "You should check the account's password after the package installation." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +#, fuzzy +#| msgid "" +#| "See /usr/share/doc/mysql-server-5.1/README.Debian for more information." +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "Se /usr/share/doc/mysql-server-5.1/README.Debian för mer information." + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "Cannot upgrade if ISAM tables are present!" +#~ msgstr "Kan inte uppgradera om ISAM-tabeller finns!" + +#~ msgid "" +#~ "Recent versions of MySQL can no longer use the old ISAM table format and " +#~ "it is necessary to convert your tables to e.g. MyISAM before upgrading by " +#~ "using \"mysql_convert_table_format\" or \"ALTER TABLE x ENGINE=MyISAM\". " +#~ "The installation of mysql-server-5.1 will now abort. In case your old " +#~ "mysql-server-4.1 gets removed nevertheless just reinstall it to convert " +#~ "those tables." +#~ msgstr "" +#~ "Senaste versionerna av MySQL kan inte längre använda gamla ISAM-" +#~ "tabellformatet och det är nödvändigt att konvertera dina tabeller till " +#~ "exempelvis MyISAM före uppgradering med \"mysql_convert_table_format\" " +#~ "eller \"ALTER TABLE x ENGINE=MyISAM\". Installationen av mysql-server-5.1 " +#~ "kommer nu att avbrytas. Om ditt gamla mysql-server-4.1-paket tas bort är " +#~ "det bara att installera om det för att konvertera de tabellerna." + +#~ msgid "" +#~ "Support MySQL connections from hosts running Debian \"sarge\" or older?" +#~ msgstr "" +#~ "Behöver du MySQL-anslutningar från system som kör Debian \"Sarge\" eller " +#~ "äldre?" + +#, fuzzy +#~| msgid "" +#~| "The way passwords were stored was not very secure. This has been " +#~| "improved with the drawback that clients (e.g. PHP) from hosts running " +#~| "Debian 3.1 Sarge will not be able to connect to account which are new or " +#~| "whose password have been changed. See /usr/share/doc/mysql-server-5.1/" +#~| "README.Debian." +#~ msgid "" +#~ "In old versions of MySQL clients on Debian, passwords were not stored " +#~ "securely. This has been improved since then, however clients (such as " +#~ "PHP) from hosts running Debian 3.1 Sarge will not be able to connect to " +#~ "recent accounts or accounts whose password have been changed." +#~ msgstr "" +#~ "Sättet som lösenorden lagrades på var inte särskilt säkert. Detta har " +#~ "förbättrats på bekostnad av att klienter (t.ex. PHP) från system som kör " +#~ "Debian 3.1 Sarge inte kan ansluta till konton som är nya eller vars " +#~ "lösenord har ändrats. Se /usr/share/doc/mysql-server-5.1/README.Debian." + +#~ msgid "" +#~ "To use mysql you must install an equivalent user and group to the " +#~ "following and ensure yourself that /var/lib/mysql has the right " +#~ "permissions (the uid/gid may be different)." +#~ msgstr "" +#~ "För att använda MySQL måste du installera en motsvarande användare och " +#~ "grupp till följande och se till att /var/lib/mysql har korrekta " +#~ "rättigheter satta (uid/gid kan vara olika)." + +#~ msgid "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" +#~ msgstr "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" + +#~ msgid "/etc/group: mysql:x:101:" +#~ msgstr "/etc/group: mysql:x:101:" + +#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql" +#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql" + +#~ msgid "Remove the databases used by all MySQL versions?" +#~ msgstr "Ta bort databaserna som används av alla MySQL-versioner?" + +#~ msgid "" +#~ "If you do not provide a password no changes will be made to the account." +#~ msgstr "" +#~ "Om du inte anger ett lösenord kommer inga ändringar att göras för kontot." + +#~ msgid "" +#~ "When installation finishes, you should verify that the account is " +#~ "properly protected with a password (see README.Debian for more " +#~ "information)." +#~ msgstr "" +#~ "När installationen är klar, bör du kontrollera så att kontot är riktigt " +#~ "skyddat av ett lösenord (läs README.Debian för mer information)." + +#~ msgid "Update Hints" +#~ msgstr "Uppdateringstips" + +#~ msgid "" +#~ "You have to run \"mysql_upgrade\" after the upgrade, else tables can be " +#~ "corrupted! This script also enhances the privilege tables but is not " +#~ "supposed to give any user more rights that he had before," +#~ msgstr "" +#~ "Du måste köra \"mysql_upgrade\" efter uppgraderingen, annars kan " +#~ "tabellerna vara skadade! Detta skript utökar även privilegietabellerna " +#~ "men är inte tänkte att ge någon användare mer befogenhet än vad han hade " +#~ "tidigare," + +#~ msgid "Please also read http://www.mysql.com/doc/en/Upgrade.html" +#~ msgstr "Läs även http://www.mysql.com/doc/en/Upgrade.html" + +#~ msgid "Install Hints" +#~ msgstr "Installationstips" + +#~ msgid "" +#~ "On upgrades from MySQL 3.23, as shipped with Debian Woody, symlinks in " +#~ "place of /var/lib/mysql or /var/log/mysql gets accidently removed and " +#~ "have manually be restored." +#~ msgstr "" +#~ "Vid uppgraderingar från MySQL 3.23 som skickades med Debian Woody har " +#~ "symboliska länkar i /var/lib/mysql eller /var/log/mysql av misstag tagits " +#~ "bort och måste manuellt återskapas." + +#~ msgid "" +#~ "MySQL will only install if you have a non-numeric hostname that is " +#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command " +#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 " +#~ "myhostname\"." +#~ msgstr "" +#~ "MySQL kan endast installeras om du har ett icke-numeriskt värdnamn som " +#~ "kan slås upp via filen /etc/hosts. Exempelvis om kommandot \"hostname\" " +#~ "returnerar \"mittnamn\" så bör det finnas en rad som liknar \"10.0.0.1 " +#~ "mittnamn\"." + +#~ msgid "" +#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account " +#~ "is used in the start/stop and cron scripts. Don't delete." +#~ msgstr "" +#~ "En ny MySQL-användare kallad \"debian-sys-maint\" kommer att skapas. " +#~ "Detta MySQL-konto används för start/stopp och cron-skript. Ta inte bort " +#~ "det." + +#~ msgid "" +#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /" +#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in " +#~ "there, never only the password!" +#~ msgstr "" +#~ "Tänk på att sätta ett LÖSENORD för MySQL:s root-användare! Om du " +#~ "använder /root/.my.cnf, skriv då alltid en \"user\"-rad och en \"password" +#~ "\"-rad i den, aldrig med endast lösenordet!" + +#~ msgid "" +#~ "Should I remove the complete /var/lib/mysql directory tree which is used " +#~ "by all MySQL versions, not necessarily only the one you are about to " +#~ "purge?" +#~ msgstr "" +#~ "Ska jag ta bort hela katalogträdet i /var/lib/mysql som används av alla " +#~ "MySQL-versioner och inte bara för den som du nu kommer att rensa ut?" + +#~ msgid "" +#~ "Rarely, e.g. on new major versions, the privilege system is improved. To " +#~ "make use of it mysql_fix_privilege_tables must be executed manually. The " +#~ "script is not supposed to give any user more rights that he had before," +#~ msgstr "" +#~ "Sällan, exempelvis i nya större versioner, har behörighetssystemet " +#~ "förbättrats. För att använda det måste skriptet " +#~ "mysql_fix_privilege_tables köras manuellt. Skriptet är inte tänkt att ge " +#~ "någon användare högre behörighet än han hade tidigare." diff --git a/storage/xtradb/build/debian/po/templates.pot b/storage/xtradb/build/debian/po/templates.pot new file mode 100644 index 00000000000..bbddfe37f83 --- /dev/null +++ b/storage/xtradb/build/debian/po/templates.pot @@ -0,0 +1,187 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "Really proceed with downgrade?" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "Important note for NIS/YP users" +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "Remove all Percona SQL databases?" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +msgid "Start the Percona SQL server on boot?" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "New password for the Percona SQL \"root\" user:" +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "You should check the account's password after the package installation." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" diff --git a/storage/xtradb/build/debian/po/tr.po b/storage/xtradb/build/debian/po/tr.po new file mode 100644 index 00000000000..e19ddeedcfa --- /dev/null +++ b/storage/xtradb/build/debian/po/tr.po @@ -0,0 +1,342 @@ +# Turkish translation of mysql-server. +# This file is distributed under the same license as the mysql-server package. +# Gürkan Aslan <gurkan@iaslan.com>, 2004 +# +msgid "" +msgstr "" +"Project-Id-Version: mysql-dfsg-4.1\n" +"Report-Msgid-Bugs-To: percona-xtradb-dfsg-5.1@packages.debian.org\n" +"POT-Creation-Date: 2010-02-15 17:10-0500\n" +"PO-Revision-Date: 2004-06-05 08:53+0300\n" +"Last-Translator: Gürkan Aslan <gurkan@iaslan.com>\n" +"Language-Team: Turkish <debian-l10n-turkish@lists.debian.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "Really proceed with downgrade?" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "A file named /var/lib/mysql/debian-*.flag exists on this system." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"Such file is an indication that a mysql-server package with a higher version " +"has been installed earlier." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:2001 +msgid "" +"There is no guarantee that the version you're currently installing will be " +"able to use the current databases." +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +#, fuzzy +#| msgid "Important note for NIS/YP users!" +msgid "Important note for NIS/YP users" +msgstr "NIS/YP kullanıcıları için önemli not!" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"To use MySQL, the following entries for users and groups should be added to " +"the system:" +msgstr "" + +#. Type: note +#. Description +#: ../percona-xtradb-server-5.1.templates:3001 +msgid "" +"You should also check the permissions and the owner of the /var/lib/mysql " +"directory:" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "Remove all Percona SQL databases?" +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "" +"The /var/lib/mysql directory which contains the Percona SQL databases is " +"about to be removed." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:4001 +msgid "" +"If you're removing the Percona SQL package in order to later install a more " +"recent version or if a different mysql-server package is already using it, " +"the data should be kept." +msgstr "" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +#| msgid "Should MySQL start on boot?" +msgid "Start the Percona SQL server on boot?" +msgstr "MySQL açılış sırasında baÅŸlatılsın mı?" + +#. Type: boolean +#. Description +#: ../percona-xtradb-server-5.1.templates:5001 +#, fuzzy +msgid "" +"The Percona SQL server can be launched automatically at boot time or " +"manually with the '/etc/init.d/mysql start' command." +msgstr "" +"MySQL açılış sırasında veya '/etc/init.d/mysql start' komutunu vermeniz " +"halinde elle baÅŸlatılabilir. EÄŸer açılışta otomatik olarak baÅŸlatılmasını " +"istiyorsanız burada 'evet'i seçin." + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "New password for the Percona SQL \"root\" user:" +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "" +"While not mandatory, it is highly recommended that you set a password for " +"the Percona SQL administrative \"root\" user." +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:6001 +msgid "If that field is left blank, the password will not be changed." +msgstr "" + +#. Type: password +#. Description +#: ../percona-xtradb-server-5.1.templates:7001 +msgid "Repeat password for the Percona SQL \"root\" user:" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "Unable to set password for the Percona SQL \"root\" user" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "" +"An error occurred while setting the password for the Percona SQL " +"administrative user. This may have happened because the account already has " +"a password, or because of a communication problem with the Percona SQL " +"server." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "You should check the account's password after the package installation." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:8001 +msgid "" +"Please read the /usr/share/doc/mysql-server-5.1/README.Debian file for more " +"information." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:9001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "NDB Cluster seems to be in use" +msgstr "" + +#. Type: error +#. Description +#: ../percona-xtradb-server-5.1.templates:10001 +msgid "" +"Percona-SQL-5.1 has orphaned NDB Cluster support. Please migrate to the new " +"mysql-cluster package and remove all lines starting with \"ndb\" from all " +"config files below /etc/mysql/." +msgstr "" + +#~ msgid "" +#~ "To use mysql you must install an equivalent user and group to the " +#~ "following and ensure yourself that /var/lib/mysql has the right " +#~ "permissions (the uid/gid may be different)." +#~ msgstr "" +#~ "Mysql'i kullanmak için aÅŸağıdakiyle eÅŸdeÄŸer bir kullanıcı ve grup " +#~ "tanımlamalı, ve /var/lib/mysql izinlerinin uygun ÅŸekilde ayarlandığından " +#~ "emin olmalısınız (uid/gid farklı olabilir)." + +#~ msgid "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" +#~ msgstr "" +#~ "/etc/passwd: mysql:x:100:101:MySQL Server:/var/lib/mysql:/bin/false" + +#~ msgid "/etc/group: mysql:x:101:" +#~ msgstr "/etc/group: mysql:x:101:" + +#~ msgid "/var/lib/mysql: drwxr-xr-x mysql mysql" +#~ msgstr "/var/lib/mysql: drwxr-xr-x mysql mysql" + +#, fuzzy +#~ msgid "Please also read http://www.mysql.com/doc/en/Upgrade.html" +#~ msgstr "Lütfen http://www.mysql.com/doc/en/Upgrade.html belgesini okuyun" + +#, fuzzy +#~ msgid "" +#~ "MySQL will only install if you have a non-numeric hostname that is " +#~ "resolvable via the /etc/hosts file. E.g. if the \"hostname\" command " +#~ "returns \"myhostname\" then there must be a line like \"10.0.0.1 " +#~ "myhostname\"." +#~ msgstr "" +#~ "MySQL sadece /etc/hosts dosyası yoluyla çözülebilir NUMERÄ°K OLMAYAN bir " +#~ "makine adına sahipseniz kurulacaktır. ÖrneÄŸin, eÄŸer \"hostname\" komutu " +#~ "\"makinem\" ismini döndürüyorsa, bu dosya içinde \"10.0.0.1 makinem\" " +#~ "gibi bir satır olmalıdır." + +#, fuzzy +#~ msgid "" +#~ "A new mysql user \"debian-sys-maint\" will be created. This mysql account " +#~ "is used in the start/stop and cron scripts. Don't delete." +#~ msgstr "" +#~ "Yeni mysql kullanıcısı \"debian-sys-maint\" yaratılacak. Bu hesap, " +#~ "baÅŸlangıç betiklerinde ve cron içinde kullanılıyor. Bu hesabı silmeyin." + +#, fuzzy +#~ msgid "" +#~ "Please remember to set a PASSWORD for the MySQL root user! If you use a /" +#~ "root/.my.cnf, always write the \"user\" and the \"password\" lines in " +#~ "there, never only the password!" +#~ msgstr "" +#~ "Lütfen MySQL root kullanıcısı için bir PAROLA girmeyi unutmayın! EÄŸer /" +#~ "root/.my.cnf kullanıyorsanız, \"user\" ve \"password\" satırlarını her " +#~ "zaman buraya ekleyin, sadece parolayı deÄŸil! Daha fazla bilgi için /usr/" +#~ "share/doc/mysql-server/README.Debian dosyasını okuyun." + +#, fuzzy +#~ msgid "" +#~ "Should I remove all databases below /var/lib/mysql as you are purging the " +#~ "mysql-server package?" +#~ msgstr "" +#~ "mysql-server paketi kaldırıldıktan sonra bütün veritabanları silinsin mi?" + +#~ msgid "" +#~ "Networking is disabled by default for security reasons. You can enable it " +#~ "by commenting out the skip-networking option in /etc/mysql/my.cnf." +#~ msgstr "" +#~ "AÄŸ, öntanımlı olarak güvenlik gerekçeleriyle devre dışı bırakıldı. Bu " +#~ "özelliÄŸi /etc/mysql/my.cnf dosyası içindeki \"skip-networking\" " +#~ "seçeneÄŸini kaldırarak etkinleÅŸtirebilirsiniz." + +#~ msgid "security and update notice" +#~ msgstr "güvenlik ve güncelleme duyurusu" + +#~ msgid "" +#~ "Should I remove everything below /var/lib/mysql when you purge the mysql-" +#~ "server package with the \"dpkg --purge mysql-server\" command (i.e. " +#~ "remove everything including the configuration) somewhen? (default is not)" +#~ msgstr "" +#~ "mysql-server paketini temizlemek için \"dpkg --purge mysql-server\" " +#~ "komutunu kullandığınızda (yani yapılandırma dahil herÅŸeyi silmek) /var/" +#~ "lib/mysql altındaki herÅŸeyi sileyim mi? (öntanımlı cevap hayır'dır)." + +#~ msgid "Please run mysql_fix_privilege_tables !" +#~ msgstr "Lütfen mysql_fix_privilege_tables komutunu çalıştırın!" + +#~ msgid "" +#~ "I will ensure secure permissions of /var/lib/mysql by replacing GIDs " +#~ "other than root and mysql with mysql." +#~ msgstr "" +#~ "/var/lib/mysql'in izinlerinin güvenli olmasını saÄŸlamak amacıyla, buna " +#~ "ait GID'leri root ve mysql'den farklı olacak ÅŸekilde deÄŸiÅŸtireceÄŸim." + +#~ msgid "" +#~ "Instructions how to enable SSL support are in /usr/share/doc/mysql-server/" +#~ msgstr "" +#~ "SSL desteÄŸini nasıl etkinleÅŸtirebileceÄŸinize iliÅŸkin talimatlar /usr/" +#~ "share/doc/mysql-server/ içinde." + +#~ msgid "mysql_fix_privileges_tables will be executed" +#~ msgstr "mysql_fix_privileges_tables çalıştırılacak" + +#~ msgid "" +#~ "The latest MySQL versions have an enhanced, more fine grained, privilege " +#~ "system. To make use of it, some new fields must be added to the tables " +#~ "in the \"mysql\" database. This is done by the " +#~ "mysql_fix_privilege_tables script during this upgrade regardless of if " +#~ "the server is currently running or not!" +#~ msgstr "" +#~ "En son MySQL sürümleri zenginleÅŸtirilmiÅŸ, daha ayrıntılandırılmış bir " +#~ "ayrıcalık (privilege) sistemine sahiptir. Yeni sistemi kullanmak için, " +#~ "\"mysql\" veritabanındaki tablolara bazı yeni alanlar eklenmelidir. Bu " +#~ "iÅŸlem, sunucunun çalışıp çalışmamasına baÄŸlı olmaksızın " +#~ "mysql_fix_privilege_tables betiÄŸi tarafından bu yükseltme sırasında " +#~ "yapılır." + +#~ msgid "" +#~ "This script is not supposed to give any user more rights that he had " +#~ "before, if you encounter such a case, please contact me." +#~ msgstr "" +#~ "Bu betiÄŸin hiç bir kullanıcıya öncekinden daha fazla hak kazandırmadığı " +#~ "varsayılıyor. EÄŸer bunun aksinde bir durumla karşılaşırsanız, lütfen " +#~ "benimle baÄŸlantıya geçin." + +#~ msgid "Make MySQL reachable via network?" +#~ msgstr "MySQL network üzerinden ulaşılabilir olsun mu?" + +#~ msgid "" +#~ "Should MySQL listen on a network reachable TCP port? This is not " +#~ "necessary for use on a single computer and could be a security problem." +#~ msgstr "" +#~ "MySQL aÄŸ üzerinde ulaşılabilen bir TCP portunu dinlesin mi? Tek olan bir " +#~ "bilgisayar için bu ayar gerekli deÄŸildir ve bir güvenlik sorunu " +#~ "oluÅŸturabilir." + +#~ msgid "Enable chroot mode?" +#~ msgstr "chroot kipi etkinleÅŸtirilsin mi?" + +#~ msgid "" +#~ "MySQL is able to jail itself into the /var/lib/mysql_jail directory so " +#~ "that users cannot modify any files outside this directory. This improves " +#~ "resistence against crackers, too, as they are not able to modify system " +#~ "files." +#~ msgstr "" +#~ "MySQL kendini /var/lib/mysql_jail dizinine hapsederek kullanıcıların bu " +#~ "dizin dışındaki hiç bir dosyayı deÄŸiÅŸtirmemesini saÄŸlayabilir. Bu " +#~ "düzenleme, sistem dosyalarını deÄŸiÅŸtirmelerini engelleyeceÄŸinden, " +#~ "cracker'lara karşı dayanıklılığı arttırır." diff --git a/storage/xtradb/build/debian/rules b/storage/xtradb/build/debian/rules new file mode 100755 index 00000000000..f166009da2c --- /dev/null +++ b/storage/xtradb/build/debian/rules @@ -0,0 +1,322 @@ +#!/usr/bin/make -f + +export DH_VERBOSE=1 + +PACKAGE=percona-xtradb-dfsg-5.1 + +include /usr/share/dpatch/dpatch.make + +TMP=$(CURDIR)/debian/tmp/ + +ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH) +ARCH_OS = $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEBVERSION = $(shell dpkg-parsechangelog | awk '/^Version: / { print $$2 }' | sed 's/^.*-//' ) + +DEB_SOURCE_PACKAGE ?= $(strip $(shell egrep '^Source: ' debian/control | cut -f 2 -d ':')) +DEB_VERSION ?= $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') +DEB_NOEPOCH_VERSION ?= $(shell echo $(DEB_VERSION) | cut -d: -f2-) +DEB_UPSTREAM_VERSION ?= $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//') +DEB_UPSTREAM_VERSION_MAJOR_MINOR := $(shell echo $(DEB_UPSTREAM_VERSION) | sed -r -n 's/^([0-9]+\.[0-9]+).*/\1/p') + +DISTRIBUTION = $(shell echo "Percona SQL Server (GPL), XtraDB 10") + +MAKE_J = -j$(shell if [ -f /proc/cpuinfo ] ; then grep -c processor.* /proc/cpuinfo ; else echo 1 ; fi) +ifeq (${MAKE_J}, -j0) + MAKE_J = -j1 +endif + +MAKE_TEST_TARGET=test-force +ifneq ($(findstring $(DEB_BUILD_OPTIONS),fulltest),) +# make test-bt is the testsuite run by the MySQL build team +# before a release, but it is long + MAKE_TEST_TARGET=test-bt +endif + +USE_ASSEMBLER=--enable-assembler + +#ifneq ($(findstring $(ARCH), alpha amd64 arm armel ia64 i386 hppa mipsel powerpc s390 sparc),) +# TESTSUITE_FAIL_CMD=true +#else + TESTSUITE_FAIL_CMD=exit 1 +#endif + +# This causes seg11 crashes if LDAP is used for groups in /etc/nsswitch.conf +# so it is disabled by default although, according to MySQL, it brings >10% +# performance gain if enabled. See #299382. +ifeq ($(STATIC_MYSQLD), 1) + USE_STATIC_MYSQLD=--with-mysqld-ldflags=-all-static +endif + +configure: patch configure-stamp +configure-stamp: + @echo "RULES.configure-stamp" + dh_testdir + +ifneq ($(ARCH_OS),hurd) + if [ ! -d /proc/self ]; then echo "/proc IS NEEDED" 1>&2; exit 1; fi +endif + + sh -c 'PATH=$${MYSQL_BUILD_PATH:-"/bin:/usr/bin"} \ + CC=$${MYSQL_BUILD_CC:-gcc} \ + CFLAGS=$${MYSQL_BUILD_CFLAGS:-"-O3 -DBIG_JOINS=1 ${FORCE_FPIC_CFLAGS}"} \ + CXX=$${MYSQL_BUILD_CXX:-g++} \ + CXXFLAGS=$${MYSQL_BUILD_CXXFLAGS:-"-O3 -DBIG_JOINS=1 -felide-constructors -fno-exceptions -fno-rtti ${FORCE_FPIC_CFLAGS}"} \ + ./configure \ + --build=${DEB_BUILD_GNU_TYPE} \ + --host=${DEB_HOST_GNU_TYPE} \ + \ + --prefix=/usr \ + --exec-prefix=/usr \ + --libexecdir=/usr/sbin \ + --datadir=/usr/share \ + --localstatedir=/var/lib/mysql \ + --includedir=/usr/include \ + --infodir=/usr/share/info \ + --mandir=/usr/share/man \ + \ + --with-server-suffix="-$(DEBVERSION)" \ + --with-comment="($(DISTRIBUTION))" \ + --with-system-type="debian-linux-gnu" \ + \ + --enable-shared \ + --enable-static \ + --enable-thread-safe-client \ + $(USE_ASSEMBLER) \ + --enable-local-infile \ + $(FORCE_FPIC) \ + --with-fast-mutexes \ + --with-big-tables \ + --with-unix-socket-path=/var/run/mysqld/mysqld.sock \ + --with-mysqld-user=mysql \ + --with-libwrap \ + $(USE_STATIC_MYSQLD) \ + --with-ssl \ + --without-docs \ + --with-extra-charsets=all \ + --with-plugins=max-no-ndb \ + \ + --without-embedded-server \ + --with-embedded-privilege-control' + + # --sysconfdir=/etc/mysql -- Appends /etc/mysql after ~/ in the my.cnf search patch! + # + # --with-debug + + touch configure-stamp + + +build: build-stamp +build-stamp: configure + dh_testdir + + $(MAKE) $(MAKE_J) + +ifeq ($(findstring $(DEB_BUILD_OPTIONS),nocheck),) + if [ ! -f testsuite-stamp ] ; then \ + $(MAKE) $(MAKE_TEST_TARGET) || $(TESTSUITE_FAIL_CMD) ; \ + fi +endif + + touch testsuite-stamp + + touch build-stamp + + +clean: clean-patched unpatch + rm -rf debian/patched +clean-patched: + @echo "RULES.clean-patched" + dh_testdir + dh_testroot + rm -f configure-stamp + rm -f build-stamp + rm -f testsuite-stamp + + [ ! -f Makefile ] || $(MAKE) clean + [ ! -d mysql-test/var ] || rm -rf mysql-test/var + + # We like to see how long this is neccessary + @echo "CRUFT BEGIN" + @find -type l -print0 | xargs --no-run-if-empty -0 rm -v + @find -name .deps -type d -print0 | xargs --no-run-if-empty -0 rm -rfv + @rm -vrf ndb/docs/.doxy* ndb/docs/*html ndb/docs/*pdf innobase/autom4te.cache + @for i in \ + readline/Makefile \ + sql-bench/Makefile \ + scripts/make_win_binary_distribution \ + scripts/mysqlbug \ + sql/gen_lex_hash \ + sql/lex_hash.h \ + strings/ctype_autoconf.c \ + config.log \ + config.cache \ + ; \ + do \ + rm -vf $$i; \ + done + @echo "CRUFT END" + + debconf-updatepo + dh_clean -v + + +install: +install: build + @echo "RULES.install" + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + # some self written manpages which hopefully + # gets overwritten sooner or later with upstreams + mkdir -p $(TMP)/usr/share/man/man1/ + mkdir -p $(TMP)/usr/share/man/man8/ + cp debian/additions/*.1 $(TMP)/usr/share/man/man1/ + mkdir -p $(TMP)/etc/mysql/conf.d/ + cp debian/additions/mysqld_safe_syslog.cnf $(TMP)/etc/mysql/conf.d/ + ln -s mysqlmanager.1 $(TMP)/usr/share/man/man1/mysqlmanager-pwgen.1 + ln -s mysqlmanager.1 $(TMP)/usr/share/man/man1/mysqlmanagerc.1 + + # make install (trailing slash needed for innobase) + $(MAKE) install DESTDIR=$(TMP)/ + + # After installing, remove rpath to make lintian happy. + set +e; \ + find ./debian/tmp/ -type f -print0 \ + | xargs -0 --no-run-if-empty chrpath -k 2>/dev/null \ + | fgrep RPATH= \ + | cut -d: -f 1 \ + | xargs --no-run-if-empty chrpath -d; \ + set -e + + # libmysqlclient: move shared libraries (but not the rest like libheap.a & co) + mv $(TMP)/usr/lib/mysql/libmysqlclient* $(TMP)/usr/lib + perl -pi -e 's#/usr/lib/mysql#/usr/lib#' $(TMP)/usr/lib/libmysqlclient.la + perl -pi -e 's#/usr/lib/mysql#/usr/lib#' $(TMP)/usr/lib/libmysqlclient_r.la + # Check if our beloved versioned symbols are really there + if [ "`objdump -T $(TMP)/usr/lib/libmysqlclient.so.16.0.0 | grep -c libmysqlclient_16`" -lt 500 ]; then \ + echo "ERROR: versioned symbols are absent"; \ + exit 1; \ + fi + + # libmysqlclient-dev: forgotten header file since 3.23.25? + cp include/my_config.h $(TMP)/usr/include/mysql/ + cp include/my_dir.h $(TMP)/usr/include/mysql/ + + # percona-xtradb-common: We now provide our own config file. + install -d $(TMP)/etc/mysql + install -m 0644 debian/additions/my.cnf $(TMP)/etc/mysql/my.cnf + + # percona-xtradb-client + install -m 0755 debian/additions/mysqlreport $(TMP)/usr/bin/ + install -m 0755 debian/additions/innotop/innotop $(TMP)/usr/bin/ + install -m 0644 debian/additions/innotop/innotop.1 $(TMP)/usr/share/man/man1/ + install -m 0644 -D debian/additions/innotop/InnoDBParser.pm $(TMP)/usr/share/perl5/InnoDBParser.pm + + # percona-xtradb-server + install -m 0755 scripts/mysqld_safe $(TMP)/usr/bin/mysqld_safe + mkdir -p $(TMP)/usr/share/doc/percona-xtradb-server-5.1/examples + mv $(TMP)/usr/share/mysql/*cnf $(TMP)/usr/share/doc/percona-xtradb-server-5.1/examples/ + rm -vf $(TMP)/usr/share/mysql/mi_test_all* \ + $(TMP)/usr/share/mysql/mysql-log-rotate \ + $(TMP)/usr/share/mysql/mysql.server \ + $(TMP)/usr/share/mysql/binary-configure + nm -n sql/mysqld |gzip -9 > $(TMP)/usr/share/doc/percona-xtradb-server-5.1/mysqld.sym.gz + install -m 0755 debian/additions/echo_stderr $(TMP)/usr/share/mysql/ + install -m 0755 debian/additions/debian-start $(TMP)/etc/mysql/ + install -m 0755 debian/additions/debian-start.inc.sh $(TMP)/usr/share/mysql/ + # lintian overrides + mkdir -p $(TMP)/usr/share/lintian/overrides/ + cp debian/percona-xtradb-common.lintian-overrides $(TMP)/usr/share/lintian/overrides/percona-xtradb-common + cp debian/percona-xtradb-server-5.1.lintian-overrides $(TMP)/usr/share/lintian/overrides/percona-xtradb-server-5.1 + cp debian/percona-xtradb-client-5.1.lintian-overrides $(TMP)/usr/share/lintian/overrides/percona-xtradb-client-5.1 + + # For 5.0 -> 5.1 transition + d=$(TMP)/usr/share/percona-xtradb-common/internal-use-only/; \ + mkdir -p $$d; \ + cp debian/percona-xtradb-server-5.1.mysql.init $$d/_etc_init.d_mysql; \ + cp debian/percona-xtradb-server-5.1.logrotate $$d/_etc_logrotate.d_percona-xtradb-server; \ + cp debian/additions/debian-start $$d/_etc_mysql_debian-start; + + dh_movefiles + +# Build architecture-independent files here. +binary-indep: build install + @echo "RULES.binary-indep" + dh_testdir -i + dh_testroot -i + dh_installdebconf -i + dh_installdocs -i + dh_installexamples -i + dh_installmenu -i + dh_installlogrotate -i + dh_installinit -i + dh_installcron -i + dh_installman -i + dh_installinfo -i + dh_installlogcheck -i + dh_installchangelogs -i + dh_link -i + dh_compress -i + dh_fixperms -i + dh_installdeb -i + dh_perl -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +# Build architecture-dependent files here. +binary-arch: build install + @echo "RULES.binary-arch" + dh_testdir + dh_testroot + + dh_installdebconf -a + dh_installdocs -a + dh_installexamples -a + dh_installmenu -a + dh_installlogrotate -a --name percona-xtradb-server + # Start mysql in runlevel 19 before 20 where apache, proftpd etc gets + # started which might depend on a running database server. + dh_installinit -a --name=mysql -- defaults 19 21 + dh_installcron -a --name percona-xtradb-server + dh_installman -a + dh_installinfo -a + dh_installlogcheck -a + dh_installchangelogs -a + dh_strip -a + dh_link -a # .so muss nach .so.1.2.3 installier werden! + dh_compress -a + dh_fixperms -a + dh_makeshlibs -a + dh_makeshlibs -plibmysqlclient16 -V'libmysqlclient16 (>= 5.1.21-1)' + dh_installdeb -a + dh_perl -a + dh_shlibdeps -a -l debian/libmysqlclient16/usr/lib -L libmysqlclient16 + dh_gencontrol -a + dh_md5sums -a + dh_builddeb -a + +source diff: + @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false + +binary: binary-indep binary-arch + +get-orig-source: + @wget -nv -T10 -t3 \ + -O /tmp/mysql-$(DEB_UPSTREAM_VERSION).tar.gz \ + http://ftp.gwdg.de/pub/misc/mysql/Downloads/MySQL-$(DEB_UPSTREAM_VERSION_MAJOR_MINOR)/mysql-$(DEB_UPSTREAM_VERSION).tar.gz + @tar xfz /tmp/mysql-$(DEB_UPSTREAM_VERSION).tar.gz -C /tmp + @rm -rf /tmp/mysql-$(DEB_UPSTREAM_VERSION)/Docs + @rm -rf /tmp/mysql-$(DEB_UPSTREAM_VERSION)/debian + @mv /tmp/mysql-$(DEB_UPSTREAM_VERSION) /tmp/$(DEB_SOURCE_PACKAGE)-$(DEB_UPSTREAM_VERSION).orig + @cd /tmp ; tar czf $(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_VERSION).orig.tar.gz $(DEB_SOURCE_PACKAGE)-$(DEB_UPSTREAM_VERSION).orig + @rm -f /tmp/mysql-$(DEB_UPSTREAM_VERSION).tar.gz + @rm -rf /tmp/$(DEB_SOURCE_PACKAGE)-$(DEB_UPSTREAM_VERSION).orig + +.PHONY: clean clean-patched configure build binary binary-indep binary-arch install patch unpatch + +# vim: ts=8 diff --git a/storage/xtradb/build/debian/source.lintian-overrides b/storage/xtradb/build/debian/source.lintian-overrides new file mode 100644 index 00000000000..7a93dd28f84 --- /dev/null +++ b/storage/xtradb/build/debian/source.lintian-overrides @@ -0,0 +1,2 @@ +maintainer-script-lacks-debhelper-token debian/mysql-server-5.1.postinst +maintainer-script-lacks-debhelper-token debian/mysql-server-5.1.postrm diff --git a/storage/xtradb/build/debian/watch b/storage/xtradb/build/debian/watch new file mode 100644 index 00000000000..f6fdd67bd8d --- /dev/null +++ b/storage/xtradb/build/debian/watch @@ -0,0 +1,3 @@ +version=3 +opts="uversionmangle=s/-(rc|beta)/$1/" \ + ftp://sunsite.informatik.rwth-aachen.de/pub/mirror/www.mysql.com/Downloads/MySQL-5.1/mysql-([\d\.]*(?:-beta|-rc)?).tar.gz debian diff --git a/storage/xtradb/build/percona-sql.spec b/storage/xtradb/build/percona-sql.spec new file mode 100644 index 00000000000..d0fa6f2a41d --- /dev/null +++ b/storage/xtradb/build/percona-sql.spec @@ -0,0 +1,1644 @@ +############################################################################# +# +# This is the spec file for the distribution specific RPM files +# +############################################################################## + +############################################################################## +# Some common macro definitions +############################################################################## + +# Required arguments +# mysqlversion - e.g. 5.1.37 +# pluginversion - Version of InnoDB plugin taken as the basis, e.g. 1.0.3 +# redhatversion - 5 or 4 +# xtradbversion - The XtraDB release, eg. 6 + +%define mysql_vendor Percona, Inc +%define redhatversion %(cat /etc/redhat-release | awk '{ print $3}' | awk -F. '{ print $1}') +%define community 1 +%define mysqlversion 5.1.45 +%define pluginversion 1.0.6 +%define xtradbversion 10 +%define distribution rhel%{redhatversion} +%define release %{xtradbversion}.%{distribution} + +%define mysqld_user mysql +%define mysqld_group mysql +%define mysqldatadir /var/lib/mysql +%define see_base For a description of MySQL see the base MySQL RPM or http://www.mysql.com + +# ------------------------------------------------------------------------------ +# Meta information, don't remove! +# ------------------------------------------------------------------------------ +# norootforbuild + +# ------------------------------------------------------------------------------ +# On SuSE 9 no separate "debuginfo" package is built. To enable basic +# debugging on that platform, we don't strip binaries on SuSE 9. We +# disable the strip of binaries by redefining the RPM macro +# "__os_install_post" leaving out the script calls that normally does +# this. We do this in all cases, as on platforms where "debuginfo" is +# created, a script "find-debuginfo.sh" will be called that will do +# the strip anyway, part of separating the executable and debug +# information into separate files put into separate packages. +# +# Some references (shows more advanced conditional usage): +# http://www.redhat.com/archives/rpm-list/2001-November/msg00257.html +# http://www.redhat.com/archives/rpm-list/2003-February/msg00275.html +# http://www.redhat.com/archives/rhl-devel-list/2004-January/msg01546.html +# http://lists.opensuse.org/archive/opensuse-commit/2006-May/1171.html +# ------------------------------------------------------------------------------ +%define __os_install_post /usr/lib/rpm/brp-compress + +# ------------------------------------------------------------------------------ +# We don't package all files installed into the build root by intention - +# See BUG#998 for details. +# ------------------------------------------------------------------------------ +%define _unpackaged_files_terminate_build 0 + +# ------------------------------------------------------------------------------ +# RPM build tools now automatically detects Perl module dependencies. This +# detection gives problems as it is broken in some versions, and it also +# give unwanted dependencies from mandatory scripts in our package. +# Might not be possible to disable in all RPM tool versions, but here we +# try. We keep the "AutoReqProv: no" for the "test" sub package, as disabling +# here might fail, and that package has the most problems. +# See http://fedoraproject.org/wiki/Packaging/Perl#Filtering_Requires:_and_Provides +# http://www.wideopen.com/archives/rpm-list/2002-October/msg00343.html +# ------------------------------------------------------------------------------ +%undefine __perl_provides +%undefine __perl_requires + +############################################################################## +# Command line handling +############################################################################## + +# ---------------------------------------------------------------------- +# use "rpmbuild --with yassl" or "rpm --define '_with_yassl 1'" (for RPM 3.x) +# to build with yaSSL support (off by default) +# ---------------------------------------------------------------------- +%{?_with_yassl:%define YASSL_BUILD 1} +%{!?_with_yassl:%define YASSL_BUILD 0} + +# ---------------------------------------------------------------------- +# use "rpmbuild --without libgcc" or "rpm --define '_without_libgcc 1'" (for RPM 3.x) +# to include libgcc (as libmygcc) (on by default) +# ---------------------------------------------------------------------- +%{!?_with_libgcc: %{!?_without_libgcc: %define WITH_LIBGCC 1}} +%{?_with_libgcc:%define WITH_LIBGCC 1} +%{?_without_libgcc:%define WITH_LIBGCC 0} + + +# On SuSE 9 no separate "debuginfo" package is built. To enable basic +# debugging on that platform, we don't strip binaries on SuSE 9. We +# disable the strip of binaries by redefining the RPM macro +# "__os_install_post" leaving out the script calls that normally does +# this. We do this in all cases, as on platforms where "debuginfo" is +# created, a script "find-debuginfo.sh" will be called that will do +# the strip anyway, part of separating the executable and debug +# information into separate files put into separate packages. +# +# Some references (shows more advanced conditional usage): +# http://www.redhat.com/archives/rpm-list/2001-November/msg00257.html +# http://www.redhat.com/archives/rpm-list/2003-February/msg00275.html +# http://www.redhat.com/archives/rhl-devel-list/2004-January/msg01546.html +# http://lists.opensuse.org/archive/opensuse-commit/2006-May/1171.html + +%define __os_install_post /usr/lib/rpm/brp-compress + +%define server_suffix -51 +%define package_suffix -51 +%define ndbug_comment Percona SQL Server (GPL), XtraDB %{xtradbversion} +%define debug_comment Percona SQL Server - Debug (GPL), XtraDB %{xtradbversion} +%define commercial 0 +%define YASSL_BUILD 1 +%define EMBEDDED_BUILD 0 +%define PARTITION_BUILD 1 +%define CLUSTER_BUILD 0 +%define COMMUNITY_BUILD 1 +%define INNODB_BUILD 1 +%define PERCONA_PLUGIN_BUILD 1 +%define MARIA_BUILD 0 +%define NORMAL_TEST_MODE test-bt +%define DEBUG_TEST_MODE test-bt-debug + +%define BUILD_DEBUG 0 + + +%if %{COMMUNITY_BUILD} +%define cluster_package_prefix -cluster +%else +%define cluster_package_prefix - +%endif + +%define lic_type GNU GPL v2 +%define lic_files COPYING README +%define src_dir mysql-%{mysqlversion} + +Source1: percona-xtradb-%{pluginversion}-%{xtradbversion}.tar.gz +Patch0: percona-support.patch + +Patch01: show_patches.patch +Patch02: slow_extended.patch +Patch03: profiling_slow.patch +Patch04: microsec_process.patch +Patch05: userstat.patch +Patch06: optimizer_fix.patch +Patch07: mysql-test_for_xtradb.diff +Patch08: show_temp_51.patch + + +%define perconaxtradbplugin percona-xtradb-%{pluginversion}-%{xtradbversion}.tar.gz + +############################################################################## +# Main spec file section +############################################################################## + +Name: Percona-XtraDB%{package_suffix} +Summary: Percona-XtraDB: a very fast and reliable SQL database server +Group: Applications/Databases +Version: %{mysqlversion} +Release: %{release} +Distribution: Red Hat Enterprise Linux %{redhatversion} +License: GPL version 2 http://www.gnu.org/licenses/gpl-2.0.html +Source: %{src_dir}.tar.gz +URL: http://www.percona.com/ +Packager: %{mysql_vendor} MySQL Development Team <mysql-dev@percona.com> +Vendor: %{mysql_vendor} +Provides: msqlormysql MySQL-server Percona-XtraDB-server +BuildRequires: gperf perl readline-devel gcc-c++ ncurses-devel zlib-devel libtool automake autoconf time ccache bison + +# Think about what you use here since the first step is to +# run a rm -rf +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +# From the manual +%description +The Percona-XtraDB software delivers a very fast, multi-threaded, multi-user, +and robust SQL (Structured Query Language) database server. Percona-XtraDB Server +is intended for mission-critical, heavy-load production systems as well +as for embedding into mass-deployed software. + +Percona Inc. provides commercial support of Percona-XtraDB Server. +For more information visist our web site http://www.percona.com/ + +############################################################################## +# Sub package definition +############################################################################## + +%package -n Percona-XtraDB-server%{package_suffix} +Summary: %{ndbug_comment} for Red Hat Enterprise Linux %{redhatversion} +Group: Applications/Databases +Requires: chkconfig coreutils shadow-utils grep procps +Provides: msqlormysql mysql-server MySQL-server Percona-XtraDB-server +Obsoletes: MySQL mysql mysql-server MySQL-server MySQL-server-community MySQL-server-percona + +%description -n Percona-XtraDB-server%{package_suffix} +The Percona-XtraDB software delivers a very fast, multi-threaded, multi-user, +and robust SQL (Structured Query Language) database server. Percona-XtraDB Server +is intended for mission-critical, heavy-load production systems as well +as for embedding into mass-deployed software. + +Percona Inc. provides commercial support of Percona-XtraDB Server. +For more information visist our web site http://www.percona.com/ + +This package includes the Percona-XtraDB server binary +%if %{INNODB_BUILD} +(configured including XtraDB) +%endif +as well as related utilities to run and administer a Percona-XtraDB server. + +If you want to access and work with the database, you have to install +package "Percona-XtraDB-client%{package_suffix}" as well! + +# ------------------------------------------------------------------------------ + +%package -n Percona-XtraDB-client%{package_suffix} +Summary: Percona-XtraDB - Client +Group: Applications/Databases +Obsoletes: mysql-client MySQL-client MySQL-client-community MySQL-client-percona +Provides: mysql-client MySQL-client Percona-XtraDB-client mysql MySQL + +%description -n Percona-XtraDB-client%{package_suffix} +This package contains the standard Percona-XtraDB clients and administration tools. + +%{see_base} + + +# ------------------------------------------------------------------------------ + +%package -n Percona-XtraDB-test%{package_suffix} +Requires: mysql-client perl +Summary: Percona-XtraDB - Test suite +Group: Applications/Databases +Provides: mysql-test MySQL-test Percona-XtraDB-test +Obsoletes: mysql-test MySQL-test MySQL-test-community MySQL-test-percona +AutoReqProv: no + +%description -n Percona-XtraDB-test%{package_suffix} +This package contains the Percona-XtraDB regression test suite. + +%{see_base} + +# ------------------------------------------------------------------------------ + +%package -n Percona-XtraDB-devel%{package_suffix} +Summary: Percona-XtraDB - Development header files and libraries +Group: Applications/Databases +Provides: mysql-devel MySQL-devel Percona-XtraDB-devel +Obsoletes: mysql-devel MySQL-devel MySQL-devel-community MySQL-devel-percona + +%description -n Percona-XtraDB-devel%{package_suffix} +This package contains the development header files and libraries +necessary to develop Percona-XtraDB client applications. + +%{see_base} + +# ------------------------------------------------------------------------------ + +%package -n Percona-XtraDB-shared%{package_suffix} +Summary: Percona-XtraDB - Shared libraries +Group: Applications/Databases +Provides: mysql-shared MySQL-shared Percona-XtraDB-shared +# Obsoletes below to correct old missing Provides:/Obsoletes +Obsoletes: mysql-shared MySQL-shared-standard MySQL-shared-pro +Obsoletes: MySQL-shared-pro-cert MySQL-shared-pro-gpl +Obsoletes: MySQL-shared-pro-gpl-cert MySQL-shared MySQL-shared-community MySQL-shared-percona + +%description -n Percona-XtraDB-shared%{package_suffix} +This package contains the shared libraries (*.so*) which certain +languages and applications need to dynamically load and use MySQL. + +# ------------------------------------------------------------------------------ + +%if %{PERCONA_PLUGIN_BUILD} + +%package -n Percona-XtraDB-%{pluginversion}-%{xtradbversion} +Requires: Percona-XtraDB-devel +Summary: Percona XtraDB Storage engine for MySQL +Group: Applications/Databases +Provides: percona-xtradb-plugin Percona-XtraDB-plugin +Obsoletes: percona-xtradb-plugin Percona-XtraDB-plugin + +%description -n Percona-XtraDB-%{pluginversion}-%{xtradbversion} +This package contains the Percona-XtraDB storage engine for MySQL server. + +An enhanced version of the InnoDB storage engine, including all +of InnoDB's robust, reliable ACID-compliant design and advanced +MVCC architecture, and builds on that solid foundation with more +features, more tunability, more metrics, and more scalability. +In particular, it is designed to scale better on many cores, +to use memory more efficiently, and to be more convenient and useful. +The new features are especially designed to reduce the need for +awkward workarounds to many of InnoDB's limitations. We choose +features and fixes based on customer requests and on our best +judgment as a high-performance consulting company. + +%endif + +############################################################################## +# +############################################################################## + +%prep + +%setup -n %{src_dir} + +%patch01 -p1 +%patch02 -p1 +%patch03 -p1 +%patch04 -p1 +%patch05 -p1 +%patch06 -p1 +%patch07 -p1 +%patch08 -p1 + +if [ "%{redhatversion}" = "5" ] ; then +tar xfz $RPM_SOURCE_DIR/%{perconaxtradbplugin} -C storage/innobase --strip-components=1 +else +tar xfz $RPM_SOURCE_DIR/%{perconaxtradbplugin} -C storage/innobase --strip-path=1 +fi +%patch0 -p1 + +cd storage/innobase && bash -x ./setup.sh + +############################################################################## +# The actual build +############################################################################## + +%build + +BuildMySQL() { +# Get flags from environment. RPM_OPT_FLAGS seems not to be set anywhere. +CFLAGS=${CFLAGS:-$RPM_OPT_FLAGS} +CXXFLAGS=${CXXFLAGS:-$RPM_OPT_FLAGS} +# Evaluate current setting of $DEBUG +if [ $DEBUG -gt 0 ] ; then + OPT_COMMENT='--with-comment="%{debug_comment}"' + OPT_DEBUG='--with-debug' + CFLAGS=`echo " $CFLAGS " | \ + sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \ + -e 's/^ //' -e 's/ $//'` + CXXFLAGS=`echo " $CXXFLAGS " | \ + sed -e 's/ -O[0-9]* / /' -e 's/ -unroll2 / /' -e 's/ -ip / /' \ + -e 's/^ //' -e 's/ $//'` +else + OPT_COMMENT='--with-comment="%{ndbug_comment}"' + OPT_DEBUG='' +fi + +echo "BUILD ==================" +echo $* + +# The --enable-assembler simply does nothing on systems that does not +# support assembler speedups. +sh -c "CFLAGS=\"$CFLAGS\" \ + CXXFLAGS=\"$CXXFLAGS\" \ + AM_CPPFLAGS=\"$AM_CPPFLAGS\" \ + LDFLAGS=\"$LDFLAGS\" \ + ./configure \ + $* \ + --enable-assembler \ + --enable-local-infile \ + --with-mysqld-user=%{mysqld_user} \ + --with-unix-socket-path=/var/lib/mysql/mysql.sock \ + --with-pic \ + --prefix=/ \ +%if %{CLUSTER_BUILD} + --with-extra-charsets=all \ +%else + --with-extra-charsets=complex \ +%endif +%if %{YASSL_BUILD} + --with-ssl \ +%else + --without-ssl \ +%endif + --exec-prefix=%{_exec_prefix} \ + --libexecdir=%{_sbindir} \ + --libdir=%{_libdir} \ + --sysconfdir=%{_sysconfdir} \ + --datadir=%{_datadir} \ + --localstatedir=%{mysqldatadir} \ + --infodir=%{_infodir} \ + --includedir=%{_includedir} \ + --mandir=%{_mandir} \ + --enable-thread-safe-client \ + --enable-profiling \ +%if %{?ndbug_comment:1}0 + $OPT_COMMENT \ +%endif + $OPT_DEBUG \ +%if %{commercial} + --with-libedit \ +%else + --with-readline \ +%endif + ; make " +} +# end of function definition "BuildMySQL" + + +BuildServer() { +BuildMySQL "--enable-shared \ +%if %{?server_suffix:1}0 + --with-server-suffix='%{server_suffix}' \ +%endif +%if %{CLUSTER_BUILD} + --with-plugin-ndbcluster \ +%else + --without-plugin-ndbcluster \ +%endif +%if %{MARIA_BUILD} + --with-plugin-maria \ + --with-maria-tmp-tables \ +%else + --without-plugin-maria \ +%endif +%if %{INNODB_BUILD} + --with-plugin-innobase \ + --without-plugin-innodb_plugin \ +%else + --without-plugin-innobase \ + --without-plugin-innodb_plugin \ +%endif +%if %{PARTITION_BUILD} + --with-plugin-partition \ +%else + --without-plugin-partition \ +%endif + --with-plugin-csv \ + --with-plugin-archive \ + --with-plugin-blackhole \ + --with-plugin-federated \ +%if %{EMBEDDED_BUILD} + --with-embedded-server \ +%else + --without-embedded-server \ +%endif + --without-bench \ + --with-zlib-dir=bundled \ + --with-big-tables" + +if [ -n "$MYSQL_CONFLOG_DEST" ] ; then + cp -fp config.log "$MYSQL_CONFLOG_DEST" +fi + +#if [ -f sql/.libs/mysqld ] ; then +# nm --numeric-sort sql/.libs/mysqld > sql/mysqld.sym +#else +# nm --numeric-sort sql/mysqld > sql/mysqld.sym +#fi +} +# end of function definition "BuildServer" + + +RBR=$RPM_BUILD_ROOT +MBD=$RPM_BUILD_DIR/%{src_dir} + +# Clean up the BuildRoot first +[ "$RBR" != "/" ] && [ -d $RBR ] && rm -rf $RBR; +mkdir -p $RBR%{_libdir}/mysql $RBR%{_sbindir} + +# Use gcc for C and C++ code (to avoid a dependency on libstdc++ and +# including exceptions into the code +if [ -z "$CXX" -a -z "$CC" ] ; then + export CC="gcc" CXX="gcc" +fi + +if [ "%{redhatversion}" = "5" ] ; then +export CFLAGS="-static-libgcc -O2 -fno-omit-frame-pointer -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic" +export CXXFLAGS="-static-libgcc -O2 -fno-omit-frame-pointer -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic" +fi + +if [ "%{redhatversion}" != "5" ] ; then +export CFLAGS="-static-libgcc -O2 -g -fno-omit-frame-pointer -pipe " +export CXXFLAGS="-static-libgcc -O2 -g -fno-omit-frame-pointer -pipe " +fi + + +# Create the shared libs seperately to avoid a dependency for the client utilities +DEBUG=0 +BuildMySQL "--enable-shared" + +# Install shared libraries +cp -av libmysql/.libs/*.so* $RBR/%{_libdir} +cp -av libmysql_r/.libs/*.so* $RBR/%{_libdir} +mkdir -p $RBR%{_libdir}/mysql/plugin +cp -av storage/innobase/.libs/*.so* $RBR%{_libdir}/mysql/plugin +cp -av storage/innobase/scripts/install_innodb_plugins.sql $RBR%{_libdir}/mysql/plugin + +pushd $RBR%{_libdir}/mysql +tar cfz percona-xtradb-%{pluginversion}-%{xtradbversion}-%{mysqlversion}.$RPM_ARCH.tar.gz plugin +mv percona-xtradb-%{pluginversion}-%{xtradbversion}-%{mysqlversion}.$RPM_ARCH.tar.gz %{_topdir} +popd + +############################################################################## + +# Include libgcc.a in the devel subpackage (BUG 4921) +%if %{WITH_LIBGCC} +libgcc=`$CC $CFLAGS --print-libgcc-file` +install -m 644 "$libgcc" $RBR%{_libdir}/mysql/libmygcc.a +%endif + +############################################################################## + +# Now create a debug server +%if %{BUILD_DEBUG} +DEBUG=1 +make clean + +( BuildServer ) # subshell, so that CFLAGS + CXXFLAGS are modified only locally + +if [ "$MYSQL_RPMBUILD_TEST" != "no" ] ; then + MTR_BUILD_THREAD=auto make %{DEBUG_TEST_MODE} +fi + +# Get the debug server and its .sym file from the build tree +#if [ -f sql/.libs/mysqld ] ; then +# cp sql/.libs/mysqld $RBR%{_sbindir}/mysqld-debug +#else +# cp sql/mysqld $RBR%{_sbindir}/mysqld-debug +#fi +#cp libmysqld/libmysqld.a $RBR%{_libdir}/mysql/libmysqld-debug.a +#cp sql/mysqld.sym $RBR%{_libdir}/mysql/mysqld-debug.sym + +%endif + +# Now, the default server +DEBUG=0 +make clean + +BuildServer + +if [ "$MYSQL_RPMBUILD_TEST" != "no" ] ; then + MTR_BUILD_THREAD=auto make %{NORMAL_TEST_MODE} +fi + +# Now, build plugin +#BUILDSO=0 +#make clean + +#BuildServer + +#if [ "$MYSQL_RPMBUILD_TEST" != "no" ] ; then +# MTR_BUILD_THREAD=auto make %{NORMAL_TEST_MODE} +#fi + +%install +RBR=$RPM_BUILD_ROOT +MBD=$RPM_BUILD_DIR/%{src_dir} + +# Ensure that needed directories exists +install -d $RBR%{_sysconfdir}/{logrotate.d,init.d} +install -d $RBR%{mysqldatadir}/mysql +install -d $RBR%{_datadir}/mysql-test +install -d $RBR%{_datadir}/mysql/SELinux/RHEL4 +install -d $RBR%{_includedir} +install -d $RBR%{_libdir} +install -d $RBR%{_mandir} +install -d $RBR%{_sbindir} +install -d $RBR%{_libdir}/mysql/plugin + +make DESTDIR=$RBR benchdir_root=%{_datadir} install + +# install symbol files ( for stack trace resolution) +#install -m644 $MBD/sql/mysqld.sym $RBR%{_libdir}/mysql/mysqld.sym + +# Install logrotate and autostart +install -m644 $MBD/support-files/mysql-log-rotate \ + $RBR%{_sysconfdir}/logrotate.d/mysql +install -m755 $MBD/support-files/mysql.server \ + $RBR%{_sysconfdir}/init.d/mysql + +# in RPMs, it is unlikely that anybody should use "sql-bench" +rm -fr $RBR%{_datadir}/sql-bench + +# Create a symlink "rcmysql", pointing to the init.script. SuSE users +# will appreciate that, as all services usually offer this. +ln -s %{_sysconfdir}/init.d/mysql $RBR%{_sbindir}/rcmysql + +# Touch the place where the my.cnf config file and mysqlmanager.passwd +# (MySQL Instance Manager password file) might be located +# Just to make sure it's in the file list and marked as a config file +touch $RBR%{_sysconfdir}/my.cnf +touch $RBR%{_sysconfdir}/mysqlmanager.passwd + +# Install SELinux files in datadir +install -m600 $MBD/support-files/RHEL4-SElinux/mysql.{fc,te} \ + $RBR%{_datadir}/mysql/SELinux/RHEL4 + + +############################################################################## +# Post processing actions, i.e. when installed +############################################################################## + +%pre -n Percona-XtraDB-server%{package_suffix} +# Check if we can safely upgrade. An upgrade is only safe if it's from one +# of our RPMs in the same version family. + +installed=`rpm -q --whatprovides mysql-server 2> /dev/null` +if [ $? -eq 0 -a -n "$installed" ]; then + vendor=`rpm -q --queryformat='%{VENDOR}' "$installed" 2>&1` + version=`rpm -q --queryformat='%{VERSION}' "$installed" 2>&1` + myvendor='%{mysql_vendor}' + myversion='%{mysqlversion}' + + old_family=`echo $version | sed -n -e 's,^\([1-9][0-9]*\.[0-9][0-9]*\)\..*$,\1,p'` + new_family=`echo $myversion | sed -n -e 's,^\([1-9][0-9]*\.[0-9][0-9]*\)\..*$,\1,p'` + + [ -z "$vendor" ] && vendor='<unknown>' + [ -z "$old_family" ] && old_family="<unrecognized version $version>" + [ -z "$new_family" ] && new_family="<bad package specification: version $myversion>" + + error_text= +# if [ "$vendor" != "$myvendor" ]; then +# error_text="$error_text +#The current MySQL server package is provided by a different +#vendor ($vendor) than $myvendor. Some files may be installed +#to different locations, including log files and the service +#startup script in %{_sysconfdir}/init.d/. +#" +# fi + + if [ "$old_family" != "$new_family" ]; then + error_text="$error_text +Upgrading directly from MySQL $old_family to MySQL $new_family may not +be safe in all cases. A manual dump and restore using mysqldump is +recommended. It is important to review the MySQL manual's Upgrading +section for version-specific incompatibilities. +" + fi + + if [ -n "$error_text" ]; then + cat <<HERE >&2 + +****************************************************************** +A MySQL server package ($installed) is installed. +$error_text +A manual upgrade is required. + +- Ensure that you have a complete, working backup of your data and my.cnf + files +- Shut down the MySQL server cleanly +- Remove the existing MySQL packages. Usually this command will + list the packages you should remove: + rpm -qa | grep -i '^mysql-' + + You may choose to use 'rpm --nodeps -ev <package-name>' to remove + the package which contains the mysqlclient shared library. The + library will be reinstalled by the MySQL-shared-compat package. +- Install the new MySQL packages supplied by $myvendor +- Ensure that the MySQL server is started +- Run the 'mysql_upgrade' program + +This is a brief description of the upgrade process. Important details +can be found in the MySQL manual, in the Upgrading section. +****************************************************************** +HERE + exit 1 + fi +fi + +# Shut down a previously installed server first +if [ -x %{_sysconfdir}/init.d/mysql ] ; then + %{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1 + echo "Giving mysqld 5 seconds to exit nicely" + sleep 5 +fi + +%post -n Percona-XtraDB-server%{package_suffix} +mysql_datadir=%{mysqldatadir} + +# ---------------------------------------------------------------------- +# Create data directory +# ---------------------------------------------------------------------- +mkdir -p $mysql_datadir/{mysql,test} + +# ---------------------------------------------------------------------- +# Make MySQL start/shutdown automatically when the machine does it. +# ---------------------------------------------------------------------- +if [ -x /sbin/chkconfig ] ; then + /sbin/chkconfig --add mysql +fi + +# ---------------------------------------------------------------------- +# Create a MySQL user and group. Do not report any problems if it already +# exists. +# ---------------------------------------------------------------------- +groupadd -r %{mysqld_group} 2> /dev/null || true +useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true +# The user may already exist, make sure it has the proper group nevertheless (BUG#12823) +usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true + +# ---------------------------------------------------------------------- +# Change permissions so that the user that will run the MySQL daemon +# owns all database files. +# ---------------------------------------------------------------------- +chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir + +# ---------------------------------------------------------------------- +# Initiate databases +# ---------------------------------------------------------------------- +%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user} + +# ---------------------------------------------------------------------- +# FIXME upgrade databases if needed would go here - but it cannot be +# automated yet +# ---------------------------------------------------------------------- + +# ---------------------------------------------------------------------- +# Change permissions again to fix any new files. +# ---------------------------------------------------------------------- +chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir + +# ---------------------------------------------------------------------- +# Fix permissions for the permission database so that only the user +# can read them. +# ---------------------------------------------------------------------- +chmod -R og-rw $mysql_datadir/mysql + +# ---------------------------------------------------------------------- +# install SELinux files - but don't override existing ones +# ---------------------------------------------------------------------- +SETARGETDIR=/etc/selinux/targeted/src/policy +SEDOMPROG=$SETARGETDIR/domains/program +SECONPROG=$SETARGETDIR/file_contexts/program +if [ -f /etc/redhat-release ] && \ + (grep -q "Red Hat Enterprise Linux .. release 4" /etc/redhat-release \ + || grep -q "CentOS release 4" /etc/redhat-release) ; then + echo + echo + echo 'Notes regarding SELinux on this platform:' + echo '=========================================' + echo + echo 'The default policy might cause server startup to fail because it is ' + echo 'not allowed to access critical files. In this case, please update ' + echo 'your installation. ' + echo + echo 'The default policy might also cause inavailability of SSL related ' + echo 'features because the server is not allowed to access /dev/random ' + echo 'and /dev/urandom. If this is a problem, please do the following: ' + echo + echo ' 1) install selinux-policy-targeted-sources from your OS vendor' + echo ' 2) add the following two lines to '$SEDOMPROG/mysqld.te':' + echo ' allow mysqld_t random_device_t:chr_file read;' + echo ' allow mysqld_t urandom_device_t:chr_file read;' + echo ' 3) cd to '$SETARGETDIR' and issue the following command:' + echo ' make load' + echo + echo +fi + +if [ -x sbin/restorecon ] ; then + sbin/restorecon -R var/lib/mysql +fi + +# Restart in the same way that mysqld will be started normally. +if [ -x %{_sysconfdir}/init.d/mysql ] ; then + %{_sysconfdir}/init.d/mysql start + echo "Giving mysqld 2 seconds to start" + sleep 2 +fi + +# Allow mysqld_safe to start mysqld and print a message before we exit +sleep 2 + +%if %{CLUSTER_BUILD} +%post -n MySQL%{cluster_package_prefix}storage%{package_suffix} +# Create cluster directory if needed +mkdir -p /var/lib/mysql-cluster +%endif + +%preun -n Percona-XtraDB-server%{package_suffix} +if [ $1 = 0 ] ; then + # Stop MySQL before uninstalling it + if [ -x %{_sysconfdir}/init.d/mysql ] ; then + %{_sysconfdir}/init.d/mysql stop > /dev/null + # Don't start it automatically anymore + if [ -x /sbin/chkconfig ] ; then + /sbin/chkconfig --del mysql + fi + fi +fi + +# We do not remove the mysql user since it may still own a lot of +# database files. + +# ---------------------------------------------------------------------- +# Clean up the BuildRoot after build is done +# ---------------------------------------------------------------------- +%clean +[ "$RPM_BUILD_ROOT" != "/" ] && [ -d $RPM_BUILD_ROOT ] && rm -rf $RPM_BUILD_ROOT; + +############################################################################## +# Files section +############################################################################## + +%files -n Percona-XtraDB-server%{package_suffix} +%defattr(-,root,root,0755) + +%doc %{lic_files} +%doc support-files/my-*.cnf +%if %{CLUSTER_BUILD} +%doc support-files/ndb-*.ini +%endif + +%doc %attr(644, root, root) %{_infodir}/mysql.info* + +%if %{INNODB_BUILD} +%doc %attr(644, root, man) %{_mandir}/man1/innochecksum.1* +%endif +%doc %attr(644, root, man) %{_mandir}/man1/my_print_defaults.1* +%doc %attr(644, root, man) %{_mandir}/man1/myisam_ftdump.1* +%doc %attr(644, root, man) %{_mandir}/man1/myisamchk.1* +%doc %attr(644, root, man) %{_mandir}/man1/myisamlog.1* +%doc %attr(644, root, man) %{_mandir}/man1/myisampack.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_convert_table_format.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_extensions.1* +%doc %attr(644, root, man) %{_mandir}/man8/mysqld.8* +%doc %attr(644, root, man) %{_mandir}/man1/mysqld_multi.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysqld_safe.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_fix_privilege_tables.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_install_db.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_secure_installation.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_setpermission.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_upgrade.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysqlhotcopy.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysqlman.1* +%doc %attr(644, root, man) %{_mandir}/man8/mysqlmanager.8* +%doc %attr(644, root, man) %{_mandir}/man1/mysql.server.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysqltest.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_tzinfo_to_sql.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_zap.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysqlbug.1* +%doc %attr(644, root, man) %{_mandir}/man1/perror.1* +%doc %attr(644, root, man) %{_mandir}/man1/replace.1* +%doc %attr(644, root, man) %{_mandir}/man1/resolve_stack_dump.1* +%doc %attr(644, root, man) %{_mandir}/man1/resolveip.1* + +%ghost %config(noreplace,missingok) %{_sysconfdir}/my.cnf +%ghost %config(noreplace,missingok) %{_sysconfdir}/mysqlmanager.passwd + +%if %{INNODB_BUILD} +%attr(755, root, root) %{_bindir}/innochecksum +%endif +%attr(755, root, root) %{_bindir}/my_print_defaults +%attr(755, root, root) %{_bindir}/myisam_ftdump +%attr(755, root, root) %{_bindir}/myisamchk +%attr(755, root, root) %{_bindir}/myisamlog +%attr(755, root, root) %{_bindir}/myisampack +%attr(755, root, root) %{_bindir}/mysql_convert_table_format +%attr(755, root, root) %{_bindir}/mysql_fix_extensions +%attr(755, root, root) %{_bindir}/mysql_fix_privilege_tables +%attr(755, root, root) %{_bindir}/mysql_install_db +%attr(755, root, root) %{_bindir}/mysql_secure_installation +%attr(755, root, root) %{_bindir}/mysql_setpermission +%attr(755, root, root) %{_bindir}/mysql_tzinfo_to_sql +%attr(755, root, root) %{_bindir}/mysql_upgrade +%attr(755, root, root) %{_bindir}/mysql_zap +%attr(755, root, root) %{_bindir}/mysqlbug +%attr(755, root, root) %{_bindir}/mysqld_multi +%attr(755, root, root) %{_bindir}/mysqld_safe +%attr(755, root, root) %{_bindir}/mysqldumpslow +%attr(755, root, root) %{_bindir}/mysqlhotcopy +%attr(755, root, root) %{_bindir}/mysqltest +%attr(755, root, root) %{_bindir}/perror +%attr(755, root, root) %{_bindir}/replace +%attr(755, root, root) %{_bindir}/resolve_stack_dump +%attr(755, root, root) %{_bindir}/resolveip + +%attr(755, root, root) %{_sbindir}/mysqld +%if %{BUILD_DEBUG} +%attr(755, root, root) %{_sbindir}/mysqld-debug +%endif +%attr(755, root, root) %{_sbindir}/mysqlmanager +%attr(755, root, root) %{_sbindir}/rcmysql +#%attr(644, root, root) %{_libdir}/mysql/mysqld.sym +%if %{BUILD_DEBUG} +#%attr(644, root, root) %{_libdir}/mysql/mysqld-debug.sym +%endif + +%attr(644, root, root) %config(noreplace,missingok) %{_sysconfdir}/logrotate.d/mysql +%attr(755, root, root) %{_sysconfdir}/init.d/mysql + +%attr(755, root, root) %{_datadir}/mysql/ + +%files -n Percona-XtraDB-client%{package_suffix} +%defattr(-, root, root, 0755) +%attr(755, root, root) %{_bindir}/msql2mysql +%attr(755, root, root) %{_bindir}/mysql +%attr(755, root, root) %{_bindir}/mysql_find_rows +%attr(755, root, root) %{_bindir}/mysql_waitpid +%attr(755, root, root) %{_bindir}/mysqlaccess +%attr(755, root, root) %{_bindir}/mysqladmin +%attr(755, root, root) %{_bindir}/mysqlbinlog +%attr(755, root, root) %{_bindir}/mysqlcheck +%attr(755, root, root) %{_bindir}/mysqldump +%attr(755, root, root) %{_bindir}/mysqlimport +%attr(755, root, root) %{_bindir}/mysqlshow +%attr(755, root, root) %{_bindir}/mysqlslap + +%doc %attr(644, root, man) %{_mandir}/man1/msql2mysql.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_find_rows.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_waitpid.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysqlaccess.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysqladmin.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysqlbinlog.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysqlcheck.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysqldump.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysqlimport.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysqlshow.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysqlslap.1* + +%post -n Percona-XtraDB-shared%{package_suffix} +/sbin/ldconfig + +%postun -n Percona-XtraDB-shared%{package_suffix} +/sbin/ldconfig + +%if %{CLUSTER_BUILD} +%files -n MySQL%{cluster_package_prefix}storage%{package_suffix} +%defattr(-,root,root,0755) +%attr(755, root, root) %{_sbindir}/ndbd +%doc %attr(644, root, man) %{_mandir}/man8/ndbd.8* + +%files -n MySQL%{cluster_package_prefix}management%{package_suffix} +%defattr(-,root,root,0755) +%attr(755, root, root) %{_sbindir}/ndb_mgmd +%doc %attr(644, root, man) %{_mandir}/man8/ndb_mgmd.8* + +%files -n MySQL%{cluster_package_prefix}tools%{package_suffix} +%defattr(-,root,root,0755) +%attr(755, root, root) %{_bindir}/ndb_config +%attr(755, root, root) %{_bindir}/ndb_desc +%attr(755, root, root) %{_bindir}/ndb_error_reporter +%attr(755, root, root) %{_bindir}/ndb_mgm +%attr(755, root, root) %{_bindir}/ndb_restore +%attr(755, root, root) %{_bindir}/ndb_select_all +%attr(755, root, root) %{_bindir}/ndb_select_count +%attr(755, root, root) %{_bindir}/ndb_show_tables +%attr(755, root, root) %{_bindir}/ndb_size.pl +%attr(755, root, root) %{_bindir}/ndb_test_platform +%attr(755, root, root) %{_bindir}/ndb_waiter +%doc %attr(644, root, man) %{_mandir}/man1/ndb_config.1* +%doc %attr(644, root, man) %{_mandir}/man1/ndb_desc.1* +%doc %attr(644, root, man) %{_mandir}/man1/ndb_error_reporter.1* +%doc %attr(644, root, man) %{_mandir}/man1/ndb_mgm.1* +%doc %attr(644, root, man) %{_mandir}/man1/ndb_restore.1* +%doc %attr(644, root, man) %{_mandir}/man1/ndb_select_all.1* +%doc %attr(644, root, man) %{_mandir}/man1/ndb_select_count.1* +%doc %attr(644, root, man) %{_mandir}/man1/ndb_show_tables.1* +%doc %attr(644, root, man) %{_mandir}/man1/ndb_size.pl.1* +%doc %attr(644, root, man) %{_mandir}/man1/ndb_waiter.1* + +%files -n MySQL%{cluster_package_prefix}extra%{package_suffix} +%defattr(-,root,root,0755) +%attr(755, root, root) %{_bindir}/ndb_delete_all +%attr(755, root, root) %{_bindir}/ndb_drop_index +%attr(755, root, root) %{_bindir}/ndb_drop_table +%attr(755, root, root) %{_sbindir}/ndb_cpcd +%doc %attr(644, root, man) %{_mandir}/man1/ndb_delete_all.1* +%doc %attr(644, root, man) %{_mandir}/man1/ndb_drop_index.1* +%doc %attr(644, root, man) %{_mandir}/man1/ndb_drop_table.1* +%doc %attr(644, root, man) %{_mandir}/man1/ndb_cpcd.1* +%endif + +%files -n Percona-XtraDB-devel%{package_suffix} +%defattr(-, root, root, 0755) +%if %{commercial} +%else +%doc EXCEPTIONS-CLIENT +%endif +%doc %attr(644, root, man) %{_mandir}/man1/comp_err.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql_config.1* +%attr(755, root, root) %{_bindir}/mysql_config +%dir %attr(755, root, root) %{_libdir}/mysql +%{_includedir}/mysql +%{_datadir}/aclocal/mysql.m4 +%{_libdir}/mysql/libdbug.a +%{_libdir}/mysql/libheap.a +%if %{WITH_LIBGCC} +%{_libdir}/mysql/libmygcc.a +%endif +%{_libdir}/mysql/libmyisam.a +%{_libdir}/mysql/libmyisammrg.a +%{_libdir}/mysql/libmysqlclient.a +%{_libdir}/mysql/libmysqlclient.la +%{_libdir}/mysql/libmysqlclient_r.a +%{_libdir}/mysql/libmysqlclient_r.la +%{_libdir}/mysql/libmystrings.a +%{_libdir}/mysql/libmysys.a +%{_libdir}/mysql/libvio.a +%{_libdir}/mysql/libz.a +%{_libdir}/mysql/libz.la +%if %{CLUSTER_BUILD} +%{_libdir}/mysql/libndbclient.a +%{_libdir}/mysql/libndbclient.la +%endif + +%files -n Percona-XtraDB-shared%{package_suffix} +%defattr(-, root, root, 0755) +# Shared libraries (omit for architectures that don't support them) +%{_libdir}/*.so* + +%files -n Percona-XtraDB-test%{package_suffix} +%defattr(-, root, root, 0755) +%{_datadir}/mysql-test +%attr(755, root, root) %{_bindir}/mysql_client_test +%doc %attr(644, root, man) %{_mandir}/man1/mysql_client_test.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql-stress-test.pl.1* +%doc %attr(644, root, man) %{_mandir}/man1/mysql-test-run.pl.1* + +%files -n Percona-XtraDB-%{pluginversion}-%{xtradbversion} +%defattr(-, root, root, 0755) +%attr(644, root, root) %{_libdir}/mysql/plugin/ha_innodb.so* +%attr(644, root, root) %{_libdir}/mysql/plugin/install_innodb_plugins.sql + +############################################################################## +# The spec file changelog only includes changes made to the spec file +# itself - note that they must be ordered by date (important when +# merging BK trees) +############################################################################## +%changelog +* Mon Mar 22 2010 Aleksandr Kuzminsky <aleksandr.kuzminsky@percona.com> + +XtraDB Release 10 + +* Thu Feb 11 2010 Aleksandr Kuzminsky <aleksandr.kuzminsky@percona.com> + +Package name changed to Percona-XtraDB + +* Tue Jan 05 2010 Aleksandr Kuzminsky <aleksandr.kuzminsky@percona.com> + +- Corrected emails +- -m64 is removed from CFLAGS + +* Tue Apr 21 2009 Aleksandr Kuzminsky <aleksandr.kuzminsky@percona.com> + +- Adoption for XtraDB Storage Engine + +* Fri Nov 07 2008 Joerg Bruehe <joerg@mysql.com> + +- Modify CFLAGS and CXXFLAGS such that a debug build is not optimized. + This should cover both gcc and icc flags. Fixes bug#40546. + +* Mon Aug 18 2008 Joerg Bruehe <joerg@mysql.com> + +- Get rid of the "warning: Installed (but unpackaged) file(s) found:" + Some generated files aren't needed in RPMs: + - the "sql-bench/" subdirectory + Some files were missing: + - /usr/share/aclocal/mysql.m4 ("devel" subpackage) + - Manuals for embedded tests ("test" subpackage) + - Manual "mysqlbug" ("server" subpackage) + - Manual "mysql_find_rows" ("client" subpackage) + +* Wed Jun 11 2008 Kent Boortz <kent@mysql.com> + +- Removed the Example storage engine, it is not to be in products + +* Fri Apr 04 2008 Daniel Fischer <df@mysql.com> + +- Added Cluster+InnoDB product + +* Mon Mar 31 2008 Kent Boortz <kent@mysql.com> + +- Made the "Federated" storage engine an option + +* Tue Mar 11 2008 Joerg Bruehe <joerg@mysql.com> + +- Cleanup: Remove manual file "mysql_tableinfo.1". + +* Mon Feb 18 2008 Timothy Smith <tim@mysql.com> + +- Require a manual upgrade if the alread-installed mysql-server is + from another vendor, or is of a different major version. + +* Fri Dec 14 2007 Joerg Bruehe <joerg@mysql.com> + +- Add the "%doc" directive for all man pages and other documentation; + also, some re-ordering to reduce differences between spec files. + +* Fri Dec 14 2007 Joerg Bruehe <joerg@mysql.com> + +- Added "client/mysqlslap" (bug#32077) + +* Wed Oct 31 2007 Joerg Bruehe <joerg@mysql.com> + +- Explicitly handle InnoDB using its own variable and "--with"/"--without" + options, because the "configure" default is "yes". + Also, fix the specification of "community" to include "partitioning". + +* Mon Sep 03 2007 Kent Boortz <kent@mysql.com> + +- Let libmygcc be included unless "--without libgcc" is given. + +* Sun Sep 02 2007 Kent Boortz <kent@mysql.com> + +- Changed SSL flag given to configure to "--with-ssl" +- Removed symbolic link "safe_mysqld" +- Removed script and man page for "mysql_explain_log" +- Removed scripts "mysql_tableinfo" and "mysql_upgrade_shell" +- Removed "comp_err" from list to install +- Removed duplicates of "libndbclient.a" and "libndbclient.la" + +* Tue Jul 17 2007 Joerg Bruehe <joerg@mysql.com> + +- Add the man page for "mysql-stress-test.pl" to the "test" RPM + (consistency in fixing bug#21023, the script is handled by "Makefile.am") + +* Wed Jul 11 2007 Daniel Fischer <df@mysql.com> + +- Change the way broken SELinux policies on RHEL4 and CentOS 4 + are handled to be more likely to actually work + +* Thu Jun 05 2007 kent Boortz <kent@mysql.com> + +- Enabled the CSV engine in all builds + +* Thu May 3 2007 Mads Martin Joergensen <mmj@mysql.com> + +- Spring cleanup + +* Thu Apr 19 2007 Mads Martin Joergensen <mmj@mysql.com> + +- If sbin/restorecon exists then run it + +* Wed Apr 18 2007 Kent Boortz <kent@mysql.com> + +- Packed unpacked files + + /usr/sbin/ndb_cpcd + /usr/bin/mysql_upgrade_shell + /usr/bin/innochecksum + /usr/share/man/man1/ndb_cpcd.1.gz + /usr/share/man/man1/innochecksum.1.gz + /usr/share/man/man1/mysql_fix_extensions.1.gz + /usr/share/man/man1/mysql_secure_installation.1.gz + /usr/share/man/man1/mysql_tableinfo.1.gz + /usr/share/man/man1/mysql_waitpid.1.gz + +- Commands currently not installed but that has man pages + + /usr/share/man/man1/make_win_bin_dist.1.gz + /usr/share/man/man1/make_win_src_distribution.1.gz + /usr/share/man/man1/mysql-stress-test.pl.1.gz + /usr/share/man/man1/ndb_print_backup_file.1.gz + /usr/share/man/man1/ndb_print_schema_file.1.gz + /usr/share/man/man1/ndb_print_sys_file.1.gz + +* Thu Mar 22 2007 Joerg Bruehe <joerg@mysql.com> + +- Add "comment" options to the test runs, for better log analysis. + +* Wed Mar 21 2007 Joerg Bruehe <joerg@mysql.com> + +- Add even more man pages. + +* Fri Mar 16 2007 Joerg Bruehe <joerg@mysql.com> + +- Build the server twice, once as "mysqld-debug" and once as "mysqld"; + test them both, and include them in the resulting file. +- Consequences of the fix for bug#20166: + Remove "mysql_create_system_tables", + new "mysql_fix_privilege_tables.sql" is included implicitly. + +* Wed Mar 14 2007 Daniel Fischer <df@mysql.com> + +- Adjust compile options some more and change naming of community + cluster RPMs to explicitly say 'cluster'. + +* Mon Mar 12 2007 Daniel Fischer <df@mysql.com> + +- Adjust compile options and other settings for 5.0 community builds. + +* Fri Mar 02 2007 Joerg Bruehe <joerg@mysql.com> + +- Add several man pages which are now created. + +* Mon Jan 29 2007 Mads Martin Joergensen <mmj@mysql.com> + +- Make sure SELinux works correctly. Files from Colin Charles. + +* Fri Jan 05 2007 Kent Boortz <kent@mysql.com> + +- Add CFLAGS to gcc call with --print-libgcc-file, to make sure the + correct "libgcc.a" path is returned for the 32/64 bit architecture. + +* Tue Dec 19 2006 Joerg Bruehe <joerg@mysql.com> + +- The man page for "mysqld" is now in section 8. + +* Thu Dec 14 2006 Joerg Bruehe <joerg@mysql.com> + +- Include the new man pages for "my_print_defaults" and "mysql_tzinfo_to_sql" + in the server RPM. +- The "mysqlmanager" man page was relocated to section 8, reflect that. + +* Fri Nov 17 2006 Mads Martin Joergensen <mmj@mysql.com> + +- Really fix obsoletes/provides for community -> this +- Make it possible to not run test by setting + MYSQL_RPMBUILD_TEST to "no" + +* Wed Nov 15 2006 Joerg Bruehe <joerg@mysql.com> + +- Switch from "make test*" to explicit calls of the test suite, + so that "report features" can be used. + +* Wed Nov 15 2006 Kent Boortz <kent@mysql.com> + +- Added "--with cluster" and "--define cluster{_gpl}" + +* Tue Oct 24 2006 Mads Martin Joergensen <mmj@mysql.com> + +- Shared need to Provide/Obsolete mysql-shared + +* Mon Oct 23 2006 Mads Martin Joergensen <mmj@mysql.com> + +- Run sbin/restorecon after db init (Bug#12676) + +* Thu Jul 06 2006 Joerg Bruehe <joerg@mysql.com> + +- Correct a typing error in my previous change. + +* Tue Jul 04 2006 Joerg Bruehe <joerg@mysql.com> + +- Use the Perl script to run the tests, because it will automatically check + whether the server is configured with SSL. + +* Wed Jun 28 2006 Joerg Bruehe <joerg@mysql.com> + +- Revert all previous attempts to call "mysql_upgrade" during RPM upgrade, + there are some more aspects which need to be solved before this is possible. + For now, just ensure the binary "mysql_upgrade" is delivered and installed. + +* Wed Jun 28 2006 Joerg Bruehe <joerg@mysql.com> + +- Move "mysqldumpslow" from the client RPM to the server RPM (bug#20216). + +* Wed Jun 21 2006 Joerg Bruehe <joerg@mysql.com> + +- To run "mysql_upgrade", we need a running server; + start it in isolation and skip password checks. + +* Sat May 23 2006 Kent Boortz <kent@mysql.com> + +- Always compile for PIC, position independent code. + +* Fri Apr 28 2006 Kent Boortz <kent@mysql.com> + +- Install and run "mysql_upgrade" + +* Sat Apr 01 2006 Kent Boortz <kent@mysql.com> + +- Allow to override $LDFLAGS + +* Fri Jan 06 2006 Lenz Grimmer <lenz@mysql.com> + +- added a MySQL-test subpackage (BUG#16070) + +* Tue Dec 27 2005 Joerg Bruehe <joerg@mysql.com> + +- Some minor alignment with the 4.1 version + +* Wed Dec 14 2005 Rodrigo Novo <rodrigo@mysql.com> + +- Cosmetic changes: source code location & rpm packager +- Protect "nm -D" against libtool weirdness +- Add libz.a & libz.la to the list of files for subpackage -devel +- moved --with-zlib-dir=bundled out of BuildMySQL, as it doesn't makes + sense for the shared package + +* Tue Nov 22 2005 Joerg Bruehe <joerg@mysql.com> + +- Extend the file existence check for "init.d/mysql" on un-install + to also guard the call to "insserv"/"chkconfig". + +* Wed Nov 16 2005 Lenz Grimmer <lenz@mysql.com> + +- added mysql_client_test to the "client" subpackage (BUG#14546) + +* Tue Nov 15 2005 Lenz Grimmer <lenz@mysql.com> + +- changed default definitions to build a standard GPL release when not + defining anything else +- install the shared libs more elegantly by using "make install" + +* Wed Oct 19 2005 Kent Boortz <kent@mysql.com> + +- Made yaSSL support an option (off by default) + +* Wed Oct 19 2005 Kent Boortz <kent@mysql.com> + +- Enabled yaSSL support + +* Thu Oct 13 2005 Lenz Grimmer <lenz@mysql.com> + +- added a usermod call to assign a potential existing mysql user to the + correct user group (BUG#12823) +- added a separate macro "mysqld_group" to be able to define the + user group of the mysql user seperately, if desired. + +* Fri Oct 1 2005 Kent Boortz <kent@mysql.com> + +- Copy the config.log file to location outside + the build tree + +* Fri Sep 30 2005 Lenz Grimmer <lenz@mysql.com> + +- don't use install-strip to install the binaries (strip segfaults on + icc-compiled binaries on IA64) + +* Thu Sep 22 2005 Lenz Grimmer <lenz@mysql.com> + +- allow overriding the CFLAGS (needed for Intel icc compiles) +- replace the CPPFLAGS=-DBIG_TABLES with "--with-big-tables" configure option + +* Fri Aug 19 2005 Joerg Bruehe <joerg@mysql.com> + +- Protect against failing tests. + +* Thu Aug 04 2005 Lenz Grimmer <lenz@mysql.com> + +- Fixed the creation of the mysql user group account in the postinstall + section (BUG 12348) + +* Fri Jul 29 2005 Lenz Grimmer <lenz@mysql.com> + +- Fixed external RPM Requirements to better suit the target distribution + (BUG 12233) + +* Fri Jul 15 2005 Lenz Grimmer <lenz@mysql.com> + +- create a "mysql" user group and assign the mysql user account to that group + in the server postinstall section. (BUG 10984) + +* Wed Jun 01 2005 Lenz Grimmer <lenz@mysql.com> + +- use "mysqldatadir" variable instead of hard-coding the path multiple times +- use the "mysqld_user" variable on all occasions a user name is referenced +- removed (incomplete) Brazilian translations +- removed redundant release tags from the subpackage descriptions + +* Fri May 27 2005 Lenz Grimmer <lenz@mysql.com> + +- fixed file list (removed libnisam.a and libmerge.a from the devel subpackage) +- force running the test suite + +* Wed Apr 20 2005 Lenz Grimmer <lenz@mysql.com> + +- Enabled the "blackhole" storage engine for the Max RPM + +* Wed Apr 13 2005 Lenz Grimmer <lenz@mysql.com> + +- removed the MySQL manual files (html/ps/texi) - they have been removed + from the MySQL sources and are now available seperately. + +* Mon Apr 4 2005 Petr Chardin <petr@mysql.com> + +- old mysqlmanager, mysqlmanagerc and mysqlmanager-pwger renamed into + mysqltestmanager, mysqltestmanager and mysqltestmanager-pwgen respectively + +* Fri Mar 18 2005 Lenz Grimmer <lenz@mysql.com> + +- Disabled RAID in the Max binaries once and for all (it has finally been + removed from the source tree) + +* Sun Feb 20 2005 Petr Chardin <petr@mysql.com> + +- Install MySQL Instance Manager together with mysqld, touch mysqlmanager + password file + +* Mon Feb 14 2005 Lenz Grimmer <lenz@mysql.com> + +- Fixed the compilation comments and moved them into the separate build sections + for Max and Standard + +* Mon Feb 7 2005 Tomas Ulin <tomas@mysql.com> + +- enabled the "Ndbcluster" storage engine for the max binary +- added extra make install in ndb subdir after Max build to get ndb binaries +- added packages for ndbcluster storage engine + +* Fri Jan 14 2005 Lenz Grimmer <lenz@mysql.com> + +- replaced obsoleted "BuildPrereq" with "BuildRequires" instead + +* Thu Jan 13 2005 Lenz Grimmer <lenz@mysql.com> + +- enabled the "Federated" storage engine for the max binary + +* Tue Jan 04 2005 Petr Chardin <petr@mysql.com> + +- ISAM and merge storage engines were purged. As well as appropriate + tools and manpages (isamchk and isamlog) + +* Thu Dec 31 2004 Lenz Grimmer <lenz@mysql.com> + +- enabled the "Archive" storage engine for the max binary +- enabled the "CSV" storage engine for the max binary +- enabled the "Example" storage engine for the max binary + +* Thu Aug 26 2004 Lenz Grimmer <lenz@mysql.com> + +- MySQL-Max now requires MySQL-server instead of MySQL (BUG 3860) + +* Fri Aug 20 2004 Lenz Grimmer <lenz@mysql.com> + +- do not link statically on IA64/AMD64 as these systems do not have + a patched glibc installed + +* Tue Aug 10 2004 Lenz Grimmer <lenz@mysql.com> + +- Added libmygcc.a to the devel subpackage (required to link applications + against the the embedded server libmysqld.a) (BUG 4921) + +* Mon Aug 09 2004 Lenz Grimmer <lenz@mysql.com> + +- Added EXCEPTIONS-CLIENT to the "devel" package + +* Thu Jul 29 2004 Lenz Grimmer <lenz@mysql.com> + +- disabled OpenSSL in the Max binaries again (the RPM packages were the + only exception to this anyway) (BUG 1043) + +* Wed Jun 30 2004 Lenz Grimmer <lenz@mysql.com> + +- fixed server postinstall (mysql_install_db was called with the wrong + parameter) + +* Thu Jun 24 2004 Lenz Grimmer <lenz@mysql.com> + +- added mysql_tzinfo_to_sql to the server subpackage +- run "make clean" instead of "make distclean" + +* Mon Apr 05 2004 Lenz Grimmer <lenz@mysql.com> + +- added ncurses-devel to the build prerequisites (BUG 3377) + +* Thu Feb 12 2004 Lenz Grimmer <lenz@mysql.com> + +- when using gcc, _always_ use CXX=gcc +- replaced Copyright with License field (Copyright is obsolete) + +* Tue Feb 03 2004 Lenz Grimmer <lenz@mysql.com> + +- added myisam_ftdump to the Server package + +* Tue Jan 13 2004 Lenz Grimmer <lenz@mysql.com> + +- link the mysql client against libreadline instead of libedit (BUG 2289) + +* Mon Dec 22 2003 Lenz Grimmer <lenz@mysql.com> + +- marked /etc/logrotate.d/mysql as a config file (BUG 2156) + +* Fri Dec 13 2003 Lenz Grimmer <lenz@mysql.com> + +- fixed file permissions (BUG 1672) + +* Thu Dec 11 2003 Lenz Grimmer <lenz@mysql.com> + +- made testing for gcc3 a bit more robust + +* Fri Dec 05 2003 Lenz Grimmer <lenz@mysql.com> + +- added missing file mysql_create_system_tables to the server subpackage + +* Fri Nov 21 2003 Lenz Grimmer <lenz@mysql.com> + +- removed dependency on MySQL-client from the MySQL-devel subpackage + as it is not really required. (BUG 1610) + +* Fri Aug 29 2003 Lenz Grimmer <lenz@mysql.com> + +- Fixed BUG 1162 (removed macro names from the changelog) +- Really fixed BUG 998 (disable the checking for installed but + unpackaged files) + +* Tue Aug 05 2003 Lenz Grimmer <lenz@mysql.com> + +- Fixed BUG 959 (libmysqld not being compiled properly) +- Fixed BUG 998 (RPM build errors): added missing files to the + distribution (mysql_fix_extensions, mysql_tableinfo, mysqldumpslow, + mysql_fix_privilege_tables.1), removed "-n" from install section. + +* Wed Jul 09 2003 Lenz Grimmer <lenz@mysql.com> + +- removed the GIF Icon (file was not included in the sources anyway) +- removed unused variable shared_lib_version +- do not run automake before building the standard binary + (should not be necessary) +- add server suffix '-standard' to standard binary (to be in line + with the binary tarball distributions) +- Use more RPM macros (_exec_prefix, _sbindir, _libdir, _sysconfdir, + _datadir, _includedir) throughout the spec file. +- allow overriding CC and CXX (required when building with other compilers) + +* Fri May 16 2003 Lenz Grimmer <lenz@mysql.com> + +- re-enabled RAID again + +* Wed Apr 30 2003 Lenz Grimmer <lenz@mysql.com> + +- disabled MyISAM RAID (--with-raid) - it throws an assertion which + needs to be investigated first. + +* Mon Mar 10 2003 Lenz Grimmer <lenz@mysql.com> + +- added missing file mysql_secure_installation to server subpackage + (BUG 141) + +* Tue Feb 11 2003 Lenz Grimmer <lenz@mysql.com> + +- re-added missing pre- and post(un)install scripts to server subpackage +- added config file /etc/my.cnf to the file list (just for completeness) +- make sure to create the datadir with 755 permissions + +* Mon Jan 27 2003 Lenz Grimmer <lenz@mysql.com> + +- removed unused CC and CXX variables +- CFLAGS and CXXFLAGS should honor RPM_OPT_FLAGS + +* Fri Jan 24 2003 Lenz Grimmer <lenz@mysql.com> + +- renamed package "MySQL" to "MySQL-server" +- fixed Copyright tag +- added mysql_waitpid to client subpackage (required for mysql-test-run) + +* Wed Nov 27 2002 Lenz Grimmer <lenz@mysql.com> + +- moved init script from /etc/rc.d/init.d to /etc/init.d (the majority of + Linux distributions now support this scheme as proposed by the LSB either + directly or via a compatibility symlink) +- Use new "restart" init script action instead of starting and stopping + separately +- Be more flexible in activating the automatic bootup - use insserv (on + older SuSE versions) or chkconfig (Red Hat, newer SuSE versions and + others) to create the respective symlinks + +* Wed Sep 25 2002 Lenz Grimmer <lenz@mysql.com> + +- MySQL-Max now requires MySQL >= 4.0 to avoid version mismatches + (mixing 3.23 and 4.0 packages) + +* Fri Aug 09 2002 Lenz Grimmer <lenz@mysql.com> + +- Turn off OpenSSL in MySQL-Max for now until it works properly again +- enable RAID for the Max binary instead +- added compatibility link: safe_mysqld -> mysqld_safe to ease the + transition from 3.23 + +* Thu Jul 18 2002 Lenz Grimmer <lenz@mysql.com> + +- Reworked the build steps a little bit: the Max binary is supposed + to include OpenSSL, which cannot be linked statically, thus trying + to statically link against a special glibc is futile anyway +- because of this, it is not required to make yet another build run + just to compile the shared libs (saves a lot of time) +- updated package description of the Max subpackage +- clean up the BuildRoot directory afterwards + +* Mon Jul 15 2002 Lenz Grimmer <lenz@mysql.com> + +- Updated Packager information +- Fixed the build options: the regular package is supposed to + include InnoDB and linked statically, while the Max package + should include BDB and SSL support + +* Fri May 03 2002 Lenz Grimmer <lenz@mysql.com> + +- Use more RPM macros (e.g. infodir, mandir) to make the spec + file more portable +- reorganized the installation of documentation files: let RPM + take care of this +- reorganized the file list: actually install man pages along + with the binaries of the respective subpackage +- do not include libmysqld.a in the devel subpackage as well, if we + have a special "embedded" subpackage +- reworked the package descriptions + +* Mon Oct 8 2001 Monty + +- Added embedded server as a separate RPM + +* Fri Apr 13 2001 Monty + +- Added mysqld-max to the distribution + +* Tue Jan 2 2001 Monty + +- Added mysql-test to the bench package + +* Fri Aug 18 2000 Tim Smith <tim@mysql.com> + +- Added separate libmysql_r directory; now both a threaded + and non-threaded library is shipped. + +* Wed Sep 28 1999 David Axmark <davida@mysql.com> + +- Added the support-files/my-example.cnf to the docs directory. + +- Removed devel dependency on base since it is about client + development. + +* Wed Sep 8 1999 David Axmark <davida@mysql.com> + +- Cleaned up some for 3.23. + +* Thu Jul 1 1999 David Axmark <davida@mysql.com> + +- Added support for shared libraries in a separate sub + package. Original fix by David Fox (dsfox@cogsci.ucsd.edu) + +- The --enable-assembler switch is now automatically disables on + platforms there assembler code is unavailable. This should allow + building this RPM on non i386 systems. + +* Mon Feb 22 1999 David Axmark <david@detron.se> + +- Removed unportable cc switches from the spec file. The defaults can + now be overridden with environment variables. This feature is used + to compile the official RPM with optimal (but compiler version + specific) switches. + +- Removed the repetitive description parts for the sub rpms. Maybe add + again if RPM gets a multiline macro capability. + +- Added support for a pt_BR translation. Translation contributed by + Jorge Godoy <jorge@bestway.com.br>. + +* Wed Nov 4 1998 David Axmark <david@detron.se> + +- A lot of changes in all the rpm and install scripts. This may even + be a working RPM :-) + +* Sun Aug 16 1998 David Axmark <david@detron.se> + +- A developers changelog for MySQL is available in the source RPM. And + there is a history of major user visible changed in the Reference + Manual. Only RPM specific changes will be documented here. diff --git a/storage/xtradb/dict/dict0crea.c b/storage/xtradb/dict/dict0crea.c index f548d89bc68..e315716551e 100644 --- a/storage/xtradb/dict/dict0crea.c +++ b/storage/xtradb/dict/dict0crea.c @@ -97,8 +97,8 @@ dict_create_sys_tables_tuple( if (table->flags & ~DICT_TF_COMPACT) { ut_a(table->flags & DICT_TF_COMPACT); ut_a(dict_table_get_format(table) >= DICT_TF_FORMAT_ZIP); - ut_a((table->flags & DICT_TF_ZSSIZE_MASK) - <= (DICT_TF_ZSSIZE_MAX << DICT_TF_ZSSIZE_SHIFT)); + ut_a(((ulonglong) table->flags & DICT_TF_ZSSIZE_MASK) + <= (ulonglong) (DICT_TF_ZSSIZE_MAX << DICT_TF_ZSSIZE_SHIFT)); ut_a(!(table->flags & (~0 << DICT_TF_BITS))); mach_write_to_4(ptr, table->flags); } else { diff --git a/storage/xtradb/dict/dict0dict.c b/storage/xtradb/dict/dict0dict.c index 3f5dd2930e3..7b4174b4b15 100644 --- a/storage/xtradb/dict/dict0dict.c +++ b/storage/xtradb/dict/dict0dict.c @@ -54,6 +54,7 @@ UNIV_INTERN dict_index_t* dict_ind_compact; #include "row0merge.h" #include "m_ctype.h" /* my_isspace() */ #include "ha_prototypes.h" /* innobase_strcasecmp() */ +#include "srv0start.h" /* SRV_LOG_SPACE_FIRST_ID */ #include <ctype.h> @@ -658,7 +659,7 @@ dict_table_get( mutex_exit(&(dict_sys->mutex)); if (table != NULL) { - if (!table->stat_initialized) { + if (!table->stat_initialized && !table->is_corrupt) { /* If table->ibd_file_missing == TRUE, this will print an error message and return without doing anything. */ @@ -1181,7 +1182,7 @@ retry: + dict_sys->size) > srv_dict_size_limit ) { prev_table = UT_LIST_GET_PREV(table_LRU, table); - if (table == self || table->n_mysql_handles_opened) + if (table == self || table->n_mysql_handles_opened || table->is_corrupt) goto next_loop; cached_foreign_tables = 0; @@ -4219,6 +4220,11 @@ dict_update_statistics_low( } while (index) { + if (table->is_corrupt) { + ut_a(srv_pass_corrupt_table); + return; + } + size = btr_get_size(index, BTR_TOTAL_SIZE); index->stat_index_size = size; @@ -4920,4 +4926,42 @@ dict_close(void) mem_free(dict_sys); dict_sys = NULL; } + +/************************************************************************* +set is_corrupt flag by space_id*/ + +void +dict_table_set_corrupt_by_space( +/*============================*/ + ulint space_id, + ibool need_mutex) +{ + dict_table_t* table; + ibool found = FALSE; + + ut_a(space_id != 0 && space_id < SRV_LOG_SPACE_FIRST_ID); + + if (need_mutex) + mutex_enter(&(dict_sys->mutex)); + + table = UT_LIST_GET_FIRST(dict_sys->table_LRU); + + while (table) { + if (table->space == space_id) { + table->is_corrupt = TRUE; + found = TRUE; + } + + table = UT_LIST_GET_NEXT(table_LRU, table); + } + + if (need_mutex) + mutex_exit(&(dict_sys->mutex)); + + if (!found) { + fprintf(stderr, "InnoDB: space to be marked as " + "crashed was not found for id %lu.\n", + (ulong) space_id); + } +} #endif /* !UNIV_HOTBACKUP */ diff --git a/storage/xtradb/dict/dict0mem.c b/storage/xtradb/dict/dict0mem.c index 6458cbab92d..acf550befad 100644 --- a/storage/xtradb/dict/dict0mem.c +++ b/storage/xtradb/dict/dict0mem.c @@ -85,6 +85,8 @@ dict_mem_table_create( /* The number of transactions that are either waiting on the AUTOINC lock or have been granted the lock. */ table->n_waiting_or_granted_auto_inc_locks = 0; + + table->is_corrupt = FALSE; #endif /* !UNIV_HOTBACKUP */ ut_d(table->magic_n = DICT_TABLE_MAGIC_N); diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c index b6eed68fc7f..3e63c0795f8 100644 --- a/storage/xtradb/fil/fil0fil.c +++ b/storage/xtradb/fil/fil0fil.c @@ -222,6 +222,7 @@ struct fil_space_struct { file we have written to */ ibool is_in_unflushed_spaces; /*!< TRUE if this space is currently in unflushed_spaces */ + ibool is_corrupt; UT_LIST_NODE_T(fil_space_t) space_list; /*!< list of all spaces */ ulint magic_n;/*!< FIL_SPACE_MAGIC_N */ @@ -630,7 +631,7 @@ fil_node_open_file( fil_system_t* system, /*!< in: tablespace memory cache */ fil_space_t* space) /*!< in: space */ { - ib_int64_t size_bytes; + ib_uint64_t size_bytes; ulint size_low; ulint size_high; ibool ret; @@ -671,8 +672,8 @@ fil_node_open_file( os_file_get_size(node->handle, &size_low, &size_high); - size_bytes = (((ib_int64_t)size_high) << 32) - + (ib_int64_t)size_low; + size_bytes = (((ib_uint64_t)size_high) << 32) + + (ib_uint64_t)size_low; #ifdef UNIV_HOTBACKUP if (space->id == 0) { node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE); @@ -1222,6 +1223,8 @@ try_again: ut_fold_string(name), space); space->is_in_unflushed_spaces = FALSE; + space->is_corrupt = FALSE; + UT_LIST_ADD_LAST(space_list, fil_system->space_list, space); mutex_exit(&fil_system->mutex); @@ -3044,7 +3047,9 @@ fil_open_single_table_tablespace( mach_write_ull(page + FIL_PAGE_FILE_FLUSH_LSN, current_lsn); mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, srv_use_checksums - ? buf_calc_page_new_checksum(page) + ? (!srv_fast_checksum + ? buf_calc_page_new_checksum(page) + : buf_calc_page_new_checksum_32(page)) : BUF_NO_CHECKSUM_MAGIC); mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM, srv_use_checksums @@ -3156,9 +3161,21 @@ skip_info: goto skip_write; } - if (checksum_field != 0 + if (!srv_fast_checksum + && checksum_field != 0 + && checksum_field != BUF_NO_CHECKSUM_MAGIC + && checksum_field + != buf_calc_page_new_checksum(page)) { + + goto skip_write; + } + + if (srv_fast_checksum + && checksum_field != 0 && checksum_field != BUF_NO_CHECKSUM_MAGIC && checksum_field + != buf_calc_page_new_checksum_32(page) + && checksum_field != buf_calc_page_new_checksum(page)) { goto skip_write; @@ -3238,7 +3255,9 @@ skip_info: mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, srv_use_checksums - ? buf_calc_page_new_checksum(page) + ? (!srv_fast_checksum + ? buf_calc_page_new_checksum(page) + : buf_calc_page_new_checksum_32(page)) : BUF_NO_CHECKSUM_MAGIC); mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM, srv_use_checksums @@ -3424,7 +3443,7 @@ fil_load_single_table_tablespace( ulint flags; ulint size_low; ulint size_high; - ib_int64_t size; + ib_uint64_t size; #ifdef UNIV_HOTBACKUP fil_space_t* space; #endif @@ -3544,7 +3563,7 @@ fil_load_single_table_tablespace( /* Every .ibd file is created >= 4 pages in size. Smaller files cannot be ok. */ - size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low; + size = (((ib_uint64_t)size_high) << 32) + (ib_uint64_t)size_low; #ifndef UNIV_HOTBACKUP if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) { fprintf(stderr, @@ -4577,9 +4596,9 @@ _fil_io( ut_ad(ut_is_2pow(zip_size)); ut_ad(buf); ut_ad(len > 0); -#if (1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE -# error "(1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE" -#endif +//#if (1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE +//# error "(1 << UNIV_PAGE_SIZE_SHIFT) != UNIV_PAGE_SIZE" +//#endif ut_ad(fil_validate()); #ifndef UNIV_HOTBACKUP # ifndef UNIV_LOG_DEBUG @@ -4713,6 +4732,22 @@ _fil_io( ut_a(byte_offset % OS_FILE_LOG_BLOCK_SIZE == 0); ut_a((len % OS_FILE_LOG_BLOCK_SIZE) == 0); + if (srv_pass_corrupt_table && space->is_corrupt) { + /* should ignore i/o for the crashed space */ + mutex_enter(&fil_system->mutex); + fil_node_complete_io(node, fil_system, type); + mutex_exit(&fil_system->mutex); + if (mode == OS_AIO_NORMAL) { + ut_a(space->purpose == FIL_TABLESPACE); + buf_page_io_complete(message, trx); + } + if (type == OS_FILE_READ) { + return(DB_TABLESPACE_DELETED); + } else { + return(DB_SUCCESS); + } + } else { + ut_a(!space->is_corrupt); #ifdef UNIV_HOTBACKUP /* In ibbackup do normal i/o, not aio */ if (type == OS_FILE_READ) { @@ -4727,6 +4762,8 @@ _fil_io( ret = os_aio(type, mode | wake_later, node->name, node->handle, buf, offset_low, offset_high, len, node, message, trx); #endif + } /**/ + ut_a(ret); if (mode == OS_AIO_SYNC) { @@ -4752,13 +4789,16 @@ ibool fil_area_is_exist( /*==============*/ ulint space_id, /*!< in: space id */ - ulint zip_size, /*!< in: compressed page size in bytes; + ulint zip_size __attribute__((unused)), + /*!< in: compressed page size in bytes; 0 for uncompressed pages */ ulint block_offset, /*!< in: offset in number of blocks */ - ulint byte_offset, /*!< in: remainder of offset in bytes; in + ulint byte_offset __attribute__((unused)), + /*!< in: remainder of offset in bytes; in aio this must be divisible by the OS block size */ - ulint len) /*!< in: how many bytes to read or write; this + ulint len __attribute__((unused))) + /*!< in: how many bytes to read or write; this must not cross a file boundary; in aio this must be a block size multiple */ { @@ -4873,7 +4913,7 @@ fil_aio_wait( if (fil_node->space->purpose == FIL_TABLESPACE) { srv_set_io_thread_op_info(segment, "complete io for buf page"); - buf_page_io_complete(message); + buf_page_io_complete(message, NULL); } else { srv_set_io_thread_op_info(segment, "complete io for log"); log_io_complete(message); @@ -5225,3 +5265,46 @@ fil_system_hash_nodes(void) return 0; } } + +/************************************************************************* +functions to access is_corrupt flag of fil_space_t*/ + +ibool +fil_space_is_corrupt( +/*=================*/ + ulint space_id) +{ + fil_space_t* space; + ibool ret = FALSE; + + mutex_enter(&fil_system->mutex); + + space = fil_space_get_by_id(space_id); + + if (space && space->is_corrupt) { + ret = TRUE; + } + + mutex_exit(&fil_system->mutex); + + return(ret); +} + +void +fil_space_set_corrupt( +/*==================*/ + ulint space_id) +{ + fil_space_t* space; + + mutex_enter(&fil_system->mutex); + + space = fil_space_get_by_id(space_id); + + if (space) { + space->is_corrupt = TRUE; + } + + mutex_exit(&fil_system->mutex); +} + diff --git a/storage/xtradb/fsp/fsp0fsp.c b/storage/xtradb/fsp/fsp0fsp.c index 3cc4318fc06..19722623611 100644 --- a/storage/xtradb/fsp/fsp0fsp.c +++ b/storage/xtradb/fsp/fsp0fsp.c @@ -370,6 +370,12 @@ fsp_get_space_header( ut_ad(id || !zip_size); block = buf_page_get(id, zip_size, 0, RW_X_LATCH, mtr); + + if (srv_pass_corrupt_table && !block) { + return(0); + } + ut_a(block); + header = FSP_HEADER_OFFSET + buf_block_get_frame(block); buf_block_dbg_add_level(block, SYNC_FSP_PAGE); @@ -652,15 +658,12 @@ xdes_calc_descriptor_page( ulint offset) /*!< in: page offset */ { #ifndef DOXYGEN /* Doxygen gets confused of these */ -# if UNIV_PAGE_SIZE <= XDES_ARR_OFFSET \ - + (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE -# error -# endif # if PAGE_ZIP_MIN_SIZE <= XDES_ARR_OFFSET \ + (PAGE_ZIP_MIN_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE # error # endif #endif /* !DOXYGEN */ + ut_a(UNIV_PAGE_SIZE > XDES_ARR_OFFSET + (UNIV_PAGE_SIZE / FSP_EXTENT_SIZE) * XDES_SIZE); ut_ad(ut_is_2pow(zip_size)); if (!zip_size) { @@ -788,6 +791,12 @@ xdes_get_descriptor( fsp_header_t* sp_header; block = buf_page_get(space, zip_size, 0, RW_X_LATCH, mtr); + + if (srv_pass_corrupt_table && !block) { + return(0); + } + ut_a(block); + buf_block_dbg_add_level(block, SYNC_FSP_PAGE); sp_header = FSP_HEADER_OFFSET + buf_block_get_frame(block); @@ -1457,12 +1466,12 @@ fsp_fill_free_list( mtr); xdes_init(descr, mtr); -#if UNIV_PAGE_SIZE % FSP_EXTENT_SIZE -# error "UNIV_PAGE_SIZE % FSP_EXTENT_SIZE != 0" -#endif -#if PAGE_ZIP_MIN_SIZE % FSP_EXTENT_SIZE -# error "PAGE_ZIP_MIN_SIZE % FSP_EXTENT_SIZE != 0" -#endif +//#if UNIV_PAGE_SIZE % FSP_EXTENT_SIZE +//# error "UNIV_PAGE_SIZE % FSP_EXTENT_SIZE != 0" +//#endif +//#if PAGE_ZIP_MIN_SIZE % FSP_EXTENT_SIZE +//# error "PAGE_ZIP_MIN_SIZE % FSP_EXTENT_SIZE != 0" +//#endif if (UNIV_UNLIKELY(init_xdes)) { @@ -1871,6 +1880,11 @@ fsp_seg_inode_page_find_free( { fseg_inode_t* inode; + if (srv_pass_corrupt_table && !page) { + return(ULINT_UNDEFINED); + } + ut_a(page); + for (; i < FSP_SEG_INODES_PER_PAGE(zip_size); i++) { inode = fsp_seg_inode_page_get_nth_inode( @@ -1984,6 +1998,11 @@ fsp_alloc_seg_inode( page = buf_block_get_frame(block); + if (srv_pass_corrupt_table && !page) { + return(0); + } + ut_a(page); + n = fsp_seg_inode_page_find_free(page, 0, zip_size, mtr); ut_a(n != ULINT_UNDEFINED); @@ -2077,6 +2096,11 @@ fseg_inode_try_get( inode = fut_get_ptr(space, zip_size, inode_addr, RW_X_LATCH, mtr); + if (srv_pass_corrupt_table && !inode) { + return(0); + } + ut_a(inode); + if (UNIV_UNLIKELY (ut_dulint_is_zero(mach_read_from_8(inode + FSEG_ID)))) { @@ -2104,7 +2128,7 @@ fseg_inode_get( { fseg_inode_t* inode = fseg_inode_try_get(header, space, zip_size, mtr); - ut_a(inode); + ut_a(srv_pass_corrupt_table || inode); return(inode); } @@ -3263,6 +3287,11 @@ fseg_free_page_low( descr = xdes_get_descriptor(space, zip_size, page, mtr); + if (srv_pass_corrupt_table && !descr) { + /* The page may be corrupt. pass it. */ + return; + } + ut_a(descr); if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)) { fputs("InnoDB: Dump of the tablespace extent descriptor: ", @@ -3515,6 +3544,11 @@ fseg_free_step( descr = xdes_get_descriptor(space, zip_size, header_page, mtr); + if (srv_pass_corrupt_table && !descr) { + /* The page may be corrupt. pass it. */ + return(TRUE); + } + /* Check that the header resides on a page which has not been freed yet */ @@ -3599,6 +3633,12 @@ fseg_free_step_not_header( inode = fseg_inode_get(header, space, zip_size, mtr); + if (srv_pass_corrupt_table && !inode) { + /* ignore the corruption */ + return(TRUE); + } + ut_a(inode); + descr = fseg_get_first_extent(inode, space, zip_size, mtr); if (descr != NULL) { diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 72c2a513177..42b6aa48b3c 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -125,9 +125,6 @@ extern ib_int64_t trx_sys_mysql_relay_log_pos; # ifndef MYSQL_PLUGIN_IMPORT # define MYSQL_PLUGIN_IMPORT /* nothing */ # endif /* MYSQL_PLUGIN_IMPORT */ -/* This is needed because of Bug #3596. Let us hope that pthread_mutex_t -is defined the same in both builds: the MySQL server and the InnoDB plugin. */ -extern MYSQL_PLUGIN_IMPORT pthread_mutex_t LOCK_thread_count; #if MYSQL_VERSION_ID < 50124 /* this is defined in mysql_priv.h inside #ifdef MYSQL_SERVER @@ -170,6 +167,8 @@ static ulong innobase_commit_concurrency = 0; static ulong innobase_read_io_threads; static ulong innobase_write_io_threads; +static ulong innobase_page_size; + static my_bool innobase_thread_concurrency_timer_based; static long long innobase_buffer_pool_size, innobase_log_file_size; @@ -203,6 +202,7 @@ static char* innobase_log_arch_dir = NULL; #endif /* UNIV_LOG_ARCHIVE */ static my_bool innobase_use_doublewrite = TRUE; static my_bool innobase_use_checksums = TRUE; +static my_bool innobase_fast_checksum = FALSE; static my_bool innobase_extra_undoslots = FALSE; static my_bool innobase_fast_recovery = FALSE; static my_bool innobase_recovery_stats = TRUE; @@ -920,36 +920,6 @@ convert_error_code_to_mysql( } /*************************************************************//** -If you want to print a thd that is not associated with the current thread, -you must call this function before reserving the InnoDB kernel_mutex, to -protect MySQL from setting thd->query NULL. If you print a thd of the current -thread, we know that MySQL cannot modify thd->query, and it is not necessary -to call this. Call innobase_mysql_end_print_arbitrary_thd() after you release -the kernel_mutex. */ -extern "C" UNIV_INTERN -void -innobase_mysql_prepare_print_arbitrary_thd(void) -/*============================================*/ -{ - ut_ad(!mutex_own(&kernel_mutex)); - VOID(pthread_mutex_lock(&LOCK_thread_count)); -} - -/*************************************************************//** -Releases the mutex reserved by innobase_mysql_prepare_print_arbitrary_thd(). -In the InnoDB latching order, the mutex sits right above the -kernel_mutex. In debug builds, we assert that the kernel_mutex is -released before this function is invoked. */ -extern "C" UNIV_INTERN -void -innobase_mysql_end_print_arbitrary_thd(void) -/*========================================*/ -{ - ut_ad(!mutex_own(&kernel_mutex)); - VOID(pthread_mutex_unlock(&LOCK_thread_count)); -} - -/*************************************************************//** Prints info of a THD object (== user session thread) to the given file. */ extern "C" UNIV_INTERN void @@ -2063,6 +2033,36 @@ innobase_init( } #endif /* UNIV_DEBUG */ + srv_page_size = 0; + srv_page_size_shift = 0; + + if (innobase_page_size != (1 << 14)) { + int n_shift; + + fprintf(stderr, + "InnoDB: Warning: innodb_page_size has been changed from default value 16384. (###EXPERIMENTAL### operation)\n"); + for (n_shift = 12; n_shift <= UNIV_PAGE_SIZE_SHIFT_MAX; n_shift++) { + if (innobase_page_size == (1u << n_shift)) { + srv_page_size_shift = n_shift; + srv_page_size = (1 << srv_page_size_shift); + fprintf(stderr, + "InnoDB: The universal page size of the database is set to %lu.\n", + srv_page_size); + break; + } + } + } else { + srv_page_size_shift = 14; + srv_page_size = (1 << srv_page_size_shift); + } + + if (!srv_page_size_shift) { + fprintf(stderr, + "InnoDB: Error: %lu is not valid value for innodb_page_size.\n", + innobase_page_size); + goto error; + } + #ifndef MYSQL_SERVER innodb_overwrite_relay_log_info = FALSE; #endif @@ -2371,6 +2371,7 @@ innobase_change_buffering_inited_ok: srv_use_doublewrite_buf = (ibool) innobase_use_doublewrite; srv_use_checksums = (ibool) innobase_use_checksums; + srv_fast_checksum = (ibool) innobase_fast_checksum; #ifdef HAVE_LARGE_PAGES if ((os_use_large_pages = (ibool) my_use_large_pages)) @@ -3381,6 +3382,12 @@ ha_innobase::open( DBUG_RETURN(1); } + if (share->ib_table && share->ib_table->is_corrupt) { + free_share(share); + + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + } + /* Create buffers for packing the fields of a record. Why table->stored_rec_length did not work here? Obviously, because char fields when packed actually became 1 byte longer, when we also @@ -3408,6 +3415,19 @@ retry: /* Get pointer to a table object in InnoDB dictionary cache */ ib_table = dict_table_get(norm_name, TRUE); + if (ib_table && ib_table->is_corrupt) { + free_share(share); + my_free(upd_buff, MYF(0)); + + DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + } + + if (share->ib_table) { + ut_a(share->ib_table == ib_table); + } else { + share->ib_table = ib_table; + } + if (NULL == ib_table) { if (is_part && retries < 10) { ++retries; @@ -4579,6 +4599,10 @@ ha_innobase::write_row( ha_statistic_increment(&SSV::ha_write_count); + if (share->ib_table->is_corrupt) { + DBUG_RETURN(HA_ERR_CRASHED); + } + if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT) table->timestamp_field->set_time(); @@ -4691,6 +4715,10 @@ no_commit: error = row_insert_for_mysql((byte*) record, prebuilt); +#ifdef EXTENDED_FOR_USERSTAT + if (error == DB_SUCCESS) rows_changed++; +#endif + /* Handle duplicate key errors */ if (auto_inc_used) { ulint err; @@ -4786,6 +4814,10 @@ report_error: func_exit: innobase_active_small(); + if (share->ib_table->is_corrupt) { + DBUG_RETURN(HA_ERR_CRASHED); + } + DBUG_RETURN(error_result); } @@ -4966,6 +4998,10 @@ ha_innobase::update_row( ha_statistic_increment(&SSV::ha_update_count); + if (share->ib_table->is_corrupt) { + DBUG_RETURN(HA_ERR_CRASHED); + } + if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) table->timestamp_field->set_time(); @@ -5031,6 +5067,10 @@ ha_innobase::update_row( } } +#ifdef EXTENDED_FOR_USERSTAT + if (error == DB_SUCCESS) rows_changed++; +#endif + innodb_srv_conc_exit_innodb(trx); error = convert_error_code_to_mysql(error, @@ -5051,6 +5091,10 @@ ha_innobase::update_row( innobase_active_small(); + if (share->ib_table->is_corrupt) { + DBUG_RETURN(HA_ERR_CRASHED); + } + DBUG_RETURN(error); } @@ -5072,6 +5116,10 @@ ha_innobase::delete_row( ha_statistic_increment(&SSV::ha_delete_count); + if (share->ib_table->is_corrupt) { + DBUG_RETURN(HA_ERR_CRASHED); + } + if (!prebuilt->upd_node) { row_get_prebuilt_update_vector(prebuilt); } @@ -5084,6 +5132,10 @@ ha_innobase::delete_row( error = row_update_for_mysql((byte*) record, prebuilt); +#ifdef EXTENDED_FOR_USERSTAT + if (error == DB_SUCCESS) rows_changed++; +#endif + innodb_srv_conc_exit_innodb(trx); error = convert_error_code_to_mysql( @@ -5094,6 +5146,10 @@ ha_innobase::delete_row( innobase_active_small(); + if (share->ib_table->is_corrupt) { + DBUG_RETURN(HA_ERR_CRASHED); + } + DBUG_RETURN(error); } @@ -5333,6 +5389,10 @@ ha_innobase::index_read( ha_statistic_increment(&SSV::ha_read_key_count); + if (share->ib_table->is_corrupt) { + DBUG_RETURN(HA_ERR_CRASHED); + } + index = prebuilt->index; if (UNIV_UNLIKELY(index == NULL)) { @@ -5395,6 +5455,10 @@ ha_innobase::index_read( ret = DB_UNSUPPORTED; } + if (share->ib_table->is_corrupt) { + DBUG_RETURN(HA_ERR_CRASHED); + } + switch (ret) { case DB_SUCCESS: error = 0; @@ -5489,6 +5553,10 @@ ha_innobase::change_active_index( { DBUG_ENTER("change_active_index"); + if (share->ib_table->is_corrupt) { + DBUG_RETURN(HA_ERR_CRASHED); + } + ut_ad(user_thd == ha_thd()); ut_a(prebuilt->trx == thd_to_trx(user_thd)); @@ -5580,6 +5648,10 @@ ha_innobase::general_fetch( DBUG_ENTER("general_fetch"); + if (share->ib_table->is_corrupt) { + DBUG_RETURN(HA_ERR_CRASHED); + } + ut_a(prebuilt->trx == thd_to_trx(user_thd)); innodb_srv_conc_enter_innodb(prebuilt->trx); @@ -5589,10 +5661,19 @@ ha_innobase::general_fetch( innodb_srv_conc_exit_innodb(prebuilt->trx); + if (share->ib_table->is_corrupt) { + DBUG_RETURN(HA_ERR_CRASHED); + } + switch (ret) { case DB_SUCCESS: error = 0; table->status = 0; +#ifdef EXTENDED_FOR_USERSTAT + rows_read++; + if (active_index >= 0 && active_index < MAX_KEY) + index_rows_read[active_index]++; +#endif break; case DB_RECORD_NOT_FOUND: error = HA_ERR_END_OF_FILE; @@ -6550,9 +6631,9 @@ ha_innobase::create( | DICT_TF_COMPACT | DICT_TF_FORMAT_ZIP << DICT_TF_FORMAT_SHIFT; -#if DICT_TF_ZSSIZE_MAX < 1 -# error "DICT_TF_ZSSIZE_MAX < 1" -#endif +//#if DICT_TF_ZSSIZE_MAX < 1 +//# error "DICT_TF_ZSSIZE_MAX < 1" +//#endif } } @@ -6812,6 +6893,10 @@ ha_innobase::delete_all_rows(void) DBUG_RETURN(my_errno=HA_ERR_WRONG_COMMAND); } + if (share->ib_table->is_corrupt) { + DBUG_RETURN(HA_ERR_CRASHED); + } + /* Truncate the table in InnoDB */ error = row_truncate_table_for_mysql(prebuilt->table, prebuilt->trx); @@ -6820,6 +6905,10 @@ ha_innobase::delete_all_rows(void) goto fallback; } + if (share->ib_table->is_corrupt) { + DBUG_RETURN(HA_ERR_CRASHED); + } + error = convert_error_code_to_mysql(error, prebuilt->table->flags, NULL); @@ -7323,6 +7412,16 @@ ha_innobase::read_time( return(ranges + (double) rows / (double) total_rows * time_for_scan); } +UNIV_INTERN +bool +ha_innobase::is_corrupt() const +{ + if (share->ib_table) + return ((bool)share->ib_table->is_corrupt); + else + return (FALSE); +} + /*********************************************************************//** Returns statistics information of the table to the MySQL interpreter, in various fields of the handle object. */ @@ -7373,9 +7472,9 @@ ha_innobase::info( ib_table = prebuilt->table; if (flag & HA_STATUS_TIME) { - if (innobase_stats_on_metadata - && (thd_sql_command(user_thd) == SQLCOM_ANALYZE - || srv_stats_auto_update)) { + if ((innobase_stats_on_metadata + || thd_sql_command(user_thd) == SQLCOM_ANALYZE) + && !share->ib_table->is_corrupt) { /* In sql_show we call with this flag: update then statistics so that they are up-to-date */ @@ -7602,6 +7701,10 @@ ha_innobase::analyze( THD* thd, /*!< in: connection thread handle */ HA_CHECK_OPT* check_opt) /*!< in: currently ignored */ { + if (share->ib_table->is_corrupt) { + return(HA_ADMIN_CORRUPT); + } + /* Serialize ANALYZE TABLE inside InnoDB, see Bug#38996 Race condition in ANALYZE TABLE */ pthread_mutex_lock(&analyze_mutex); @@ -7611,6 +7714,10 @@ ha_innobase::analyze( pthread_mutex_unlock(&analyze_mutex); + if (share->ib_table->is_corrupt) { + return(HA_ADMIN_CORRUPT); + } + return(0); } @@ -7656,6 +7763,10 @@ ha_innobase::check( ret = row_check_table_for_mysql(prebuilt); + if (ret != DB_INTERRUPTED && share->ib_table->is_corrupt) { + return(HA_ADMIN_CORRUPT); + } + switch (ret) { case DB_SUCCESS: return(HA_ADMIN_OK); @@ -8389,6 +8500,10 @@ ha_innobase::transactional_table_lock( update_thd(thd); + if (share->ib_table->is_corrupt) { + DBUG_RETURN(HA_ERR_CRASHED); + } + if (prebuilt->table->ibd_file_missing && !thd_tablespace_op(thd)) { ut_print_timestamp(stderr); fprintf(stderr, @@ -9087,6 +9202,11 @@ ha_innobase::get_auto_increment( invoking this method. So we are not sure if it's guaranteed to be 0 or not. */ + /* We need the upper limit of the col type to check for + whether we update the table autoinc counter or not. */ + ulonglong col_max_value = innobase_get_int_col_max_value( + table->next_number_field); + /* Called for the first time ? */ if (trx->n_autoinc_rows == 0) { @@ -9103,6 +9223,11 @@ ha_innobase::get_auto_increment( /* Not in the middle of a mult-row INSERT. */ } else if (prebuilt->autoinc_last_value == 0) { set_if_bigger(*first_value, autoinc); + /* Check for -ve values. */ + } else if (*first_value > col_max_value && trx->n_autoinc_rows > 0) { + /* Set to next logical value. */ + ut_a(autoinc > trx->n_autoinc_rows); + *first_value = (autoinc - trx->n_autoinc_rows) - 1; } *nb_reserved_values = trx->n_autoinc_rows; @@ -9113,12 +9238,6 @@ ha_innobase::get_auto_increment( ulonglong need; ulonglong current; ulonglong next_value; - ulonglong col_max_value; - - /* We need the upper limit of the col type to check for - whether we update the table autoinc counter or not. */ - col_max_value = innobase_get_int_col_max_value( - table->next_number_field); current = *first_value > col_max_value ? autoinc : *first_value; need = *nb_reserved_values * increment; @@ -10249,6 +10368,20 @@ static MYSQL_SYSVAR_BOOL(checksums, innobase_use_checksums, "Disable with --skip-innodb-checksums.", NULL, NULL, TRUE); +static MYSQL_SYSVAR_BOOL(fast_checksum, innobase_fast_checksum, + PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, + "Change the algorithm of checksum for the whole of datapage to 4-bytes word based. " + "The original checksum is checked after the new one. It may be slow for reading page" + " which has orginal checksum. Overwrite the page or recreate the InnoDB database, " + "if you want the entire benefit for performance at once. " + "#### Attention: The checksum is not compatible for normal or disabled version! ####", + NULL, NULL, FALSE); + +static MYSQL_SYSVAR_ULONG(page_size, innobase_page_size, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "###EXPERIMENTAL###: The universal page size of the database. Changing for created database is not supported. Use on your own risk!", + NULL, NULL, (1 << 14), (1 << 12), (1 << UNIV_PAGE_SIZE_SHIFT_MAX), 0); + static MYSQL_SYSVAR_STR(data_home_dir, innobase_data_home_dir, PLUGIN_VAR_READONLY, "The common part for InnoDB table spaces.", @@ -10705,11 +10838,21 @@ static MYSQL_SYSVAR_ULONG(relax_table_creation, srv_relax_table_creation, "Relax limitation of column size at table creation as builtin InnoDB.", NULL, NULL, 0, 0, 1, 0); +static MYSQL_SYSVAR_ULONG(pass_corrupt_table, srv_pass_corrupt_table, + PLUGIN_VAR_RQCMDARG, + "Pass corruptions of user tables as 'corrupt table' instead of not crashing itself, " + "when used with file_per_table. " + "All file io for the datafile after detected as corrupt are disabled, " + "except for the deletion.", + NULL, NULL, 0, 0, 1, 0); + static struct st_mysql_sys_var* innobase_system_variables[]= { + MYSQL_SYSVAR(page_size), MYSQL_SYSVAR(additional_mem_pool_size), MYSQL_SYSVAR(autoextend_increment), MYSQL_SYSVAR(buffer_pool_size), MYSQL_SYSVAR(checksums), + MYSQL_SYSVAR(fast_checksum), MYSQL_SYSVAR(commit_concurrency), MYSQL_SYSVAR(concurrency_tickets), MYSQL_SYSVAR(data_file_path), @@ -10784,6 +10927,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(io_capacity), MYSQL_SYSVAR(use_purge_thread), MYSQL_SYSVAR(relax_table_creation), + MYSQL_SYSVAR(pass_corrupt_table), NULL }; @@ -10816,6 +10960,8 @@ i_s_innodb_cmpmem_reset, i_s_innodb_table_stats, i_s_innodb_index_stats, i_s_innodb_admin_command, +i_s_innodb_sys_tables, +i_s_innodb_sys_indexes, i_s_innodb_patches mysql_declare_plugin_end; maria_declare_plugin(innobase) diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h index 9baa8698d38..ff93b68793c 100644 --- a/storage/xtradb/handler/ha_innodb.h +++ b/storage/xtradb/handler/ha_innodb.h @@ -36,6 +36,7 @@ typedef struct st_innobase_share { incremented in get_share() and decremented in free_share() */ void* table_name_hash;/*!< hash table chain node */ + dict_table_t* ib_table; } INNOBASE_SHARE; @@ -119,6 +120,7 @@ class ha_innobase: public handler int close(void); double scan_time(); double read_time(uint index, uint ranges, ha_rows rows); + bool is_corrupt() const; int write_row(uchar * buf); int update_row(const uchar * old_data, uchar * new_data); diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc index 061ccc67456..03e1668675f 100644 --- a/storage/xtradb/handler/i_s.cc +++ b/storage/xtradb/handler/i_s.cc @@ -47,6 +47,7 @@ extern "C" { #include "trx0rseg.h" /* for trx_rseg_struct */ #include "trx0sys.h" /* for trx_sys */ #include "dict0dict.h" /* for dict_sys */ +#include "btr0pcur.h" #include "buf0lru.h" /* for XTRA_LRU_[DUMP/RESTORE] */ /* from buf0buf.c */ struct buf_chunk_struct{ @@ -860,7 +861,7 @@ i_s_innodb_buffer_pool_pages_index_fill( p++; } else { field_store_string(table->field[0], NULL); - p = (char *)index->table_name; + p = index->table_name; } strcpy(table_name_raw, (const char*)p); filename_to_tablename(table_name_raw, table_name, sizeof(table_name)); @@ -3302,6 +3303,14 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_rseg_maria = */ static ST_FIELD_INFO i_s_innodb_table_stats_info[] = { + {STRUCT_FLD(field_name, "table_schema"), + STRUCT_FLD(field_length, NAME_LEN), + STRUCT_FLD(field_type, MYSQL_TYPE_STRING), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, 0), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + {STRUCT_FLD(field_name, "table_name"), STRUCT_FLD(field_length, NAME_LEN), STRUCT_FLD(field_type, MYSQL_TYPE_STRING), @@ -3347,6 +3356,14 @@ static ST_FIELD_INFO i_s_innodb_table_stats_info[] = static ST_FIELD_INFO i_s_innodb_index_stats_info[] = { + {STRUCT_FLD(field_name, "table_schema"), + STRUCT_FLD(field_length, NAME_LEN), + STRUCT_FLD(field_type, MYSQL_TYPE_STRING), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, 0), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + {STRUCT_FLD(field_name, "table_name"), STRUCT_FLD(field_length, NAME_LEN), STRUCT_FLD(field_type, MYSQL_TYPE_STRING), @@ -3422,16 +3439,30 @@ i_s_innodb_table_stats_fill( table = UT_LIST_GET_FIRST(dict_sys->table_LRU); while (table) { + char buf[NAME_LEN * 2 + 2]; + char* ptr; + if (table->stat_clustered_index_size == 0) { table = UT_LIST_GET_NEXT(table_LRU, table); continue; } - field_store_string(i_s_table->field[0], table->name); - i_s_table->field[1]->store(table->stat_n_rows); - i_s_table->field[2]->store(table->stat_clustered_index_size); - i_s_table->field[3]->store(table->stat_sum_of_other_index_sizes); - i_s_table->field[4]->store(table->stat_modified_counter); + buf[NAME_LEN * 2 + 1] = 0; + strncpy(buf, table->name, NAME_LEN * 2 + 1); + ptr = strchr(buf, '/'); + if (ptr) { + *ptr = '\0'; + ++ptr; + } else { + ptr = buf; + } + + field_store_string(i_s_table->field[0], buf); + field_store_string(i_s_table->field[1], ptr); + i_s_table->field[2]->store(table->stat_n_rows); + i_s_table->field[3]->store(table->stat_clustered_index_size); + i_s_table->field[4]->store(table->stat_sum_of_other_index_sizes); + i_s_table->field[5]->store(table->stat_modified_counter); if (schema_table_store_record(thd, i_s_table)) { status = 1; @@ -3487,11 +3518,24 @@ i_s_innodb_index_stats_fill( while (index) { char buff[256+1]; char row_per_keys[256+1]; + char buf[NAME_LEN * 2 + 2]; + char* ptr; ulint i; - field_store_string(i_s_table->field[0], table->name); - field_store_string(i_s_table->field[1], index->name); - i_s_table->field[2]->store(index->n_uniq); + buf[NAME_LEN * 2 + 1] = 0; + strncpy(buf, table->name, NAME_LEN * 2 + 1); + ptr = strchr(buf, '/'); + if (ptr) { + *ptr = '\0'; + ++ptr; + } else { + ptr = buf; + } + + field_store_string(i_s_table->field[0], buf); + field_store_string(i_s_table->field[1], ptr); + field_store_string(i_s_table->field[2], index->name); + i_s_table->field[3]->store(index->n_uniq); row_per_keys[0] = '\0'; if (index->stat_n_diff_key_vals) { @@ -3507,10 +3551,10 @@ i_s_innodb_index_stats_fill( strncat(row_per_keys, buff, 256 - strlen(row_per_keys)); } } - field_store_string(i_s_table->field[3], row_per_keys); + field_store_string(i_s_table->field[4], row_per_keys); - i_s_table->field[4]->store(index->stat_index_size); - i_s_table->field[5]->store(index->stat_n_leaf_pages); + i_s_table->field[5]->store(index->stat_index_size); + i_s_table->field[6]->store(index->stat_n_leaf_pages); if (schema_table_store_record(thd, i_s_table)) { status = 1; @@ -3810,3 +3854,505 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_admin_command_maria = STRUCT_FLD(version_info, "1.0"), STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE) }; + +static ST_FIELD_INFO i_s_innodb_sys_tables_info[] = +{ + {STRUCT_FLD(field_name, "NAME"), + STRUCT_FLD(field_length, NAME_LEN), + STRUCT_FLD(field_type, MYSQL_TYPE_STRING), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, 0), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "ID"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "N_COLS"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "TYPE"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "MIX_ID"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "MIX_LEN"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "CLUSTER_NAME"), + STRUCT_FLD(field_length, NAME_LEN), + STRUCT_FLD(field_type, MYSQL_TYPE_STRING), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, 0), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "SPACE"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + END_OF_ST_FIELD_INFO +}; + +static ST_FIELD_INFO i_s_innodb_sys_indexes_info[] = +{ + {STRUCT_FLD(field_name, "TABLE_ID"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "ID"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "NAME"), + STRUCT_FLD(field_length, NAME_LEN), + STRUCT_FLD(field_type, MYSQL_TYPE_STRING), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, 0), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "N_FIELDS"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "TYPE"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "SPACE"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "PAGE_NO"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + END_OF_ST_FIELD_INFO +}; + +static +int +copy_string_field( +/*==============*/ + TABLE* table, + int table_field, + const rec_t* rec, + int rec_field) +{ + int status; + const byte* data; + ulint len; + + /*fprintf(stderr, "copy_string_field %d %d\n", table_field, rec_field);*/ + + data = rec_get_nth_field_old(rec, rec_field, &len); + if (len == UNIV_SQL_NULL) { + table->field[table_field]->set_null(); + status = 0; /* success */ + } else { + table->field[table_field]->set_notnull(); + status = table->field[table_field]->store( + (char *) data, len, system_charset_info); + } + + return status; +} + +static +int +copy_int_field( +/*===========*/ + TABLE* table, + int table_field, + const rec_t* rec, + int rec_field) +{ + int status; + const byte* data; + ulint len; + + /*fprintf(stderr, "copy_int_field %d %d\n", table_field, rec_field);*/ + + data = rec_get_nth_field_old(rec, rec_field, &len); + if (len == UNIV_SQL_NULL) { + table->field[table_field]->set_null(); + status = 0; /* success */ + } else { + table->field[table_field]->set_notnull(); + status = table->field[table_field]->store( + mach_read_from_4(data), true); + } + + return status; +} + +static +int +copy_id_field( +/*==========*/ + TABLE* table, + int table_field, + const rec_t* rec, + int rec_field) +{ + int status; + const byte* data; + ulint len; + + /*fprintf(stderr, "copy_id_field %d %d\n", table_field, rec_field);*/ + + data = rec_get_nth_field_old(rec, rec_field, &len); + if (len == UNIV_SQL_NULL) { + table->field[table_field]->set_null(); + status = 0; /* success */ + } else { + table->field[table_field]->set_notnull(); + status = table->field[table_field]->store( + ut_conv_dulint_to_longlong(mach_read_from_8(data)), true); + } + + return status; +} + +static +int +copy_sys_tables_rec( +/*================*/ + TABLE* table, + const dict_index_t* index, + const rec_t* rec +) +{ + int status; + int field; + + /* NAME */ + field = dict_index_get_nth_col_pos(index, 0); + status = copy_string_field(table, 0, rec, field); + if (status) { + return status; + } + /* ID */ + field = dict_index_get_nth_col_pos(index, 1); + status = copy_id_field(table, 1, rec, field); + if (status) { + return status; + } + /* N_COLS */ + field = dict_index_get_nth_col_pos(index, 2); + status = copy_int_field(table, 2, rec, field); + if (status) { + return status; + } + /* TYPE */ + field = dict_index_get_nth_col_pos(index, 3); + status = copy_int_field(table, 3, rec, field); + if (status) { + return status; + } + /* MIX_ID */ + field = dict_index_get_nth_col_pos(index, 4); + status = copy_id_field(table, 4, rec, field); + if (status) { + return status; + } + /* MIX_LEN */ + field = dict_index_get_nth_col_pos(index, 5); + status = copy_int_field(table, 5, rec, field); + if (status) { + return status; + } + /* CLUSTER_NAME */ + field = dict_index_get_nth_col_pos(index, 6); + status = copy_string_field(table, 6, rec, field); + if (status) { + return status; + } + /* SPACE */ + field = dict_index_get_nth_col_pos(index, 7); + status = copy_int_field(table, 7, rec, field); + if (status) { + return status; + } + + return 0; +} + +static +int +copy_sys_indexes_rec( +/*=================*/ + TABLE* table, + const dict_index_t* index, + const rec_t* rec +) +{ + int status; + int field; + + /* TABLE_ID */ + field = dict_index_get_nth_col_pos(index, 0); + status = copy_id_field(table, 0, rec, field); + if (status) { + return status; + } + /* ID */ + field = dict_index_get_nth_col_pos(index, 1); + status = copy_id_field(table, 1, rec, field); + if (status) { + return status; + } + /* NAME */ + field = dict_index_get_nth_col_pos(index, 2); + status = copy_string_field(table, 2, rec, field); + if (status) { + return status; + } + /* N_FIELDS */ + field = dict_index_get_nth_col_pos(index, 3); + status = copy_int_field(table, 3, rec, field); + if (status) { + return status; + } + /* TYPE */ + field = dict_index_get_nth_col_pos(index, 4); + status = copy_int_field(table, 4, rec, field); + if (status) { + return status; + } + /* SPACE */ + field = dict_index_get_nth_col_pos(index, 5); + status = copy_int_field(table, 5, rec, field); + if (status) { + return status; + } + /* PAGE_NO */ + field = dict_index_get_nth_col_pos(index, 6); + status = copy_int_field(table, 6, rec, field); + if (status) { + return status; + } + + return 0; +} + +static +int +i_s_innodb_schema_table_fill( +/*=========================*/ + THD* thd, + TABLE_LIST* tables, + COND* cond) +{ + int status = 0; + TABLE* table = (TABLE *) tables->table; + const char* table_name = tables->schema_table_name; + dict_table_t* innodb_table; + dict_index_t* index; + btr_pcur_t pcur; + const rec_t* rec; + mtr_t mtr; + int id; + + DBUG_ENTER("i_s_innodb_schema_table_fill"); + + /* deny access to non-superusers */ + if (check_global_access(thd, PROCESS_ACL)) { + DBUG_RETURN(0); + } + + if (innobase_strcasecmp(table_name, "innodb_sys_tables") == 0) { + id = 0; + } else if (innobase_strcasecmp(table_name, "innodb_sys_indexes") == 0) { + id = 1; + } else { + DBUG_RETURN(1); + } + + + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + + mutex_enter(&(dict_sys->mutex)); + + mtr_start(&mtr); + + if (id == 0) { + innodb_table = dict_table_get_low("SYS_TABLES"); + } else { + innodb_table = dict_table_get_low("SYS_INDEXES"); + } + index = UT_LIST_GET_FIRST(innodb_table->indexes); + + btr_pcur_open_at_index_side(TRUE, index, BTR_SEARCH_LEAF, &pcur, + TRUE, &mtr); + for (;;) { + btr_pcur_move_to_next_user_rec(&pcur, &mtr); + + rec = btr_pcur_get_rec(&pcur); + if (!btr_pcur_is_on_user_rec(&pcur)) { + /* end of index */ + btr_pcur_close(&pcur); + mtr_commit(&mtr); + break; + } + if (rec_get_deleted_flag(rec, 0)) { + /* record marked as deleted */ + btr_pcur_close(&pcur); + mtr_commit(&mtr); + continue; + } + + if (id == 0) { + status = copy_sys_tables_rec(table, index, rec); + } else { + status = copy_sys_indexes_rec(table, index, rec); + } + if (status) { + btr_pcur_close(&pcur); + mtr_commit(&mtr); + break; + } + +#if 0 + btr_pcur_store_position(&pcur, &mtr); + mtr_commit(&mtr); + + status = schema_table_store_record(thd, table); + if (status) { + btr_pcur_close(&pcur); + break; + } + + mtr_start(&mtr); + btr_pcur_restore_position(BTR_SEARCH_LEAF, &pcur, &mtr); +#else + status = schema_table_store_record(thd, table); + if (status) { + btr_pcur_close(&pcur); + mtr_commit(&mtr); + break; + } +#endif + } + + mutex_exit(&(dict_sys->mutex)); + + DBUG_RETURN(status); +} + +static +int +i_s_innodb_sys_tables_init( +/*=======================*/ + void* p) +{ + DBUG_ENTER("i_s_innodb_sys_tables_init"); + ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; + + schema->fields_info = i_s_innodb_sys_tables_info; + schema->fill_table = i_s_innodb_schema_table_fill; + + DBUG_RETURN(0); +} + +static +int +i_s_innodb_sys_indexes_init( +/*========================*/ + void* p) +{ + DBUG_ENTER("i_s_innodb_sys_indexes_init"); + ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; + + schema->fields_info = i_s_innodb_sys_indexes_info; + schema->fill_table = i_s_innodb_schema_table_fill; + + DBUG_RETURN(0); +} + +UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_tables = +{ + STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), + STRUCT_FLD(info, &i_s_info), + STRUCT_FLD(name, "INNODB_SYS_TABLES"), + STRUCT_FLD(author, plugin_author), + STRUCT_FLD(descr, "InnoDB SYS_TABLES table"), + STRUCT_FLD(license, PLUGIN_LICENSE_GPL), + STRUCT_FLD(init, i_s_innodb_sys_tables_init), + STRUCT_FLD(deinit, i_s_common_deinit), + STRUCT_FLD(version, 0x0100 /* 1.0 */), + STRUCT_FLD(status_vars, NULL), + STRUCT_FLD(system_vars, NULL), + STRUCT_FLD(__reserved1, NULL) +}; + +UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_indexes = +{ + STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), + STRUCT_FLD(info, &i_s_info), + STRUCT_FLD(name, "INNODB_SYS_INDEXES"), + STRUCT_FLD(author, plugin_author), + STRUCT_FLD(descr, "InnoDB SYS_INDEXES table"), + STRUCT_FLD(license, PLUGIN_LICENSE_GPL), + STRUCT_FLD(init, i_s_innodb_sys_indexes_init), + STRUCT_FLD(deinit, i_s_common_deinit), + STRUCT_FLD(version, 0x0100 /* 1.0 */), + STRUCT_FLD(status_vars, NULL), + STRUCT_FLD(system_vars, NULL), + STRUCT_FLD(__reserved1, NULL) +}; diff --git a/storage/xtradb/handler/i_s.h b/storage/xtradb/handler/i_s.h index 69bd80d0e2b..376ea161a24 100644 --- a/storage/xtradb/handler/i_s.h +++ b/storage/xtradb/handler/i_s.h @@ -41,6 +41,8 @@ extern struct st_mysql_plugin i_s_innodb_rseg; extern struct st_mysql_plugin i_s_innodb_table_stats; extern struct st_mysql_plugin i_s_innodb_index_stats; extern struct st_mysql_plugin i_s_innodb_admin_command; +extern struct st_mysql_plugin i_s_innodb_sys_tables; +extern struct st_mysql_plugin i_s_innodb_sys_indexes; extern struct st_maria_plugin i_s_innodb_buffer_pool_pages_maria; extern struct st_maria_plugin i_s_innodb_buffer_pool_pages_index_maria; diff --git a/storage/xtradb/handler/innodb_patch_info.h b/storage/xtradb/handler/innodb_patch_info.h index 253f6360aa0..5fa50129a04 100644 --- a/storage/xtradb/handler/innodb_patch_info.h +++ b/storage/xtradb/handler/innodb_patch_info.h @@ -43,5 +43,9 @@ struct innodb_enhancement { {"innodb_extend_slow","Extended statistics in slow.log","It is InnoDB-part only. It needs to patch also to mysqld.","http://www.percona.com/docs/wiki/percona-xtradb"}, {"innodb_relax_table_creation","Relax limitation of column size at table creation as builtin InnoDB.","","http://www.percona.com/docs/wiki/percona-xtradb"}, {"innodb_lru_dump_restore","Dump and restore command for content of buffer pool","","http://www.percona.com/docs/wiki/percona-xtradb"}, +{"innodb_pass_corrupt_table","Treat tables as corrupt instead of crash, when meet corrupt blocks","","http://www.percona.com/docs/wiki/percona-xtradb"}, +{"innodb_fast_checksum","Using the checksum on 32bit-unit calculation","incompatible for unpatched ver.","http://www.percona.com/docs/wiki/percona-xtradb"}, +{"innodb_files_extend","allow >4GB transaction log files, and can vary universal page size of datafiles","incompatible for unpatched ver.","http://www.percona.com/docs/wiki/percona-xtradb"}, +{"innodb_sys_tables_sys_indexes","Expose InnoDB SYS_TABLES and SYS_INDEXES schema tables","","http://www.percona.com/docs/wiki/percona-xtradb"}, {NULL, NULL, NULL, NULL} }; diff --git a/storage/xtradb/include/btr0btr.ic b/storage/xtradb/include/btr0btr.ic index 2259d22c9a6..4aa4a41f50d 100644 --- a/storage/xtradb/include/btr0btr.ic +++ b/storage/xtradb/include/btr0btr.ic @@ -28,7 +28,7 @@ Created 6/2/1994 Heikki Tuuri #include "mtr0mtr.h" #include "mtr0log.h" #include "page0zip.h" - +#include "srv0srv.h" #define BTR_MAX_NODE_LEVEL 50 /*!< Maximum B-tree page level (not really a hard limit). Used in debug assertions @@ -52,7 +52,9 @@ btr_block_get( block = buf_page_get(space, zip_size, page_no, mode, mtr); - if (mode != RW_NO_LATCH) { + ut_a(srv_pass_corrupt_table || block); + + if (block && mode != RW_NO_LATCH) { buf_block_dbg_add_level(block, SYNC_TREE_NODE); } diff --git a/storage/xtradb/include/buf0buddy.h b/storage/xtradb/include/buf0buddy.h index a3b9fe1c9cd..3a35f8e46e9 100644 --- a/storage/xtradb/include/buf0buddy.h +++ b/storage/xtradb/include/buf0buddy.h @@ -83,7 +83,7 @@ typedef struct buf_buddy_stat_struct buf_buddy_stat_t; /** Statistics of the buddy system, indexed by block size. Protected by buf_pool_mutex. */ -extern buf_buddy_stat_t buf_buddy_stat[BUF_BUDDY_SIZES + 1]; +extern buf_buddy_stat_t buf_buddy_stat[BUF_BUDDY_SIZES_MAX + 1]; #ifndef UNIV_NONINL # include "buf0buddy.ic" diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h index ddd08c49a12..c95fcc00dd3 100644 --- a/storage/xtradb/include/buf0buf.h +++ b/storage/xtradb/include/buf0buf.h @@ -482,6 +482,11 @@ ulint buf_calc_page_new_checksum( /*=======================*/ const byte* page); /*!< in: buffer page */ +UNIV_INTERN +ulint +buf_calc_page_new_checksum_32( +/*==========================*/ + const byte* page); /*!< in: buffer page */ /********************************************************************//** In versions < 4.0.14 and < 4.1.1 there was a bug that the checksum only looked at the first few bytes of the page. This calculates that old @@ -855,7 +860,7 @@ buf_block_get_frame( const buf_block_t* block) /*!< in: pointer to the control block */ __attribute__((pure)); #else /* UNIV_DEBUG */ -# define buf_block_get_frame(block) (block)->frame +# define buf_block_get_frame(block) (block ? (block)->frame : 0) #endif /* UNIV_DEBUG */ /*********************************************************************//** Gets the space id of a block. @@ -987,7 +992,8 @@ UNIV_INTERN void buf_page_io_complete( /*=================*/ - buf_page_t* bpage); /*!< in: pointer to the block in question */ + buf_page_t* bpage, /*!< in: pointer to the block in question */ + trx_t* trx); /********************************************************************//** Calculates a folded value of a file page address to use in the page hash table. @@ -1155,6 +1161,7 @@ struct buf_page_struct{ 0 if the block was never accessed in the buffer pool */ /* @} */ + ibool is_corrupt; # ifdef UNIV_DEBUG_FILE_ACCESSES ibool file_page_was_freed; /*!< this is set to TRUE when fsp @@ -1422,11 +1429,11 @@ struct buf_pool_struct{ /* @{ */ UT_LIST_BASE_NODE_T(buf_page_t) zip_clean; /*!< unmodified compressed pages */ - UT_LIST_BASE_NODE_T(buf_page_t) zip_free[BUF_BUDDY_SIZES]; + UT_LIST_BASE_NODE_T(buf_page_t) zip_free[BUF_BUDDY_SIZES_MAX]; /*!< buddy free lists */ -#if BUF_BUDDY_HIGH != UNIV_PAGE_SIZE -# error "BUF_BUDDY_HIGH != UNIV_PAGE_SIZE" -#endif +//#if BUF_BUDDY_HIGH != UNIV_PAGE_SIZE +//# error "BUF_BUDDY_HIGH != UNIV_PAGE_SIZE" +//#endif #if BUF_BUDDY_LOW > PAGE_ZIP_MIN_SIZE # error "BUF_BUDDY_LOW > PAGE_ZIP_MIN_SIZE" #endif diff --git a/storage/xtradb/include/buf0buf.ic b/storage/xtradb/include/buf0buf.ic index e48794fc753..c9809fbdcd8 100644 --- a/storage/xtradb/include/buf0buf.ic +++ b/storage/xtradb/include/buf0buf.ic @@ -35,7 +35,7 @@ Created 11/5/1995 Heikki Tuuri #include "buf0flu.h" #include "buf0lru.h" #include "buf0rea.h" - +#include "srv0srv.h" /********************************************************************//** Reads the freed_page_clock of a buffer block. @return freed_page_clock */ @@ -581,6 +581,12 @@ buf_block_get_frame( /*================*/ const buf_block_t* block) /*!< in: pointer to the control block */ { + ut_a(srv_pass_corrupt_table || block); + + if (srv_pass_corrupt_table && !block) { + return(0); + } + ut_ad(block); switch (buf_block_get_state(block)) { diff --git a/storage/xtradb/include/buf0types.h b/storage/xtradb/include/buf0types.h index bfae6477135..507f1543bbb 100644 --- a/storage/xtradb/include/buf0types.h +++ b/storage/xtradb/include/buf0types.h @@ -70,6 +70,7 @@ enum buf_io_fix { buddy system; must be at least sizeof(buf_page_t) */ #define BUF_BUDDY_SIZES (UNIV_PAGE_SIZE_SHIFT - BUF_BUDDY_LOW_SHIFT) +#define BUF_BUDDY_SIZES_MAX (UNIV_PAGE_SIZE_SHIFT_MAX - BUF_BUDDY_LOW_SHIFT) /*!< number of buddy sizes */ /** twice the maximum block size of the buddy system; diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h index 3d49b6a98a4..8272bfe2422 100644 --- a/storage/xtradb/include/dict0dict.h +++ b/storage/xtradb/include/dict0dict.h @@ -1164,6 +1164,15 @@ void dict_close(void); /*============*/ +/************************************************************************* +set is_corrupt flag by space_id*/ + +void +dict_table_set_corrupt_by_space( +/*============================*/ + ulint space_id, + ibool need_mutex); + #ifndef UNIV_NONINL #include "dict0dict.ic" #endif diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h index 2d001111938..603ecfda3f9 100644 --- a/storage/xtradb/include/dict0mem.h +++ b/storage/xtradb/include/dict0mem.h @@ -521,6 +521,7 @@ struct dict_table_struct{ the AUTOINC lock on this table. */ /* @} */ /*----------------------*/ + ibool is_corrupt; #endif /* !UNIV_HOTBACKUP */ #ifdef UNIV_DEBUG diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h index 805948f5b5d..bacaafa1c72 100644 --- a/storage/xtradb/include/fil0fil.h +++ b/storage/xtradb/include/fil0fil.h @@ -116,6 +116,7 @@ extern fil_addr_t fil_addr_null; #define FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID 34 /*!< starting from 4.1.x this contains the space id of the page */ #define FIL_PAGE_DATA 38 /*!< start of the data on the page */ +#define FIL_PAGE_DATA_ALIGN_32 40 /* @} */ /** File page trailer @{ */ #define FIL_PAGE_END_LSN_OLD_CHKSUM 8 /*!< the low 4 bytes of this are used @@ -748,6 +749,19 @@ ulint fil_system_hash_nodes(void); /*========================*/ +/************************************************************************* +functions to access is_corrupt flag of fil_space_t*/ + +ibool +fil_space_is_corrupt( +/*=================*/ + ulint space_id); + +void +fil_space_set_corrupt( +/*==================*/ + ulint space_id); + typedef struct fil_space_struct fil_space_t; #endif diff --git a/storage/xtradb/include/fsp0types.h b/storage/xtradb/include/fsp0types.h index 496081c2346..2dd2deca671 100644 --- a/storage/xtradb/include/fsp0types.h +++ b/storage/xtradb/include/fsp0types.h @@ -42,7 +42,7 @@ fseg_alloc_free_page) */ /* @} */ /** File space extent size (one megabyte) in pages */ -#define FSP_EXTENT_SIZE (1 << (20 - UNIV_PAGE_SIZE_SHIFT)) +#define FSP_EXTENT_SIZE (1u << (20 - UNIV_PAGE_SIZE_SHIFT)) /** On a page of any file segment, data may be put starting from this offset */ diff --git a/storage/xtradb/include/fut0fut.ic b/storage/xtradb/include/fut0fut.ic index 0b52719a055..529f2a516d3 100644 --- a/storage/xtradb/include/fut0fut.ic +++ b/storage/xtradb/include/fut0fut.ic @@ -23,6 +23,7 @@ File-based utilities Created 12/13/1995 Heikki Tuuri ***********************************************************************/ +#include "srv0srv.h" #include "sync0rw.h" #include "buf0buf.h" @@ -48,6 +49,12 @@ fut_get_ptr( ut_ad((rw_latch == RW_S_LATCH) || (rw_latch == RW_X_LATCH)); block = buf_page_get(space, zip_size, addr.page, rw_latch, mtr); + + if (srv_pass_corrupt_table && !block) { + return(0); + } + ut_a(block); + ptr = buf_block_get_frame(block) + addr.boffset; buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); diff --git a/storage/xtradb/include/ha_prototypes.h b/storage/xtradb/include/ha_prototypes.h index e8789d1638b..b737a00b3dc 100644 --- a/storage/xtradb/include/ha_prototypes.h +++ b/storage/xtradb/include/ha_prototypes.h @@ -153,28 +153,6 @@ get_innobase_type_from_mysql_type( const void* field) /*!< in: MySQL Field */ __attribute__((nonnull)); -/*************************************************************//** -If you want to print a thd that is not associated with the current thread, -you must call this function before reserving the InnoDB kernel_mutex, to -protect MySQL from setting thd->query NULL. If you print a thd of the current -thread, we know that MySQL cannot modify thd->query, and it is not necessary -to call this. Call innobase_mysql_end_print_arbitrary_thd() after you release -the kernel_mutex. */ -UNIV_INTERN -void -innobase_mysql_prepare_print_arbitrary_thd(void); -/*============================================*/ - -/*************************************************************//** -Releases the mutex reserved by innobase_mysql_prepare_print_arbitrary_thd(). -In the InnoDB latching order, the mutex sits right above the -kernel_mutex. In debug builds, we assert that the kernel_mutex is -released before this function is invoked. */ -UNIV_INTERN -void -innobase_mysql_end_print_arbitrary_thd(void); -/*========================================*/ - /******************************************************************//** Get the variable length bounds of the given character set. */ UNIV_INTERN diff --git a/storage/xtradb/include/page0cur.h b/storage/xtradb/include/page0cur.h index 1544b0abe1c..6b444b3dd96 100644 --- a/storage/xtradb/include/page0cur.h +++ b/storage/xtradb/include/page0cur.h @@ -293,6 +293,22 @@ page_cur_open_on_rnd_user_rec( /*==========================*/ buf_block_t* block, /*!< in: page */ page_cur_t* cursor);/*!< out: page cursor */ + +UNIV_INTERN +void +page_cur_open_on_nth_user_rec( +/*==========================*/ + buf_block_t* block, /*!< in: page */ + page_cur_t* cursor, /*!< out: page cursor */ + ulint nth); + +UNIV_INTERN +ibool +page_cur_open_on_rnd_user_rec_after_nth( +/*==========================*/ + buf_block_t* block, /*!< in: page */ + page_cur_t* cursor, /*!< out: page cursor */ + ulint nth); #endif /* !UNIV_HOTBACKUP */ /***********************************************************//** Parses a log record of a record insert on a page. diff --git a/storage/xtradb/include/page0types.h b/storage/xtradb/include/page0types.h index d9a277bf208..49fe9d6abbe 100644 --- a/storage/xtradb/include/page0types.h +++ b/storage/xtradb/include/page0types.h @@ -56,8 +56,9 @@ page0*.h includes rem0rec.h and may include rem0rec.ic. */ /** Number of supported compressed page sizes */ #define PAGE_ZIP_NUM_SSIZE (UNIV_PAGE_SIZE_SHIFT - PAGE_ZIP_MIN_SIZE_SHIFT + 2) -#if PAGE_ZIP_NUM_SSIZE > (1 << PAGE_ZIP_SSIZE_BITS) -# error "PAGE_ZIP_NUM_SSIZE > (1 << PAGE_ZIP_SSIZE_BITS)" +#define PAGE_ZIP_NUM_SSIZE_MAX (UNIV_PAGE_SIZE_SHIFT_MAX - PAGE_ZIP_MIN_SIZE_SHIFT + 2) +#if PAGE_ZIP_NUM_SSIZE_MAX > (1 << PAGE_ZIP_SSIZE_BITS) +# error "PAGE_ZIP_NUM_SSIZE_MAX > (1 << PAGE_ZIP_SSIZE_BITS)" #endif /** Compressed page descriptor */ @@ -98,7 +99,7 @@ struct page_zip_stat_struct { typedef struct page_zip_stat_struct page_zip_stat_t; /** Statistics on compression, indexed by page_zip_des_struct::ssize - 1 */ -extern page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE - 1]; +extern page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE_MAX - 1]; /**********************************************************************//** Write the "deleted" flag of a record on a compressed page. The flag must diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h index dc136d89b8c..99ad3ad03d0 100644 --- a/storage/xtradb/include/srv0srv.h +++ b/storage/xtradb/include/srv0srv.h @@ -227,6 +227,7 @@ extern ulint srv_stats_update_need_lock; extern ibool srv_use_doublewrite_buf; extern ibool srv_use_checksums; +extern ibool srv_fast_checksum; extern ibool srv_set_thread_priorities; extern int srv_query_thread_priority; @@ -247,6 +248,7 @@ extern ulong srv_adaptive_checkpoint; extern ulong srv_expand_import; extern ulint srv_relax_table_creation; +extern ulint srv_pass_corrupt_table; extern ulong srv_extra_rsegments; extern ulong srv_dict_size_limit; diff --git a/storage/xtradb/include/trx0sys.h b/storage/xtradb/include/trx0sys.h index 8789d575bca..13d93d5a77a 100644 --- a/storage/xtradb/include/trx0sys.h +++ b/storage/xtradb/include/trx0sys.h @@ -487,9 +487,9 @@ in size */ /** Contents of TRX_SYS_MYSQL_LOG_MAGIC_N_FLD */ #define TRX_SYS_MYSQL_LOG_MAGIC_N 873422344 -#if UNIV_PAGE_SIZE < 4096 -# error "UNIV_PAGE_SIZE < 4096" -#endif +//#if UNIV_PAGE_SIZE < 4096 +//# error "UNIV_PAGE_SIZE < 4096" +//#endif /** The offset of the MySQL replication info in the trx system header; this contains the same fields as TRX_SYS_MYSQL_LOG_INFO below */ #define TRX_SYS_MYSQL_MASTER_LOG_INFO (UNIV_PAGE_SIZE - 2000) diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i index b702c96a85c..0d9417fab38 100644 --- a/storage/xtradb/include/univ.i +++ b/storage/xtradb/include/univ.i @@ -47,7 +47,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 1 #define INNODB_VERSION_MINOR 0 #define INNODB_VERSION_BUGFIX 6 -#define PERCONA_INNODB_VERSION 9 +#define PERCONA_INNODB_VERSION 10 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; @@ -288,9 +288,13 @@ management to ensure correct alignment for doubles etc. */ */ /* The 2-logarithm of UNIV_PAGE_SIZE: */ -#define UNIV_PAGE_SIZE_SHIFT 14 +/* #define UNIV_PAGE_SIZE_SHIFT 14 */ +#define UNIV_PAGE_SIZE_SHIFT_MAX 14 +#define UNIV_PAGE_SIZE_SHIFT srv_page_size_shift /* The universal page size of the database */ -#define UNIV_PAGE_SIZE (1u << UNIV_PAGE_SIZE_SHIFT) +/* #define UNIV_PAGE_SIZE (1u << UNIV_PAGE_SIZE_SHIFT) */ +#define UNIV_PAGE_SIZE srv_page_size +#define UNIV_PAGE_SIZE_MAX (1u << UNIV_PAGE_SIZE_SHIFT_MAX) /* Maximum number of parallel threads in a parallelized operation */ #define UNIV_MAX_PARALLELISM 32 @@ -383,7 +387,7 @@ number indicate that a field contains a reference to an externally stored part of the field in the tablespace. The length field then contains the sum of the following flag and the locally stored len. */ -#define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE) +#define UNIV_EXTERN_STORAGE_FIELD (UNIV_SQL_NULL - UNIV_PAGE_SIZE_MAX) /* Some macros to improve branch prediction and reduce cache misses */ #if defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER) @@ -486,4 +490,6 @@ typedef void* os_thread_ret_t; UNIV_MEM_ALLOC(addr, size); \ } while (0) +extern ulint srv_page_size_shift; +extern ulint srv_page_size; #endif diff --git a/storage/xtradb/include/ut0rnd.h b/storage/xtradb/include/ut0rnd.h index ce5152e942f..ad55df40abc 100644 --- a/storage/xtradb/include/ut0rnd.h +++ b/storage/xtradb/include/ut0rnd.h @@ -124,6 +124,13 @@ ut_fold_binary( const byte* str, /*!< in: string of bytes */ ulint len) /*!< in: length */ __attribute__((pure)); +UNIV_INLINE +ulint +ut_fold_binary_32( +/*==============*/ + const byte* str, /*!< in: string of bytes */ + ulint len) /*!< in: length */ + __attribute__((pure)); /***********************************************************//** Looks for a prime number slightly greater than the given argument. The prime is chosen so that it is not near any power of 2. diff --git a/storage/xtradb/include/ut0rnd.ic b/storage/xtradb/include/ut0rnd.ic index 763469142ec..372b5b6d5b7 100644 --- a/storage/xtradb/include/ut0rnd.ic +++ b/storage/xtradb/include/ut0rnd.ic @@ -228,3 +228,28 @@ ut_fold_binary( return(fold); } + +UNIV_INLINE +ulint +ut_fold_binary_32( +/*==============*/ + const byte* str, /*!< in: string of bytes */ + ulint len) /*!< in: length */ +{ + const ib_uint32_t* str_end = (const ib_uint32_t*) (str + len); + const ib_uint32_t* str_32 = (const ib_uint32_t*) str; + ulint fold = 0; + + ut_ad(str); + /* This function is only for word-aligned data */ + ut_ad(len % 4 == 0); + ut_ad((ulint)str % 4 == 0); + + while (str_32 < str_end) { + fold = ut_fold_ulint_pair(fold, (ulint)(*str_32)); + + str_32++; + } + + return(fold); +} diff --git a/storage/xtradb/lock/lock0lock.c b/storage/xtradb/lock/lock0lock.c index d1a37b13cd0..59394f13766 100644 --- a/storage/xtradb/lock/lock0lock.c +++ b/storage/xtradb/lock/lock0lock.c @@ -4336,11 +4336,6 @@ lock_print_info_summary( /*====================*/ FILE* file) /*!< in: file where to print */ { - /* We must protect the MySQL thd->query field with a MySQL mutex, and - because the MySQL mutex must be reserved before the kernel_mutex of - InnoDB, we call innobase_mysql_prepare_print_arbitrary_thd() here. */ - - innobase_mysql_prepare_print_arbitrary_thd(); lock_mutex_enter_kernel(); if (lock_deadlock_found) { @@ -4423,7 +4418,6 @@ loop: if (trx == NULL) { lock_mutex_exit_kernel(); - innobase_mysql_end_print_arbitrary_thd(); ut_ad(lock_validate()); @@ -4507,7 +4501,6 @@ loop: } lock_mutex_exit_kernel(); - innobase_mysql_end_print_arbitrary_thd(); mtr_start(&mtr); @@ -4518,7 +4511,6 @@ loop: load_page_first = FALSE; - innobase_mysql_prepare_print_arbitrary_thd(); lock_mutex_enter_kernel(); goto loop; diff --git a/storage/xtradb/log/log0log.c b/storage/xtradb/log/log0log.c index 5d54b75b725..f2487407071 100644 --- a/storage/xtradb/log/log0log.c +++ b/storage/xtradb/log/log0log.c @@ -608,7 +608,9 @@ log_group_calc_lsn_offset( offset = (gr_lsn_size_offset + difference) % group_size; + if (sizeof(ulint) == 4) { ut_a(offset < (((ib_int64_t) 1) << 32)); /* offset must be < 4 GB */ + } /* fprintf(stderr, "Offset is %lu gr_lsn_offset is %lu difference is %lu\n", @@ -1805,6 +1807,7 @@ log_group_checkpoint( mach_write_to_4(buf + LOG_CHECKPOINT_LOG_BUF_SIZE, log_sys->buf_size); #ifdef UNIV_LOG_ARCHIVE +#error "UNIV_LOG_ARCHIVE could not be enabled" if (log_sys->archiving_state == LOG_ARCH_OFF) { archived_lsn = IB_ULONGLONG_MAX; } else { @@ -1818,7 +1821,9 @@ log_group_checkpoint( mach_write_ull(buf + LOG_CHECKPOINT_ARCHIVED_LSN, archived_lsn); #else /* UNIV_LOG_ARCHIVE */ - mach_write_ull(buf + LOG_CHECKPOINT_ARCHIVED_LSN, IB_ULONGLONG_MAX); + mach_write_ull(buf + LOG_CHECKPOINT_ARCHIVED_LSN, + (ib_uint64_t)log_group_calc_lsn_offset( + log_sys->next_checkpoint_lsn, group)); #endif /* UNIV_LOG_ARCHIVE */ for (i = 0; i < LOG_MAX_N_GROUPS; i++) { diff --git a/storage/xtradb/log/log0recv.c b/storage/xtradb/log/log0recv.c index a847ee58ab5..25eee07067c 100644 --- a/storage/xtradb/log/log0recv.c +++ b/storage/xtradb/log/log0recv.c @@ -680,8 +680,22 @@ recv_find_max_checkpoint( group->lsn = mach_read_ull( buf + LOG_CHECKPOINT_LSN); + +#ifdef UNIV_LOG_ARCHIVE +#error "UNIV_LOG_ARCHIVE could not be enabled" +#endif + { + ib_uint64_t tmp_lsn_offset = mach_read_ull( + buf + LOG_CHECKPOINT_ARCHIVED_LSN); + if (sizeof(ulint) != 4 + && tmp_lsn_offset != IB_ULONGLONG_MAX) { + group->lsn_offset = (ulint) tmp_lsn_offset; + } else { group->lsn_offset = mach_read_from_4( buf + LOG_CHECKPOINT_OFFSET); + } + } + checkpoint_no = mach_read_ull( buf + LOG_CHECKPOINT_NO); diff --git a/storage/xtradb/mtr/mtr0log.c b/storage/xtradb/mtr/mtr0log.c index 3f3dab36b76..d22015a575f 100644 --- a/storage/xtradb/mtr/mtr0log.c +++ b/storage/xtradb/mtr/mtr0log.c @@ -408,7 +408,7 @@ mlog_parse_string( ptr += 2; if (UNIV_UNLIKELY(offset >= UNIV_PAGE_SIZE) - || UNIV_UNLIKELY(len + offset) > UNIV_PAGE_SIZE) { + || UNIV_UNLIKELY(len + offset > UNIV_PAGE_SIZE)) { recv_sys->found_corrupt_log = TRUE; return(NULL); diff --git a/storage/xtradb/page/page0cur.c b/storage/xtradb/page/page0cur.c index f10f16a7dd9..fa3d2532deb 100644 --- a/storage/xtradb/page/page0cur.c +++ b/storage/xtradb/page/page0cur.c @@ -564,6 +564,74 @@ page_cur_open_on_rnd_user_rec( } while (rnd--); } +UNIV_INTERN +void +page_cur_open_on_nth_user_rec( +/*==========================*/ + buf_block_t* block, /*!< in: page */ + page_cur_t* cursor, /*!< out: page cursor */ + ulint nth) +{ + ulint n_recs = page_get_n_recs(buf_block_get_frame(block)); + + page_cur_set_before_first(block, cursor); + + if (UNIV_UNLIKELY(n_recs == 0)) { + + return; + } + + nth--; + + if (nth >= n_recs) { + nth = n_recs - 1; + } + + do { + page_cur_move_to_next(cursor); + } while (nth--); +} + +UNIV_INTERN +ibool +page_cur_open_on_rnd_user_rec_after_nth( +/*==========================*/ + buf_block_t* block, /*!< in: page */ + page_cur_t* cursor, /*!< out: page cursor */ + ulint nth) +{ + ulint rnd; + ulint n_recs = page_get_n_recs(buf_block_get_frame(block)); + ibool ret; + + page_cur_set_before_first(block, cursor); + + if (UNIV_UNLIKELY(n_recs == 0)) { + + return (FALSE); + } + + nth--; + + if (nth >= n_recs) { + nth = n_recs - 1; + } + + rnd = (ulint) (nth + page_cur_lcg_prng() % (n_recs - nth)); + + if (rnd == nth) { + ret = TRUE; + } else { + ret = FALSE; + } + + do { + page_cur_move_to_next(cursor); + } while (rnd--); + + return (ret); +} + /***********************************************************//** Writes the log record of a record insert on a page. */ static diff --git a/storage/xtradb/page/page0zip.c b/storage/xtradb/page/page0zip.c index aa5e39ff04a..c5c373781a2 100644 --- a/storage/xtradb/page/page0zip.c +++ b/storage/xtradb/page/page0zip.c @@ -49,7 +49,7 @@ Created June 2005 by Marko Makela #ifndef UNIV_HOTBACKUP /** Statistics on compression, indexed by page_zip_des_t::ssize - 1 */ -UNIV_INTERN page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE - 1]; +UNIV_INTERN page_zip_stat_t page_zip_stat[PAGE_ZIP_NUM_SSIZE_MAX - 1]; #endif /* !UNIV_HOTBACKUP */ /* Please refer to ../include/page0zip.ic for a description of the diff --git a/storage/xtradb/row/row0ins.c b/storage/xtradb/row/row0ins.c index fe51fce82c4..4b104ced649 100644 --- a/storage/xtradb/row/row0ins.c +++ b/storage/xtradb/row/row0ins.c @@ -1340,6 +1340,12 @@ run_again: const rec_t* rec = btr_pcur_get_rec(&pcur); const buf_block_t* block = btr_pcur_get_block(&pcur); + if (srv_pass_corrupt_table && !block) { + err = DB_CORRUPTION; + break; + } + ut_a(block); + if (page_rec_is_infimum(rec)) { goto next_rec; diff --git a/storage/xtradb/row/row0merge.c b/storage/xtradb/row/row0merge.c index 25f041c0885..93b2095dc26 100644 --- a/storage/xtradb/row/row0merge.c +++ b/storage/xtradb/row/row0merge.c @@ -92,7 +92,7 @@ This buffer is used for writing or reading a record that spans two row_merge_block_t. Thus, it must be able to hold one merge record, whose maximum size is the same as the minimum size of row_merge_block_t. */ -typedef byte mrec_buf_t[UNIV_PAGE_SIZE]; +typedef byte mrec_buf_t[UNIV_PAGE_SIZE_MAX]; /** @brief Merge record in row_merge_block_t. @@ -1216,6 +1216,13 @@ row_merge_read_clustered_index( if (UNIV_LIKELY(has_next)) { rec = btr_pcur_get_rec(&pcur); + + if (srv_pass_corrupt_table && !rec) { + err = DB_CORRUPTION; + goto err_exit; + } + ut_a(rec); + offsets = rec_get_offsets(rec, clust_index, NULL, ULINT_UNDEFINED, &row_heap); diff --git a/storage/xtradb/row/row0sel.c b/storage/xtradb/row/row0sel.c index ed9ea8fe8c6..1d5d525cca6 100644 --- a/storage/xtradb/row/row0sel.c +++ b/storage/xtradb/row/row0sel.c @@ -3766,6 +3766,13 @@ rec_loop: /* PHASE 4: Look for matching records in a loop */ rec = btr_pcur_get_rec(pcur); + + if (srv_pass_corrupt_table && !rec) { + err = DB_CORRUPTION; + goto lock_wait_or_error; + } + ut_a(rec); + ut_ad(!!page_rec_is_comp(rec) == comp); #ifdef UNIV_SEARCH_DEBUG /* diff --git a/storage/xtradb/srv/srv0srv.c b/storage/xtradb/srv/srv0srv.c index 00352191c2b..e655c4e844d 100644 --- a/storage/xtradb/srv/srv0srv.c +++ b/storage/xtradb/srv/srv0srv.c @@ -224,6 +224,10 @@ UNIV_INTERN ulint srv_n_file_io_threads = ULINT_MAX; UNIV_INTERN ulint srv_n_read_io_threads = ULINT_MAX; UNIV_INTERN ulint srv_n_write_io_threads = ULINT_MAX; +/* The universal page size of the database */ +UNIV_INTERN ulint srv_page_size_shift = 0; +UNIV_INTERN ulint srv_page_size = 0; + /* User settable value of the number of pages that must be present in the buffer cache and accessed sequentially for InnoDB to trigger a readahead request. */ @@ -386,6 +390,7 @@ UNIV_INTERN ulint srv_stats_update_need_lock = 1; UNIV_INTERN ibool srv_use_doublewrite_buf = TRUE; UNIV_INTERN ibool srv_use_checksums = TRUE; +UNIV_INTERN ibool srv_fast_checksum = FALSE; UNIV_INTERN ibool srv_set_thread_priorities = TRUE; UNIV_INTERN int srv_query_thread_priority = 0; @@ -406,6 +411,7 @@ UNIV_INTERN ulong srv_adaptive_checkpoint = 0; /* 0: none 1: reflex 2: estimat UNIV_INTERN ulong srv_expand_import = 0; /* 0:disable 1:enable */ UNIV_INTERN ulint srv_relax_table_creation = 0; /* 0:disable 1:enable */ +UNIV_INTERN ulint srv_pass_corrupt_table = 0; /* 0:disable 1:enable */ UNIV_INTERN ulong srv_extra_rsegments = 0; /* extra rseg for users */ UNIV_INTERN ulong srv_dict_size_limit = 0; @@ -2559,6 +2565,7 @@ srv_master_thread( srv_main_thread_process_no = os_proc_get_number(); srv_main_thread_id = os_thread_pf(os_thread_get_curr_id()); + mutex_enter(&kernel_mutex); srv_table_reserve_slot(SRV_MASTER); diff --git a/storage/xtradb/srv/srv0start.c b/storage/xtradb/srv/srv0start.c index 264bf7a7c05..dcc13ea17b6 100644 --- a/storage/xtradb/srv/srv0start.c +++ b/storage/xtradb/srv/srv0start.c @@ -1352,10 +1352,12 @@ innobase_start_or_create_for_mysql(void) } #endif /* UNIV_LOG_ARCHIVE */ - if (srv_n_log_files * srv_log_file_size >= 262144) { + if (sizeof(ulint) == 4 + && srv_n_log_files * srv_log_file_size + >= ((ulint)1 << (32 - UNIV_PAGE_SIZE_SHIFT))) { fprintf(stderr, "InnoDB: Error: combined size of log files" - " must be < 4 GB\n"); + " must be < 4 GB on 32-bit systems\n"); return(DB_ERROR); } @@ -1364,7 +1366,7 @@ innobase_start_or_create_for_mysql(void) for (i = 0; i < srv_n_data_files; i++) { #ifndef __WIN__ - if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= 262144) { + if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= ((ulint)1 << (32 - UNIV_PAGE_SIZE_SHIFT))) { fprintf(stderr, "InnoDB: Error: file size must be < 4 GB" " with this MySQL binary\n" @@ -1809,6 +1811,13 @@ innobase_start_or_create_for_mysql(void) os_fast_mutex_free(&srv_os_test_mutex); + if (!srv_file_per_table_original_value + && srv_pass_corrupt_table) { + fprintf(stderr, "InnoDB: Warning:" + " innodb_file_per_table is diabled." + " So innodb_pass_corrupt_table doesn't make sence\n"); + } + if (srv_print_verbose_log) { ut_print_timestamp(stderr); fprintf(stderr, diff --git a/storage/xtradb/trx/trx0i_s.c b/storage/xtradb/trx/trx0i_s.c index e7646c99227..78b20edd365 100644 --- a/storage/xtradb/trx/trx0i_s.c +++ b/storage/xtradb/trx/trx0i_s.c @@ -1205,9 +1205,6 @@ trx_i_s_possibly_fetch_data_into_cache( return(1); } - /* We are going to access trx->query in all transactions */ - innobase_mysql_prepare_print_arbitrary_thd(); - /* We need to read trx_sys and record/table lock queues */ mutex_enter(&kernel_mutex); @@ -1215,8 +1212,6 @@ trx_i_s_possibly_fetch_data_into_cache( mutex_exit(&kernel_mutex); - innobase_mysql_end_print_arbitrary_thd(); - return(0); } diff --git a/storage/xtradb/trx/trx0trx.c b/storage/xtradb/trx/trx0trx.c index 69bc5c6b18b..e81daf4cad9 100644 --- a/storage/xtradb/trx/trx0trx.c +++ b/storage/xtradb/trx/trx0trx.c @@ -1695,9 +1695,7 @@ trx_mark_sql_stat_end( /**********************************************************************//** Prints info about a transaction to the given file. The caller must own the -kernel mutex and must have called -innobase_mysql_prepare_print_arbitrary_thd(), unless he knows that MySQL -or InnoDB cannot meanwhile change the info printed here. */ +kernel mutex. */ UNIV_INTERN void trx_print( |