34
34
35
35
import org .apache .accumulo .core .Constants ;
36
36
import org .apache .accumulo .core .client .AccumuloException ;
37
+ import org .apache .accumulo .core .client .AccumuloSecurityException ;
38
+ import org .apache .accumulo .core .client .NamespaceNotFoundException ;
39
+ import org .apache .accumulo .core .client .TableNotFoundException ;
40
+ import org .apache .accumulo .core .conf .ConfigCheckUtil ;
37
41
import org .apache .accumulo .core .fate .ReadOnlyFateStore ;
38
42
import org .apache .accumulo .core .fate .ZooStore ;
39
43
import org .apache .accumulo .core .metadata .schema .Ample ;
@@ -83,6 +87,15 @@ public boolean isParentLevelUpgraded(Ample.DataLevel level) {
83
87
return level == Ample .DataLevel .METADATA || level == Ample .DataLevel .ROOT ;
84
88
}
85
89
},
90
+ /**
91
+ * This signifies that zookeeper and the root and metadata tables have been upgraded so far.
92
+ */
93
+ UPGRADED_METADATA {
94
+ @ Override
95
+ public boolean isParentLevelUpgraded (Ample .DataLevel level ) {
96
+ return level == Ample .DataLevel .METADATA || level == Ample .DataLevel .ROOT ;
97
+ }
98
+ },
86
99
/**
87
100
* This signifies that everything (zookeeper, root table, metadata table) is upgraded.
88
101
*/
@@ -199,7 +212,6 @@ public synchronized Future<Void> upgradeMetadata(ServerContext context,
199
212
"upgrade root: failed to find root upgrader for version " + currentVersion );
200
213
upgraders .get (v ).upgradeRoot (context );
201
214
}
202
-
203
215
setStatus (UpgradeStatus .UPGRADED_ROOT , eventCoordinator );
204
216
205
217
for (int v = currentVersion ; v < AccumuloDataVersion .get (); v ++) {
@@ -211,6 +223,10 @@ public synchronized Future<Void> upgradeMetadata(ServerContext context,
211
223
"upgrade metadata: failed to find upgrader for version " + currentVersion );
212
224
upgraders .get (v ).upgradeMetadata (context );
213
225
}
226
+ setStatus (UpgradeStatus .UPGRADED_METADATA , eventCoordinator );
227
+
228
+ log .info ("Validating configuration properties." );
229
+ validateProperties (context );
214
230
215
231
log .info ("Updating persistent data version." );
216
232
updateAccumuloVersion (context .getServerDirs (), context .getVolumeManager (),
@@ -227,6 +243,25 @@ public synchronized Future<Void> upgradeMetadata(ServerContext context,
227
243
}
228
244
}
229
245
246
+ private void validateProperties (ServerContext context ) {
247
+ ConfigCheckUtil .validate (context .getSiteConfiguration (), "site configuration" );
248
+ ConfigCheckUtil .validate (context .getConfiguration (), "system configuration" );
249
+ try {
250
+ for (String ns : context .namespaceOperations ().list ()) {
251
+ ConfigCheckUtil .validate (
252
+ context .namespaceOperations ().getNamespaceProperties (ns ).entrySet (),
253
+ ns + " namespace configuration" );
254
+ }
255
+ for (String table : context .tableOperations ().list ()) {
256
+ ConfigCheckUtil .validate (context .tableOperations ().getTableProperties (table ).entrySet (),
257
+ table + " table configuration" );
258
+ }
259
+ } catch (AccumuloException | AccumuloSecurityException | NamespaceNotFoundException
260
+ | TableNotFoundException e ) {
261
+ throw new IllegalStateException ("Error checking properties" , e );
262
+ }
263
+ }
264
+
230
265
// visible for testing
231
266
synchronized void updateAccumuloVersion (ServerDirs serverDirs , VolumeManager fs , int oldVersion ) {
232
267
for (Volume volume : fs .getVolumes ()) {
0 commit comments