Examples of Iface


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

    return sampleOfTerms;
  }

  private static Set<String> getRandomSampleOfTerms(String connectionStr, final String tableName, final String field, final int numberOfTerms) throws BlurException, TException,
      IOException {
    Iface client = BlurClient.getClient(connectionStr);
    String[] split = field.split("\\.");
    String columnFamily = split[0];
    String columnName = split[1];
    List<String> terms = client.terms(tableName, columnFamily, columnName, "", (short) numberOfTerms);
    return new HashSet<String>(terms);
  }
View Full Code Here

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

public class QueryCollectorTest extends BlurAgentBaseTestClass {
  private static BlurDatabaseConnection database = new BlurDatabaseConnection(jdbc);

  @Test
  public void shouldAddQueriesToDB() throws BlurException, TException, IOException {
    Iface blurConnection = BlurClient.getClient(MiniCluster.getControllerConnectionStr());


    TableDescriptor td = new TableDescriptor();
    td.setTableUri(MiniCluster.getFileSystemUri() + "/blur-tables/test");
    td.setName("test");
    td.setShardCount(1);

    blurConnection.createTable(td);
   
    BlurQuery query = new BlurQuery();
    query.setQuery(new Query("test.col:*", true, ScoreType.SUPER, null, null));
    query.setUuid("12345");
    blurConnection.query("test", query);
   
    System.out.println(jdbc.queryForList("select * from blur_queries"));
   
    Thread testQueryCollector = new Thread(new QueryCollector(BlurClient.getClient(MiniCluster.getControllerConnectionStr()), "test",
        1, database), "Query Test Thread");
View Full Code Here

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

    List<String> terms = client.terms(tableName, columnFamily, columnName, "", (short) numberOfTerms);
    return new HashSet<String>(terms);
  }

