public void Setup() { for (int i = 0; i < 4; i++) { _files.Add(Path.GetRandomFileName()); var table = new HashListMemTable(maxSize: 2000); for (int j = 0; j < 10; j++) { table.Add((UInt32)j + 1, i + 1, i * j); } _tables.Add(PTable.FromMemtable(table, _files[i])); } _files.Add(Path.GetRandomFileName()); _newtable = PTable.MergeTo(_tables, _files[4], x => false); }
public void only_entry_with_smallest_position_is_returned_when_triduplicated() { var memTable = new HashListMemTable(_ptableVersion, maxSize: 10); memTable.Add(0x010100000000, 0x01, 0xfff1); memTable.Add(0x010100000000, 0x01, 0xfff3); memTable.Add(0x010100000000, 0x01, 0xfff5); using (var ptable = PTable.FromMemtable(memTable, Filename)) { IndexEntry entry; Assert.IsTrue(ptable.TryGetOldestEntry(0x010100000000, out entry)); Assert.AreEqual(GetHash(0x010100000000), entry.Stream); Assert.AreEqual(0x01, entry.Version); Assert.AreEqual(0xfff1, entry.Position); } }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); _filename = GetTempFilePath(); _finalmergefile = GetTempFilePath(); _finalmergefile2 = GetTempFilePath(); _map = IndexMap.FromFile(_filename); var memtable = new HashListMemTable(_ptableVersion, maxSize: 10); memtable.Add(0, 1, 0); var guidFilename = new GuidFilenameProvider(PathName); _result = _map.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 0, 0, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), guidFilename, _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 0, 0, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), guidFilename, _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 0, 0, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), guidFilename, _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 0, 0, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), guidFilename, _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 0, 0, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), guidFilename, _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 0, 0, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), guidFilename, _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 0, 0, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), guidFilename, _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 0, 0, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), guidFilename, _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 0, 0, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), guidFilename, _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 0, 0, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), guidFilename, _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 0, 0, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), guidFilename, _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 0, 0, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), guidFilename, _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 0, 0, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), guidFilename, _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 0, 0, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), guidFilename, _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 0, 0, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), guidFilename, _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath(), skipIndexVerify: _skipIndexVerify), 1, 2, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), new FakeFilenameProvider(_finalmergefile, _finalmergefile2), _ptableVersion, 4, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); _filename = GetTempFilePath(); _finalmergefile = GetTempFilePath(); _finalmergefile2 = GetTempFilePath(); _map = IndexMap.FromFile(_filename); var memtable = new HashListMemTable(maxSize: 10); memtable.Add(0, 1, 0); var guidFilename = new GuidFilenameProvider(PathName); _result = _map.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 0, _ => true, guidFilename); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 0, _ => true, guidFilename); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 0, _ => true, guidFilename); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 0, _ => true, guidFilename); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 0, _ => true, guidFilename); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 0, _ => true, guidFilename); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 0, _ => true, guidFilename); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 0, _ => true, guidFilename); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 0, _ => true, guidFilename); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 0, _ => true, guidFilename); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 0, _ => true, guidFilename); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 0, _ => true, guidFilename); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 0, _ => true, guidFilename); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 0, _ => true, guidFilename); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 0, 0, _ => true, guidFilename); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 1, 2, _ => true, new FakeFilenameProvider(_finalmergefile, _finalmergefile2)); _result.ToDelete.ForEach(x => x.MarkForDestruction()); }
public void when_duplicated_entries_exist_the_one_with_oldest_position_is_returned() { var memTable = new HashListMemTable(_ptableVersion, maxSize: 10); memTable.Add(0x010100000000, 0x01, 0xfff1); memTable.Add(0x010100000000, 0x02, 0xfff2); memTable.Add(0x010100000000, 0x01, 0xfff3); memTable.Add(0x010100000000, 0x02, 0xfff4); using (var ptable = PTable.FromMemtable(memTable, Filename, skipIndexVerify: _skipIndexVerify)) { IndexEntry entry; Assert.IsTrue(ptable.TryGetOldestEntry(0x010100000000, out entry)); Assert.AreEqual(GetHash(0x010100000000), entry.Stream); Assert.AreEqual(0x01, entry.Version); Assert.AreEqual(0xfff1, entry.Position); } }
public void Setup() { for (int i = 0; i < 2; i++) { _files.Add(Path.GetRandomFileName()); var table = new HashListMemTable(); for (int j = 0; j < 10; j++) { table.Add(0, 0, 1000000 - i * 1000 - j); table.Add(0, 0, i * 1000 + j); } _tables.Add(PTable.FromMemtable(table, _files[i])); } _files.Add(Path.GetRandomFileName()); _newtable = PTable.MergeTo(_tables, _files[2], x => false); }
public override void SetUp() { base.SetUp(); _indexMapFileName = Path.Combine(PathName, "index.map"); _ptableFileName = Path.Combine(PathName, "ptable"); var indexMap = IndexMap.FromFile(_indexMapFileName, x => false, maxTablesPerLevel: 2); var memtable = new HashListMemTable(); memtable.Add(0, 0, 0); memtable.Add(1, 1, 100); _ptable = PTable.FromMemtable(memtable, _ptableFileName); indexMap = indexMap.AddFile(_ptable, 0, 0, new GuidFilenameProvider(PathName)).MergedMap; indexMap.SaveToFile(_indexMapFileName); }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); for (int i = 0; i < 2; i++) { _files.Add(GetTempFilePath()); var table = new HashListMemTable(maxSize: 20); for (int j = 0; j < 10; j++) { table.Add((UInt32)j + 1, i + 1, i * j); } _tables.Add(PTable.FromMemtable(table, _files[i])); } _files.Add(GetTempFilePath()); _newtable = PTable.MergeTo(_tables, _files[2], x => false); }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); _filename = GetTempFilePath(); _tablename = GetTempFilePath(); _mergeFile = GetFilePathFor("mergefile"); _map = IndexMap.FromFile(_filename); var memtable = new HashListMemTable(_ptableVersion, maxSize: 10); memtable.Add(0, 1, 0); var table = PTable.FromMemtable(memtable, _tablename); _result = _map.AddPTable(table, 7, 11, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), new FakeFilenameProvider(_mergeFile), _ptableVersion); table.MarkForDestruction(); }
public void Setup() { _filename = GetTempFilePath(); _copiedfilename = GetTempFilePath(); var mtable = new HashListMemTable(_ptableVersion, maxSize: 10); mtable.Add(0x010100000000, 0x0001, 0x0001); mtable.Add(0x010500000000, 0x0001, 0x0002); _table = PTable.FromMemtable(mtable, _filename); _table.Dispose(); File.Copy(_filename, _copiedfilename); using (var f = new FileStream(_copiedfilename, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)) { f.Seek(22, SeekOrigin.Begin); f.WriteByte(0x22); } }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); for (int i = 0; i < 4; i++) { _files.Add(GetTempFilePath()); var table = new HashListMemTable(_ptableVersion, maxSize: 30); for (int j = 0; j < 10; j++) { table.Add((ulong)(0x010100000000 << i), j, i * 10 + j); } _tables.Add(PTable.FromMemtable(table, _files[i])); } _files.Add(GetTempFilePath()); _newtable = PTable.MergeTo(_tables, _files[4], (streamId, hash) => hash, x => x.Position % 2 == 0, x => new Tuple <string, bool>("", x.Position % 2 == 0), _ptableVersion); }
public override async Task TestFixtureSetUp() { await base.TestFixtureSetUp(); _files.Add(GetTempFilePath()); var table = new HashListMemTable(_fromVersion, maxSize: 20); if (_fromVersion == PTableVersions.IndexV1) { table.Add(0x010100000000, 0, 0x0101); table.Add(0x010200000000, 0, 0x0102); table.Add(0x010300000000, 0, 0x0103); table.Add(0x010400000000, 0, 0x0104); } else { table.Add(0x0101, 0, 0x0101); table.Add(0x0102, 0, 0x0102); table.Add(0x0103, 0, 0x0103); table.Add(0x0104, 0, 0x0104); } _tables.Add(PTable.FromMemtable(table, GetTempFilePath(), Constants.PTableInitialReaderCount, Constants.PTableMaxReaderCountDefault, skipIndexVerify: _skipIndexVerify)); table = new HashListMemTable(_fromVersion, maxSize: 20); if (_fromVersion == PTableVersions.IndexV1) { table.Add(0x010500000000, 0, 0x0105); table.Add(0x010600000000, 0, 0x0106); table.Add(0x010700000000, 0, 0x0107); table.Add(0x010800000000, 0, 0x0108); } else { table.Add(0x0105, 0, 0x0105); table.Add(0x0106, 0, 0x0106); table.Add(0x0107, 0, 0x0107); table.Add(0x0108, 0, 0x0108); } _tables.Add(PTable.FromMemtable(table, GetTempFilePath(), Constants.PTableInitialReaderCount, Constants.PTableMaxReaderCountDefault, skipIndexVerify: _skipIndexVerify)); _newtableFile = GetTempFilePath(); _newtable = PTable.MergeTo(_tables, _newtableFile, (streamId, hash) => hash + 1, x => true, x => new Tuple <string, bool>(x.Stream.ToString(), true), PTableVersions.IndexV4, Constants.PTableInitialReaderCount, Constants.PTableMaxReaderCountDefault, skipIndexVerify: _skipIndexVerify); }
public override void SetUp() { base.SetUp(); _indexMapFileName = GetFilePathFor("index.map"); _ptableFileName = GetFilePathFor("ptable"); var indexMap = IndexMap.FromFile(_indexMapFileName, maxTablesPerLevel: 2); var memtable = new HashListMemTable(maxSize: 10); memtable.Add(0, 0, 0); memtable.Add(1, 1, 100); _ptable = PTable.FromMemtable(memtable, _ptableFileName); indexMap = indexMap.AddPTable(_ptable, 0, 0, _ => true, new GuidFilenameProvider(PathName)).MergedMap; indexMap.SaveToFile(_indexMapFileName); }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); for (int i = 0; i < 2; i++) { _files.Add(GetTempFilePath()); var table = new HashListMemTable(_ptableVersion, maxSize: 20); for (int j = 0; j < 10; j++) { table.Add((ulong)(0x010100000000 << (j + 1)), i + 1, i * j); } _tables.Add(PTable.FromMemtable(table, _files[i], skipIndexVerify: _skipIndexVerify)); } _files.Add(GetTempFilePath()); _newtable = PTable.MergeTo(_tables, _files[2], (streamId, hash) => hash, x => true, x => new System.Tuple <string, bool>("", true), _ptableVersion, skipIndexVerify: _skipIndexVerify); }
public override void SetUp() { base.SetUp(); _indexMapFileName = GetFilePathFor("index.map"); _ptableFileName = GetFilePathFor("ptable"); var indexMap = IndexMap.FromFile(_indexMapFileName, maxTablesPerLevel: 2); var memtable = new HashListMemTable(_ptableVersion, maxSize: 10); memtable.Add(0, 0, 0); memtable.Add(1, 1, 100); _ptable = PTable.FromMemtable(memtable, _ptableFileName); indexMap = indexMap.AddPTable(_ptable, 0, 0, (streamId, hash) => hash, _ => true, _ => new Tuple <string, bool>("", true), new GuidFilenameProvider(PathName), _ptableVersion).MergedMap; indexMap.SaveToFile(_indexMapFileName); }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); for (int i = 0; i < 4; i++) { _files.Add(GetTempFilePath()); var table = new HashListMemTable(maxSize: 30); for (int j = 0; j < 10; j++) { table.Add((uint)i, j, i*10 + j); } _tables.Add(PTable.FromMemtable(table, _files[i])); } _files.Add(GetTempFilePath()); _newtable = PTable.MergeTo(_tables, _files[4], x => x.Position % 2 == 0); }
public void when_duplicated_entries_exist_the_one_with_latest_position_is_returned() { var memTable = new HashListMemTable(maxSize: 2000); memTable.Add(0x11, 0x01, 0xfff1); memTable.Add(0x11, 0x02, 0xfff2); memTable.Add(0x11, 0x01, 0xfff3); memTable.Add(0x11, 0x02, 0xfff4); using (var ptable = PTable.FromMemtable(memTable, Filename)) { IndexEntry entry; Assert.IsTrue(ptable.TryGetLatestEntry(0x11, out entry)); Assert.AreEqual(0x11, entry.Stream); Assert.AreEqual(0x02, entry.Version); Assert.AreEqual(0xfff4, entry.Position); } }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); _filename = GetTempFilePath(); _tablename = GetTempFilePath(); _mergeFile = GetFilePathFor("mergefile"); _map = IndexMap.FromFile(_filename, x => false); var memtable = new HashListMemTable(maxSize: 10); memtable.Add(0, 1, 0); var table = PTable.FromMemtable(memtable, _tablename); _result = _map.AddFile(table, 7, 11, new FakeFilenameProvider(_mergeFile)); table.MarkForDestruction(); }
public override async Task TestFixtureSetUp() { await base.TestFixtureSetUp(); _mergeFile = GetTempFilePath(); _filename = GetTempFilePath(); _map = IndexMapTestFactory.FromFile(_filename, maxTablesPerLevel: 4); var memtable = new HashListMemTable(_ptableVersion, maxSize: 10); memtable.Add(0, 1, 0); _result = _map.AddPTable( PTable.FromMemtable(memtable, GetTempFilePath(), Constants.PTableInitialReaderCount, Constants.PTableMaxReaderCountDefault, skipIndexVerify: _skipIndexVerify), 1, 2, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), new GuidFilenameProvider(PathName), _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable( PTable.FromMemtable(memtable, GetTempFilePath(), Constants.PTableInitialReaderCount, Constants.PTableMaxReaderCountDefault, skipIndexVerify: _skipIndexVerify), 3, 4, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), new GuidFilenameProvider(PathName), _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable( PTable.FromMemtable(memtable, GetTempFilePath(), Constants.PTableInitialReaderCount, Constants.PTableMaxReaderCountDefault, skipIndexVerify: _skipIndexVerify), 4, 5, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), new GuidFilenameProvider(PathName), _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable( PTable.FromMemtable(memtable, GetTempFilePath(), Constants.PTableInitialReaderCount, Constants.PTableMaxReaderCountDefault, skipIndexVerify: _skipIndexVerify), 0, 1, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), new FakeFilenameProvider(_mergeFile), _ptableVersion, _maxAutoMergeIndexLevel, 0, skipIndexVerify: _skipIndexVerify); _result.ToDelete.ForEach(x => x.MarkForDestruction()); }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); for (int i = 0; i < 4; i++) { _files.Add(GetTempFilePath()); var table = new HashListMemTable(maxSize: 50); for (int j = 0; j < 10; j++) { table.Add(0, 0, 1000000 - i * 1000 - j); table.Add(0, 0, i * 1000 + j); } _tables.Add(PTable.FromMemtable(table, _files[i])); } _files.Add(GetTempFilePath()); _newtable = PTable.MergeTo(_tables, _files[4], x => false); }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); var table = new HashListMemTable(_ptableVersion, maxSize: 50); table.Add(0x010100000000, 0x0001, 0x0001); table.Add(0x010500000000, 0x0001, 0x0002); table.Add(0x010200000000, 0x0001, 0x0003); table.Add(0x010200000000, 0x0002, 0x0004); table.Add(0x010300000000, 0x0001, 0xFFF1); table.Add(0x010300000000, 0x0003, 0xFFF3); table.Add(0x010300000000, 0x0005, 0xFFF5); _ptable = PTable.FromMemtable(table, Filename, Constants.PTableInitialReaderCount, Constants.PTableMaxReaderCountDefault, cacheDepth: 0, skipIndexVerify: _skipIndexVerify, useBloomFilter: _useBloomFilter, lruCacheSize: _lruCacheSize); }
public override async Task TestFixtureSetUp() { await base.TestFixtureSetUp(); _filename = GetTempFilePath(); _tablename = GetTempFilePath(); _mergeFile = GetFilePathFor("mergefile"); _map = IndexMapTestFactory.FromFile(_filename, maxAutoMergeLevel: _maxAutoMergeIndexLevel); var memtable = new HashListMemTable(_ptableVersion, maxSize: 10); memtable.Add(0, 1, 0); var table = PTable.FromMemtable(memtable, _tablename, Constants.PTableInitialReaderCount, Constants.PTableMaxReaderCountDefault, skipIndexVerify: _skipIndexVerify); _result = _map.AddAndMergePTable(table, 7, 11, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), new FakeFilenameProvider(_mergeFile), _ptableVersion, 0, skipIndexVerify: _skipIndexVerify); table.MarkForDestruction(); }
public override async Task SetUp() { await base.SetUp(); _filename = GetTempFilePath(); _copiedfilename = GetTempFilePath(); var mtable = new HashListMemTable(_ptableVersion, maxSize: 10); mtable.Add(0x010100000000, 0x0001, 0x0001); mtable.Add(0x010500000000, 0x0001, 0x0002); _table = PTable.FromMemtable(mtable, _filename, Constants.PTableInitialReaderCount, Constants.PTableMaxReaderCountDefault); _table.Dispose(); File.Copy(_filename, _copiedfilename); using (var f = new FileStream(_copiedfilename, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)) { f.Seek(130, SeekOrigin.Begin); f.WriteByte(0x22); } }
public void setup() { _filename = Path.GetRandomFileName(); _copiedfilename = Path.GetRandomFileName(); var mtable = new HashListMemTable(maxSize: 2000); mtable.Add(0x0101, 0x0001, 0x0001); mtable.Add(0x0105, 0x0001, 0x0002); _table = PTable.FromMemtable(mtable, _filename); File.Copy(_filename, _copiedfilename); _table.MarkForDestruction(); using (var f = new FileStream(_copiedfilename, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)) { f.Seek(130, SeekOrigin.Begin); f.WriteByte(0x22); } _table = PTable.FromFile(_copiedfilename); }
public override async Task SetUp() { await base.SetUp(); _indexMapFileName = GetFilePathFor("index.map"); _ptableFileName = GetFilePathFor("ptable"); var indexMap = IndexMapTestFactory.FromFile(_indexMapFileName, maxTablesPerLevel: 2, maxAutoMergeLevel: _maxAutoMergeIndexLevel); var memtable = new HashListMemTable(_ptableVersion, maxSize: 10); memtable.Add(0, 0, 0); memtable.Add(1, 1, 100); _ptable = PTable.FromMemtable(memtable, _ptableFileName, Constants.PTableInitialReaderCount, Constants.PTableMaxReaderCountDefault, skipIndexVerify: _skipIndexVerify); indexMap = indexMap.AddAndMergePTable(_ptable, 0, 0, (streamId, hash) => hash, _ => true, _ => new Tuple <string, bool>("", true), new GuidFilenameProvider(PathName), _ptableVersion, 0, skipIndexVerify: _skipIndexVerify).MergedMap; indexMap.SaveToFile(_indexMapFileName); }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); _files.Add(GetTempFilePath()); var table = new HashListMemTable(PTableVersions.Index32Bit, maxSize: 20); table.Add(0x010100000000, 0, 0x0101); table.Add(0x010200000000, 0, 0x0102); table.Add(0x010300000000, 0, 0x0103); table.Add(0x010400000000, 0, 0x0104); _tables.Add(PTable.FromMemtable(table, GetTempFilePath())); table = new HashListMemTable(PTableVersions.Index32Bit, maxSize: 20); table.Add(0x010500000000, 0, 0x0105); table.Add(0x010600000000, 0, 0x0106); table.Add(0x010700000000, 0, 0x0107); table.Add(0x010800000000, 0, 0x0108); _tables.Add(PTable.FromMemtable(table, GetTempFilePath())); _newtable = PTable.MergeTo(_tables, GetTempFilePath(), (streamId, hash) => hash + 1, x => true, x => new Tuple <string, bool>(x.Stream.ToString(), true), PTableVersions.Index64Bit); }
public override void SetUp() { base.SetUp(); _filename = GetFilePathFor("indexfile"); _tablename = GetTempFilePath(); _mergeFile = GetFilePathFor("outfile"); _map = IndexMapTestFactory.FromFile(_filename, maxTablesPerLevel: 4); var memtable = new HashListMemTable(_ptableVersion, maxSize: 10); memtable.Add(0, 2, 123); var table = PTable.FromMemtable(memtable, _tablename); _result = _map.AddPTable(table, 0, 0, (streamId, hash) => hash, _ => true, _ => new Tuple <string, bool>("", true), new FakeFilenameProvider(_mergeFile), _ptableVersion, _maxAutoMergeIndexLevel, 0); _result = _result.MergedMap.AddPTable(table, 0, 0, (streamId, hash) => hash, _ => true, _ => new Tuple <string, bool>("", true), new FakeFilenameProvider(_mergeFile), _ptableVersion, _maxAutoMergeIndexLevel, 0); _result = _result.MergedMap.AddPTable(table, 0, 0, (streamId, hash) => hash, _ => true, _ => new Tuple <string, bool>("", true), new FakeFilenameProvider(_mergeFile), _ptableVersion, _maxAutoMergeIndexLevel, 0); var merged = _result.MergedMap.AddPTable(table, 0, 0, (streamId, hash) => hash, _ => true, _ => new Tuple <string, bool>("", true), new FakeFilenameProvider(_mergeFile), _ptableVersion, _maxAutoMergeIndexLevel, 0); _result = merged.MergedMap.AddPTable(table, 0, 0, (streamId, hash) => hash, _ => true, _ => new Tuple <string, bool>("", true), new FakeFilenameProvider(_mergeFile), _ptableVersion, _maxAutoMergeIndexLevel, 0); _result = _result.MergedMap.AddPTable(table, 7, 11, (streamId, hash) => hash, _ => true, _ => new Tuple <string, bool>("", true), new FakeFilenameProvider(_mergeFile), _ptableVersion, _maxAutoMergeIndexLevel, 0); _result.MergedMap.SaveToFile(_filename); table.Dispose(); merged.MergedMap.InOrder().ToList().ForEach(x => x.Dispose()); merged.ToDelete.ForEach(x => x.Dispose()); _result.MergedMap.InOrder().ToList().ForEach(x => x.Dispose()); _result.ToDelete.ForEach(x => x.Dispose()); }
public override void TestFixtureSetUp() { hasher = new Murmur3AUnsafe(); base.TestFixtureSetUp(); for (int i = 0; i < 4; i++) { _files.Add(GetTempFilePath()); var table = new HashListMemTable(_ptableVersion, maxSize: 20); for (int j = 0; j < 10; j++) { table.Add((ulong)(0x010100000000 << (j + 1)), i + 1, i * j); } _tables.Add(PTable.FromMemtable(table, _files[i])); } _files.Add(GetTempFilePath()); _newtable = PTable.MergeTo(_tables, _files[4], (streamId, hash) => hash << 32 | hasher.Hash(streamId), _ => true, _ => new System.Tuple <string, bool>("", true), _ptableVersion); }
public override void TestFixtureSetUp() { base.TestFixtureSetUp(); _filename = GetTempFilePath(); _mergeFile = GetTempFilePath(); _map = IndexMap.FromFile(_filename, maxTablesPerLevel: 2); var memtable = new HashListMemTable(_ptableVersion, maxSize: 10); memtable.Add(0, 1, 0); _result = _map.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 123, 321, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), new GuidFilenameProvider(PathName), _ptableVersion); _result.ToDelete.ForEach(x => x.MarkForDestruction()); _result = _result.MergedMap.AddPTable(PTable.FromMemtable(memtable, GetTempFilePath()), 100, 400, (streamId, hash) => hash, _ => true, _ => new System.Tuple <string, bool>("", true), new FakeFilenameProvider(_mergeFile), _ptableVersion); _result.ToDelete.ForEach(x => x.MarkForDestruction()); }
public override void SetUp() { base.SetUp(); _filename = GetFilePathFor("indexfile"); _tablename = GetTempFilePath(); _mergeFile = GetFilePathFor("outputfile"); _map = IndexMap.FromFile(_filename, x => false); var memtable = new HashListMemTable(); memtable.Add(0, 2, 7); var table = PTable.FromMemtable(memtable, _tablename); _result = _map.AddFile(table, 7, 11, new FakeFilenameProvider(_mergeFile)); _result.MergedMap.SaveToFile(_filename); _result.ToDelete.ForEach(x => x.Dispose()); _result.MergedMap.InOrder().ToList().ForEach(x => x.Dispose()); table.Dispose(); }