Exemplo n.º 1
0
 public void TearDown()
 {
     fht.StopSession();
     fht = null;
     log.Close();
     DeleteDirectory(test_path);
 }
Exemplo n.º 2
0
 public void TearDown()
 {
     fht.StopSession();
     fht.Dispose();
     fht = null;
     log.Close();
 }
Exemplo n.º 3
0
 public void Setup()
 {
     log = new LocalStorageDevice("hybridlog_native.log", deleteOnClose: true);
     fht = FasterFactory.Create
           <KeyStruct, ValueStruct, InputStruct, OutputStruct, Empty, Functions, ICustomFaster>
               (128, log);
     fht.StartSession();
 }
Exemplo n.º 4
0
        public SingleThreadedRecoveryTest()
        {
            // Create FASTER index
            var log = FASTERFactory.CreateLogDevice(DirectoryConfiguration.GetHybridLogFileName());

            fht = FASTERFactory.Create
                  <AdId, NumClicks, Input, Output, Empty, Functions, ICustomFaster>
                      (keySpace, log);
        }
Exemplo n.º 5
0
        public void Setup()
        {
            var log = FASTERFactory.CreateLogDevice(Path.GetTempPath() + "\\hybridlog_native.log");

            fht = FASTERFactory.Create
                  <KeyStruct, ValueStruct, InputStruct, OutputStruct, Empty, Functions, ICustomFaster>
                      (128, log);
            fht.StartSession();
        }
Exemplo n.º 6
0
 public void Setup()
 {
     log = new LocalStorageDevice(TestContext.CurrentContext.TestDirectory + "\\hybridlog_native.log", deleteOnClose: true);
     fht = FasterFactory.Create
           <KeyStruct, ValueStruct, InputStruct, OutputStruct, Empty, Functions, ICustomFaster>
               (128, new LogSettings {
         LogDevice = log
     });
     fht.StartSession();
 }
Exemplo n.º 7
0
        public ConcurrentTest(int threadCount)
        {
            this.threadCount = threadCount;

            // Create FASTER index
            var log = FASTERFactory.CreateLogDevice(DirectoryConfiguration.GetHybridLogFileName());

            fht = FASTERFactory.Create
                  <AdId, NumClicks, Input, Output, Empty, Functions, ICustomFaster>
                      (keySpace, log);
            numActiveThreads = 0;

            inputArrays  = new BlockingCollection <Input[]>();
            threadNumOps = new long[threadCount];
            Prepare();
        }
Exemplo n.º 8
0
        public void Setup()
        {
            if (test_path == null)
            {
                test_path = Path.GetTempPath() + Path.GetRandomFileName();
                if (!Directory.Exists(test_path))
                {
                    Directory.CreateDirectory(test_path);
                }
            }

            var log = FASTERFactory.CreateLogDevice(test_path + "\\hlog");

            fht =
                FASTERFactory.Create
                <AdId, NumClicks, Input, Output, Empty, Functions, ICustomFaster>
                    (keySpace, log, checkpointDir: test_path);
        }
Exemplo n.º 9
0
        public void Setup()
        {
            if (test_path == null)
            {
                test_path = Path.GetTempPath() + Path.GetRandomFileName();
                if (!Directory.Exists(test_path))
                {
                    Directory.CreateDirectory(test_path);
                }
            }

            log = FasterFactory.CreateLogDevice(test_path + "\\hlog");

            fht =
                FasterFactory.Create
                <AdId, NumClicks, Input, Output, Empty, Functions, ICustomFaster>
                    (keySpace, new LogSettings {
                LogDevice = log
            }, new CheckpointSettings {
                CheckpointDir = test_path
            });
        }
Exemplo n.º 10
0
 public void TearDown()
 {
     fht.StopSession();
     fht = null;
 }
Exemplo n.º 11
0
        public unsafe void SimpleRecoveryTest1()
        {
            log = FasterFactory.CreateLogDevice(TestContext.CurrentContext.TestDirectory + "\\hlog", deleteOnClose: true);

            Directory.CreateDirectory(TestContext.CurrentContext.TestDirectory + "\\checkpoints");

            fht1 = FasterFactory.Create
                   <AdId, NumClicks, Input, Output, Empty, SimpleFunctions, ICustomFaster>
                       (indexSizeBuckets: 128,
                       logSettings: new LogSettings {
                LogDevice = log, MutableFraction = 0.1, MemorySizeBits = 29
            },
                       checkpointSettings: new CheckpointSettings {
                CheckpointDir = TestContext.CurrentContext.TestDirectory + "\\checkpoints", CheckPointType = CheckpointType.Snapshot
            }
                       );

            fht2 = FasterFactory.Create
                   <AdId, NumClicks, Input, Output, Empty, SimpleFunctions, ICustomFaster>
                       (indexSizeBuckets: 128,
                       logSettings: new LogSettings {
                LogDevice = log, MutableFraction = 0.1, MemorySizeBits = 29
            },
                       checkpointSettings: new CheckpointSettings {
                CheckpointDir = TestContext.CurrentContext.TestDirectory + "\\checkpoints", CheckPointType = CheckpointType.Snapshot
            }
                       );


            int numOps     = 5000;
            var inputArray = new AdId[numOps];

            for (int i = 0; i < numOps; i++)
            {
                inputArray[i].adId = i;
            }

            NumClicks value;
            Input     inputArg;
            Output    output;


            fixed(AdId *input = inputArray)
            {
                fht1.StartSession();
                for (int key = 0; key < numOps; key++)
                {
                    value.numClicks = key;
                    fht1.Upsert(input + key, &value, null, 0);
                }
                fht1.TakeFullCheckpoint(out Guid token);
                fht1.CompleteCheckpoint(true);
                fht1.StopSession();

                fht2.Recover(token);
                fht2.StartSession();
                for (int key = 0; key < numOps; key++)
                {
                    var status = fht2.Read(input + key, &inputArg, &output, null, 0);

                    if (status == Status.PENDING)
                    {
                        fht2.CompletePending(true);
                    }
                    else
                    {
                        Assert.IsTrue(output.value.numClicks == key);
                    }
                }
                fht2.StopSession();
            }

            log.Close();
            fht1.Dispose();
            fht2.Dispose();
            new DirectoryInfo(TestContext.CurrentContext.TestDirectory + "\\checkpoints").Delete(true);
        }