openlink / virtuoso-opensource

Virtuoso is a high-performance and scalable Multi-Model RDBMS, Data Integration Middleware, Linked Data Deployment, and HTTP Application Server Platform
https://vos.openlinksw.com
Other
867 stars 210 forks source link

Inconsistent BEFORE INSERT trigger behavior #611

Open rnavarropiris opened 7 years ago

rnavarropiris commented 7 years ago

Problem description

Triggers declared as BEFORE INSERT show an inconsistent behaviour on different setups. In most cases, it seems as if the trigger does not respect the BEFORE behaviour.

Might be related to this issue: https://github.com/openlink/virtuoso-opensource/issues/262

Process

The provided script (test.sh, see below):

  1. starts a new Virtuoso server (with no existing DB files) using the provided virtuoso.ini file (see below)
  2. configures a BEFORE INSERT ON RDF_QUAD trigger which logs the number of triples in the graph (expected to be 0 at all times)
  3. writes a triple on an empty graph several times (the graph is emptied everytime before the INSERT statement)
  4. shuts the server gracefully down
  5. starts the server again, using the existing DB and TRX files
  6. repeates the steps 2-4

It is expected that the logfile of both runs shows the same counts, which should always be 0.

The following test cases were executed several times, leading always to the same result documented here.

Case 1: MacOs version

System:

OS X El Capitan
Version: 10.11.6 (15G31)

Installed with brew (brew install virtuoso):

$ brew info virtuoso
virtuoso: stable 7.2.4.2 (bottled), HEAD
High-performance object-relational SQL database
https://virtuoso.openlinksw.com/wiki/main/
Conflicts with: unixodbc
/usr/local/Cellar/virtuoso/7.2.4.2 (191 files, 50.0M) *
  Poured from bottle on 2016-11-21 at 14:20:46
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/virtuoso.rb

Both logfiles are wrong, as the count shows 1 instead of the expected 0

Logfile (steps 1-4):

$ cat test-preRestart.log

        Mon Nov 21 2016
15:45:23 OpenLink Virtuoso Universal Server
15:45:23 Version 07.20.3217-pthreads for Darwin as of Jul 20 2016
15:45:23 uses parts of OpenSSL, PCRE, Html Tidy
15:45:23 SQL Optimizer enabled (max 1000 layouts)
15:45:23 Compiler unit is timed at 0.000470 msec
15:45:28 Checkpoint started
15:45:28 Roll forward started
15:45:28 Roll forward complete
15:45:28 Checkpoint started
15:45:28 Checkpoint finished, log reused
15:45:28 Checkpoint started
15:45:28 Checkpoint finished, log reused
15:45:28 Checkpoint started
15:45:28 Checkpoint finished, log reused
15:45:29 Checkpoint started
15:45:29 Checkpoint finished, log reused
15:45:29 Checkpoint started
15:45:29 Checkpoint finished, log reused
15:45:29 PL LOG: Can't get list of vad packages in /opt/virtuoso-opensource/share/virtuoso/vad/
15:45:29 Default charset UTF-8 not defined. Reverting to ISO-8859-1
15:45:29 Checkpoint started
15:45:29 Checkpoint finished, log reused
15:45:31 HTTP/WebDAV server online at 1112
15:45:31 Server online at 1111 (pid 48800)
15:45:33 EXEC_1 0 127.0.0.1 1111:2 s1111_2_0 Exec 1 time(s) CREATE TRIGGER before_insert BEFORE INSERT ON DB.DBA.RDF_QUAD REFERENCING NEW AS QUAD { declare quadInstances integer; select count (*) into quadInstances from DB.DBA.RDF_QUAD WHERE __i2id ('urn:g') = G; dbg_printf('before insert count of <urn:g> : %d', quadInstances); }
15:45:33 EXEC_1 0 127.0.0.1 1111:3 s1111_3_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:33 EXEC_1 0 127.0.0.1 1111:4 s1111_4_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o0>}}
before insert count of <urn:g> : 1
15:45:33 EXEC_1 0 127.0.0.1 1111:5 s1111_5_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:33 EXEC_1 0 127.0.0.1 1111:6 s1111_6_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o1>}}
before insert count of <urn:g> : 1
15:45:33 EXEC_1 0 127.0.0.1 1111:7 s1111_7_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:33 EXEC_1 0 127.0.0.1 1111:8 s1111_8_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o2>}}
before insert count of <urn:g> : 1
15:45:34 EXEC_1 0 127.0.0.1 1111:9 s1111_9_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:34 EXEC_1 0 127.0.0.1 1111:10 s1111_10_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o3>}}
before insert count of <urn:g> : 1
15:45:34 EXEC_1 0 127.0.0.1 1111:11 s1111_11_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:34 EXEC_1 0 127.0.0.1 1111:12 s1111_12_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o4>}}
before insert count of <urn:g> : 1
15:45:34 EXEC_1 0 127.0.0.1 1111:13 s1111_13_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:34 EXEC_1 0 127.0.0.1 1111:14 s1111_14_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o5>}}
before insert count of <urn:g> : 1
15:45:34 EXEC_1 0 127.0.0.1 1111:15 s1111_15_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:34 EXEC_1 0 127.0.0.1 1111:16 s1111_16_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o6>}}
before insert count of <urn:g> : 1
15:45:34 EXEC_1 0 127.0.0.1 1111:17 s1111_17_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:34 EXEC_1 0 127.0.0.1 1111:18 s1111_18_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o7>}}
before insert count of <urn:g> : 1
15:45:34 EXEC_1 0 127.0.0.1 1111:19 s1111_19_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:34 EXEC_1 0 127.0.0.1 1111:20 s1111_20_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o8>}}
before insert count of <urn:g> : 1
15:45:34 EXEC_1 0 127.0.0.1 1111:21 s1111_21_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:34 EXEC_1 0 127.0.0.1 1111:22 s1111_22_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o9>}}
before insert count of <urn:g> : 1
15:45:34 EXEC_1 0 127.0.0.1 1111:23 s1111_23_0 Exec 1 time(s) SHUTDOWN
15:45:34 Checkpoint started
15:45:34 Checkpoint finished, log reused
15:45:34 Server shutdown complete

Logfile (steps 5-6):

cat test-afterRestart.log

        Mon Nov 21 2016
