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

Add datasource field in accelerations cache #1525

Merged
merged 2 commits into from
Mar 13, 2024

Conversation

ps48
Copy link
Member

@ps48 ps48 commented Mar 12, 2024

Description

Updating the accelerations cache structure from:

export interface CachedAccelerations {
  flintIndexName: string;
  type: AccelerationIndexType;
  database: string;
  table: string;
  indexName: string;
  autoRefresh: boolean;
  status: string;
}

export interface AccelerationsCacheData {
  version: string;
  accelerations: CachedAccelerations[];
  lastUpdated: string; // date string in UTC format
  status: CachedDataSourceStatus;
}

To:

export interface CachedAccelerations {
  flintIndexName: string;
  type: AccelerationIndexType;
  database: string;
  table: string;
  indexName: string;
  autoRefresh: boolean;
  status: string;
}

export interface CachedAcclerationByDataSource {
  name: string;
  accelerations: CachedAccelerations[];
  lastUpdated: string; // date string in UTC format
  status: CachedDataSourceStatus;
}

export interface AccelerationsCacheData {
  version: string;
  dataSources: CachedAcclerationByDataSource[];
}

Issues Resolved

#1484

  • Add relevant helper functions in the cache manager
  • Increase cache test coverage

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>
Copy link

codecov bot commented Mar 12, 2024

Codecov Report

Attention: Patch coverage is 95.83333% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 56.94%. Comparing base (d17cad3) to head (47f0768).

Files Patch % Lines
public/framework/catalog_cache/cache_loader.tsx 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1525      +/-   ##
==========================================
+ Coverage   56.62%   56.94%   +0.31%     
==========================================
  Files         348      348              
  Lines       12656    12675      +19     
  Branches     3202     3206       +4     
==========================================
+ Hits         7167     7218      +51     
+ Misses       5436     5404      -32     
  Partials       53       53              
Flag Coverage Δ
dashboards-observability 56.94% <95.83%> (+0.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@RyanL1997 RyanL1997 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Lets merge this, so that I can use the changes in #1521.

accelerations: [],
lastUpdated: '',
status: CachedDataSourceStatus.Empty,
dataSources: [],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because the dataSources: [] contains the above?

        accelerations: [],
        lastUpdated: '',
        status: CachedDataSourceStatus.Empty,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes!

@@ -83,19 +83,19 @@ export interface CachedColumn {

export interface CachedTable {
name: string;
columns: CachedColumn[];
columns?: CachedColumn[];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why optional here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cause columns are lazy loaded for tables. These will be loaded in cache when users open table flyout or use a table in create acceleration flyout.

@@ -189,6 +188,7 @@ export const useLoadToCache = (loadCacheType: LoadCacheType) => {
}, ASYNC_POLLING_INTERVAL);

const startLoading = (dataSourceName: string, databaseName?: string) => {
setLoadStatus(DirectQueryLoadingStatus.SCHEDULED);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this meaning that, SCHEDULED means loading? For example, instead of checking if it is SUCCESS, FAILED, or CANCELLED, I can use this as an indicator to see if it is at a loading/refreshing stage?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is added as we want to start with status as scheduled whenever the startpolling is called. Otherwise, it keep the old calls status.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SCHEDULED is the initial state, it may not necessarily be loading.

const { loadStatus, startLoading, stopLoading } = useLoadAccelerationsToCache();

If startLoading isn't called, then loadStatus will remain as SCHEDULED.

Copy link
Collaborator

@mengweieric mengweieric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

public/framework/catalog_cache/cache_manager.ts Outdated Show resolved Hide resolved
Copy link
Member

@sejli sejli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>
@ps48 ps48 merged commit b0f0d9b into opensearch-project:main Mar 13, 2024
16 of 20 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Mar 13, 2024
* add datasource in accelerations cache

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>

* fixed nits

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>

---------

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>
(cherry picked from commit b0f0d9b)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ps48 pushed a commit that referenced this pull request Mar 13, 2024
* add datasource in accelerations cache



* fixed nits



---------


(cherry picked from commit b0f0d9b)

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
amsiglan pushed a commit to amsiglan/dashboards-observability that referenced this pull request Jun 7, 2024
…opensearch-project#1526)

* add datasource in accelerations cache

* fixed nits

---------

(cherry picked from commit b0f0d9b)

Signed-off-by: Shenoy Pratik <sgguruda@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
(cherry picked from commit 2d18a4f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants