-
1. Re: Admin API TEIID : DelteVDB
rareddy Dec 18, 2009 11:33 AM (in response to rgros)If there are any pending connections that are assosiated with that old VDB, then VDB's status will be switched to "deleted" but it it will not be deleted until all the connections assosiated with that VDB are either closed or terminated. Once the connection count goes to zero the file will be deleted. Any new connections to the "deleted" VDB will also be denied in this stage.
-
2. Re: Admin API TEIID : DelteVDB
rgros Dec 22, 2009 4:26 AM (in response to rareddy)After several tries to check that all connections are correctly closed, we still have the problem of the vdb.deleted file.
Here is our basic piece of code :
public String / void addVdb(byte[] vdbAsAByteArray) / deleteVDB(String vdbName, String vdbVersion) throws Exception
{
VDB vdb = null;
Connection connect = null;
try
{
// Get a handle to the TEIID Admin API
connect = getConnection("admin", "teiid");
Admin adminTeiid = connect.getAdminAPI();
vdb = adminTeiid.addVDB(vdbName, vdbAsAByteArray, new AdminOptions(AdminOptions.OnConflict.OVERWRITE)); / adminTeiid.deleteVDB(vdbName, vdbVersion);
}
catch(Exception e)
{
throw e;
}
finally
{
if(connect != null)
{
try
{
connect.close();
}
catch (SQLException e)
{
// Do nothing
}
}
}
return vdb.getVDBVersion(); / return;
}
private Connection getConnection(String user, String password) throws Exception
{
String url = "jdbc:teiid:admin@mm://localhost:31000";
Class.forName("org.teiid.jdbc.TeiidDriver");
Connection c = (com.metamatrix.jdbc.api.Connection) DriverManager.getConnection(url, user, password);
return c;
}
We tried to delete all ConnectorBindings after deleting the vdb but the collection is already empty :
Collection<ConnectorBinding> bindings = adminTeiid.getConnectorBindings("*");
for(ConnectorBinding binding : bindings)
{
adminTeiid.stopConnectorBinding(binding.getIdentifier(), true);
adminTeiid.deleteConnectorBinding(binding.getIdentifier());
}
We also tried to pass connect to null after closing, to add connect.commit() before closing, but unsuccessfully.
The more disconcerting is that it never appends when debugging...
Is there another way we could also investigating ? -
3. Re: Admin API TEIID : DelteVDB
rareddy Dec 22, 2009 12:09 PM (in response to rgros)The code looks fine. Yes, when a file locked by a process and we can not delete for some reason then we create ".delete" file. I tried your usecase on both Win/Linux boxes and did not see issue with Teiid holding a lock in either environment. May be my usage of the VDB did not go through the same scenario as yours.
You can see the code creating the ".delete" file at
Since you are supplying the byte[] to the "addVDB" call, the only process could possibly hold the lock is Teiid. If you are working on Windows, you can use Process Explorer or use command 'lsof' on the linux to see which process is holding the file lock.
Do not like to suggest this, but may be you can try 'restart' call on the admin api, see if that helps. I also did try the "embedded" scenario ( you are working with server as per your connection URL) even there I could not re-produce it.
Also, which version are you using 6.2? If you can give me simple Junit test which reproduces this issue, I can take look.
Sorry that could'nt be more helpful.
Thanks
Ramesh..