Exemple #1
0
 public HeartbeatResponse(DatanodeCommand[] cmds, NNHAStatusHeartbeat haStatus, RollingUpgradeStatus
                          rollingUpdateStatus)
 {
     commands                 = cmds;
     this.haStatus            = haStatus;
     this.rollingUpdateStatus = rollingUpdateStatus;
 }
Exemple #2
0
        /// <exception cref="System.IO.IOException"/>
        public virtual HeartbeatResponse SendHeartbeat(DatanodeRegistration registration,
                                                       StorageReport[] reports, long cacheCapacity, long cacheUsed, int xmitsInProgress
                                                       , int xceiverCount, int failedVolumes, VolumeFailureSummary volumeFailureSummary
                                                       )
        {
            DatanodeProtocolProtos.HeartbeatRequestProto.Builder builder = DatanodeProtocolProtos.HeartbeatRequestProto
                                                                           .NewBuilder().SetRegistration(PBHelper.Convert(registration)).SetXmitsInProgress
                                                                               (xmitsInProgress).SetXceiverCount(xceiverCount).SetFailedVolumes(failedVolumes);
            builder.AddAllReports(PBHelper.ConvertStorageReports(reports));
            if (cacheCapacity != 0)
            {
                builder.SetCacheCapacity(cacheCapacity);
            }
            if (cacheUsed != 0)
            {
                builder.SetCacheUsed(cacheUsed);
            }
            if (volumeFailureSummary != null)
            {
                builder.SetVolumeFailureSummary(PBHelper.ConvertVolumeFailureSummary(volumeFailureSummary
                                                                                     ));
            }
            DatanodeProtocolProtos.HeartbeatResponseProto resp;
            try
            {
                resp = rpcProxy.SendHeartbeat(NullController, ((DatanodeProtocolProtos.HeartbeatRequestProto
                                                                )builder.Build()));
            }
            catch (ServiceException se)
            {
                throw ProtobufHelper.GetRemoteException(se);
            }
            DatanodeCommand[] cmds = new DatanodeCommand[resp.GetCmdsList().Count];
            int index = 0;

            foreach (DatanodeProtocolProtos.DatanodeCommandProto p in resp.GetCmdsList())
            {
                cmds[index] = PBHelper.Convert(p);
                index++;
            }
            RollingUpgradeStatus rollingUpdateStatus = null;

            // Use v2 semantics if available.
            if (resp.HasRollingUpgradeStatusV2())
            {
                rollingUpdateStatus = PBHelper.Convert(resp.GetRollingUpgradeStatusV2());
            }
            else
            {
                if (resp.HasRollingUpgradeStatus())
                {
                    rollingUpdateStatus = PBHelper.Convert(resp.GetRollingUpgradeStatus());
                }
            }
            return(new HeartbeatResponse(cmds, PBHelper.Convert(resp.GetHaStatus()), rollingUpdateStatus
                                         ));
        }
Exemple #3
0
 private void Completed()
 {
     Program.BeginInvoke(this, () =>
     {
         progressBar1.Value = 100;
         UpgradeStatus      = RollingUpgradeStatus.Completed;
         labelTitle.Text    = completedTitleLabel;
         OnPageUpdated();
     });
 }
Exemple #4
0
        private void StartAutomaticUpgrade()
        {
            _workerAutomaticUpgrade = new AutomaticBackgroundThread(SelectedMasters, planActions, revertAction);
            _workerAutomaticUpgrade.ReportRunning    += ReportRunning;
            _workerAutomaticUpgrade.ReportException  += ReportException;
            _workerAutomaticUpgrade.ReportHostDone   += ReportHostDone;
            _workerAutomaticUpgrade.ReportRevertDone += ReportRevertDone;
            _workerAutomaticUpgrade.Completed        += Completed;
            _workerAutomaticUpgrade.Start();

            UpgradeStatus = RollingUpgradeStatus.Started;
        }
