1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| #!/bin/bash
DBA_USER="dba" DBA_PASSWORD="dba" LOG_FILE="bulk_load.log" CORES=$(nproc) LOADERS=$((CORES / 4)) ISQL_PATH="/vltd/triplestore/meta/meta_virtuoso/virtuoso-opensource/bin/isql"
DATA_DIR="/vltd/triplestore/meta/meta_virtuoso/virtuoso_input" FILE_PATTERN="*.nq" GRAPH_URI="https://w3id.org/oc/meta/"
launch_loader() { $ISQL_PATH 127.0.0.1:1111 $DBA_USER $DBA_PASSWORD exec="rdf_loader_run(log_enable=>2);" >> $LOG_FILE 2>&1 & }
echo "Inizio caricamento bulk RDF: $(date)" > $LOG_FILE
echo "Disabilitazione dell'indicizzazione: $(date)" >> $LOG_FILE $ISQL_PATH 127.0.0.1:1111 $DBA_USER $DBA_PASSWORD exec="DB.DBA.VT_BATCH_UPDATE ('DB.DBA.RDF_OBJ', 'ON', NULL);" >> $LOG_FILE 2>&1
echo "Cancellazione della lista: $(date)" >> $LOG_FILE $ISQL_PATH 127.0.0.1:1111 $DBA_USER $DBA_PASSWORD exec="delete from DB.DBA.load_list;" >> $LOG_FILE 2>&1
echo "Caricamento dei dati: $(date)" >> $LOG_FILE $ISQL_PATH 127.0.0.1:1111 $DBA_USER $DBA_PASSWORD exec="ld_dir('$DATA_DIR', '$FILE_PATTERN', '$GRAPH_URI');" >> $LOG_FILE 2>&1 $ISQL_PATH 127.0.0.1:1111 $DBA_USER $DBA_PASSWORD exec="set isolation='uncommitted';" >> $LOG_FILE 2>&1
for ((i=1; i<=LOADERS; i++)) do echo "Lancio loader $i: $(date)" >> $LOG_FILE launch_loader done
wait
echo "Esecuzione checkpoint: $(date)" >> $LOG_FILE $ISQL_PATH 127.0.0.1:1111 $DBA_USER $DBA_PASSWORD exec="checkpoint;" >> $LOG_FILE 2>&1 $ISQL_PATH 127.0.0.1:1111 $DBA_USER $DBA_PASSWORD exec="commit WORK;" >> $LOG_FILE 2>&1 $ISQL_PATH 127.0.0.1:1111 $DBA_USER $DBA_PASSWORD exec="checkpoint;" >> $LOG_FILE 2>&1
echo "Riabilitazione dell'indicizzazione: $(date)" >> $LOG_FILE $ISQL_PATH 127.0.0.1:1111 $DBA_USER $DBA_PASSWORD exec="DB.DBA.RDF_OBJ_FT_RULE_ADD (null, null, 'All');" >> $LOG_FILE 2>&1 $ISQL_PATH 127.0.0.1:1111 $DBA_USER $DBA_PASSWORD exec="DB.DBA.VT_INC_INDEX_DB_DBA_RDF_OBJ ();" >> $LOG_FILE 2>&1
$ISQL_PATH 127.0.0.1:1111 $DBA_USER $DBA_PASSWORD exec="checkpoint_interval(N);" >> $LOG_FILE 2>&1 $ISQL_PATH 127.0.0.1:1111 $DBA_USER $DBA_PASSWORD exec="scheduler_interval(M);" >> $LOG_FILE 2>&1
echo "Caricamento bulk RDF completato: $(date)" >> $LOG_FILE
|