Skip to content

Fix Server Active State Endpoint#23585

Merged
swapsmagic merged 1 commit intoprestodb:masterfrom
swapsmagic:fix_server_active_state_status
Sep 5, 2024
Merged

Fix Server Active State Endpoint#23585
swapsmagic merged 1 commit intoprestodb:masterfrom
swapsmagic:fix_server_active_state_status

Conversation

@swapsmagic
Copy link
Contributor

@swapsmagic swapsmagic commented Sep 4, 2024

Description

GET /v1/info/state endpoint to return cluster state INACTIVE till resource group configuration manager is not fully loaded.

Motivation and Context

During start of the cluster, ResourceGroupManagerConfigurationManager is initialized with InitializingConfigurationManager class. And later configuration manager is configured when loadConfigurationManager method is called. But between this time period GET /v1/info/state endpoint returns the server state as ACTIVE. And if the server receives any queries during the period, they all fails with SERVER_STARTING_UP error.

Impact

In this PR, we are addressing that by providing a flag in ResourceGroupConfigurationManager that is been checked and if not true, /v1/info/state endpoint return server status as INACTIVE.

Test Plan

Added unit test to verify the scenario.

Contributor checklist

  • Please make sure your submission complies with our development, formatting, commit message, and attribution guidelines.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

General Changes
* GET `/v1/info/state` to return INACTIVE state until the resource group configuration manager is fully initialized :pr:`23585`

@swapsmagic swapsmagic force-pushed the fix_server_active_state_status branch 2 times, most recently from 91a3f73 to 8c40f98 Compare September 4, 2024 21:53
NikhilCollooru
NikhilCollooru previously approved these changes Sep 4, 2024
NikhilCollooru
NikhilCollooru previously approved these changes Sep 4, 2024
During start of the cluster, ResourceGroupManagerConfigurationManager is initialized with InitializingConfigurationManager class.
And later configuration manager is configured when loadConfigurationManager method is called. But between this time period
GET `/v1/info/state` endpoint returns the server state as ACTIVE. And if the server receives any queries during the period, they all fails
with SERVER_STARTING_UP error.
In this PR, we are addressing that by providing a flag in ResourceGroupConfigurationManager that is been checked and if not true, `/v1/info/state`
endpoint return server status as INACTIVE.
@swapsmagic swapsmagic merged commit 7b14c7a into prestodb:master Sep 5, 2024
@swapsmagic swapsmagic deleted the fix_server_active_state_status branch September 5, 2024 05:12
private final boolean isResourceManagerEnabled;
private final QueryManagerConfig queryManagerConfig;
private final InternalNodeManager nodeManager;
private boolean isConfigurationManagerLoaded;
Copy link
Contributor

Choose a reason for hiding this comment

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

Given that this is mutable and guaranteed to be accessed from multiple threads, you should ensure that there is proper visibility to each thread. Note that where you set this, in loadConfigurationManager, such care has also been taken in other mutated members, like configurationManager. I'd recommend making it an AtomicBoolean.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will send a followup PR to address this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jaystarshot jaystarshot mentioned this pull request Nov 1, 2024
25 tasks
@tdcmeehan tdcmeehan added the from:Meta PR from Meta label Dec 13, 2024
@prestodb-ci
Copy link
Contributor

Saved that user @swapsmagic is from Meta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:Meta PR from Meta

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments