Last modified by Eleni Cojocariu on 2026/09/18 15:29

Show last authors
1 The database attachment store keeps the content of an attachment in the wiki database instead of on disk, which makes a dump of the database a complete backup of the wiki; [[The Attachment Store>>doc:documentation.xs.admin.store.attachment-store.WebHome]] compares the two stores and [[Optional Store Features>>doc:documentation.xs.admin.store.optional-features.WebHome]] lists what each of the properties below decides.
2
3 **This is a configuration change, not a migration.** It sets the store used for the next attachment saved; every attachment already written to the filesystem stays there, and is still served from there.
4
5 {{warning}}
6 On MySQL, raise ##max_allowed_packet## before you start. The content of an attachment and its whole version history are written as single values, in one query, so plan on about three times the size of your largest attachment, and more where attachments have long histories. [[Packet for query is too large>>doc:documentation.xs.admin.installation.methods.install-xwiki-war.install-relational-database.configure-mysql.max-allowed-packet.WebHome]] is what a value set too low looks like.
7 {{/warning}}
8
9 1. Stop XWiki.
10 1. Open ##xwiki/WEB-INF/xwiki.cfg## and set the four storage hints to ##hibernate##:(((
11 {{code language="properties"}}
12 xwiki.store.attachment.hint=hibernate
13 xwiki.store.attachment.versioning.hint=hibernate
14 xwiki.store.attachment.recyclebin.content.hint=hibernate
15 xwiki.store.recyclebin.content.hint=hibernate
16 {{/code}}
17
18 All four ship commented out, so uncommenting them is part of the change: a line left commented keeps its default whatever value you wrote on it. The last of the four is the store for deleted Pages rather than for deleted attachments, and it belongs here because a Page carries its attachments with it into the recycle bin.
19 )))
20 1. Start XWiki again.
21 1. Attach a file to any Page, then look for its content in the database:(((
22 {{code language="sql"}}
23 SELECT COUNT(*) FROM xwikiattachment_content;
24 {{/code}}
25
26 The table gains a row, the file you have just attached. It does not gain a row for every attachment already in the wiki, and nothing new appears under ##store/file## in the permanent directory: the older attachments are still on disk, exactly as they were.
27 )))
28
29 From here on the wiki is under the size ceiling of the database store: an attachment much larger than 30 MB cannot be saved, for the reason [[The Attachment Store>>doc:documentation.xs.admin.store.attachment-store.WebHome]] gives.

Get Connected