Skip to content

Commit

Permalink
Merge branch '2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
dlmarion committed Feb 22, 2024
2 parents e3d6204 + af50af7 commit dd7b749
Showing 1 changed file with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@

import org.apache.accumulo.core.Constants;
import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.NamespaceNotFoundException;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.conf.ConfigCheckUtil;
import org.apache.accumulo.core.dataImpl.KeyExtent;
import org.apache.accumulo.core.fate.ReadOnlyTStore;
import org.apache.accumulo.core.fate.ZooStore;
Expand Down Expand Up @@ -82,6 +86,15 @@ public boolean isParentLevelUpgraded(KeyExtent extent) {
return extent.isMeta();
}
},
/**
* This signifies that zookeeper and the root and metadata tables have been upgraded so far.
*/
UPGRADED_METADATA {
@Override
public boolean isParentLevelUpgraded(KeyExtent extent) {
return extent.isMeta();
}
},
/**
* This signifies that everything (zookeeper, root table, metadata table) is upgraded.
*/
Expand Down Expand Up @@ -197,7 +210,6 @@ public synchronized Future<Void> upgradeMetadata(ServerContext context,
"upgrade root: failed to find root upgrader for version " + currentVersion);
upgraders.get(v).upgradeRoot(context);
}

setStatus(UpgradeStatus.UPGRADED_ROOT, eventCoordinator);

for (int v = currentVersion; v < AccumuloDataVersion.get(); v++) {
Expand All @@ -209,6 +221,10 @@ public synchronized Future<Void> upgradeMetadata(ServerContext context,
"upgrade metadata: failed to find upgrader for version " + currentVersion);
upgraders.get(v).upgradeMetadata(context);
}
setStatus(UpgradeStatus.UPGRADED_METADATA, eventCoordinator);

log.info("Validating configuration properties.");
validateProperties(context);

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

private void validateProperties(ServerContext context) {
ConfigCheckUtil.validate(context.getSiteConfiguration(), "site configuration");
ConfigCheckUtil.validate(context.getConfiguration(), "system configuration");
try {
for (String ns : context.namespaceOperations().list()) {
ConfigCheckUtil.validate(
context.namespaceOperations().getNamespaceProperties(ns).entrySet(),
ns + " namespace configuration");
}
for (String table : context.tableOperations().list()) {
ConfigCheckUtil.validate(context.tableOperations().getTableProperties(table).entrySet(),
table + " table configuration");
}
} catch (AccumuloException | AccumuloSecurityException | NamespaceNotFoundException
| TableNotFoundException e) {
throw new IllegalStateException("Error checking properties", e);
}
}

// visible for testing
synchronized void updateAccumuloVersion(ServerDirs serverDirs, VolumeManager fs, int oldVersion) {
for (Volume volume : fs.getVolumes()) {
Expand Down

0 comments on commit dd7b749

Please sign in to comment.