15:45:39 OpenLink Virtuoso Universal Server
15:45:39 Version 07.20.3217-pthreads for Darwin as of Jul 20 2016
15:45:39 uses parts of OpenSSL, PCRE, Html Tidy
15:45:39 Database version 3126
15:45:39 SQL Optimizer enabled (max 1000 layouts)
15:45:41 Compiler unit is timed at 0.000201 msec
15:45:41 Roll forward started
15:45:41 Roll forward complete
before insert count of <urn:g> : 1
before insert count of <urn:g> : 1
before insert count of <urn:g> : 1
15:45:41 PL LOG: Can't get list of vad packages in /opt/virtuoso-opensource/share/virtuoso/vad/
15:45:41 Default charset UTF-8 not defined. Reverting to ISO-8859-1
15:45:41 Checkpoint started
15:45:41 Checkpoint finished, log reused
15:45:43 HTTP/WebDAV server online at 1112
15:45:43 Server online at 1111 (pid 48856)
15:45:49 EXEC_1 0 127.0.0.1 1111:3 s1111_3_0 Exec 1 time(s) CREATE TRIGGER before_insert BEFORE INSERT ON DB.DBA.RDF_QUAD REFERENCING NEW AS QUAD { declare quadInstances integer; select count (*) into quadInstances from DB.DBA.RDF_QUAD WHERE __i2id ('urn:g') = G; dbg_printf('before insert count of <urn:g> : %d', quadInstances); }
15:45:49 EXEC_1 0 127.0.0.1 1111:4 s1111_4_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:49 EXEC_1 0 127.0.0.1 1111:5 s1111_5_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o0>}}
before insert count of <urn:g> : 1
15:45:50 EXEC_1 0 127.0.0.1 1111:6 s1111_6_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:50 EXEC_1 0 127.0.0.1 1111:7 s1111_7_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o1>}}
before insert count of <urn:g> : 1
15:45:50 EXEC_1 0 127.0.0.1 1111:8 s1111_8_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:50 EXEC_1 0 127.0.0.1 1111:9 s1111_9_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o2>}}
before insert count of <urn:g> : 1
15:45:50 EXEC_1 0 127.0.0.1 1111:10 s1111_10_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:50 EXEC_1 0 127.0.0.1 1111:11 s1111_11_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o3>}}
before insert count of <urn:g> : 1
15:45:50 EXEC_1 0 127.0.0.1 1111:12 s1111_12_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:50 EXEC_1 0 127.0.0.1 1111:13 s1111_13_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o4>}}
before insert count of <urn:g> : 1
15:45:50 EXEC_1 0 127.0.0.1 1111:14 s1111_14_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:50 EXEC_1 0 127.0.0.1 1111:15 s1111_15_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o5>}}
before insert count of <urn:g> : 1
15:45:50 EXEC_1 0 127.0.0.1 1111:16 s1111_16_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:50 EXEC_1 0 127.0.0.1 1111:17 s1111_17_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o6>}}
before insert count of <urn:g> : 1
15:45:50 EXEC_1 0 127.0.0.1 1111:18 s1111_18_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:50 EXEC_1 0 127.0.0.1 1111:19 s1111_19_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o7>}}
before insert count of <urn:g> : 1
15:45:50 EXEC_1 0 127.0.0.1 1111:20 s1111_20_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:50 EXEC_1 0 127.0.0.1 1111:21 s1111_21_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o8>}}
before insert count of <urn:g> : 1
15:45:51 EXEC_1 0 127.0.0.1 1111:22 s1111_22_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:45:51 EXEC_1 0 127.0.0.1 1111:23 s1111_23_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o9>}}
before insert count of <urn:g> : 1

Case 2: docker container

Setup (in an image based on the Ubuntu 14.04 image):

  git clone --recursive https://github.com/openlink/virtuoso-opensource.git /opt/virtuoso-opensource.src
  cd /opt/virtuoso-opensource.src
  git checkout v7.2.4.2
  ./autogen.sh
  CFLAGS="-O2 -m64"
  export CFLAGS
  ./configure --prefix=/opt/virtuoso-opensource --with-readline
  make -j 8
  make install

The first logfile is ok, the second is not, as the count shows 1 instead of the expected 0

Logfile (steps 1-4):

$ cat test-preRestart.log

        Mon Nov 21 2016
15:49:03 OpenLink Virtuoso Universal Server
15:49:03 Version 07.20.3217-pthreads for Linux as of Nov  8 2016
15:49:03 uses parts of OpenSSL, PCRE, Html Tidy
15:49:03 SQL Optimizer enabled (max 1000 layouts)
15:49:03 Compiler unit is timed at 0.000330 msec
15:49:05 Checkpoint started
15:49:05 Roll forward started
15:49:05 Roll forward complete
15:49:05 Checkpoint started
15:49:05 Checkpoint finished, log reused
15:49:05 Checkpoint started
15:49:05 Checkpoint finished, log reused
15:49:05 Checkpoint started
15:49:05 Checkpoint finished, log reused
15:49:05 Checkpoint started
15:49:05 Checkpoint finished, log reused
15:49:05 Checkpoint started
15:49:05 Checkpoint finished, log reused
15:49:05 PL LOG: Installing Virtuoso Conductor version 1.00.8759 (DAV)
15:49:05 PL LOG: Installing with dependencies Virtuoso Conductor version 1.00.8759/2016-11-08 15:53 (DAV)
15:49:05 Checkpoint started
15:49:05 Checkpoint finished, log reused
15:49:07 Checkpoint started
15:49:07 Checkpoint finished, log reused
15:49:07 PL LOG: Installation with dependencies complete
15:49:07 Default charset UTF-8 not defined. Reverting to ISO-8859-1
15:49:07 Checkpoint started
15:49:07 Checkpoint finished, log reused
15:49:07 SSL server online at 2111
15:49:07 HTTP/WebDAV server online at 80
15:49:07 Server online at 1111 (pid 352)
15:49:13 EXEC_1 0 127.0.0.1 1111:2 s1111_2_0 Exec 1 time(s) CREATE TRIGGER before_insert BEFORE INSERT ON DB.DBA.RDF_QUAD REFERENCING NEW AS QUAD { declare quadInstances integer; select count (*) into quadInstances from DB.DBA.RDF_QUAD WHERE __i2id ('urn:g') = G; dbg_printf('before insert count of <urn:g> : %d', quadInstances); }
15:49:13 EXEC_1 0 127.0.0.1 1111:3 s1111_3_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:13 EXEC_1 0 127.0.0.1 1111:4 s1111_4_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o0>}}
before insert count of <urn:g> : 0
15:49:13 EXEC_1 0 127.0.0.1 1111:5 s1111_5_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:13 EXEC_1 0 127.0.0.1 1111:6 s1111_6_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o1>}}
before insert count of <urn:g> : 0
15:49:13 EXEC_1 0 127.0.0.1 1111:7 s1111_7_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:13 EXEC_1 0 127.0.0.1 1111:8 s1111_8_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o2>}}
before insert count of <urn:g> : 0
15:49:13 EXEC_1 0 127.0.0.1 1111:9 s1111_9_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:13 EXEC_1 0 127.0.0.1 1111:10 s1111_10_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o3>}}
before insert count of <urn:g> : 0
15:49:13 EXEC_1 0 127.0.0.1 1111:11 s1111_11_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:13 EXEC_1 0 127.0.0.1 1111:12 s1111_12_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o4>}}
before insert count of <urn:g> : 0
15:49:13 EXEC_1 0 127.0.0.1 1111:13 s1111_13_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:13 EXEC_1 0 127.0.0.1 1111:14 s1111_14_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o5>}}
before insert count of <urn:g> : 0
15:49:13 EXEC_1 0 127.0.0.1 1111:15 s1111_15_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:13 EXEC_1 0 127.0.0.1 1111:16 s1111_16_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o6>}}
before insert count of <urn:g> : 0
15:49:13 EXEC_1 0 127.0.0.1 1111:17 s1111_17_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:13 EXEC_1 0 127.0.0.1 1111:18 s1111_18_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o7>}}
before insert count of <urn:g> : 0
15:49:14 EXEC_1 0 127.0.0.1 1111:19 s1111_19_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:14 EXEC_1 0 127.0.0.1 1111:20 s1111_20_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o8>}}
before insert count of <urn:g> : 0
15:49:14 EXEC_1 0 127.0.0.1 1111:21 s1111_21_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:14 EXEC_1 0 127.0.0.1 1111:22 s1111_22_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o9>}}
before insert count of <urn:g> : 0
15:49:14 EXEC_1 0 127.0.0.1 1111:23 s1111_23_0 Exec 1 time(s) SHUTDOWN
15:49:14 Checkpoint started
15:49:14 Checkpoint finished, log reused
15:49:14 Server shutdown complete

