ATLAS-4838 : Export/Import : changeMarker is not set to entity's lastupdatetime or its closer timestamp value

Signed-off-by: Pinal Shah <pinal.shah@freestoneinfotech.com>
This commit is contained in:
priyanshi-freestoneinfotech 2024-03-27 17:13:19 +05:30 committed by Pinal Shah
parent b4745dcfe1
commit f4f9d62330
4 changed files with 23 additions and 4 deletions

View File

@ -18,6 +18,7 @@
package org.apache.atlas.repository.patches; 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.AtlasPatches;
import org.apache.atlas.model.patches.AtlasPatch.PatchStatus; import org.apache.atlas.model.patches.AtlasPatch.PatchStatus;
import org.apache.atlas.repository.graph.GraphBackedSearchIndexer; import org.apache.atlas.repository.graph.GraphBackedSearchIndexer;
@ -77,8 +78,12 @@ public class AtlasPatchManager {
} }
} catch (Exception ex) { } catch (Exception ex) {
LOG.error("Error applying patches.", 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()"); LOG.info("<== AtlasPatchManager.applyAll()");
} }

View File

@ -91,6 +91,7 @@ import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.apache.atlas.RequestContext;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -450,11 +451,17 @@ public class AdminResource {
LOG.debug("==> AdminResource.scheduleSaveAndDeleteMetrics()"); LOG.debug("==> AdminResource.scheduleSaveAndDeleteMetrics()");
} }
// auto persist try {
saveMetrics(); // 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()) { if (LOG.isDebugEnabled()) {
LOG.debug("<== AdminResource.scheduleSaveAndDeleteMetrics()"); LOG.debug("<== AdminResource.scheduleSaveAndDeleteMetrics()");

View File

@ -20,6 +20,7 @@ package org.apache.atlas.web.service;
import org.apache.atlas.AtlasConfiguration; import org.apache.atlas.AtlasConfiguration;
import org.apache.atlas.AtlasErrorCode; import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.RequestContext;
import org.apache.atlas.util.BeanUtil; import org.apache.atlas.util.BeanUtil;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.audit.AtlasAuditEntry; 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); auditService.add(AtlasAuditEntry.AuditOperation.SERVER_STATE_ACTIVE, date, date, null, null, 0);
} catch (AtlasBaseException e) { } catch (AtlasBaseException e) {
LOG.error("Exception occurred during audit", e); LOG.error("Exception occurred during audit", e);
} finally {
// After server related audits are added, the request created and now cleared here.
RequestContext.clear();
} }
} }
} }

View File

@ -106,6 +106,9 @@ public class ServiceState {
auditService.add(AtlasAuditEntry.AuditOperation.SERVER_STATE_ACTIVE, date, date, null, null, 0); auditService.add(AtlasAuditEntry.AuditOperation.SERVER_STATE_ACTIVE, date, date, null, null, 0);
} catch (AtlasBaseException e) { } catch (AtlasBaseException e) {
LOG.error("Exception occurred during audit", 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();
} }
} }
} }