Uploaded image for project: 'Atlas'
  1. Atlas
  2. ATLAS-1681

Atlas went into inconsistent state after creating a type with faulty definition

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0.0, trunk
    • 0.8.1, 1.0.0
    • atlas-core
    • None

    Description

      Created an entity type with one of its attribute name empty with the following definition with the following JSON:

      {
         "structDefs":[
      
         ],
         "entityDefs":[
            {
               "category":"ENTITY",
               "updateTime":12345,
               "name":"entity_incorrect",
               "typeVersion":"0.1",
               "attributeDefs":[
                  {
                     "name":"type_str",
                     "isOptional":true,
                     "isUnique":false,
                     "isIndexable":false,
                     "typeName":"string",
                     "valuesMaxCount":1,
                     "cardinality":"SINGLE",
                     "valuesMinCount":0
                  },
                  {
                     "name":"",
                     "typeName":"int",
                     "isOptional":true,
                     "cardinality":"SINGLE",
                     "valuesMinCount":-1,
                     "valuesMaxCount":-1,
                     "isUnique":false,
                     "isIndexable":false
                  }
               ],
               "superTypes":[
      
               ],
               "version":12345,
               "guid":"-48964f25979it51334479",
               "createTime":12345,
               "description":"incorrect json"
            }
         ],
         "classificationDefs":[
      
         ],
         "enumDefs":[
      
         ]
      }
      
      

      Note the second attribute name in the attribute definition

      POSTed the type definition to

      /api/atlas/v2/types/typedefs
      

      The type is created ,with 200 OK but with exception

      java.lang.IllegalArgumentException: Attribute name cannot be empty
      

      (Attached the complete stack trace as a file)

      Inconsistency Observed :

      1. Types drop down box lists the type entity_incorrect , but clicking on it throws "Invalid Expression" exception

      2. Therafter ,any type creation (entity type , classification etc) is succeeding with 200 OK but application.log has exception :

      org.apache.atlas.query.Expressions$UnresolvedException: Unresolved id, expression: entity_correct
      

      Example :
      After POSTing the incorrect json to Atlas , created a tag tag_after in UI . It succeeded. But Search of tag throws invalid expression and tag Association to entity fails with

      org.apache.atlas.exception.AtlasBaseException: org.apache.atlas.repository.RepositoryException: org.apache.atlas.typesystem.exception.TypeNotFoundException: Unknown datatype: tag_after
      

      Type registration is affected when Atlas accepts the wrong JSON.

      Giving an empty attribute name is not a very common scenario but at what conditions such wrong JSONs could be accepted should be looked at.

      Attachments

        1. EmptyAttrNameInTypeDef.txt
          20 kB
          Sharmadha S

        Activity

          People

            apoorvnaik Apoorv Naik
            sharmadhas Sharmadha S
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: