Skip to content

Conversation

@djatnieks
Copy link

What is the issue

cndb-15058: table metrics - bloom filter memory usage doesn't include partially written sstables' if early open is not enabled

What does this PR fix and why was it fixed

Include in flight BF memory usage if early open is not enabled

… early open is not enabled (#1949)

cndb-15058: table metrics - bloom filter memory usage doesn't include
partially written sstables' if early open is not enabled

Include in flight BF memory usage if early open is not enabled
@github-actions
Copy link

Checklist before you submit for review

  • This PR adheres to the Definition of Done
  • Make sure there is a PR in the CNDB project updating the Converged Cassandra version
  • Use NoSpamLogger for log lines that may appear frequently in the logs
  • Verify test results on Butler
  • Test coverage for new/modified code is > 80%
  • Proper code formatting
  • Proper title for each commit staring with the project-issue number, like CNDB-1234
  • Each commit has a meaningful description
  • Each commit is not very long and contains related changes
  • Renames, moves and reformatting are in distinct commits
  • All new files should contain the DataStax copyright header instead of the Apache License one

@djatnieks
Copy link
Author

@jasonstack The 5.0 implementation of bf metrics is changed and I think this is causing the test to fail - I left a FIXME comment in BloomFilterMetrics which seems to me the closest equivalent of TableMetrics.bloomFilterOffHeapMemoryUsed createTableGuage implements getValue` with:

     long total = inFlightBloomFilterOffHeapMemoryUsed.get();

In 5.0 I cannot see a way to access inFlightBloomFilterOffHeapMemoryUsed from TableMetrics in BloomFilterMetrics.

I considered moving inFlightBloomFilterOffHeapMemoryUsed to BloomFilterMetrics, but TableMetrics is per-table while BloomFilterMetrics is not and currently only operates on sstable readers, so that didn't seem to help any.

I want to check with you about options before I consider something else ... let me know what you think - thanks!

@jasonstack
Copy link

Hi @djatnieks the refactoring in 5.0 is tricky..

Maybe we can refactor GaugeProvider to use Function<ColumnFamilyStore, T> neutralValue to extract value from inFlightBloomFilterOffHeapMemoryUsed (which can be stored in CFS or TableMetrics).

Similar to the following, but it uses a fixed neutralValue

    protected final <T extends Number> GaugeProvider<T> newGaugeProvider(String name, T neutralValue, Function<R, T> extractor, BiFunction<T, T, T> combiner)
    {
        return new SimpleGaugeProvider<>(this::map, name, readers -> {
            T total = neutralValue;
            for (R reader : readers)
                total = combiner.apply(total, extractor.apply(reader));
            return total;
        });
    }

…oomFilterMetrics.bloomFilterOffHeapMemoryUsed
@sonarqubecloud
Copy link

@cassci-bot
Copy link

@djatnieks djatnieks assigned driftx and unassigned driftx Aug 27, 2025
@djatnieks djatnieks requested a review from driftx August 28, 2025 15:08
@djatnieks
Copy link
Author

the refactoring in 5.0 is tricky..

Yes, indeed. Thanks for the suggestions @jasonstack - I was able to update AbstractMetricsProviders with a new guage provider to use for bloomFilterOffHeapMemoryUsed that uses inFlightBloomFilterOffHeapMemoryUsed and now the new test is passing.

@djatnieks djatnieks merged commit c37db98 into main-5.0 Aug 28, 2025
576 of 592 checks passed
@djatnieks djatnieks deleted the CNDB-15213 branch August 28, 2025 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants