This is an automated email from the ASF dual-hosted git repository. pinal pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-2.0 by this push: new 89fdbe333 ATLAS-4838 : Export/Import : changeMarker is not set to entity's lastupdatetime or its closer timestamp value 89fdbe333 is described below commit 89fdbe333aba5bb771142206de76221cc362f8f0 Author: priyanshi-freestoneinfotech <priyanshi.s...@freestoneinfotech.com> AuthorDate: Wed Mar 27 17:13:19 2024 +0530 ATLAS-4838 : Export/Import : changeMarker is not set to entity's lastupdatetime or its closer timestamp value Signed-off-by: Pinal Shah <pinal.s...@freestoneinfotech.com> --- .../atlas/repository/patches/AtlasPatchManager.java | 5 +++++ .../org/apache/atlas/web/resources/AdminResource.java | 15 +++++++++++---- .../java/org/apache/atlas/web/service/EmbeddedServer.java | 4 ++++ .../java/org/apache/atlas/web/service/ServiceState.java | 3 +++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/patches/AtlasPatchManager.java b/repository/src/main/java/org/apache/atlas/repository/patches/AtlasPatchManager.java index e72a87713..c41b75dc3 100644 --- a/repository/src/main/java/org/apache/atlas/repository/patches/AtlasPatchManager.java +++ b/repository/src/main/java/org/apache/atlas/repository/patches/AtlasPatchManager.java @@ -18,6 +18,7 @@ package org.apache.atlas.repository.patches; +import org.apache.atlas.RequestContext; import org.apache.atlas.model.patches.AtlasPatch.AtlasPatches; import org.apache.atlas.model.patches.AtlasPatch.PatchStatus; import org.apache.atlas.repository.graph.GraphBackedSearchIndexer; @@ -77,8 +78,12 @@ public class AtlasPatchManager { } } catch (Exception ex) { LOG.error("Error applying patches.", ex); + } finally { + // After all the patches are applied, we are clearing the request created at time of applying all the patches. + RequestContext.clear(); } + LOG.info("<== AtlasPatchManager.applyAll()"); } diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java index 0025276bb..3a7777a24 100755 --- a/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java +++ b/webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java @@ -91,6 +91,7 @@ import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Service; +import org.apache.atlas.RequestContext; import javax.inject.Inject; import javax.inject.Singleton; @@ -450,11 +451,17 @@ public class AdminResource { LOG.debug("==> AdminResource.scheduleSaveAndDeleteMetrics()"); } - // auto persist - saveMetrics(); + try { + // auto persist + saveMetrics(); + + // auto purge + metricsService.purgeMetricsStats(); + } finally { + // After collecting metrics at regular intervals the request created is now cleared. + RequestContext.clear(); + } - // auto purge - metricsService.purgeMetricsStats(); if (LOG.isDebugEnabled()) { LOG.debug("<== AdminResource.scheduleSaveAndDeleteMetrics()"); diff --git a/webapp/src/main/java/org/apache/atlas/web/service/EmbeddedServer.java b/webapp/src/main/java/org/apache/atlas/web/service/EmbeddedServer.java index 4c3a1c569..b8685462a 100755 --- a/webapp/src/main/java/org/apache/atlas/web/service/EmbeddedServer.java +++ b/webapp/src/main/java/org/apache/atlas/web/service/EmbeddedServer.java @@ -20,6 +20,7 @@ package org.apache.atlas.web.service; import org.apache.atlas.AtlasConfiguration; import org.apache.atlas.AtlasErrorCode; +import org.apache.atlas.RequestContext; import org.apache.atlas.util.BeanUtil; import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.model.audit.AtlasAuditEntry; @@ -138,6 +139,9 @@ public class EmbeddedServer { auditService.add(AtlasAuditEntry.AuditOperation.SERVER_STATE_ACTIVE, date, date, null, null, 0); } catch (AtlasBaseException e) { LOG.error("Exception occurred during audit", e); + } finally { + // After server related audits are added, the request created and now cleared here. + RequestContext.clear(); } } } diff --git a/webapp/src/main/java/org/apache/atlas/web/service/ServiceState.java b/webapp/src/main/java/org/apache/atlas/web/service/ServiceState.java index ea74d21ad..fe55fe010 100644 --- a/webapp/src/main/java/org/apache/atlas/web/service/ServiceState.java +++ b/webapp/src/main/java/org/apache/atlas/web/service/ServiceState.java @@ -106,6 +106,9 @@ public class ServiceState { auditService.add(AtlasAuditEntry.AuditOperation.SERVER_STATE_ACTIVE, date, date, null, null, 0); } catch (AtlasBaseException e) { LOG.error("Exception occurred during audit", e); + } finally { + // In HA environment, after the server related audits are added, the request created are now cleared. + RequestContext.clear(); } } }