  private static Set<String> getFields(String connectionStr, final String tableName) throws BlurException, TException, IOException {
    Iface client = BlurClient.getClient(connectionStr);
    Schema schema = client.schema(tableName);
    Set<String> fields = new HashSet<String>();
    for (String cf : schema.families.keySet()) {
      for (String field : schema.families.get(cf).keySet()) {
        fields.add(cf + "." + field);
      }
View Full Code Here

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

    final int numberOfFamilies = 3;
    final int numberOfWords = 30;
    int batch = 1;
    String connectionString = args[0];
    String table = args[1];
    Iface client = BlurClient.getClient(connectionString);
    runLoad(client, table, wal, numberRows, numberRecordsPerRow, numberOfFamilies, numberOfColumns, numberOfWords,
        batch, new PrintWriter(System.out));
  }
View Full Code Here

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

    controllerServer.setMaxDefaultDelay(configuration.getInt(BLUR_CONTROLLER_RETRY_MAX_DEFAULT_DELAY, 2000));
    controllerServer.setMaxRecordsPerRowFetchRequest(configuration.getInt(BLUR_MAX_RECORDS_PER_ROW_FETCH_REQUEST, 1000));

    controllerServer.init();

    Iface iface = BlurUtil.recordMethodCallsAndAverageTimes(controllerServer, Iface.class, true);

    int threadCount = configuration.getInt(BLUR_CONTROLLER_SERVER_THRIFT_THREAD_COUNT, 32);
   
    ControllerServerEventHandler eventHandler = new ControllerServerEventHandler();
View Full Code Here

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

public class PrintConfiguration {

  public static void main(String[] args) throws BlurException, TException, IOException {
    String connectionStr = args[0];
    Iface client = BlurClient.getClient(new Connection("localhost", 40020,10000));
    Map<String, String> map = new TreeMap<String, String>(client.configuration());
    for (Entry<String, String> e : map.entrySet()) {
      System.out.println(e.getKey() + " " + e.getValue());
    }
  }
View Full Code Here

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

  public static void main(String[] args) throws BlurException, TException {
    String connectionStr = args[0];
    final String cluster = args[1];
    String uri = args[2];
    int shardCount = 1;
    Iface client = BlurClient.getClient(connectionStr);
    while (true) {
      String tableName = UUID.randomUUID().toString();
      System.out.println("Creating [" + tableName + "]");
      boolean readOnly = createTable(client, cluster, uri, shardCount, tableName);
      if (!readOnly) {
View Full Code Here

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

    assertEquals(Arrays.asList("test"), tableList);
  }

  @Test
  public void testLoadTable() throws BlurException, TException, InterruptedException {
    Iface client = getClient();
    int length = 100;
    List<RowMutation> mutations = new ArrayList<RowMutation>();
    for (int i = 0; i < length; i++) {
      String rowId = UUID.randomUUID().toString();
      RecordMutation mutation = BlurThriftHelper.newRecordMutation("test", rowId,
          BlurThriftHelper.newColumn("test", "value"));
      RowMutation rowMutation = BlurThriftHelper.newRowMutation("test", rowId, mutation);
      rowMutation.setWaitToBeVisible(true);
      mutations.add(rowMutation);
    }
    long s = System.nanoTime();
    client.mutateBatch(mutations);
    long e = System.nanoTime();
    System.out.println("mutateBatch took [" + (e - s) / 1000000.0 + "]");
    BlurQuery blurQueryRow = new BlurQuery();
    Query queryRow = new Query();
    queryRow.setQuery("test.test:value");
    blurQueryRow.setQuery(queryRow);
    blurQueryRow.setUseCacheIfPresent(false);
    blurQueryRow.setCacheResult(false);
    BlurResults resultsRow = client.query("test", blurQueryRow);
    assertRowResults(resultsRow);
    assertEquals(length, resultsRow.getTotalResults());

    BlurQuery blurQueryRecord = new BlurQuery();
    Query queryRecord = new Query();
    queryRecord.rowQuery = false;
    queryRecord.setQuery("test.test:value");
    blurQueryRecord.setQuery(queryRecord);
    BlurResults resultsRecord = client.query("test", blurQueryRecord);
    assertRecordResults(resultsRecord);
    assertEquals(length, resultsRecord.getTotalResults());

    Schema schema = client.schema("test");
    assertFalse(schema.getFamilies().isEmpty());
  }
View Full Code Here

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

  public void testQueryCancel() throws BlurException, TException, InterruptedException {
    // This will make each collect in the collectors pause 250 ms per collect
    // call
    IndexManager.DEBUG_RUN_SLOW.set(true);

    final Iface client = getClient();
    final BlurQuery blurQueryRow = new BlurQuery();
    Query queryRow = new Query();
    queryRow.setQuery("test.test:value");
    blurQueryRow.setQuery(queryRow);
    blurQueryRow.setUseCacheIfPresent(false);
    blurQueryRow.setCacheResult(false);
    blurQueryRow.setUuid("1234");

    final AtomicReference<BlurException> error = new AtomicReference<BlurException>();
    final AtomicBoolean fail = new AtomicBoolean();

    new Thread(new Runnable() {
      @Override
      public void run() {
        try {
          // This call will take several seconds to execute.
          client.query("test", blurQueryRow);
          fail.set(true);
        } catch (BlurException e) {
          error.set(e);
        } catch (TException e) {
          e.printStackTrace();
          fail.set(true);
        }
      }
    }).start();
    Thread.sleep(500);
    client.cancelQuery("test", blurQueryRow.getUuid());
    BlurException blurException = pollForError(error, 10, TimeUnit.SECONDS, null);
    if (fail.get()) {
      fail("Unknown error, failing test.");
    }
    assertEquals(blurException.getErrorType(), ErrorType.QUERY_CANCEL);
View Full Code Here

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

    System.gc();
    Thread.sleep(1000);
  }

  private void runBackPressureViaQuery() throws InterruptedException {
    final Iface client = getClient();
    final BlurQuery blurQueryRow = new BlurQuery();
    Query queryRow = new Query();
    queryRow.setQuery("test.test:value");
    blurQueryRow.setQuery(queryRow);
    blurQueryRow.setUseCacheIfPresent(false);
    blurQueryRow.setCacheResult(false);
    blurQueryRow.setUuid("1234");

    final AtomicReference<BlurException> error = new AtomicReference<BlurException>();
    final AtomicBoolean fail = new AtomicBoolean();

    System.gc();
    System.gc();
    MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();
    MemoryUsage usage = memoryMXBean.getHeapMemoryUsage();
    long max = usage.getMax();
    long used = usage.getUsed();
    long limit = (long) (max * 0.80);
    long difference = limit - used;
    byte[] bufferToFillHeap = new byte[(int) (difference - _20MB)];
    new Thread(new Runnable() {
      @Override
      public void run() {
        try {
          // This call will take several seconds to execute.
          client.query("test", blurQueryRow);
          fail.set(true);
        } catch (BlurException e) {
          error.set(e);
        } catch (TException e) {
          e.printStackTrace();
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.