This repository contains supplementary material for capturing lock data from IBM Db2 and training models to predict a sequence of locks. For more information, refer to the preprint.
-
Create a Python 3.11 virtual environment: See
0_prep.sh.python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txtNote: For the narval system, see
requirements_narval.txt. -
Download and extract the data to the
data/directory.
- The data archive can be downloaded here.
.vscode/: Holds debug configuration file specific to VS Code.github/workflows: Contains GitHub Actions workflows for continuous integration and automationanalysis/: Directory for results analysis R scripts and notebooksdata/: Stores all downloaded and extracted data for the projectexperiments/: Experiment runner scripts for different configurations (includes SLURM integration)logs/: Stores experiment log filesplay_scripts/: Contains utility data and modelling exploration notebooksresults/: Directory to store experiment resultssrc/: Contains the main source codetrain.py: Main script for training modelsdatapipeline.py: Data loading and preprocessingmodel.py: Model architectures (Transformer and LSTM)evaluate.py: Evaluation metrics and result reportingutils.py: Utility functionstests/: Unit tests
workload-testing/Directory includes the HammerDB scripts to start TPC-C workloads
All file names referenced in this subsection are relative to the workload-testing/ directory.
- Enable the DB2 trace using the command in
traceCommands.txt. - Start TPC-C HammerDB workloads by using
hammerDBinit.bat,hammerDBStep1.bat, andhammerDBStep2.bat. - Stop the DB2 trace using the command in
traceCommands.txt. - Start trace preprocessing by running
db2trc flw -t. - Extract the row and table locks using
lookup_locknames.py.
Several experiment scripts are provided in the experiments/ directory. To run an experiment:
bash experiments/exp-2.sh
For SLURM-based systems, the same script can be run using the SLURM command:
sbatch experiments/exp-2.sh
Note: Most experiment scripts are interopable with SLURM and normal bash execution.
After running experiments, use the extract and transform scripts to process the results. See the scripts for more details:
bash 2_extract.sh
bash 3_transform.sh
Run unit tests using pytest command:
pytest
If you use or study the code, please cite it as follows.
@article{rakha2025lockprediction,
title={Lock Prediction for Zero-Downtime Database Encryption},
author={Mohamed Sami Rakha and Adam Sorrenti and Greg Stager and Walid Rjaibi and Andriy Miranskyy},
journal={arXiv preprint arXiv:2506.23985},
year={2025},
doi={10.48550/arXiv.2506.23985}
}