6195: Add more debug info to teamrace to figure out how duplicate ranks occur r=def- a=Zwelf

Should help with #6194. I don't have my mysql setup with me right now, so I can't check if I can find out what is going wrong. I'll see if I can do that tomorrow :)

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Zwelf <zwelf@strct.cc>
This commit is contained in:
bors[bot] 2022-12-26 08:45:48 +00:00 committed by GitHub
commit 50f83a6de6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -414,8 +414,12 @@ bool CScoreWorker::SaveScore(IDbConnection *pSqlServer, const ISqlData *pGameDat
pSqlServer->BindString(2, pData->m_aName);
pSqlServer->BindString(3, pData->m_aTimestamp);
pSqlServer->Print();
int NumInserted;
pSqlServer->ExecuteUpdate(&NumInserted, pError, ErrorSize);
int NumDeleted;
pSqlServer->ExecuteUpdate(&NumDeleted, pError, ErrorSize);
if(NumDeleted == 0)
{
dbg_msg("sql", "Warning: Rank got moved out of backup database, will show up as duplicate rank in MySQL");
}
return false;
}
if(w == Write::NORMAL_FAILED)
@ -554,8 +558,17 @@ bool CScoreWorker::SaveTeamScore(IDbConnection *pSqlServer, const ISqlData *pGam
// copy uuid, because mysql BindBlob doesn't support const buffers
CUuid TeamrankId = pData->m_TeamrankUuid;
pSqlServer->BindBlob(1, TeamrankId.m_aData, sizeof(TeamrankId.m_aData));
int NumInserted;
return pSqlServer->ExecuteUpdate(&NumInserted, pError, ErrorSize);
pSqlServer->Print();
int NumDeleted;
if(pSqlServer->ExecuteUpdate(&NumDeleted, pError, ErrorSize))
{
return true;
}
if(NumDeleted == 0)
{
dbg_msg("sql", "Warning: Teamrank got moved out of backup database, will show up as duplicate teamrank in MySQL");
}
return false;
}
if(w == Write::NORMAL_FAILED)
{
@ -570,6 +583,7 @@ bool CScoreWorker::SaveTeamScore(IDbConnection *pSqlServer, const ISqlData *pGam
return true;
}
pSqlServer->BindBlob(1, TeamrankId.m_aData, sizeof(TeamrankId.m_aData));
pSqlServer->Print();
if(pSqlServer->ExecuteUpdate(&NumInserted, pError, ErrorSize))
{
return true;
@ -583,6 +597,7 @@ bool CScoreWorker::SaveTeamScore(IDbConnection *pSqlServer, const ISqlData *pGam
return true;
}
pSqlServer->BindBlob(1, TeamrankId.m_aData, sizeof(TeamrankId.m_aData));
pSqlServer->Print();
return pSqlServer->ExecuteUpdate(&NumInserted, pError, ErrorSize);
}