You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Mike Matrigali <mi...@sbcglobal.net> on 2005/05/02 17:52:37 UTC

Re: [PATCH] fix for DERBY-235 ( unable to create a database using a different storage factory than the one provided by default with the engine)

committed this patch with svn 165645

Suresh Thalamati wrote:
> 
> Problem was service name on database creation  was getting just set to 
> the canonical name of the database directory
> without subsub protocol name added in the beginning. Whereas rest of the 
> system seems to expect that the
> subsub protocol name  also is part of the  service  name.  For example 
> if "csf" is  subprotocol name ,
> service name should be  "csf:C:\suresht\databases\wombat1" not just 
> "C:\suresht\databases\wombat1".
> Attached diff fixes the problem by  prefixing the subsub protocol name  
> to the canonical name, to generate
> the service name in the case of create also.
> 
> This was not an issue with default "directory"  subsub protocol because 
> the system consistently generates
> the service name as just the canonical name of  the service root.
> 
> Another doubt I had while fixing this issue why we generate the service 
> name after creating the service root,
> my guess is because of the following comment in the java docs for 
> java.io.File.getCanonicalPath() method:
> " Every pathname that denotes an existing file or directory has a unique 
> canonical form. Every pathname that
> denotes a nonexistent file or directory also has a unique canonical 
> form. The canonical form of the pathname of a
> nonexistent file or directory may be different  from the canonical form 
> of the same pathname after the file or
> directory is created. Similarly, the canonical form of the pathname of 
> an existing file or directory may be different from the
> canonical form of the same pathname after the file or directory is deleted.
> "
> 
> Tests:  Ran derbyall ; all tests passed.
> 
> 
> Thanks
> -suresh
> 
> 
> ------------------------------------------------------------------------
> 
> Index: java/engine/org/apache/derby/impl/services/monitor/PersistentServiceImpl.java
> ===================================================================
> --- java/engine/org/apache/derby/impl/services/monitor/PersistentServiceImpl.java	(revision 165030)
> +++ java/engine/org/apache/derby/impl/services/monitor/PersistentServiceImpl.java	(working copy)
> @@ -629,7 +629,15 @@
>  		Throwable t = null;
>          try
>          {
> -            return (String) AccessController.doPrivileged(
> +			String protocolLeadIn = "";
> +			//prepend the subsub protocol name to the storage factoty canonical
> +			//name to form the service name except in case of the the 
> +			//default subsubprototcol(PersistentService.DIRECTORY)
> +
> +			if (!(getType().equals( PersistentService.DIRECTORY))) 
> +				protocolLeadIn = getType() + ":";
> +
> +            return protocolLeadIn + (String) AccessController.doPrivileged(
>                  new PrivilegedExceptionAction()
>                  {
>                      public Object run()