コード例 #1
0
        /// <exception cref="System.IO.IOException"/>
        internal JournalNodeRpcServer(Configuration conf, JournalNode jn)
        {
            this.jn = jn;
            Configuration confCopy = new Configuration(conf);

            // Ensure that nagling doesn't kick in, which could cause latency issues.
            confCopy.SetBoolean(CommonConfigurationKeysPublic.IpcServerTcpnodelayKey, true);
            IPEndPoint addr = GetAddress(confCopy);

            RPC.SetProtocolEngine(confCopy, typeof(QJournalProtocolPB), typeof(ProtobufRpcEngine
                                                                               ));
            QJournalProtocolServerSideTranslatorPB translator = new QJournalProtocolServerSideTranslatorPB
                                                                    (this);
            BlockingService service = QJournalProtocolProtos.QJournalProtocolService.NewReflectiveBlockingService
                                          (translator);

            this.server = new RPC.Builder(confCopy).SetProtocol(typeof(QJournalProtocolPB)).SetInstance
                              (service).SetBindAddress(addr.GetHostName()).SetPort(addr.Port).SetNumHandlers(HandlerCount
                                                                                                             ).SetVerbose(false).Build();
            // set service-level authorization security policy
            if (confCopy.GetBoolean(CommonConfigurationKeys.HadoopSecurityAuthorization, false
                                    ))
            {
                server.RefreshServiceAcl(confCopy, new HDFSPolicyProvider());
            }
        }
コード例 #2
0
 public virtual void Setup()
 {
     // start 1 journal node
     jCluster = new MiniJournalCluster.Builder(new Configuration()).Format(true).NumJournalNodes
                    (NumJn).Build();
     jn = jCluster.GetJournalNode(0);
 }
コード例 #3
0
 private static void AssertJNFailsToStart(Configuration conf, string errString)
 {
     try
     {
         JournalNode jn = new JournalNode();
         jn.SetConf(conf);
         jn.Start();
     }
     catch (Exception e)
     {
         GenericTestUtils.AssertExceptionContains(errString, e);
     }
 }
コード例 #4
0
        public virtual void Setup()
        {
            FilePath editsDir = new FilePath(MiniDFSCluster.GetBaseDirectory() + FilePath.separator
                                             + "TestJournalNode");

            FileUtil.FullyDelete(editsDir);
            conf.Set(DFSConfigKeys.DfsJournalnodeEditsDirKey, editsDir.GetAbsolutePath());
            conf.Set(DFSConfigKeys.DfsJournalnodeRpcAddressKey, "0.0.0.0:0");
            jn = new JournalNode();
            jn.SetConf(conf);
            jn.Start();
            journalId = "test-journalid-" + GenericTestUtils.UniqueSequenceId();
            journal   = jn.GetOrCreateJournal(journalId);
            journal.Format(FakeNsinfo);
            ch = new IPCLoggerChannel(conf, FakeNsinfo, journalId, jn.GetBoundIpcAddress());
        }
コード例 #5
0
        public virtual void TestJournalNodeMXBean()
        {
            // we have not formatted the journals yet, and the journal status in jmx
            // should be empty since journal objects are created lazily
            MBeanServer mbs        = ManagementFactory.GetPlatformMBeanServer();
            ObjectName  mxbeanName = new ObjectName("Hadoop:service=JournalNode,name=JournalNodeInfo"
                                                    );
            // getJournalsStatus
            string journalStatus = (string)mbs.GetAttribute(mxbeanName, "JournalsStatus");

            NUnit.Framework.Assert.AreEqual(jn.GetJournalsStatus(), journalStatus);
            NUnit.Framework.Assert.IsFalse(journalStatus.Contains(Nameservice));
            // format the journal ns1
            NamespaceInfo FakeNsinfo = new NamespaceInfo(12345, "mycluster", "my-bp", 0L);

            jn.GetOrCreateJournal(Nameservice).Format(FakeNsinfo);
            // check again after format
            // getJournalsStatus
            journalStatus = (string)mbs.GetAttribute(mxbeanName, "JournalsStatus");
            NUnit.Framework.Assert.AreEqual(jn.GetJournalsStatus(), journalStatus);
            IDictionary <string, IDictionary <string, string> > jMap = new Dictionary <string, IDictionary
                                                                                       <string, string> >();
            IDictionary <string, string> infoMap = new Dictionary <string, string>();

            infoMap["Formatted"] = "true";
            jMap[Nameservice]    = infoMap;
            NUnit.Framework.Assert.AreEqual(JSON.ToString(jMap), journalStatus);
            // restart journal node without formatting
            jCluster = new MiniJournalCluster.Builder(new Configuration()).Format(false).NumJournalNodes
                           (NumJn).Build();
            jn = jCluster.GetJournalNode(0);
            // re-check
            journalStatus = (string)mbs.GetAttribute(mxbeanName, "JournalsStatus");
            NUnit.Framework.Assert.AreEqual(jn.GetJournalsStatus(), journalStatus);
            jMap    = new Dictionary <string, IDictionary <string, string> >();
            infoMap = new Dictionary <string, string>();
            infoMap["Formatted"] = "true";
            jMap[Nameservice]    = infoMap;
            NUnit.Framework.Assert.AreEqual(JSON.ToString(jMap), journalStatus);
        }
コード例 #6
0
        /// <exception cref="System.IO.IOException"/>
        public static Journal GetJournalFromContext(ServletContext context, string jid)
        {
            JournalNode jn = (JournalNode)context.GetAttribute(JnAttributeKey);

            return(jn.GetOrCreateJournal(jid));
        }
コード例 #7
0
 internal JournalNodeHttpServer(Configuration conf, JournalNode jn)
 {
     this.conf             = conf;
     this.localJournalNode = jn;
 }
コード例 #8
0
ファイル: JournalNode.cs プロジェクト: orf53975/hadoop.net
 internal ErrorReporter(JournalNode _enclosing)
 {
     this._enclosing = _enclosing;
 }