Package org.apache.accumulo.core.data

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


     
      String tableId = new String(ByteBufferUtil.toBytes(tkeyExtent.table), Constants.UTF8);
      if (!security.canSplitTablet(credentials, tableId))
        throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
     
      KeyExtent keyExtent = new KeyExtent(tkeyExtent);
     
      Tablet tablet = onlineTablets.get(keyExtent);
      if (tablet == null) {
        throw new NotServingTabletException(tkeyExtent);
      }
     
      if (keyExtent.getEndRow() == null || !keyExtent.getEndRow().equals(ByteBufferUtil.toText(splitPoint))) {
        try {
          if (TabletServer.this.splitTablet(tablet, ByteBufferUtil.toBytes(splitPoint)) == null) {
            throw new NotServingTabletException(tkeyExtent);
          }
        } catch (IOException e) {
View Full Code Here


      synchronized (onlineTablets) {
        onlineTabletsCopy = new TreeMap<KeyExtent,Tablet>(onlineTablets);
      }
      List<TabletStats> result = new ArrayList<TabletStats>();
      Text text = new Text(tableId);
      KeyExtent start = new KeyExtent(text, new Text(), null);
      for (Entry<KeyExtent,Tablet> entry : onlineTabletsCopy.tailMap(start).entrySet()) {
        KeyExtent ke = entry.getKey();
        if (ke.getTableId().compareTo(text) == 0) {
          Tablet tablet = entry.getValue();
          TabletStats stats = tablet.timer.getTabletStats();
          stats.extent = ke.toThrift();
          stats.ingestRate = tablet.ingestRate();
          stats.queryRate = tablet.queryRate();
          stats.splitCreationTime = tablet.getSplitCreationTime();
          stats.numEntries = tablet.getNumEntries();
          result.add(stats);
View Full Code Here

      } catch (ThriftSecurityException e) {
        log.error(e, e);
        throw new RuntimeException(e);
      }
     
      final KeyExtent extent = new KeyExtent(textent);
     
      synchronized (unopenedTablets) {
        synchronized (openingTablets) {
          synchronized (onlineTablets) {
           
            // checking if this exact tablet is in any of the sets
            // below is not a strong enough check
            // when splits and fix splits occurring
           
            Set<KeyExtent> unopenedOverlapping = KeyExtent.findOverlapping(extent, unopenedTablets);
            Set<KeyExtent> openingOverlapping = KeyExtent.findOverlapping(extent, openingTablets);
            Set<KeyExtent> onlineOverlapping = KeyExtent.findOverlapping(extent, onlineTablets);
            Set<KeyExtent> all = new HashSet<KeyExtent>();
            all.addAll(unopenedOverlapping);
            all.addAll(openingOverlapping);
            all.addAll(onlineOverlapping);
           
            if (!all.isEmpty()) {
              if (all.size() != 1 || !all.contains(extent)) {
                log.error("Tablet " + extent + " overlaps previously assigned " + unopenedOverlapping + " " + openingOverlapping + " " + onlineOverlapping);
              }
              return;
            }
           
            unopenedTablets.add(extent);
          }
        }
      }
     
      // add the assignment job to the appropriate queue
      log.info("Loading tablet " + extent);
     
      final Runnable ah = new LoggingRunnable(log, new AssignmentHandler(extent));
      // Root tablet assignment must take place immediately
      if (extent.isRootTablet()) {
        new Daemon("Root Tablet Assignment") {
          @Override
          public void run() {
            ah.run();
            if (onlineTablets.containsKey(extent)) {
              log.info("Root tablet loaded: " + extent);
            } else {
              log.info("Root tablet failed to load");
            }
           
          }
        }.start();
      } else {
        if (extent.isMeta()) {
          resourceManager.addMetaDataAssignment(ah);
        } else {
          resourceManager.addAssignment(ah);
        }
      }
View Full Code Here

      } catch (ThriftSecurityException e) {
        log.error(e, e);
        throw new RuntimeException(e);
      }
     
      KeyExtent extent = new KeyExtent(textent);
     
      resourceManager.addMigration(extent, new LoggingRunnable(log, new UnloadTabletHandler(extent, save)));
    }
View Full Code Here

        throw new RuntimeException(e);
      }
     
      ArrayList<Tablet> tabletsToFlush = new ArrayList<Tablet>();
     
      KeyExtent ke = new KeyExtent(new Text(tableId), ByteBufferUtil.toText(endRow), ByteBufferUtil.toText(startRow));
     
      synchronized (onlineTablets) {
        for (Tablet tablet : onlineTablets.values())
          if (ke.overlaps(tablet.getExtent()))
            tabletsToFlush.add(tablet);
      }
     
      Long flushID = null;
     
View Full Code Here

      } catch (ThriftSecurityException e) {
        log.error(e, e);
        throw new RuntimeException(e);
      }
     
      Tablet tablet = onlineTablets.get(new KeyExtent(textent));
      if (tablet != null) {
        log.info("Flushing " + tablet.getExtent());
        try {
          tablet.flush(tablet.getFlushID());
        } catch (NoNodeException nne) {
          log.info("Asked to flush tablet that has no flush id " + new KeyExtent(textent) + " " + nne.getMessage());
        }
      }
    }
View Full Code Here

      } catch (ThriftSecurityException e) {
        log.error(e, e);
        throw new RuntimeException(e);
      }
     
      KeyExtent ke = new KeyExtent(textent);
     
      Tablet tablet = onlineTablets.get(ke);
      if (tablet != null) {
        tablet.chopFiles();
      }
View Full Code Here

      } catch (ThriftSecurityException e) {
        log.error(e, e);
        throw new RuntimeException(e);
      }
     
      KeyExtent ke = new KeyExtent(new Text(tableId), ByteBufferUtil.toText(endRow), ByteBufferUtil.toText(startRow));
     
      ArrayList<Tablet> tabletsToCompact = new ArrayList<Tablet>();
      synchronized (onlineTablets) {
        for (Tablet tablet : onlineTablets.values())
          if (ke.overlaps(tablet.getExtent()))
            tabletsToCompact.add(tablet);
      }
     
      Long compactionId = null;
     
View Full Code Here

    List<TabletStats> result = new ArrayList<TabletStats>();
    TabletServerStatus tableInfo = state.get(tserver);
    // generate some fake tablets
    for (int i = 0; i < tableInfo.tableMap.get(tableId).onlineTablets; i++) {
      TabletStats stats = new TabletStats();
      stats.extent = new KeyExtent(new Text(tableId), new Text(tserver.host() + String.format("%03d", i + 1)), new Text(tserver.host()
          + String.format("%03d", i))).toThrift();
      result.add(stats);
    }
    return result;
  }
View Full Code Here

      Map<KeyExtent,TabletStats> onlineTabletsForTable = onlineTablets.get(table);
      try {
        if (onlineTabletsForTable == null) {
          onlineTabletsForTable = new HashMap<KeyExtent,TabletStats>();
          for (TabletStats stat : getOnlineTabletsForTable(tooMuch.server, table))
            onlineTabletsForTable.put(new KeyExtent(stat.extent), stat);
          onlineTablets.put(table, onlineTabletsForTable);
        }
      } catch (Exception ex) {
        log.error("Unable to select a tablet to move", ex);
        return result;
      }
      KeyExtent extent = selectTablet(tooMuch.server, onlineTabletsForTable);
      onlineTabletsForTable.remove(extent);
      if (extent == null)
        return result;
      tooMuchMap.put(table, tooMuchMap.get(table) - 1);
      /**
 
View Full Code Here

TOP

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

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.