Attila Sasvari created OOZIE-2965:
-------------------------------------

             Summary: Consolidate workflow, bundle, coordinator, SLA validation
                 Key: OOZIE-2965
                 URL: https://issues.apache.org/jira/browse/OOZIE-2965
             Project: Oozie
          Issue Type: Bug
            Reporter: Attila Sasvari


Right now validating a workflow, coordinator, bundle, SLA xml against the 
provided schemas are happenning in different ways.

- Validating a coordinator xml with {{oozie validate}}:
https://github.com/apache/oozie/blob/branch-4.3/core/src/main/java/org/apache/oozie/servlet/V2ValidateServlet.java#L125
Here we try to validate against all possible schemas. Validation depends on a 
magic string "cvc-elt.1.a" in the exception's message that I believe is 
questionable. It is not present in all xercesImpl versions, and my cause 
problems if Oozie server loads earlier versions of xercesImpl. For example: we 
get a SAXParseException in the first iteration when validating against the 
workflow schemas if Xerces classes are loaded from xercesImpl 2.9.1: 
{noformat}
oozie validate -oozie http://localhost:11000/oozie  /tmp/coordinator.xml 
Error: E0701: XML schema error, /tmp/coordinator.xml, 
org.xml.sax.SAXParseException; lineNumber: 7; columnNumber: 43; cvc-elt.1: 
Cannot find the declaration of element 'coordinator-app'.
{noformat}
- Submitting a coordinator xml with {{oozie job ... -submit}}:
https://github.com/apache/oozie/blob/branch-4.3/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java#L495
Here only coordinator schemas are used for the validation.

Validation during bundle submission happens in similar way : 
https://github.com/apache/oozie/blob/5998c18fde1da769e91e3ef1bcca484723730c76/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java#L289.
 
During workflow submission, validation is a bit more complex: 
https://github.com/apache/oozie/blob/branch-4.3/core/src/main/java/org/apache/oozie/workflow/lite/LiteWorkflowAppParser.java#L169

It would be a better solution to have a common validation logic  for job 
(workflow, coordinator, bundle, etc) submission and xml validation with {{oozie 
validate}}. We should only validate XML against the given entity's schema(s) 
(e.g. coording), and not against each schema. {{V2ValidateServlet}} should not 
(re)implement xml validation.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to