Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
varqox committed Nov 1, 2024
2 parents 3a3c833 + f66103b commit e00addf
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
image: debian:bookworm
options: --security-opt seccomp=unconfined --privileged --security-opt systempaths=unconfined # needed to make clone3() work in the container, and mount cgroup2 read-write, and /proc mountable
steps:
- run: echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- run: mount -t cgroup2 -o nsdelegate,remount none /sys/fs/cgroup
- run: useradd tester
- run: chown -R tester:tester /sys/fs/cgroup
Expand All @@ -27,6 +28,7 @@ jobs:
image: ubuntu:24.04
options: --security-opt seccomp=unconfined --privileged --security-opt systempaths=unconfined # needed to make clone3() work in the container, and mount cgroup2 read-write, and /proc mountable
steps:
- run: echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- run: mount -t cgroup2 -o nsdelegate,remount none /sys/fs/cgroup
- run: useradd tester
- run: chown -R tester:tester /sys/fs/cgroup
Expand All @@ -46,6 +48,7 @@ jobs:
image: fedora:39
options: --security-opt seccomp=unconfined --privileged --security-opt systempaths=unconfined # needed to make clone3() work in the container, and mount cgroup2 read-write, and /proc mountable
steps:
- run: echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- run: mount -t cgroup2 -o nsdelegate,remount none /sys/fs/cgroup
- run: useradd tester
- run: chown -R tester:tester /sys/fs/cgroup
Expand All @@ -64,6 +67,7 @@ jobs:
image: archlinux
options: --security-opt seccomp=unconfined --privileged --security-opt systempaths=unconfined # needed to make clone3() work in the container, and mount cgroup2 read-write, and /proc mountable
steps:
- run: echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- run: mount -t cgroup2 -o nsdelegate,remount none /sys/fs/cgroup
- run: useradd tester
- run: chown -R tester:tester /sys/fs/cgroup
Expand All @@ -82,6 +86,7 @@ jobs:
image: debian:bookworm
options: --security-opt seccomp=unconfined --privileged --security-opt systempaths=unconfined # needed to make clone3() work in the container, and mount cgroup2 read-write, and /proc mountable
steps:
- run: echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- run: mount -t cgroup2 -o nsdelegate,remount none /sys/fs/cgroup
- run: useradd tester
- run: chown -R tester:tester /sys/fs/cgroup
Expand All @@ -102,6 +107,7 @@ jobs:
image: debian:bookworm
options: --security-opt seccomp=unconfined --privileged --security-opt systempaths=unconfined # needed to make clone3() work in the container, and mount cgroup2 read-write, and /proc mountable
steps:
- run: echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- run: mount -t cgroup2 -o nsdelegate,remount none /sys/fs/cgroup
- run: useradd tester
- run: chown -R tester:tester /sys/fs/cgroup
Expand All @@ -121,6 +127,7 @@ jobs:
image: ubuntu:24.04
options: --security-opt seccomp=unconfined --privileged --security-opt systempaths=unconfined # needed to make clone3() work in the container, and mount cgroup2 read-write, and /proc mountable
steps:
- run: echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- run: mount -t cgroup2 -o nsdelegate,remount none /sys/fs/cgroup
- run: useradd tester
- run: chown -R tester:tester /sys/fs/cgroup
Expand All @@ -140,6 +147,7 @@ jobs:
image: fedora:39
options: --security-opt seccomp=unconfined --privileged --security-opt systempaths=unconfined # needed to make clone3() work in the container, and mount cgroup2 read-write, and /proc mountable
steps:
- run: echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- run: mount -t cgroup2 -o nsdelegate,remount none /sys/fs/cgroup
- run: useradd tester
- run: chown -R tester:tester /sys/fs/cgroup
Expand All @@ -158,6 +166,7 @@ jobs:
image: archlinux
options: --security-opt seccomp=unconfined --privileged --security-opt systempaths=unconfined # needed to make clone3() work in the container, and mount cgroup2 read-write, and /proc mountable
steps:
- run: echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- run: mount -t cgroup2 -o nsdelegate,remount none /sys/fs/cgroup
- run: useradd tester
- run: chown -R tester:tester /sys/fs/cgroup
Expand All @@ -176,6 +185,7 @@ jobs:
image: debian:bookworm
options: --security-opt seccomp=unconfined --privileged --security-opt systempaths=unconfined # needed to make clone3() work in the container, and mount cgroup2 read-write, and /proc mountable
steps:
- run: echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- run: mount -t cgroup2 -o nsdelegate,remount none /sys/fs/cgroup
- run: useradd tester
- run: chown -R tester:tester /sys/fs/cgroup
Expand Down
7 changes: 7 additions & 0 deletions subprojects/sim/src/sim/db/schema.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,13 @@ const DbSchema& get_schema() {
" KEY `for_contest_initial_problem_final_by_score_and_full_status` (`initial_final_candidate`,`user_id`,`contest_problem_id`,`score` DESC,`full_status`,`id` DESC),"
// Needed to efficiently query contest view coloring
" KEY `initial_final` (`user_id`,`contest_problem_id`,`contest_problem_initial_final`),"
// For ranking
" KEY `contest_final` (`contest_id`,`contest_problem_final`),"
" KEY `contest_initial_final` (`contest_id`,`contest_problem_initial_final`),"
" KEY `contest_round_final` (`contest_round_id`,`contest_problem_final`),"
" KEY `contest_initial_round_final` (`contest_round_id`,`contest_problem_initial_final`),"
" KEY `contest_problem_final` (`contest_problem_id`,`contest_problem_final`),"
" KEY `contest_initial_problem_final` (`contest_problem_id`,`contest_problem_initial_final`),"
// For foreign keys
" KEY `file_id` (`file_id`),"
" CONSTRAINT `submissions_ibfk_1` FOREIGN KEY (`file_id`) REFERENCES `internal_files` (`id`) ON UPDATE CASCADE,"
Expand Down
18 changes: 14 additions & 4 deletions subprojects/sim/src/sim_upgrader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,27 @@ run_command(const vector<string>& args, const Spawner::Options& options = {}) {

// Update the below hash and body of the function do_perform_upgrade()
constexpr StringView NORMALIZED_SCHEMA_HASH_BEFORE_UPGRADE =
"bffaa77f52297395cf099de1afdc67b919d37a5e0143a64d6f046583037915d8";
"935264658c3a283d37e125526d67102dd03f4596fdfb704d970cd227c48d8bda";

static void do_perform_upgrade(
[[maybe_unused]] const string& sim_dir, [[maybe_unused]] sim::mysql::Connection& mysql
) {
STACK_UNWINDING_MARK;

// Upgrade here
mysql.execute("ALTER TABLE add_problem_jobs DROP COLUMN added_problem_id");
mysql.execute("ALTER TABLE reupload_problem_jobs DROP COLUMN problem_id");
mysql.execute("ALTER TABLE problem_tags MODIFY is_hidden tinyint(1) NOT NULL AFTER problem_id");
mysql.execute(
"ALTER TABLE submissions ADD KEY `contest_final` (`contest_id`,`contest_problem_final`)"
);
mysql.execute("ALTER TABLE submissions ADD KEY `contest_initial_final` (`contest_id`,"
"`contest_problem_initial_final`)");
mysql.execute("ALTER TABLE submissions ADD KEY `contest_round_final` (`contest_round_id`,"
"`contest_problem_final`)");
mysql.execute("ALTER TABLE submissions ADD KEY `contest_initial_round_final` "
"(`contest_round_id`,`contest_problem_initial_final`)");
mysql.execute("ALTER TABLE submissions ADD KEY `contest_problem_final` (`contest_problem_id`,"
"`contest_problem_final`)");
mysql.execute("ALTER TABLE submissions ADD KEY `contest_initial_problem_final` "
"(`contest_problem_id`,`contest_problem_initial_final`)");
}

enum class LockKind {
Expand Down

0 comments on commit e00addf

Please sign in to comment.