Skip to content

Commit dd7b749

Browse files
committedFeb 22, 2024
Merge branch '2.1'
2 parents e3d6204 + af50af7 commit dd7b749

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
@@ -33,6 +33,10 @@
3333

3434
import org.apache.accumulo.core.Constants;
3535
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;
3640
import org.apache.accumulo.core.dataImpl.KeyExtent;
3741
import org.apache.accumulo.core.fate.ReadOnlyTStore;
3842
import org.apache.accumulo.core.fate.ZooStore;
@@ -82,6 +86,15 @@ public boolean isParentLevelUpgraded(KeyExtent extent) {
8286
return extent.isMeta();
8387
}
8488
},
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+
},
8598
/**
8699
* This signifies that everything (zookeeper, root table, metadata table) is upgraded.
87100
*/
@@ -197,7 +210,6 @@ public synchronized Future<Void> upgradeMetadata(ServerContext context,
197210
"upgrade root: failed to find root upgrader for version " + currentVersion);
198211
upgraders.get(v).upgradeRoot(context);
199212
}
200-
201213
setStatus(UpgradeStatus.UPGRADED_ROOT, eventCoordinator);
202214

203215
for (int v = currentVersion; v < AccumuloDataVersion.get(); v++) {
@@ -209,6 +221,10 @@ public synchronized Future<Void> upgradeMetadata(ServerContext context,
209221
"upgrade metadata: failed to find upgrader for version " + currentVersion);
210222
upgraders.get(v).upgradeMetadata(context);
211223
}
224+
setStatus(UpgradeStatus.UPGRADED_METADATA, eventCoordinator);
225+
226+
log.info("Validating configuration properties.");
227+
validateProperties(context);
212228

213229
log.info("Updating persistent data version.");
214230
updateAccumuloVersion(context.getServerDirs(), context.getVolumeManager(),
@@ -225,6 +241,25 @@ public synchronized Future<Void> upgradeMetadata(ServerContext context,
225241
}
226242
}
227243

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

0 commit comments

Comments
 (0)