Commit d3a8b876 authored by Stanley Clark's avatar Stanley Clark
Browse files

Fixed IBM and SAQP

parent 6b434820
......@@ -30,6 +30,9 @@ docker-compose run builder mvn package
cp experiments/.env.example experiments/.env
cp pg-cuckoo/PgCuckoo/config-blank.ini pg-cuckoo/PgCuckoo/config.ini
# Setup Haskell Stack dependencies for the first time
docker-compose run optimiser /bin/sh -c "cd /home/pg-cuckoo/PgCuckoo && stack install --allow-different-user"
# We are now able to run the compiled files using a dedicated java container:
docker-compose run optimiser
```
......
......@@ -37,8 +37,8 @@ Connect via JDBC using username `sys as sysdba`.
-e DBNAME=testdb \
-v DB2Data:/database \
ibmcom/db2
docker run -itd --name DB2 --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=password -e DBNAME=testdb -v DB2Data:/database ibmcom/db2
```
* Run `ibm/populate.sh`
* Run `ibm/run.sh`
#!/usr/bin/env sh
# Generate explain tables
docker exec -ti DB2 bash -c "su - db2inst1 db2 \"connect to testdb\" && cd sqllib/misc && db2 -tf EXPLAIN.DDL"
# Connect to DB2
db2 catalog tcpip node docker remote 0.0.0.0 server 50000
db2 catalog database testdb as testdb at node docker
docker exec -it DB2 useradd -m db2sec -g db2iadm1 -p "$(openssl passwd -crypt passwd1)"
db2 CONNECT TO testdb user db2inst1 using password
db2 grant secadm on database to user db2sec
db2 CONNECT TO testdb user db2sec using passwd1
db2 grant secadm on database to user db2inst1
......@@ -20,14 +21,16 @@ do
db2 grant dataaccess on database to user "user$i"
done
# Create TPC-DS schema, users and policies
db2 -t -f sql/clean.sql
# Create TPC-DS schema and users
db2 -t -f sql/employee.sql
db2 -t -f sql/policies.sql
db2 -t -f ../../tpc-ds/tools/tpcds.sql
# Import generated data to postgres instance
for tableScript in ../../tpc-ds/tools/*.dat
do
db2 IMPORT FROM "$tableScript" OF DEL MODIFIED BY COLDEL\| INSERT INTO "$(basename "$tableScript" .dat)";
db2 TRUNCATE "$(basename "$tableScript" .dat)" IMMEDIATE;
db2 LOAD CLIENT FROM "$(realpath "$tableScript")" OF DEL MODIFIED BY COLDEL\| INSERT INTO "$(basename "$tableScript" .dat)" NONRECOVERABLE;
done
# Import and activate policies
db2 -t -f sql/policies.sql
drop table if exists dbgen_version;
drop table if exists customer_address;
drop table if exists customer_demographics;
drop table if exists date_dim;
drop table if exists warehouse;
drop table if exists ship_mode;
drop table if exists time_dim;
drop table if exists reason;
drop table if exists income_band;
drop table if exists item;
drop table if exists store;
drop table if exists call_center;
drop table if exists customer;
drop table if exists web_site;
drop table if exists store_returns;
drop table if exists household_demographics;
drop table if exists web_page;
drop table if exists promotion;
drop table if exists catalog_page;
drop table if exists inventory;
drop table if exists catalog_returns;
drop table if exists web_returns;
drop table if exists web_sales;
drop table if exists catalog_sales;
drop table if exists store_sales;
drop table if exists employee;
\ No newline at end of file
......@@ -156,7 +156,7 @@ ENFORCED FOR ALL ACCESS ENABLE;
ALTER TABLE dbgen_version ACTIVATE ROW ACCESS CONTROL;
CREATE OR REPLACE PERMISSION employee_ROW_ACCESS ON employee FOR ROWS WHERE
SYSTEM_USER = 'DB2INST1' OR true
SYSTEM_USER = 'DB2INST1' OR false
ENFORCED FOR ALL ACCESS ENABLE;
ALTER TABLE employee ACTIVATE ROW ACCESS CONTROL;
......
......@@ -31,6 +31,7 @@ services:
context: .
dockerfile: experiments/Dockerfile
volumes:
- ./pg-cuckoo/PgCuckoo/config.ini:/home/app/pg-cuckoo/PgCuckoo/config.ini
- ./experiments:/home/app
- ./queries:/home/queries
volumes:
......
......@@ -15,11 +15,15 @@ RUN curl -O https://download.java.net/java/GA/jdk14.0.1/664493ef4a6946b186ff29eb
&& ln -s /opt/jdk-14.0.1/bin/java /usr/bin/java
# First time setup of stack
COPY pg-cuckoo/PgCuckoo /home/pg-cuckoo/PgCuckoo
COPY pg-cuckoo/PgCuckoo/app /home/pg-cuckoo/PgCuckoo/app/
COPY pg-cuckoo/PgCuckoo/src /home/pg-cuckoo/PgCuckoo/src/
COPY pg-cuckoo/PgCuckoo/test /home/pg-cuckoo/PgCuckoo/test
COPY pg-cuckoo/PgCuckoo/Makefile pg-cuckoo/PgCuckoo/package.yaml pg-cuckoo/PgCuckoo/Setup.hs pg-cuckoo/PgCuckoo/stack.yaml /home/pg-cuckoo/PgCuckoo/
RUN cd /home/pg-cuckoo/PgCuckoo && stack install --allow-different-user || true
# Link Z3 dependencies for SMT XACML policy translator
RUN ln -s /home/app/libz3.so /usr/lib/libz3.so && ln -s /home/app/libz3java.so /usr/lib/libz3java.so
WORKDIR /home/app/
COPY pg-cuckoo/PgCuckoo/config.ini /home/pg-cuckoo/PgCuckoo
CMD java -Duser.dir="/home/app" -jar /home/app/target/SAQP-1.0.0.jar
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment