Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(meta): fix catalog ref count #18427

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Loading