Ejemplo n.º 1
0
        // Derived class exposed API
        internal void RecoverFuzzyIndex(IndexCheckpointInfo info)
        {
            var token      = info.info.token;
            var ht_version = resizeInfo.version;

            if (state[ht_version].size != info.info.table_size)
            {
                throw new FasterException($"Incompatible hash table size during recovery; allocated {state[ht_version].size} buckets, recovering {info.info.table_size} buckets");
            }

            // Create devices to read from using Async API
            info.main_ht_device = checkpointManager.GetIndexDevice(token);

            BeginMainIndexRecovery(ht_version,
                                   info.main_ht_device,
                                   info.info.num_ht_bytes);

            var sectorSize       = info.main_ht_device.SectorSize;
            var alignedIndexSize = (uint)((info.info.num_ht_bytes + (sectorSize - 1)) & ~(sectorSize - 1));

            overflowBucketsAllocator.Recover(info.main_ht_device, alignedIndexSize, info.info.num_buckets, info.info.num_ofb_bytes);

            // Wait until reading is complete
            IsFuzzyIndexRecoveryComplete(true);

            // close index checkpoint files appropriately
            info.main_ht_device.Dispose();

            // Delete all tentative entries!
            DeleteTentativeEntries();
        }
Ejemplo n.º 2
0
        private uint InitializeMainIndexRecovery(ref IndexCheckpointInfo info, bool isAsync)
        {
            var token      = info.info.token;
            var ht_version = resizeInfo.version;

            if (state[ht_version].size != info.info.table_size)
            {
                throw new FasterException($"Incompatible hash table size during recovery; allocated {state[ht_version].size} buckets, recovering {info.info.table_size} buckets");
            }

            // Create devices to read from using Async API
            info.main_ht_device = checkpointManager.GetIndexDevice(token);

            BeginMainIndexRecovery(ht_version, info.main_ht_device, info.info.num_ht_bytes, isAsync);

            var sectorSize       = info.main_ht_device.SectorSize;
            var alignedIndexSize = (uint)((info.info.num_ht_bytes + (sectorSize - 1)) & ~(sectorSize - 1));

            return(alignedIndexSize);
        }
Ejemplo n.º 3
0
        private ulong InitializeMainIndexRecovery(ref IndexCheckpointInfo info, bool isAsync)
        {
            var token      = info.info.token;
            var ht_version = resizeInfo.version;

            // Create devices to read from using Async API
            info.main_ht_device = checkpointManager.GetIndexDevice(token);
            var sectorSize = info.main_ht_device.SectorSize;

            if (state[ht_version].size != info.info.table_size)
            {
                Free(ht_version);
                Initialize(info.info.table_size, (int)sectorSize);
            }


            BeginMainIndexRecovery(ht_version, info.main_ht_device, info.info.num_ht_bytes, isAsync);


            var alignedIndexSize = (info.info.num_ht_bytes + (sectorSize - 1)) & ~((ulong)sectorSize - 1);

            return(alignedIndexSize);
        }
Ejemplo n.º 4
0
 public void Initialize(Guid token, long _size, ICheckpointManager checkpointManager)
 {
     info.Initialize(token, _size);
     checkpointManager.InitializeIndexCheckpoint(token);
     main_ht_device = checkpointManager.GetIndexDevice(token);
 }