public void Commit() { try { while (_dirtyObjSet != null) { var curObjsToStore = _dirtyObjSet; _dirtyObjSet = null; foreach (var o in curObjsToStore) { StoreObject(o.Value); } } _owner.CommitLastDictId((ulong)_lastDictId, _keyValueTr); _keyValueTr.Commit(); if (_updatedTables != null) { foreach (var updatedTable in _updatedTables) { updatedTable.LastPersistedVersion = updatedTable.ClientTypeVersion; updatedTable.ResetNeedStoreSingletonOid(); } } } finally { Dispose(); } }
public void Iterate(IObjectDBTransaction tr) { var iterator = new ODBIterator(tr, new VisitorForFindUnused(this)); using (_kvtr = _keyValueDb.StartWritingTransaction().Result) { iterator.Iterate(); _kvtr.Commit(); } _kvtr = null; }
public void Commit() { try { foreach (var o in _dirtyObjSet) { StoreObject(o.Value); } } finally { _valid = false; } _keyValueTr.Commit(); foreach (var updatedTable in _updatedTables) { updatedTable.Key.LastPersistedVersion = updatedTable.Key.ClientTypeVersion; } }
public void Commit() { LogSimpleOperation(KVReplayOperation.Commit); _tr.Commit(); }
public void Commit() { _keyValueDBTransaction.Commit(); }
void DoRandomWork() { var opCounter = 0; var random = new Random(); using (var stream = CreateTestStream()) //using (IKeyValueDB db = new KeyValueDBReplayProxy(new KeyValueDB(), new PositionLessStreamWriter(new PositionLessStreamProxy("btdb.log")))) using (IKeyValueDB db = new KeyValueDB()) { db.Open(stream, false); IKeyValueDBTransaction tr = db.StartTransaction(); while (opCounter < 100000) { if (opCounter % 1000 == 0) { Console.WriteLine(string.Format("Operation {0}", opCounter)); Console.WriteLine(tr.CalculateStats().ToString()); } opCounter++; var action = random.Next(100); if (action < 10) { if (action > 1) { //Console.WriteLine("Commit"); tr.Commit(); } else { //Console.WriteLine("Rollback"); } tr.Dispose(); tr = db.StartTransaction(); } else if (action < 50 || tr.GetKeyIndex() < 0) { var key = new byte[random.Next(1, 1000)]; random.NextBytes(key); //Console.WriteLine(string.Format("CreateKey {0}", key.Length)); tr.CreateKey(key); } else if (action < 60) { //Console.WriteLine("EraseCurrent"); tr.EraseCurrent(); } else if (action < 65) { //Console.WriteLine("FindNextKey"); tr.FindNextKey(); } else if (action < 70) { //Console.WriteLine("FindPreviousKey"); tr.FindPreviousKey(); } else { var value = new byte[random.Next(1, 100000)]; random.NextBytes(value); //Console.WriteLine(string.Format("SetValue {0}", value.Length)); tr.SetValue(value); } } tr.Dispose(); } }