Logfile (steps 5-6):

$ cat test-afterRestart.log

        Mon Nov 21 2016
15:49:19 OpenLink Virtuoso Universal Server
15:49:19 Version 07.20.3217-pthreads for Linux as of Nov  8 2016
15:49:19 uses parts of OpenSSL, PCRE, Html Tidy
15:49:19 Database version 3126
15:49:19 SQL Optimizer enabled (max 1000 layouts)
15:49:20 Compiler unit is timed at 0.000129 msec
15:49:20 Roll forward started
15:49:20 Roll forward complete
before insert count of <urn:g> : 1
before insert count of <urn:g> : 1
before insert count of <urn:g> : 1
15:49:21 Default charset UTF-8 not defined. Reverting to ISO-8859-1
15:49:21 Checkpoint started
15:49:21 Checkpoint finished, log reused
15:49:21 SSL server online at 2111
15:49:21 HTTP/WebDAV server online at 80
15:49:21 Server online at 1111 (pid 497)
15:49:29 EXEC_1 0 127.0.0.1 1111:3 s1111_3_0 Exec 1 time(s) CREATE TRIGGER before_insert BEFORE INSERT ON DB.DBA.RDF_QUAD REFERENCING NEW AS QUAD { declare quadInstances integer; select count (*) into quadInstances from DB.DBA.RDF_QUAD WHERE __i2id ('urn:g') = G; dbg_printf('before insert count of <urn:g> : %d', quadInstances); }
15:49:29 EXEC_1 0 127.0.0.1 1111:4 s1111_4_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:29 EXEC_1 0 127.0.0.1 1111:5 s1111_5_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o0>}}
before insert count of <urn:g> : 1
15:49:29 EXEC_1 0 127.0.0.1 1111:6 s1111_6_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:29 EXEC_1 0 127.0.0.1 1111:7 s1111_7_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o1>}}
before insert count of <urn:g> : 1
15:49:29 EXEC_1 0 127.0.0.1 1111:8 s1111_8_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:29 EXEC_1 0 127.0.0.1 1111:9 s1111_9_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o2>}}
before insert count of <urn:g> : 1
15:49:29 EXEC_1 0 127.0.0.1 1111:10 s1111_10_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:29 EXEC_1 0 127.0.0.1 1111:11 s1111_11_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o3>}}
before insert count of <urn:g> : 1
15:49:29 EXEC_1 0 127.0.0.1 1111:12 s1111_12_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:29 EXEC_1 0 127.0.0.1 1111:13 s1111_13_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o4>}}
before insert count of <urn:g> : 1
15:49:29 EXEC_1 0 127.0.0.1 1111:14 s1111_14_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:29 EXEC_1 0 127.0.0.1 1111:15 s1111_15_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o5>}}
before insert count of <urn:g> : 1
15:49:29 EXEC_1 0 127.0.0.1 1111:16 s1111_16_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:29 EXEC_1 0 127.0.0.1 1111:17 s1111_17_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o6>}}
before insert count of <urn:g> : 1
15:49:30 EXEC_1 0 127.0.0.1 1111:18 s1111_18_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:30 EXEC_1 0 127.0.0.1 1111:19 s1111_19_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o7>}}
before insert count of <urn:g> : 1
15:49:30 EXEC_1 0 127.0.0.1 1111:20 s1111_20_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:30 EXEC_1 0 127.0.0.1 1111:21 s1111_21_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o8>}}
before insert count of <urn:g> : 1
15:49:30 EXEC_1 0 127.0.0.1 1111:22 s1111_22_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
15:49:30 EXEC_1 0 127.0.0.1 1111:23 s1111_23_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o9>}}
before insert count of <urn:g> : 1

Case 3: docker container (with volume mounting)

Same setup as in case 2, but the directory were the database files are created is a mounted directory.

Logfile (steps 1-4):

$ cat test-preRestart.log

        Mon Nov 21 2016
