Skip to content

Commit

Permalink
fix(meta): fix catalog ref count (#18427)
Browse files Browse the repository at this point in the history
  • Loading branch information
zwang28 authored Sep 5, 2024
1 parent 79ba869 commit df7f54f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions e2e_test/backup_restore/tpch_snapshot_create.slt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
include ../tpch/create_tables.slt.part

statement ok
CREATE SECRET secret1 WITH (backend = 'meta') AS 'demo-secret'

# First, insert the data into the tables
include ../tpch/insert_customer.slt.part
include ../tpch/insert_lineitem.slt.part
Expand Down
3 changes: 3 additions & 0 deletions e2e_test/backup_restore/tpch_snapshot_drop.slt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
statement ok
DROP SECRET secret1;

statement ok
drop materialized view tpch_q7;

Expand Down
1 change: 1 addition & 0 deletions src/meta/src/manager/catalog/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ impl UserManager {
.values()
.map(|connection| connection.owner),
)
.chain(database.secrets.values().map(|secret| secret.owner))
.for_each(|owner_id| user_manager.increase_ref(owner_id));

Ok(user_manager)
Expand Down
14 changes: 13 additions & 1 deletion src/storage/backup/integration_tests/test_basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,20 @@ if ! psql -h localhost -p 4566 -d dev -U root -c "show materialized views;" | gr
echo "expect 0 MV"
exit 1
fi
if ! psql -h localhost -p 4566 -d dev -U root -c "show secrets;" | grep -q "0 row"; then
echo "expect 0 SECRET"
exit 1
fi
echo "restore snapshot ${job_id_1} succeeded"

restore "${job_id_2}"
start_cluster
if ! psql -h localhost -p 4566 -d dev -U root -c "show materialized views;" | grep -q "1 row"; then
echo "expect 1 MVs"
echo "expect 1 MV"
exit 1
fi
if ! psql -h localhost -p 4566 -d dev -U root -c "show secrets;" | grep -q "1 row"; then
echo "expect 1 SECRET"
exit 1
fi
echo "restore snapshot ${job_id_2} succeeded"
Expand All @@ -55,6 +63,10 @@ if ! psql -h localhost -p 4566 -d dev -U root -c "show materialized views;" | gr
echo "expect 0 MV"
exit 1
fi
if ! psql -h localhost -p 4566 -d dev -U root -c "show secrets;" | grep -q "0 row"; then
echo "expect 0 SECRET"
exit 1
fi
echo "restore snapshot ${job_id_3} succeeded"

echo "test succeeded"

0 comments on commit df7f54f

Please sign in to comment.