public async Task MergeFiles() { var merger = new TableFileMerger(_tableFiles.Select(f => f.GetAsyncEnumerator()).ToArray()); var mWriter = new TableFileMergeWriter(_storageLayer, _cache, loadNewFiles: false); await mWriter.WriteFromMerger(merger); }
static async Task Main(string[] args) { //var merge = new MergeBenchmark(); //merge.GlobalSetup(); //await merge.MergeFiles(); //return; var summary = BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args); return; var dbFolder = "D:\\stress"; var outputFolder = "D:\\stressoutput"; Directory.Delete(outputFolder, true); Directory.CreateDirectory(outputFolder); var dbOptions = new TrimDatabaseOptions(); using var blockstore = dbOptions.BlockCache(); var filenames = Directory.GetFiles(dbFolder); var files = new TableFile[filenames.Length]; for (var i = 0; i < files.Length; i++) { var tf = new TableFile(filenames[i], blockstore); await tf.LoadAsync(); files[i] = tf; } var merger = new TableFileMerger(files.Select(f => f.GetAsyncEnumerator()).ToArray()); var storageLayer = new SortedStorageLayer(5, dbFolder, blockstore, 10 * 1024 * 1024, 100); var mWriter = new TableFileMergeWriter(storageLayer, blockstore); await mWriter.WriteFromMerger(merger); }