Hey all. So we've got a nasty problem that surfaces about 1-2 times a month where a server crash wipes out one of our player housing databases. I'm trying to lock down the root cause of the problem, but it's proven to be very elusive. In the meantime, I'm trying to think of ways to improve the reliability or uncover any potential limitations of the NDBE system that we use for this database.
For those familiar with the system, I am fairly confident the NBDE_FlushCampaignDatabase() function is likely the reason the DB is being lost (it's down below). I believe what is happening is that either the DestroyCampaignDatabase or the SCO function within it crash, which results in the DB being destroyed, but then the NBDE object on which all the variables are located is not saved because one of those functions brings down the NWServer app before it can be saved.
So my questions to all NWN's clever individuals here are:
1. Is there a limitation to the number of variables that can be stored on an object which could cause problems with the SCO function? The database we are losing is the largest that NBDE handles. And while I have not counted up the variables being stored on the actual objet (I can do that if anyone things it would help), I'm pretty sure we're in the thousands.
2. Are there any redunancy checks you would recommend to the function below to avoid that millisecond delay in which the database has been destroyed, and the object only exists in the module before SCO is used to save it?
// this will flush (aka write to disk) the specified campaign database in one big swoop
//
// don't use this function in a rapid manner.
// delay each subsequent call to this function by at least 1 second (using delaycommand)
// this way you completely eliminate cpu-spikes, no matter how many database
// you flush.
void NBDE_FlushCampaignDatabase(string sCampaignName)
{
// get database vault, it holds all database items
object oVault = GetObjectByTag(NBDE_VAULT_TAG);
if(GetIsObjectValid(oVault))
{
// get database item
object oDatabase = GetLocalObject(oVault, NBDE_INDEX_PREFIX + sCampaignName);
// store the whole database via one single StoreCampaignObject call
// all variables on the item get stored with the item
if(GetIsObjectValid(oDatabase))
{
// delete database on each flush to keep it compact and clean
DestroyCampaignDatabase(sCampaignName);
// store database
StoreCampaignObject(sCampaignName, NBDE_DATABASE_ITEM_VARNAME , oDatabase);
}
// database not loaded, no need to flush...
}
else // vault container missing
WriteTimestampedLogEntry("NBDE> Error: unable to locate '"+NBDE_VAULT_TAG+"' vault container object");
}





Retour en haut






