|
@@ -57,6 +57,7 @@ import org.apache.hadoop.yarn.server.timelineservice.storage.common.TimestampGen
|
|
public class FlowRunCoprocessor extends BaseRegionObserver {
|
|
public class FlowRunCoprocessor extends BaseRegionObserver {
|
|
|
|
|
|
private static final Log LOG = LogFactory.getLog(FlowRunCoprocessor.class);
|
|
private static final Log LOG = LogFactory.getLog(FlowRunCoprocessor.class);
|
|
|
|
+ private boolean isFlowRunRegion = false;
|
|
|
|
|
|
private HRegion region;
|
|
private HRegion region;
|
|
/**
|
|
/**
|
|
@@ -70,9 +71,15 @@ public class FlowRunCoprocessor extends BaseRegionObserver {
|
|
if (e instanceof RegionCoprocessorEnvironment) {
|
|
if (e instanceof RegionCoprocessorEnvironment) {
|
|
RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
|
|
RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
|
|
this.region = env.getRegion();
|
|
this.region = env.getRegion();
|
|
|
|
+ isFlowRunRegion = TimelineStorageUtils.isFlowRunTable(
|
|
|
|
+ region.getRegionInfo(), env.getConfiguration());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public boolean isFlowRunRegion() {
|
|
|
|
+ return isFlowRunRegion;
|
|
|
|
+ }
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* (non-Javadoc)
|
|
* (non-Javadoc)
|
|
*
|
|
*
|
|
@@ -93,6 +100,9 @@ public class FlowRunCoprocessor extends BaseRegionObserver {
|
|
WALEdit edit, Durability durability) throws IOException {
|
|
WALEdit edit, Durability durability) throws IOException {
|
|
Map<String, byte[]> attributes = put.getAttributesMap();
|
|
Map<String, byte[]> attributes = put.getAttributesMap();
|
|
|
|
|
|
|
|
+ if (!isFlowRunRegion) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
// Assumption is that all the cells in a put are the same operation.
|
|
// Assumption is that all the cells in a put are the same operation.
|
|
List<Tag> tags = new ArrayList<>();
|
|
List<Tag> tags = new ArrayList<>();
|
|
if ((attributes != null) && (attributes.size() > 0)) {
|
|
if ((attributes != null) && (attributes.size() > 0)) {
|
|
@@ -160,6 +170,10 @@ public class FlowRunCoprocessor extends BaseRegionObserver {
|
|
@Override
|
|
@Override
|
|
public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> e,
|
|
public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> e,
|
|
Get get, List<Cell> results) throws IOException {
|
|
Get get, List<Cell> results) throws IOException {
|
|
|
|
+ if (!isFlowRunRegion) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
Scan scan = new Scan(get);
|
|
Scan scan = new Scan(get);
|
|
scan.setMaxVersions();
|
|
scan.setMaxVersions();
|
|
RegionScanner scanner = null;
|
|
RegionScanner scanner = null;
|
|
@@ -190,11 +204,14 @@ public class FlowRunCoprocessor extends BaseRegionObserver {
|
|
@Override
|
|
@Override
|
|
public RegionScanner preScannerOpen(
|
|
public RegionScanner preScannerOpen(
|
|
ObserverContext<RegionCoprocessorEnvironment> e, Scan scan,
|
|
ObserverContext<RegionCoprocessorEnvironment> e, Scan scan,
|
|
- RegionScanner s) throws IOException {
|
|
|
|
- // set max versions for scan to see all
|
|
|
|
- // versions to aggregate for metrics
|
|
|
|
- scan.setMaxVersions();
|
|
|
|
- return s;
|
|
|
|
|
|
+ RegionScanner scanner) throws IOException {
|
|
|
|
+
|
|
|
|
+ if (isFlowRunRegion) {
|
|
|
|
+ // set max versions for scan to see all
|
|
|
|
+ // versions to aggregate for metrics
|
|
|
|
+ scan.setMaxVersions();
|
|
|
|
+ }
|
|
|
|
+ return scanner;
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -213,6 +230,9 @@ public class FlowRunCoprocessor extends BaseRegionObserver {
|
|
public RegionScanner postScannerOpen(
|
|
public RegionScanner postScannerOpen(
|
|
ObserverContext<RegionCoprocessorEnvironment> e, Scan scan,
|
|
ObserverContext<RegionCoprocessorEnvironment> e, Scan scan,
|
|
RegionScanner scanner) throws IOException {
|
|
RegionScanner scanner) throws IOException {
|
|
|
|
+ if (!isFlowRunRegion) {
|
|
|
|
+ return scanner;
|
|
|
|
+ }
|
|
return new FlowScanner(e.getEnvironment(), scan.getBatch(),
|
|
return new FlowScanner(e.getEnvironment(), scan.getBatch(),
|
|
scanner, FlowScannerOperation.READ);
|
|
scanner, FlowScannerOperation.READ);
|
|
}
|
|
}
|
|
@@ -221,6 +241,9 @@ public class FlowRunCoprocessor extends BaseRegionObserver {
|
|
public InternalScanner preFlush(
|
|
public InternalScanner preFlush(
|
|
ObserverContext<RegionCoprocessorEnvironment> c, Store store,
|
|
ObserverContext<RegionCoprocessorEnvironment> c, Store store,
|
|
InternalScanner scanner) throws IOException {
|
|
InternalScanner scanner) throws IOException {
|
|
|
|
+ if (!isFlowRunRegion) {
|
|
|
|
+ return scanner;
|
|
|
|
+ }
|
|
if (LOG.isDebugEnabled()) {
|
|
if (LOG.isDebugEnabled()) {
|
|
if (store != null) {
|
|
if (store != null) {
|
|
LOG.debug("preFlush store = " + store.getColumnFamilyName()
|
|
LOG.debug("preFlush store = " + store.getColumnFamilyName()
|
|
@@ -241,6 +264,9 @@ public class FlowRunCoprocessor extends BaseRegionObserver {
|
|
@Override
|
|
@Override
|
|
public void postFlush(ObserverContext<RegionCoprocessorEnvironment> c,
|
|
public void postFlush(ObserverContext<RegionCoprocessorEnvironment> c,
|
|
Store store, StoreFile resultFile) {
|
|
Store store, StoreFile resultFile) {
|
|
|
|
+ if (!isFlowRunRegion) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
if (LOG.isDebugEnabled()) {
|
|
if (LOG.isDebugEnabled()) {
|
|
if (store != null) {
|
|
if (store != null) {
|
|
LOG.debug("postFlush store = " + store.getColumnFamilyName()
|
|
LOG.debug("postFlush store = " + store.getColumnFamilyName()
|
|
@@ -262,6 +288,9 @@ public class FlowRunCoprocessor extends BaseRegionObserver {
|
|
InternalScanner scanner, ScanType scanType, CompactionRequest request)
|
|
InternalScanner scanner, ScanType scanType, CompactionRequest request)
|
|
throws IOException {
|
|
throws IOException {
|
|
|
|
|
|
|
|
+ if (!isFlowRunRegion) {
|
|
|
|
+ return scanner;
|
|
|
|
+ }
|
|
FlowScannerOperation requestOp = FlowScannerOperation.MINOR_COMPACTION;
|
|
FlowScannerOperation requestOp = FlowScannerOperation.MINOR_COMPACTION;
|
|
if (request != null) {
|
|
if (request != null) {
|
|
requestOp = (request.isMajor() ? FlowScannerOperation.MAJOR_COMPACTION
|
|
requestOp = (request.isMajor() ? FlowScannerOperation.MAJOR_COMPACTION
|