Rebuilding the Ancestor Table

The ancestor table records the parent and descendant (child) relationship between pages. It is also used when determining whether a page will inherit view restrictions from a parent page. 

Occasionally records in the ancestor table can become corrupted. When this happens you will need to rebuild the ancestor table.

How to find out if the ancestor table needs to be rebuilt...

Run the following query:

SELECT A.ANCESTORID, A.DESCENDENTID, COUNT(A.DESCENDENTID)
FROM CONFANCESTORS A, CONTENT B
WHERE B.CONTENTID = A.DESCENDENTID
GROUP BY A.ANCESTORID, A.DESCENDENTID HAVING COUNT(A.DESCENDENTID) != 1
ORDER BY 3 DESC

If this query returns any results, the ancestors table is broken and needs to be rebuilt.

Rebuild the ancestor table

To rebuild the ancestor table:

  1. Back up your database.
  2. Use the following URL to access the Page Level Permissions page 
    <your-site>/admin/permissions/pagepermsadmin.action
  3. Choose Rebuild ancestor table

  4. Go to  > General Configuration > Cache Management.
  5. Flush the Inherited Content Permissions cache. 
You may also need to rebuild the content index so that the permissions take effect in search results.

This process takes about ten minutes for an average size site, and you may not be able to save new content during this time. We recommend you take a full backup of your database and complete this process during a maintenance window.

Track progress of the rebuild

To track the progress of the ancestor table rebuild:

  1. Go to  > General Configuration > Logging & Profiling
  2. Add the following entry, setting the logging level to INFO

    com.atlassian.confluence.pages.ancestors.HibernatePageAncestorManager

    See Configuring Logging for more information. 

  3. Open <confluence_home>/logs/atlassian-confluence.log. You should now see additional ancestor table logging, similar to the example below:

    2018-07-25 20:48:56,202 INFO [http-nio-8666-exec-10] [confluence.pages.ancestors.HibernatePageAncestorManager] rebuild Started
    2018-07-25 20:48:56,213 INFO [http-nio-8666-exec-10] [confluence.pages.ancestors.HibernatePageAncestorManager] clearHibernateCollectionCache Evicting the contents of Hibernate 'com.atlassian.confluence.pages.Page.ancestors' collection cache
    2018-07-25 20:48:56,235 INFO [http-nio-8666-exec-10] [confluence.pages.ancestors.HibernatePageAncestorManager] apply Stored ancestors for child pages... 16/16
    2018-07-25 20:48:56,236 INFO [http-nio-8666-exec-10] [confluence.pages.ancestors.HibernatePageAncestorManager] rebuild Ancestors persisted to database in 11 ms
    2018-07-25 20:48:56,237 INFO [http-nio-8666-exec-10] [confluence.pages.ancestors.HibernatePageAncestorManager] rebuild Complete!
Last modified on May 31, 2019

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.