Search in sources :

Example 1 with Source

use of alluxio.conf.Source in project alluxio by Alluxio.

the class DefaultBlockWorker method getConfiguration.

@Override
public Configuration getConfiguration(GetConfigurationPOptions options) {
    // NOTE(cc): there is no guarantee that the returned cluster and path configurations are
    // consistent snapshot of the system's state at a certain time, the path configuration might
    // be in a newer state. But it's guaranteed that the hashes are respectively correspondent to
    // the properties.
    Configuration.Builder builder = Configuration.newBuilder();
    if (!options.getIgnoreClusterConf()) {
        Set<PropertyKey> keys = ServerConfiguration.keySet();
        for (PropertyKey key : ServerConfiguration.keySet()) {
            if (key.isBuiltIn()) {
                Source source = ServerConfiguration.getSource(key);
                Object value = ServerConfiguration.getOrDefault(key, null, ConfigurationValueOptions.defaults().useDisplayValue(true).useRawValue(options.getRawValue()));
                builder.addClusterProperty(key.getName(), value, source);
            }
        }
        // NOTE(cc): assumes that ServerConfiguration is read-only when master is running, otherwise,
        // the following hash might not correspond to the above cluster configuration.
        builder.setClusterConfHash(ServerConfiguration.hash());
    }
    return builder.build();
}
Also used : Configuration(alluxio.wire.Configuration) ServerConfiguration(alluxio.conf.ServerConfiguration) PropertyKey(alluxio.conf.PropertyKey) Source(alluxio.conf.Source)

Example 2 with Source

use of alluxio.conf.Source in project alluxio by Alluxio.

the class DefaultMetaMaster method getConfiguration.

