mirror of
https://github.com/ZoneTree/ZoneTree.git
synced 2026-10-27 20:20:22 +08:00
Adds logs for silent exceptions thrown in tasks.
This commit is contained in:
@@ -166,14 +166,21 @@ public class MutableSegment<TKey, TValue> : IMutableSegment<TKey, TValue>
|
||||
Task.Factory.StartNew(FreezeWriteAheadLog);
|
||||
}
|
||||
|
||||
private void FreezeWriteAheadLog()
|
||||
void FreezeWriteAheadLog()
|
||||
{
|
||||
while (WritesInProgress > 0)
|
||||
try
|
||||
{
|
||||
Thread.Yield();
|
||||
while (WritesInProgress > 0)
|
||||
{
|
||||
Thread.Yield();
|
||||
}
|
||||
WriteAheadLog.MarkFrozen();
|
||||
BTree.SetTreeReadOnlyAndLockFree();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Options.Logger.LogError(e);
|
||||
}
|
||||
WriteAheadLog.MarkFrozen();
|
||||
BTree.SetTreeReadOnlyAndLockFree();
|
||||
}
|
||||
|
||||
public void Drop()
|
||||
|
||||
@@ -254,7 +254,14 @@ public sealed class CompressedFileSystemWriteAheadLog<TKey, TValue> : IWriteAhea
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
FileStream.Dispose();
|
||||
try
|
||||
{
|
||||
FileStream.Dispose();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Logger.LogError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -268,7 +268,14 @@ public sealed class FileSystemWriteAheadLog<TKey, TValue> : IWriteAheadLog<TKey,
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
Dispose();
|
||||
try
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -310,9 +310,15 @@ public sealed class LazyFileSystemWriteAheadLog<TKey, TValue> : IWriteAheadLog<T
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
StopWriter(true);
|
||||
FileStream.WriteTail();
|
||||
FileStream.Dispose();
|
||||
try
|
||||
{
|
||||
StopWriter(true);
|
||||
FileStream.Dispose();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.LogError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user