7b962c4065637056255c2a7f291dc798b81c4560,server/website/website/db/myrocks/parser.py,MyRocksParser,convert_dbms_knobs,#MyRocksParser#Any#,179

Before Change


        knob_data = {}
        for name, value in list(knobs.items()):
            prt_name = self.partial_name(name)
            if prt_name in self.tunable_knob_catalog_:
                metadata = self.tunable_knob_catalog_[prt_name]
                assert(metadata.tunable)
                value = knobs[name]
                conv_value = None
                if metadata.vartype == VarType.BOOL:
                    conv_value = self.convert_bool(value, metadata)
                elif metadata.vartype == VarType.ENUM:
                    conv_value = self.convert_enum(value, metadata)
                elif metadata.vartype == VarType.INTEGER:
                    conv_value = self.convert_integer(value, metadata)
                elif metadata.vartype == VarType.REAL:
                    conv_value = self.convert_real(value, metadata)
                elif metadata.vartype == VarType.STRING:
                    conv_value = self.convert_string(value, metadata)
                elif metadata.vartype == VarType.TIMESTAMP:
                    conv_value = self.convert_timestamp(value, metadata)
                else:
                    raise Exception(
                        "Unknown variable type: {}".format(metadata.vartype))
                if conv_value is None:
                    raise Exception(
                        "Param value for {} cannot be null".format(name))
                knob_data[name] = conv_value
        return knob_data

After Change



    def convert_dbms_knobs(self, knobs):
        knob_data = {}
        tunable_knob_catalog = KnobCatalog.objects.filter(dbms__id=self.dbms_id, tunable=True)
        for name, value in list(knobs.items()):
            prt_name = self.partial_name(name)
            metadata = tunable_knob_catalog.filter(name=prt_name).first()
            if metadata:
                conv_value = None
                if metadata.vartype == VarType.BOOL:
                    conv_value = self.convert_bool(value, metadata)
                elif metadata.vartype == VarType.ENUM:
                    conv_value = self.convert_enum(value, metadata)
                elif metadata.vartype == VarType.INTEGER:
                    conv_value = self.convert_integer(value, metadata)
                elif metadata.vartype == VarType.REAL:
                    conv_value = self.convert_real(value, metadata)
                elif metadata.vartype == VarType.STRING:
                    conv_value = self.convert_string(value, metadata)
                elif metadata.vartype == VarType.TIMESTAMP:
                    conv_value = self.convert_timestamp(value, metadata)
                else:
                    raise Exception(
                        "Unknown variable type: {}".format(metadata.vartype))
                if conv_value is None:
                    raise Exception(
                        "Param value for {} cannot be null".format(name))
                knob_data[name] = conv_value
        return knob_data

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 11

Instances


Project Name: cmu-db/ottertune
Commit Name: 7b962c4065637056255c2a7f291dc798b81c4560
Time: 2020-01-13
Author: dvanaken@cs.cmu.edu
File Name: server/website/website/db/myrocks/parser.py
Class Name: MyRocksParser
Method Name: convert_dbms_knobs


Project Name: cmu-db/ottertune
Commit Name: 7b962c4065637056255c2a7f291dc798b81c4560
Time: 2020-01-13
Author: dvanaken@cs.cmu.edu
File Name: server/website/website/db/myrocks/parser.py
Class Name: MyRocksParser
Method Name: convert_dbms_metrics


Project Name: cmu-db/ottertune
Commit Name: 7b962c4065637056255c2a7f291dc798b81c4560
Time: 2020-01-13
Author: dvanaken@cs.cmu.edu
File Name: server/website/website/db/base/parser.py
Class Name: BaseParser
Method Name: calculate_change_in_metrics


Project Name: cmu-db/ottertune
Commit Name: 7b962c4065637056255c2a7f291dc798b81c4560
Time: 2020-01-13
Author: dvanaken@cs.cmu.edu
File Name: server/website/website/db/myrocks/parser.py
Class Name: MyRocksParser
Method Name: convert_dbms_knobs