Package org.apache.accumulo.core.data

Examples of org.apache.accumulo.core.data.Range


    conf.set(Property.TABLE_ITERATOR_PREFIX + IteratorScope.minc.name() + ".addIter", "2," + AddingIter.class.getName());
    conf.set(Property.TABLE_ITERATOR_PREFIX + IteratorScope.minc.name() + ".sqIter", "1," + SquaringIter.class.getName());
   
    SortedKeyValueIterator<Key,Value> iter = IteratorUtil.loadIterators(IteratorScope.minc, source, new KeyExtent(new Text("tab"), null, null), conf,
        new DefaultIteratorEnvironment(conf));
    iter.seek(new Range(), EMPTY_COL_FAMS, false);
   
    assertTrue(iter.hasTop());
    assertTrue(iter.getTopKey().equals(MultiIteratorTest.nk(1, 0)));
    assertTrue(iter.getTopValue().toString().equals("2"));
   
View Full Code Here


   
    SortedMapIterator source = new SortedMapIterator(tm);
   
    SortedKeyValueIterator<Key,Value> iter = IteratorUtil.loadIterators(IteratorScope.minc, source, new KeyExtent(new Text("tab"), null, null), conf,
        new DefaultIteratorEnvironment(conf));
    iter.seek(new Range(), EMPTY_COL_FAMS, false);
   
    assertTrue(iter.hasTop());
    assertTrue(iter.getTopKey().equals(MultiIteratorTest.nk(1, 0)));
    assertTrue(iter.getTopValue().toString().equals("64"));
   
View Full Code Here

   
    SortedMapIterator source = new SortedMapIterator(tm);
   
    SortedKeyValueIterator<Key,Value> iter = IteratorUtil.loadIterators(IteratorScope.minc, source, new KeyExtent(new Text("tab"), null, null), conf,
        new DefaultIteratorEnvironment(conf));
    iter.seek(new Range(), EMPTY_COL_FAMS, false);
   
    assertTrue(iter.hasTop());
    assertTrue(iter.getTopKey().equals(MultiIteratorTest.nk(2, 950)));
    iter.next();
   
View Full Code Here

    String startHexTime = Long.toHexString(startTime), endHexTime = Long.toHexString(endTime);
    while (startHexTime.length() < endHexTime.length()) {
      startHexTime = "0" + startHexTime;
    }

    return new Range(new Text("start:" + startHexTime), new Text("start:" + endHexTime));
  }
View Full Code Here

   
    Scanner scanner = getScanner(sb);
    if (scanner == null) {
      return;
    }
    Range range = getRangeForTrace(minutes);
    scanner.setRange(range);
    Map<String,Stats> summary = new TreeMap<String,Stats>();
    for (Entry<Key,Value> entry : scanner) {
      RemoteSpan span = TraceFormatter.getRemoteSpan(entry);
      Stats stats = summary.get(span.description);
View Full Code Here

    Assert.assertEquals(MergeState.WAITING_FOR_OFFLINE, newState);
   
    // unassign the tablets
    BatchDeleter deleter = connector.createBatchDeleter("!METADATA", Constants.NO_AUTHS, 1000, new BatchWriterConfig());
    deleter.fetchColumnFamily(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY);
    deleter.setRanges(Collections.singletonList(new Range()));
    deleter.delete();
   
    // now we should be ready to merge but, we have an inconsistent !METADATA table
    stats = scan(state, metaDataStateStore);
    Assert.assertEquals(MergeState.WAITING_FOR_OFFLINE, stats.nextMergeState(connector, state));
View Full Code Here

      mdScanner.setBatchSize(1000);
     
      // leave these in, again, now using endKey for safety
      mdScanner.fetchColumnFamily(Constants.METADATA_DATAFILE_COLUMN_FAMILY);
     
      mdScanner.setRange(new Range(rowName));
     
      datafilesMetadata = new TreeMap<Key,Value>();
     
      for (Entry<Key,Value> entry : mdScanner) {
       
View Full Code Here

    lookupResult.closed = true;
  }
 
  private void addUnfinishedRange(LookupResult lookupResult, Range range, Key key, boolean inclusiveStartKey) {
    if (range.getEndKey() == null || key.compareTo(range.getEndKey()) < 0) {
      Range nlur = new Range(new Key(key), inclusiveStartKey, range.getEndKey(), range.isEndKeyInclusive());
      lookupResult.unfinishedRanges.add(nlur);
    }
  }
View Full Code Here

    }
   
    ranges = Range.mergeOverlapping(ranges);
    Collections.sort(ranges);
   
    Range tabletRange = extent.toDataRange();
    for (Range range : ranges) {
      // do a test to see if this range falls within the tablet, if it does not
      // then clip will throw an exception
      tabletRange.clip(range);
    }
   
    ScanDataSource dataSource = new ScanDataSource(authorizations, this.defaultSecurityLabel, columns, ssiList, ssio, interruptFlag);
   
    LookupResult result = null;
View Full Code Here

        Scanner s = connector.createScanner(opts.tableName, opts.auths);
        s.setBatchSize(scanOpts.scanBatchSize);
        Key startKey = new Key(encodeLong(opts.start), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE);
        Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), CF_BYTES, CQ_BYTES, new byte[0], 0);
        s.setBatchSize(50000);
        s.setRange(new Range(startKey, stopKey));
       
        for (Entry<Key,Value> entry : s) {
          System.err.println("ERROR : saw entries in range that should be deleted ( first value : " + entry.getValue().toString() + ")");
          System.err.println("exiting...");
          System.exit(1);
        }
       
      } else if (opts.mode.equals("verify")) {
        long t1 = System.currentTimeMillis();
       
        Scanner s = connector.createScanner(opts.tableName, opts.auths);
        Key startKey = new Key(encodeLong(opts.start), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE);
        Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), CF_BYTES, CQ_BYTES, new byte[0], 0);
        s.setBatchSize(scanOpts.scanBatchSize);
        s.setRange(new Range(startKey, stopKey));
       
        long i = opts.start;
       
        for (Entry<Key,Value> e : s) {
          Key k = e.getKey();
          Value v = e.getValue();
         
          // System.out.println("v = "+v);
         
          checkKeyValue(i, k, v);
         
          i++;
        }
       
        if (i != opts.start + opts.num) {
          System.err.println("ERROR : did not see expected number of rows, saw " + (i - opts.start) + " expected " + opts.num);
          System.err.println("exiting... ARGHHHHHH");
          System.exit(1);
         
        }
       
        long t2 = System.currentTimeMillis();
       
        System.out.printf("time : %9.2f secs%n", ((t2 - t1) / 1000.0));
        System.out.printf("rate : %9.2f entries/sec%n", opts.num / ((t2 - t1) / 1000.0));
       
      } else if (opts.mode.equals("randomLookups")) {
        int numLookups = 1000;
       
        Random r = new Random();
       
        long t1 = System.currentTimeMillis();
       
        for (int i = 0; i < numLookups; i++) {
          long row = ((r.nextLong() & 0x7fffffffffffffffl) % opts.num) + opts.start;
         
          Scanner s = connector.createScanner(opts.tableName, opts.auths);
          s.setBatchSize(scanOpts.scanBatchSize);
          Key startKey = new Key(encodeLong(row), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE);
          Key stopKey = new Key(encodeLong(row), CF_BYTES, CQ_BYTES, new byte[0], 0);
          s.setRange(new Range(startKey, stopKey));
         
          Iterator<Entry<Key,Value>> si = s.iterator();
         
          if (si.hasNext()) {
            Entry<Key,Value> e = si.next();
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.data.Range

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.