You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@jena.apache.org by GitBox <gi...@apache.org> on 2021/04/26 20:55:32 UTC

[GitHub] [jena] kinow commented on a change in pull request #988: Added ability to delete old DB after compaction has completed successfully

kinow commented on a change in pull request #988:
URL: https://github.com/apache/jena/pull/988#discussion_r620642487



##########
File path: jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/ctl/ActionCompact.java
##########
@@ -88,18 +88,25 @@ private static DatasetGraph unwrap(DatasetGraph dsg, Predicate<DatasetGraph> pre
     }
 
     static class CompactTask extends TaskBase {
-        static private Logger log = Fuseki.compactLog;
+        static private final Logger log = Fuseki.compactLog;
+
+        private final boolean shouldDeleteOld;
 
         public CompactTask(HttpAction action) {
             super(action);
+
+            String deleteOldParam = action.request.getParameter("deleteOld");
+
+            this.shouldDeleteOld = ( deleteOldParam != null
+                && ( deleteOldParam.isEmpty() || deleteOldParam.equalsIgnoreCase("true") ) );

Review comment:
       If I understood it correctly (having first :coffee: of the day), in the command line the database is not deleted by default.
   
   But here in Fuseki if you do not pass a parameter (`http//url/`?) then it is not deleted. If you pass an empty parameter (`http//url/?deleteOld=` ?) then it is deleted? Or if you pass `"true"` (`http//url/?deleteOld=true` ?) then it's also deleted.
   
   If that's correct, then I think it's the old database is not deleted only if I do not specify the parameter or if I set its value to `"false"`? Shouldn't we ignore blank/empty strings too, and only delete if the param is `true`, having this way the same behaviour as in the cli?
   
   ```suggestion
               this.shouldDeleteOld = deleteOldParam != null && deleteOldParam.trim().equalsIgnoreCase("true");
   ```




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@jena.apache.org
For additional commands, e-mail: pr-help@jena.apache.org