Skip to content

Commit

Permalink
build: back to opt-level=0 in debug builds, for faster compile times (#…
Browse files Browse the repository at this point in the history
…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 <alexander@neon.tech>
  • Loading branch information
problame and bayandin committed Nov 20, 2023
1 parent d98ac04 commit d2ca410
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
14 changes: 0 additions & 14 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 4 additions & 1 deletion test_runner/regress/test_branch_and_gc.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@
# 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()

Expand Down
5 changes: 5 additions & 0 deletions test_runner/regress/test_layer_eviction.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import time

import pytest
from fixtures.log_helper import log
from fixtures.neon_fixtures import (
NeonEnvBuilder,
Expand All @@ -15,7 +16,11 @@
# 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(
Expand Down
5 changes: 4 additions & 1 deletion test_runner/regress/test_pageserver_restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,10 @@ def assert_complete():
# 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()

Expand Down
2 changes: 1 addition & 1 deletion test_runner/regress/test_tenant_detach.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
5 changes: 4 additions & 1 deletion test_runner/regress/test_wal_acceptor_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,10 @@ def adjust_safekeepers(env: NeonEnv, active_sk: List[bool]):
# 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()

Expand Down

1 comment on commit d2ca410

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2456 tests run: 2321 passed, 0 failed, 135 skipped (full report)


Flaky tests (1)

Postgres 16

  • test_crafted_wal_end[simple]: debug

Code coverage (full report)

  • functions: 54.5% (9093 of 16693 functions)
  • lines: 81.5% (52342 of 64185 lines)

The comment gets automatically updated with the latest test results
d2ca410 at 2023-11-20T15:24:18.527Z :recycle:

Please sign in to comment.