Skip to content

Conversation

@pdillinger
Copy link
Contributor

Summary: Clearing DB dir for crash test is currently a hodgepodge of

  1. Caller of db_crashtest.py maybe tries to clear the dir
  2. db_crashtest.py tries to clear the dir in get_dbname() (but ignoring failure)
  3. db_crashtest.py passes --destroy_db_initially to some db_stress calls as needed
  4. db_crashtest.py tries to clear the dir between some db_stress calls
  5. db_crashtest.py tries to clear the dir after everything is done and successful (no artifacts to investigate or save) (but ignoring failure)
  6. Try to add more uniqueness to the directory from Use unique DB directory when TEST_TMPDIR is set #14249

This change reverts or replaces 2, 4, 5, and 6 by doubling-down on (expanding) 3 and a small variant of it:

  • crash_test.mk passes --destroy_db_initially=1 so that the first run of db_stress clears the db dir.
  • After each db_stress invocation, db_crashtest.py resets destroy_db_initially=0 so that the next invocation reuses the same DB, except in cases where there is an incompatibility that requires a fresh DB (from cases 3 and 4 above).
  • On success, uses new db_stress --destroy_db_and_exit option to clean up the DB dir without needing a custom cleanup_cmd (now ignored)

Note that although case 1 is likely obsolete, it is out of control of an open source PR.

Test Plan: some manual runs

Summary: Clearing DB dir for crash test is currently a hodgepodge of
1. Caller of db_crashtest.py maybe tries to clear the dir
2. db_crashtest.py tries to clear the dir in get_dbname() (but ignoring
   failure)
3. db_crashtest.py passes --destroy_db_initially to some db_stress calls
   as needed
4. db_crashtest.py tries to clear the dir between some db_stress calls
5. db_crashtest.py tries to clear the dir after everything is done and
   successful (no artifacts to investigate or save) (but ignoring
   failure)
6. Try to add more uniqueness to the directory from facebook#14249

This change reverts or replaces 2, 4, 5, and 6 by doubling-down on
(expanding) 3 and a small variant of it:

* crash_test.mk passes --destroy_db_initially=1 so that the first run of
  db_stress clears the db dir.
* After each db_stress invocation, db_crashtest.py resets
  destroy_db_initially=0 so that the next invocation reuses the same DB,
  except in cases where there is an incompatibility that requires a
  fresh DB (from cases 3 and 4 above).
* On success, uses new `db_stress --destroy_db_and_exit` option to clean
  up the DB dir without needing a custom cleanup_cmd (now ignored)

Note that although case 1 is likely obsolete, it is out of control of an
open source PR.

Test Plan: some manual runs
@meta-codesync
Copy link

meta-codesync bot commented Jan 21, 2026

@pdillinger has imported this pull request. If you are a Meta employee, you can view this in D91164731.

Copy link
Contributor

@xingbowang xingbowang left a comment

Choose a reason for hiding this comment

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

LGTM, assuming you have a test run verifying this works.

@meta-codesync
Copy link

meta-codesync bot commented Jan 22, 2026

@pdillinger merged this pull request in a9906f0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants