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 DataSourceName update for HotReload #2401

Merged
merged 5 commits into from
Oct 15, 2024
Merged

Conversation

abhishekkumams
Copy link
Contributor

@abhishekkumams abhishekkumams commented Oct 1, 2024

Why make this change?

the correct way of updating the dataSourceName was already there in the initial PR here:

public void UpdateDefaultDataSourceName(string initialDefaultDataSourceName)

then in another refactor PR, it was incorrectly updated, ref: https://github.com/Azure/data-api-builder/pull/2356/files#r1781334859

The current code directly assigns a new value to DefaultDataSourceName. However, this approach does not account for updating the different mappings related to DataSourceName when the application undergoes a hot reload. During a hot reload, it is crucial to maintain the same default data source name as before the hot reload to all the mappings for being consistent. This is because references to the data source depend on this name for lookups.

The new method UpdateDefaultDataSourceName ensures that the default data source name is updated correctly, maintaining consistency across hot reloads.

What is this change?

  • Using the correct initial method to update the DataSourceName for HotReload Scenario.

How was this tested?

  • Manual Testing
  • More tests should be a part of other HotReload PRs

the correct way of updating the dataSourceName was already there in the initial PR here: https://github.com/Azure/data-api-builder/blob/741865371911ef0b8dc6a27d9bc9ef82470cfc16/src/Config/ObjectModel/RuntimeConfig.cs#L303
 
then in another refactor PR, it was incorrectly updated, ref: https://github.com/Azure/data-api-builder/pull/2356/files#r1781334859

This PR fixes this.

Tests will be a part of another Hot Reload PR.
@abhishekkumams
Copy link
Contributor Author

/azp run

1 similar comment
@abhishekkumams
Copy link
Contributor Author

/azp run

@abhishekkumams
Copy link
Contributor Author

/azp run

@abhishekkumams abhishekkumams self-assigned this Oct 4, 2024
@abhishekkumams abhishekkumams added the bug Something isn't working label Oct 4, 2024
@abhishekkumams abhishekkumams added this to the 1.3 milestone Oct 4, 2024
@RubenCerna2079
Copy link
Contributor

In the tests section you wrote that "more tests should be part of other HotReload PRs". Do you mean tests related to the function UpdateDefaultDataSourceName or what did you mean by it?

@abhishekkumams
Copy link
Contributor Author

In the tests section you wrote that "more tests should be part of other HotReload PRs". Do you mean tests related to the function UpdateDefaultDataSourceName or what did you mean by it?

correct integrations tests would be verifying this update logic as well.

@abhishekkumams
Copy link
Contributor Author

/azp run

@seantleonard
Copy link
Contributor

It would be helpful to have in PR description "Why" this change is correct and why the previous one is wrong

Copy link
Contributor

@seantleonard seantleonard left a comment

Choose a reason for hiding this comment

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

This enables my local environment to work with hot reload. However please add more to pr description for WHY this change works.

@seantleonard seantleonard requested a review from sezal98 as a code owner October 9, 2024 16:45
@seantleonard
Copy link
Contributor

/azp run

@abhishekkumams
Copy link
Contributor Author

/azp run

@abhishekkumams
Copy link
Contributor Author

/azp run

1 similar comment
@abhishekkumams
Copy link
Contributor Author

/azp run

@abhishekkumams abhishekkumams merged commit f97aa96 into main Oct 15, 2024
7 checks passed
@abhishekkumams abhishekkumams deleted the abhishekkumams-patch-3 branch October 15, 2024 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants