Clearing/Reducing ArtifactHit and ArtifactHitBin records

Are there any side effects of clearing ArtifactHit and ArtifactHitBin?

They are about 85% of the data on a client install (or at least, when excluding them from the entity snapshot, the resultant zip file is reduced by about that).

1 Like

Just following up, there don’t seem to be any repercussions, and depending on your traffic, particularly if you use find as you type kind of drop-downs, omitting ArtifactHit and ArtifactHitBin from the snapshot exports greatly reduce the size.

And, also, FWIW, if it helps anyone, we create snapshots from client machines and then locally do:

Client Machine:

  1. Tools > Data Snapshots > Export Snapshot
  2. Exclude ArtifactHit and ArtifactHitBin
  3. Create

Local Machine

  1. gradle cleanDb
  2. java -server -Djava.awt.headless=true -XX:-OmitStackTraceInFastThrow -XX:+UseG1GC -Xmx16384m -jar moqui.war load raw location=~/Downloads/SnapshotFilename.zip
  3. Start Moqui
  4. Tools > Data Snapshots > Create FKs
  5. After it has finished, Stop Moqui
  6. Backup the restored image: ./backupH2.sh SomeNickname

Where backupH2.sh is:

#!/usr/bin/env bash

if [ -z "$MOQUI_HOME" ]; then
  MOQUI_HOME=~/src/moqui
fi

backup_root=~/src/MoquiBackup/MoquiH2Backup
rm -rf ${backup_root}/backup$1
mkdir -p ${backup_root}/backup$1/db
cp -R $MOQUI_HOME/runtime/db/derby ${backup_root}/backup$1/db
cp -R $MOQUI_HOME/runtime/db/h2 ${backup_root}/backup$1/db
cp -R $MOQUI_HOME/runtime/db/orientdb ${backup_root}/backup$1/db
cp -R $MOQUI_HOME/runtime/elasticsearch ${backup_root}/backup$1
  1. If we want to restore the image, ./restoreH2.sh SomeNickname

Where restoreH2.sh is:

#!/usr/bin/env bash

if [ -z "$MOQUI_HOME" ]; then
  MOQUI_HOME=~/src/moqui
fi

backup_root=~/src/MoquiBackup/MoquiH2Backup
gradle cleanDb
cp -R ${backup_root}/backup$1/db/derby ${MOQUI_HOME}/runtime/db/
cp -R ${backup_root}/backup$1/db/h2 ${MOQUI_HOME}/runtime/db/
cp -R ${backup_root}/backup$1/db/orientdb ${MOQUI_HOME}/runtime/db/
cp -R ${backup_root}/backup$1/elasticsearch ${MOQUI_HOME}/runtime/

It makes testing and retesting on client machine data much easier.

1 Like