-
1. Re: Add a new ModelMetaData to a deployed VDB in teiid-embedded without undeploy/redeploy of the VDB
rareddy Jun 13, 2016 2:33 PM (in response to jrod2016)John,
Yes, I see that during the undeploy of the VDB, embedded terminates all the sessions. Teiid does allow this in full server version, you can open JIRA enhancement for this.
Ramesh..
-
2. Re: Add a new ModelMetaData to a deployed VDB in teiid-embedded without undeploy/redeploy of the VDB
shawkins Jun 13, 2016 2:43 PM (in response to rareddy)> Teiid does allow this in full server version, you can open JIRA enhancement for this.
The full server does not allow for this - it only does not require an explicit undeploy. The reployment (TEIID50019) of a vdb with a matching name/version will undeploy the old version, which will kill the existing sessions.
The only way to not affect current consumers is to use versioned deployment - which is something we initially abstracted from embedded, but could easily be allowed.
-
3. Re: Add a new ModelMetaData to a deployed VDB in teiid-embedded without undeploy/redeploy of the VDB
jrod2016 Jun 13, 2016 5:27 PM (in response to shawkins)I verified that using versioned deployment does not require me to do an undeploy and my existing sessions with the older versions are unaffected. I've listed my sample code below:
public void defineViewAlt(ViewDefinitionTO viewDefinitionTO) {
logger.info(String.format("Defining alt view [%s] for model [%s]", viewDefinitionTO.getViewName(), viewDefinitionTO.getModelName()));
try {final OptionalInt maxVdb = server.getAdmin().getVDBs().stream().mapToInt(vdb -> Integer.parseInt(vdb.getVersion())).max();
if (maxVdb.isPresent()) {final int maxVdbVersion = maxVdb.getAsInt();
final VDB vdb = server.getAdmin().getVDB(VDB_NAME, maxVdbVersion);
ModelMetaData[] models = getModelsFromVDB(vdb);
ModelMetaData[] newModels = new ModelMetaData[models.length + 1];
System.arraycopy(models, 0, newModels, 0, models.length);
newModels[models.length] = getModel(viewDefinitionTO);
server.deployVDB(String.format("%s.%d", VDB_NAME, maxVdbVersion + 1), newModels);
}} catch (Exception ex) {
logger.error(String.format("Exception [%s] occurred", ex.getMessage()), ex);
throw new RuntimeException(ex.getMessage());
}}
When connecting with a JDBC string to teiid (jdbc:teiid:my-vdb@mm://localhost:31000), it seems that version "1" is used if no vdb version is specified. Is there a way to change this behavior such that the connection is made to the latest version of the VDB instead of the first version?
-
4. Re: Add a new ModelMetaData to a deployed VDB in teiid-embedded without undeploy/redeploy of the VDB
shawkins Jun 13, 2016 5:42 PM (in response to jrod2016)By default vdb's expect to be referenced by version in the connection string. You can change with with the vdb property <connection-type>ANY</connection-type> - it's a child of the vdb root - VDB Versioning · Teiid Documentation
It looks like that needs added to the overall vdb structure definition as well. I'll make that change.
-
5. Re: Add a new ModelMetaData to a deployed VDB in teiid-embedded without undeploy/redeploy of the VDB
jrod2016 Jun 13, 2016 6:17 PM (in response to shawkins)Sure enough, that worked. I added the following line of code. Had to cast it to VDBMetaData though...
server.getAdmin().getVDBs().forEach(vdbToMod -> ((VDBMetaData) vdbToMod).setConnectionType(VDB.ConnectionType.ANY));
-
6. Re: Add a new ModelMetaData to a deployed VDB in teiid-embedded without undeploy/redeploy of the VDB
shawkins Jun 13, 2016 8:15 PM (in response to jrod2016)There is also the Admin.changeVDBConnectionType method.