private void InitRollback()
{
byte[] btWork = new byte[8];
_fsRollbackHelper.Position = 0;
_fsRollbackHelper.Read(btWork, 0, 8);
eofRollback = btWork.To_Int64_BigEndian();
if (eofRollback == 0)
{
if (this._fsRollback.Length >= MaxRollbackFileSize)
{
this._fsRollback.Dispose();
this._configuration.FSFactory.Delete(this._fileName + ".rol");
//this._fsRollback = new FileStream(this._fileName + ".rol", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, _fileStreamBufferSize, FileOptions.WriteThrough);
this._fsRollback = this._configuration.FSFactory.CreateType1(this._fileName + ".rol", _fileStreamBufferSize);
//no sense to do anything with backup
}
return;
}
//!!!Check if data file is empty write first root 64 bytes, ??? Where it must stay after rollback restoration???
//Restoring rollback
RestoreInitRollback();
//Checking if we can recreate rollback file
if (this._fsRollback.Length >= MaxRollbackFileSize)
{
this._fsRollback.Dispose();
this._configuration.FSFactory.Delete(this._fileName + ".rol");
this._fsRollback = this._configuration.FSFactory.CreateType1(this._fileName + ".rol", _fileStreamBufferSize);
//File.Delete(this._fileName + ".rol");
//this._fsRollback = new FileStream(this._fileName + ".rol", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None, _fileStreamBufferSize, FileOptions.WriteThrough);
//no sense to do anything with backup
}
eofRollback = 0;
_fsRollbackHelper.Position = 0;
_fsRollbackHelper.Write(eofRollback.To_8_bytes_array_BigEndian(), 0, 8);
NET_Flush(_fsRollbackHelper);
//try
//{
//}
//catch (Exception ex)
//{
// IsOperable = false;
// throw DBreezeException.Throw(DBreezeException.eDBreezeExceptions.RESTORE_ROLLBACK_DATA_FAILED, this._fileName, ex);
//}
}