20
20
21
21
import java .util .ArrayList ;
22
22
import java .util .List ;
23
+ import java .util .Map ;
23
24
import java .util .Set ;
24
25
import java .util .SortedMap ;
25
26
import java .util .stream .Collectors ;
26
27
28
+ import org .apache .accumulo .core .data .TableId ;
27
29
import org .apache .accumulo .core .data .TabletId ;
28
30
import org .apache .accumulo .core .dataImpl .KeyExtent ;
29
31
import org .apache .accumulo .core .dataImpl .TabletIdImpl ;
@@ -42,38 +44,43 @@ public class BalanceParamsImpl implements TabletBalancer.BalanceParameters {
42
44
private final SortedMap <TServerInstance ,TabletServerStatus > thriftCurrentStatus ;
43
45
private final Set <KeyExtent > thriftCurrentMigrations ;
44
46
private final DataLevel currentDataLevel ;
47
+ private final Map <String ,TableId > tablesToBalance ;
45
48
46
49
public static BalanceParamsImpl fromThrift (SortedMap <TabletServerId ,TServerStatus > currentStatus ,
47
50
SortedMap <TServerInstance ,TabletServerStatus > thriftCurrentStatus ,
48
- Set <KeyExtent > thriftCurrentMigrations , DataLevel currentLevel ) {
51
+ Set <KeyExtent > thriftCurrentMigrations , DataLevel currentLevel ,
52
+ Map <String ,TableId > tablesToBalance ) {
49
53
Set <TabletId > currentMigrations = thriftCurrentMigrations .stream ().map (TabletIdImpl ::new )
50
54
.collect (Collectors .toUnmodifiableSet ());
51
55
52
56
return new BalanceParamsImpl (currentStatus , currentMigrations , new ArrayList <>(),
53
- thriftCurrentStatus , thriftCurrentMigrations , currentLevel );
57
+ thriftCurrentStatus , thriftCurrentMigrations , currentLevel , tablesToBalance );
54
58
}
55
59
56
60
public BalanceParamsImpl (SortedMap <TabletServerId ,TServerStatus > currentStatus ,
57
- Set <TabletId > currentMigrations , List <TabletMigration > migrationsOut ,
58
- DataLevel currentLevel ) {
61
+ Set <TabletId > currentMigrations , List <TabletMigration > migrationsOut , DataLevel currentLevel ,
62
+ Map < String , TableId > tablesToBalance ) {
59
63
this .currentStatus = currentStatus ;
60
64
this .currentMigrations = currentMigrations ;
61
65
this .migrationsOut = migrationsOut ;
62
66
this .thriftCurrentStatus = null ;
63
67
this .thriftCurrentMigrations = null ;
64
68
this .currentDataLevel = currentLevel ;
69
+ this .tablesToBalance = tablesToBalance ;
65
70
}
66
71
67
72
private BalanceParamsImpl (SortedMap <TabletServerId ,TServerStatus > currentStatus ,
68
73
Set <TabletId > currentMigrations , List <TabletMigration > migrationsOut ,
69
74
SortedMap <TServerInstance ,TabletServerStatus > thriftCurrentStatus ,
70
- Set <KeyExtent > thriftCurrentMigrations , DataLevel currentLevel ) {
75
+ Set <KeyExtent > thriftCurrentMigrations , DataLevel currentLevel ,
76
+ Map <String ,TableId > tablesToBalance ) {
71
77
this .currentStatus = currentStatus ;
72
78
this .currentMigrations = currentMigrations ;
73
79
this .migrationsOut = migrationsOut ;
74
80
this .thriftCurrentStatus = thriftCurrentStatus ;
75
81
this .thriftCurrentMigrations = thriftCurrentMigrations ;
76
82
this .currentDataLevel = currentLevel ;
83
+ this .tablesToBalance = tablesToBalance ;
77
84
}
78
85
79
86
@ Override
@@ -110,4 +117,9 @@ public void addMigration(KeyExtent extent, TServerInstance oldServer, TServerIns
110
117
public String currentLevel () {
111
118
return currentDataLevel .name ();
112
119
}
120
+
121
+ @ Override
122
+ public Map <String ,TableId > getTablesToBalance () {
123
+ return tablesToBalance ;
124
+ }
113
125
}
0 commit comments