6 1#2470
Conversation
Fixed writing pages in the same thread that does EnqueuePage
…context Don't capture synchronization context in DiskWriterQueue
…ion-in-ensure 2451 lazy string interpolation in ensure
# Conflicts: # LiteDB/Engine/Disk/DiskWriterQueue.cs
2451 fix disk writer queue
| { | ||
| public static class Logging | ||
| { | ||
| public static event Action<LogEventArgs> LogCallback; |
There was a problem hiding this comment.
Have at least some simple mechanism to hook to logs and log them - to reveal what is wrong if it fails in production
| public bool IsDisposed => _state.Disposed; | ||
|
|
||
| private readonly TaskCompletionSource<bool> _closedTask = new TaskCompletionSource<bool>(); | ||
| public Task<bool> Closed => _closedTask.Task; |
There was a problem hiding this comment.
give a chance to outside observer to check
if (db.IsDisposed)
{
await db.Closed;
}
recreate db
| _state.Handle(ex); | ||
| _state.Handle(LiteException.InvalidDatafileState(ex, "DiskWriterQueue failed")); |
There was a problem hiding this comment.
make DiskWriterQueue exceptions "fatal" - these can't be survived and it is best to tear down the entire engine and let the outside observer to restart the engine (possibly with a rebuild)
| ExhaustQueue(); | ||
| } | ||
| } | ||
|
|
||
| private void ExhaustQueue() | ||
| { | ||
| while (_queue.TryDequeue(out var page)) | ||
| { | ||
| page.Release(); | ||
| } | ||
| } |
There was a problem hiding this comment.
If anything fails here we need to drop this object - this means all pages must be released (including the one that caused the failure - see the finally case below)
|
@ltetak were you planning on publishing this PR? I would love to have a way to hook into the logs from LiteDB to help diagnose issues we are getting in Production. |
|
@Blue101black here it is #2576 |
Hello the LiteDB community. I would like to open a discussion about the stability of this tool. I have some thoughts first and then there is a draft here about some recent changes + some quick wins.