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.
This commit is contained in:
Sergei Golubchik 2008-08-06 23:52:55 +02:00
parent 3971e262e9
commit 5a4cdba544
2 changed files with 15 additions and 2 deletions
storage/maria

View file

@ -185,8 +185,21 @@ int maria_write(MARIA_HA *info, uchar *record)
buff, record, filepos,
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));
/*
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
transaction was committed long time ago. It could not be

View file

@ -758,6 +758,7 @@ TRN *trnman_recreate_trn_from_recovery(uint16 shortid, TrID longid)
TrID old_trid_generator= global_trid_generator;
TRN *trn;
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))
return NULL;
/* deallocate excessive allocations of trnman_new_trn() */
@ -766,7 +767,6 @@ TRN *trnman_recreate_trn_from_recovery(uint16 shortid, TrID longid)
short_trid_to_active_trn[trn->short_id]= 0;
DBUG_ASSERT(short_trid_to_active_trn[shortid] == NULL);
short_trid_to_active_trn[shortid]= trn;
trn->trid= longid;
trn->short_id= shortid;
return trn;
}