-
Notifications
You must be signed in to change notification settings - Fork 9
ignore deleting core types. log errors when it happens #5407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ on: | |
- beta | ||
- master | ||
- staging | ||
- typdef-ignore-atlas-core | ||
|
||
jobs: | ||
build: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,19 +125,25 @@ public void init() throws AtlasBaseException { | |
@Override | ||
public void reloadEnumTypeDefs() throws AtlasBaseException { | ||
LOG.info("==> AtlasTypeDefGraphStore.reloadEnumTypeDefs()"); | ||
AtlasTransientTypeRegistry ttr = null; | ||
boolean commitUpdates = false; | ||
AtlasTransientTypeRegistry ttr = null; | ||
boolean commitUpdates = false; | ||
|
||
try { | ||
ttr = typeRegistry.lockTypeRegistryForUpdate(5); | ||
List<AtlasEnumDef> enumDefs = getEnumDefStore(ttr).getAll(); | ||
for (AtlasBaseTypeDef atlasBaseTypeDef : ttr.getAllEnumDefs()) { | ||
if (atlasBaseTypeDef instanceof AtlasEnumDef) { | ||
if ("atlas_core".equalsIgnoreCase(atlasBaseTypeDef.getServiceType())) { | ||
LOG.debug("Skipping removal of built-in enum type: {}", atlasBaseTypeDef.getName()); | ||
continue; | ||
} | ||
ttr.removeTypeByName(atlasBaseTypeDef.getName()); | ||
} | ||
} | ||
ttr.addTypes(enumDefs); | ||
commitUpdates = true; | ||
} catch (Throwable abe) { | ||
LOG.warn("reloadEnumTypeDefs(): failed to reload enum defs", abe); | ||
} finally { | ||
typeRegistry.releaseTypeRegistryForUpdate(ttr, commitUpdates); | ||
LOG.info("<== AtlasTypeDefGraphStore.reloadEnumTypeDefs()"); | ||
|
@@ -155,11 +161,17 @@ public void reloadStructTypeDefs() throws AtlasBaseException { | |
List<AtlasStructDef> structDefs = getStructDefStore(ttr).getAll(); | ||
for (AtlasBaseTypeDef atlasBaseTypeDef : ttr.getAllStructDefs()) { | ||
if (atlasBaseTypeDef instanceof AtlasStructDef) { | ||
if ("atlas_core".equalsIgnoreCase(atlasBaseTypeDef.getServiceType())) { | ||
LOG.debug("Skipping removal of built-in struct type: {}", atlasBaseTypeDef.getName()); | ||
continue; | ||
} | ||
ttr.removeTypeByName(atlasBaseTypeDef.getName()); | ||
} | ||
} | ||
ttr.addTypes(structDefs); | ||
commitUpdates = true; | ||
} catch (Throwable abe) { | ||
LOG.warn("reloadStructTypeDefs(): failed to reload struct defs", abe); | ||
} finally { | ||
typeRegistry.releaseTypeRegistryForUpdate(ttr, commitUpdates); | ||
LOG.info("<== AtlasTypeDefGraphStore.reloadStructTypeDefs()"); | ||
|
@@ -177,11 +189,17 @@ public void reloadEntityTypeDefs() throws AtlasBaseException { | |
List<AtlasEntityDef> entityDefs = getEntityDefStore(ttr).getAll(); | ||
for (AtlasBaseTypeDef atlasBaseTypeDef : ttr.getAllEntityDefs()) { | ||
if (atlasBaseTypeDef instanceof AtlasEntityDef) { | ||
if ("atlas_core".equalsIgnoreCase(atlasBaseTypeDef.getServiceType())) { | ||
LOG.debug("Skipping removal of built-in entity type: {}", atlasBaseTypeDef.getName()); | ||
continue; | ||
} | ||
ttr.removeTypeByName(atlasBaseTypeDef.getName()); | ||
} | ||
} | ||
ttr.addTypes(entityDefs); | ||
commitUpdates = true; | ||
} catch (Throwable abe) { | ||
LOG.warn("reloadEntityTypeDefs(): failed to reload entity defs", abe); | ||
} finally { | ||
typeRegistry.releaseTypeRegistryForUpdate(ttr, commitUpdates); | ||
LOG.info("<== AtlasTypeDefGraphStore.reloadEntityTypeDefs()"); | ||
|
@@ -199,11 +217,17 @@ public void reloadRelationshipTypeDefs() throws AtlasBaseException { | |
List<AtlasRelationshipDef> relationshipDefs = getRelationshipDefStore(ttr).getAll(); | ||
for (AtlasBaseTypeDef atlasBaseTypeDef : ttr.getAllRelationshipDefs()) { | ||
if (atlasBaseTypeDef instanceof AtlasRelationshipDef) { | ||
if ("atlas_core".equalsIgnoreCase(atlasBaseTypeDef.getServiceType())) { | ||
LOG.debug("Skipping removal of built-in relationship type: {}", atlasBaseTypeDef.getName()); | ||
continue; | ||
} | ||
ttr.removeTypeByName(atlasBaseTypeDef.getName()); | ||
} | ||
} | ||
ttr.addTypes(relationshipDefs); | ||
commitUpdates = true; | ||
} catch (Throwable abe) { | ||
LOG.warn("reloadRelationshipTypeDefs(): failed to reload relationship defs", abe); | ||
} finally { | ||
typeRegistry.releaseTypeRegistryForUpdate(ttr, commitUpdates); | ||
LOG.info("<== AtlasTypeDefGraphStore.reloadRelationshipTypeDefs()"); | ||
|
@@ -226,6 +250,8 @@ public void reloadBusinessMetadataTypeDefs() throws AtlasBaseException { | |
} | ||
ttr.addTypes(businessMetadataDefs); | ||
commitUpdates = true; | ||
} catch (Throwable abe) { | ||
LOG.warn("reloadBusinessMetadataTypeDefs(): failed to reload BM defs", abe); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Metadata Reload Inconsistencies and Exception HandlingTwo inconsistencies appear in the
Additional Locations (1) |
||
} finally { | ||
typeRegistry.releaseTypeRegistryForUpdate(ttr, commitUpdates); | ||
LOG.info("<== AtlasTypeDefGraphStore.reloadBusinessMetadataTypeDefs()"); | ||
|
@@ -248,6 +274,8 @@ public void reloadClassificationMetadataTypeDefs() throws AtlasBaseException { | |
} | ||
ttr.addTypes(classificationDefs); | ||
commitUpdates = true; | ||
} catch (Throwable abe) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Classification Metadata Reload Fails Core Type CheckThe |
||
LOG.warn("reloadClassificationMetadataTypeDefs(): failed to reload classification defs", abe); | ||
} finally { | ||
typeRegistry.releaseTypeRegistryForUpdate(ttr, commitUpdates); | ||
LOG.info("<== AtlasTypeDefGraphStore.reloadClassificationMetadataTypeDefs()"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: API Contract Violation in Exception Handling
The
reload*TypeDefs
methods now catch allThrowable
exceptions and log them as warnings without rethrowing. This breaks the API contract, as these methods are declared tothrow AtlasBaseException
, masking critical errors and potentially leaving type definitions in a stale state.Additional Locations (4)
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java#L172-L174
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java#L200-L202
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java#L228-L230
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java#L276-L278