I am wondering about the attachment storage path for JIRA. On a server that I am running, the structure of the attachments directory (/var/atlassian/application-data/jira/data/attachments/) looks like this:
`-- JSDT `-- 10000 `-- JSDT-2 |-- 10100 `-- thumbs `-- _thumb_10100.png
I am currently writing a groovy script in which I need to determine the path to an attachment. In answers to questions such as https://answers.atlassian.com/questions/297697, PathUtils.joinPaths() is used to construct the path. However, it does not seem to add the "10000"-directory seen above. My questions related to this are:
I bet I am missing something trivial, but what I see is a bit inconsistent with what I've found when looking around answers and documentation.
We have gone through several different directory structures for attachments over the years. Although it may seem pointless on a small system, consider for a moment that there are JIRA instances out that that have tens of thousands of issues in a single project.
Operating systems and their filesystems impose certain limits on the number of files that can be contained in a single directory. On ext3, for example, you may not have more than 65,535 entries in a single directory. If we used just the issue key, then as your product grew:
`-- JSDT |-- JSDT-1 | ... `-- JSDT-65535 !!! JSDT-65536 !!!
At some point you wouldn't be able to attach files to any new issues because the directory entry slots would be exhausted. This has happened before:
We changed the layout in 7.0.0 (and JRA-19873 probably should have been marked as fixed as a result).
The "10000" is a grouping number based on the issue ID (meaning the database row's ID, not the issue number that goes after the project key). Issues that get IDs from 10000 - 19999 go into the "10000" bucket. Those from 20000 to 29999 go into the "20000" bucket. This way there is a worst case of 10,000 issue directories in a single bucket, which is still within the limitations set by all of our supported operating systems. Other points:
AttachmentUtils.getAttachmentDirectoryis probably closest to what you want.
If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
We're bringing product updates and pro tips on teamwork to ten cities around the world.Save your spot