-
Bug
-
Resolution: Fixed
-
High
-
3.5
-
None
-
Ex-cluster on Postgres on Linux
When testing migration of attachments from the database to the filesystem I get about 400 of the stacktrace below. This is caused by a mismatch between the reported filesize in the attachment table and the actual length of the attachment. The current behaviour is to log the error and skip the attachment. However, I have checked some of the attachments and they are not actually broken. It is (at least sometimes) the attachment table that is incorrect.
So really, Confluence should log a warning and migrate the data regardless.
Note, I'm not sure how old this bug is, but since it's definitely older than 4.0 I've put "3.5" as the affects version.
SQL to find a summary of the affected records:
select count(*), attachments.filesize, avg(length(attachmentdata.data)), attachments.contenttype, attachments.attachment_comment, attachments.version from attachments, attachmentdata where attachments.attachmentid=attachmentdata.attachmentid and filesize != length(data) group by attachments.filesize, attachments.contenttype, attachments.attachment_comment, attachments.version
Sample stacktrace
2011-10-19 14:57:02,346 ERROR [Long running task: Attachment data migration] [persistence.dao.hibernate.AbstractHibernateAttachmentDao$IntraHibernateAttachmentCopier] copy Could not copy attachment: Attachment: Marketing Pyramid v.2 (542867488) jon -- referer: http://localhost:8080/confluence/admin/doeditattachmentstorage.action | url: /confluence/admin/doattachmentmigration.action | userName: dwillis.adm | action: doattachmentmigration com.atlassian.confluence.pages.attachments.AttachmentDataStreamSizeMismatchException: Attachment data stream contains a different number of bytes to the declared size of the attachment. Expected: 495, actual: 6514 at com.atlassian.confluence.pages.persistence.dao.FileSystemAttachmentDataDao.writeStreamToFile(FileSystemAttachmentDataDao.java:241) at com.atlassian.confluence.pages.persistence.dao.FileSystemAttachmentDataDao.saveDataForAttachment(FileSystemAttachmentDataDao.java:172) at com.atlassian.confluence.pages.persistence.dao.FileSystemAttachmentDataDao.saveDataForAttachment(FileSystemAttachmentDataDao.java:132) at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao$IntraHibernateAttachmentCopier.copy(AbstractHibernateAttachmentDao.java:448) at com.atlassian.confluence.pages.persistence.dao.hibernate.AbstractHibernateAttachmentDao$IntraHibernateAttachmentMigrator.migrate(AbstractHibernateAttachmentDao.java:503) at com.atlassian.confluence.util.longrunning.AttachmentMigrationLongRunningTask$1.doInTransactionWithoutResult(AttachmentMigrationLongRunningTask.java:71) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:33) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128) at com.atlassian.confluence.util.longrunning.AttachmentMigrationLongRunningTask.runInternal(AttachmentMigrationLongRunningTask.java:66) at com.atlassian.confluence.util.longrunning.ConfluenceAbstractLongRunningTask.run(ConfluenceAbstractLongRunningTask.java:21) at com.atlassian.confluence.util.longrunning.ManagedTask.run(ManagedTask.java:35) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:680)
- relates to
-
CONFSERVER-9888 Attachment migration from filesystem to database or vice versa cannot move large numbers of attachments
- Closed