Duplicate space appears in Space Directory

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

Problem

When navigating to the Space Directory page in Confluence, you will see a space with a duplicate entry.

Diagnosis

This is the behaviour observed:

  1. Rebuilding the index doesn't help.
  2. Clicking on each space will link the user to the same exact space.
  3. Adding one space to the user's "favourites" will favourite the other as well.
  4. Searching for the space in the site will come up with two search results and they may differ in their last modified dates. However, they still link to the same, correct space.
  5. You will also notice that one of your other spaces in the site will be missing in the Space Directory.
  6. Checking the spaces table in the Confluence database, we can see that there is only one row with the space key and space name that is duplicated.

    select * from SPACES where spacekey='TEST';

Cause

There are two tables in the Confluence database that are responsible for displaying the content in the Space Directory: spaces and content. However, the actual list of spaces being displayed on that page is not dependent on the spaces table. It actually looks at the content table and follows these conditions.

  1. content_type='SPACEDESCRIPTION'
  2. spaceid=1234; where 1234 is the spaceid value from the spaces table.

In this case, there were two entries in the content table whose spaceid columns were pointing to a single space. This resulted in the duplicate to appear.

'content' table

contentidcontent_typespaceid
12345SPACEDESCRIPTION112233
67890SPACEDESCRIPTION112233

In the spaces table, we can see that the space ID referenced in the content table belongs to Test space, which is the duplicated space. However, that space is only pointing to the first space description, which is denoted by the spacedescid column. The second is actually being referenced by a completely different space.

'spaces' table

spaceidtitlespacekeyspacedescid
112233Test spaceTEST12345
445566Java ProgrammingJAVA67890

Resolution

Based on the DB entries above, the erroneous entry is in the content table with a content ID of '67890'. We'll need to update its spaceid value so that it points to the correct space – Java Programming. This can easily be achieved using the query below.

update content set spaceid=445566 where contentid=67890;

Once that is done, you'll need to:

  1. Reindex Confluence.
  2. Flush Confluence cache by navigating to:
    • Confluence Administration > General Configuration > Cache Management > Flush All
  3. Access the Space Directory again and you'll see the duplicate is no longer present.
Last modified on Jan 16, 2019

Was this helpful?

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