CSharpTest.Net.Collections
CSharpTest.Net.Collections copied to clipboard
Race condition in TransactionLog() c'tor
Issue:
Race condition in TransactionLog.cs, TransactionLog's c'tor, between the File.Exists(...)
call and the new FileInfo(_options.FileName).Length
statement. A file can be deleted in between leading to an exception later.
What steps will reproduce the problem?
- Set V2 options with "CreateFile = CreatePolicy.Always"
- Add via something like (note the
using
usage)
public void Add(MyEntity newItem)
{
// Open the BPlusTree using these options
using (var bpt = new BPlusTree<string, KeyEntity>(_options))
{
bpt.Add(newItem.key, newItem.Value);
}
}
- Add about 100K entities in rapid fire via the Add(MyEntity newItem) call.
There is a 1% error chance (on a high performance SSD) so by the 100th of so addition, you'll hit the race condition.
What is the expected output? What do you see instead?
- See above
What version of the product are you using? On what operating system?
- Tip of HG repo
Please provide any additional information below.
- Not specific to this issue but at a project level, it would be nice if you had a forum or something where user's of this library could talk about uses/features/bugs. For example: A cool idea would be extending the storage to use Azure Blob Storage (in Page mode). Likely extending/replicating off the
BTreeFileStoreV2
class. A forum could facilitate this sort of a discussion. Or perhaps having a multi master write model (extending on that azure thought).
Fixed on /dev