use of org.apache.accumulo.tserver.tablet.Tablet in project accumulo by apache.
the class TabletServer method getStats.
public TabletServerStatus getStats(Map<Table.ID, MapCounter<ScanRunState>> scanCounts) {
long start = System.currentTimeMillis();
TabletServerStatus result = new TabletServerStatus();
Map<KeyExtent, Tablet> onlineTabletsCopy;
synchronized (this.onlineTablets) {
onlineTabletsCopy = new HashMap<>(this.onlineTablets);
}
Map<String, TableInfo> tables = new HashMap<>();
for (Entry<KeyExtent, Tablet> entry : onlineTabletsCopy.entrySet()) {
String tableId = entry.getKey().getTableId().canonicalID();
TableInfo table = tables.get(tableId);
if (table == null) {
table = new TableInfo();
table.minors = new Compacting();
table.majors = new Compacting();
tables.put(tableId, table);
}
Tablet tablet = entry.getValue();
long recs = tablet.getNumEntries();
table.tablets++;
table.onlineTablets++;
table.recs += recs;
table.queryRate += tablet.queryRate();
table.queryByteRate += tablet.queryByteRate();
table.ingestRate += tablet.ingestRate();
table.ingestByteRate += tablet.ingestByteRate();
table.scanRate += tablet.scanRate();
long recsInMemory = tablet.getNumEntriesInMemory();
table.recsInMemory += recsInMemory;
if (tablet.isMinorCompactionRunning())
table.minors.running++;
if (tablet.isMinorCompactionQueued())
table.minors.queued++;
if (tablet.isMajorCompactionRunning())
table.majors.running++;
if (tablet.isMajorCompactionQueued())
table.majors.queued++;
}
for (Entry<Table.ID, MapCounter<ScanRunState>> entry : scanCounts.entrySet()) {
TableInfo table = tables.get(entry.getKey().canonicalID());
if (table == null) {
table = new TableInfo();
tables.put(entry.getKey().canonicalID(), table);
}
if (table.scans == null)
table.scans = new Compacting();
table.scans.queued += entry.getValue().get(ScanRunState.QUEUED);
table.scans.running += entry.getValue().get(ScanRunState.RUNNING);
}
ArrayList<KeyExtent> offlineTabletsCopy = new ArrayList<>();
synchronized (this.unopenedTablets) {
synchronized (this.openingTablets) {
offlineTabletsCopy.addAll(this.unopenedTablets);
offlineTabletsCopy.addAll(this.openingTablets);
}
}
for (KeyExtent extent : offlineTabletsCopy) {
String tableId = extent.getTableId().canonicalID();
TableInfo table = tables.get(tableId);
if (table == null) {
table = new TableInfo();
tables.put(tableId, table);
}
table.tablets++;
}
result.lastContact = RelativeTime.currentTimeMillis();
result.tableMap = tables;
result.osLoad = ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage();
result.name = getClientAddressString();
result.holdTime = resourceManager.holdTime();
result.lookups = seekCount.get();
result.indexCacheHits = resourceManager.getIndexCache().getStats().hitCount();
result.indexCacheRequest = resourceManager.getIndexCache().getStats().requestCount();
result.dataCacheHits = resourceManager.getDataCache().getStats().hitCount();
result.dataCacheRequest = resourceManager.getDataCache().getStats().requestCount();
result.logSorts = logSorter.getLogSorts();
result.flushs = flushCounter.get();
result.syncs = syncCounter.get();
result.bulkImports = new ArrayList<>();
result.bulkImports.addAll(clientHandler.getBulkLoadStatus());
result.bulkImports.addAll(bulkImportStatus.getBulkLoadStatus());
result.version = getVersion();
result.responseTime = System.currentTimeMillis() - start;
return result;
}
use of org.apache.accumulo.tserver.tablet.Tablet in project accumulo by apache.
the class TabletServer method markUnusedWALs.
private void markUnusedWALs() {
Set<DfsLogger> candidates;
synchronized (closedLogs) {
candidates = new HashSet<>(closedLogs);
}
for (Tablet tablet : getOnlineTablets()) {
candidates.removeAll(tablet.getCurrentLogFiles());
}
try {
TServerInstance session = this.getTabletSession();
for (DfsLogger candidate : candidates) {
log.info("Marking " + candidate.getPath() + " as unreferenced");
walMarker.walUnreferenced(session, candidate.getPath());
}
synchronized (closedLogs) {
closedLogs.removeAll(candidates);
}
} catch (WalMarkerException ex) {
log.info(ex.toString(), ex);
}
}
Aggregations