Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] #1893 #2096

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions LiteDB/Engine/Disk/DiskService.cs
Expand Up @@ -111,7 +111,7 @@ private void Initialize(Stream stream, Collation collation, long initialSize)
stream.SetLength(initialSize);
}

stream.FlushToDisk();
stream.Flush();
}

/// <summary>
Expand Down Expand Up @@ -297,7 +297,7 @@ public void Write(IEnumerable<PageBuffer> pages, FileOrigin origin)
stream.Write(page.Array, page.Offset, PAGE_SIZE);
}

stream.FlushToDisk();
stream.Flush();
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion LiteDB/Engine/Disk/DiskWriterQueue.cs
Expand Up @@ -110,7 +110,7 @@ private void ExecuteQueue()
}

// after this I will have 100% sure data are safe on log file
_stream.FlushToDisk();
_stream.Flush();
}
catch (IOException)
{
Expand Down
11 changes: 4 additions & 7 deletions LiteDB/Engine/Disk/StreamFactory/FileStreamFactory.cs
@@ -1,8 +1,4 @@
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.IO;
using static LiteDB.Constants;

namespace LiteDB.Engine
Expand Down Expand Up @@ -41,11 +37,12 @@ public Stream GetStream(bool canWrite, bool sequencial)
var isNewFile = write && this.Exists() == false;

var stream = new FileStream(_filename,
_readonly ? System.IO.FileMode.Open : System.IO.FileMode.OpenOrCreate,
_readonly ? FileMode.Open : FileMode.OpenOrCreate,
write ? FileAccess.ReadWrite : FileAccess.Read,
write ? FileShare.Read : FileShare.ReadWrite,
PAGE_SIZE,
sequencial ? FileOptions.SequentialScan : FileOptions.RandomAccess);
// FILE_FLAG_NO_BUFFERING = 0x20000000
(sequencial ? FileOptions.SequentialScan : FileOptions.RandomAccess) | FileOptions.WriteThrough | (FileOptions)0x20000000);

if (isNewFile && _hidden)
{
Expand Down
2 changes: 1 addition & 1 deletion LiteDB/Engine/Disk/Streams/AesStream.cs
Expand Up @@ -121,7 +121,7 @@ public AesStream(string password, Stream stream)
}

_stream.Position = PAGE_SIZE;
_stream.FlushToDisk();
_stream.Flush();

using (var ms = new MemoryStream(new byte[16]))
using (var tempStream = new CryptoStream(ms, _decryptor, CryptoStreamMode.Read))
Expand Down
24 changes: 0 additions & 24 deletions LiteDB/Utils/Extensions/StreamExtensions.cs

This file was deleted.