should be it
This commit is contained in:
44
external/duckdb/test/sql/storage/encryption/temp_files/encrypt_asof_join_merge.test_slow
vendored
Normal file
44
external/duckdb/test/sql/storage/encryption/temp_files/encrypt_asof_join_merge.test_slow
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
# name: test/sql/storage/encryption/temp_files/encrypt_asof_join_merge.test_slow
|
||||
# description: Test merge queue and repartitioning with encrypted temporary files
|
||||
# group: [temp_files]
|
||||
|
||||
foreach cipher GCM CTR
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/encrypted_temp_files_${cipher}.db' AS enc (ENCRYPTION_KEY 'asdf', ENCRYPTION_CIPHER '${cipher}');
|
||||
|
||||
statement ok
|
||||
SET temp_file_encryption=true;
|
||||
|
||||
statement ok
|
||||
USE enc;
|
||||
|
||||
statement ok
|
||||
PRAGMA memory_limit='400M'
|
||||
|
||||
statement ok
|
||||
PRAGMA threads=4
|
||||
|
||||
statement ok
|
||||
SET temp_directory='__TEST_DIR__/temp.tmp'
|
||||
|
||||
# Force PhysicalAsOfJoin
|
||||
statement ok
|
||||
PRAGMA asof_loop_join_threshold = 0;
|
||||
|
||||
query II
|
||||
WITH build AS (
|
||||
SELECT k, ('2021-01-01'::TIMESTAMP + INTERVAL (i) SECOND) AS t, i % 37 AS v
|
||||
FROM range(3000000) t(i), range(2) tk(k)
|
||||
), probe AS (
|
||||
SELECT k, t
|
||||
FROM range(2) tk(k),
|
||||
range('2021-01-01 00:00:30'::TIMESTAMP, '2021-02-01 00:00:30'::TIMESTAMP, INTERVAL 1 HOUR) tt(t)
|
||||
) SELECT SUM(v) AS v, COUNT(*) AS n
|
||||
FROM probe ASOF JOIN build USING(k, t)
|
||||
----
|
||||
26790 1488
|
||||
|
||||
restart
|
||||
|
||||
endloop
|
||||
@@ -0,0 +1,43 @@
|
||||
# name: test/sql/storage/encryption/temp_files/encrypted_offloading_block_files.test_slow
|
||||
# group: [temp_files]
|
||||
|
||||
foreach cipher GCM CTR
|
||||
|
||||
|
||||
require block_size 262144
|
||||
|
||||
load __TEST_DIR__/offloading_block_files.db
|
||||
|
||||
# ATTACH DB
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/encrypted.db' as enc (ENCRYPTION_KEY 'asdf', ENCRYPTION_CIPHER '${cipher}');
|
||||
|
||||
statement ok
|
||||
SET temp_file_encryption=true;
|
||||
|
||||
statement ok
|
||||
USE enc;
|
||||
|
||||
# 500M row table.
|
||||
statement ok
|
||||
CREATE TABLE tbl AS FROM
|
||||
range(100) t1(i)
|
||||
CROSS JOIN range(100) t2(j)
|
||||
CROSS JOIN range(100) t3(k)
|
||||
CROSS JOIN range(100) t4(l)
|
||||
CROSS JOIN range(5) t5(m)
|
||||
SELECT row_number() OVER () AS i, random() AS random_value;
|
||||
|
||||
statement ok
|
||||
SET max_temp_directory_size = '1GB';
|
||||
|
||||
statement ok
|
||||
SET memory_limit = '1GB';
|
||||
|
||||
statement error
|
||||
SELECT * FROM tbl ORDER BY random_value;
|
||||
----
|
||||
|
||||
restart
|
||||
|
||||
endloop
|
||||
52
external/duckdb/test/sql/storage/encryption/temp_files/encrypted_tmp_file_setting.test
vendored
Normal file
52
external/duckdb/test/sql/storage/encryption/temp_files/encrypted_tmp_file_setting.test
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
# name: test/sql/storage/encryption/temp_files/encrypted_tmp_file_setting.test
|
||||
# group: [temp_files]
|
||||
|
||||
foreach cipher GCM CTR
|
||||
|
||||
require block_size 262144
|
||||
|
||||
statement ok
|
||||
SET temp_directory='__TEST_DIR__/test_temp_dir'
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/encrypted_temp_files.db' AS enc (ENCRYPTION_KEY 'asdf');
|
||||
|
||||
statement ok
|
||||
USE enc;
|
||||
|
||||
# we do not encrypt temporary files at all
|
||||
statement ok
|
||||
SET temp_file_encryption = false;
|
||||
|
||||
statement ok
|
||||
SET memory_limit = '8MB';
|
||||
|
||||
statement ok
|
||||
SET enable_external_access=false
|
||||
|
||||
statement error
|
||||
SET temp_directory='__TEST_DIR__/new_temp_dir'
|
||||
----
|
||||
disabled by configuration
|
||||
|
||||
statement error
|
||||
RESET temp_directory
|
||||
----
|
||||
disabled by configuration
|
||||
|
||||
# temp files are not encrypted
|
||||
statement ok
|
||||
CREATE TEMPORARY TABLE tbl AS FROM range(10_000_000)
|
||||
|
||||
# note; you should be very careful using this
|
||||
# If some tmp files are encrypted and others not
|
||||
# this will lead to corrupt files
|
||||
# therefore, this is disabled
|
||||
statement error
|
||||
SET temp_file_encryption = true;
|
||||
----
|
||||
Permission Error: Existing temporary files found: Modifying the temp_file_encryption setting while there are existing temporary files is disabled.
|
||||
|
||||
restart
|
||||
|
||||
endloop
|
||||
35
external/duckdb/test/sql/storage/encryption/temp_files/encrypted_tpch_join.test_slow
vendored
Normal file
35
external/duckdb/test/sql/storage/encryption/temp_files/encrypted_tpch_join.test_slow
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# name: test/sql/storage/encryption/temp_files/encrypted_tpch_join.test_slow
|
||||
# group: [temp_files]
|
||||
|
||||
foreach cipher GCM CTR
|
||||
|
||||
require tpch
|
||||
|
||||
statement ok
|
||||
SET threads = 8;
|
||||
|
||||
statement ok
|
||||
SET memory_limit = '1GB';
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/tpch_enc_${cipher}.db' as enc (ENCRYPTION_KEY 'asdf', ENCRYPTION_CIPHER '${cipher}');
|
||||
|
||||
statement ok
|
||||
USE enc;
|
||||
|
||||
statement ok
|
||||
CALL dbgen (sf = 1) ;
|
||||
|
||||
statement ok
|
||||
ALTER TABLE lineitem RENAME TO lineitem1;
|
||||
|
||||
statement ok
|
||||
CREATE TABLE lineitem2 AS FROM lineitem1;
|
||||
|
||||
statement ok
|
||||
CREATE OR REPLACE TABLE ans as select l1.* , l2.* from lineitem1 l1
|
||||
JOIN lineitem2 l2 USING (l_orderkey , l_linenumber);
|
||||
|
||||
restart
|
||||
|
||||
endloop
|
||||
@@ -0,0 +1,41 @@
|
||||
# name: test/sql/storage/encryption/temp_files/temp_directory_enable_external_access.test
|
||||
# group: [temp_files]
|
||||
|
||||
foreach cipher GCM CTR
|
||||
|
||||
|
||||
require block_size 262144
|
||||
|
||||
statement ok
|
||||
SET temp_directory='__TEST_DIR__/test_temp_dir'
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/encrypted_temp_files_${cipher}.db' AS enc (ENCRYPTION_KEY 'asdf', ENCRYPTION_CIPHER '${cipher}');
|
||||
|
||||
statement ok
|
||||
USE enc;
|
||||
|
||||
statement ok
|
||||
SET memory_limit = '8MB';
|
||||
|
||||
statement ok
|
||||
SET enable_external_access=false
|
||||
|
||||
# cannot modify the temp directory when enable_external_access is set
|
||||
statement error
|
||||
SET temp_directory='__TEST_DIR__/new_temp_dir'
|
||||
----
|
||||
disabled by configuration
|
||||
|
||||
statement error
|
||||
RESET temp_directory
|
||||
----
|
||||
disabled by configuration
|
||||
|
||||
# 10M row table with 8B rows -> 80MB uncompressed - this requires the temp directory
|
||||
statement ok
|
||||
CREATE TEMPORARY TABLE tbl AS FROM range(10_000_000)
|
||||
|
||||
restart
|
||||
|
||||
endloop
|
||||
47
external/duckdb/test/sql/storage/encryption/wal/encrypted_wal_blob_storage.test
vendored
Normal file
47
external/duckdb/test/sql/storage/encryption/wal/encrypted_wal_blob_storage.test
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# name: test/sql/storage/encryption/wal/encrypted_wal_blob_storage.test
|
||||
# description: Test BLOB with persistent storage with an encrypted WAL
|
||||
# group: [wal]
|
||||
|
||||
foreach cipher GCM CTR
|
||||
|
||||
|
||||
load __TEST_DIR__/any_file.db
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_checkpoint_on_shutdown
|
||||
|
||||
statement ok
|
||||
PRAGMA wal_autocheckpoint='1TB';
|
||||
|
||||
# # load the DB from disk
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/encrypted_blob_storage_${cipher}.db' AS enc (ENCRYPTION_KEY 'asdf', ENCRYPTION_CIPHER '${cipher}');
|
||||
|
||||
# create a table with hugeints
|
||||
statement ok
|
||||
CREATE TABLE enc.blobs (b BLOB);
|
||||
|
||||
statement ok
|
||||
INSERT INTO enc.blobs VALUES('a'), ('\xAA'), ('\xAA\xFF\xAA'), (''), (NULL), ('\x55\xAA\xFF\x55\xAA\xFF\x55\xAA\xFF\x01'), ('\x55\xAA\xFF\x55\xAA\xFF\x55\xAA\xFF\x01')
|
||||
|
||||
statement ok
|
||||
DETACH enc
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/encrypted_blob_storage_${cipher}.db' AS enc (ENCRYPTION_KEY 'asdf');
|
||||
|
||||
query I
|
||||
SELECT * FROM enc.blobs
|
||||
----
|
||||
a
|
||||
\xAA
|
||||
\xAA\xFF\xAA
|
||||
(empty)
|
||||
NULL
|
||||
U\xAA\xFFU\xAA\xFFU\xAA\xFF\x01
|
||||
U\xAA\xFFU\xAA\xFFU\xAA\xFF\x01
|
||||
|
||||
restart
|
||||
|
||||
endloop
|
||||
|
||||
45
external/duckdb/test/sql/storage/encryption/wal/encrypted_wal_lazy_creation.test
vendored
Normal file
45
external/duckdb/test/sql/storage/encryption/wal/encrypted_wal_lazy_creation.test
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# name: test/sql/storage/encryption/wal/encrypted_wal_lazy_creation.test
|
||||
# description: Verify the Encrypted WAL is lazily created when attaching
|
||||
# group: [wal]
|
||||
|
||||
# If we enable alternative verification, then we disable checkpointing on shutdown.
|
||||
# Thus, we'll keep the WAL alive when detaching the database.
|
||||
|
||||
foreach cipher GCM CTR
|
||||
|
||||
require no_alternative_verify
|
||||
|
||||
require noforcestorage
|
||||
|
||||
require skip_reload
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/attach_no_wal_${cipher}.db' AS attach_no_wal (ENCRYPTION_KEY 'asdf', ENCRYPTION_CIPHER '${cipher}');
|
||||
|
||||
statement ok
|
||||
CREATE TABLE attach_no_wal.integers(i INTEGER);
|
||||
|
||||
statement ok
|
||||
INSERT INTO attach_no_wal.integers FROM range(10000);
|
||||
|
||||
statement ok
|
||||
DETACH attach_no_wal;
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/attach_no_wal_${cipher}.db' AS attach_no_wal (ENCRYPTION_KEY 'asdf');
|
||||
|
||||
# Verify that we don't have a WAL after attaching.
|
||||
query I
|
||||
SELECT COUNT(*) FROM glob('__TEST_DIR__/attach_no_wal_${cipher}.db.wal');
|
||||
----
|
||||
0
|
||||
|
||||
# Verify that we checkpointed the WAL.
|
||||
query I
|
||||
SELECT COUNT(*) FROM attach_no_wal.integers;
|
||||
----
|
||||
10000
|
||||
|
||||
restart
|
||||
|
||||
endloop
|
||||
133
external/duckdb/test/sql/storage/encryption/wal/encrypted_wal_pragmas.test
vendored
Normal file
133
external/duckdb/test/sql/storage/encryption/wal/encrypted_wal_pragmas.test
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
# name: test/sql/storage/encryption/wal/encrypted_wal_pragmas.test
|
||||
# description: test encrypted wal debug PRAGMAS
|
||||
# group: [wal]
|
||||
|
||||
foreach cipher GCM CTR
|
||||
|
||||
|
||||
load __TEST_DIR__/any_wal_db.db
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/encrypted_wal_restart_${cipher}.db' as enc (ENCRYPTION_KEY 'asdf', ENCRYPTION_CIPHER '${cipher}');
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_checkpoint_on_shutdown
|
||||
|
||||
statement ok
|
||||
PRAGMA wal_autocheckpoint='1TB';
|
||||
|
||||
# create a table and add a column to it
|
||||
statement ok
|
||||
CREATE TABLE enc.test (a INTEGER, b INTEGER);
|
||||
|
||||
statement ok
|
||||
INSERT INTO enc.test VALUES (11, 22), (13, 22), (12, 21)
|
||||
|
||||
statement ok
|
||||
ALTER TABLE enc.test ALTER b TYPE VARCHAR
|
||||
|
||||
query IT
|
||||
SELECT * FROM enc.test ORDER BY 1
|
||||
----
|
||||
11 22
|
||||
12 21
|
||||
13 22
|
||||
|
||||
statement ok
|
||||
INSERT INTO enc.test VALUES (10, 'hello')
|
||||
|
||||
statement ok
|
||||
DETACH enc
|
||||
|
||||
# WAL replay succeeds
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/encrypted_wal_restart_${cipher}.db' as enc (ENCRYPTION_KEY 'asdf');
|
||||
|
||||
statement ok
|
||||
DETACH enc
|
||||
|
||||
# now set debug pragma at the start
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/encrypted_wal_restart_new_${cipher}.db' as enc (ENCRYPTION_KEY 'asdf', ENCRYPTION_CIPHER '${cipher}');
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_checkpoint_on_shutdown
|
||||
|
||||
statement ok
|
||||
PRAGMA wal_autocheckpoint='1TB';
|
||||
|
||||
statement ok
|
||||
CREATE TABLE enc.test (a INTEGER, b INTEGER);
|
||||
|
||||
statement ok
|
||||
INSERT INTO enc.test VALUES (11, 22), (13, 22), (12, 21)
|
||||
|
||||
statement ok
|
||||
ALTER TABLE enc.test ALTER b TYPE VARCHAR
|
||||
|
||||
query IT
|
||||
SELECT * FROM enc.test ORDER BY 1
|
||||
----
|
||||
11 22
|
||||
12 21
|
||||
13 22
|
||||
|
||||
restart
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/encrypted_wal_restart_new_${cipher}.db' as enc (ENCRYPTION_KEY 'asdf');
|
||||
|
||||
query IT
|
||||
SELECT * FROM enc.test ORDER BY 1
|
||||
----
|
||||
11 22
|
||||
12 21
|
||||
13 22
|
||||
|
||||
restart
|
||||
|
||||
# now disable, but then directly enable
|
||||
# this should work
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/encrypted_wal_disable_enable_${cipher}.db' as enc (ENCRYPTION_KEY 'asdf', ENCRYPTION_CIPHER '${cipher}');
|
||||
|
||||
statement ok
|
||||
PRAGMA wal_autocheckpoint='1TB';
|
||||
|
||||
statement ok
|
||||
CREATE TABLE enc.test (a INTEGER, b INTEGER);
|
||||
|
||||
statement ok
|
||||
INSERT INTO enc.test VALUES (11, 22), (13, 22), (12, 21)
|
||||
|
||||
statement ok
|
||||
ALTER TABLE enc.test ALTER b TYPE VARCHAR
|
||||
|
||||
query IT
|
||||
SELECT * FROM enc.test ORDER BY 1
|
||||
----
|
||||
11 22
|
||||
12 21
|
||||
13 22
|
||||
|
||||
statement ok
|
||||
INSERT INTO enc.test VALUES (10, 'hello')
|
||||
|
||||
restart
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/encrypted_wal_disable_enable_${cipher}.db' as enc (ENCRYPTION_KEY 'asdf', ENCRYPTION_CIPHER '${cipher}');
|
||||
|
||||
query IT
|
||||
SELECT * FROM enc.test ORDER BY 1
|
||||
----
|
||||
10 hello
|
||||
11 22
|
||||
12 21
|
||||
13 22
|
||||
|
||||
|
||||
restart
|
||||
|
||||
endloop
|
||||
76
external/duckdb/test/sql/storage/encryption/wal/encrypted_wal_restart.test
vendored
Normal file
76
external/duckdb/test/sql/storage/encryption/wal/encrypted_wal_restart.test
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
# name: test/sql/storage/encryption/wal/encrypted_wal_restart.test
|
||||
# description: test wal restart
|
||||
# group: [wal]
|
||||
|
||||
foreach cipher GCM CTR
|
||||
|
||||
load __TEST_DIR__/any_wal_db.db
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/encrypted_wal_restart_${cipher}.db' as enc (ENCRYPTION_KEY 'asdf', ENCRYPTION_CIPHER '${cipher}');
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_checkpoint_on_shutdown
|
||||
|
||||
statement ok
|
||||
PRAGMA wal_autocheckpoint='1TB';
|
||||
|
||||
# create a table and add a column to it
|
||||
statement ok
|
||||
CREATE TABLE enc.test (a INTEGER, b INTEGER);
|
||||
|
||||
statement ok
|
||||
INSERT INTO enc.test VALUES (11, 22), (13, 22), (12, 21)
|
||||
|
||||
restart
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/encrypted_wal_restart_${cipher}.db' as enc (ENCRYPTION_KEY 'asdf', ENCRYPTION_CIPHER '${cipher}');
|
||||
|
||||
statement ok
|
||||
PRAGMA disable_checkpoint_on_shutdown
|
||||
|
||||
statement ok
|
||||
PRAGMA wal_autocheckpoint='1TB';
|
||||
|
||||
statement ok
|
||||
ALTER TABLE enc.test ALTER b TYPE VARCHAR
|
||||
|
||||
query IT
|
||||
SELECT * FROM enc.test ORDER BY 1
|
||||
----
|
||||
11 22
|
||||
12 21
|
||||
13 22
|
||||
|
||||
statement ok
|
||||
INSERT INTO enc.test VALUES (10, 'hello')
|
||||
|
||||
query IT
|
||||
SELECT * FROM enc.test ORDER BY 1
|
||||
----
|
||||
10 hello
|
||||
11 22
|
||||
12 21
|
||||
13 22
|
||||
|
||||
restart
|
||||
|
||||
# statement error
|
||||
# ATTACH '__TEST_DIR__/encrypted_wal_restart_${cipher}.db' as enc (ENCRYPTION_KEY 'xxxx', ENCRYPTION_CIPHER '${cipher}');
|
||||
# ----
|
||||
|
||||
statement ok
|
||||
ATTACH '__TEST_DIR__/encrypted_wal_restart_${cipher}.db' as enc (ENCRYPTION_KEY 'asdf', ENCRYPTION_CIPHER '${cipher}');
|
||||
|
||||
query IT
|
||||
SELECT * FROM enc.test ORDER BY 1
|
||||
----
|
||||
10 hello
|
||||
11 22
|
||||
12 21
|
||||
13 22
|
||||
|
||||
endloop
|
||||
|
||||
restart
|
||||
Reference in New Issue
Block a user