16:32:11 OpenLink Virtuoso Universal Server
16:32:11 Version 07.20.3217-pthreads for Linux as of Nov  8 2016
16:32:11 uses parts of OpenSSL, PCRE, Html Tidy
16:32:11 Database version 3126
16:32:11 SQL Optimizer enabled (max 1000 layouts)
16:32:12 Compiler unit is timed at 0.000135 msec
16:32:12 Roll forward started
16:32:12 Roll forward complete
16:32:12 Default charset UTF-8 not defined. Reverting to ISO-8859-1
16:32:12 Checkpoint started
16:32:12 Checkpoint finished, log reused
16:32:12 SSL server online at 2111
16:32:12 HTTP/WebDAV server online at 80
16:32:13 Server online at 1111 (pid 360)
16:32:21 EXEC_1 0 127.0.0.1 1111:2 s1111_2_0 Exec 1 time(s) CREATE TRIGGER before_insert BEFORE INSERT ON DB.DBA.RDF_QUAD REFERENCING NEW AS QUAD { declare quadInstances integer; select count (*) into quadInstances from DB.DBA.RDF_QUAD WHERE __i2id ('urn:g') = G; dbg_printf('before insert count of <urn:g> : %d', quadInstances); }
16:32:21 EXEC_1 0 127.0.0.1 1111:3 s1111_3_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:21 EXEC_1 0 127.0.0.1 1111:4 s1111_4_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o0>}}
before insert count of <urn:g> : 1
16:32:21 EXEC_1 0 127.0.0.1 1111:5 s1111_5_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:21 EXEC_1 0 127.0.0.1 1111:6 s1111_6_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o1>}}
before insert count of <urn:g> : 1
16:32:21 EXEC_1 0 127.0.0.1 1111:7 s1111_7_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:21 EXEC_1 0 127.0.0.1 1111:8 s1111_8_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o2>}}
before insert count of <urn:g> : 1
16:32:21 EXEC_1 0 127.0.0.1 1111:9 s1111_9_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:21 EXEC_1 0 127.0.0.1 1111:10 s1111_10_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o3>}}
before insert count of <urn:g> : 1
16:32:21 EXEC_1 0 127.0.0.1 1111:11 s1111_11_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:21 EXEC_1 0 127.0.0.1 1111:12 s1111_12_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o4>}}
before insert count of <urn:g> : 1
16:32:21 EXEC_1 0 127.0.0.1 1111:13 s1111_13_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:21 EXEC_1 0 127.0.0.1 1111:14 s1111_14_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o5>}}
before insert count of <urn:g> : 1
16:32:21 EXEC_1 0 127.0.0.1 1111:15 s1111_15_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:21 EXEC_1 0 127.0.0.1 1111:16 s1111_16_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o6>}}
before insert count of <urn:g> : 1
16:32:21 EXEC_1 0 127.0.0.1 1111:17 s1111_17_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:21 EXEC_1 0 127.0.0.1 1111:18 s1111_18_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o7>}}
before insert count of <urn:g> : 1
16:32:21 EXEC_1 0 127.0.0.1 1111:19 s1111_19_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:21 EXEC_1 0 127.0.0.1 1111:20 s1111_20_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o8>}}
before insert count of <urn:g> : 1
16:32:22 EXEC_1 0 127.0.0.1 1111:21 s1111_21_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:22 EXEC_1 0 127.0.0.1 1111:22 s1111_22_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o9>}}
before insert count of <urn:g> : 1
16:32:22 EXEC_1 0 127.0.0.1 1111:23 s1111_23_0 Exec 1 time(s) SHUTDOWN
16:32:22 Checkpoint started
16:32:22 Checkpoint finished, log reused
16:32:22 Server shutdown complete

Logfile (steps 5-6):

cat test-afterRestart.log

        Mon Nov 21 2016
16:32:27 OpenLink Virtuoso Universal Server
16:32:27 Version 07.20.3217-pthreads for Linux as of Nov  8 2016
16:32:27 uses parts of OpenSSL, PCRE, Html Tidy
16:32:27 Database version 3126
16:32:27 SQL Optimizer enabled (max 1000 layouts)
16:32:28 Compiler unit is timed at 0.000130 msec
16:32:29 Roll forward started
16:32:29 Roll forward complete
before insert count of <urn:g> : 1
before insert count of <urn:g> : 1
before insert count of <urn:g> : 1
16:32:29 Default charset UTF-8 not defined. Reverting to ISO-8859-1
16:32:29 Checkpoint started
16:32:29 Checkpoint finished, log reused
16:32:29 SSL server online at 2111
16:32:29 HTTP/WebDAV server online at 80
16:32:29 Server online at 1111 (pid 504)
16:32:37 EXEC_1 0 127.0.0.1 1111:3 s1111_3_0 Exec 1 time(s) CREATE TRIGGER before_insert BEFORE INSERT ON DB.DBA.RDF_QUAD REFERENCING NEW AS QUAD { declare quadInstances integer; select count (*) into quadInstances from DB.DBA.RDF_QUAD WHERE __i2id ('urn:g') = G; dbg_printf('before insert count of <urn:g> : %d', quadInstances); }
16:32:37 EXEC_1 0 127.0.0.1 1111:4 s1111_4_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:37 EXEC_1 0 127.0.0.1 1111:5 s1111_5_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o0>}}
before insert count of <urn:g> : 1
16:32:37 EXEC_1 0 127.0.0.1 1111:6 s1111_6_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:37 EXEC_1 0 127.0.0.1 1111:7 s1111_7_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o1>}}
before insert count of <urn:g> : 1
16:32:37 EXEC_1 0 127.0.0.1 1111:8 s1111_8_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:37 EXEC_1 0 127.0.0.1 1111:9 s1111_9_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o2>}}
before insert count of <urn:g> : 1
16:32:37 EXEC_1 0 127.0.0.1 1111:10 s1111_10_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:37 EXEC_1 0 127.0.0.1 1111:11 s1111_11_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o3>}}
before insert count of <urn:g> : 1
16:32:37 EXEC_1 0 127.0.0.1 1111:12 s1111_12_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:37 EXEC_1 0 127.0.0.1 1111:13 s1111_13_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o4>}}
before insert count of <urn:g> : 1
16:32:37 EXEC_1 0 127.0.0.1 1111:14 s1111_14_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:37 EXEC_1 0 127.0.0.1 1111:15 s1111_15_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o5>}}
before insert count of <urn:g> : 1
16:32:37 EXEC_1 0 127.0.0.1 1111:16 s1111_16_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:37 EXEC_1 0 127.0.0.1 1111:17 s1111_17_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o6>}}
before insert count of <urn:g> : 1
16:32:38 EXEC_1 0 127.0.0.1 1111:18 s1111_18_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:38 EXEC_1 0 127.0.0.1 1111:19 s1111_19_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o7>}}
before insert count of <urn:g> : 1
16:32:38 EXEC_1 0 127.0.0.1 1111:20 s1111_20_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:38 EXEC_1 0 127.0.0.1 1111:21 s1111_21_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o8>}}
before insert count of <urn:g> : 1
16:32:38 EXEC_1 0 127.0.0.1 1111:22 s1111_22_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
16:32:38 EXEC_1 0 127.0.0.1 1111:23 s1111_23_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o9>}}
before insert count of <urn:g> : 1

test.sh

#!/bin/bash

# set -e
# set -o pipefail

ISQL=isql
PORT=1111
VIRTUOSO_BINARY=virtuoso-t
# VIRTUOSO_BINARY=/opt/virtuoso-opensource/bin/virtuoso-t
INIFILE=$PWD/virtuoso.ini

function cleanup() {
  $ISQL localhost:$PORT dba dba exec="DROP TRIGGER before_insert; SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o};" > /dev/null
  echo "cleanup successful"
}

function prepareTrigger() {
  echo "Preparing trigger..."
  $ISQL localhost:$PORT dba dba exec="trace_on('exec');" > /dev/null
  $ISQL localhost:$PORT dba dba exec="CREATE TRIGGER before_insert BEFORE INSERT ON DB.DBA.RDF_QUAD REFERENCING NEW AS QUAD { declare quadInstances integer; select count (*) into quadInstances from DB.DBA.RDF_QUAD WHERE __i2id ('urn:g') = G; dbg_printf('before insert count of <urn:g> : %%d', quadInstances); };" > /dev/null
  # $ISQL localhost:$PORT dba dba exec="CREATE TRIGGER before_insert BEFORE INSERT ON DB.DBA.RDF_QUAD REFERENCING NEW AS QUAD { declare quadInstances integer; select * from DB.DBA.RDF_QUAD WHERE __i2id ('urn:g') = G; };" > /dev/null
}

function runInserts() {
  echo "Running inserts..."
  COUNTER=0
  while [  $COUNTER -lt 10 ]; do
     $ISQL localhost:$PORT dba dba exec="SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o};" > /dev/null
     $ISQL localhost:$PORT dba dba exec="SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o${COUNTER}>}};" > /dev/null
     let COUNTER=COUNTER+1
     sleep 0.1s
     # isql localhost:$PORT dba dba exec="SPARQL SELECT count(*) FROM <urn:g> WHERE {?s ?p ?o};"
  done
  echo "Inserts finished"
}

function shutdownVirtuoso() {
  echo "Shuting server down..."
  $ISQL localhost:$PORT dba dba exec="SHUTDOWN;" > /dev/null
  sleep 5
  echo "Shutdown successful"
}

function startVirtuoso() {
  echo "Starting server..."
  $VIRTUOSO_BINARY +configfile $INIFILE -f &> test.log &
  sleep 10
  echo "Startup successful"
}

###

# 1- start server
mkdir data
startVirtuoso

# 2- prepare
prepareTrigger

# 3- run 
runInserts

# 4- shutdown
shutdownVirtuoso
cp test.log test-preRestart.log

# 5- restart
startVirtuoso
cleanup

# 6- repeat 2-4
prepareTrigger
runInserts
shutdownVirtuoso
cp test.log test-afterRestart.log
rm -rf data

virtuoso.ini

;
;  virtuoso.ini
;
;  Configuration file for the OpenLink Virtuoso VDBMS Server
;
;  To learn more about this product, or any other product in our
;  portfolio, please check out our web site at:
;
;      http://www.openlinksw.com
;
;  or contact us at:
;
;      general.information@openlinksw.com
;
;  If you have any technical questions, please contact our support
;  staff at:
;
;      technical.support@openlinksw.com
;

;
;  Database setup
;
[Database]
DatabaseFile      = ./data/virtuoso.db
ErrorLogFile      = ./data/virtuoso.log
LockFile          = ./data/virtuoso.lck
ErrorLogLevel      = 7
;Syslog      = 1
;crashdump_start_dp = 0
;crashdump_end_dp = 0
xa_persistent_file    = ./data/virtuoso.pxa

TransactionFile      = ./data/virtuoso.trx
FileExtend      = 200
MaxCheckpointRemap    = 2000
;LogSegments    = 0
;Log1   = <name>
;Log2   = <name>
;...
Striping      = 0

[TempDatabase]
DatabaseFile      = ./data/virtuoso.tdb
TransactionFile      = ./data/virtuoso.ttr
;FileExtend      = 100
MaxCheckpointRemap       = 2000
;LogSegments    = 0
;Log1   = <name>
;Log2   = <name>
;...
;Striping        = 0

;
;  Server parameters
;
[Parameters]
O_DIRECT      = 0
ServerPort      = 1111
LiteMode      = 0
DisableUnixSocket    = 1
DisableTcpSocket    = 0
;SSLServerPort      = 2111
;SSLCertificate      = ./data/cert/cert.pem
;SSLPrivateKey      = ./data/cert/private-key.pem
;X509ClientVerify    = 0
;X509ClientVerifyDepth    = 0
;X509ClientVerifyCAFile    = ca.pem
ServerThreads      = 20
CheckpointInterval    = 60
;UnremapQuota    = 0
CaseMode      = 2
;UseDaylightSaving  = 1
;NullUnspecifiedParams  = 0
MaxStaticCursorRows    = 5000
;PrefixResultNames   = 1
;DisableMtWrite    = 0
;MinAutoCheckpointSize  = 2048
;AutoCheckpointLogSize  = 0
CheckpointAuditTrail    = 0
;CheckpointSyncMode     = 2
AllowOSCalls      = 0
SchedulerInterval    = 10
;TraceOn     = errors
;TraceLogFileLine  = 0
DirsAllowed      = ., /opt/virtuoso-opensource/share/virtuoso/vad, ./data, /tmp
;DirsDenied         = /usr/local/virtuoso/samples, /usr/local/virtuoso/tests/suite
;BackupDirs    = <dir_here>
;SafeExecutables  = 0
DbaExecutables           = dbpump
;TempDir     = <dir_here>
;TempSesDir    = <dir_here>
;DefaltDataLanguage  = <lang_here>
;ServerThreadSize = 50000
;MainThreadSize   = 140000
;FutureThreadSize = 140000
ThreadCleanupInterval    = 0
ThreadThreshold      = 10
ResourcesCleanupInterval  = 0
;Collation    = <collation-here : ex. spanish>
Charset    = UTF-8
FreeTextBatchSize    = 100000
;CallstackOnException = 1
;PLDebug     = 1
;TestCoverage   = <cov_file>
;AddViewColRefsQualifier = 0
;AllowPasswordEncryption = 1
;DecryptionAccess = <user_list>
;TransactionAfterImageLimit = 50000000
;FDsPerFile   = 1
;MaxOptimizeLayouts = 1000
;SkipStartupCompilation = 1
;TempAllocationPct  = 30
;JavaClasspath    = <cp>
;BackupDir1   = <bd1>
;BackupDir2   = <bd2>
;...
SingleCPU      = 0
;RecursiveFreeTextUsage  = 1
;RecursiveTriggerCalls   = 1
;MaxSortedTopRows  = 10000
;MaxDistinctTempMemCacheRows = 100000
;RunAs      = <os_user_name>
;AutoSqlStats   = 0
;MinSignalHandling   = 1
;SqlWarningMode    = 1
;SqlWarningsToSyslog   = 0
;TempDBSize    = 10
;DbevEnable    = 1
;X509ExtensionOID  = <oid>

