CSharpTest.Net
TransactionLogLimit Property
See Also  Example Send Feedback Download Help File
CSharpTest.Net.BPlusTree Assembly > CSharpTest.Net.Collections Namespace > BPlusTree.OptionsV2<TKey,TValue> Class : TransactionLogLimit Property

Glossary Item Box

Defines the number of bytes in the transaction log file before the BPlusTree will auto-commit and truncate the log. Values equal to or less than zero will not auto-commit (default).

Syntax

Visual Basic (Declaration) 
Public Shadows Property TransactionLogLimit As Long
C# 
public new long TransactionLogLimit {get; set;}

Example

BPlusTree/BPlusTree.Test/BasicTestsVersion2.cs

C#Copy Code
var options = (BPlusTree<int, string>.OptionsV2)Options;
options.TransactionLogLimit = 30;

using (BPlusTree<int, string> tree = Create(options))
{
    tree.EnableCount();
    Assert.AreEqual(0, tree.Count);

    tree.Add(1, "A");
    tree.Rollback();
    Assert.AreEqual(0, tree.Count);

    tree.Add(1, "A");
    tree.Add(2, "B"); //The second write exceeds 30 bytes and auto-commits
    tree.Rollback();
    Assert.AreEqual(2, tree.Count);
    tree.Add(3, "C");
    tree.Add(4, "D"); //The second write will commit, but not the last
    tree.Add(5, "E");
    tree.Rollback();
    Assert.AreEqual(4, tree.Count);
    Assert.IsFalse(tree.ContainsKey(5));
}
VB.NETCopy Code
Dim options As var = DirectCast(Options, BPlusTree(Of Integer, String).OptionsV2)
options.TransactionLogLimit = 30

Using tree As BPlusTree(Of Integer, String) = Create(options)
    tree.EnableCount()
    Assert.AreEqual(0, tree.Count)

    tree.Add(1, "A")
    tree.Rollback()
    Assert.AreEqual(0, tree.Count)

    tree.Add(1, "A")
    tree.Add(2, "B")
    'The second write exceeds 30 bytes and auto-commits
    tree.Rollback()
    Assert.AreEqual(2, tree.Count)
    tree.Add(3, "C")
    tree.Add(4, "D")
    'The second write will commit, but not the last
    tree.Add(5, "E")
    tree.Rollback()
    Assert.AreEqual(4, tree.Count)
    Assert.IsFalse(tree.ContainsKey(5))
End Using

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys