-
1. Re: Validate VDB before calling EmbeddedServer.deploy
shawkins Aug 17, 2016 4:34 PM (in response to jrod2016)The full validation potentially requires a metadata load, so there isn't a option beyond just the full deploy. Do you have a scenario where you don't want it to be available? You can set connection-type NONE - VDB Definition · Teiid Documentation
-
2. Re: Validate VDB before calling EmbeddedServer.deploy
jrod2016 Aug 18, 2016 11:11 AM (in response to shawkins)In that case, how can I recover a failed deploy? Here's my current deploy code
int newVdbVersion = maxVdbVersion + 1; ModelMetaData[] backupModels = getModelsFromVDB(vdb); try { server.deployVDB(String.format("%s.%d", dbName, newVdbVersion), modelUpdates.apply(vdb, modelMetaData)); // modelUpdates.apply returns ModelMetaData[] } catch (Exception e) { // How can I recover here? throw e; }
So, the issue I face is that if I get an error like this:
org.teiid.metadata.ParseException: TEIID30386 org.teiid.api.exception.query.QueryParserException: TEIID31100 Parsing error: Encountered "CREATE VIEW [*]Order[*] (Product_line" at line 1, column 13. Was expecting: id
Then, subsequent deploys fail with the same error. Anyway to clear out the ModelMetaData which caused an issue with the server?
-
3. Re: Validate VDB before calling EmbeddedServer.deploy
shawkins Aug 18, 2016 3:01 PM (in response to jrod2016)> Anyway to clear out the ModelMetaData which caused an issue with the server?
What corrective action are you taking?
-
4. Re: Validate VDB before calling EmbeddedServer.deploy
jrod2016 Aug 18, 2016 4:46 PM (in response to shawkins)I plan to remove the view causing the error from the model. Is there any operation which is the opposite of ModelMetaData.addSourceMetadata? Or can I just remove it from sourceMetadataText within ModelMetaData?
So, I have something like this (which works apparently). Is there a better way to do this?
private void removeViewFromModel(String viewName, ModelMetaData mmd) { final int sourceMetadataIndex = mmd.getSourceMetadataText() .stream() .map(this::getViewName) .collect(Collectors.toList()) .indexOf(viewName); mmd.getSourceMetadataText().remove(sourceMetadataIndex); mmd.getSourceMetadataType().remove(sourceMetadataIndex); }
-
5. Re: Validate VDB before calling EmbeddedServer.deploy
shawkins Aug 19, 2016 4:04 PM (in response to jrod2016)> Is there a better way to do this?
If you know you want to remove the whole metadata source, then yes that should be fine.
-
6. Re: Validate VDB before calling EmbeddedServer.deploy
jrod2016 Aug 19, 2016 4:06 PM (in response to shawkins)Sounds good. Thanks.