Skip to content

Commit

Permalink
Automatic merge
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Michael Widenius committed Jun 28, 2008
2 parents d29e7f7 + 97a0501 commit c580583
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 23 deletions.
26 changes: 17 additions & 9 deletions KNOWN_BUGS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand 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
====================================
Expand Down
6 changes: 6 additions & 0 deletions include/m_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion storage/maria/ha_maria.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion storage/maria/ma_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion storage/maria/ma_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 21 additions & 6 deletions storage/maria/ma_loghandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions storage/maria/ma_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion storage/maria/ma_sp_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions storage/maria/ma_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
15 changes: 11 additions & 4 deletions storage/maria/trnman.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit c580583

Please sign in to comment.