Package org.apache.blur.thrift.generated.Blur

Examples of org.apache.blur.thrift.generated.Blur.Iface


    return client.terms(table, family, column, startWith, (short) 10);
  }

  public static void disableTable(String table) throws TException, IOException {
    Iface client = BlurClient.getClient(Config.getConnectionString());

    client.disableTable(table);
  }
View Full Code Here


    client.disableTable(table);
  }

  public static void enableTable(String table) throws TException, IOException {
    Iface client = BlurClient.getClient(Config.getConnectionString());

    client.enableTable(table);
  }
View Full Code Here

    client.enableTable(table);
  }

  public static void deleteTable(String table, boolean includeFiles) throws TException, IOException {
    Iface client = BlurClient.getClient(Config.getConnectionString());

    client.removeTable(table, includeFiles);
  }
View Full Code Here

      BlurException {
    if (args.length != 4) {
      throw new CommandException("Invalid args: " + help());
    }

    Iface clientToNode = BlurClient.getClient(args[1]);
    Level level = Level.valueOf(args[2].toUpperCase().trim());
    String classNameOrLoggerName = args[3].trim();
    if (classNameOrLoggerName.equals("ROOT")) {
      clientToNode.logging(null, level);
    } else {
      clientToNode.logging(classNameOrLoggerName, level);
    }
  }
View Full Code Here

      BlurException {
    if (args.length != 2) {
      throw new CommandException("Invalid args: " + help());
    }

    Iface clientToNode = BlurClient.getClient(args[1]);
    clientToNode.resetLogging();
  }
View Full Code Here

      loadWords(args[8]);
    } else {
      loadWords(null);
    }

    final Iface client = BlurClient.getClient(args[0]);
    final String table = args[1];
    final boolean wal = Boolean.parseBoolean(args[2]);
    final int numberOfColumns = Integer.parseInt(args[3]);
    final int numberRecordsPerRow = Integer.parseInt(args[4]);
    final int numberOfFamilies = Integer.parseInt(args[5]);
    final int numberOfWords = Integer.parseInt(args[6]);
    final long timeBetweenReporting = TimeUnit.SECONDS.toMillis(Integer.parseInt(args[7]));
    final long start = System.currentTimeMillis();

    long s = start;
    long recordCountTotal = 0;
    long rowCount = 0;

    int batchSize = 100;

    List<RowMutation> batch = new ArrayList<RowMutation>();

    long recordCount = 0;
    long totalTime = 0;
    long calls = 0;
    while (true) {
      long now = System.currentTimeMillis();
      if (s + timeBetweenReporting < now) {
        double avgSeconds = (now - start) / 1000.0;
        double seconds = (now - s) / 1000.0;
        double avgRate = recordCountTotal / avgSeconds;
        double rate = recordCount / seconds;
        double latency = (totalTime / 1000000.0) / calls;
        System.out.println(System.currentTimeMillis() + "," + recordCountTotal + "," + rowCount + "," + latency + "," + rate + "," + avgRate);
        s = now;
        recordCount = 0;
        totalTime = 0;
        calls = 0;
      }

      RowMutation mutation = new RowMutation();
      mutation.setTable(table);
      String rowId = getRowId();
      mutation.setRowId(rowId);
      mutation.setRowMutationType(RowMutationType.REPLACE_ROW);
      for (int j = 0; j < numberRecordsPerRow; j++) {
        mutation.addToRecordMutations(getRecordMutation(numberOfColumns, numberOfFamilies, numberOfWords));
      }
      batch.add(mutation);
      if (batch.size() >= batchSize) {
        long sm = System.nanoTime();
        client.mutateBatch(batch);
        long em = System.nanoTime();
        calls++;
        totalTime += (em - sm);
        batch.clear();
      }
View Full Code Here

    // String uuid = UUID.randomUUID().toString();
    String uuid = "123456";
    Trace.setupTrace(uuid);
    System.out.println("Tracing on [" + uuid + "]");
    Iface client = BlurClient.getClient(connectionStr);
    System.out.println(client.tableStats(tableName));
    Trace.tearDownTrace();
  }
