support Oracle flash back; auto-fix metric type; compile ojdbc

This commit is contained in:
yangdsh
2019-11-23 20:21:51 +00:00
committed by Dana Van Aken
parent 5555ead3a3
commit dceee6e0ba
8 changed files with 111 additions and 11 deletions

View File

@@ -3,6 +3,8 @@
#
# Copyright (c) 2017-18, Carnegie Mellon University Database Group
#
import logging
from collections import OrderedDict
from website.models import KnobCatalog, KnobUnitType, MetricCatalog
@@ -10,6 +12,8 @@ from website.types import BooleanType, MetricType, VarType
from website.utils import ConversionUtil
from .. import target_objectives
LOG = logging.getLogger(__name__)
# pylint: disable=no-self-use
class BaseParser:
@@ -300,7 +304,7 @@ class BaseParser:
'Invalid metric type: {}'.format(metric.metric_type))
return valid_metrics, diffs
def calculate_change_in_metrics(self, metrics_start, metrics_end):
def calculate_change_in_metrics(self, metrics_start, metrics_end, fix_metric_type=True):
adjusted_metrics = {}
for met_name, start_val in list(metrics_start.items()):
end_val = metrics_end[met_name]
@@ -316,6 +320,13 @@ class BaseParser:
adj_val = end_val - start_val
else: # MetricType.STATISTICS or MetricType.INFO
adj_val = end_val
if fix_metric_type:
if adj_val < 0:
adj_val = end_val
LOG.debug("Changing metric %s from COUNTER to STATISTICS", met_name)
metric_fixed = self.metric_catalog_[met_name]
metric_fixed.metric_type = MetricType.STATISTICS
metric_fixed.save()
assert adj_val >= 0, \
'{} wrong metric type: {} (start={}, end={}, diff={})'.format(
met_name, MetricType.name(met_info.metric_type), start_val,