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