Example #1
0
        // Regression test for HDFS-8070
        /// <exception cref="System.Exception"/>
        public virtual void TestPreReceiptVerificationDfsClientCanDoScr()
        {
            BlockReaderTestUtil.EnableShortCircuitShmTracing();
            TemporarySocketDirectory sockDir = new TemporarySocketDirectory();
            Configuration            conf    = CreateShortCircuitConf("testPreReceiptVerificationDfsClientCanDoScr"
                                                                      , sockDir);

            conf.SetLong(DFSConfigKeys.DfsClientReadShortcircuitStreamsCacheExpiryMsKey, 1000000000L
                         );
            MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).NumDataNodes(1).Build();

            cluster.WaitActive();
            DistributedFileSystem fs = cluster.GetFileSystem();

            fs.GetClient().GetConf().brfFailureInjector = new TestShortCircuitCache.TestPreReceiptVerificationFailureInjector
                                                              ();
            Path TestPath1 = new Path("/test_file1");

            DFSTestUtil.CreateFile(fs, TestPath1, 4096, (short)1, unchecked ((int)(0xFADE2)));
            Path TestPath2 = new Path("/test_file2");

            DFSTestUtil.CreateFile(fs, TestPath2, 4096, (short)1, unchecked ((int)(0xFADE2)));
            DFSTestUtil.ReadFileBuffer(fs, TestPath1);
            DFSTestUtil.ReadFileBuffer(fs, TestPath2);
            ShortCircuitRegistry registry = cluster.GetDataNodes()[0].GetShortCircuitRegistry
                                                ();

            registry.Visit(new _Visitor_780());
            cluster.Shutdown();
            sockDir.Close();
        }
Example #2
0
        public virtual void SetUp()
        {
            datanode  = Org.Mockito.Mockito.Mock <DataNode>();
            storage   = Org.Mockito.Mockito.Mock <DataStorage>();
            this.conf = new Configuration();
            this.conf.SetLong(DFSConfigKeys.DfsDatanodeScanPeriodHoursKey, 0);
            DNConf dnConf = new DNConf(conf);

            Org.Mockito.Mockito.When(datanode.GetConf()).ThenReturn(conf);
            Org.Mockito.Mockito.When(datanode.GetDnConf()).ThenReturn(dnConf);
            BlockScanner disabledBlockScanner = new BlockScanner(datanode, conf);

            Org.Mockito.Mockito.When(datanode.GetBlockScanner()).ThenReturn(disabledBlockScanner
                                                                            );
            ShortCircuitRegistry shortCircuitRegistry = new ShortCircuitRegistry(conf);

            Org.Mockito.Mockito.When(datanode.GetShortCircuitRegistry()).ThenReturn(shortCircuitRegistry
                                                                                    );
            CreateStorageDirs(storage, conf, NumInitVolumes);
            dataset = new FsDatasetImpl(datanode, storage, conf);
            foreach (string bpid in BlockPoolIds)
            {
                dataset.AddBlockPool(bpid, conf);
            }
            NUnit.Framework.Assert.AreEqual(NumInitVolumes, dataset.GetVolumes().Count);
            NUnit.Framework.Assert.AreEqual(0, dataset.GetNumFailedVolumes());
        }
Example #3
0
 private static void CheckNumberOfSegmentsAndSlots(int expectedSegments, int expectedSlots
                                                   , ShortCircuitRegistry registry)
 {
     registry.Visit(new _Visitor_631(expectedSegments, expectedSlots));
 }