Examples of VolumeManager


Examples of org.apache.accumulo.server.fs.VolumeManager

  private static List<Mutation> recover(Map<String,KeyValue[]> logs, Set<String> files, KeyExtent extent) throws IOException {
    TemporaryFolder root = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
    root.create();
    final String workdir = root.getRoot().getAbsolutePath() + "/workdir";
    VolumeManager fs = VolumeManagerImpl.getLocal(workdir);
    final Path workdirPath = new Path("file://" + workdir);
    fs.deleteRecursively(workdirPath);
    ArrayList<Path> dirs = new ArrayList<Path>();
    try {
      for (Entry<String,KeyValue[]> entry : logs.entrySet()) {
        String path = workdir + "/" + entry.getKey();
        FileSystem ns = fs.getVolumeByPath(new Path(path)).getFileSystem();
        @SuppressWarnings("deprecation")
        Writer map = new MapFile.Writer(ns.getConf(), ns, path + "/log1", LogFileKey.class, LogFileValue.class);
        for (KeyValue lfe : entry.getValue()) {
          map.append(lfe.key, lfe.value);
        }
View Full Code Here

Examples of org.apache.accumulo.server.fs.VolumeManager

    }
   
    if (refCount == 0) {
      // delete the map files
      try {
        VolumeManager fs = master.getFileSystem();
        for (String dir : ServerConstants.getTablesDirs()) {
          fs.deleteRecursively(new Path(dir, tableId));
        }
      } catch (IOException e) {
        log.error("Unable to remove deleted table directory", e);
      } catch (IllegalArgumentException exception) {
        if (exception.getCause() instanceof UnknownHostException) {
View Full Code Here

Examples of org.apache.accumulo.server.fs.VolumeManager

        return "0 0 0 0";
     
    }
   
    private String getFSStats() throws Exception {
      VolumeManager fs = VolumeManagerImpl.get();
      long length1 = 0, dcount1 = 0, fcount1 = 0;
      long length2 = 0, dcount2 = 0, fcount2 = 0;
      for (String dir : ServerConstants.getTablesDirs()) {
        ContentSummary contentSummary = fs.getContentSummary(new Path(dir));
        length1 += contentSummary.getLength();
        dcount1 += contentSummary.getDirectoryCount();
        fcount1 += contentSummary.getFileCount();
        contentSummary = fs.getContentSummary(new Path(dir, tableId));
        length2 += contentSummary.getLength();
        dcount2 += contentSummary.getDirectoryCount();
        fcount2 += contentSummary.getFileCount();
      }
     
View Full Code Here

Examples of org.apache.accumulo.server.fs.VolumeManager

  public static void main(String[] args) throws Exception {
    try {
      SecurityUtil.serverLogin(ServerConfiguration.getSiteConfiguration());

      VolumeManager fs = VolumeManagerImpl.get();
      ServerOpts opts = new ServerOpts();
      opts.parseArgs("master", args);
      String hostname = opts.getAddress();
      Instance instance = HdfsZooInstance.getInstance();
      ServerConfiguration conf = new ServerConfiguration(instance);
View Full Code Here

Examples of org.apache.accumulo.server.fs.VolumeManager

  }

  public static void main(String[] args) throws IOException {
    try {
      SecurityUtil.serverLogin(ServerConfiguration.getSiteConfiguration());
      VolumeManager fs = VolumeManagerImpl.get();
      ServerOpts opts = new ServerOpts();
      opts.parseArgs("tserver", args);
      String hostname = opts.getAddress();
      Instance instance = HdfsZooInstance.getInstance();
      ServerConfiguration conf = new ServerConfiguration(instance);
View Full Code Here

Examples of org.apache.accumulo.server.fs.VolumeManager

  public synchronized void open(String address) throws IOException {
    String filename = UUID.randomUUID().toString();
    String logger = StringUtil.join(Arrays.asList(address.split(":")), "+");

    log.debug("DfsLogger.open() begin");
    VolumeManager fs = conf.getFileSystem();

    logPath = fs.choose(ServerConstants.getWalDirs()) + "/" + logger + "/" + filename;
    try {
      short replication = (short) conf.getConfiguration().getCount(Property.TSERV_WAL_REPLICATION);
      if (replication == 0)
        replication = fs.getDefaultReplication(new Path(logPath));
      long blockSize = conf.getConfiguration().getMemoryInBytes(Property.TSERV_WAL_BLOCKSIZE);
      if (blockSize == 0)
        blockSize = (long) (conf.getConfiguration().getMemoryInBytes(Property.TSERV_WALOG_MAX_SIZE) * 1.1);
      if (conf.getConfiguration().getBoolean(Property.TSERV_WAL_SYNC))
        logFile = fs.createSyncable(new Path(logPath), 0, replication, blockSize);
      else
        logFile = fs.create(new Path(logPath), true, 0, replication, blockSize);

      try {
        NoSuchMethodException e = null;
        try {
          // sync: send data to datanodes
View Full Code Here

Examples of org.apache.accumulo.server.fs.VolumeManager

   *          - first argument is the file to print
   */
  public static void main(String[] args) throws IOException {
    Opts opts = new Opts();
    opts.parseArgs(LogReader.class.getName(), args);
    VolumeManager fs = VolumeManagerImpl.get();

    Matcher rowMatcher = null;
    KeyExtent ke = null;
    Text row = null;
    if (opts.files.isEmpty()) {
      new JCommander(opts).usage();
      return;
    }
    if (opts.row != null)
      row = new Text(opts.row);
    if (opts.extent != null) {
      String sa[] = opts.extent.split(";");
      ke = new KeyExtent(new Text(sa[0]), new Text(sa[1]), new Text(sa[2]));
    }
    if (opts.regexp != null) {
      Pattern pattern = Pattern.compile(opts.regexp);
      rowMatcher = pattern.matcher("");
    }

    Set<Integer> tabletIds = new HashSet<Integer>();

    for (String file : opts.files) {

      Path path = new Path(file);
      LogFileKey key = new LogFileKey();
      LogFileValue value = new LogFileValue();

      if (fs.isFile(path)) {
        // read log entries from a simple hdfs file
        DFSLoggerInputStreams streams = DfsLogger.readHeaderAndReturnStream(fs, path, ServerConfiguration.getSiteConfiguration());
        DataInputStream input = streams.getDecryptingInputStream();

        try {
View Full Code Here

Examples of org.apache.accumulo.server.fs.VolumeManager

      HashMap<Property,String> testProps = new HashMap<Property,String>();
      testProps.put(Property.INSTANCE_DFS_DIR, dfsDir.getAbsolutePath());

      AccumuloConfiguration testConf = new FileUtilTestConfiguration(testProps);
      VolumeManager fs = VolumeManagerImpl.getLocal(dfsDir.getAbsolutePath());

      FileUtil.cleanupIndexOp(testConf, tmpPath1, fs, new ArrayList<FileSKVIterator>());

      Assert.assertFalse("Expected " + tmp1 + " to be cleaned up but it wasn't", tmp1.exists());
    } finally {
View Full Code Here

Examples of org.apache.accumulo.server.fs.VolumeManager

      HashMap<Property,String> testProps = new HashMap<Property,String>();
      testProps.put(Property.INSTANCE_VOLUMES, v1.toURI().toString() + "," + v2.toURI().toString());

      AccumuloConfiguration testConf = new FileUtilTestConfiguration(testProps);
      VolumeManager fs = VolumeManagerImpl.getLocal(accumuloDir.getAbsolutePath());

      FileUtil.cleanupIndexOp(testConf, tmpPath1, fs, new ArrayList<FileSKVIterator>());

      Assert.assertFalse("Expected " + tmp1 + " to be cleaned up but it wasn't", tmp1.exists());
View Full Code Here

Examples of org.apache.accumulo.server.fs.VolumeManager

      HashMap<Property,String> testProps = new HashMap<Property,String>();
      testProps.put(Property.INSTANCE_VOLUMES, v1.toURI().toString() + "," + v2.toURI().toString());

      AccumuloConfiguration testConf = new FileUtilTestConfiguration(testProps);
      VolumeManager fs = VolumeManagerImpl.getLocal(accumuloDir.getAbsolutePath());

      FileUtil.cleanupIndexOp(testConf, tmpPath1, fs, new ArrayList<FileSKVIterator>());

      Assert.assertFalse("Expected " + tmp1 + " to be cleaned up but it wasn't", tmp1.exists());
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.