#At bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-maria/
2648 Michael Widenius 2008-06-28 [merge]
Automatic merge
Added some minor changes that was done in my tree while waiting for test to run:
- Remove in Maria T_QUICK when retrying repair for enabling indexes, as the record file may be in use by other threads
- Disable code that is only relevant for EXTERNAL_LOCKING
modified:
KNOWN_BUGS.txt
include/m_string.h
storage/maria/ha_maria.cc
storage/maria/ma_check.c
storage/maria/ma_key.c
storage/maria/ma_loghandler.c
storage/maria/ma_open.c
storage/maria/ma_sp_key.c
storage/maria/ma_write.c
storage/maria/trnman.c
per-file messages:
include/m_string.h
Automatic merge
storage/maria/ha_maria.cc
Remove T_QUICK when retrying repair for enabling indexes, as the record file may be in use by other threads
storage/maria/ma_check.c
Automatic merge
storage/maria/ma_key.c
Automatic merge
storage/maria/ma_loghandler.c
Automatic merge
storage/maria/ma_open.c
Disable code that is only relevant for EXTERNAL_LOCKING
storage/maria/ma_sp_key.c
Automatic merge
storage/maria/ma_write.c
Automatic merge
storage/maria/trnman.c
Automatic merge
=== modified file 'KNOWN_BUGS.txt'
--- a/KNOWN_BUGS.txt 2008-06-02 20:53:25 +0000
+++ b/KNOWN_BUGS.txt 2008-06-28 13:57:00 +0000
@@ -27,9 +27,10 @@ Known bugs that we are working on and wi
- We have some instabilities in log writing that is under investigatation
This causes mainly assert to triggers in the code and sometimes
the log handler doesn't start up after restart.
+ Most of this should now be fixed...
-Known bugs that are planned to be fixed before Beta
-===================================================
+Known bugs that are planned to be fixed before Gamma/RC
+=======================================================
- If we get a write failure on disk (disk full or disk error) for the
log, we should stop all usage of transactional tables and mark all
@@ -44,15 +45,22 @@ Known bugs that are planned to be fixed
or kill mysqld, remove logs and repair tables.
-Missing features that is planned to fix before Beta
-===================================================
+Known bugs that are planned to be fixed later
+=============================================
-- Multiple concurrent inserts & multiple concurrent readers at same time
- with full MVCC control. Note that UPDATE and DELETE will still be
- blocking (as with MyISAM)
-- COUNT(*) and TABLE CHECKSUM under MVCC (ie, they are instant and kept up
- to date even with multiple inserter)
+LOCK TABLES .. WRITE CONCURRENT is mainly done for testing MVCC. Don't
+use this in production. Things that is not working if you are using
+this on a table:
+
+- INSERT/REPLACE ... SELECT on an empty table may cause crashes or
+ wrong results if someone else is doing writes on the table during repair
+ or someone is doing selects during the repair index phase.
+INSERT ... SELECT and REPLACE ... SELECT are blocking inserts and
+SELECT for the table.
+
+Missing features that is planned to fix before Beta
+===================================================
Features planned for future releases
====================================
=== modified file 'include/m_string.h'
--- a/include/m_string.h 2008-04-28 16:24:05 +0000
+++ b/include/m_string.h 2008-06-26 15:10:11 +0000
@@ -134,6 +134,12 @@ extern size_t my_bcmp(const uchar *s1,co
#define bzero_if_purify(A,B)
#endif /* HAVE_purify */
+#if defined(_lint) || defined(FORCE_INIT_OF_VARS)
+#define LINT_INIT_STRUCT(var) bzero(&var, sizeof(var)) /* No uninitialize-warning */
+#else
+#define LINT_INIT_STRUCT(var)
+#endif
+
#ifndef bmove512
extern void bmove512(uchar *dst,const uchar *src,size_t len);
#endif
=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc 2008-06-28 12:45:15 +0000
+++ b/storage/maria/ha_maria.cc 2008-06-28 13:57:00 +0000
@@ -1714,7 +1714,7 @@ int ha_maria::enable_indexes(uint mode)
/* This should never fail normally */
DBUG_ASSERT(0);
/* Repairing by sort failed. Now try standard repair method. */
- param.testflag &= ~(T_REP_BY_SORT | T_QUICK);
+ param.testflag &= ~T_REP_BY_SORT;
error= (repair(thd, ¶m, 0) != HA_ADMIN_OK);
/*
If the standard repair succeeded, clear all error messages which
@@ -2473,6 +2473,10 @@ THR_LOCK_DATA **ha_maria::store_lock(THD
thd->lex->sql_command != SQLCOM_LOCK_TABLES) &&
mysql_bin_log.is_open())
lock_type= TL_READ_NO_INSERT;
+ else if (lock_type == TL_WRITE_CONCURRENT_INSERT &&
+ (thd->lex->sql_command == SQLCOM_REPLACE_SELECT ||
+ thd->lex->sql_command == SQLCOM_REPLACE_SELECT))
+ lock_type= TL_WRITE;
file->lock.type= lock_type;
}
*to++= &file->lock;
=== modified file 'storage/maria/ma_check.c'
--- a/storage/maria/ma_check.c 2008-06-28 08:27:14 +0000
+++ b/storage/maria/ma_check.c 2008-06-28 13:57:00 +0000
@@ -4428,8 +4428,8 @@ static int sort_key_read(MARIA_SORT_PARA
int error;
MARIA_SORT_INFO *sort_info= sort_param->sort_info;
MARIA_HA *info= sort_info->info;
- DBUG_ENTER("sort_key_read");
MARIA_KEY int_key;
+ DBUG_ENTER("sort_key_read");
if ((error=sort_get_next_record(sort_param)))
DBUG_RETURN(error);
=== modified file 'storage/maria/ma_key.c'
--- a/storage/maria/ma_key.c 2008-06-26 05:18:28 +0000
+++ b/storage/maria/ma_key.c 2008-06-26 15:10:11 +0000
@@ -19,7 +19,7 @@
#include "m_ctype.h"
#include "ma_sp_defs.h"
#include "ma_blockrec.h" /* For ROW_FLAG_TRANSID */
-#include <trnman.h>
+#include "trnman.h"
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
=== modified file 'storage/maria/ma_loghandler.c'
--- a/storage/maria/ma_loghandler.c 2008-06-26 09:32:22 +0000
+++ b/storage/maria/ma_loghandler.c 2008-06-26 19:27:08 +0000
@@ -95,6 +95,10 @@ typedef union
#define MAX_NUMBER_OF_LSNS_PER_RECORD 2
+/* max lsn calculation for buffer */
+#define BUFFER_MAX_LSN(B) \
+ ((B)->last_lsn == LSN_IMPOSSIBLE ? (B)->prev_last_lsn : (B)->last_lsn)
+
/* log write buffer descriptor */
struct st_translog_buffer
{
@@ -2093,9 +2097,7 @@ static my_bool translog_buffer_next(TRAN
}
log_descriptor.buffers[old_buffer_no].next_buffer_offset= new_buffer->offset;
new_buffer->prev_last_lsn=
- ((log_descriptor.buffers[old_buffer_no].last_lsn != LSN_IMPOSSIBLE) ?
- log_descriptor.buffers[old_buffer_no].last_lsn :
- log_descriptor.buffers[old_buffer_no].prev_last_lsn);
+ BUFFER_MAX_LSN(log_descriptor.buffers + old_buffer_no);
DBUG_PRINT("info", ("prev_last_lsn set to (%lu,0x%lx) buffer: 0x%lx",
LSN_IN_PARTS(new_buffer->prev_last_lsn),
(ulong) new_buffer));
@@ -7515,7 +7517,7 @@ my_bool translog_flush(TRANSLOG_ADDRESS
{
/* fix lsn if it was horizon */
if (cmp_translog_addr(lsn, log_descriptor.bc.buffer->last_lsn) > 0)
- lsn= log_descriptor.bc.buffer->last_lsn;
+ lsn= BUFFER_MAX_LSN(log_descriptor.bc.buffer);
translog_flush_wait_for_end(lsn);
pthread_mutex_unlock(&log_descriptor.log_flush_lock);
DBUG_RETURN(0);
@@ -7550,11 +7552,24 @@ my_bool translog_flush(TRANSLOG_ADDRESS
i= (i + 1) % TRANSLOG_BUFFERS_NO) {}
start_buffer_no= i;
- /* if we have to flush last buffer then we will finish it */
- if (cmp_translog_addr(lsn, log_descriptor.bc.buffer->prev_last_lsn) > 0)
+ DBUG_PRINT("info",
+ ("start from: %u current: %u prev last lsn: (%lu,0x%lx)",
+ (uint) start_buffer_no, (uint) log_descriptor.bc.buffer_no,
+ LSN_IN_PARTS(log_descriptor.bc.buffer->prev_last_lsn)));
+
+
+ /*
+ if LSN up to which we have to flush bigger then maximum LSN of previous
+ buffer and at least one LSN was saved in the current buffer (last_lsn !=
+ LSN_IMPOSSIBLE) then we better finish the current buffer.
+ */
+ if (cmp_translog_addr(lsn, log_descriptor.bc.buffer->prev_last_lsn) > 0 &&
+ log_descriptor.bc.buffer->last_lsn != LSN_IMPOSSIBLE)
{
struct st_translog_buffer *buffer= log_descriptor.bc.buffer;
lsn= log_descriptor.bc.buffer->last_lsn; /* fix lsn if it was horizon */
+ DBUG_PRINT("info", ("LSN to flush fixed to last lsn: (%lu,0x%lx)",
+ LSN_IN_PARTS(log_descriptor.bc.buffer->last_lsn)));
last_buffer_no= log_descriptor.bc.buffer_no;
log_descriptor.is_everything_flushed= 1;
translog_force_current_buffer_to_finish();
=== modified file 'storage/maria/ma_open.c'
--- a/storage/maria/ma_open.c 2008-06-26 05:18:28 +0000
+++ b/storage/maria/ma_open.c 2008-06-28 13:57:00 +0000
@@ -1349,6 +1349,7 @@ uint _ma_state_info_read_dsk(File file,
{
uchar buff[MARIA_STATE_INFO_SIZE + MARIA_STATE_EXTRA_SIZE];
+#ifdef EXTERNAL_LOCKING
/* trick to detect transactional tables */
DBUG_ASSERT(state->create_rename_lsn == LSN_IMPOSSIBLE);
if (!maria_single_user)
@@ -1357,6 +1358,7 @@ uint _ma_state_info_read_dsk(File file,
return 1;
_ma_state_info_read(buff, state);
}
+#endif
return 0;
}
=== modified file 'storage/maria/ma_sp_key.c'
--- a/storage/maria/ma_sp_key.c 2008-06-26 05:18:28 +0000
+++ b/storage/maria/ma_sp_key.c 2008-06-26 15:10:11 +0000
@@ -15,7 +15,7 @@
#include "maria_def.h"
#include "ma_blockrec.h" /* For ROW_FLAG_TRANSID */
-#include <trnman.h>
+#include "trnman.h"
#ifdef HAVE_SPATIAL
=== modified file 'storage/maria/ma_write.c'
--- a/storage/maria/ma_write.c 2008-06-26 05:18:28 +0000
+++ b/storage/maria/ma_write.c 2008-06-26 15:10:11 +0000
@@ -396,6 +396,7 @@ static int _ma_ck_write_btree_with_log(M
MARIA_KEY org_key;
DBUG_ENTER("_ma_ck_write_btree_with_log");
+ LINT_INIT_STRUCT(org_key);
if (share->now_transactional)
{
/* Save original value as the key may change */
=== modified file 'storage/maria/trnman.c'
--- a/storage/maria/trnman.c 2008-06-26 05:18:28 +0000
+++ b/storage/maria/trnman.c 2008-06-28 10:06:59 +0000
@@ -519,17 +519,24 @@ my_bool trnman_end_trn(TRN *trn, my_bool
*/
void trnman_free_trn(TRN *trn)
{
- TRN *tmp= pool;
+ /*
+ union is to solve strict aliasing issue.
+ without it gcc 3.4.3 doesn't notice that updating *(void **)&tmp
+ modifies the value of tmp.
+ */
+ union { TRN *trn; void *v; } tmp;
+
+ tmp.trn= pool;
my_atomic_rwlock_wrlock(&LOCK_pool);
do
{
/*
- without this volatile cast gcc-3.4.4 moved the assignment
+ without this volatile cast gcc-3.4.4 moves the assignment
down after the loop at -O2
*/
- *(TRN * volatile *)&(trn->next)= tmp;
- } while (!my_atomic_casptr((void **)&pool, (void **)&tmp, trn));
+ *(TRN * volatile *)&(trn->next)= tmp.trn;
+ } while (!my_atomic_casptr((void **)&pool, &tmp.v, trn));
my_atomic_rwlock_wrunlock(&LOCK_pool);
}
| Thread |
|---|
| • bzr commit into MySQL/Maria:mysql-maria branch (monty:2648) | Michael Widenius | 28 Jun |