From d2ca4109191e92a9da340184e5bc71768853fe8e Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Mon, 20 Nov 2023 15:41:37 +0100 Subject: [PATCH] build: back to opt-level=0 in debug builds, for faster compile times (#5751) This change brings down incremental compilation for me from > 1min to 10s (and this is a pretty old Ryzen 1700X). More details: "incremental compilation" here means to change one character in the `failed to read value from offset` string in `image_layer.rs`. The command for incremental compilation is `cargo build_testing`. The system on which I got these numbers uses `mold` via `~/.cargo/config.toml`. As a bonus, `rust-gdb` is now at least a little fun again. Some tests are timing out in debug builds due to these changes. This PR makes them skip for debug builds. We run both with debug and release build, so, the loss of coverage is marginal. --------- Co-authored-by: Alexander Bayandin --- .cargo/config.toml | 14 -------------- test_runner/regress/test_branch_and_gc.py | 5 ++++- test_runner/regress/test_layer_eviction.py | 5 +++++ test_runner/regress/test_pageserver_restart.py | 5 ++++- test_runner/regress/test_tenant_detach.py | 2 +- test_runner/regress/test_wal_acceptor_async.py | 5 ++++- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index cc767a7f68..5e452974ad 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,17 +1,3 @@ -# The binaries are really slow, if you compile them in 'dev' mode with the defaults. -# Enable some optimizations even in 'dev' mode, to make tests faster. The basic -# optimizations enabled by "opt-level=1" don't affect debuggability too much. -# -# See https://www.reddit.com/r/rust/comments/gvrgca/this_is_a_neat_trick_for_getting_good_runtime/ -# -[profile.dev.package."*"] -# Set the default for dependencies in Development mode. -opt-level = 3 - -[profile.dev] -# Turn on a small amount of optimization in Development mode. -opt-level = 1 - [build] # This is only present for local builds, as it will be overridden # by the RUSTDOCFLAGS env var in CI. diff --git a/test_runner/regress/test_branch_and_gc.py b/test_runner/regress/test_branch_and_gc.py index 53e67b1592..bdc944f352 100644 --- a/test_runner/regress/test_branch_and_gc.py +++ b/test_runner/regress/test_branch_and_gc.py @@ -46,7 +46,10 @@ from fixtures.utils import query_scalar # Because the delta layer D covering lsn1 is corrupted, creating a branch # starting from lsn1 should return an error as follows: # could not find data for key ... at LSN ..., for request at LSN ... -def test_branch_and_gc(neon_simple_env: NeonEnv): +def test_branch_and_gc(neon_simple_env: NeonEnv, build_type: str): + if build_type == "debug": + pytest.skip("times out in debug builds") + env = neon_simple_env pageserver_http_client = env.pageserver.http_client() diff --git a/test_runner/regress/test_layer_eviction.py b/test_runner/regress/test_layer_eviction.py index 6a6273760c..2cd2406065 100644 --- a/test_runner/regress/test_layer_eviction.py +++ b/test_runner/regress/test_layer_eviction.py @@ -1,5 +1,6 @@ import time +import pytest from fixtures.log_helper import log from fixtures.neon_fixtures import ( NeonEnvBuilder, @@ -15,7 +16,11 @@ from fixtures.utils import query_scalar # and then download them back. def test_basic_eviction( neon_env_builder: NeonEnvBuilder, + build_type: str, ): + if build_type == "debug": + pytest.skip("times out in debug builds") + neon_env_builder.enable_pageserver_remote_storage(RemoteStorageKind.LOCAL_FS) env = neon_env_builder.init_start( diff --git a/test_runner/regress/test_pageserver_restart.py b/test_runner/regress/test_pageserver_restart.py index fa1b131537..443b0812fd 100644 --- a/test_runner/regress/test_pageserver_restart.py +++ b/test_runner/regress/test_pageserver_restart.py @@ -144,7 +144,10 @@ def test_pageserver_restart(neon_env_builder: NeonEnvBuilder, generations: bool) # Test that repeatedly kills and restarts the page server, while the # safekeeper and compute node keep running. @pytest.mark.timeout(540) -def test_pageserver_chaos(neon_env_builder: NeonEnvBuilder): +def test_pageserver_chaos(neon_env_builder: NeonEnvBuilder, build_type: str): + if build_type == "debug": + pytest.skip("times out in debug builds") + neon_env_builder.enable_pageserver_remote_storage(s3_storage()) neon_env_builder.enable_scrub_on_exit() diff --git a/test_runner/regress/test_tenant_detach.py b/test_runner/regress/test_tenant_detach.py index 03e78dda2b..0bd3800480 100644 --- a/test_runner/regress/test_tenant_detach.py +++ b/test_runner/regress/test_tenant_detach.py @@ -307,7 +307,7 @@ def test_tenant_detach_smoke(neon_env_builder: NeonEnvBuilder): ) gc_thread = Thread(target=lambda: do_gc_target(pageserver_http, tenant_id, timeline_id)) gc_thread.start() - time.sleep(1) + time.sleep(5) # By now the gc task is spawned but in sleep for another second due to the failpoint. log.info("detaching tenant") diff --git a/test_runner/regress/test_wal_acceptor_async.py b/test_runner/regress/test_wal_acceptor_async.py index 81a2411271..feab7e605b 100644 --- a/test_runner/regress/test_wal_acceptor_async.py +++ b/test_runner/regress/test_wal_acceptor_async.py @@ -602,7 +602,10 @@ async def run_wal_lagging(env: NeonEnv, endpoint: Endpoint, test_output_dir: Pat # The test takes more than default 5 minutes on Postgres 16, # see https://github.com/neondatabase/neon/issues/5305 @pytest.mark.timeout(600) -def test_wal_lagging(neon_env_builder: NeonEnvBuilder, test_output_dir: Path): +def test_wal_lagging(neon_env_builder: NeonEnvBuilder, test_output_dir: Path, build_type: str): + if build_type == "debug": + pytest.skip("times out in debug builds") + neon_env_builder.num_safekeepers = 3 env = neon_env_builder.init_start()