Examples of PolicyInfo


Examples of gov.nasa.arc.mct.policy.PolicyInfo

  public EvaluatorComponentProvider() {
    infos = Arrays.asList(new ComponentTypeInfo(
        bundle.getString("display_name")
        bundle.getString("description"),
        EvaluatorComponent.class));
    policies.add(new PolicyInfo(PolicyInfo.CategoryType.FILTER_VIEW_ROLE.getKey(), EvaluatorViewPolicy.class));
    policies.add(new PolicyInfo(PolicyInfo.CategoryType.FILTER_VIEW_ROLE.getKey(), EnumeratorViewPolicy.class));
  }
View Full Code Here

Examples of gov.nasa.arc.mct.policy.PolicyInfo

  /**
   * Creates a new view provider service object. Initializes the set
   * of objects that will be provided to the core.
   */
  public TableViewProvider() {
    policyInfos = Collections.singleton(new PolicyInfo(PolicyInfo.CategoryType.FILTER_VIEW_ROLE.getKey(), TableViewPolicy.class));
    viewInfos = Arrays.asList(
        new ViewInfo(TableViewManifestation.class, TableViewManifestation.VIEW_ROLE_NAME, "gov.nasa.arc.mct.table.view.TableViewRole", ViewType.OBJECT),
        new ViewInfo(TableViewManifestation.class, TableViewManifestation.VIEW_ROLE_NAME, "gov.nasa.arc.mct.table.view.TableViewRole", ViewType.EMBEDDED));
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.protocol.PolicyInfo

  /**
   * Fix a specific file
   */
  private void fixFile(Path badFile) throws IOException {

    PolicyInfo pinfo = null;
    String filename = badFile.toString();

    LOG.info("File  = file to fix:" + badFile);

    // Find the policy that maps this file
    for (PathToPolicy pp: pathToPolicy) {
      if (filename.startsWith(pp.spath)) {
        pinfo = pp.pinfo;
        break;
      }
    }
    if (pinfo == null) {
      throw new IOException("Unable to find matching policy for " +
                            badFile);
    }

    // process the file and fix it.
    Path src;
    HighTideNode.getMetrics().fixAttempt.inc();
   
    if (filename.startsWith(pinfo.getSrcPath().toString())) {
      // srcPath is corrupted, pick the first destPath as source of truth.
      String[] splits = filename.split(pinfo.getSrcPath().toString());
      src = new Path(pinfo.getDestPaths().get(0).rpath.toString() + splits[1]);
    } else {
      // dest file is corrupted, copy from source to destination
      String[] splits = filename.split(pinfo.getDestPaths().get(0).rpath.toString());
      src = new Path(pinfo.getSrcPath().toString() + splits[1]);
    }
    DistributedFileSystem srcFs = (DistributedFileSystem) src.getFileSystem(pinfo.getConf());
    DistributedFileSystem destFs = (DistributedFileSystem) badFile.getFileSystem(pinfo.getConf());

    FileStatus sstat = srcFs.getFileStatus(src);
    FileStatus dstat = destFs.getFileStatus(badFile);

    // assert that modtime of the two files are same
View Full Code Here

Examples of org.apache.hadoop.raid.protocol.PolicyInfo

    mySetup(1, 1);
    Path dir = new Path("/user/test/raidtest");
    Path file1 = new Path(dir + "/file1");
    HashMap<String, PolicyInfo> infos = new HashMap<String, PolicyInfo>();
    for (Codec code: Codec.getCodecs()) {
      PolicyInfo pi = new PolicyInfo("testPurgePreference", conf);
      pi.setSrcPath("/user/test/raidtest");
      pi.setCodecId(code.id);
      pi.setDescription("test policy");
      pi.setProperty("targetReplication", "1");
      pi.setProperty("metaReplication", "1");
      infos.put(code.id, pi);
    }
   
    try {
      LOG.info("Create a old file");
      TestRaidNode.createOldFile(fileSys, file1, 1, 9, 8192L);
      FileStatus stat = fileSys.getFileStatus(file1);
      FileStatus dirStat = fileSys.getFileStatus(dir);
      HashMap<String, Path> parityFiles = new HashMap<String, Path>();
      // Create the parity files.
      LOG.info("Start Raiding");
      for (PolicyInfo pi: infos.values()){
        Codec code = Codec.getCodec(pi.getCodecId());
        FileStatus fsStat = (code.isDirRaid)? dirStat: stat;
        RaidNode.doRaid(
          conf, pi, fsStat, new RaidNode.Statistics(), Reporter.NULL);
        Path parity = RaidNode.getOriginalParityFile(new Path(code.parityDirectory),
              fsStat.getPath());
        assertTrue(fileSys.exists(parity));
        parityFiles.put(pi.getCodecId(), parity);
      }
      LOG.info("Finished Raiding");
      // Check purge of a single parity file.
      PurgeMonitor purgeMonitor = new PurgeMonitor(conf, null);
      LOG.info("Purge testrs");
      purgeMonitor.purgeCode(Codec.getCodec("testrs"));
      // Simulate code couldn't purge normal code even with higher priority
      assertTrue(fileSys.exists(parityFiles.get("testrs")));
      assertTrue(fileSys.exists(parityFiles.get("dir-rs")));
      assertTrue(fileSys.exists(parityFiles.get("rs")));
      assertTrue(fileSys.exists(parityFiles.get("dir-xor")));
      assertTrue(fileSys.exists(parityFiles.get("xor")));
     
      LOG.info("Purge dir-rs");
      purgeMonitor.purgeCode(Codec.getCodec("dir-rs"));
      // Calling purge under the Dir-RS path has no effect.
      assertTrue(fileSys.exists(parityFiles.get("testrs")));
      assertTrue(fileSys.exists(parityFiles.get("dir-rs")));
      assertTrue(fileSys.exists(parityFiles.get("rs")));
      assertTrue(fileSys.exists(parityFiles.get("dir-xor")));
      assertTrue(fileSys.exists(parityFiles.get("xor")));
     
      LOG.info("Purge rs");
      purgeMonitor.purgeCode(Codec.getCodec("rs"));
      // Calling purge under the rs path will delete rs
      assertTrue(fileSys.exists(parityFiles.get("testrs")));
      assertTrue(fileSys.exists(parityFiles.get("dir-rs")));
      assertFalse(fileSys.exists(parityFiles.get("rs")));
      assertTrue(fileSys.exists(parityFiles.get("dir-xor")));
      assertTrue(fileSys.exists(parityFiles.get("xor")));
     
      LOG.info("Purge dir-xor");
      purgeMonitor.purgeCode(Codec.getCodec("dir-xor"));
      // Calling purge under the Dir-xor path will delete dir-xor
      assertTrue(fileSys.exists(parityFiles.get("testrs")));
      assertTrue(fileSys.exists(parityFiles.get("dir-rs")));
      assertFalse(fileSys.exists(parityFiles.get("dir-xor")));
      assertTrue(fileSys.exists(parityFiles.get("xor")));
     
      LOG.info("Purge xor");
      purgeMonitor.purgeCode(Codec.getCodec("xor"));
      assertFalse(fileSys.exists(parityFiles.get("xor")));
      assertTrue(fileSys.exists(parityFiles.get("testrs")));
      assertTrue(fileSys.exists(parityFiles.get("dir-rs")));
     
      LOG.info("delete dir-rs parity file");
      fileSys.delete(parityFiles.get("dir-rs"), true);
      assertFalse(fileSys.exists(parityFiles.get("dir-rs")));
      //Recreate RS and Dir-XOR
      LOG.info("Raid rs");
      RaidNode.doRaid(
          conf, infos.get("rs"), stat, new RaidNode.Statistics(),
          Reporter.NULL);
      assertTrue(fileSys.exists(parityFiles.get("rs")));
      LOG.info("Raid dir-xor");
      RaidNode.doRaid(
          conf, infos.get("dir-xor"), dirStat, new RaidNode.Statistics(),
          Reporter.NULL);
      assertTrue(fileSys.exists(parityFiles.get("dir-xor")));
      LOG.info("Raid xor");
      RaidNode.doRaid(
          conf, infos.get("xor"), stat, new RaidNode.Statistics(),
          Reporter.NULL);
      assertTrue(fileSys.exists(parityFiles.get("xor")));
     
      LOG.info("Purge dir-xor should fail because rs doesn't have parity " +
          "file for directory, only dir-rs could purge dir-xor");
      purgeMonitor.purgeCode(Codec.getCodec("dir-xor"));
      // Calling purge under the Dir-XOR path succeeds
      assertTrue(fileSys.exists(parityFiles.get("testrs")));
      assertTrue(fileSys.exists(parityFiles.get("rs")));
      assertTrue(fileSys.exists(parityFiles.get("dir-xor")));
      assertTrue(fileSys.exists(parityFiles.get("xor")));
     
      LOG.info("delete dir-xor parity file");
      fileSys.delete(parityFiles.get("dir-xor"), true);
      assertFalse(fileSys.exists(parityFiles.get("dir-xor")));
     
      LOG.info("Purge xor");
      purgeMonitor.purgeCode(Codec.getCodec("xor"));
      // Calling purge under the Dir-RS path has no effect.
      assertTrue(fileSys.exists(parityFiles.get("testrs")));
      assertTrue(fileSys.exists(parityFiles.get("rs")));
      assertFalse(fileSys.exists(parityFiles.get("xor")));
     
      // The following is har related stuff
      
      Path rsParity = parityFiles.get("rs");
      Path xorParity = parityFiles.get("xor");
      PolicyInfo infoXor = infos.get("xor");
      PolicyInfo infoRs = infos.get("rs");
      // Now check the purge of a parity har.
      // Delete the RS parity for now.
      fileSys.delete(rsParity, true);
      // Recreate the XOR parity.
      Path xorHar = new Path("/raid", "user/test/raidtest/raidtest" +
View Full Code Here

Examples of org.apache.hadoop.raid.protocol.PolicyInfo

  }

  public void verifyDirRaidSourceCollect(String codecId, FileSystem fs,
                                         boolean writeAndRestoreSnapshot)
                                             throws IOException {
    PolicyInfo info = new PolicyInfo("Test-Dir-Raid-" + codecId, conf);
    info.setSrcPath("/a");
    info.setProperty("modTimePeriod", "0");
    info.setProperty("targetReplication", "1");
    info.setCodecId(codecId);
   
    PolicyInfo infoTooNew = new PolicyInfo("Test-Too-New-" + codecId, conf);
    infoTooNew.setSrcPath("/new");
    infoTooNew.setProperty("modTimePeriod", "" + Long.MAX_VALUE);
    infoTooNew.setProperty("targetReplication", "1");
    infoTooNew.setCodecId(codecId);
   
    createFile(fs, new Path("/a/b/NOT_RAIDED1"), 1, 1, 10240L);
    createFile(fs, new Path("/a/b/NOT_RAIDED2"), 2, 2, 10240L);
    createFile(fs, new Path("/a/b/NOT_RAIDED3"), 1, 3, 10240L);
   
View Full Code Here

Examples of org.apache.hadoop.raid.protocol.PolicyInfo

  }
 
  public void verifySourceCollect(String codecId, FileSystem fs,
                                  boolean writeAndRestoreSnapshot)
      throws Exception {
    PolicyInfo info = new PolicyInfo("Test-Raided-" + codecId, conf);
    info.setSrcPath("/a/b");
    info.setProperty("modTimePeriod", "0");
    info.setProperty("targetReplication", "1");
    info.setCodecId(codecId);

    PolicyInfo infoTooNew = new PolicyInfo("Test-Too-New-" + codecId, conf);
    infoTooNew.setSrcPath("/a/new");
    infoTooNew.setProperty("modTimePeriod", "" + Long.MAX_VALUE);
    infoTooNew.setProperty("targetReplication", "1");
    infoTooNew.setCodecId(codecId);

    createFile(fs, new Path("/a/b/TOO_SMALL"), 1, 1, 1024L);
    createFile(fs, new Path("/a/b/d/TOO_SMALL"), 2, 2, 1024L);
    createFile(fs, new Path("/a/b/f/g/RAIDED"), 1, 3, 1024L);
    createFile(fs, new Path("/a/b/f/g/h/RAIDED"), 1, 4, 1024L);
View Full Code Here

Examples of org.apache.hadoop.raid.protocol.PolicyInfo

    LOG.info("Statistics html:\n " + st.htmlTable());
    fs.delete(parityPath, true);
  }

  public void verifyLongPrefixOverride(FileSystem fs) throws Exception {
    PolicyInfo info = new PolicyInfo("Test", conf);
    info.setSrcPath("/a/b");
    info.setProperty("modTimePeriod", "0");
    info.setProperty("targetReplication", "1");
    info.setCodecId("rs");

    PolicyInfo infoLongPrefix = new PolicyInfo("Long-Prefix", conf);
    infoLongPrefix.setSrcPath("/a/b/c");
    infoLongPrefix.setProperty("modTimePeriod", "0");
    infoLongPrefix.setProperty("targetReplication", "2");
    infoLongPrefix.setCodecId("xor");

    createFile(fs, new Path("/a/b/k"), 3, 4, 1024L);
    createFile(fs, new Path("/a/b/c/d"), 3, 5, 1024L);
    StatisticsCollector collector =
        new StatisticsCollector(fakeRaidNode, fakeConfigManager, conf);
View Full Code Here

Examples of org.apache.hadoop.raid.protocol.PolicyInfo

    assertCounters(rsOther, 1, 5, 15 * 1024L, 5 * 1024L);
    fs.delete(new Path("/a"), true);
  }

  public void verifyRsCodeOverride(FileSystem fs) throws Exception {
    PolicyInfo info = new PolicyInfo("Test", conf);
    info.setSrcPath("/a/b/*");
    info.setProperty("modTimePeriod", "0");
    info.setProperty("targetReplication", "1");
    info.setCodecId("xor");

    PolicyInfo infoLongPrefix = new PolicyInfo("Long-Prefix", conf);
    infoLongPrefix.setSrcPath("/a/b/c");
    infoLongPrefix.setProperty("modTimePeriod", "0");
    infoLongPrefix.setProperty("targetReplication", "2");
    infoLongPrefix.setCodecId("rs");

    createFile(fs, new Path("/a/b/k"), 3, 4, 1024L);
    createFile(fs, new Path("/a/b/c/d"), 3, 5, 1024L);
    StatisticsCollector collector =
        new StatisticsCollector(fakeRaidNode, fakeConfigManager, conf);
View Full Code Here

Examples of org.apache.hadoop.raid.protocol.PolicyInfo

      FileSystem fs = srcs.getFileSystem(job);

      List<FileSplit> splits = new ArrayList<FileSplit>(numSplits);

      Text key = new Text();
      PolicyInfo value = new PolicyInfo();
      SequenceFile.Reader in = null;
      long prev = 0L;
      int count = 0; // count src
      try {
        for (in = new SequenceFile.Reader(fs, srcs, job); in.next(key, value);) {
View Full Code Here

Examples of org.apache.hadoop.raid.protocol.PolicyInfo

    SAXException, RaidConfigurationException,
    ClassNotFoundException, ParserConfigurationException {
    // find the matched raid policy
    String policyName = args[startIndex++];
    ConfigManager configManager = new ConfigManager(conf);
    PolicyInfo policy = configManager.getPolicy(policyName);
    if (policy == null) {
      System.err.println ("Invalid policy: " + policyName);
      return -1;
    }
    Codec codec = Codec.getCodec(policy.getCodecId());
    if (codec == null) {
      System.err.println("Policy " + policyName
          + " with invalid codec " + policy.getCodecId());
    }

    // find the matched paths to raid
    FileSystem fs = FileSystem.get(conf);
    List<FileStatus> pathsToRaid = new ArrayList<FileStatus>();
    List<Path> policySrcPaths = policy.getSrcPathExpanded();
    for (int i = startIndex; i< args.length; i++) {
      boolean invalidPathToRaid = true;
      Path pathToRaid = new Path(args[i]).makeQualified(fs);
      String pathToRaidStr = pathToRaid.toString();
      if (!pathToRaidStr.endsWith(Path.SEPARATOR)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.