27
27
import java .util .SortedMap ;
28
28
import java .util .stream .Collectors ;
29
29
30
+ import org .apache .accumulo .core .data .TableId ;
30
31
import org .apache .accumulo .core .data .TabletId ;
31
32
import org .apache .accumulo .core .dataImpl .KeyExtent ;
32
33
import org .apache .accumulo .core .dataImpl .TabletIdImpl ;
@@ -46,11 +47,13 @@ public class BalanceParamsImpl implements TabletBalancer.BalanceParameters {
46
47
private final Set <KeyExtent > thriftCurrentMigrations ;
47
48
private final Map <String ,Set <TabletServerId >> tserverResourceGroups ;
48
49
private final DataLevel currentDataLevel ;
50
+ private final Map <String ,TableId > tablesToBalance ;
49
51
50
52
public static BalanceParamsImpl fromThrift (SortedMap <TabletServerId ,TServerStatus > currentStatus ,
51
53
Map <String ,Set <TServerInstance >> currentTServerGrouping ,
52
54
SortedMap <TServerInstance ,TabletServerStatus > thriftCurrentStatus ,
53
- Set <KeyExtent > thriftCurrentMigrations , DataLevel currentLevel ) {
55
+ Set <KeyExtent > thriftCurrentMigrations , DataLevel currentLevel ,
56
+ Map <String ,TableId > tablesToBalance ) {
54
57
Set <TabletId > currentMigrations = thriftCurrentMigrations .stream ().map (TabletIdImpl ::new )
55
58
.collect (Collectors .toUnmodifiableSet ());
56
59
@@ -62,33 +65,37 @@ public static BalanceParamsImpl fromThrift(SortedMap<TabletServerId,TServerStatu
62
65
});
63
66
64
67
return new BalanceParamsImpl (currentStatus , tserverGroups , currentMigrations , new ArrayList <>(),
65
- thriftCurrentStatus , thriftCurrentMigrations , currentLevel );
68
+ thriftCurrentStatus , thriftCurrentMigrations , currentLevel , tablesToBalance );
66
69
}
67
70
68
71
public BalanceParamsImpl (SortedMap <TabletServerId ,TServerStatus > currentStatus ,
69
72
Map <String ,Set <TabletServerId >> currentGroups , Set <TabletId > currentMigrations ,
70
- List <TabletMigration > migrationsOut , DataLevel currentLevel ) {
73
+ List <TabletMigration > migrationsOut , DataLevel currentLevel ,
74
+ Map <String ,TableId > tablesToBalance ) {
71
75
this .currentStatus = currentStatus ;
72
76
this .tserverResourceGroups = currentGroups ;
73
77
this .currentMigrations = currentMigrations ;
74
78
this .migrationsOut = migrationsOut ;
75
79
this .thriftCurrentStatus = null ;
76
80
this .thriftCurrentMigrations = null ;
77
81
this .currentDataLevel = currentLevel ;
82
+ this .tablesToBalance = tablesToBalance ;
78
83
}
79
84
80
85
private BalanceParamsImpl (SortedMap <TabletServerId ,TServerStatus > currentStatus ,
81
86
Map <String ,Set <TabletServerId >> currentGroups , Set <TabletId > currentMigrations ,
82
87
List <TabletMigration > migrationsOut ,
83
88
SortedMap <TServerInstance ,TabletServerStatus > thriftCurrentStatus ,
84
- Set <KeyExtent > thriftCurrentMigrations , DataLevel currentLevel ) {
89
+ Set <KeyExtent > thriftCurrentMigrations , DataLevel currentLevel ,
90
+ Map <String ,TableId > tablesToBalance ) {
85
91
this .currentStatus = currentStatus ;
86
92
this .tserverResourceGroups = currentGroups ;
87
93
this .currentMigrations = currentMigrations ;
88
94
this .migrationsOut = migrationsOut ;
89
95
this .thriftCurrentStatus = thriftCurrentStatus ;
90
96
this .thriftCurrentMigrations = thriftCurrentMigrations ;
91
97
this .currentDataLevel = currentLevel ;
98
+ this .tablesToBalance = tablesToBalance ;
92
99
}
93
100
94
101
@ Override
@@ -130,4 +137,9 @@ public Map<String,Set<TabletServerId>> currentResourceGroups() {
130
137
public String currentLevel () {
131
138
return currentDataLevel .name ();
132
139
}
140
+
141
+ @ Override
142
+ public Map <String ,TableId > getTablesToBalance () {
143
+ return tablesToBalance ;
144
+ }
133
145
}
0 commit comments