View Full Code Here

  public static void main(String[] args) throws BlurException, TException, IOException {
    String connectionStr = args[0];
    String tableName = args[1];
    String queryStr = args[2];

    Iface client = BlurClient.getClient(connectionStr);

    final BlurQuery blurQuery = new BlurQuery();
    Query query = new Query();
    blurQuery.setQuery(query);
    query.setQuery(queryStr);

    blurQuery.addToFacets(new Facet("fam1.col1:value1 OR fam1.col1:value2", 10000));
    blurQuery.addToFacets(new Facet("fam1.col1:value100 AND fam1.col1:value200", Long.MAX_VALUE));

    BlurResults results = client.query(tableName, blurQuery);
    System.out.println("Total Results: " + results.totalResults);

    List<Long> facetCounts = results.getFacetCounts();
    List<Facet> facets = blurQuery.getFacets();
    for (int i = 0; i < facets.size(); i++) {
View Full Code Here

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

    Iface client = getClient();
    client.createTable(tableDescriptor);

    BlurOutputFormat.setupJob(job, tableDescriptor);
    Path tablePath = new Path(tableUri);
    Path shardPath = new Path(tablePath, BlurUtil.getShardName(0));
    FileStatus[] listStatus = fileSystem.listStatus(shardPath);
    assertEquals(3, listStatus.length);
    System.out.println("======" + listStatus.length);
    for (FileStatus fileStatus : listStatus) {
      System.out.println(fileStatus.getPath());
    }

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

    while (true) {
      TableStats tableStats = client.tableStats(tableName);
      System.out.println(tableStats);
      if (tableStats.getRowCount() > 0) {
        break;
      }
      Thread.sleep(5000);
View Full Code Here

        + "]");
  }

  @Override
  public void mutate(Map<String, Map<String, IndexMutation>> mutations, TransactionHandle tx) throws StorageException {
    Iface client = getClient();
    List<RowMutation> mutationBatch = new ArrayList<RowMutation>();
    for (Map.Entry<String, Map<String, IndexMutation>> stores : mutations.entrySet()) {
      String store = stores.getKey();
      String tableName = getTableName(store);
      for (Map.Entry<String, IndexMutation> entry : stores.getValue().entrySet()) {
        String rowId = entry.getKey();
        IndexMutation mutation = entry.getValue();

        RowMutation rowMutation = new RowMutation();
        rowMutation.setRowId(rowId);
        rowMutation.setTable(tableName);
        rowMutation.setWal(_wal);
        rowMutation.setWaitToBeVisible(_waitToBeVisible);
        mutationBatch.add(rowMutation);

        if (mutation.isDeleted()) {
          rowMutation.setRowMutationType(RowMutationType.DELETE_ROW);
          continue;
        }

        RecordMutation recordMutation = new RecordMutation().setRecordMutationType(RecordMutationType.REPLACE_COLUMNS);
        Record record = new Record().setFamily(getFamily(store)).setRecordId(rowId);

        rowMutation.addToRecordMutations(recordMutation);
        rowMutation.setRowMutationType(RowMutationType.UPDATE_ROW);

        if (mutation.hasAdditions()) {
          for (IndexEntry indexEntry : mutation.getAdditions()) {
            record.addToColumns(new Column(indexEntry.key, getValue(indexEntry.value)));
          }
        }
        if (mutation.hasDeletions()) {
          for (IndexEntry indexEntry : mutation.getAdditions()) {
            record.addToColumns(new Column(indexEntry.key, null));
          }
        }
      }
    }
    try {
      client.mutateBatch(mutationBatch);
    } catch (BlurException e) {
      throw new PermanentStorageException("Unknown error while trying to perform batch update.", e);
    } catch (TException e) {
      throw new PermanentStorageException("Unknown error while trying to perform batch update.", e);
    }
View Full Code Here

TOP

Related Classes of org.apache.blur.thrift.generated.Blur.Iface

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.