Skip to content

Site delete does not remove itself from index #32251

@fabrizzio-dotCMS

Description

@fabrizzio-dotCMS

Problem Statement

The site delete process leaves a reference on the index that needs to be removed; otherwise, when creating a new site with the same name, it will not allow it.

Steps to Reproduce

For an unknown reason
This can only be reproduced in the customer environment, but you have to..

Create a site and publish it
POST {{serverURL}}/api/v1/site
{
"siteName":"xyz2",
"tagStorage":"SYSTEM_HOST",
"runDashboard":false
}

Add a folder under the site
POST {{serverURL}}/api/v1/folder/createfolders/xyz2
["/application/vtl/custom-fields"]

Then add a file (Let's say a vtl) under the folder that we just created
PUT {{serverURL}}/api/v1/workflow/actions/default/fire/PUBLISH
{
"contentlet" : {
"contentType" : "FileAsset",
"hostFolder" : "xyz2:/application/vtl/custom-fields",
"fileName" : "url-title.vtl",
"title" : "url-title.vtl"
}
}

Now archive the site
PUT {{serverURL}}/api/v1/site/{{siteId}}/_archive

And delete the site
DELETE {{serverURL}}/api/v1/site/{{siteId}}

Now attempt to recreate a site using the same name
POST {{serverURL}}/api/v1/site
{
"siteName":"xyz2",
"tagStorage":"SYSTEM_HOST",
"runDashboard":false
}

Then I get an exception like:

[26/05/25 16:18:18:236 UTC]  INFO business.HostFactoryImpl: -> (Step 13/14) Deleting all Secrets from Site 'xyz2'
[26/05/25 16:18:18:236 UTC]  INFO apps.AppsAPIImpl:  Removing secrets under site `xyz2`
[26/05/25 16:18:18:236 UTC]  INFO business.HostFactoryImpl: -> (Step 14/14) Flushing all caches after deleting Site 'xyz2'
[26/05/25 16:18:18:237 UTC]  INFO business.HostFactoryImpl: ======================================================================
[26/05/25 16:18:18:238 UTC]  INFO business.HostFactoryImpl:   Site 'xyz2' has been deleted successfully!
[26/05/25 16:18:18:238 UTC]  INFO business.HostFactoryImpl: ======================================================================
[26/05/25 16:18:18:274 UTC]  INFO listener.EmbeddingContentListener: GOT onPublish - PublishEvent:false for content: url-title.vtl id:de38b0afd27bf20af0c70fbd2e009257
[26/05/25 16:18:18:277 UTC]  INFO db.EmbeddingsFactory: Checking if Vector Extension Exists
[26/05/25 16:18:18:278 UTC]  INFO db.EmbeddingsFactory: Adding PGVector extension to database
[26/05/25 16:18:21:270 UTC]  INFO timedcache.TimedCacheProvider: ***     Building Cache : esquerycache, size:10000, seconds:3600,Concurrency:32 (every 60000 millis)
[26/05/25 16:18:37:247 UTC]  INFO taillog.TailLogResource: Requested logFile:/srv/dotserver/tomcat-9.0.85/logs/dotcms.log
[26/05/25 16:18:37:252 UTC]  WARN taillog.TailLogResource:  TailLog Thread available with name: Log-Tailer0:dotcms.log
[26/05/25 16:19:36:156 UTC]  INFO util.ActivityLogger: class com.dotcms.content.elasticsearch.business.ESContentletAPIImpl: system : Saving Content , StartDate: N/D; EndDate: N/D; User:dotcms.org.1; ContentIdentifier:

[26/05/25 16:19:36:729 UTC]  WARN business.ESContentletAPIImpl: Unique field [hostName] could not be validated, as unique content Inode '39218fcd-dd4f-45db-be50-8a5dc233d816' was not found. ES Index might need to be reindexed.
[26/05/25 16:19:36:730 UTC]  WARN business.ESContentletAPIImpl: Unique field [hostName] could not be validated, as unique content Inode '39218fcd-dd4f-45db-be50-8a5dc233d816' was not found. ES Index might need to be reindexed.
[26/05/25 16:19:36:730 UTC]  WARN business.ESContentletAPIImpl: Unique field [hostName] could not be validated, as unique content Inode '39218fcd-dd4f-45db-be50-8a5dc233d816' was not found. ES Index might need to be reindexed.
[26/05/25 16:19:36:730 UTC]  WARN business.ESContentletAPIImpl: com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.validateContentlet(ESContentletAPIImpl.java:7813)
[26/05/25 16:19:36:730 UTC]  WARN business.ESContentletAPIImpl: Unique field [hostName] could not be validated, as unique content Inode '39218fcd-dd4f-45db-be50-8a5dc233d816' was not found. ES Index might need to be reindexed.
com.dotmarketing.portlets.contentlet.business.DotContentletValidationException: Unique field [hostName] could not be validated, as unique content Inode '39218fcd-dd4f-45db-be50-8a5dc233d816' was not found. ES Index might need to be reindexed.
    at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.validateContentlet(ESContentletAPIImpl.java:7813) ~[classes/:?]
    at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.validateContentlet(ESContentletAPIImpl.java:8246) ~[classes/:?]
    at com.dotmarketing.portlets.contentlet.business.ContentletAPIInterceptor.validateContentlet(ContentletAPIInterceptor.java:2099) ~[classes/:?]
    at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.internalCheckin(ESContentletAPIImpl.java:5420) ~[classes/:?]
    at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.lambda$checkin$59(ESContentletAPIImpl.java:5048) ~[classes/:?]
    at com.dotcms.concurrent.lock.StripedLockImpl.tryLock(StripedLockImpl.java:100) ~[classes/:?]
    at com.dotcms.concurrent.lock.StripedLockImpl.tryLock(StripedLockImpl.java:55) ~[classes/:?]
    at com.dotcms.concurrent.lock.IdentifierStripedLock.tryLock(IdentifierStripedLock.java:16) ~[classes/:?]
    at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.checkin(ESContentletAPIImpl.java:5047) ~[classes/:?]
    at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.checkin(ESContentletAPIImpl.java:10040) ~[classes/:?]
    at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.checkin(ESContentletAPIImpl.java:4883) ~[classes/:?]
    at com.dotmarketing.portlets.contentlet.business.ContentletAPIInterceptor.checkin(ContentletAPIInterceptor.java:267) ~[classes/:?]
    at com.dotmarketing.portlets.contentlet.business.HostAPIImpl.save(HostAPIImpl.java:463) ~[classes/:?]
    at com.dotcms.rest.api.v1.site.SiteHelper.save(SiteHelper.java:126) ~[classes/:?]
    at com.dotcms.rest.api.v1.site.SiteResource.createNewSite(SiteResource.java:861) ~[classes/:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

The id presented here ESContentletAPIImpl: Unique field [hostName] could not be validated, as unique content Inode '39218fcd-dd4f-45db-be50-8a5dc233d816' was not found. ES Index might need to be reindexed.

is the site we just deleted

Acceptance Criteria

We should be able to delete a site and recreate it using the same name again

dotCMS Version

release-24.04.24_lts

Proposed Objective

Customer Support

Proposed Priority

Priority 3 - Average

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions