Search in sources :

Example 1 with ZooConfiguration

use of org.apache.accumulo.server.conf.ZooConfiguration in project accumulo by apache.

the class ServerContext method getConfiguration.

@Override
public AccumuloConfiguration getConfiguration() {
    if (systemConfig == null) {
        // system configuration uses its own instance of ZooCache
        // this could be useful to keep its update counter independent
        ZooCache propCache = new ZooCache(new ZooReader(getZooKeepers(), getZooKeepersSessionTimeOut()), null);
        systemConfig = new ZooConfiguration(this, propCache, getSiteConfiguration());
    }
    return systemConfig;
}
Also used : ZooReader(org.apache.accumulo.fate.zookeeper.ZooReader) ZooConfiguration(org.apache.accumulo.server.conf.ZooConfiguration) ZooCache(org.apache.accumulo.fate.zookeeper.ZooCache)

Example 2 with ZooConfiguration

use of org.apache.accumulo.server.conf.ZooConfiguration in project accumulo by apache.

the class Upgrader9to10 method renameOldMasterPropsinZK.

@SuppressWarnings("deprecation")
private void renameOldMasterPropsinZK(ServerContext context) {
    // Rename all of the properties only set in ZooKeeper that start with "master." to rename and
    // store them starting with "manager." instead.
    var zooConfiguration = new ZooConfiguration(context, context.getZooCache(), new ConfigurationCopy());
    zooConfiguration.getAllPropertiesWithPrefix(Property.MASTER_PREFIX).forEach((original, value) -> {
        DeprecatedPropertyUtil.getReplacementName(original, (log, replacement) -> {
            log.info("Automatically renaming deprecated property '{}' with its replacement '{}'" + " in ZooKeeper on upgrade.", original, replacement);
            try {
                // Set the property under the new name
                SystemPropUtil.setSystemProperty(context, replacement, value);
                SystemPropUtil.removePropWithoutDeprecationWarning(context, original);
            } catch (KeeperException | InterruptedException e) {
                throw new RuntimeException("Unable to upgrade system properties", e);
            }
        });
    });
}
Also used : ConfigurationCopy(org.apache.accumulo.core.conf.ConfigurationCopy) ZooConfiguration(org.apache.accumulo.server.conf.ZooConfiguration) KeeperException(org.apache.zookeeper.KeeperException)

Aggregations

ZooConfiguration (org.apache.accumulo.server.conf.ZooConfiguration)2 ConfigurationCopy (org.apache.accumulo.core.conf.ConfigurationCopy)1 ZooCache (org.apache.accumulo.fate.zookeeper.ZooCache)1 ZooReader (org.apache.accumulo.fate.zookeeper.ZooReader)1 KeeperException (org.apache.zookeeper.KeeperException)1