Project: Scylla (App Definition and Development / Database)
File: backport.md

Backport queue is implemented using github issues and github label. All patches that fix things must come with a Fixes: #nnnn line; if a patchset it should be present on the cover letter as well. All patches with Fixes: should also include which branches need backport (perhaps none) by including Branches: w.x, y.z or Branches: none Maintainers will insist on rule 1 After a patch with a Fixes #nnnn line gets promoted, a bot wakes up and assigns the label [Backport candidate] to that issue iff: no Branches: was added Branches: w.x was added In case the "Branches: none" was specified the label [Backport candidate] is not set Once a week or so a maintainer wakes up and filters the issue list of open [Backport candidate]s. The maintainer may take the following actions: 5.1. Decide no branches need the fix, and remove the label 5.2. Decide the fix does not merit a backport, and remove the label (explaining why in the issue) 5.3. Backport to branches that require it, and remove the label 5.4. Backport to some branches, but not others, noting which and keeping the label 5.5. Decide that more time is needed to gain confidence in the fix, and keep the label 5.6. Ask someone else (from QA, or the patch author, or anyone relevant) for assistance in selecting among the options When backporting the maintainer will try to cherry-pick the changes onto the branch with older version of Scylla, but sometimes additional changes are needed to make the change work with old code. In such case the maintainer can ask the contributor to prepare a change to work with this particular version. Here are the instructions for a contributor on how to properly prepare these changes. It's the easiest to show it by an example, so let's look at PR , which fixed issue . First the original PR should get

In the example the author wanted to merge the branch `cvybhu:filtermultibug` into `scylladb:master`. Each PR is submitted on its own branch, which the PR author wants to merge into the `master` branch. Before the changes end up on `master`, they are first added to the `next` branch to run some additional tests. Later the `next` branch is merged into `master` and the PR is officially merged. Released versions of `Scylla` live on their own branches - `branch-5.0`, `branch-4.6` etc. To backport the change we will have to put it on its own branch and merge it into the branch with the desired version. In the example, the PR with the backport wants to merge `cvybhu:filtermultibug_5.0` into `scylladb:branch-5.0`. Before the changes end up on `branch-5.0`, they are first added to the `next-5.0` branch to run some additional tests. Later the `next-5.0` branch is merged into `branch-5.0` and the PR is officially backported. Go to the branch with the target backport version ```bash git fetch origin branch-5.0 git checkout -t origin/branch-5.0 git submodule sync git pull origin branch-5.0 git submodule update --recursive ``` Create a branch with the fix ```bash git checkout -b myfixbranch_5.0 ``` Copy the changes to the branch, use the merge commit from `master`. This command will copy all commits to the branch at once, which might result in a lot conflicts to resolve. It's also possible to cherry-pick the commits individually in order to tackle the conflicts one at a time. Please use the `-x` option on cherry-pick so that's it's possible to tell where the commit came from. ```bash git cherry-pick -m1 -x 2d2034ea28b8615a130146ad9780010d29d2fcc9 ``` Resolve conflicts as necessary Build and run the tests using `dbuild` ```bash ./tools/toolchain/dbuild ./configure.py --disable-dpdk ./tools/toolchain/dbuild ninja dev-test ``` Push the branch ```bash git push <my-scylla-fork> myfixbranch_5.0 ``` Open the PR. Change the branch so that the merge target is the backport branch (e.g `branch-5.0`) instead of `master`