Commit e8b0d677 authored by Sergei Golubchik's avatar Sergei Golubchik

fixes for failing test suite

storage/maria/ma_write.c:
  select ... group by ... - take temporary tables into account, they have TRN->pins == 0
storage/maria/trnman.c:
  one cannot modify TRN->trid, it's a key in the trid_to_trn
  hash, if trid is modified, TRN won't be found (and deleted in
  trnman_free_trn) from the hash.
parent 9423c79b
...@@ -185,8 +185,21 @@ int maria_write(MARIA_HA *info, uchar *record) ...@@ -185,8 +185,21 @@ int maria_write(MARIA_HA *info, uchar *record)
buff, record, filepos, buff, record, filepos,
info->trn->trid))) info->trn->trid)))
{ {
TRN *blocker=trnman_trid_to_trn(info->trn, info->dup_key_trid); TRN *blocker;
DBUG_PRINT("error",("Got error: %d on write",my_errno)); DBUG_PRINT("error",("Got error: %d on write",my_errno));
/*
explicit check for our own trid, because temp tables
aren't transactional and don't have a proper TRN so the code
below doesn't work for them
XXX a better test perhaps ?
*/
if (info->dup_key_trid == info->trn->trid)
{
if (local_lock_tree)
rw_unlock(&keyinfo->root_lock);
goto err;
}
blocker= trnman_trid_to_trn(info->trn, info->dup_key_trid);
/* /*
if blocker TRN was not found, it means that the conflicting if blocker TRN was not found, it means that the conflicting
transaction was committed long time ago. It could not be transaction was committed long time ago. It could not be
......
...@@ -758,6 +758,7 @@ TRN *trnman_recreate_trn_from_recovery(uint16 shortid, TrID longid) ...@@ -758,6 +758,7 @@ TRN *trnman_recreate_trn_from_recovery(uint16 shortid, TrID longid)
TrID old_trid_generator= global_trid_generator; TrID old_trid_generator= global_trid_generator;
TRN *trn; TRN *trn;
DBUG_ASSERT(maria_in_recovery && !maria_multi_threaded); DBUG_ASSERT(maria_in_recovery && !maria_multi_threaded);
global_trid_generator= longid-1; /* force a correct trid in the new trn */
if (unlikely((trn= trnman_new_trn(NULL, NULL)) == NULL)) if (unlikely((trn= trnman_new_trn(NULL, NULL)) == NULL))
return NULL; return NULL;
/* deallocate excessive allocations of trnman_new_trn() */ /* deallocate excessive allocations of trnman_new_trn() */
...@@ -766,7 +767,6 @@ TRN *trnman_recreate_trn_from_recovery(uint16 shortid, TrID longid) ...@@ -766,7 +767,6 @@ TRN *trnman_recreate_trn_from_recovery(uint16 shortid, TrID longid)
short_trid_to_active_trn[trn->short_id]= 0; short_trid_to_active_trn[trn->short_id]= 0;
DBUG_ASSERT(short_trid_to_active_trn[shortid] == NULL); DBUG_ASSERT(short_trid_to_active_trn[shortid] == NULL);
short_trid_to_active_trn[shortid]= trn; short_trid_to_active_trn[shortid]= trn;
trn->trid= longid;
trn->short_id= shortid; trn->short_id= shortid;
return trn; return trn;
} }
......
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