VADInstallDir      = /opt/virtuoso-opensource/share/virtuoso/vad/
PrefixResultNames               = 0
RdfFreeTextRulesSize    = 100
IndexTreeMaps      = 256
MaxMemPoolSize                  = 200000000
;;
;; When running with large data sets, one should configure the Virtuoso
;; process to use between 2/3 to 3/5 of free system memory and to stripe
;; storage on all available disks.
;;
;; Uncomment next two lines if there is 2 GB system memory free
;NumberOfBuffers          = 170000
;MaxDirtyBuffers          = 130000
;; Uncomment next two lines if there is 4 GB system memory free
;NumberOfBuffers          = 340000
; MaxDirtyBuffers          = 250000
;; Uncomment next two lines if there is 8 GB system memory free
;NumberOfBuffers          = 680000
;MaxDirtyBuffers          = 500000
;; Uncomment next two lines if there is 16 GB system memory free
;NumberOfBuffers          = 1360000
;MaxDirtyBuffers          = 1000000
;; Uncomment next two lines if there is 32 GB system memory free
;NumberOfBuffers          = 2720000
;MaxDirtyBuffers          = 2000000
;; Uncomment next two lines if there is 48 GB system memory free
;NumberOfBuffers          = 4000000
;MaxDirtyBuffers          = 3000000
;; Uncomment next two lines if there is 64 GB system memory free
;NumberOfBuffers          = 5450000
;MaxDirtyBuffers          = 4000000
;;
;; Note the default settings will take very little memory
;; but will not result in very good performance
;;
NumberOfBuffers          = 10000
MaxDirtyBuffers          = 6000

TransactionAfterImageLimit = 2107483640
;TransactionAfterImageLimit = 9223372036854775807

[HTTPServer]
ServerPort      = 1112
;HTTPLogFile    = log.out
ServerRoot      = /opt/virtuoso-opensource/var/lib/virtuoso/vsp
;ServerIdString    = virtuoso
;ClientIdString    = Mozilla/4.0 (compatible; Virtuoso)
;SOAPClientIdString  = Openlink Virtuoso SOAP
DavRoot        = DAV
EnabledDavVSP      = 0
HTTPProxyEnabled    = 0
;EnabledGzipContent     = 0
;HttpSessionSize  = 20971520
TempASPXDir      = 0
DefaultMailServer    = localhost:25
Charset       = UTF-8
;POP3Port     = 1234
;NewsServerPort   = 1235
;FTPServerPort    = 21
;FTPServerTimeout       = 600
;SSLPort    = 4433
;SSLCertificate   = ./virtuoso_cert.pem
;SSLPrivateKey    = ./virtuoso_key.pem
;X509ClientVerify = 0
;X509ClientVerifyDepth  = 0
;X509ClientVerifyCAFile = ca.pem
ServerThreads      = 100
MaxKeepAlives      = 10
KeepAliveTimeout    = 10
MaxCachedProxyConnections  = 10
ProxyConnectionCacheTimeout  = 15
HTTPThreadSize      = 140000
;PersistentHostingModules    = 0
;EnableRequestTrap  = 0
HttpPrintWarningsInOutput  = 0
;DAVChunkedQuota  = 1000000
;DAVQuotaEnabled  = 0

;SpamFilter   = 1
;FTPServerAnonymousHome = /DAV/
;FTPServerMinFreePort = 20000
;FTPServerMaxFreePort = 30000
;FTPServerAnonymousLogin = 1 
;FTPServerLogFile = ftplog
;NNTPOrganizationHeader = <org>
;NNTPFromHeader   = <from>

[AutoRepair]
BadParentLinks      = 0

[Client]
SQL_PREFETCH_ROWS    = 100
SQL_PREFETCH_BYTES    = 16000
SQL_QUERY_TIMEOUT    = 0
SQL_TXN_TIMEOUT      = 0
;SQL_NO_CHAR_C_ESCAPE    = 1
;; ACTIVATING THE FOLLOWING PROPERTY LEADS TO UTF8-FAIL! DO NOT TOUCH!
;SQL_UTF8_EXECS      = 0
;SQL_NO_SYSTEM_TABLES    = 0
;SQL_BINARY_TIMESTAMP    = 1
;SQL_ENCRYPTION_ON_PASSWORD  = -1

[VDB]
ArrayOptimization    = 0
NumArrayParameters    = 10
VDBDisconnectTimeout    = 1000
;VDBOracleCatalogFix  = 1
;AttachInAutoCommit = 1
;ReconnectOnFailure = 0
KeepConnectionOnFixedThread = 0
;PrpcBurstTimeoutMsecs  = 100
;SerializeConnect = 1
;DisableStmtCache = 0
;SQLStateMap    = <errors_file>
;SkipDMLPrimaryKey  = 0
;RemotePKNotUnique  = 0
;UseGlobalPool    = 0

;DuplicateColumnsCheck  = 0

[Replication]
ServerName      = docker.local
ServerEnable      = 1
QueueMax      = 50000

;
;  Striping setup
;
;  These parameters have only effect when Striping is set to 1 in the
;  [Database] section, in which case the DatabaseFile parameter is ignored.
;
;  With striping, the database is spawned across multiple segments
;  where each segment can have multiple stripes.
;
;  Format of the lines below:
;    Segment<number> = <size>, <stripe file name> [, <stripe file name> .. ]
;
;  <number> must be ordered from 1 up.
;
;  The <size> is the total size of the segment which is equally divided
;  across all stripes forming  the segment. Its specification can be in
;  gigabytes (g), megabytes (m), kilobytes (k) or in database blocks
;  (b, the default)
;
;  Note that the segment size must be a multiple of the database page size
;  which is currently 8k. Also, the segment size must be divisible by the
;  number of stripe files forming  the segment.
;
;  The example below creates a 200 meg database striped on two segments
;  with two stripes of 50 meg and one of 100 meg.
;
;  You can always add more segments to the configuration, but once
;  added, do not change the setup.
;
[Striping]
;GrouthRatio  = 20
Segment1      = 100M, db-seg1-1.db, db-seg1-2.db
Segment2      = 100M, db-seg2-1.db
;...

