Page MenuHomePhabricator

Deleting old commits
Closed, ResolvedPublic


I have a large number of commits (>250,000) that belong to a repository that no longer exists. I want to remove these from the database but I can't delete them with ./bin/remove destroy (I get an "No such object" error).

	phabricator_repository.repository_commit AS commit
    LEFT JOIN phabricator_repository.repository ON commit.repositoryID =

Could I just drop these from the database manually?

Event Timeline

joshuaspence assigned this task to epriestley.
joshuaspence raised the priority of this task from to Needs Triage.
joshuaspence updated the task description. (Show Details)
joshuaspence added a project: Repositories.
joshuaspence added a subscriber: joshuaspence.

Yes, although that will leave all their audits, commit data, edges, etc., in the database.

You could mitigate that to some degree with:

foreach (new LiskMigrationIterator(new PhabricatorRepositoryCommit()) as $commit) {
  if (/* The commit has a valid repository PHID. */) {

This will get rid of some of that data.

You could make these objects destructable and use a DestructionEngine on them to eliminate more data.

They can't be loaded through any policy-aware infrastructure because you must be able to see a commit's repository in order to be able to see the commit, and the repository is no longer ever visible.

This worked great, thanks.