This is an automated email from the ASF dual-hosted git repository.

bchapuis pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git


The following commit(s) were added to refs/heads/main by this push:
     new 68711ce7 Improve SQLite configuration (#672)
68711ce7 is described below

commit 68711ce7da5cd662fb9ba34f3169053d57d9e5d1
Author: Bertil Chapuis <[email protected]>
AuthorDate: Tue May 30 10:28:02 2023 +0200

    Improve SQLite configuration (#672)
---
 .../apache/baremaps/workflow/tasks/ExportVectorTiles.java | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git 
a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
 
b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
index 11c806ac..7828a049 100644
--- 
a/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
+++ 
b/baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java
@@ -36,6 +36,11 @@ import org.apache.baremaps.workflow.WorkflowContext;
 import org.locationtech.jts.geom.Envelope;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.sqlite.SQLiteConfig;
+import org.sqlite.SQLiteConfig.JournalMode;
+import org.sqlite.SQLiteConfig.LockingMode;
+import org.sqlite.SQLiteConfig.SynchronousMode;
+import org.sqlite.SQLiteConfig.TempStore;
 import org.sqlite.SQLiteDataSource;
 
 public record ExportVectorTiles(
@@ -49,8 +54,6 @@ public record ExportVectorTiles(
 
   @Override
   public void execute(WorkflowContext context) throws Exception {
-
-
     var configReader = new ConfigReader();
     var objectMapper = objectMapper();
     var tileset = objectMapper.readValue(configReader.read(this.tileset), 
Tileset.class);
@@ -78,7 +81,15 @@ public record ExportVectorTiles(
 
   private TileStore targetTileStore(Tileset source) throws TileStoreException, 
IOException {
     if (mbtiles) {
+      var sqliteConfig = new SQLiteConfig();
+      sqliteConfig.setCacheSize(1000000);
+      sqliteConfig.setJournalMode(JournalMode.OFF);
+      sqliteConfig.setLockingMode(LockingMode.EXCLUSIVE);
+      sqliteConfig.setSynchronous(SynchronousMode.OFF);
+      sqliteConfig.setTempStore(TempStore.MEMORY);
+
       var dataSource = new SQLiteDataSource();
+      dataSource.setConfig(sqliteConfig);
       dataSource.setUrl("jdbc:sqlite:" + repository);
 
       var tilesStore = new MBTiles(dataSource);

Reply via email to