Fix a bug that can destroy metadata. If we find destroyed

metadata, fix it.
This commit is contained in:
JoelKatz
2013-07-09 09:38:50 -07:00
parent e0e12febce
commit c288c4cd25
8 changed files with 15 additions and 78 deletions

View File

@@ -121,46 +121,6 @@ void Transaction::setStatus (TransStatus ts, uint32 lseq)
mInLedger = lseq;
}
void Transaction::save ()
{
if ((mStatus == INVALID) || (mStatus == REMOVED))
return;
char status;
switch (mStatus)
{
case NEW:
status = TXN_SQL_NEW;
break;
case INCLUDED:
status = TXN_SQL_INCLUDED;
break;
case CONFLICTED:
status = TXN_SQL_CONFLICT;
break;
case COMMITTED:
status = TXN_SQL_VALIDATED;
break;
case HELD:
status = TXN_SQL_HELD;
break;
default:
status = TXN_SQL_UNKNOWN;
}
Database* db = getApp().getTxnDB ()->getDB ();
ScopedLock dbLock (getApp().getTxnDB ()->getDBLock ());
// FIXME: This can destroy metadata
db->executeSQL (mTransaction->getSQLInsertReplaceHeader () + mTransaction->getSQL (getLedger (), status) + ";");
}
Transaction::pointer Transaction::transactionFromSQL (Database* db, bool bValidate)
{
Serializer rawTxn;