Skip to content

Commit

Permalink
Update bucketlistDB size check
Browse files Browse the repository at this point in the history
  • Loading branch information
chowbao committed Sep 13, 2024
1 parent da7cb2b commit 881f2b8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/bucketlist_db_size_check.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@
)
}}

with bucketlist_db_size as (
with bucket_max_size as (
select
bucket_list_target_size_bytes
from {{ ref('config_settings_current') }}
where true
and config_setting_id = 2
)
, bucketlist_db_size as (
select sequence,
closed_at,
total_byte_size_of_bucket_list / 1000000000 as bl_db_gb
from {{ ref('stg_history_ledgers') }}
where closed_at >= TIMESTAMP_SUB('{{ dbt_airflow_macros.ts(timezone=none) }}', INTERVAL 1 HOUR )
-- alert when the bucketlist has grown larger than 12 gb
and total_byte_size_of_bucket_list / 1000000000 >= 12
)
-- alert when the bucketlist has grown larger than 1 gb from bucket_list_target_size_bytes
and total_byte_size_of_bucket_list > (select bucket_list_target_size_bytes - 1000000000 from bucket_max_size))

select * from bucketlist_db_size

0 comments on commit 881f2b8

Please sign in to comment.