Search in sources :

Example 1 with StaticClusterAgentsFactory

use of com.github.ambry.clustermap.StaticClusterAgentsFactory in project ambry by linkedin.

the class ConsistencyCheckerTool method main.

public static void main(String[] args) throws Exception {
    VerifiableProperties properties = ToolUtils.getVerifiableProperties(args);
    ConsistencyCheckerToolConfig config = new ConsistencyCheckerToolConfig(properties);
    ClusterMapConfig clusterMapConfig = new ClusterMapConfig(properties);
    ServerConfig serverConfig = new ServerConfig(properties);
    try (ClusterMap clusterMap = new StaticClusterAgentsFactory(clusterMapConfig, config.hardwareLayoutFilePath, config.partitionLayoutFilePath).getClusterMap()) {
        StoreToolsMetrics metrics = new StoreToolsMetrics(clusterMap.getMetricRegistry());
        StoreConfig storeConfig = new StoreConfig(properties);
        // this tool supports only blob IDs. It can become generic if StoreKeyFactory provides a deserFromString method.
        BlobIdFactory blobIdFactory = new BlobIdFactory(clusterMap);
        Set<StoreKey> filterKeySet = new HashSet<>();
        for (String key : config.filterSet) {
            filterKeySet.add(new BlobId(key, clusterMap));
        }
        Time time = SystemTime.getInstance();
        Throttler throttler = new Throttler(config.indexEntriesToProcessPerSec, 1000, true, time);
        StoreKeyConverterFactory storeKeyConverterFactory = Utils.getObj(serverConfig.serverStoreKeyConverterFactory, properties, clusterMap.getMetricRegistry());
        ConsistencyCheckerTool consistencyCheckerTool = new ConsistencyCheckerTool(clusterMap, blobIdFactory, storeConfig, filterKeySet, throttler, metrics, time, storeKeyConverterFactory.getStoreKeyConverter());
        boolean success = consistencyCheckerTool.checkConsistency(config.pathOfInput.listFiles(File::isDirectory)).getFirst();
        System.exit(success ? 0 : 1);
    }
}
Also used : ClusterMap(com.github.ambry.clustermap.ClusterMap) VerifiableProperties(com.github.ambry.config.VerifiableProperties) SystemTime(com.github.ambry.utils.SystemTime) Time(com.github.ambry.utils.Time) ClusterMapConfig(com.github.ambry.config.ClusterMapConfig) BlobIdFactory(com.github.ambry.commons.BlobIdFactory) ServerConfig(com.github.ambry.config.ServerConfig) StaticClusterAgentsFactory(com.github.ambry.clustermap.StaticClusterAgentsFactory) StoreConfig(com.github.ambry.config.StoreConfig) BlobId(com.github.ambry.commons.BlobId) File(java.io.File) HashSet(java.util.HashSet) Throttler(com.github.ambry.utils.Throttler)

Example 2 with StaticClusterAgentsFactory

use of com.github.ambry.clustermap.StaticClusterAgentsFactory in project ambry by linkedin.

the class CompactionVerifier method main.

/**
 * Main function to trigger the verifier.
 * @param args CLI arguments
 * @throws Exception if the verifier encountered problems.
 */
public static void main(String[] args) throws Exception {
    VerifiableProperties verifiableProperties = ToolUtils.getVerifiableProperties(args);
    CompactionVerifierConfig verifierConfig = new CompactionVerifierConfig(verifiableProperties);
    StoreConfig storeConfig = new StoreConfig(verifiableProperties);
    assert !storeConfig.storeEnableHardDelete : "Hard delete cannot be enabled in the properties";
    ClusterMapConfig clusterMapConfig = new ClusterMapConfig(verifiableProperties);
    ClusterMap clusterMap = new StaticClusterAgentsFactory(clusterMapConfig, verifierConfig.hardwareLayoutFilePath, verifierConfig.partitionLayoutFilePath).getClusterMap();
    StoreKeyFactory storeKeyFactory = Utils.getObj(storeConfig.storeKeyFactory, clusterMap);
    try (CompactionVerifier compactionVerifier = new CompactionVerifier(verifierConfig, storeConfig, storeKeyFactory)) {
        compactionVerifier.verifyCompaction();
    }
    LOGGER.info("Verification completed successfully");
}
Also used : ClusterMap(com.github.ambry.clustermap.ClusterMap) StaticClusterAgentsFactory(com.github.ambry.clustermap.StaticClusterAgentsFactory) VerifiableProperties(com.github.ambry.config.VerifiableProperties) StoreConfig(com.github.ambry.config.StoreConfig) ClusterMapConfig(com.github.ambry.config.ClusterMapConfig)

Aggregations

ClusterMap (com.github.ambry.clustermap.ClusterMap)2 StaticClusterAgentsFactory (com.github.ambry.clustermap.StaticClusterAgentsFactory)2 ClusterMapConfig (com.github.ambry.config.ClusterMapConfig)2 StoreConfig (com.github.ambry.config.StoreConfig)2 VerifiableProperties (com.github.ambry.config.VerifiableProperties)2 BlobId (com.github.ambry.commons.BlobId)1 BlobIdFactory (com.github.ambry.commons.BlobIdFactory)1 ServerConfig (com.github.ambry.config.ServerConfig)1 SystemTime (com.github.ambry.utils.SystemTime)1 Throttler (com.github.ambry.utils.Throttler)1 Time (com.github.ambry.utils.Time)1 File (java.io.File)1 HashSet (java.util.HashSet)1