* Arena/FastAlloc: add comments where potential metrics can be added (#12306)
* Arena/FastAlloc: add comments where potential metrics can be incremented.
The intent is to count allocations and bytes.
Remove a commented-out ifdef block that has been disabled for many years and
which does not work (per the explanation in the comment). We don't need to
keep reading about the results of a small failed experiment from many years ago.
* add more one FIXME comment
* add one more METRICS-FIXME
* Add a SimpleCounter template for counter metrics (#12326)
* ignore TAGS (from etags/ctags)
* Add initial SimpleCounter interface/implementation/unit tests
* Add initial SimpleCounter interface/implementation/unit tests
* Fix unit test
* Improve clarity on unit test
* Update FIXME comments
* Address review comments. Must use function local static mutex
* update comment
* Go back to template specializations to handle older C++ versions
* SimpleCounter: periodically log the counters to TraceEvent (#12329)
* SimpleCounter: periodically log the counters to TraceEvent. Muck with hierarchical names to comply with random rules.
* Update doc about Prometheus metric names
* relax assertion about counter count, because unit test is actually running in fdbserver and that causes a unrelated counter to be created
* Update SimpleCounter unit tests not to use metric names that break Trace.cpp simulation-only checks (#12333)
* Add a pointed comment in UnitTest.h about some weaknesses
* Use counter names that will get converted to field names that TraceEvent does not complain about
* unit test: do not use a counter name that will cause Trace.cpp to emit errors in simulation
* update comment about caveats with unittests breaking simulation
* yet another field name fix
* just call validateField() directly from simple counters
* run report loop in unit tests
* fix build, fix comment
* blah blah blah
* always be munging metric names
* Instrument Arena, FastAlloc, Platform.cpp with SimpleCounter metrics to count allocations and bytes (#12339)
* emit a simpleCounterReport when we declare out of memory
* FastAlloc.h: initial pass of adding byte/object allocation/deallocation metrics
* Avoid conflict over the name SimpleCounter by eliminating this private definition of a name which is too valuable for this one random file to claim for its own use
* FastAlloc.cpp, Platform.actor.cpp: initial pass at adding SimpleCounter metrics to count allocations and bytes
* rename wrapper calls and update comments
* Count bytes copied in StringRef
* Arena.cpp: instrument allocations and some other stuff
* Arena.cpp: simplify use of SimpleCounter
* simpleCounterReport: generate TraceEvent in batches of MAX_TRACE_EVENT_LENGTH / 100 counters to avoid trace buffer overflow
* Eliminate poorly motivated trace field name validation, and change SimpleCounter to emit Prometheus-compatible metric names (#12356)
Trace.cpp does not provide a rationale for validateField() and validateFormat(). It appears to be some kind of
XML related validation. Why we should care about this is not clear. The output is going to Splunk. As far as I know, Splunk is supposed to be pretty liberal in what it accepts as input.
Add logic in SimpleCounter.cpp to convert hierarchical metric names to Prometheus compatible metric names
by the simple rule of converting intermediate '/' chars into '_', i.e. something like /flow/arena/bytesAllocated becomes
flow_arena_bytesAllocated. I feel hierarchical names are still slightly better, and very easy to reason about when
creating new metric names on the fly, but ensuring that they are at least Prometheus compatible should allow targeting
to future metrics platforms down the road.
Testing:
20250905-010257-gglass-25f3ef43ccc1c130 compressed=True data_size=41538755 duration=6389116 ended=100000 fail_fast=10 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=1:00:34 sanity=False started=100000 stopped=20250905-020331 submitted=20250905-010257 timeout=5400 username=gglass
* replace undocumented trace event field name rules with a rule that enforces that field names must be valid Prometheus metric names. No idea why the old code declines to even state what it is trying to be compatible with
* move Prometheus metric name validation to SimpleCounter.cpp. Remove validation from Trace.cpp. This stuff is going to Splunk. Splunk takes what we give it.
* Use simple counter to replace recently added net2 counters (#12358)
* use simple counter to replace recent added net2 counters
* allow unit test to use SimpleCounter Trace event
---------
Co-authored-by: Zhe Wang <zhe.wang@wustl.edu>
* New restore consolidated commit
This change adds RestoreDispatchPartitionedTaskFunc to restore
from partitioned-format backup.
* ArenaBlock::totalSize parameter pass by ref
* Fix format issues identified by CI
Original code comment says
"there's no hard guarantee about the above equality and the result could vary by platform, malloc implementation, and tooling instrumentation (e.g. ASAN, valgrind)"
Therefore, we should remove the assertion on UB. Since removal of the UB makes the rest of the test case
less meaningful, we commented out the entire test case.
Furthermore, we have a case in which, even without ASAN or other instrumentation, e.g. Valgrind, etc, the equality does not hold.
Profile: team
Commit hash: 3164cadc6f
Command: devRetryCorrectnessTest bin/fdbserver -r simulation -f tests/fast/RandomUnitTests.toml -s 3939330597 -b on --crash --trace_format json
* Enable secure allocation mode in Arena
This mode allows zeroing out blocks holding sensitive data after use
* Introduce WipedString to all token-holding memory
Also introduce a option flag "sensitive"
* Make pointer equivalency a hard requirement for non-ASAN builds
So that we can detect when Arena/malloc/memory-wipe behavior changes
Narrow the self-reference ASSERT in ArenaBlock::dependOn to only
the cases where we're trying to make a reference from self -> other.
It's allowed for self.getPtr() to be null, in which case we create
the ArenaBlock anew and there's no danger of self-reference.
Fixes Issue #8869.
The intent is to have one ArenaBlock live at least at long as another. If they're
the same, that's accomplished without doing any additional bookkeeping.
It introduces a cycle in the `next` pointers in the ArenaBlockRef's,
which results in infinite recursion as we follow them in `getTotalSize`.
This doesn't fix the underlying problem, but gives a better failure
than a stack overflow.
* Allocate at least sizeof(ArenaBlock) for an ArenaBlock
* Fix message pack unit test
Previously we were using only the 4 least significan bits as the length
of a message pack string, but it should be 5 according to https://github.com/msgpack/msgpack/blob/master/spec.md#str-format-family
* Add contrib/debug_determinism
Add an instrumentation-based technique for debugging unseen mismatches. Also guard a few existing sources of nondeterminism that don't affect unseen with the DEBUG_DETERMINISM macro.
Also change the simulated run loop to not run as the only task inside the real run loop, since that was a source of nondeterminism.
Also fix nondeterminism from calling timer_int
* Add StorageMetadataType::currentTime
Basically a deterministic-in-simulation version of timer_int that we can
use instead of timer_int for StorageMetadataType::createdTime