@Override // ClientDatanodeProtocol & ReconfigurationProtocol public List<String> listReconfigurableProperties() throws IOException { checkSuperuserPrivilege(); return RECONFIGURABLE_PROPERTIES; }
@Override // ClientDatanodeProtocol & ReconfigurationProtocol public void startReconfiguration() throws IOException { checkSuperuserPrivilege(); startReconfigurationTask(); }
@Override //ClientDatanodeProtocol public void evictWriters() throws IOException { checkSuperuserPrivilege(); LOG.info("Evicting all writers."); xserver.stopWriters(); }
@Override public SpanReceiverInfo[] listSpanReceivers() throws IOException { checkSuperuserPrivilege(); return tracerConfigurationManager.listSpanReceivers(); }
@Override public long addSpanReceiver(SpanReceiverInfo info) throws IOException { checkSuperuserPrivilege(); return tracerConfigurationManager.addSpanReceiver(info); }
@Override // ClientDatanodeProtocol & ReconfigurationProtocol public ReconfigurationTaskStatus getReconfigurationStatus() throws IOException { checkSuperuserPrivilege(); return getReconfigurationTaskStatus(); }
@Override public void removeSpanReceiver(long id) throws IOException { checkSuperuserPrivilege(); tracerConfigurationManager.removeSpanReceiver(id); }
@Override // ClientDatanodeProtocol public synchronized void shutdownDatanode(boolean forUpgrade) throws IOException { checkSuperuserPrivilege(); LOG.info("shutdownDatanode command received (upgrade={}). " + "Shutting down Datanode...", forUpgrade); // Shutdown can be called only once. if (shutdownInProgress) { throw new IOException("Shutdown already in progress."); } shutdownInProgress = true; shutdownForUpgrade = forUpgrade; // Asynchronously start the shutdown process so that the rpc response can be // sent back. Thread shutdownThread = new Thread("Async datanode shutdown thread") { @Override public void run() { if (!shutdownForUpgrade) { // Delay the shutdown a bit if not doing for restart. try { Thread.sleep(1000); } catch (InterruptedException ie) { } } shutdown(); } }; shutdownThread.setDaemon(true); shutdownThread.start(); }
@Override // ClientDatanodeProtocol public void deleteBlockPool(String blockPoolId, boolean force) throws IOException { checkSuperuserPrivilege(); LOG.info("deleteBlockPool command received for block pool {}, " + "force={}", blockPoolId, force); if (blockPoolManager.get(blockPoolId) != null) { LOG.warn("The block pool {} is still running, cannot be deleted.", blockPoolId); throw new IOException( "The block pool is still running. First do a refreshNamenodes to " + "shutdown the block pool service"); } data.deleteBlockPool(blockPoolId, force); }
@Override public List<DatanodeVolumeInfo> getVolumeReport() throws IOException { checkSuperuserPrivilege(); Map<String, Object> volumeInfoMap = data.getVolumeInfoMap(); if (volumeInfoMap == null) { LOG.warn("DataNode volume info not available."); return new ArrayList<>(0); } List<DatanodeVolumeInfo> volumeInfoList = new ArrayList<>(); for (Entry<String, Object> volume : volumeInfoMap.entrySet()) { @SuppressWarnings("unchecked") Map<String, Object> volumeInfo = (Map<String, Object>) volume.getValue(); DatanodeVolumeInfo dnStorageInfo = new DatanodeVolumeInfo( volume.getKey(), (Long) volumeInfo.get("usedSpace"), (Long) volumeInfo.get("freeSpace"), (Long) volumeInfo.get("reservedSpace"), (Long) volumeInfo.get("reservedSpaceForReplicas"), (Long) volumeInfo.get("numBlocks"), (StorageType) volumeInfo.get("storageType")); volumeInfoList.add(dnStorageInfo); } return volumeInfoList; }
/** * Returns the status of current or last executed work plan. * @return DiskBalancerWorkStatus. * @throws IOException */ @Override public DiskBalancerWorkStatus queryDiskBalancerPlan() throws IOException { checkSuperuserPrivilege(); return getDiskBalancer().queryWorkStatus(); }
/** * Cancels a running plan. * @param planID - Hash string that identifies a plan */ @Override public void cancelDiskBalancePlan(String planID) throws IOException { checkSuperuserPrivilege(); getDiskBalancer().cancelPlan(planID); }
@Override // ClientDatanodeProtocol public void refreshNamenodes() throws IOException { checkSuperuserPrivilege(); setConf(new Configuration()); refreshNamenodes(getConf()); }
@Override // ClientDatanodeProtocol public void triggerBlockReport(BlockReportOptions options) throws IOException { checkSuperuserPrivilege(); for (BPOfferService bpos : blockPoolManager.getAllNamenodeThreads()) { if (bpos != null) { for (BPServiceActor actor : bpos.getBPServiceActors()) { actor.triggerBlockReport(options); } } } }
/** * Gets a runtime configuration value from diskbalancer instance. For * example : DiskBalancer bandwidth. * * @param key - String that represents the run time key value. * @return value of the key as a string. * @throws IOException - Throws if there is no such key */ @Override public String getDiskBalancerSetting(String key) throws IOException { checkSuperuserPrivilege(); Preconditions.checkNotNull(key); switch (key) { case DiskBalancerConstants.DISKBALANCER_VOLUME_NAME: return getDiskBalancer().getVolumeNames(); case DiskBalancerConstants.DISKBALANCER_BANDWIDTH : return Long.toString(getDiskBalancer().getBandwidth()); default: LOG.error("Disk Balancer - Unknown key in get balancer setting. Key: {}", key); throw new DiskBalancerException("Unknown key", DiskBalancerException.Result.UNKNOWN_KEY); } }
/** * Allows submission of a disk balancer Job. * @param planID - Hash value of the plan. * @param planVersion - Plan version, reserved for future use. We have only * version 1 now. * @param planFile - Plan file name * @param planData - Actual plan data in json format * @throws IOException */ @Override public void submitDiskBalancerPlan(String planID, long planVersion, String planFile, String planData, boolean skipDateCheck) throws IOException { checkSuperuserPrivilege(); if (getStartupOption(getConf()) != StartupOption.REGULAR) { throw new DiskBalancerException( "Datanode is in special state, e.g. Upgrade/Rollback etc." + " Disk balancing not permitted.", DiskBalancerException.Result.DATANODE_STATUS_NOT_REGULAR); } getDiskBalancer().submitPlan(planID, planVersion, planFile, planData, skipDateCheck); }
@Override // ClientDatanodeProtocol public void refreshNamenodes() throws IOException { checkSuperuserPrivilege(); conf = new Configuration(); refreshNamenodes(conf); }
@Override // ClientDatanodeProtocol public void startReconfiguration() throws IOException { checkSuperuserPrivilege(); startReconfigurationTask(); }
@Override // ClientDatanodeProtocol public void startReconfiguration() throws IOException { checkSuperuserPrivilege(); startReconfigurationTask(); }
@Override public void removeSpanReceiver(long id) throws IOException { checkSuperuserPrivilege(); spanReceiverHost.removeSpanReceiver(id); }