Why does Bitbucket occasionally not remove the directory from the filesystem when a repository is deleted?

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問


プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

 

要約

When a repository is deleted from Bitbucket the on disk directory and files are also expected to be removed:

$BITBUCKET_HOME/shared/data/repositories/<RepoID>

It is occasionally noted that although the repository has been removed from Bitbucket and database, the directory remains and a "DELETED" file is placed in the directory.

Why is the directory not removed?

When a parent repository of forked repos is deleted while the child repositories are still present, Bitbucket creates a "DELETED" file inside the repository instead of actually deleting it from filesystem. Bitbucket implements forking by having the child repository. This is because the child forks are still referencing the objects from this repository on the filesystem. Deleting this from filesystem will make the child forks unusable.

How does Bitbucket consider a repository with a DELETED in its directory?

Bitbucket has no reference for this repository in its database and from the perspective of Bitbucket this repository does not exist, hence Bitbucket will allow you to create new repository with same name. However in the backend filesystem the forked repositories might still be referencing objects from the parent repository directory, hence it is not deleted from filesystem.

ソリューション

Should we manually remove the directory?

Unfortunately Bitbucket does not remove these repositories from filesystem even after all the forks are deleted. Since the repository is already deleted from Bitbucket database, it has no way of tracking them.

We have raised a Feature Request to avoid these issues by notifying the user about existing forks before the deletion:

If you absolutely need to delete these repositories, currently the only way is to do it manually. In order to manually delete them, first you need to be sure there are no forks referencing objects from them.

How to find which repositories refer to the deleted repository?

Since the repository is removed from the UI, one way to do this is to scan contents of all 'alternates' files inside all repositories to see if any one references to the current repository directory.

The following commands will check the alternates files of all the repositories and return the list of alternates that have a reference to <RepoID>.

$ cd $BITBUCKET_HOME/shared/data/repositories/
$ grep -iRl "repositories/<RepoID>" */objects/info/alternates
最終更新日 2023 年 5 月 2 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.