Commit 213d518c authored by Michael Widenius's avatar Michael Widenius

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

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
parents 0af4bedc da904304
......@@ -27,9 +27,10 @@ Known bugs that we are working on and will be fixed shortly
- 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 before Beta
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
=============================================
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:
- 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)
- 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
====================================
......
......@@ -134,6 +134,12 @@ extern size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len);
#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
......
......@@ -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, &param, 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,
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;
......
......@@ -4428,8 +4428,8 @@ static int sort_key_read(MARIA_SORT_PARAM *sort_param, uchar *key)
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);
......
......@@ -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
......
......@@ -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(TRANSLOG_ADDRESS *horizon,
}
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 lsn)
{
/* 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 lsn)
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();
......
......@@ -1349,6 +1349,7 @@ uint _ma_state_info_read_dsk(File file, MARIA_STATE_INFO *state)
{
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, MARIA_STATE_INFO *state)
return 1;
_ma_state_info_read(buff, state);
}
#endif
return 0;
}
......
......@@ -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
......
......@@ -396,6 +396,7 @@ static int _ma_ck_write_btree_with_log(MARIA_HA *info, MARIA_KEY *key,
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 */
......
......@@ -519,17 +519,24 @@ my_bool trnman_end_trn(TRN *trn, my_bool commit)
*/
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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment