affversion

package
v1.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AffClassify added in v1.6.0

func AffClassify(dbDeployerPath string, dbJsonPath string, config *task.TaskPoolConfig)

AffClassify: classify bugs according to the versions they affect.

Specifically, for each bug, we will calculate the oldest reproducible version `o1v` and use it for classification if the bug can not be reproduced on the previous version of `o1v` (and no error)

Make sure you have done `affversion` or `affdbdeployer`, we will query the database `affversion.db`. You also need to provide `dbdeployer`, which will tell us the order of each version

So the command is:

`./impomysql affclassify dbDeployerPath dbJsonPath taskPoolConfigPath`

We will create `affclassify.json` in taskPoolPath. It is an array of {`o1v`, bug list}.

We will also create a directory `affclassify` in taskPoolPath. For each `o1v`, we will save the first detected bug in `affclassify`

func AffDBDeployer

func AffDBDeployer(dbDeployerPath string, dbJsonPath string, config *task.TaskPoolConfig, threadNum int, portStr string,
	newestImage string, oldestImage string)

AffDBDeployer: In affversion, we need to manually deploy each version of DBMS. Now this work can be done automatically, see https://github.com/qaqcatz/dbdeployer

With dbdeployer, you can use the following command to verify all versions from newestImage to oldestImage:

`./impomysql affdbdeployer dbDeployerPath dbJsonPath taskPoolConfigPath threadNum port newestImage oldestImage`

func AffVersionTask

func AffVersionTask(config *task.TaskConfig, publicConn *connector.Connector, port int, version string, whereVersionStatus string) error

AffVersionTask: sqlsim first!

Verify whether the bugs detected by tasks can be reproduced on the specified version of DBMS. You need to deploy the specified version of DBMS in config.Host:config.Port yourself.

We will create a sqlite database `affversion.db` under the sibling directory of config.GetTaskPath() with a table:

CREATE TABLE IF NOT EXISTS `affversion` (`taskId` INT, `bugJsonName` TEXT, `version` TEXT, `status` INT);
CREATE INDEX IF NOT EXISTS `tv` ON `affversion` (`taskId`, `version`);

If a bug has already been checked, we will skip it. Specifically, we will execute the following query:

SELECT bugJsonName FROM `affversion` WHERE `taskId`=taskId AND `version`=version);

- `port`: although we can read port from config file, we think it is more flexible to specify the port on the command line.

- `taskId`: the id of a task, e.g. 0, 1, 2, ...

- `bugJsonName`: the json file name of a bug, e.g. bug-0-21-FixMHaving1U, you can use task-`taskId`/sqlsim/`bugJsonName` to read the bug.

- `version`, `status`: whether the bug can be reproduced on the specified version of DBMS. `version` can be an arbitrary non-empty string, it is recommended to use tag or commit id. `status`: 1-yes; 0-no; -1-error.

`whereVersionStatus` format: version@status. If whereVersionStatus == "", we will verify each bug under config.GetTaskPath()/sqlsim,

else we will only verify these bugs:

SELECT `bugJsonName` FROM `affversion` WHERE `taskId` = config.TaskId AND `version` = version AND `status`=status

According to the reproduction status of the bug, we will insert a new record to `affversion`:

INSERT INTO `affversion` VALUES (taskId, bugJsonName, version, status)

func AffVersionTaskPool

func AffVersionTaskPool(config *task.TaskPoolConfig, threadNum int, port int, version string, whereVersionEQ string) error

AffVersionTaskPool: like task and task pool, see AffVersionTask. Old versions may crash or exception, we need to save logs for debugging.

logPath: taskPoolPath/affversion-version.log (if version has '/', change to '@')

func PrepareAndRunAffVersionTask

func PrepareAndRunAffVersionTask(logger *logrus.Logger, taskConfigJsonPath string,
	waitGroup *sync.WaitGroup,
	conn *connector.Connector, connPool *connector.ConnectorPool,
	port int, version string, whereVersionEQ string)

Types

type VListPair added in v1.6.0

type VListPair struct {
	O1V     string   `json:"o1v"`
	BugList []string `json:"bugList"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL