Aklakan opened a new issue, #1548:
URL: https://github.com/apache/jena/issues/1548

   ### Version
   
   4.7.0-SNAPSHOT
   
   ### What happened?
   
   The core of the issue is that GraphBase.isEmpty() scans all triples which is 
infeasibly slow for large graphs (several 100M triples).
   
   We noticed a problem, that when uploading a small amount of data using the 
"Fuseki Add Data tab" into a very large graph then the upload would hang 
indefinitely. Conversely, uploading the same data using  `SPARQL LOAD` 
statement worked fine.
   
   The Fuseki Add Data tab uses the Graph Store Protocol. Jena's implementation 
ends up checking `GraphBase.isEmpty`.
   If it is empty then the HTTP response is `201 created`, otherwise it is `200 
success`.
   
   However, `GraphBase.isEmpty` is implemented as a scan over all data.
   The solution is to this issue seems to be to change that implementation 
essentially to `return !graph.find().hasNext()`.
   
   
   ### Relevant output and stacktrace
   
   ```shell
   
org.apache.jena.dboe.transaction.txn.IteratorTxnTracker.next(IteratorTxnTracker.java:39)
        at org.apache.jena.atlas.iterator.Iter$IterMap.next(Iter.java:417)
        at org.apache.jena.atlas.iterator.Iter.next(Iter.java:1109)
        at 
org.apache.jena.util.iterator.WrappedIterator.next(WrappedIterator.java:107)
        at 
org.apache.jena.graph.impl.GraphBase.graphBaseSize(GraphBase.java:311)
        at 
org.apache.jena.sparql.core.GraphView.graphBaseSize(GraphView.java:187)
        at org.apache.jena.graph.impl.GraphBase.size(GraphBase.java:297)
        at org.apache.jena.graph.impl.GraphBase.isEmpty(GraphBase.java:327)
        at 
org.apache.jena.fuseki.servlets.GraphTarget.exists(GraphTarget.java:221)
        at 
org.apache.jena.fuseki.servlets.GSP_RW.triplesPutPostTxn(GSP_RW.java:190)
        at org.apache.jena.fuseki.servlets.GSP_RW.doPutPostGSP(GSP_RW.java:160)
        at org.apache.jena.fuseki.servlets.GSP_RW.execPostGSP(GSP_RW.java:77)
        at org.apache.jena.fuseki.servlets.GSP_RW.doPost(GSP_RW.java:74)
        at 
org.apache.jena.fuseki.servlets.ActionREST.doPost$(ActionREST.java:97)
   ```
   ```
   
   
   ### Are you interested in making a pull request?
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to