Package org.apache.blur.thrift.generated

Examples of org.apache.blur.thrift.generated.TableDescriptor


  }

  private int getShardCount(String table) throws BlurException, TException {
    Integer numberOfShards = _tableShardCountMap.get(table);
    if (numberOfShards == null) {
      TableDescriptor descriptor = describe(table);
      numberOfShards = descriptor.shardCount;
      _tableShardCountMap.put(table, numberOfShards);
    }
    return numberOfShards;
  }
View Full Code Here


    _writer.commit();
    _writer.close();

    IndexReader reader = DirectoryReader.open(_directory);

    TableDescriptor descriptor = _blurTask.getTableDescriptor();

    Path directoryPath = _blurTask.getDirectoryPath(context);
    remove(directoryPath);

    NoLockFactory lockFactory = NoLockFactory.getNoLockFactory();
View Full Code Here

    Collections.sort(files, new LuceneFileComparator(_directory));
    return files;
  }

  protected void setupDirectory(Context context) throws IOException {
    TableDescriptor descriptor = _blurTask.getTableDescriptor();
    switch (_blurTask.getIndexingType()) {
    case UPDATE:
      Path directoryPath = _blurTask.getDirectoryPath(context);
      _directory = getDestDirectory(context.getConfiguration(), descriptor, directoryPath);
View Full Code Here

    shutdownZooKeeper();
    shutdownDfs();
  }

  private static void createTable(String test, Iface client) throws BlurException, TException, IOException {
    final TableDescriptor descriptor = new TableDescriptor();
    descriptor.setName(test);
    descriptor.setShardCount(7);
    descriptor.setTableUri(getFileSystemUri() + "/blur/" + test);
    client.createTable(descriptor);
  }
View Full Code Here

    FileInputFormat.addInputPath(job, new Path(TEST_ROOT_DIR + "/in"));
    String tableUri = new Path(TEST_ROOT_DIR + "/out").toString();
    CsvBlurMapper.addColumns(job, "cf1", "col");

    TableDescriptor tableDescriptor = new TableDescriptor();
    tableDescriptor.setShardCount(2);
    tableDescriptor.setTableUri(tableUri);
    tableDescriptor.setName("test");

    createShardDirectories(outDir, 2);

    BlurOutputFormat.setupJob(job, tableDescriptor);
    BlurOutputFormat.setIndexLocally(job, false);

    assertTrue(job.waitForCompletion(true));
    Counters ctrs = job.getCounters();
    System.out.println("Counters: " + ctrs);

    long total = 0;
    for (int i = 0; i < tableDescriptor.getShardCount(); i++) {
      Path path = new Path(tableUri, BlurUtil.getShardName(i));
      Collection<Path> commitedTasks = getCommitedTasks(path);
      assertEquals(1, commitedTasks.size());

      DirectoryReader reader = DirectoryReader.open(new HdfsDirectory(conf, commitedTasks.iterator().next()));
View Full Code Here

    FileInputFormat.addInputPath(job, new Path(TEST_ROOT_DIR + "/in"));
    String tableUri = new Path(TEST_ROOT_DIR + "/out").toString();
    CsvBlurMapper.addColumns(job, "cf1", "col");

    TableDescriptor tableDescriptor = new TableDescriptor();
    tableDescriptor.setShardCount(7);
    tableDescriptor.setTableUri(tableUri);
    tableDescriptor.setName("test");

    createShardDirectories(outDir, 7);

    BlurOutputFormat.setupJob(job, tableDescriptor);
    int multiple = 2;
    BlurOutputFormat.setReducerMultiplier(job, multiple);

    assertTrue(job.waitForCompletion(true));
    Counters ctrs = job.getCounters();
    System.out.println("Counters: " + ctrs);

    long total = 0;
    for (int i = 0; i < tableDescriptor.getShardCount(); i++) {
      Path path = new Path(tableUri, BlurUtil.getShardName(i));
      Collection<Path> commitedTasks = getCommitedTasks(path);
      assertTrue(multiple >= commitedTasks.size());
      for (Path p : commitedTasks) {
        DirectoryReader reader = DirectoryReader.open(new HdfsDirectory(conf, p));
View Full Code Here

    FileInputFormat.addInputPath(job, new Path(TEST_ROOT_DIR + "/in"));
    String tableUri = new Path(TEST_ROOT_DIR + "/out").toString();
    CsvBlurMapper.addColumns(job, "cf1", "col");

    TableDescriptor tableDescriptor = new TableDescriptor();
    tableDescriptor.setShardCount(1);
    tableDescriptor.setTableUri(tableUri);
    tableDescriptor.setName("test");

    createShardDirectories(outDir, 1);

    BlurOutputFormat.setupJob(job, tableDescriptor);
    BlurOutputFormat.setReducerMultiplier(job, 2);
View Full Code Here

    FileInputFormat.addInputPath(job, new Path(TEST_ROOT_DIR + "/in"));
    String tableUri = new Path(TEST_ROOT_DIR + "/out").toString();
    CsvBlurMapper.addColumns(job, "cf1", "col");

    TableDescriptor tableDescriptor = new TableDescriptor();
    tableDescriptor.setShardCount(2);
    tableDescriptor.setTableUri(tableUri);
    tableDescriptor.setName("test");

    createShardDirectories(outDir, 2);

    BlurOutputFormat.setupJob(job, tableDescriptor);
    BlurOutputFormat.setIndexLocally(job, false);

    job.submit();
    boolean killCalled = false;
    while (!job.isComplete()) {
      Thread.sleep(1000);
      System.out.printf("Killed [" + killCalled + "] Map [%f] Reduce [%f]%n", job.mapProgress() * 100,
          job.reduceProgress() * 100);
      if (job.reduceProgress() > 0.7 && !killCalled) {
        job.killJob();
        killCalled = true;
      }
    }

    assertFalse(job.isSuccessful());

    for (int i = 0; i < tableDescriptor.getShardCount(); i++) {
      Path path = new Path(tableUri, BlurUtil.getShardName(i));
      FileSystem fileSystem = path.getFileSystem(job.getConfiguration());
      FileStatus[] listStatus = fileSystem.listStatus(path);
      assertEquals(toString(listStatus), 0, listStatus.length);
    }
View Full Code Here

  private void createTable(String name) throws KeeperException, InterruptedException {
    createTable(name, true);
  }

  private void createTable(String name, boolean enabled) throws KeeperException, InterruptedException {
    TableDescriptor tableDescriptor = new TableDescriptor();
    tableDescriptor.setName(name);
    tableDescriptor.setTableUri("./target/tmp/zk_test_hdfs");
    tableDescriptor.setEnabled(enabled);
    clusterStatus.createTable(tableDescriptor);
    if (enabled) {
      clusterStatus.enableTable(tableDescriptor.getCluster(), name);
    }
  }
View Full Code Here

    FileSystem fileSystem = path.getFileSystem(configuration);
    fileSystem.delete(path, true);

    KeywordAnalyzer analyzer = new KeywordAnalyzer();

    TableDescriptor tableDescriptor = new TableDescriptor();
    tableDescriptor.setName("table");
    String tableUri = new Path(path, "tableuri").toUri().toString();

    System.out.println("tableUri=" + tableUri);
    tableDescriptor.setTableUri(tableUri);

    TableContext tableContext = TableContext.create(tableDescriptor);
    ShardContext shardContext = ShardContext.create(tableContext, "shard-1");
    TransactionRecorder transactionRecorder = new TransactionRecorder(shardContext);
    closeThis.add(transactionRecorder);
View Full Code Here

TOP

Related Classes of org.apache.blur.thrift.generated.TableDescriptor

Copyright © 2018 www.massapicom. 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.