diff --git a/dotCMS/src/main/java/com/dotcms/content/elasticsearch/business/ContentletIndexAPIImpl.java b/dotCMS/src/main/java/com/dotcms/content/elasticsearch/business/ContentletIndexAPIImpl.java index 3f4dc937d140..c227b057602b 100644 --- a/dotCMS/src/main/java/com/dotcms/content/elasticsearch/business/ContentletIndexAPIImpl.java +++ b/dotCMS/src/main/java/com/dotcms/content/elasticsearch/business/ContentletIndexAPIImpl.java @@ -355,7 +355,7 @@ public boolean fullReindexSwitchover(Connection conn, final boolean forceSwitch) < Config.getLongProperty("REINDEX_THREAD_MINIMUM_RUNTIME_IN_SEC", 30) * 1000) { if (reindexTimeElapsed().isPresent()) { Logger.info(this.getClass(), - "Reindex has been running only " + reindexTimeElapsed().get() + "Reindex has been running only " + reindexTimeElapsed().orElse("- No value present -") + ". Letting the reindex settle."); } else { Logger.info(this.getClass(), "Reindex Time Elapsed not set."); diff --git a/dotCMS/src/main/java/com/dotcms/content/elasticsearch/business/ESContentletAPIImpl.java b/dotCMS/src/main/java/com/dotcms/content/elasticsearch/business/ESContentletAPIImpl.java index 812f6c2d4281..275336d3fb85 100644 --- a/dotCMS/src/main/java/com/dotcms/content/elasticsearch/business/ESContentletAPIImpl.java +++ b/dotCMS/src/main/java/com/dotcms/content/elasticsearch/business/ESContentletAPIImpl.java @@ -3784,15 +3784,19 @@ public void refresh(Contentlet contentlet) throws DotReindexStateException, public void refreshAllContent() throws DotReindexStateException { try { if (indexAPI.isInFullReindex()) { + Logger.info(this, "=======> Full reindex already in progress, skipping refresh all content"); return; } // we prepare the new index and aliases to point both old and new + Logger.info(this, "=======> Preparing the new index and aliases to point both old and new"); indexAPI.fullReindexStart(); // delete failing records + Logger.info(this, "=======> Deleting failing records"); reindexQueueAPI.deleteFailedRecords(); // new records to index + Logger.info(this, "=======> Adding all records to reindex queue"); reindexQueueAPI.addAllToReindexQueue(); } catch (Exception e) { diff --git a/dotCMS/src/main/java/com/dotcms/rest/api/v1/index/ESIndexResource.java b/dotCMS/src/main/java/com/dotcms/rest/api/v1/index/ESIndexResource.java index d7eb2453329e..517731bfa819 100644 --- a/dotCMS/src/main/java/com/dotcms/rest/api/v1/index/ESIndexResource.java +++ b/dotCMS/src/main/java/com/dotcms/rest/api/v1/index/ESIndexResource.java @@ -339,6 +339,7 @@ public Response startReindex(@Context final HttpServletRequest request, @Context APILocator.getContentletAPI().refresh(type); } else { + Logger.info(this, "=======> Refreshing ALL contents in dotCMS"); APILocator.getContentletAPI().refreshAllContent(); } diff --git a/dotCMS/src/main/java/com/dotmarketing/common/reindex/ReindexQueueFactory.java b/dotCMS/src/main/java/com/dotmarketing/common/reindex/ReindexQueueFactory.java index 88f459765b1a..6d1b8a58ee5e 100644 --- a/dotCMS/src/main/java/com/dotmarketing/common/reindex/ReindexQueueFactory.java +++ b/dotCMS/src/main/java/com/dotmarketing/common/reindex/ReindexQueueFactory.java @@ -96,6 +96,13 @@ protected void addAllToReindexQueue() throws DotDataException { + " from contentlet_version_info where identifier is not null"; dc.setSQL(sql); dc.loadResult(); + + dc = new DotConnect(); + dc.setSQL("SELECT count(*) as count from dist_reindex_journal"); + final List> count = dc.loadObjectResults(); + if (!count.isEmpty()) { + Logger.info(this, String.format("=======> After adding all from the contentlet_version_info table, there are %s records in the table", count.get(0).getOrDefault("count", "- NO VALUE -"))); + } } catch (Exception e) { throw new DotDataException(e.getMessage(), e); } @@ -341,13 +348,25 @@ private void loadUpLocalQueue() throws DotDataException { db.addParam(priorityLevel); db.addParam(lastIdIndexed); - for (Map map : db.loadObjectResults()) { + Logger.info(this, String.format("Loading %d records from the reindex journal with reindexingServers = [ %s], myIndex = [ %s ], priorityLevel = [ %s ], lastIdIndexed = [ %s ]", + REINDEX_RECORDS_TO_FETCH, reindexingServers, myIndex, priorityLevel, lastIdIndexed)); + final DotConnect dc2 = new DotConnect(); + dc2.setSQL("SELECT count(*) as count from dist_reindex_journal"); + final List> count = dc2.loadObjectResults(); + if (!count.isEmpty()) { + Logger.info(this, String.format("=======> Total records in reindex journal: %s", count.get(0).getOrDefault("count", "- NO VALUE -"))); + } + + final List> results = db.loadObjectResults(); + Logger.info(this, String.format("=======> Loaded %d records from the reindex journal", results.size())); + for (Map map : results) { final ReindexEntry entry = mapToReindexEntry(map); lastIdIndexed = entry.getId(); queue.add(entry); } if (queue.isEmpty()) { + Logger.info(this, "=======> The reindex queue is empty!"); lastIdIndexed = 0; } }