public override async Task TestFixtureSetUp() { await base.TestFixtureSetUp(); var table = new HashListMemTable(PTableVersions.IndexV4, maxSize: 20); table.Add(0x010100000000, 0, 1); table.Add(0x010200000000, 0, 2); table.Add(0x010300000000, 0, 3); table.Add(0x010300000000, 1, 4); _oldTable = PTable.FromMemtable(table, GetTempFilePath(), Constants.PTableInitialReaderCount, Constants.PTableMaxReaderCountDefault); var cancellationTokenSource = new CancellationTokenSource(); long spaceSaved; Func <IndexEntry, bool> existsAt = x => { cancellationTokenSource.Cancel(); return(true); }; Func <IndexEntry, Tuple <string, bool> > readRecord = x => { throw new Exception("Should not be called"); }; Func <string, ulong, ulong> upgradeHash = (streamId, hash) => { throw new Exception("Should not be called"); }; _expectedOutputFile = GetTempFilePath(); Assert.That( () => PTable.Scavenged(_oldTable, _expectedOutputFile, upgradeHash, existsAt, readRecord, PTableVersions.IndexV4, out spaceSaved, ct: cancellationTokenSource.Token, initialReaders: Constants.PTableInitialReaderCount, maxReaders: Constants.PTableMaxReaderCountDefault), Throws.InstanceOf <OperationCanceledException>()); }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); var table = new HashListMemTable(_oldVersion, maxSize: 20); table.Add(0x010100000000, 0, 1); table.Add(0x010200000000, 0, 2); table.Add(0x010300000000, 0, 3); table.Add(0x010300000000, 1, 4); _oldTable = PTable.FromMemtable(table, GetTempFilePath()); long spaceSaved; Func <IndexEntry, bool> existsAt = x => true; Func <IndexEntry, Tuple <string, bool> > readRecord = x => { throw new Exception("Should not be called"); }; Func <string, ulong, ulong> upgradeHash = (streamId, hash) => { throw new Exception("Should not be called"); }; _expectedOutputFile = GetTempFilePath(); _newtable = PTable.Scavenged(_oldTable, _expectedOutputFile, upgradeHash, existsAt, readRecord, PTableVersions.IndexV4, out spaceSaved, skipIndexVerify: _skipIndexVerify); }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); var table = new HashListMemTable(PTableVersions.IndexV4, maxSize: 20); table.Add(0x010100000000, 0, 1); table.Add(0x010200000000, 0, 2); table.Add(0x010300000000, 0, 3); table.Add(0x010300000000, 1, 4); _oldTable = PTable.FromMemtable(table, GetTempFilePath()); long spaceSaved; Func <IndexEntry, bool> existsAt = x => { throw new Exception("Expected exception"); }; Func <IndexEntry, Tuple <string, bool> > readRecord = x => { throw new Exception("Should not be called"); }; Func <string, ulong, ulong> upgradeHash = (streamId, hash) => { throw new Exception("Should not be called"); }; _expectedOutputFile = GetTempFilePath(); Assert.That(() => PTable.Scavenged(_oldTable, _expectedOutputFile, upgradeHash, existsAt, readRecord, PTableVersions.IndexV4, out spaceSaved), Throws.Exception.With.Message.EqualTo("Expected exception")); }
public override void TestFixtureSetUp() { hasher = new Murmur3AUnsafe(); base.TestFixtureSetUp(); var table = new HashListMemTable(PTableVersions.IndexV1, maxSize: 20); table.Add(0x010100000000, 0, 1); table.Add(0x010200000000, 0, 2); table.Add(0x010300000000, 0, 3); table.Add(0x010300000000, 1, 4); _oldTable = PTable.FromMemtable(table, GetTempFilePath()); long spaceSaved; _upgradeHash = (streamId, hash) => hash << 32 | hasher.Hash(streamId); Func <IndexEntry, bool> existsAt = x => x.Position % 2 == 0; Func <IndexEntry, Tuple <string, bool> > readRecord = x => new Tuple <string, bool>(x.Stream.ToString(), x.Position % 2 == 0); _newtable = PTable.Scavenged(_oldTable, GetTempFilePath(), _upgradeHash, existsAt, readRecord, _newVersion, out spaceSaved, skipIndexVerify: _skipIndexVerify); }
public override async Task TestFixtureSetUp() { await base.TestFixtureSetUp(); var table = new HashListMemTable(_oldVersion, maxSize: 20); table.Add(0x010100000000, 0, 1); table.Add(0x010200000000, 0, 2); table.Add(0x010300000000, 0, 3); table.Add(0x010300000000, 1, 4); _oldTable = PTable.FromMemtable(table, GetTempFilePath(), Constants.PTableInitialReaderCount, Constants.PTableMaxReaderCountDefault); long spaceSaved; Func <IndexEntry, bool> existsAt = x => x.Position % 2 == 0; Func <IndexEntry, Tuple <string, bool> > readRecord = x => { throw new Exception("Should not be called"); }; Func <string, ulong, ulong> upgradeHash = (streamId, hash) => { throw new Exception("Should not be called"); }; _newtable = PTable.Scavenged(_oldTable, GetTempFilePath(), upgradeHash, existsAt, readRecord, PTableVersions.IndexV4, out spaceSaved, skipIndexVerify: _skipIndexVerify, initialReaders: Constants.PTableInitialReaderCount, maxReaders: Constants.PTableMaxReaderCountDefault); }
public override async Task TestFixtureSetUp() { hasher = new Murmur3AUnsafe(); await base.TestFixtureSetUp(); var table = new HashListMemTable(PTableVersions.IndexV1, maxSize: 20); table.Add(0x010100000000, 0, 1); table.Add(0x010200000000, 0, 2); table.Add(0x010300000000, 0, 3); table.Add(0x010300000000, 1, 4); _oldTable = PTable.FromMemtable(table, GetTempFilePath(), Constants.PTableInitialReaderCount, Constants.PTableMaxReaderCountDefault); long spaceSaved; _upgradeHash = (streamId, hash) => hash << 32 | hasher.Hash(streamId); Func <IndexEntry, bool> existsAt = x => x.Position % 2 == 0; Func <IndexEntry, Tuple <string, bool> > readRecord = x => new Tuple <string, bool>(x.Stream.ToString(), x.Position % 2 == 0); _newtable = PTable.Scavenged(_oldTable, GetTempFilePath(), _upgradeHash, existsAt, readRecord, _newVersion, out spaceSaved, skipIndexVerify: _skipIndexVerify, initialReaders: Constants.PTableInitialReaderCount, maxReaders: Constants.PTableMaxReaderCountDefault, useBloomFilter: true); }