@Override
public Configuration getConfiguration(GetConfigurationPOptions options) {
    // NOTE(cc): there is no guarantee that the returned cluster and path configurations are
    // consistent snapshot of the system's state at a certain time, the path configuration might
    // be in a newer state. But it's guaranteed that the hashes are respectively correspondent to
    // the properties.
    Configuration.Builder builder = Configuration.newBuilder();
    if (!options.getIgnoreClusterConf()) {
        for (PropertyKey key : ServerConfiguration.keySet()) {
            if (key.isBuiltIn()) {
                Source source = ServerConfiguration.getSource(key);
                Object value = ServerConfiguration.getOrDefault(key, null, ConfigurationValueOptions.defaults().useDisplayValue(true).useRawValue(options.getRawValue()));
                builder.addClusterProperty(key.getName(), value, source);
            }
        }
        // NOTE(cc): assumes that ServerConfiguration is read-only when master is running, otherwise,
        // the following hash might not correspond to the above cluster configuration.
        builder.setClusterConfHash(ServerConfiguration.hash());
    }
    if (!options.getIgnorePathConf()) {
        PathPropertiesView pathProperties = mPathProperties.snapshot();
        pathProperties.getProperties().forEach((path, properties) -> properties.forEach((key, value) -> builder.addPathProperty(path, key, value)));
        builder.setPathConfHash(pathProperties.getHash());
    }
    return builder.build();
}
Also used : Configuration(alluxio.wire.Configuration) SystemClock(alluxio.clock.SystemClock) CloseableIterator(alluxio.resource.CloseableIterator) LoggerFactory(org.slf4j.LoggerFactory) Server(alluxio.Server) PropertyKey(alluxio.conf.PropertyKey) MetaCommand(alluxio.grpc.MetaCommand) GrpcService(alluxio.grpc.GrpcService) HeartbeatThread(alluxio.heartbeat.HeartbeatThread) Map(java.util.Map) ClientContext(alluxio.ClientContext) IndexDefinition(alluxio.collections.IndexDefinition) BackupPRequest(alluxio.grpc.BackupPRequest) IndexedSet(alluxio.collections.IndexedSet) ImmutableSet(com.google.common.collect.ImmutableSet) ServerConfiguration(alluxio.conf.ServerConfiguration) Set(java.util.Set) AlluxioException(alluxio.exception.AlluxioException) CheckpointName(alluxio.master.journal.checkpoint.CheckpointName) InetSocketAddress(java.net.InetSocketAddress) Executors(java.util.concurrent.Executors) RegisterMasterPOptions(alluxio.grpc.RegisterMasterPOptions) BackupRole(alluxio.master.backup.BackupRole) List(java.util.List) Source(alluxio.conf.Source) ServiceType(alluxio.grpc.ServiceType) CoreMasterContext(alluxio.master.CoreMasterContext) Optional(java.util.Optional) Journal(alluxio.proto.journal.Journal) UfsManager(alluxio.underfs.UfsManager) JournalContext(alluxio.master.journal.JournalContext) UnavailableException(alluxio.exception.status.UnavailableException) GetConfigurationPOptions(alluxio.grpc.GetConfigurationPOptions) HashMap(java.util.HashMap) OSUtils(alluxio.util.OSUtils) NetworkAddressUtils(alluxio.util.network.NetworkAddressUtils) ConfigHash(alluxio.wire.ConfigHash) BlockMaster(alluxio.master.block.BlockMaster) Scope(alluxio.grpc.Scope) JournalType(alluxio.master.journal.JournalType) Constants(alluxio.Constants) Meta(alluxio.proto.journal.Meta) Nullable(javax.annotation.Nullable) ConfigurationValueOptions(alluxio.conf.ConfigurationValueOptions) CoreMaster(alluxio.master.CoreMaster) Logger(org.slf4j.Logger) HeartbeatContext(alluxio.heartbeat.HeartbeatContext) ServerConfigurationStore(alluxio.master.meta.checkconf.ServerConfigurationStore) IdUtils(alluxio.util.IdUtils) ExceptionMessage(alluxio.exception.ExceptionMessage) HeartbeatExecutor(alluxio.heartbeat.HeartbeatExecutor) IOException(java.io.IOException) ThreadFactoryUtils(alluxio.util.ThreadFactoryUtils) NotFoundException(alluxio.exception.status.NotFoundException) LockResource(alluxio.resource.LockResource) ConfigurationUtils(alluxio.util.ConfigurationUtils) ExecutorServiceFactory(alluxio.util.executor.ExecutorServiceFactory) MasterClientContext(alluxio.master.MasterClientContext) BackupLeaderRole(alluxio.master.backup.BackupLeaderRole) BackupStatusPRequest(alluxio.grpc.BackupStatusPRequest) Clock(java.time.Clock) BackupStatus(alluxio.wire.BackupStatus) StateLockOptions(alluxio.master.StateLockOptions) ServerConfigurationChecker(alluxio.master.meta.checkconf.ServerConfigurationChecker) ExecutorServiceFactories(alluxio.util.executor.ExecutorServiceFactories) Collections(java.util.Collections) BackupWorkerRole(alluxio.master.backup.BackupWorkerRole) Address(alluxio.wire.Address) ConfigCheckReport(alluxio.wire.ConfigCheckReport) NotThreadSafe(javax.annotation.concurrent.NotThreadSafe) Configuration(alluxio.wire.Configuration) ServerConfiguration(alluxio.conf.ServerConfiguration) PropertyKey(alluxio.conf.PropertyKey) Source(alluxio.conf.Source)

Aggregations

PropertyKey (alluxio.conf.PropertyKey)2 ServerConfiguration (alluxio.conf.ServerConfiguration)2 Source (alluxio.conf.Source)2 ClientContext (alluxio.ClientContext)1 Constants (alluxio.Constants)1 Server (alluxio.Server)1 SystemClock (alluxio.clock.SystemClock)1 IndexDefinition (alluxio.collections.IndexDefinition)1 IndexedSet (alluxio.collections.IndexedSet)1 ConfigurationValueOptions (alluxio.conf.ConfigurationValueOptions)1 AlluxioException (alluxio.exception.AlluxioException)1 ExceptionMessage (alluxio.exception.ExceptionMessage)1 NotFoundException (alluxio.exception.status.NotFoundException)1 UnavailableException (alluxio.exception.status.UnavailableException)1 BackupPRequest (alluxio.grpc.BackupPRequest)1 BackupStatusPRequest (alluxio.grpc.BackupStatusPRequest)1 GetConfigurationPOptions (alluxio.grpc.GetConfigurationPOptions)1 GrpcService (alluxio.grpc.GrpcService)1 MetaCommand (alluxio.grpc.MetaCommand)1 RegisterMasterPOptions (alluxio.grpc.RegisterMasterPOptions)1