You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ae...@apache.org on 2018/03/15 16:32:40 UTC
[25/51] [partial] hadoop git commit: HDFS-13258. Ozone: restructure
Hdsl/Ozone code to separated maven subprojects. Contributed by Elek Marton,
Mukul Kumar Singh, Xiaoyu Yao, Ajay Kumar, Anu Engineer, Lokesh Jain,
Nanda Kumar.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/package-info.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/package-info.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/package-info.java
deleted file mode 100644
index 09d9f32..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.hadoop.ozone.ksm;
-/*
- This package contains the keyspace manager classes.
- */
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/Lease.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/Lease.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/Lease.java
deleted file mode 100644
index dfa9315..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/Lease.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.hadoop.ozone.lease;
-
-import org.apache.hadoop.util.Time;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.Callable;
-
-/**
- * This class represents the lease created on a resource. Callback can be
- * registered on the lease which will be executed in case of timeout.
- *
- * @param <T> Resource type for which the lease can be associated
- */
-public class Lease<T> {
-
- /**
- * The resource for which this lease is created.
- */
- private final T resource;
-
- private final long creationTime;
-
- /**
- * Lease lifetime in milliseconds.
- */
- private volatile long leaseTimeout;
-
- private boolean expired;
-
- /**
- * Functions to be called in case of timeout.
- */
- private List<Callable<Void>> callbacks;
-
-
- /**
- * Creates a lease on the specified resource with given timeout.
- *
- * @param resource
- * Resource for which the lease has to be created
- * @param timeout
- * Lease lifetime in milliseconds
- */
- public Lease(T resource, long timeout) {
- this.resource = resource;
- this.leaseTimeout = timeout;
- this.callbacks = Collections.synchronizedList(new ArrayList<>());
- this.creationTime = Time.monotonicNow();
- this.expired = false;
- }
-
- /**
- * Returns true if the lease has expired, else false.
- *
- * @return true if expired, else false
- */
- public boolean hasExpired() {
- return expired;
- }
-
- /**
- * Registers a callback which will be executed in case of timeout. Callbacks
- * are executed in a separate Thread.
- *
- * @param callback
- * The Callable which has to be executed
- * @throws LeaseExpiredException
- * If the lease has already timed out
- */
- public void registerCallBack(Callable<Void> callback)
- throws LeaseExpiredException {
- if(hasExpired()) {
- throw new LeaseExpiredException("Resource: " + resource);
- }
- callbacks.add(callback);
- }
-
- /**
- * Returns the time elapsed since the creation of lease.
- *
- * @return elapsed time in milliseconds
- * @throws LeaseExpiredException
- * If the lease has already timed out
- */
- public long getElapsedTime() throws LeaseExpiredException {
- if(hasExpired()) {
- throw new LeaseExpiredException("Resource: " + resource);
- }
- return Time.monotonicNow() - creationTime;
- }
-
- /**
- * Returns the time available before timeout.
- *
- * @return remaining time in milliseconds
- * @throws LeaseExpiredException
- * If the lease has already timed out
- */
- public long getRemainingTime() throws LeaseExpiredException {
- if(hasExpired()) {
- throw new LeaseExpiredException("Resource: " + resource);
- }
- return leaseTimeout - getElapsedTime();
- }
-
- /**
- * Returns total lease lifetime.
- *
- * @return total lifetime of lease in milliseconds
- * @throws LeaseExpiredException
- * If the lease has already timed out
- */
- public long getLeaseLifeTime() throws LeaseExpiredException {
- if(hasExpired()) {
- throw new LeaseExpiredException("Resource: " + resource);
- }
- return leaseTimeout;
- }
-
- /**
- * Renews the lease timeout period.
- *
- * @param timeout
- * Time to be added to the lease in milliseconds
- * @throws LeaseExpiredException
- * If the lease has already timed out
- */
- public void renew(long timeout) throws LeaseExpiredException {
- if(hasExpired()) {
- throw new LeaseExpiredException("Resource: " + resource);
- }
- leaseTimeout += timeout;
- }
-
- @Override
- public int hashCode() {
- return resource.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if(obj instanceof Lease) {
- return resource.equals(((Lease) obj).resource);
- }
- return false;
- }
-
- @Override
- public String toString() {
- return "Lease<" + resource.toString() + ">";
- }
-
- /**
- * Returns the callbacks to be executed for the lease in case of timeout.
- *
- * @return callbacks to be executed
- */
- List<Callable<Void>> getCallbacks() {
- return callbacks;
- }
-
- /**
- * Expires/Invalidates the lease.
- */
- void invalidate() {
- callbacks = null;
- expired = true;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseAlreadyExistException.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseAlreadyExistException.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseAlreadyExistException.java
deleted file mode 100644
index a39ea22..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseAlreadyExistException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.hadoop.ozone.lease;
-
-/**
- * This exception represents that there is already a lease acquired on the
- * same resource.
- */
-public class LeaseAlreadyExistException extends LeaseException {
-
- /**
- * Constructs an {@code LeaseAlreadyExistException} with {@code null}
- * as its error detail message.
- */
- public LeaseAlreadyExistException() {
- super();
- }
-
- /**
- * Constructs an {@code LeaseAlreadyExistException} with the specified
- * detail message.
- *
- * @param message
- * The detail message (which is saved for later retrieval
- * by the {@link #getMessage()} method)
- */
- public LeaseAlreadyExistException(String message) {
- super(message);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseCallbackExecutor.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseCallbackExecutor.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseCallbackExecutor.java
deleted file mode 100644
index 1b7391b..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseCallbackExecutor.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.hadoop.ozone.lease;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.concurrent.Callable;
-
-/**
- * This class is responsible for executing the callbacks of a lease in case of
- * timeout.
- */
-public class LeaseCallbackExecutor<T> implements Runnable {
-
- private static final Logger LOG = LoggerFactory.getLogger(Lease.class);
-
- private final T resource;
- private final List<Callable<Void>> callbacks;
-
- /**
- * Constructs LeaseCallbackExecutor instance with list of callbacks.
- *
- * @param resource
- * The resource for which the callbacks are executed
- * @param callbacks
- * Callbacks to be executed by this executor
- */
- public LeaseCallbackExecutor(T resource, List<Callable<Void>> callbacks) {
- this.resource = resource;
- this.callbacks = callbacks;
- }
-
- @Override
- public void run() {
- if(LOG.isDebugEnabled()) {
- LOG.debug("Executing callbacks for lease on {}", resource);
- }
- for(Callable<Void> callback : callbacks) {
- try {
- callback.call();
- } catch (Exception e) {
- LOG.warn("Exception while executing callback for lease on {}",
- resource, e);
- }
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseException.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseException.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseException.java
deleted file mode 100644
index 418f412..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.hadoop.ozone.lease;
-
-/**
- * This exception represents all lease related exceptions.
- */
-public class LeaseException extends Exception {
-
- /**
- * Constructs an {@code LeaseException} with {@code null}
- * as its error detail message.
- */
- public LeaseException() {
- super();
- }
-
- /**
- * Constructs an {@code LeaseException} with the specified
- * detail message.
- *
- * @param message
- * The detail message (which is saved for later retrieval
- * by the {@link #getMessage()} method)
- */
- public LeaseException(String message) {
- super(message);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseExpiredException.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseExpiredException.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseExpiredException.java
deleted file mode 100644
index 440a023..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseExpiredException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.hadoop.ozone.lease;
-
-/**
- * This exception represents that the lease that is being accessed has expired.
- */
-public class LeaseExpiredException extends LeaseException {
-
- /**
- * Constructs an {@code LeaseExpiredException} with {@code null}
- * as its error detail message.
- */
- public LeaseExpiredException() {
- super();
- }
-
- /**
- * Constructs an {@code LeaseExpiredException} with the specified
- * detail message.
- *
- * @param message
- * The detail message (which is saved for later retrieval
- * by the {@link #getMessage()} method)
- */
- public LeaseExpiredException(String message) {
- super(message);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseManager.java
deleted file mode 100644
index b8390dd..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseManager.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.hadoop.ozone.lease;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * LeaseManager is someone who can provide you leases based on your
- * requirement. If you want to return the lease back before it expires,
- * you can give it back to Lease Manager. He is the one responsible for
- * the lifecycle of leases. The resource for which lease is created
- * should have proper {@code equals} method implementation, resource
- * equality is checked while the lease is created.
- *
- * @param <T> Type of leases that this lease manager can create
- */
-public class LeaseManager<T> {
-
- private static final Logger LOG =
- LoggerFactory.getLogger(LeaseManager.class);
-
- private final long defaultTimeout;
- private Map<T, Lease<T>> activeLeases;
- private LeaseMonitor leaseMonitor;
- private Thread leaseMonitorThread;
- private boolean isRunning;
-
- /**
- * Creates an instance of lease manager.
- *
- * @param defaultTimeout
- * Default timeout in milliseconds to be used for lease creation.
- */
- public LeaseManager(long defaultTimeout) {
- this.defaultTimeout = defaultTimeout;
- }
-
- /**
- * Starts the lease manager service.
- */
- public void start() {
- LOG.debug("Starting LeaseManager service");
- activeLeases = new ConcurrentHashMap<>();
- leaseMonitor = new LeaseMonitor();
- leaseMonitorThread = new Thread(leaseMonitor);
- leaseMonitorThread.setName("LeaseManager#LeaseMonitor");
- leaseMonitorThread.setDaemon(true);
- leaseMonitorThread.setUncaughtExceptionHandler((thread, throwable) -> {
- // Let us just restart this thread after logging an error.
- // if this thread is not running we cannot handle Lease expiry.
- LOG.error("LeaseMonitor thread encountered an error. Thread: {}",
- thread.toString(), throwable);
- leaseMonitorThread.start();
- });
- LOG.debug("Starting LeaseManager#LeaseMonitor Thread");
- leaseMonitorThread.start();
- isRunning = true;
- }
-
- /**
- * Returns a lease for the specified resource with default timeout.
- *
- * @param resource
- * Resource for which lease has to be created
- * @throws LeaseAlreadyExistException
- * If there is already a lease on the resource
- */
- public synchronized Lease<T> acquire(T resource)
- throws LeaseAlreadyExistException {
- return acquire(resource, defaultTimeout);
- }
-
- /**
- * Returns a lease for the specified resource with the timeout provided.
- *
- * @param resource
- * Resource for which lease has to be created
- * @param timeout
- * The timeout in milliseconds which has to be set on the lease
- * @throws LeaseAlreadyExistException
- * If there is already a lease on the resource
- */
- public synchronized Lease<T> acquire(T resource, long timeout)
- throws LeaseAlreadyExistException {
- checkStatus();
- if(LOG.isDebugEnabled()) {
- LOG.debug("Acquiring lease on {} for {} milliseconds", resource, timeout);
- }
- if(activeLeases.containsKey(resource)) {
- throw new LeaseAlreadyExistException("Resource: " + resource);
- }
- Lease<T> lease = new Lease<>(resource, timeout);
- activeLeases.put(resource, lease);
- leaseMonitorThread.interrupt();
- return lease;
- }
-
- /**
- * Returns a lease associated with the specified resource.
- *
- * @param resource
- * Resource for which the lease has to be returned
- * @throws LeaseNotFoundException
- * If there is no active lease on the resource
- */
- public Lease<T> get(T resource) throws LeaseNotFoundException {
- checkStatus();
- Lease<T> lease = activeLeases.get(resource);
- if(lease != null) {
- return lease;
- }
- throw new LeaseNotFoundException("Resource: " + resource);
- }
-
- /**
- * Releases the lease associated with the specified resource.
- *
- * @param resource
- * The for which the lease has to be released
- * @throws LeaseNotFoundException
- * If there is no active lease on the resource
- */
- public synchronized void release(T resource)
- throws LeaseNotFoundException {
- checkStatus();
- if(LOG.isDebugEnabled()) {
- LOG.debug("Releasing lease on {}", resource);
- }
- Lease<T> lease = activeLeases.remove(resource);
- if(lease == null) {
- throw new LeaseNotFoundException("Resource: " + resource);
- }
- lease.invalidate();
- }
-
- /**
- * Shuts down the LeaseManager and releases the resources. All the active
- * {@link Lease} will be released (callbacks on leases will not be
- * executed).
- */
- public void shutdown() {
- checkStatus();
- LOG.debug("Shutting down LeaseManager service");
- leaseMonitor.disable();
- leaseMonitorThread.interrupt();
- for(T resource : activeLeases.keySet()) {
- try {
- release(resource);
- } catch(LeaseNotFoundException ex) {
- //Ignore the exception, someone might have released the lease
- }
- }
- isRunning = false;
- }
-
- /**
- * Throws {@link LeaseManagerNotRunningException} if the service is not
- * running.
- */
- private void checkStatus() {
- if(!isRunning) {
- throw new LeaseManagerNotRunningException("LeaseManager not running.");
- }
- }
-
- /**
- * Monitors the leases and expires them based on the timeout, also
- * responsible for executing the callbacks of expired leases.
- */
- private final class LeaseMonitor implements Runnable {
-
- private boolean monitor = true;
- private ExecutorService executorService;
-
- private LeaseMonitor() {
- this.monitor = true;
- this.executorService = Executors.newCachedThreadPool();
- }
-
- @Override
- public void run() {
- while(monitor) {
- LOG.debug("LeaseMonitor: checking for lease expiry");
- long sleepTime = Long.MAX_VALUE;
-
- for (T resource : activeLeases.keySet()) {
- try {
- Lease<T> lease = get(resource);
- long remainingTime = lease.getRemainingTime();
- if (remainingTime <= 0) {
- //Lease has timed out
- List<Callable<Void>> leaseCallbacks = lease.getCallbacks();
- release(resource);
- executorService.execute(
- new LeaseCallbackExecutor(resource, leaseCallbacks));
- } else {
- sleepTime = remainingTime > sleepTime ?
- sleepTime : remainingTime;
- }
- } catch (LeaseNotFoundException | LeaseExpiredException ex) {
- //Ignore the exception, someone might have released the lease
- }
- }
-
- try {
- if(!Thread.interrupted()) {
- Thread.sleep(sleepTime);
- }
- } catch (InterruptedException ignored) {
- // This means a new lease is added to activeLeases.
- }
- }
- }
-
- /**
- * Disables lease monitor, next interrupt call on the thread
- * will stop lease monitor.
- */
- public void disable() {
- monitor = false;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseManagerNotRunningException.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseManagerNotRunningException.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseManagerNotRunningException.java
deleted file mode 100644
index ced31de..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseManagerNotRunningException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.hadoop.ozone.lease;
-
-/**
- * This exception represents that there LeaseManager service is not running.
- */
-public class LeaseManagerNotRunningException extends RuntimeException {
-
- /**
- * Constructs an {@code LeaseManagerNotRunningException} with {@code null}
- * as its error detail message.
- */
- public LeaseManagerNotRunningException() {
- super();
- }
-
- /**
- * Constructs an {@code LeaseManagerNotRunningException} with the specified
- * detail message.
- *
- * @param message
- * The detail message (which is saved for later retrieval
- * by the {@link #getMessage()} method)
- */
- public LeaseManagerNotRunningException(String message) {
- super(message);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseNotFoundException.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseNotFoundException.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseNotFoundException.java
deleted file mode 100644
index c292d33..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/LeaseNotFoundException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.hadoop.ozone.lease;
-
-/**
- * This exception represents that the lease that is being accessed does not
- * exist.
- */
-public class LeaseNotFoundException extends LeaseException {
-
- /**
- * Constructs an {@code LeaseNotFoundException} with {@code null}
- * as its error detail message.
- */
- public LeaseNotFoundException() {
- super();
- }
-
- /**
- * Constructs an {@code LeaseNotFoundException} with the specified
- * detail message.
- *
- * @param message
- * The detail message (which is saved for later retrieval
- * by the {@link #getMessage()} method)
- */
- public LeaseNotFoundException(String message) {
- super(message);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/package-info.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/package-info.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/package-info.java
deleted file mode 100644
index 48ee2e1..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/lease/package-info.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-/**
- * A generic lease management API which can be used if a service
- * needs any kind of lease management.
- */
-
-package org.apache.hadoop.ozone.lease;
-/*
- This package contains lease management related classes.
- */
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/package-info.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/package-info.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/package-info.java
deleted file mode 100644
index db399db..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/package-info.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.ozone;
-
-/**
- This package contains class that support ozone implementation on the datanode
- side.
-
- Main parts of ozone on datanode are:
-
- 1. REST Interface - This code lives under the web directory and listens to the
- WebHDFS port.
-
- 2. Datanode container classes: This support persistence of ozone objects on
- datanode. These classes live under container directory.
-
- 3. Client and Shell: We also support a ozone REST client lib, they are under
- web/client and web/ozShell.
-
- */
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/StorageContainerDatanodeProtocol.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/StorageContainerDatanodeProtocol.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/StorageContainerDatanodeProtocol.java
deleted file mode 100644
index ddcc261..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/StorageContainerDatanodeProtocol.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership. The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.hadoop.ozone.protocol;
-
-import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.hdfs.protocol.DatanodeID;
-import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerReportsRequestProto;
-import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerReportsResponseProto;
-import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.ReportState;
-import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.SCMVersionRequestProto;
-import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.SCMHeartbeatResponseProto;
-import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.SCMVersionResponseProto;
-import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.SCMRegisteredCmdResponseProto;
-import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.SCMNodeReport;
-import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerBlocksDeletionACKProto;
-import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerBlocksDeletionACKResponseProto;
-import java.io.IOException;
-
-/**
- * The protocol spoken between datanodes and SCM. For specifics please the
- * Protoc file that defines this protocol.
- */
-@InterfaceAudience.Private
-public interface StorageContainerDatanodeProtocol {
- /**
- * Returns SCM version.
- * @return Version info.
- */
- SCMVersionResponseProto getVersion(SCMVersionRequestProto versionRequest)
- throws IOException;
-
- /**
- * Used by data node to send a Heartbeat.
- * @param datanodeID - Datanode ID.
- * @param nodeReport - node report state
- * @param reportState - container report state.
- * @return - SCMHeartbeatResponseProto
- * @throws IOException
- */
- SCMHeartbeatResponseProto sendHeartbeat(DatanodeID datanodeID,
- SCMNodeReport nodeReport, ReportState reportState) throws IOException;
-
- /**
- * Register Datanode.
- * @param datanodeID - DatanodID.
- * @param scmAddresses - List of SCMs this datanode is configured to
- * communicate.
- * @return SCM Command.
- */
- SCMRegisteredCmdResponseProto register(DatanodeID datanodeID,
- String[] scmAddresses) throws IOException;
-
- /**
- * Send a container report.
- * @param reports -- Container report.
- * @return container reports response.
- * @throws IOException
- */
- ContainerReportsResponseProto sendContainerReport(
- ContainerReportsRequestProto reports) throws IOException;
-
- /**
- * Used by datanode to send block deletion ACK to SCM.
- * @param request block deletion transactions.
- * @return block deletion transaction response.
- * @throws IOException
- */
- ContainerBlocksDeletionACKResponseProto sendContainerBlocksDeletionACK(
- ContainerBlocksDeletionACKProto request) throws IOException;
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/StorageContainerNodeProtocol.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/StorageContainerNodeProtocol.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/StorageContainerNodeProtocol.java
deleted file mode 100644
index f4a4f32..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/StorageContainerNodeProtocol.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.ozone.protocol;
-
-import org.apache.hadoop.classification.InterfaceAudience;
-import org.apache.hadoop.hdfs.protocol.DatanodeID;
-import org.apache.hadoop.ozone.protocol.commands.SCMCommand;
-import org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.ReportState;
-import org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.SCMVersionRequestProto;
-import org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.SCMNodeReport;
-
-import java.util.List;
-
-/**
- * The protocol spoken between datanodes and SCM.
- *
- * Please note that the full protocol spoken between a datanode and SCM is
- * separated into 2 interfaces. One interface that deals with node state and
- * another interface that deals with containers.
- *
- * This interface has functions that deals with the state of datanode.
- */
-@InterfaceAudience.Private
-public interface StorageContainerNodeProtocol {
- /**
- * Gets the version info from SCM.
- * @param versionRequest - version Request.
- * @return - returns SCM version info and other required information needed
- * by datanode.
- */
- VersionResponse getVersion(SCMVersionRequestProto versionRequest);
-
- /**
- * Register the node if the node finds that it is not registered with any SCM.
- * @param datanodeID - Send datanodeID with Node info, but datanode UUID is
- * empty. Server returns a datanodeID for the given node.
- * @return SCMHeartbeatResponseProto
- */
- SCMCommand register(DatanodeID datanodeID);
-
- /**
- * Send heartbeat to indicate the datanode is alive and doing well.
- * @param datanodeID - Datanode ID.
- * @param nodeReport - node report.
- * @param reportState - container report.
- * @return SCMheartbeat response list
- */
- List<SCMCommand> sendHeartbeat(DatanodeID datanodeID,
- SCMNodeReport nodeReport, ReportState reportState);
-
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/VersionResponse.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/VersionResponse.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/VersionResponse.java
deleted file mode 100644
index 8d8f4f1..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/VersionResponse.java
+++ /dev/null
@@ -1,150 +0,0 @@
-
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.ozone.protocol;
-
-import org.apache.hadoop.ozone.protocol.proto.OzoneProtos.KeyValue;
-import org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.SCMVersionResponseProto;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * Version response class.
- */
-public class VersionResponse {
- private final int version;
- private final Map<String, String> values;
-
- /**
- * Creates a version response class.
- * @param version
- * @param values
- */
- public VersionResponse(int version, Map<String, String> values) {
- this.version = version;
- this.values = values;
- }
-
- /**
- * Creates a version Response class.
- * @param version
- */
- public VersionResponse(int version) {
- this.version = version;
- this.values = new HashMap<>();
- }
-
- /**
- * Returns a new Builder.
- * @return - Builder.
- */
- public static Builder newBuilder() {
- return new Builder();
- }
-
- /**
- * Returns this class from protobuf message.
- * @param response - SCMVersionResponseProto
- * @return VersionResponse
- */
- public static VersionResponse getFromProtobuf(SCMVersionResponseProto
- response) {
- return new VersionResponse(response.getSoftwareVersion(),
- response.getKeysList().stream()
- .collect(Collectors.toMap(KeyValue::getKey,
- KeyValue::getValue)));
- }
-
- /**
- * Adds a value to version Response.
- * @param key - String
- * @param value - String
- */
- public void put(String key, String value) {
- if (this.values.containsKey(key)) {
- throw new IllegalArgumentException("Duplicate key in version response");
- }
- values.put(key, value);
- }
-
- /**
- * Return a protobuf message.
- * @return SCMVersionResponseProto.
- */
- public SCMVersionResponseProto getProtobufMessage() {
-
- List<KeyValue> list = new LinkedList<>();
- for (Map.Entry<String, String> entry : values.entrySet()) {
- list.add(KeyValue.newBuilder().setKey(entry.getKey()).
- setValue(entry.getValue()).build());
- }
- return
- SCMVersionResponseProto.newBuilder()
- .setSoftwareVersion(this.version)
- .addAllKeys(list).build();
- }
-
- /**
- * Builder class.
- */
- public static class Builder {
- private int version;
- private Map<String, String> values;
-
- Builder() {
- values = new HashMap<>();
- }
-
- /**
- * Sets the version.
- * @param ver - version
- * @return Builder
- */
- public Builder setVersion(int ver) {
- this.version = ver;
- return this;
- }
-
- /**
- * Adds a value to version Response.
- * @param key - String
- * @param value - String
- */
- public Builder addValue(String key, String value) {
- if (this.values.containsKey(key)) {
- throw new IllegalArgumentException("Duplicate key in version response");
- }
- values.put(key, value);
- return this;
- }
-
- /**
- * Builds the version response.
- * @return VersionResponse.
- */
- public VersionResponse build() {
- return new VersionResponse(this.version, this.values);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/CloseContainerCommand.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/CloseContainerCommand.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/CloseContainerCommand.java
deleted file mode 100644
index 79aa132..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/CloseContainerCommand.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.ozone.protocol.commands;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.SCMCloseContainerCmdResponseProto;
-import org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.Type;
-import static org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.Type.closeContainerCommand;
-
-/**
- * Asks datanode to close a container.
- */
-public class CloseContainerCommand
- extends SCMCommand<SCMCloseContainerCmdResponseProto> {
-
- private String containerName;
-
- public CloseContainerCommand(String containerName) {
- this.containerName = containerName;
- }
-
- /**
- * Returns the type of this command.
- *
- * @return Type
- */
- @Override
- public Type getType() {
- return closeContainerCommand;
- }
-
- /**
- * Gets the protobuf message of this object.
- *
- * @return A protobuf message.
- */
- @Override
- public byte[] getProtoBufMessage() {
- return getProto().toByteArray();
- }
-
- public SCMCloseContainerCmdResponseProto getProto() {
- return SCMCloseContainerCmdResponseProto.newBuilder()
- .setContainerName(containerName).build();
- }
-
- public static CloseContainerCommand getFromProtobuf(
- SCMCloseContainerCmdResponseProto closeContainerProto) {
- Preconditions.checkNotNull(closeContainerProto);
- return new CloseContainerCommand(closeContainerProto.getContainerName());
-
- }
-
- public String getContainerName() {
- return containerName;
- }
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/DeleteBlocksCommand.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/DeleteBlocksCommand.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/DeleteBlocksCommand.java
deleted file mode 100644
index 8e3463d..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/DeleteBlocksCommand.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.ozone.protocol.commands;
-
-import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.DeletedBlocksTransaction;
-import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.SCMDeleteBlocksCmdResponseProto;
-import org.apache.hadoop.ozone.protocol.proto.StorageContainerDatanodeProtocolProtos.Type;
-
-import java.util.List;
-
-/**
- * A SCM command asks a datanode to delete a number of blocks.
- */
-public class DeleteBlocksCommand extends
- SCMCommand<SCMDeleteBlocksCmdResponseProto> {
-
- private List<DeletedBlocksTransaction> blocksTobeDeleted;
-
-
- public DeleteBlocksCommand(List<DeletedBlocksTransaction> blocks) {
- this.blocksTobeDeleted = blocks;
- }
-
- public List<DeletedBlocksTransaction> blocksTobeDeleted() {
- return this.blocksTobeDeleted;
- }
-
- @Override
- public Type getType() {
- return Type.deleteBlocksCommand;
- }
-
- @Override
- public byte[] getProtoBufMessage() {
- return getProto().toByteArray();
- }
-
- public static DeleteBlocksCommand getFromProtobuf(
- SCMDeleteBlocksCmdResponseProto deleteBlocksProto) {
- return new DeleteBlocksCommand(deleteBlocksProto
- .getDeletedBlocksTransactionsList());
- }
-
- public SCMDeleteBlocksCmdResponseProto getProto() {
- return SCMDeleteBlocksCmdResponseProto.newBuilder()
- .addAllDeletedBlocksTransactions(blocksTobeDeleted).build();
- }
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/RegisteredCommand.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/RegisteredCommand.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/RegisteredCommand.java
deleted file mode 100644
index bf430ac..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/RegisteredCommand.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.ozone.protocol.commands;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.SCMRegisteredCmdResponseProto;
-import org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.SCMRegisteredCmdResponseProto
- .ErrorCode;
-import org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.Type;
-
-/**
- * Response to Datanode Register call.
- */
-public class RegisteredCommand extends
- SCMCommand<SCMRegisteredCmdResponseProto> {
- private String datanodeUUID;
- private String clusterID;
- private ErrorCode error;
-
- public RegisteredCommand(final ErrorCode error, final String datanodeUUID,
- final String clusterID) {
- this.datanodeUUID = datanodeUUID;
- this.clusterID = clusterID;
- this.error = error;
- }
-
- /**
- * Returns a new builder.
- *
- * @return - Builder
- */
- public static Builder newBuilder() {
- return new Builder();
- }
-
- /**
- * Returns the type of this command.
- *
- * @return Type
- */
- @Override
- public Type getType() {
- return Type.registeredCommand;
- }
-
- /**
- * Returns datanode UUID.
- *
- * @return - Datanode ID.
- */
- public String getDatanodeUUID() {
- return datanodeUUID;
- }
-
- /**
- * Returns cluster ID.
- *
- * @return -- ClusterID
- */
- public String getClusterID() {
- return clusterID;
- }
-
- /**
- * Returns ErrorCode.
- *
- * @return - ErrorCode
- */
- public ErrorCode getError() {
- return error;
- }
-
- /**
- * Gets the protobuf message of this object.
- *
- * @return A protobuf message.
- */
- @Override
- public byte[] getProtoBufMessage() {
- return SCMRegisteredCmdResponseProto.newBuilder()
- .setClusterID(this.clusterID)
- .setDatanodeUUID(this.datanodeUUID)
- .setErrorCode(this.error)
- .build().toByteArray();
- }
-
- /**
- * A builder class to verify all values are sane.
- */
- public static class Builder {
- private String datanodeUUID;
- private String clusterID;
- private ErrorCode error;
-
- /**
- * sets UUID.
- *
- * @param dnUUID - datanode UUID
- * @return Builder
- */
- public Builder setDatanodeUUID(String dnUUID) {
- this.datanodeUUID = dnUUID;
- return this;
- }
-
- /**
- * Create this object from a Protobuf message.
- *
- * @param response - RegisteredCmdResponseProto
- * @return RegisteredCommand
- */
- public RegisteredCommand getFromProtobuf(SCMRegisteredCmdResponseProto
- response) {
- Preconditions.checkNotNull(response);
- return new RegisteredCommand(response.getErrorCode(),
- response.hasDatanodeUUID() ? response.getDatanodeUUID(): "",
- response.hasClusterID() ? response.getClusterID(): "");
- }
-
- /**
- * Sets cluster ID.
- *
- * @param cluster - clusterID
- * @return Builder
- */
- public Builder setClusterID(String cluster) {
- this.clusterID = cluster;
- return this;
- }
-
- /**
- * Sets Error code.
- *
- * @param errorCode - error code
- * @return Builder
- */
- public Builder setErrorCode(ErrorCode errorCode) {
- this.error = errorCode;
- return this;
- }
-
- /**
- * Build the command object.
- *
- * @return RegisteredCommand
- */
- public RegisteredCommand build() {
- if ((this.error == ErrorCode.success) &&
- (this.datanodeUUID == null || this.datanodeUUID.isEmpty()) ||
- (this.clusterID == null || this.clusterID.isEmpty())) {
- throw new IllegalArgumentException("On success, RegisteredCommand " +
- "needs datanodeUUID and ClusterID.");
- }
-
- return new
- RegisteredCommand(this.error, this.datanodeUUID, this.clusterID);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/ReregisterCommand.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/ReregisterCommand.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/ReregisterCommand.java
deleted file mode 100644
index f87d35b..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/ReregisterCommand.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.ozone.protocol.commands;
-
-import org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.Type;
-
-import static org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.SCMReregisterCmdResponseProto;
-import static org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.Type.reregisterCommand;
-
-/**
- * Informs a datanode to register itself with SCM again.
- */
-public class ReregisterCommand extends
- SCMCommand<SCMReregisterCmdResponseProto>{
-
- /**
- * Returns the type of this command.
- *
- * @return Type
- */
- @Override
- public Type getType() {
- return reregisterCommand;
- }
-
- /**
- * Gets the protobuf message of this object.
- *
- * @return A protobuf message.
- */
- @Override
- public byte[] getProtoBufMessage() {
- return getProto().toByteArray();
- }
-
- public SCMReregisterCmdResponseProto getProto() {
- return SCMReregisterCmdResponseProto
- .newBuilder()
- .build();
- }
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/SCMCommand.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/SCMCommand.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/SCMCommand.java
deleted file mode 100644
index fe9b12d..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/SCMCommand.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.ozone.protocol.commands;
-
-import org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.Type;
-import com.google.protobuf.GeneratedMessage;
-
-/**
- * A class that acts as the base class to convert between Java and SCM
- * commands in protobuf format.
- * @param <T>
- */
-public abstract class SCMCommand<T extends GeneratedMessage> {
- /**
- * Returns the type of this command.
- * @return Type
- */
- public abstract Type getType();
-
- /**
- * Gets the protobuf message of this object.
- * @return A protobuf message.
- */
- public abstract byte[] getProtoBufMessage();
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/SendContainerCommand.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/SendContainerCommand.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/SendContainerCommand.java
deleted file mode 100644
index 6a9fc44..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/SendContainerCommand.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.ozone.protocol.commands;
-
-import org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.SendContainerReportProto;
-import org.apache.hadoop.ozone.protocol.proto
- .StorageContainerDatanodeProtocolProtos.Type;
-
-/**
- * Allows a Datanode to send in the container report.
- */
-public class SendContainerCommand extends SCMCommand<SendContainerReportProto> {
- /**
- * Returns a NullCommand class from NullCommandResponse Proto.
- * @param unused - unused
- * @return NullCommand
- */
- public static SendContainerCommand getFromProtobuf(
- final SendContainerReportProto unused) {
- return new SendContainerCommand();
- }
-
- /**
- * returns a new builder.
- * @return Builder
- */
- public static SendContainerCommand.Builder newBuilder() {
- return new SendContainerCommand.Builder();
- }
-
- /**
- * Returns the type of this command.
- *
- * @return Type
- */
- @Override
- public Type getType() {
- return Type.sendContainerReport;
- }
-
- /**
- * Gets the protobuf message of this object.
- *
- * @return A protobuf message.
- */
- @Override
- public byte[] getProtoBufMessage() {
- return SendContainerReportProto.newBuilder().build().toByteArray();
- }
-
- /**
- * A Builder class this is the standard pattern we are using for all commands.
- */
- public static class Builder {
- /**
- * Return a null command.
- * @return - NullCommand.
- */
- public SendContainerCommand build() {
- return new SendContainerCommand();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/package-info.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/package-info.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/package-info.java
deleted file mode 100644
index 7083c1b..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/commands/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.ozone.protocol.commands;
-/**
- Set of classes that help in protoc conversions.
- **/
http://git-wip-us.apache.org/repos/asf/hadoop/blob/ce23d9ad/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/package-info.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/package-info.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/package-info.java
deleted file mode 100644
index 8bc29aa..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/protocol/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.ozone.protocol;
-
-/**
- * This package contains classes for Ozone protocol definitions.
- */
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org