Commit Graph

1049 Commits

Author SHA1 Message Date
michael stack ac41ec01f6 Backport: add retry limit to startMoveKeys to prevent infinite loops (PR 13176)
Add START_MOVE_KEYS_MAX_RETRIES knob (default 50, BUGGIFY=10) and throw
start_move_keys_too_many_retries when exceeded. Wire the new error into
DDRelocationQueue (same light-weight re-queue handler as
finish_move_keys_too_many_retries and move_to_removed_server) and
normalDDQueueErrors so DD does not restart. Also propagate actor_cancelled
before the retry limit check in startMoveKeys.
2026-07-23 16:46:02 -07:00
Michael Stack 14de1de30e
Forward-port: DD 7.3 finish movekeys backoff (#12991) to 7.4 (#13145)
* DD 7.3 finish movekeys backoff (#12991)

* Add jitter to finishMoveKeys backoff

Jitter the exponential backoff delay to [0.75x, 1.25x] of the base
value. This prevents all 15 FlowLock slots from retrying in lockstep
when they all hit transaction_too_old at the same time.

* Cap finishMoveKeys backoff at 5s after jitter

Apply the 5.0s cap after jitter so the final delay never exceeds
the documented maximum.
2026-05-12 09:27:53 -07:00
gxglass 0bc25f0438
Add 66 counters for 22 DD or related transactions to count begin, commit, and abort for each (#13062) (#13097)
Problem: some of these transactions have been observed to involve cascades of many shards trying to execute them simultaneously owing to somewhat unpredictable DD dynamics. This then results in DD being pegged on CPU with many failing transactions.

Solution: the counters here will make it clear if this is happening and if so, where, so that further mitigations/solutions can be devised. Some of these code paths have TraceEvents, but some don't and of the existing TraceEvents, many are sampled. This PR avoids all of that and counts every time through, making us less reliant on guesswork.

An alternative approach (not taken here for many reasons) would be to instrument transaction code to let callers pass a tag. Then have the transaction client and/or server side emit a few metrics (started, committed, aborted) parameterized by tag.

One may reasonably object that the boilerplate here is kind of fugly. I guess my view is that at this late date the time for more subtle approaches has come and gone. We need this code to tell us what it is doing and if this looks a little intrusive, so be it.

Testing:
20260422-234326-gglass-2f514436068d99e6 compressed=True data_size=35519571 duration=5298275 ended=100000 fail=1 fail_fast=10 max_runs=100000 pass=99999 priority=100 remaining=0 runtime=0:55:44 sanity=False started=100000 stopped=20260423-003910 submitted=20260422-234326 timeout=5400 username=gglass
2026-04-28 17:37:09 -07:00
Michael Stack 02be074632
Forward-port to 7.4: Add DD init and team collection logging for diagnosing slow startups (#13002)
* Add DD init visibility, metrics retries, shard tracking, scan progress, and team collection logging (#12913)

Add logging throughout DD startup and runtime to diagnose slow startups,
stuck data moves, and undesired server classification.

DDTxnProcessor: Log elapsed time for server list + data move read
transaction and keyServer scan. Warn when getRange(dataMoveKeys) takes
over 5 seconds.

DataDistribution: Add NumShards and NumServers to DDInitGotInitialDD.
Add DDInitResumedDataMoves summary with ValidMoves, CancelledMoves,
EmptyMoves counts and elapsed time. Log DD exit reason as DDExiting
at SevWarn. Add DDInit-prefixed trace events throughout startup sequence.

DDTeamCollection: Add Reason and Address details to UndesiredStorageServer
trace events to distinguish version lag, same-address, wrong-class, and
exclusion causes.

DDShardTracker: Log TrackInitialShardsComplete with shard count and
TrackInitialShardsMetricsComplete with elapsed time.

NativeAPI: Add retry counting and logging for getStorageMetrics timeouts.

* Remove double trace

* Fix DD trace event issues: rate-limit warns, deduplicate events, fix DDExiting

- Wire up unused lastLogTime in waitStorageMetrics to rate-limit SevWarn
  events to once per 10s after the 60s threshold. Previously every retry
  (up to 100/s with 10ms WRONG_SHARD_SERVER_DELAY) emitted SevWarn.

- Remove redundant DataDistributorRunning and DDInitRunning events inside
  the try block. Rename the original DataDistributorRunning to DDInitRunning
  so a single event serves both purposes and fits the DDInit* query pattern.

- Move DDExiting to the three actual throw sites so it only fires on
  terminal exits, not on retries of movekeys_conflict/dd_config_changed
  when DD is disabled.

* Trim over-apologetic DDInitDone comment
2026-04-22 19:57:28 -07:00
Michael Stack 431e7c952d
Cherrypick Add restore validation feature: restores to special keyspace allowing validating backup/restore in single cluster (space willing) (#12573) (#12648)
* Add restore validation feature: restores to special keyspace allowing validating backup/restore in single cluster (space willing) (#12573)

* Add restore validation feature with simplified backup gap fix

Implements restore validation using audit_storage to verify backup/restore
correctness. Includes a minimal fix for the backup gap bug.

Key components:
- ValidateRestore audit type: compares source keys against restored keys
  at \xff\x02/rlog/ prefix in storage server
- DD audit fixes: propagate validation errors, handle DD failover correctly
- RestoreValidation and BackupAndRestoreValidation workloads for testing
- Simplified backup gap fix: prevent snapshot from finishing in the same
  iteration it dispatches the last tasks (single flag + one check)

* No faultInjection in 7.4

* Make it so no encryption when the restore validation test runs

* Add error_code_audit_storage_task_outdated to bypass list rather than do special-case handling

---------

Co-authored-by: michael stack <stack@duboce.com>
2026-01-22 13:41:34 -08:00
Zhe Wang a9cc2dd7dc
Cherrypick recent bulkload changes (#12135)
* Add multipart retry delay configuration. (#12076)

Add documentation to .h file.

Co-authored-by: stack <stack@duboce.com>

* Add a quickstart section on the bulkdump/bulkload feature to the user doc. (#12090)

* Fix assertion failure in fdbcli (#12095)

* Add Option to Turn Off Failure Injection to BulkLoad Process (#12096)

* add option to turn off failure injection to bulkload process in simulation

* nit

* DD BulkLoadTask Load Balance (#12103)

* bulkload load balance

* improve bulkload task submission efficiency

* address comments

* address comments

* cleanup

* Take a --proxy argument as backup_agent does. (#12110)

* Add "--proxy" to fdbserver (#12109)

* add --proxy to fdbserver

* fmt

* address comments

* use g_network to store proxy for s3client_ci

* Add 'ls' to s3client for the case where 'aws s3' is not installable (#12118)

* Add 'ls' to s3client for the case where 'aws s3' is not installable
-- i.e. production -- and we want a tool to test s3 connectivity.

Use it like this:

~/build_output/bin/s3client \
  --tls-ca-file /etc/ssl/cert.pem \
  --blob-credentials /path/to/credentials.json \
  ls "blobstore://backup-us-west-2.s3.amazonaws.com/x?bucket=backup-us-west-2&region=us-west-2"

* fdbclient/S3BlobStore.actor.cpp
* fdbclient/include/fdbclient/S3BlobStore.h
 Make constructResourcePath method on endpoint so accessible making ls
 URLs. Handling for encoded ampersands too. Allow 404 when requesting
 resource that doesn't exist.

* fdbclient/S3Client.actor.cpp
* fdbclient/S3Client_cli.actor.cpp
 Add in ls implementation.

* fdbclient/tests/s3client_test.sh
 Add test for new ls facility.

* See if this fixes compile issue

---------

Co-authored-by: michael stack <stack@duboce.com>

* Ingest sst files rather than their keyvalue content (2nd attempt) (#12108)

* Ingest sst files rather than their keyvalue content.

* fdbclient/ServerKnobs.cpp
* fdbclient/include/fdbclient/ServerKnobs.h
 Add BULK_LOAD_USE_SST_INGEST knob.

* fdbclient/include/fdbclient/IKeyValueStore.actor.h
 Add ingestSSTFiles and supportSStIngestion.

* fdbserver/KeyValueStoreRocksDB.actor.cpp
* fdbserver/KeyValueStoreShardedRocksDB.actor.cpp
 Implement ingestSSTFiles and supportSStIngestion

* fdbserver/storageserver.actor.cpp
 If BULK_LOAD_USE_SST_INGEST and BulkLoadType::SST, ingest sst file
 rather than read keyvalues.

* fdbclient/tests/fdb_cluster_fixture.sh
 Use rocksdb instead of sqllite in tests.

* Revert "Ingest sst files rather than their keyvalue content."

This reverts commit 6d50bf15d3566de17fa6febf2afba0f220846ca6.

* ctests pass

* Restore ingest minus metric

* Add back ingestDuration metric

* Formatting

---------

Co-authored-by: michael stack <stack@duboce.com>

* Allow resource to be empty (#12129)

* RocksDB Do Compact After BulkLoad (#12130)

* rocksdb bulkload compact after load

* address comments

* address comments

* job overwrite task root path (#12138)

* BulkLoad Load Balance Based on DataMove Busy Map  (#12137)

* bulkload load balance in ddqueue

* cleanup

* address comments

* nit

* bug fix

* nit

* address comments

* avoid scheduler busy loop

* address comments

* address comments

* avoid busy loop (#12157)

* First set of fixes... sizes and implement deleteResource (#12156)

Co-authored-by: michael stack <stack@duboce.com>

---------

Co-authored-by: Michael Stack <saintstack@users.noreply.github.com>
Co-authored-by: stack <stack@duboce.com>
2025-05-19 14:42:22 -07:00
Zhe Wang 6fa83c231d
audit replica should not read empty range to check (#12043) 2025-03-19 18:38:59 -07:00
Zhe Wang a345d66ec3
A Couple of Fixes and Improvements for BulkLoad/Dump (#12040) 2025-03-19 09:00:36 -07:00
Zhe Wang 0e736c68e7
Allow One BulkloadTask Do Multiple Manifests (#12036) 2025-03-17 11:45:15 -07:00
Zhe Wang d5946157f0
avoid shard merge when bulkload (#12035) 2025-03-15 13:20:51 -07:00
Zhe Wang eb0d9f2028
Add Verbose Level for BulkLoad Trace Events (#12034)
* add level for DDBulkLoad except for datadistribution

* nits
2025-03-14 19:15:41 -07:00
Zhe Wang 6ae46b4917
BulkLoadJob Should Not Schedule Completed BulkLoadTask (#12030)
* make bulkload job manager logic clear

* bypass task if the task has been completed

* improve scheduleBulkLoadJob
2025-03-14 14:52:33 -07:00
Zhe Wang 9f5fdd0bea
Add BulkLoad Task Count to BulkLoad FDBCLI Command (#12029)
* change a event name

* add bulkload task count to fdbcli

* nit
2025-03-13 21:07:47 -07:00
Zhe Wang 10fecd0a4e
Add Error Message To BulkLoadJob Metadata (#12024)
* add error message to bulkload metadata

* remove TODOs and add error message for bulkload job manifest map creation failures

* nits
2025-03-13 10:02:39 -07:00
Zhe Wang 529db211b2
persist bulkload task count in bulkload job (#12022) 2025-03-12 15:35:26 -07:00
Zhe Wang 51ad8428e0
A Couple for Fixes for BulkDump and RangeLock (#12013)
* fix lockrange test and improve bulk dump

* fix bulkdump stuck error

* remove unnecessary yield when read/write bulk files

* remove unnecessary string creation in read/write bulk files
2025-03-11 15:58:01 -07:00
Michael Stack 6ee6e0bd7f
Edit of bulkload/bulkdump cli. (#12012)
* fdbcli/BulkDumpCommand.actor.cpp
* fdbcli/BulkLoadCommand.actor.cpp
 Print out the bulkdump description rather than usage so user
 has a chance of figuring out what it is they entered incorrectly.
 Make bulkdump and bulkload align by using 'cancel' instead of
 'clear' in both and ordering the sub-commands the same for
 bulkload and bulkdump.  Add more help to the description.
 Bulkload was missing mention of the jobid needed
 specifying a bulkload.
* documentation/sphinx/source/bulkdump.rst
 s/clearBulkDumpJob/cancelBulkDumpJob/

Co-authored-by: stack <stack@duboce.com>
2025-03-11 08:52:13 -07:00
Zhe Wang 79a38c1dc0
Fix RangeLock in BulkDump Test and Avoid Memory Copy For Async Read/Write Bulk Files (#12007) 2025-03-10 15:13:29 -07:00
Michael Stack e1138c30ee
Make bulkload file reads and writes async and memory parsimonious (#11997)
* * fdbclient/S3Client.actor.cpp
 Change field names so capitialized (convention)
 Add duration as field to traces.

* fdbserver/BulkLoadUtil.actor.cpp
 When the job-manifest is big, processing blocks
 so much getBulkLoadJobFileManifestEntryFromJobManifestFile
 fails.

* Make bulkload file reads and writes async and memory parsimonious.
In tests at scale, processing a large job-manifest.txt was blocking
and causing the bulk job to fail. This is part 1 of two patches.
The second is to address data copy added in the below when we
made methods ACTORs (ACTOR doesn't allow passing by reference).

* fdbserver/BulkDumpUtil.actor.cpp
 Removed writeStringToFile and buldDumpFileCopy in favor of new methods
 in BulkLoadUtil. Made hosting functions ACTORs so could wait on
 async calls.

* fdbserver/BulkLoadUtil.actor.cpp
 Added async read and write functions.

* fdbserver/DataDistribution.actor.cpp
 Making uploadBulkDumpJobManifestFile async made it so big bulkloads
 work.

* fix memory corruption in writeBulkFileBytes and fix read options in getBulkLoadJobFileManifestEntryFromJobManifestFile

* If read or write < 1MB, do it in a single read else do multiple read/writes

* * packaging/docker/fdb-aws-s3-credentials-fetcher/fdb-aws-s3-credentials-fetcher.go
 Just be blunt and write out the credentials. Trying to figure when the
 blob credentials have expired is error prone.

Co-authored-by: michael stack <stack@duboce.com>
Co-authored-by: Zhe Wang <zhe.wang@wustl.edu>
2025-03-06 10:43:04 -08:00
Zhe Wang 8142ebd029
Add BulkLoad History (#11992)
* add bulkload history

* address comments

* address comments
2025-03-04 18:50:08 -08:00
Zhe Wang 8da2a54f4d
Add BulkloadJob Cancellation (#11976)
* add bulkload cancellation

* reduce frequency of job cancellation in tests

* fix bulkload assert failure

* nits

* fix busy loop in bulkload/dump workload

* fix workload

* but

* address comments and CI failures

* add task count trace event
2025-02-27 20:34:53 +00:00
Zhe Wang 2116547ad3
Improve BulkDump Implementation (#11974)
* bulkdump code refactor

* fix bugs

* improve
2025-02-26 13:58:45 -08:00
Zhe Wang 5f9f5358a8
Improve BulkLoad TraceEvent (#11971)
* improve bulkload event

* fmt
2025-02-25 14:37:21 -08:00
Zhe Wang 5cce92dcac
Simplify BulkLoad Job Metadata (#11959)
* address comments in the PR 11952

* code refactor and simplification

* avoid task outdated in DDBulkLoadJobExecute

* nit

* fix CI issue
2025-02-25 10:57:22 -08:00
Zhe Wang 94faec13d5
Enable BulkLoad Job to Give Up Unretrievable Task and Fix DDStuck Bug (#11952)
* enable bulkload job to give up unretriable task

* fix ddstuck bug
2025-02-17 17:27:32 -08:00
Zhe Wang d141eea3e1
Allow BulkLoadEngine to Handle Non-Retriable Task (#11950)
* enable-bulkload-engine-accept-unretriable-task

* nit and fmt

* fix bug
2025-02-14 10:52:29 -08:00
neethuhaneesha 62cc2a3edf
Migration to consider wiggling based on perpetualStorageEngine and not on configureStorageEngine (#11917) 2025-02-12 11:25:16 -08:00
Zhe Wang 277e82b79a
improve-bulkload (#11941) 2025-02-11 17:50:13 -08:00
Zhe Wang 961dad0552
Refactor BulkLoad Engine and Improve Trace Events (#11937)
* refactor bulkload engine framework

* add time span measure

* fmt
2025-02-11 12:01:21 -08:00
Zhe Wang d1efff1511
Improve BulkLoad Implementation (#11929)
* improve bulkload code

* address CI

* disable audit storage replica check and distributed consistency check in bulkload and bulkdump simulation test

* fix ci

* disable waitForQuiescence in bulkload and bulkdump tests
2025-02-06 21:25:49 -08:00
Zhe Wang 0f6fa090ce
Bulkload Engine Support General Storage Engine and Fix BulkLoad Bugs (#11898)
* bulkload support general engine and fix bugs

* add comments

* improve test coverage and fix bug

* nits and address comments

* nit

* nits

* fix data inconsistency bug due to bulkload metadata

* fix ss bulkload task metadata bugs

* nit and fix CI issue

* fix bugs of restore ss bulkload metadata

* use ssBulkLoadMetadata for fetchKey and general kv engine

* cleanup bulkload file for fetchkey

* fix CI issue

* fix simulation stuck due to repeated re-recruitment of unfit dd

* randomly do available space check when finding the dest team for bulkload in simulation

* address conflict

* code clean up

* update BulkDumping.toml same to BulkLoading.toml

* consolidate ss fetchkey and fetchshard failed to read bulkload task metadata

* fix DD bulkload job busy loop bug which causes segfault and test terminate unexpectedly in joshua test

* nit

* fix ss busy loop for bulkload in fetchkey

* use sqlite for bulkload ctest

* fix bulkload ctest stuck issue due to merge and change storage engine to ssd

* fix comments for CC recruit DD

* address comments

* address comments

* add comments

* fix ci format issue

* address comments

* add comments
2025-02-06 12:04:13 -08:00
michael stack aea37ae90d Use s3 if available when running the bulkload test.
It was disabled until we made it so the SS could
talk to s3, included in this PR.

Also finished the bulkload test. It only had the
bulkdump portion. bulkload support was recentlty
added so finish off the test here by adding bulkload
of the bulkdump and then verifying all data present.

Added passing knobs to the fdb cluster so available to the
fdbserver when it goes to talk to s3. Also added passing
SS count to start in fdb cluster.

* fdbclient/tests/fdb_cluster_fixture.sh
 Add ability to pass multiple knobs to fdb cluster
 and to specify more than just one SS.

* fdbserver/fdbserver.actor.cpp
 Add --blob-server option and processing of FDB_BLOB_CREDENTIALS
 if present (hijacked the unused, unadvertised --
   blob-credentials-file).

* tests/loopback_cluster/run_custom_cluster.sh
 Allow passing more than just one knob.

* fdbclient/BulkLoading.cpp
* fdbclient/include/fdbclient/BulkLoading.h
 Added getPath

* fdbclient/S3BlobStore.actor.cpp
 Fix bug where we were doubling up the first '/' on a path if
 it had a root '/' already (s3 treats /a/b as distinct from
 /a//b).

* fdbclient/S3Client.actor.cpp
 Fix up of traceevent Types.

* fdbclient/tests/bulkload_test.sh
 Enable being able to use s3 if available.
 Pick up jobid when bulkdumping. Feed it to new bulkload
 method. Add verification all data present post-bulkload.

* fdbserver/BulkLoadUtil.actor.cpp
 Add support for blobstore.

* tests/loopback_cluster/run_custom_cluster.sh
 Bug fix -- we were only able to pass in one knob. Allow
 passing multiple.
2025-01-17 17:29:56 -08:00
Zhe Wang 0bce8bd281
Parallelize Fetching BulkLoad Manifest Metadata (#11884) 2025-01-15 09:28:12 -08:00
Zhe Wang cf7c8f41b2
BulkLoad Job Framework and Co-Testing BulkLoad and BulkDump (#11865)
* add bulkload job framework and fix bugs

* add BulkLoadChecksum, fix CI issue

* nits

* nits

* address comments

* mitigate perpetual wiggle to make sure DD can select a valid team to inject data

* fix submitBulkDumpJob and submitBulkLoadJob

* change remoteRoot to jobRoot

* add comments
2025-01-14 11:28:42 -08:00
Zhe Wang d3532e4478
Improve BulkLoad/Dump implementation (#11842)
* Improve BulkLoad/Dump implementation

* make bulkload test data folder inside simfdb folder

* simplify code

* use manifest in bulkdump metadata

* use manifest in bulkload

* apply bulkload fileset to bulkload and fix bugs of bytesampling value generation

* remove BulkDumpFileFullPathSet

* address comments

* address comments

* address comments
2025-01-06 13:02:23 -08:00
Zhe Wang 83f42e13d9
Make BulkDump work with S3 (#11822)
* init

* Add bulkdump to blobstore:// (s3)

* cmake/CompileBoost.cmake
 Add boost url. Needed parsing blobstore:// urls.

* documentation/sphinx/source/bulkdump.rst
 Minor edit to allow addition of blobstore target.

* fdbcli/BulkDumpCommand.actor.cpp
* fdbclient/BulkDumping.cpp
 s/blobstore/s3/ -- more generic and aligns with
 how backup/restore refers to "s3" thingies.

* fdbclient/include/fdbclient/S3Client.actor.h
* fdbclient/S3Client.actor.cpp
 Add batch upload handler.

* fdbclient/tests/seaweedfs_fixture.sh
 Add  run seaweed method. Also look for
 weed and if installed use it else download.

* fdbserver/BulkDumpUtil.actor.cpp
 appendToPath does the right thing when passed an URL
 Add bulkDumpTransportBlobstore_impl.
 Add upload to blobstore.

* tests/loopback_cluster/run_custom_cluster.sh
 Complain if unrecognized arguments.

* Add ctest for bulkload with simple bulkdump test for now.

* Add new test to ctest list

* fix bugs

* nit

* nits

* nits

---------

Co-authored-by: stack <stack@duboce.com>
2024-12-18 13:29:36 -08:00
Zhe Wang 02c29e31ff fmt 2024-12-09 15:22:20 -08:00
Zhe Wang 27253a5aca address comments 2024-12-09 15:04:31 -08:00
Zhe Wang f2a1021d60 condense manifest content 2024-12-04 13:26:50 -08:00
Zhe Wang ad0f48cba2 add fdbcli support and fix bugs 2024-12-03 22:01:07 -08:00
Zhe Wang 61f02e5960 fix unseed mismatch 2024-12-03 22:01:07 -08:00
Zhe Wang f6be4a4b94 bulkdump generate global manifest 2024-12-03 22:01:07 -08:00
Zhe Wang eb85034fdb refactor code and make the file path configurable 2024-12-03 22:01:07 -08:00
Zhe Wang 3bb2919dec fmt 2024-12-03 22:01:07 -08:00
Zhe Wang 4b2fe52aed add more comments 2024-12-03 22:01:07 -08:00
Zhe Wang 86979abdb0 add parallelism check 2024-12-03 22:01:06 -08:00
Zhe Wang 3bc612e286 add bulkdump metadata and manifest 2024-12-03 22:01:06 -08:00
Zhe Wang 75f7693874 add SS bulkdump 2024-12-03 22:01:06 -08:00
Zhe Wang db8c7d96b8 add bulkdump mode and task scheduling in DD 2024-12-03 22:01:06 -08:00
Zhe Wang c54696f617 add bulk dump mode 2024-12-03 22:01:06 -08:00