tenforce/docker-virtuoso

Strange section values when converting environment variables to ini file

parmentf opened this issue · 3 comments

I'm not sure whether the section values deduced from environment variables are good.

Executing step by step what seems to be happening the first time in virtuoso.sh yields section values such as [NumberOfBuffers=170000]...

root@0cb539dde5e9:/usr/local/virtuoso-opensource/var/lib/virtuoso/db# printenv | grep -P "^VIRT_"
VIRT_NumberOfBuffers=170000
VIRT_MaxDirtyBuffers=130000
root@0cb539dde5e9:/usr/local/virtuoso-opensource/var/lib/virtuoso/db# setting="VIRT_NumberOfBuffers=170000"
root@0cb539dde5e9:/usr/local/virtuoso-opensource/var/lib/virtuoso/db# echo $setting 
VIRT_NumberOfBuffers=170000
root@0cb539dde5e9:/usr/local/virtuoso-opensource/var/lib/virtuoso/db# section=$(echo "$setting" | grep -o -P "^VIRT_[^_]+" | sed 's/^.\{5\}//g')
root@0cb539dde5e9:/usr/local/virtuoso-opensource/var/lib/virtuoso/db# echo $section 
NumberOfBuffers=170000
root@0cb539dde5e9:/usr/local/virtuoso-opensource/var/lib/virtuoso/db# key=$(echo "$setting" | grep -o -P "_[^_]+=" | sed 's/[_=]//g')
root@0cb539dde5e9:/usr/local/virtuoso-opensource/var/lib/virtuoso/db# echo $key
NumberOfBuffers
root@0cb539dde5e9:/usr/local/virtuoso-opensource/var/lib/virtuoso/db# value=$(echo "$setting" | grep -o -P "=.*$" | sed 's/^=//g')
root@0cb539dde5e9:/usr/local/virtuoso-opensource/var/lib/virtuoso/db# echo $value
170000
root@0cb539dde5e9:/usr/local/virtuoso-opensource/var/lib/virtuoso/db# echo "Registering $section[$key] to be $value"
Registering NumberOfBuffers=170000[NumberOfBuffers] to be 170000
root@0cb539dde5e9:/usr/local/virtuoso-opensource/var/lib/virtuoso/db# crudini --set virtuoso.ini "$section" "$key" "$value"
root@0cb539dde5e9:/usr/local/virtuoso-opensource/var/lib/virtuoso/db# grep NumberOfBuffers virtuoso.ini 
;NumberOfBuffers          = 170000
;NumberOfBuffers          = 340000
;NumberOfBuffers          = 680000
;NumberOfBuffers          = 1360000
;NumberOfBuffers          = 2720000
;NumberOfBuffers          = 4000000
;NumberOfBuffers          = 5450000
NumberOfBuffers          = 10000
[NumberOfBuffers=170000]
NumberOfBuffers = 170000

Sorry, when I use:

root@0cb539dde5e9:/usr/local/virtuoso-opensource/var/lib/virtuoso/db# crudini --get virtuoso.ini NumberOfBuffers=170000 NumberOfBuffers
170000

it seems to work.

I still have to check if Conductor / System Admin / Parameters / Parameters display the correct changed value.

Having tested executing the initialization code, the new value of NumberOfBuffers is not displayed within the Parameters section, thus I wonder if it is taken into account...

Ooops. I did not read the README well enough. I forgot to add the section in the variable name. Sorry.