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

[COST-5252] cache schema/table exists #5213

Merged
merged 7 commits into from
Jul 12, 2024
Merged

Conversation

maskarb
Copy link
Member

@maskarb maskarb commented Jul 10, 2024

Jira Ticket

COST-5252

Description

This change will cache the result of the schema and table lookup in trino.

Testing

  1. clean db and redis cache:
$ make delete-test-customer-data; make delete-testing; make delete-trino-data; make delete-redis-cache
  1. with a clean db, open a shell with access to redis:
$ REDIS_HOST=localhost make shell
  1. import the get-from-cache func and check the cache for the key (it should not be in cache):
>>> is_key_in_cache('schema-exists-trino-org1234567')
False
  1. ingest data:
$ make create-test-customer; make load-test-customer-data test_source=ONPREM
  1. once done, check the cache again. Key should be available and the value is True:
>>> is_key_in_cache('schema-exists-trino-org1234567')
True
>>> get_value_from_cache('schema-exists-trino-org1234567') 
True
  1. Check for some table keys and values:
>>> get_value_from_cache('table-exists-trino-org1234567-openshift_pod_usage_line_items_daily')
True
>>> get_value_from_cache('table-exists-trino-org1234567-openshift_pod_usage_line_items')
True
>>> get_value_from_cache('table-exists-trino-org1234567-openshift_storage_usage_line_items_daily')
True
>>> get_value_from_cache('table-exists-trino-org1234567-openshift_storage_usage_line_items')
True
>>> get_value_from_cache('table-exists-trino-org1234567-openshift_node_labels_line_items_daily')
True
>>> get_value_from_cache('table-exists-trino-org1234567-openshift_node_labels_line_items')
True
>>> get_value_from_cache('table-exists-trino-org1234567-openshift_namespace_labels_line_items_daily')
True
>>> get_value_from_cache('table-exists-trino-org1234567-openshift_namespace_labels_line_items')
True

Release Notes

  • proposed release note
* [[COST-5252](https://issues.redhat.com/browse/COST-5252)] cache schema/table exists

Copy link

codecov bot commented Jul 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.1%. Comparing base (cc5a954) to head (922804d).

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #5213   +/-   ##
=====================================
  Coverage   94.1%   94.1%           
=====================================
  Files        371     371           
  Lines      30901   30927   +26     
  Branches    4540    4542    +2     
=====================================
+ Hits       29074   29104   +30     
+ Misses      1165    1163    -2     
+ Partials     662     660    -2     

@maskarb maskarb added the smoke-tests pr_check will build the image and run minimal required smokes label Jul 11, 2024
@maskarb maskarb marked this pull request as ready for review July 12, 2024 14:03
@maskarb maskarb requested review from a team as code owners July 12, 2024 14:03
@maskarb maskarb enabled auto-merge (squash) July 12, 2024 15:12
@maskarb maskarb merged commit 31f7de6 into main Jul 12, 2024
11 checks passed
@maskarb maskarb deleted the COST-5252-cache-schema-exists branch July 12, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
smoke-tests pr_check will build the image and run minimal required smokes smokes-required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants