[ 
https://issues.apache.org/jira/browse/JENA-869?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14299830#comment-14299830
 ] 

Bruno P. Kinoshita commented on JENA-869:
-----------------------------------------

If I understand it correct, FusekiServer will try to load databases from a) 
server config, b) configuration directory and c) system directory databases 
(e.g. /home/kinow/java/jena/jena/jena-fuseki2/jena-fuseki-core/run). When 
databases are created using the Web interface, they go into the system 
directory. 

When we create the database "test1", a directory "/test1" is created under the 
system directory. However, deleting the database using the Web interface does 
not remove the directory. Recreating a test1 database again will reuse the 
existing directory. It will append the new database graph into the existing 
database. 

The old "test1" is still there with its old UUID, and the new "test1" database 
will be there as well, but with a different UUID. When the FusekiServer looks 
for databases in the system directory (the c) step in the first paragraph), it 
will query with SPARQL the model found in that directory, and will find two 
test1 databases, both in the Active state. 

Trying to load that twice, DataAccessPointRegistry will trigger the error 
reporter. 

Possible solutions include:

* When deleting a database (see ActionDatasets#execDeleteItem) we look for its 
directory under the system directory and remove it if existing

* When creating a new database, we can check if the file already exists and 
create a new name (appending -2 for example). We would need to change the 
execDeleteItem to mark the graph as inactive too though.

I'd adopt for the former alternative. Thoughts or other alternatives?

> Fuseki2: Can't reuse dataset name after DELETE
> ----------------------------------------------
>
>                 Key: JENA-869
>                 URL: https://issues.apache.org/jira/browse/JENA-869
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Fuseki
>    Affects Versions: Fuseki 2.0.0
>         Environment: Docker 
> https://registry.hub.docker.com/u/stain/jena-fuseki/
>            Reporter: Stian Soiland-Reyes
>             Fix For: Fuseki 2.0.0
>
>
> In the web interface, I create a persistent dataset "test1". I then remove 
> it. I then create a second one called "test1". Everything works fine.
> However, if I restart Fuseki, now it attemps to register test1 twice:
> {code}
> [2015-01-28 12:47:33] Servlet    INFO  Initializing Shiro environment
> [2015-01-28 12:47:33] Config     INFO  Shiro file: file:///fuseki/shiro.ini
> [2015-01-28 12:47:33] Builder    INFO  Service: TDB test1
> [2015-01-28 12:47:34] Builder    INFO  Service: TDB test1
> [2015-01-28 12:47:34] Builder    INFO  Service: :service1
> [2015-01-28 12:47:34] Builder    INFO  Service: TDB test3
> [2015-01-28 12:47:34] Config     INFO  Register: /test1
> [2015-01-28 12:47:34] Config     INFO  Register: /test1
> [2015-01-28 12:47:34] Server     ERROR Exception in initialization: Already 
> registered: /test1
> [2015-01-28 12:47:34] WebAppContext WARN  Failed startup of context 
> o.e.j.w.WebAppContext@d04ca48{/,file:/jena-fuseki/webapp/,STARTING}
> org.apache.jena.fuseki.FusekiException: Already registered: /test1
>       at 
> org.apache.jena.fuseki.server.DataAccessPointRegistry.register(DataAccessPointRegistry.java:28)
>       at 
> org.apache.jena.fuseki.server.FusekiServer.enable(FusekiServer.java:232)
>       at 
> org.apache.jena.fuseki.server.FusekiServer.initializeDataAccessPoints(FusekiServer.java:226)
>       at 
> org.apache.jena.fuseki.server.FusekiServerListener.init(FusekiServerListener.java:70)
>       at 
> org.apache.jena.fuseki.server.FusekiServerListener.contextInitialized(FusekiServerListener.java:45)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:799)
>       at 
> org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:446)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:791)
>       at 
> org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:296)
>       at 
> org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1347)
>       at 
> org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:743)
>       at 
> org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:492)
>       at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
>       at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:117)
>       at org.eclipse.jetty.server.Server.start(Server.java:355)
>       at 
> org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:99)
>       at 
> org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:60)
>       at org.eclipse.jetty.server.Server.doStart(Server.java:324)
>       at 
> org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:69)
>       at org.apache.jena.fuseki.jetty.JettyFuseki.start(JettyFuseki.java:137)
>       at 
> org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.exec(FusekiCmd.java:331)
>       at arq.cmdline.CmdMain.mainMethod(CmdMain.java:102)
>       at arq.cmdline.CmdMain.mainRun(CmdMain.java:63)
>       at arq.cmdline.CmdMain.mainRun(CmdMain.java:50)
>       at 
> org.apache.jena.fuseki.cmd.FusekiCmd$FusekiCmdInner.innerMain(FusekiCmd.java:97)
>       at org.apache.jena.fuseki.cmd.FusekiCmd.main(FusekiCmd.java:60)
> {code}
> In the HTTP log from before:
> {code}
> [2015-01-28 12:47:02] Admin      INFO  [1] GET http://localhost:3031/$/server
> [2015-01-28 12:47:02] Admin      INFO  [1] 200 OK (11 ms) 
> [2015-01-28 12:47:04] Admin      INFO  [2] GET http://localhost:3031/$/server
> [2015-01-28 12:47:04] Admin      INFO  [2] 200 OK (1 ms) 
> [2015-01-28 12:47:08] Admin      INFO  [3] POST 
> http://localhost:3031/$/datasets
> [2015-01-28 12:47:08] Admin      INFO  [3] Create database : name = /test1
> [2015-01-28 12:47:08] Builder    INFO  Service: TDB test1
> [2015-01-28 12:47:08] Admin      INFO  [3] 200 OK (499 ms) 
> [2015-01-28 12:47:09] Admin      INFO  [4] GET http://localhost:3031/$/server
> [2015-01-28 12:47:09] Admin      INFO  [4] 200 OK (2 ms) 
> [2015-01-28 12:47:12] Admin      INFO  [5] POST 
> http://localhost:3031/$/datasets
> [2015-01-28 12:47:12] Admin      INFO  [5] Create database : name = /test2
> [2015-01-28 12:47:12] Builder    INFO  Service: :service1
> [2015-01-28 12:47:12] Admin      INFO  [5] 200 OK (117 ms) 
> [2015-01-28 12:47:12] Admin      INFO  [6] GET http://localhost:3031/$/server
> [2015-01-28 12:47:12] Admin      INFO  [6] 200 OK (3 ms) 
> [2015-01-28 12:47:16] Admin      INFO  [7] POST 
> http://localhost:3031/$/datasets
> [2015-01-28 12:47:16] Admin      INFO  [7] Create database : name = /test3
> [2015-01-28 12:47:16] Builder    INFO  Service: TDB test3
> [2015-01-28 12:47:16] Admin      INFO  [7] 200 OK (126 ms) 
> [2015-01-28 12:47:16] Admin      INFO  [8] GET http://localhost:3031/$/server
> [2015-01-28 12:47:16] Admin      INFO  [8] 200 OK (3 ms) 
> [2015-01-28 12:47:20] Admin      INFO  [9] DELETE 
> http://localhost:3031/$/datasets/test1
> [2015-01-28 12:47:20] Admin      INFO  [9] DELETE ds=/test1
> [2015-01-28 12:47:20] Admin      INFO  [9] 200 OK (23 ms) 
> [2015-01-28 12:47:20] Admin      INFO  [10] GET http://localhost:3031/$/server
> [2015-01-28 12:47:20] Admin      INFO  [10] 200 OK (1 ms) 
> [2015-01-28 12:47:26] Admin      INFO  [11] POST 
> http://localhost:3031/$/datasets
> [2015-01-28 12:47:26] Admin      INFO  [12] POST 
> http://localhost:3031/$/datasets
> [2015-01-28 12:47:26] Admin      INFO  [11] Create database : name = /test1
> [2015-01-28 12:47:26] Builder    INFO  Service: TDB test1
> [2015-01-28 12:47:27] Admin      INFO  [11] 200 OK (112 ms) 
> [2015-01-28 12:47:27] Admin      INFO  [12] Create database : name = /test1
> [2015-01-28 12:47:27] Admin      INFO  [12] 409 Name already registered 
> /test1 (127 ms) 
> [2015-01-28 12:47:27] Admin      INFO  [13] GET http://localhost:3031/$/server
> [2015-01-28 12:47:27] Admin      INFO  [13] 200 OK (2 ms) 
> {code}
> Notice that 409.. the web UI didn't indicate anything about this.
> Inspecting my /fuseki reveals indeed that test1 appears three times:
> root@35e5b435426c:/fuseki# grep -r test1 .
> Binary file ./system/nodes.dat matches
> ./system_files/f9508798-2ac1-11b2-80c2-dab7e13f8f6e:        rdfs:label        
>             "TDB test1" ;
> ./system_files/f9508798-2ac1-11b2-80c2-dab7e13f8f6e:        fuseki:name       
>             "test1" ;
> ./system_files/f9508798-2ac1-11b2-80c2-dab7e13f8f6e:        tdb:location  
> "/fuseki/databases/test1" .
> ./system_files/f950879c-2ac1-11b2-80c2-dab7e13f8f6e:        rdfs:label        
>             "TDB test1" ;
> ./system_files/f950879c-2ac1-11b2-80c2-dab7e13f8f6e:        fuseki:name       
>             "test1" ;
> ./system_files/f950879c-2ac1-11b2-80c2-dab7e13f8f6e:        tdb:location  
> "/fuseki/databases/test1" .
> ./system_files/f950879b-2ac1-11b2-80c2-dab7e13f8f6e:        rdfs:label        
>             "TDB test1" ;
> ./system_files/f950879b-2ac1-11b2-80c2-dab7e13f8f6e:        fuseki:name       
>             "test1" ;
> ./system_files/f950879b-2ac1-11b2-80c2-dab7e13f8f6e:        tdb:location  
> "/fuseki/databases/test1" .
> f950879c-2ac1-11b2-80c2-dab7e13f8f6e is not in ./system/prefixes.dat and 
> ./system/nodes.dat, while the other two UUIDs are.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to