;[TempStriping]
;GrouthRatio  = 20
;Segment1      = 100M, db-seg1-1.db, db-seg1-2.db
;Segment2      = 100M, db-seg2-1.db
;...

;[Ucms]
;UcmPath      = <path>
;Ucm1        = <file>
;Ucm2        = <file>
;...

[Zero Config]
ServerName      = virtuoso (docker)
;ServerDSN      = ZDSN
;SSLServerName      = 
;SSLServerDSN      = 

[Mono]
;MONO_TRACE      = Off
;MONO_PATH      = <path_here>
;MONO_ROOT      = <path_here>
;MONO_CFG_DIR      = <path_here>
;virtclr.dll      =

[URIQA]
;DynamicLocal      = 0
DefaultHost      = localhost:80
;LocalHostNames = 
;LocalHostMasks = 
;Fingerprint = 

[SPARQL]
;ExternalQuerySource    = 1
;ExternalXsltSource     = 1
;DefaultGraph          = http://URIQAREPLACEME/dataspace
;ImmutableGraphs        = http://URIQAREPLACEME/dataspace
ResultSetMaxRows             = 0
MaxQueryCostEstimationTime   = 900  ; in seconds
MaxQueryExecutionTime        = 300  ; in seconds
DeferInferenceRulesInit      = 0  ; controls inference rules loading
;PingService           = http://rpc.pingthesemanticweb.com/
DefaultQuery                = SELECT * WHERE {?s ?p ?o} LIMIT 1000

[Plugins]
;LoadPath      = /opt/virtuoso-opensource/lib/virtuoso/hosting
;PERLINISAFEREPLACEMELoad1=Hosting,hosting_perl.so
;PYTHONINISAFEREPLACEMELoad2=Hosting,hosting_python.so
;RUBYINISAFEREPLACEMELoad4=Hosting,hosting_python.so
;Load1        = plain, wikiv
;Load2        = plain, mediawiki
;Load3        = plain, creolewiki
;Load4      = plain, im
;Load5    = plain, wbxml2
;Load6      = plain, hslookup
;Load7        = attach, libphp5.so
;Load8      = Hosting, hosting_php.so
;Load9      = Hosting,hosting_perl.so
;Load10    = Hosting,hosting_python.so
;Load11    = Hosting,hosting_ruby.so
;Load12        = msdtc,msdtc_sample

[Flags]
; enables triggers for the quad table (note by Hugh Williams 2015/07/24)
enable_rdf_trig = 1
rnavarropiris commented 7 years ago

case 2 was reproduced on an Ubuntu 14.04 server (without docker). Setup:

export VIRTUOSO_VERSION="v7.2.4.2"
export CFLAGS="-O2 -m64"

apt-get update && \
apt-get -y install dpkg-dev build-essential git && \
apt-get -y install autoconf automake libtool flex bison gperf && \
apt-get -y install gawk m4 make openssl libssl-dev libreadline-dev && \
apt-get clean && \
# Install virtuoso
git clone --recursive https://github.com/openlink/virtuoso-opensource.git /opt/virtuoso-opensource.src && \
cd /opt/virtuoso-opensource.src && \
git checkout ${VIRTUOSO_VERSION} && \
./autogen.sh && \
CFLAGS="-O2 -m64" && \
export CFLAGS && \
./configure --prefix=/opt/virtuoso-opensource --with-readline && \
make -j 8 && \
make install && \
ln -s /opt/virtuoso-opensource/bin/isql /usr/bin/isql && \
rm -rf /opt/virtuoso-opensource.src && \
mkdir -p /data
chown vagrant:vagrant data
cp /vagrant/virtuoso.ini /data/virtuoso.ini

**Steps 1-4:

vagrant@vagrant-ubuntu-trusty-64:/data$ ./test.sh
Starting server...

        Wed Nov 23 2016
11:00:14 OpenLink Virtuoso Universal Server
11:00:14 Version 07.20.3217-pthreads for Linux as of Nov 23 2016
11:00:14 uses parts of OpenSSL, PCRE, Html Tidy
11:00:14 SQL Optimizer enabled (max 1000 layouts)
11:00:14 Compiler unit is timed at 0.000376 msec
11:00:16 Checkpoint started
11:00:16 Roll forward started
11:00:16 Roll forward complete
11:00:16 Checkpoint started
11:00:16 Checkpoint finished, log reused
11:00:16 Checkpoint started
11:00:16 Checkpoint finished, log reused
11:00:17 Checkpoint started
11:00:17 Checkpoint finished, log reused
11:00:17 Checkpoint started
11:00:17 Checkpoint finished, log reused
11:00:17 Checkpoint started
11:00:17 Checkpoint finished, log reused
11:00:17 PL LOG: Installing Virtuoso Conductor version 1.00.8759 (DAV)
11:00:17 PL LOG: Installing with dependencies Virtuoso Conductor version 1.00.8759/2016-11-23 08:10 (DAV)
11:00:17 Checkpoint started
11:00:17 Checkpoint finished, log reused
11:00:19 Checkpoint started
11:00:19 Checkpoint finished, log reused
11:00:19 PL LOG: Installation with dependencies complete
11:00:19 Default charset UTF-8 not defined. Reverting to ISO-8859-1
11:00:19 Checkpoint started
11:00:19 Checkpoint finished, log reused
11:00:19 SSL server online at 2111
11:00:19 HTTP/WebDAV server online at 8890
11:00:19 Server online at 1111 (pid 5602)
Startup successful
Preparing trigger...
11:00:24 EXEC_1 0 127.0.0.1 1111:2 s1111_2_0 Exec 1 time(s) CREATE TRIGGER before_insert BEFORE INSERT ON DB.DBA.RDF_QUAD REFERENCING NEW AS QUAD { declare quadInstances integer; select count (*) into quadInstances from DB.DBA.RDF_QUAD WHERE __i2id ('urn:g') = G; dbg_printf('before insert count of <urn:g> : %d', quadInstances); }
Running inserts...
11:00:24 EXEC_1 0 127.0.0.1 1111:3 s1111_3_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:24 EXEC_1 0 127.0.0.1 1111:4 s1111_4_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o0>}}
before insert count of <urn:g> : 0
11:00:24 EXEC_1 0 127.0.0.1 1111:5 s1111_5_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:24 EXEC_1 0 127.0.0.1 1111:6 s1111_6_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o1>}}
before insert count of <urn:g> : 0
11:00:24 EXEC_1 0 127.0.0.1 1111:7 s1111_7_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:24 EXEC_1 0 127.0.0.1 1111:8 s1111_8_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o2>}}
before insert count of <urn:g> : 0
11:00:24 EXEC_1 0 127.0.0.1 1111:9 s1111_9_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:24 EXEC_1 0 127.0.0.1 1111:10 s1111_10_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o3>}}
before insert count of <urn:g> : 0
11:00:25 EXEC_1 0 127.0.0.1 1111:11 s1111_11_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:25 EXEC_1 0 127.0.0.1 1111:12 s1111_12_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o4>}}
before insert count of <urn:g> : 0
11:00:25 EXEC_1 0 127.0.0.1 1111:13 s1111_13_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:25 EXEC_1 0 127.0.0.1 1111:14 s1111_14_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o5>}}
before insert count of <urn:g> : 0
11:00:25 EXEC_1 0 127.0.0.1 1111:15 s1111_15_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:25 EXEC_1 0 127.0.0.1 1111:16 s1111_16_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o6>}}
before insert count of <urn:g> : 0
11:00:25 EXEC_1 0 127.0.0.1 1111:17 s1111_17_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:25 EXEC_1 0 127.0.0.1 1111:18 s1111_18_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o7>}}
before insert count of <urn:g> : 0
11:00:25 EXEC_1 0 127.0.0.1 1111:19 s1111_19_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:25 EXEC_1 0 127.0.0.1 1111:20 s1111_20_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o8>}}
before insert count of <urn:g> : 0
11:00:25 EXEC_1 0 127.0.0.1 1111:21 s1111_21_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:25 EXEC_1 0 127.0.0.1 1111:22 s1111_22_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o9>}}
before insert count of <urn:g> : 0
Inserts finished
Shuting server down...
11:00:25 EXEC_1 0 127.0.0.1 1111:23 s1111_23_0 Exec 1 time(s) SHUTDOWN
11:00:25 Checkpoint started
11:00:25 Checkpoint finished, log reused
11:00:25 Server shutdown complete
Shutdown successful

