环境
CentOS Linux release 7.9.2009 (Core)
openjdk 1.8.0_312
Confluence 7.12.0
MySQL 5.7.36
Nginx 1.16
描述
在删除某“问题页面”时:
第一次删除,长时间无反应。刷新页面后,页面并未删除。
第二次及之后的每次删除,则必定报错:“删除失败 我们不能删除您的页面。再试一次。”
删除其他页面,正常删除。
删除其他页面包含“问题页面”,则出现以上同样情况及报错。
解决
大概率是页面有问题,而根据描述大概猜测是某些地方阻塞,第一反应就是 Mysql 被阻塞了。
则首先解决 Mysql 阻塞问题。命令如下(其中关键命令为最后两行,其他只为参考,显示部分省略了部分字段):
mysql> select * from information_schema.innodb_lock_waits;
+-------------------+------------------------+-----------------+------------------------+
| requesting_trx_id | requested_lock_id | blocking_trx_id | blocking_lock_id |
+-------------------+------------------------+-----------------+------------------------+
| 341841530 | 341841530:142:36275:76 | 341797499 | 341797499:142:36275:76 |
+-------------------+------------------------+-----------------+------------------------+
mysql> select * from information_schema.innodb_locks;
+------------------------+-------------+-----------+-----------+------------------------+------------+------------+-----------+----------+-----------+
| lock_id | lock_trx_id | lock_mode | lock_type | lock_table | lock_index | lock_space | lock_page | lock_rec | lock_data |
+------------------------+-------------+-----------+-----------+------------------------+------------+------------+-----------+----------+-----------+
| 341841530:142:36275:76 | 341841530 | S | RECORD | `confluence`.`CONTENT` | PRIMARY | 142 | 36275 | 76 | 60602463 |
| 341797499:142:36275:76 | 341797499 | X | RECORD | `confluence`.`CONTENT` | PRIMARY | 142 | 36275 | 76 | 60602463 |
+------------------------+-------------+-----------+-----------+------------------------+------------+------------+-----------+----------+-----------+
mysql> select * from information_schema.innodb_trx;
+-----------+-----------+---------------------+------------------------+---------------------+------------+---------------------+
| trx_id | trx_state | trx_started | trx_requested_lock_id | trx_wait_started | trx_weight | trx_mysql_thread_id |
+-----------+-----------+---------------------+------------------------+---------------------+------------+---------------------+
| 341841530 | LOCK WAIT | 2021-12-27 16:59:45 | 341841530:142:36275:76 | 2021-12-27 17:28:40 | 4 | 559080 |
| 341797499 | RUNNING | 2021-12-27 16:34:13 | NULL | NULL | 22734 | 558537 |
+-----------+-----------+---------------------+------------------------+---------------------+------------+---------------------+
mysql> kill 558537;
解决 MySQL 阻塞后,删除“问题页面”,即可复现描述情况。
之后,需删除“问题页面”,在数据库中根据页面标题“这是页面标题”,确保标题唯一,不唯一可修改!找出“问题页面” ID。
mtsql> use confluence;
mysql> SELECT * FROM CONTENT WHERE TITLE = '这是页面标题';
+-----------+------------------+-------------+--------------+---------+----------------------------------+---------------------+----------------------------------+---------------------+----------------+----------+----------------+--------+----------+----------------+----------+
| CONTENTID | HIBERNATEVERSION | CONTENTTYPE | TITLE | VERSION | CREATOR | CREATIONDATE | LASTMODIFIER | LASTMODDATE | VERSIONCOMMENT | PREVVER | CONTENT_STATUS | PAGEID | SPACEID | CHILD_POSITION | PARENTID |
+-----------+------------------+-------------+--------------+---------+----------------------------------+---------------------+----------------------------------+---------------------+----------------+----------+----------------+--------+----------+----------------+----------+
| 45191450 | 56 | PAGE | 这是页面标题 | 1 | ff808081642ace1801672f0ed4d60142 | 2019-12-23 11:38:58 | ff808081642ace1801672f0ed4d60142 | 2019-12-23 11:38:58 | | NULL | current | NULL | 10944527 | 3 | 29814616 |
| 76346375 | 1725 | PAGE | 这是页面标题 | 1 | ff808081642ace1801672f0ed4d60142 | 2019-12-23 11:38:58 | ff808081642ace1801672f0ed4d60142 | 2019-12-23 11:38:58 | | 45191450 | draft | NULL | 10944527 | NULL | NULL |
+-----------+------------------+-------------+--------------+---------+----------------------------------+---------------------+----------------------------------+---------------------+----------------+----------+----------------+--------+----------+----------------+----------+
根据 CONTENTID 构造出如下页面,并直接访问,点击确认删除按钮后,稍后 Nginx 会报错 404;之后,等待一段时间再查看,页面已被删除,会提示页面已被放入到回收站。
https://网址/pages/removepage.action?pageId=45191450
如果不行,在访问的构造页面后,更改对应链接,再点击确认删除按钮,之后操作与上一步一致。
https://网址/pages/doremovepage.action?pageId=45191450
->
https://网址/pages/doremovepage.action?pageId=76346375
其中,等待一段时间大约时间,根据两次情况来看,大约 1 - 2 小时;removepage 与 doremovepage 后面 ID 可多做尝试,ID 可互换。