summaryrefslogtreecommitdiff
path: root/storage/maria
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-03-20 10:26:49 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-03-20 10:41:32 +0200
commit514b305dfb2839c619a623bbdae5f21cf0077672 (patch)
tree2f9700f05ccf0ddc7e46a547d9a191404e8dbbd7 /storage/maria
parentde51acd03730311505677eb7212756e7126183b3 (diff)
parent117291db8b35ddb4cd8c89ee4d8de888160b7163 (diff)
downloadmariadb-git-514b305dfb2839c619a623bbdae5f21cf0077672.tar.gz
Merge 10.3 into 10.4
The MDEV-17262 commit 26432e49d37a37d09b862bb49a021e44bdf4789c was skipped. In Galera 4, the implementation would seem to require changes to the streaming replication. In the tests archive.rnd_pos main.profiling, disable_ps_protocol for SHOW STATUS and SHOW PROFILE commands until MDEV-18974 has been fixed.
Diffstat (limited to 'storage/maria')
-rw-r--r--storage/maria/ma_recovery.c13
-rw-r--r--storage/maria/ma_write.c13
2 files changed, 20 insertions, 6 deletions
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index 8d2381a3e19..3ddf2d91f16 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -1416,6 +1416,11 @@ static int new_table(uint16 sid, const char *name, LSN lsn_of_file_id)
}
if (cmp_translog_addr(lsn_of_file_id, share->state.create_rename_lsn) <= 0)
{
+ /*
+ This can happen if the table was dropped and re-created since this
+ redo entry or if the table had a bulk insert directly after create,
+ in which case the create_rename_lsn changed.
+ */
tprint(tracef, ", has create_rename_lsn " LSN_FMT " more recent than"
" LOGREC_FILE_ID's LSN " LSN_FMT ", ignoring open request",
LSN_IN_PARTS(share->state.create_rename_lsn),
@@ -3636,8 +3641,16 @@ my_bool _ma_reenable_logging_for_table(MARIA_HA *info, my_bool flush_pages)
{
/* Ensure that recover is not executing any redo before this */
if (!maria_in_recovery)
+ {
+ if (share->id != 0)
+ {
+ mysql_mutex_lock(&share->intern_lock);
+ translog_deassign_id_from_share(share);
+ mysql_mutex_unlock(&share->intern_lock);
+ }
share->state.is_of_horizon= share->state.create_rename_lsn=
share->state.skip_redo_lsn= translog_get_horizon();
+ }
/*
We are going to change callbacks; if a page is flushed at this moment
this can cause race conditions, that's one reason to flush pages
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c
index 52eefa33bc3..7e9df1ed56c 100644
--- a/storage/maria/ma_write.c
+++ b/storage/maria/ma_write.c
@@ -1676,14 +1676,15 @@ static int keys_compare(bulk_insert_param *param, uchar *key1, uchar *key2)
}
-static int keys_free(uchar *key, TREE_FREE mode, bulk_insert_param *param)
+static int keys_free(void* key_arg, TREE_FREE mode, void *param_arg)
{
/*
Probably I can use info->lastkey here, but I'm not sure,
and to be safe I'd better use local lastkey.
*/
+ bulk_insert_param *param= (bulk_insert_param*)param_arg;
MARIA_SHARE *share= param->info->s;
- uchar lastkey[MARIA_MAX_KEY_BUFF];
+ uchar lastkey[MARIA_MAX_KEY_BUFF], *key= (uchar*)key_arg;
uint keylen;
MARIA_KEYDEF *keyinfo= share->keyinfo + param->keynr;
MARIA_KEY tmp_key;
@@ -1710,13 +1711,14 @@ static int keys_free(uchar *key, TREE_FREE mode, bulk_insert_param *param)
copying middle key up if tree is growing
*/
memcpy(lastkey, key, tmp_key.data_length + tmp_key.ref_length);
- return _ma_ck_write_btree(param->info, &tmp_key);
+ _ma_ck_write_btree(param->info, &tmp_key);
+ return 0;
case free_end:
if (share->lock_key_trees)
mysql_rwlock_unlock(&keyinfo->root_lock);
return 0;
}
- return 1;
+ return 0;
}
@@ -1772,8 +1774,7 @@ int maria_init_bulk_insert(MARIA_HA *info, size_t cache_size, ha_rows rows)
init_tree(&info->bulk_insert[i],
cache_size * key[i].maxlength,
cache_size * key[i].maxlength, 0,
- (qsort_cmp2)keys_compare,
- (tree_element_free) keys_free, (void *)params++, MYF(0));
+ (qsort_cmp2) keys_compare, keys_free, (void *)params++, MYF(0));
}
else
info->bulk_insert[i].root=0;