**Steps 4-6

Starting server...

        Wed Nov 23 2016
11:00:30 OpenLink Virtuoso Universal Server
11:00:30 Version 07.20.3217-pthreads for Linux as of Nov 23 2016
11:00:30 uses parts of OpenSSL, PCRE, Html Tidy
11:00:30 Database version 3126
11:00:30 SQL Optimizer enabled (max 1000 layouts)
11:00:31 Compiler unit is timed at 0.000143 msec
11:00:32 Roll forward started
11:00:32 Roll forward complete
before insert count of <urn:g> : 1
before insert count of <urn:g> : 1
before insert count of <urn:g> : 1
11:00:32 Default charset UTF-8 not defined. Reverting to ISO-8859-1
11:00:32 Checkpoint started
11:00:32 Checkpoint finished, log reused
11:00:32 SSL server online at 2111
11:00:32 HTTP/WebDAV server online at 8890
11:00:32 Server online at 1111 (pid 5865)
Startup successful
cleanup successful
Preparing trigger...
11:00:40 EXEC_1 0 127.0.0.1 1111:3 s1111_3_0 Exec 1 time(s) CREATE TRIGGER before_insert BEFORE INSERT ON DB.DBA.RDF_QUAD REFERENCING NEW AS QUAD { declare quadInstances integer; select count (*) into quadInstances from DB.DBA.RDF_QUAD WHERE __i2id ('urn:g') = G; dbg_printf('before insert count of <urn:g> : %d', quadInstances); }
Running inserts...
11:00:40 EXEC_1 0 127.0.0.1 1111:4 s1111_4_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:40 EXEC_1 0 127.0.0.1 1111:5 s1111_5_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o0>}}
before insert count of <urn:g> : 1
11:00:40 EXEC_1 0 127.0.0.1 1111:6 s1111_6_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:40 EXEC_1 0 127.0.0.1 1111:7 s1111_7_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o1>}}
before insert count of <urn:g> : 1
11:00:41 EXEC_1 0 127.0.0.1 1111:8 s1111_8_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:41 EXEC_1 0 127.0.0.1 1111:9 s1111_9_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o2>}}
before insert count of <urn:g> : 1
11:00:41 EXEC_1 0 127.0.0.1 1111:10 s1111_10_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:41 EXEC_1 0 127.0.0.1 1111:11 s1111_11_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o3>}}
before insert count of <urn:g> : 1
11:00:41 EXEC_1 0 127.0.0.1 1111:12 s1111_12_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:41 EXEC_1 0 127.0.0.1 1111:13 s1111_13_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o4>}}
before insert count of <urn:g> : 1
11:00:41 EXEC_1 0 127.0.0.1 1111:14 s1111_14_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:41 EXEC_1 0 127.0.0.1 1111:15 s1111_15_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o5>}}
before insert count of <urn:g> : 1
11:00:41 EXEC_1 0 127.0.0.1 1111:16 s1111_16_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:41 EXEC_1 0 127.0.0.1 1111:17 s1111_17_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o6>}}
before insert count of <urn:g> : 1
11:00:41 EXEC_1 0 127.0.0.1 1111:18 s1111_18_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:41 EXEC_1 0 127.0.0.1 1111:19 s1111_19_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o7>}}
before insert count of <urn:g> : 1
11:00:41 EXEC_1 0 127.0.0.1 1111:20 s1111_20_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:41 EXEC_1 0 127.0.0.1 1111:21 s1111_21_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o8>}}
before insert count of <urn:g> : 1
11:00:41 EXEC_1 0 127.0.0.1 1111:22 s1111_22_0 Exec 1 time(s) SPARQL WITH <urn:g> DELETE {?s ?p ?o} WHERE {?s ?p ?o}
11:00:41 EXEC_1 0 127.0.0.1 1111:23 s1111_23_0 Exec 1 time(s) SPARQL INSERT DATA { GRAPH <urn:g> {<urn:s> <urn:p> <urn:o9>}}
before insert count of <urn:g> : 1
Inserts finished
Shuting server down...
11:00:41 EXEC_1 0 127.0.0.1 1111:24 s1111_24_0 Exec 1 time(s) SHUTDOWN
11:00:41 Checkpoint started
11:00:41 Checkpoint finished, log reused
11:00:41 Server shutdown complete
Shutdown successful 
HughWilliams commented 7 years ago

Rene logged a support case for this issue where it is being looked into ...