How to find the Repository ID, Hierarchy ID, Partition ID and Repository location on disk for Mesh Repositories
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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.
*Except Fisheye and Crucible
Purpose
When a repository is created or migrated to mesh, the location of the repository contents changes. The Repository settings page shows the repository location on disk if the repository is not migrated and is still located in the shared home directory. For migrated and remote Mesh repositories, the Repository settings page no longer will show the full path on disk. The value is updated to show which mesh nodes hold the repository instead.
Bitbucket mesh includes the Hierarchy ID in its path on disk, and includes the Partition ID in its logs. It is valuable to retrieve these details in order to find the repository location on disk and troubleshoot issues with git repositories.
Environment
Bitbucket server 8+
Repositories located on Remote mesh nodes
Solution
Finding the Repository ID, Hierarchy ID, Partition ID of a mesh repository
- Navigate to the repository in the browser. For example: https://bb.test/projects/PRJ/repos/myrepo/settings
- Insert "/
rest/api/latest
" before "projects"
in the URL, and trim the "settings
" on the end of the URL. The final result should look like: https://bb.test/rest/api/latest/projects/PRJ/repos/myrepo - Open the page REST API to generate a JSON of repository metadata, where you can find the RepositoryId (id), hierarchyId. and partitionId (partition).
The Rest endpoint that is used is
GET <Base-URL>/rest/api/latest/projects/<Project-Key>/repos/<Repo-Slug>
Finding the Repository location on disk of a mesh repository
Mesh Repositories will be located on at least 3 remote mesh nodes. To confirm the mesh nodes look at the location field in Repository settings. In order to confirm which mesh nodes are which you can use the following Rest API to get a list of mesh nodes and their URL's:
GET <Base-URL>/rest/api/1.0/admin/git/mesh/nodes
After you have the Repository ID, Hierarchy ID, partition ID, and the mesh nodes which hold the repository, you can do the following:
- Identify the Home directory for the Mesh node
- Convert the partition ID to its 4-digit hex equivalent
Fill in the path below with Mesh home directory, partition ID in hex, Hierarchy ID and Repository ID:
<Mesh-Home-Directory>/store/data/<Partition-ID-in-Hex>/<Hierarchy-ID>/repos/<Repository-ID>
For example:
Mesh-Home-Directory: /home/ec2-user/mesh1-home
Partition ID: 30 (001e in hex)
Hierarchy ID: e1f2cd68cc7f4f58ed7e
Repository ID: 15
Becomes:
/home/ec2-user/mesh1-home/store/data/001e/e1f2cd68cc7f4f58ed7e/repos/15