Esempio n. 1
0
 public Engine(Shard shard, string path, string walPath)
 {
     this.shard              = shard;
     this.path               = path;
     wal                     = new Wal(walPath);
     fileStore               = new FileStore(path);
     cache                   = new Cache(Constants.DefaultCacheMaxMemorySize);
     compactor               = new Compactor(fileStore, path);
     compactionPlan          = new DefaultPlanner(fileStore, Constants.DefaultCompactFullWriteColdDuration);
     enableCompactionsOnOpen = true;
     stats                   = new EngineStatistics();
 }
Esempio n. 2
0
        // reloadCache reads the WAL segment files and loads them into the cache.
        private void reloadCache()
        {
            DateTime      now   = DateTime.Now;
            List <string> files = Wal.SegmentFileNames(wal.Path);

            if (files != null && files.Count > 0)
            {
                long maxsize = cache.MaxSize;
                cache.MaxSize = 0;//Disable the max size during loading
                cache.Load(files);
                cache.MaxSize = maxsize;
                Logger.Write(string.Format("Reloaded WAL cache {0} in {1} ms", wal.Path, (DateTime.Now - now).TotalMilliseconds));
            }
        }