Transaction Timed Out when Deleting a Space

お困りですか?

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

コミュニティに質問

症状

When deleting a space, the following appears in Confluence:

org.springframework.transaction.TransactionTimedOutException: Transaction timed out: deadline was Wed Aug 12 22:54:41 PDT 2009
	at org.springframework.transaction.support.ResourceHolderSupport.checkTransactionTimeout(ResourceHolderSupport.java:139)
	at org.springframework.transaction.support.ResourceHolderSupport.getTimeToLiveInMillis(ResourceHolderSupport.java:128)
	at org.springframework.transaction.support.ResourceHolderSupport.getTimeToLiveInSeconds(ResourceHolderSupport.java:112)
	at org.springframework.orm.hibernate.SessionFactoryUtils.applyTransactionTimeout(SessionFactoryUtils.java:532)
	at org.springframework.orm.hibernate.HibernateTemplate.prepareQuery(HibernateTemplate.java:1027)

原因

This can happen when the SQL transaction timed out when Confluence is trying to do something else to delete a space.

診断

Check the atlassian-confluence.log to determine the real cause.

For example, missing attachments can cause this issue:

2009-08-12 22:54:35,145 ERROR [http-8080-2] [pages.persistence.dao.FileSystemAttachmentDataDao] removeDataForAttachment Could not 
find attachments to remove at 'confluence-home-folder/attachments/88888888/9999999'
 -- referer:  http://confluence-url/spaces/removespace.action?key=SPACEKEY | url: /spaces/doremovespace.action | userName: admin 
| action: doremovespace | space: 7777777
2009-08-12 22:54:41,741 ERROR [http-8080-2] [atlassian.confluence.event.ConfluenceEventManager] publishEvent An exception was 
encountered while processing the event: com.atlassian.confluence.event.events.content.attachment.AttachmentRemoveEvent
[source=com.atlassian.confluence.pages.DefaultAttachmentManager@39522c]
 -- referer: http://confluence-url/spaces/removespace.action?key=SPACEKEY | url: /confluence/spaces/doremovespace.action | 
userName: admin | action: doremovespace | space: 7777777
org.springframework.transaction.TransactionTimedOutException: Transaction timed out: deadline was Wed Aug 12 22:54:41 PDT 2009
	at org.springframework.transaction.support.ResourceHolderSupport.checkTransactionTimeout(ResourceHolderSupport.java:139)
	at org.springframework.transaction.support.ResourceHolderSupport.getTimeToLiveInMillis(ResourceHolderSupport.java:128)
	at org.springframework.transaction.support.ResourceHolderSupport.getTimeToLiveInSeconds(ResourceHolderSupport.java:112)
	at org.springframework.orm.hibernate.SessionFactoryUtils.applyTransactionTimeout(SessionFactoryUtils.java:532)
	at org.springframework.orm.hibernate.HibernateTemplate.prepareQuery(HibernateTemplate.java:1027)

In this example, Confluence was complaining that it could not find a bunch of attachments in the file system to remove from the space.

ソリューション

Delete the attachment links from the database:

Confluence 5.7 以降

データベースを変更する前には必ずデータをバックアップするようにします。

Shut Down confluence and,

Step 1: Identify the space's spaceid:

/* Grab Space ID */
SELECT spaceid FROM spaces WHERE spacekey='<spacekey>';

Make a note of the space id.
Copy the script below, then do a find and replace for:

  • SPACEID_HERE = your space id.

Step 2: delete all attachments from this space in the database type:

(The following code is created for MySQL. You might need to adjust accordingly to your database)

//create a temp table similar to "content" table
CREATE TABLE TC LIKE CONTENT;

//insert all *attachments* that belong to the affected space
INSERT INTO TC SELECT * FROM CONTENT WHERE contenttype = 'ATTACHMENT' and spaceid = <SPACEID_HERE>;

//delete the contentproperties of the attachments
DELETE FROM CONTENTPROPERTIES WHERE CONTENTID IN (SELECT CONTENTID FROM TC);

//delete the contentproperties of the previous versions of the attachments
DELETE FROM CONTENTPROPERTIES WHERE CONTENTID IN (SELECT CONTENTID FROM CONTENT WHERE PREVVER IN (SELECT CONTENTID FROM TC));

//delete the content, the of the previous versions of the attachments
DELETE FROM CONTENT WHERE PREVVER IN (SELECT CONTENTID FROM TC);

//delete the imagedetails of the attachments
DELETE FROM IMAGEDETAILS WHERE ATTACHMENTID IN (SELECT CONTENTID FROM TC);

//delete the content of the attachments
DELETE FROM CONTENT WHERE CONTENTID IN (SELECT CONTENTID FROM TC);

//drop temp table
DROP TABLE TC;

After the deletion was successful, proceed with a cleanup of the filesystem of any leftover attachments.

Follow the documentation for the location of the attachment in the filesystem:

 

If the space ID is "135823361", we might want to delete everything that is inside the folder:
 
CONF_HOME/attachments/ver003/111/73/135823361

Perform backup of the folder before modifying them.

For Confluence 5.6 and below

データベースを変更する前には必ずデータをバックアップするようにします。

  1. Remove the reference to the attachments manually from the database:

    delete from attachments where pageid=<the page ids from the log file>;
    
  2. If some attachments have previous version(s), you will encounter a foreign key constraint violation. So you need to remove the previous versions separately as well:

    select * from attachments where pageid=<page id> AND prevver is not null;
    
  3. The query will list the previous version of the attachments, which we need to remove. Then for each listed attachments delete the attachments using their attachmentid:

    delete from attachments where attachmentid=<attachmentid returned from the query above>;
    
  4. And lastly, don't forget to delete the latest version of the attachment:

    delete from attachments where pageid=<the page ids from the above>;
    
    tip/resting Created with Sketch.

    For Confluence 3.x and later you need to identify the pageids in the database. If you are not sure how to do so, have a look at this article which explains the file structure and how it relates to page ids, or contact Atlassian support.

 

SPACEID_HERE

最終更新日 2018 年 11 月 2 日

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

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