@@ -32,6 +32,7 @@ public class CustomMetadataCache extends AbstractMassTrackingCache<CustomMetadat
3232 private volatile Map <String , Map <String , String >> mapAttrSidToName = new ConcurrentHashMap <>();
3333 private volatile Map <String , Map <String , String >> mapAttrNameToSid = new ConcurrentHashMap <>();
3434 private volatile Set <String > archivedAttrSids = ConcurrentHashMap .newKeySet ();
35+ private volatile Set <String > deletedAttrIds = ConcurrentHashMap .newKeySet ();
3536
3637 private final TypeDefsEndpoint typeDefsEndpoint ;
3738
@@ -69,6 +70,7 @@ protected void refreshCache() throws AtlanException {
6970 mapAttrSidToName .clear ();
7071 mapAttrNameToSid .clear ();
7172 archivedAttrSids .clear ();
73+ deletedAttrIds .clear ();
7274 super .refreshCache ();
7375 for (CustomMetadataDef bmDef : customMetadata ) {
7476 String typeId = bmDef .getName ();
@@ -529,6 +531,10 @@ private String getAttrNameForIdFromSetId(String setId, String attributeId, long
529531 if (setId == null || setId .isEmpty ()) throw new InvalidRequestException (ErrorCode .MISSING_CM_ID );
530532 if (attributeId == null || attributeId .isEmpty ())
531533 throw new InvalidRequestException (ErrorCode .MISSING_CM_ATTR_ID );
534+ String compositeKey = setId + "." + attributeId ;
535+ if (deletedAttrIds .contains (compositeKey )) {
536+ throw new NotFoundException (ErrorCode .CM_ATTR_NOT_FOUND_BY_ID , attributeId , setId );
537+ }
532538 Map <String , String > subMap = getAttrNameFromId (setId );
533539 String attrName = null ;
534540 if (subMap != null ) {
@@ -539,13 +545,15 @@ private String getAttrNameForIdFromSetId(String setId, String attributeId, long
539545 refresh (minimumTime );
540546 subMap = getAttrNameFromId (setId );
541547 if (subMap == null ) {
548+ deletedAttrIds .add (compositeKey );
542549 throw new NotFoundException (ErrorCode .CM_NO_ATTRIBUTES , setId );
543550 }
544551 } else {
545552 return attrName ;
546553 }
547554 attrName = subMap .get (attributeId );
548555 if (attrName == null ) {
556+ deletedAttrIds .add (compositeKey );
549557 throw new NotFoundException (ErrorCode .CM_ATTR_NOT_FOUND_BY_ID , attributeId , setId );
550558 }
551559 return attrName ;
0 commit comments