Examples of OpTimer


Examples of org.apache.accumulo.core.util.OpTimer

  public boolean exists(String tableName) {
    ArgumentChecker.notNull(tableName);
    if (tableName.equals(Constants.METADATA_TABLE_NAME))
      return true;
   
    OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Checking if table " + tableName + "exists...");
    boolean exists = Tables.getNameToIdMap(instance).containsKey(tableName);
    opTimer.stop("Checked existance of " + exists + " in %DURATION%");
    return exists;
  }
View Full Code Here

Examples of org.apache.accumulo.core.util.OpTimer

          continue;
       
        try {
          TabletClientService.Iface client = ThriftUtil.getTServerClient(tl.tablet_location, instance.getConfiguration());
          try {
            OpTimer opTimer = null;
            if (log.isTraceEnabled())
              opTimer = new OpTimer(log, Level.TRACE).start("Splitting tablet " + tl.tablet_extent + " on " + tl.tablet_location + " at " + split);
           
            client.splitTablet(null, credentials, tl.tablet_extent.toThrift(), TextUtil.getBytes(split));
           
            // just split it, might as well invalidate it in the cache
            tabLocator.invalidateCache(tl.tablet_extent);
           
            if (opTimer != null)
              opTimer.stop("Split tablet in %DURATION%");
          } finally {
            ThriftUtil.returnClient((TServiceClient) client);
          }
         
        } catch (TApplicationException tae) {
View Full Code Here

Examples of org.apache.accumulo.core.util.OpTimer

      AccumuloException {

    try {
      ArrayList<TabletLocation> list = new ArrayList<TabletLocation>();

      OpTimer opTimer = null;
      if (log.isTraceEnabled())
        opTimer = new OpTimer(log, Level.TRACE).start("Looking up in " + src.tablet_extent.getTableId() + " row=" + TextUtil.truncate(row) + "  extent="
            + src.tablet_extent + " tserver=" + src.tablet_location);
     
      Range range = new Range(row, true, stopRow, true);
     
      TreeMap<Key,Value> results = new TreeMap<Key,Value>();
     
      // System.out.println(range);
     
      boolean more = ThriftScanner.getBatchFromServer(credentials, range, src.tablet_extent, src.tablet_location, results, locCols, Constants.SCAN_BATCH_SIZE,
          Constants.NO_AUTHS, false, instance.getConfiguration());
      if (more && results.size() == 1) {
        range = new Range(results.lastKey().followingKey(PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME), true, new Key(stopRow).followingKey(PartialKey.ROW), false);
        more = ThriftScanner.getBatchFromServer(credentials, range, src.tablet_extent, src.tablet_location, results, locCols, Constants.SCAN_BATCH_SIZE,
            Constants.NO_AUTHS, false, instance.getConfiguration());
      }
     
      if (opTimer != null)
        opTimer.stop("Got " + results.size() + " results  from " + src.tablet_extent + " in %DURATION%");
     
      // System.out.println("results "+results.keySet());
     
      Pair<SortedMap<KeyExtent,Text>,List<KeyExtent>> metadata = MetadataTable.getMetadataLocationEntries(results);
     
View Full Code Here

Examples of org.apache.accumulo.core.util.OpTimer

        public void run() {
          NativeMap nm = new NativeMap();
         
          Random r = new Random();
         
          OpTimer opTimer = new OpTimer(log, Level.INFO);
         
          opTimer.start("Creating map of size " + mapSizePerThread);
         
          for (int i = 0; i < mapSizePerThread; i++) {
            String row = String.format("r%08d", i);
            String val = row + "v";
            put(nm, row, val, i);
          }
         
          opTimer.stop("Created map of size " + nm.size() + " in %DURATION%");
         
          opTimer.start("Doing " + getsPerThread + " gets()");
         
          for (int i = 0; i < getsPerThread; i++) {
            String row = String.format("r%08d", r.nextInt(mapSizePerThread));
            String val = row + "v";
           
            Value value = nm.get(new Key(new Text(row)));
            if (value == null || !value.toString().equals(val)) {
              log.error("nm.get(" + row + ") failed");
            }
          }
         
          opTimer.stop("Finished " + getsPerThread + " gets in %DURATION%");
         
          int scanned = 0;
         
          opTimer.start("Doing " + getsPerThread + " random iterations");
         
          for (int i = 0; i < getsPerThread; i++) {
            int startRow = r.nextInt(mapSizePerThread);
            String row = String.format("r%08d", startRow);
           
            Iterator<Entry<Key,Value>> iter = nm.iterator(new Key(new Text(row)));
           
            int count = 0;
           
            while (iter.hasNext() && count < 10) {
              String row2 = String.format("r%08d", startRow + count);
              String val2 = row2 + "v";
             
              Entry<Key,Value> entry = iter.next();
              if (!entry.getValue().toString().equals(val2) || !entry.getKey().equals(new Key(new Text(row2)))) {
                log.error("nm.iter(" + row2 + ") failed row = " + row + " count = " + count + " row2 = " + row + " val2 = " + val2);
              }
             
              count++;
            }
           
            scanned += count;
          }
         
          opTimer.stop("Finished " + getsPerThread + " random iterations (scanned = " + scanned + ") in %DURATION%");
         
          nm.delete();
        }
      };
     
View Full Code Here

Examples of org.apache.accumulo.core.util.OpTimer

 
  @Override
  public List<String> getMasterLocations() {
    String masterLocPath = ZooUtil.getRoot(this) + Constants.ZMASTER_LOCK;
   
    OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Looking up master location in zoocache.");
    byte[] loc = ZooUtil.getLockData(zooCache, masterLocPath);
    opTimer.stop("Found master at " + (loc == null ? null : new String(loc)) + " in %DURATION%");
   
    if (loc == null) {
      return Collections.emptyList();
    }
   
View Full Code Here

Examples of org.apache.accumulo.core.util.OpTimer

 
  @Override
  public String getRootTabletLocation() {
    String zRootLocPath = ZooUtil.getRoot(this) + Constants.ZROOT_TABLET_LOCATION;
   
    OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Looking up root tablet location in zookeeper.");
    byte[] loc = zooCache.get(zRootLocPath);
    opTimer.stop("Found root tablet at " + (loc == null ? null : new String(loc)) + " in %DURATION%");
   
    if (loc == null) {
      return null;
    }
   
View Full Code Here

Examples of org.apache.accumulo.core.util.OpTimer

 
  @Override
  public String getRootTabletLocation() {
    String zRootLocPath = ZooUtil.getRoot(this) + Constants.ZROOT_TABLET_LOCATION;
   
    OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Looking up root tablet location in zoocache.");
   
    byte[] loc = zooCache.get(zRootLocPath);
   
    opTimer.stop("Found root tablet at " + (loc == null ? null : new String(loc)) + " in %DURATION%");
   
    if (loc == null) {
      return null;
    }
   
View Full Code Here

Examples of org.apache.accumulo.core.util.OpTimer

  @Override
  public List<String> getMasterLocations() {
   
    String masterLocPath = ZooUtil.getRoot(this) + Constants.ZMASTER_LOCK;
   
    OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Looking up master location in zoocache.");
   
    byte[] loc = ZooLock.getLockData(zooCache, masterLocPath, null);
   
    opTimer.stop("Found master at " + (loc == null ? null : new String(loc)) + " in %DURATION%");
   
    if (loc == null) {
      return Collections.emptyList();
    }
   
View Full Code Here

Examples of org.apache.accumulo.core.util.OpTimer

   * Retrieve a list of tables in Accumulo.
   *
   * @return List of tables in accumulo
   */
  public SortedSet<String> list() {
    OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Fetching list of tables...");
    TreeSet<String> tableNames = new TreeSet<String>(Tables.getNameToIdMap(instance).keySet());
    opTimer.stop("Fetched " + tableNames.size() + " table names in %DURATION%");
    return tableNames;
  }
View Full Code Here

Examples of org.apache.accumulo.core.util.OpTimer

  public boolean exists(String tableName) {
    ArgumentChecker.notNull(tableName);
    if (tableName.equals(Constants.METADATA_TABLE_NAME))
      return true;
   
    OpTimer opTimer = new OpTimer(log, Level.TRACE).start("Checking if table " + tableName + "exists...");
    boolean exists = Tables.getNameToIdMap(instance).containsKey(tableName);
    opTimer.stop("Checked existance of " + exists + " in %DURATION%");
    return 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.