Skip to content

Commit 753347c

Browse files
committed
tests: replace update_lag with now()+X in 02530_dictionaries_update_field
1 parent 6d6c0e8 commit 753347c

File tree

4 files changed

+16
-39
lines changed

4 files changed

+16
-39
lines changed

tests/queries/0_stateless/02530_dictionaries_update_field.lib

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,27 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
88
function run_test_with_layout()
99
{
1010
local layout=$1
11+
12+
# NOTE: dictionaries will be updated according to server TZ, not session, so prohibit it's randomization
13+
$CLICKHOUSE_CLIENT --session_timezone '' -q "
14+
CREATE TABLE table_for_update_field_dictionary
15+
(
16+
key UInt64,
17+
value String,
18+
last_insert_time DateTime
19+
)
20+
ENGINE = TinyLog
21+
"
22+
1123
for custom_query in "" "custom"; do
1224
if [[ $custom_query == custom ]]; then
1325
dictionary_name="dict_${layout}_custom"
14-
dictionary_source="query \$doc\$SELECT key, value, last_insert_time FROM $CLICKHOUSE_DATABASE.table_for_update_field_dictionary WHERE {condition};\$doc\$ update_field 'last_insert_time' update_lag 30"
26+
dictionary_source="query \$doc\$SELECT key, value, last_insert_time FROM $CLICKHOUSE_DATABASE.table_for_update_field_dictionary WHERE {condition};\$doc\$ update_field 'last_insert_time' update_lag 0"
1527

1628
echo "$layout/custom"
1729
else
1830
dictionary_name="dict_${layout}"
19-
dictionary_source="table 'table_for_update_field_dictionary' update_field 'last_insert_time' update_lag 30"
31+
dictionary_source="table 'table_for_update_field_dictionary' update_field 'last_insert_time' update_lag 0"
2032

2133
echo "$layout"
2234
fi
@@ -43,15 +55,15 @@ function run_test_with_layout()
4355
sleep .1;
4456
done
4557

46-
$CLICKHOUSE_CLIENT --query "INSERT INTO table_for_update_field_dictionary VALUES (2, 'Second', now());"
58+
$CLICKHOUSE_CLIENT --query "INSERT INTO table_for_update_field_dictionary VALUES (2, 'Second', now()+5);"
4759

4860
while true
4961
do
5062
$CLICKHOUSE_CLIENT --query "SELECT key, value FROM $dictionary_name ORDER BY key ASC" | grep -A10 -B10 'Second' && break;
5163
sleep .1;
5264
done
5365

54-
$CLICKHOUSE_CLIENT --query "INSERT INTO table_for_update_field_dictionary VALUES (2, 'SecondUpdated', now()), (3, 'Third', now())"
66+
$CLICKHOUSE_CLIENT --query "INSERT INTO table_for_update_field_dictionary VALUES (2, 'SecondUpdated', now()+10), (3, 'Third', now()+10)"
5567

5668
while true
5769
do

tests/queries/0_stateless/02530_dictionaries_update_field_complex_key_hashed.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,4 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
88
# shellcheck source=./02530_dictionaries_update_field.lib
99
. "$CUR_DIR"/02530_dictionaries_update_field.lib
1010

11-
# NOTE: dictionaries will be updated according to server TZ, not session, so prohibit it's randomization
12-
$CLICKHOUSE_CLIENT --session_timezone '' -q "
13-
CREATE TABLE table_for_update_field_dictionary
14-
(
15-
key UInt64,
16-
value String,
17-
last_insert_time DateTime
18-
)
19-
ENGINE = MergeTree()
20-
ORDER BY tuple()
21-
"
22-
2311
run_test_with_layout "complex_key_hashed"

tests/queries/0_stateless/02530_dictionaries_update_field_flat.sh

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,4 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
88
# shellcheck source=./02530_dictionaries_update_field.lib
99
. "$CUR_DIR"/02530_dictionaries_update_field.lib
1010

11-
# NOTE: dictionaries will be updated according to server TZ, not session, so prohibit it's randomization
12-
$CLICKHOUSE_CLIENT --session_timezone '' -q "
13-
CREATE TABLE table_for_update_field_dictionary
14-
(
15-
key UInt64,
16-
value String,
17-
last_insert_time DateTime
18-
)
19-
ENGINE = TinyLog
20-
"
21-
2211
run_test_with_layout "flat"

tests/queries/0_stateless/02530_dictionaries_update_field_hashed.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,4 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
88
# shellcheck source=./02530_dictionaries_update_field.lib
99
. "$CUR_DIR"/02530_dictionaries_update_field.lib
1010

11-
# NOTE: dictionaries will be updated according to server TZ, not session, so prohibit it's randomization
12-
$CLICKHOUSE_CLIENT --session_timezone '' -q "
13-
CREATE TABLE table_for_update_field_dictionary
14-
(
15-
key UInt64,
16-
value String,
17-
last_insert_time DateTime
18-
)
19-
ENGINE = MergeTree()
20-
ORDER BY tuple()
21-
"
22-
2311
run_test_with_layout "hashed"

0 commit comments

Comments
 (0)