Exemple #5
0
        private void StartSemiAutomaticUpgrade()
        {
            bworker = new SemiAutomaticBackgroundThread(SelectedMasters, planActions, revertAction);
            bworker.ManageSemiAutomaticPlanAction += ManageSemiAutomaticPlanAction;
            bworker.ReportRunning    += ReportRunning;
            bworker.ReportException  += ReportException;
            bworker.ReportHostDone   += ReportHostDone;
            bworker.ReportRevertDone += ReportRevertDone;
            bworker.Completed        += Completed;
            bworker.Start();

            UpgradeStatus = RollingUpgradeStatus.Started;
        }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual DatanodeProtocolProtos.HeartbeatResponseProto SendHeartbeat(RpcController
                                                                                   controller, DatanodeProtocolProtos.HeartbeatRequestProto request)
        {
            HeartbeatResponse response;

            try
            {
                StorageReport[]      report = PBHelper.ConvertStorageReports(request.GetReportsList());
                VolumeFailureSummary volumeFailureSummary = request.HasVolumeFailureSummary() ? PBHelper
                                                            .ConvertVolumeFailureSummary(request.GetVolumeFailureSummary()) : null;
                response = impl.SendHeartbeat(PBHelper.Convert(request.GetRegistration()), report
                                              , request.GetCacheCapacity(), request.GetCacheUsed(), request.GetXmitsInProgress
                                                  (), request.GetXceiverCount(), request.GetFailedVolumes(), volumeFailureSummary);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
            DatanodeProtocolProtos.HeartbeatResponseProto.Builder builder = DatanodeProtocolProtos.HeartbeatResponseProto
                                                                            .NewBuilder();
            DatanodeCommand[] cmds = response.GetCommands();
            if (cmds != null)
            {
                for (int i = 0; i < cmds.Length; i++)
                {
                    if (cmds[i] != null)
                    {
                        builder.AddCmds(PBHelper.Convert(cmds[i]));
                    }
                }
            }
            builder.SetHaStatus(PBHelper.Convert(response.GetNameNodeHaState()));
            RollingUpgradeStatus rollingUpdateStatus = response.GetRollingUpdateStatus();

            if (rollingUpdateStatus != null)
            {
                // V2 is always set for newer datanodes.
                // To be compatible with older datanodes, V1 is set to null
                //  if the RU was finalized.
                HdfsProtos.RollingUpgradeStatusProto rus = PBHelper.ConvertRollingUpgradeStatus(rollingUpdateStatus
                                                                                                );
                builder.SetRollingUpgradeStatusV2(rus);
                if (!rollingUpdateStatus.IsFinalized())
                {
                    builder.SetRollingUpgradeStatus(rus);
                }
            }
            return((DatanodeProtocolProtos.HeartbeatResponseProto)builder.Build());
        }
Exemple #7
0
        /// <summary>Signal the current rolling upgrade status as indicated by the NN.</summary>
        /// <param name="rollingUpgradeStatus">rolling upgrade status</param>
        /// <exception cref="System.IO.IOException"/>
        internal virtual void SignalRollingUpgrade(RollingUpgradeStatus rollingUpgradeStatus
                                                   )
        {
            if (rollingUpgradeStatus == null)
            {
                return;
            }
            string bpid = GetBlockPoolId();

            if (!rollingUpgradeStatus.IsFinalized())
            {
                dn.GetFSDataset().EnableTrash(bpid);
                dn.GetFSDataset().SetRollingUpgradeMarker(bpid);
            }
            else
            {
                dn.GetFSDataset().ClearTrash(bpid);
                dn.GetFSDataset().ClearRollingUpgradeMarker(bpid);
            }
        }
        private void StartSemiAutomaticUpgrade()
        {
            bworker = new SemiAutomaticBackgroundThread(SelectedMasters, planActions, revertAction);
            bworker.ManageSemiAutomaticPlanAction += ManageSemiAutomaticPlanAction;
            bworker.ReportRunning += ReportRunning;
            bworker.ReportException += ReportException;
            bworker.ReportHostDone += ReportHostDone;
            bworker.ReportRevertDone += ReportRevertDone;
            bworker.Completed += Completed;
            bworker.Start();

            UpgradeStatus = RollingUpgradeStatus.Started;
        }
        private void StartAutomaticUpgrade()
        {
            _workerAutomaticUpgrade = new AutomaticBackgroundThread(SelectedMasters, planActions, revertAction);
            _workerAutomaticUpgrade.ReportRunning += ReportRunning;
            _workerAutomaticUpgrade.ReportException += ReportException;
            _workerAutomaticUpgrade.ReportHostDone += ReportHostDone;
            _workerAutomaticUpgrade.ReportRevertDone += ReportRevertDone;
            _workerAutomaticUpgrade.Completed += Completed;
            _workerAutomaticUpgrade.Start();

            UpgradeStatus = RollingUpgradeStatus.Started;
        }
 private void Completed(object sender, EventArgs eventArgs)
 {
     Program.BeginInvoke(this, () =>
                                   {
                                       progressBar1.Value = 100;
                                       UpgradeStatus = RollingUpgradeStatus.Completed;
                                       labelTitle.Text = completedTitleLabel;
                                       OnPageUpdated();
                                   });
 }
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);
            UpgradeStatus = RollingUpgradeStatus.NotStarted;
            ImageAnimator.Animate(animatedImage, onFrameChanged);
            if (direction == PageLoadedDirection.Forward && planActions.Count > 0)
                return;

            OnPageUpdated();

            dataGridView1.Rows.Clear();
            UnregisterAllStatusUpdateActions();
            planActions.Clear();

            //Add masters first
            var hostNeedUpgrade = new List<Host>();
            //Add rest of slaves not ugpraded
            foreach (var host in SelectedMasters)
            {
                Pool pool = Helpers.GetPoolOfOne(host.Connection);
                if (pool != null)
                    hostNeedUpgrade.AddRange(pool.HostsToUpgrade);
                else
                    hostNeedUpgrade.Add(host);
            }

            foreach (var host in hostNeedUpgrade)
            {
                planActions.Add(host, GetSubTasksFor(host));
                dataGridView1.Rows.Add(new DataGridViewRowUpgrade(host));
            }

            //Revert precheck changes
            revertAction = new UnwindProblemsAction(ProblemsResolvedPreCheck);
            dataGridView1.Rows.Add(new DataGridViewRowUpgrade(revertAction));

            labelOverallProgress.Text = string.Format(Messages.OVERALL_PROGRESS, 0, dataGridView1.Rows.Count - 1);
            RegisterStatusUpdateActions();
            StartUpgrade();
        }
 public override void PageCancelled()
 {
     UnregisterAllStatusUpdateActions();
     UpgradeStatus = RollingUpgradeStatus.Cancelled;
     if (bworker != null)
         bworker.Cancel();
     if (_workerAutomaticUpgrade != null)
         _workerAutomaticUpgrade.Cancel();
 }