Skip to content

Coverage build fails to compile: unused variable in gtest_cas_throttling_gate.cpp #2347

Closed

Description

@CarlosFelipeOR

Type of problem

Bug report — something's broken

Describe the situation

Build (amd_llvm_coverage_per_test) fails to compile on antalya-26.6. src/Disks/tests/gtest_cas_throttling_gate.cpp declares resolve_reads_before outside the #if !WITH_COVERAGE block that holds its only use, so under -DWITH_COVERAGE=1 the variable is unused and -Werror stops the build.

/ClickHouse/src/Disks/tests/gtest_cas_throttling_gate.cpp:69:16: error: unused variable 'resolve_reads_before' [-Werror,-Wunused-variable]
   69 |     const auto resolve_reads_before = ProfileEvents::global_counters[ProfileEvents::CASRequestResolveRead].load();

The break dropped all 8 Stateless tests (amd_llvm_coverage_per_test, per_test_coverage) shards. Nothing else is affected — every other build keeps the block active, so the variable is used there.

Reproduce

Build with -DWITH_COVERAGE=1, or run the Build (amd_llvm_coverage_per_test) job.

Fix

gtest_cas_backend.cpp already carries the right form for the same guard:

 #if !WITH_COVERAGE
     EXPECT_GT(ProfileEvents::global_counters[ProfileEvents::CASRequestResolveRead].load() - resolve_reads_before, 0u)
         << "no throttled write was settled by a read -- the engine's ambiguity-resolution path never ran";
+#else
+    (void)resolve_reads_before;
 #endif

Why PR CI missed it

The PR workflow has no coverage job — Build (amd_llvm_coverage_per_test) runs only in MasterCI. A WITH_COVERAGE-only break merges clean and surfaces on the next merge commit, pointing at an innocent PR.

Additional context

Related PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    CASantalyaantalya-26.6bugbuild

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions