Warn in constructor when deprecated balancers are used re #1880
diff --git a/core/src/main/java/org/apache/accumulo/core/spi/balancer/SimpleLoadBalancer.java b/core/src/main/java/org/apache/accumulo/core/spi/balancer/SimpleLoadBalancer.java
index c19f650..683f6cc 100644
--- a/core/src/main/java/org/apache/accumulo/core/spi/balancer/SimpleLoadBalancer.java
+++ b/core/src/main/java/org/apache/accumulo/core/spi/balancer/SimpleLoadBalancer.java
@@ -55,6 +55,12 @@
* if possible, but otherwise assignments are made in a random fashion across all available tablet
* servers.
*
+ * <p>
+ * This balancer replaces the deprecated
+ * org.apache.accumulo.server.master.balancer.DefaultLoadBalancer which will be removed in a future
+ * release. This balancer has the same functionality but uses the stable SPI which does not expose
+ * internal types on public methods.
+ *
* @since 2.1.0
*/
public class SimpleLoadBalancer implements TabletBalancer {
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java
index 5a0f859..3f681ff 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java
@@ -34,13 +34,15 @@
import org.apache.accumulo.core.master.thrift.TableInfo;
import org.apache.accumulo.core.master.thrift.TabletServerStatus;
import org.apache.accumulo.core.metadata.TServerInstance;
+import org.apache.accumulo.core.spi.balancer.SimpleLoadBalancer;
import org.apache.accumulo.core.tabletserver.thrift.TabletStats;
import org.apache.accumulo.server.master.state.TabletMigration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * @deprecated since 2.1.0. Use {@link org.apache.accumulo.core.spi.balancer.TabletBalancer} instead
+ * @deprecated since 2.1.0. Use {@link org.apache.accumulo.core.spi.balancer.SimpleLoadBalancer}
+ * instead, as it as the same functionality but a stable API.
*/
@Deprecated(since = "2.1.0")
public class DefaultLoadBalancer extends TabletBalancer {
@@ -52,10 +54,14 @@
TableId tableToBalance = null;
public DefaultLoadBalancer() {
-
+ log.warn(
+ "{} has been deprecated and will be removed in a future release. Please update your "
+ + "configuration to use the equivalent {} instead.",
+ getClass().getName(), SimpleLoadBalancer.class.getName());
}
public DefaultLoadBalancer(TableId table) {
+ this(); // emit warning
tableToBalance = table;
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/GroupBalancer.java b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/GroupBalancer.java
index d6ec3f4..561ae3f 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/GroupBalancer.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/GroupBalancer.java
@@ -46,6 +46,7 @@
import org.apache.accumulo.core.util.Pair;
import org.apache.accumulo.server.master.state.TabletMigration;
import org.apache.commons.lang3.mutable.MutableInt;
+import org.slf4j.LoggerFactory;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.HashMultimap;
@@ -80,6 +81,13 @@
public GroupBalancer(TableId tableId) {
this.tableId = tableId;
+
+ LoggerFactory.getLogger(getClass().getName())
+ .warn("{} has been deprecated and will be "
+ + "removed in a future release. Please update your configuration to use the equivalent "
+ + "{} instead.", getClass().getName(),
+ org.apache.accumulo.core.spi.balancer.GroupBalancer.class.getName());
+
}
protected Map<KeyExtent,TServerInstance> getLocationProvider() {
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java
index fc652a1..1c786f3 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java
@@ -50,6 +50,14 @@
Map<TableId,TabletBalancer> perTableBalancers = new HashMap<>();
+ public TableLoadBalancer() {
+ log.warn(
+ "{} has been deprecated and will be removed in a future release. Please update your "
+ + "configuration to use the equivalent {} instead.",
+ getClass().getName(),
+ org.apache.accumulo.core.spi.balancer.TableLoadBalancer.class.getName());
+ }
+
private TabletBalancer constructNewBalancerForTable(String clazzName, TableId tableId)
throws Exception {
String context = null;