Skip to content

Commit a4af4f0

Browse files
committed
Merge branch 'main' into elasticity
2 parents d766696 + dd7b749 commit a4af4f0

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

server/manager/src/main/java/org/apache/accumulo/manager/upgrade/UpgradeCoordinator.java

+36-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434

3535
import org.apache.accumulo.core.Constants;
3636
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;
3741
import org.apache.accumulo.core.fate.ReadOnlyFateStore;
3842
import org.apache.accumulo.core.fate.ZooStore;
3943
import org.apache.accumulo.core.metadata.schema.Ample;
@@ -83,6 +87,15 @@ public boolean isParentLevelUpgraded(Ample.DataLevel level) {
8387
return level == Ample.DataLevel.METADATA || level == Ample.DataLevel.ROOT;
8488
}
8589
},
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+
},
8699
/**
87100
* This signifies that everything (zookeeper, root table, metadata table) is upgraded.
88101
*/
@@ -199,7 +212,6 @@ public synchronized Future<Void> upgradeMetadata(ServerContext context,
199212
"upgrade root: failed to find root upgrader for version " + currentVersion);
200213
upgraders.get(v).upgradeRoot(context);
201214
}
202-
203215
setStatus(UpgradeStatus.UPGRADED_ROOT, eventCoordinator);
204216

205217
for (int v = currentVersion; v < AccumuloDataVersion.get(); v++) {
@@ -211,6 +223,10 @@ public synchronized Future<Void> upgradeMetadata(ServerContext context,
211223
"upgrade metadata: failed to find upgrader for version " + currentVersion);
212224
upgraders.get(v).upgradeMetadata(context);
213225
}
226+
setStatus(UpgradeStatus.UPGRADED_METADATA, eventCoordinator);
227+
228+
log.info("Validating configuration properties.");
229+
validateProperties(context);
214230

215231
log.info("Updating persistent data version.");
216232
updateAccumuloVersion(context.getServerDirs(), context.getVolumeManager(),
@@ -227,6 +243,25 @@ public synchronized Future<Void> upgradeMetadata(ServerContext context,
227243
}
228244
}
229245

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+
230265
// visible for testing
231266
synchronized void updateAccumuloVersion(ServerDirs serverDirs, VolumeManager fs, int oldVersion) {
232267
for (Volume volume : fs.getVolumes()) {

0 commit comments

Comments
 (0)