generated from NOAA-OWP/owp-open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Database Enhancements - Lock Up Fix (#520)
This PR includes a variety of minor Viz RDS Database / Pipeline tweaks, with the goal of preventing random memory crashes / lock-ups on the Viz database (more below). In short, it includes the following changes: - Setting work_mem to 512MB on FIMPact spatial join SQL queries (this seems to solve the problem in most cases) - Setting idle_in_transaction_session_timeout in the Viz RDS parameter group to 15 minutes (default was 1 day) - Changed the drop table logic in ana past hour max flows query to truncate to prevent locks (this should hopefully also prevent the traffic jam, even if FIMpact does fail due to the memory crash) - Removal of admin.ingest_status table logging (now redundant with step functions) - It's not included in this PR, but we also requested the 24X7 team add a CloudWatch alarm to the viz database DB Load metric with a 15-minute average threshold of 7. ---------------- * Removal of admin ingest table logging (not using since step functions) * Changing drop table on ana_past_hour to truncate to hopefully relieve risk of lock when srf_rate_of_change is taking a long time (I'm not really sure how this could happen, but I don't see any harm). * Adding postgresql work_mem adjustment to fimpact spatial joins - this is something I was teting in the historic piplines, and it seems to improve the performance of these queries signifantly. * Viz RDS Setting Change: Idle transaction timeout changed from 1 day to 15 minutes (I'm not exactly sure if this is relevant, but don't think it hurts to try it).
- Loading branch information
1 parent
aaa966b
commit ad6d7d6
Showing
19 changed files
with
42 additions
and
14 deletions.
There are no files selected for viewing
9 changes: 1 addition & 8 deletions
9
Core/LAMBDA/viz_functions/viz_db_postprocess_sql/admin/ingest_finish.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,4 @@ | ||
CREATE INDEX {index_name} ON {target_table} {index_columns}; | ||
|
||
ALTER TABLE {target_table} | ||
ADD COLUMN reference_time TEXT DEFAULT '1900-01-01 00:00:00 UTC'; | ||
|
||
UPDATE admin.ingest_status | ||
SET status = 'Import Complete', | ||
update_time = now()::timestamp without time zone, | ||
files_processed = {files_imported}, | ||
records_imported = {rows_imported} | ||
WHERE target = '{target_table}' AND reference_time = '1900-01-01 00:00:00'; | ||
ADD COLUMN reference_time TEXT DEFAULT '1900-01-01 00:00:00 UTC'; |
4 changes: 0 additions & 4 deletions
4
Core/LAMBDA/viz_functions/viz_db_postprocess_sql/admin/ingest_prep.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
Core/LAMBDA/viz_functions/viz_db_postprocess_sql/max_flows/ana_max_flows.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...functions/viz_db_postprocess_sql/summaries/ana_inundation/building_footprints_fimpact.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...ctions/viz_db_postprocess_sql/summaries/ana_inundation_hi/building_footprints_fimpact.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...ions/viz_db_postprocess_sql/summaries/ana_inundation_prvi/building_footprints_fimpact.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...process_sql/summaries/ana_past_14day_max_inundation/14day_building_footprints_fimpact.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...tprocess_sql/summaries/ana_past_14day_max_inundation/7day_building_footprints_fimpact.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...tprocess_sql/summaries/mrf_gfs_10day_max_inundation/10day_building_footprints_fimpact.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...stprocess_sql/summaries/mrf_gfs_10day_max_inundation/3day_building_footprints_fimpact.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...stprocess_sql/summaries/mrf_gfs_10day_max_inundation/5day_building_footprints_fimpact.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...tprocess_sql/summaries/mrf_nbm_10day_max_inundation/10day_building_footprints_fimpact.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...stprocess_sql/summaries/mrf_nbm_10day_max_inundation/3day_building_footprints_fimpact.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...stprocess_sql/summaries/mrf_nbm_10day_max_inundation/5day_building_footprints_fimpact.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...b_postprocess_sql/summaries/rfc_based_5day_max_inundation/building_footprints_fimpact.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
.../viz_db_postprocess_sql/summaries/srf_18hr_max_inundation/building_footprints_fimpact.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...z_db_postprocess_sql/summaries/srf_48hr_max_inundation_hi/building_footprints_fimpact.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
...db_postprocess_sql/summaries/srf_48hr_max_inundation_prvi/building_footprints_fimpact.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters