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

Rest cache - property cache #2658

Closed

Conversation

xyuanlu
Copy link
Contributor

@xyuanlu xyuanlu commented Oct 12, 2023

Issues

  • My PR addresses the following Helix issues and references them in the PR description:

#2659

Description

  • Here are some details about my PR, including screenshots of any UI changes:

Structure for rest data provider. It supports concurrent read/update.

Tests

  • The following tests are written for this issue:

Test will be added in following prs.

  • The following is the result of the "mvn test" command on the appropriate module:

(If CI test fails due to known issue, please specify the issue and test PR locally. Then copy & paste the result of "mvn test" to here.)

Changes that Break Backward Compatibility (Optional)

  • My PR contains changes that break backward compatibility or previous assumptions for certain methods or API. They include:

(Consider including all behavior changes for public methods or API. Also include these changes in merge description so that other developers are aware of these changes. This allows them to make relevant code changes in feature branches accounting for the new method/API behavior.)

Documentation (Optional)

  • In case of new functionality, my PR adds documentation in the following wiki page:

(Link the GitHub wiki you added)

Commits

  • My commits all reference appropriate Apache Helix GitHub issues in their subject lines. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Code Quality

  • My diff has been formatted using helix-style.xml
    (helix-style-intellij.xml if IntelliJ IDE is used)

…GED. (apache#2621)

Exclude on-operation instance from computing min active replica in WAGED.
@xyuanlu xyuanlu marked this pull request as ready for review October 12, 2023 21:55
_currentStateCache = null;
}
// TODO: consolidate EV from CSs
public Map<String, ExternalView> consolidateExternalViews() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to understand, if the stoppable check wants to get the external view from the cache, it should call consolidateExternalViews which will generate EV by the data from RestCurrentStateCache? Is that the plan?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should just call getEV. consolidateExternalViews will be called internal in this data provider

@asfgit asfgit force-pushed the ApplicationClusterManager branch from 7fca663 to 5f1a3f7 Compare October 17, 2023 20:25
Set<String> nodes) {
return nodes.stream()
.filter(
instance -> !DelayedAutoRebalancer.INSTANCE_OPERATION_TO_EXCLUDE_FROM_ASSIGNMENT.contains(instanceConfigMap.get(instance).getInstanceOperation()))
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably need checks before instanceConfigMap.get()

.equals("MASTER") && ev.getStateMap(partition)
.get(evacuateInstanceName)
.equals("LEADER"));

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: empty line

@asfgit asfgit force-pushed the ApplicationClusterManager branch 2 times, most recently from 5d6396e to 3775e3d Compare December 13, 2023 20:47
Comment on lines +23 to +26
/** Init, register listener and manager callback handler for different
* clusters manage the providers lifecycle
*
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

Wrong place for comments.

}
}

public void close() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Close should pair with connect / start. Do you want to make it as thread based class?



/**
* Dara cache for each Helix cluster. Configs, ideal stats and current states are read from ZK and updated
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo:
Dara -> Data
ideal stats -> ideal states


private HelixDataAccessor _accessor;

private RealmAwareZkClient _zkclient;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use meta client.

// Simple caches
private final RestPropertyCache<InstanceConfig> _instanceConfigCache;
private final RestPropertyCache<ClusterConfig> _clusterConfigCache;
private final RestPropertyCache<ResourceConfig> _resourceConfigCache;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need ResourceConfig cache?

private final RestPropertyCache<ResourceConfig> _resourceConfigCache;
private final RestPropertyCache<LiveInstance> _liveInstanceCache;
private final RestPropertyCache<IdealState> _idealStateCache;
private final RestPropertyCache<StateModelDefinition> _stateModelDefinitionCache;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this?


public void init(final HelixDataAccessor accessor) {
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: extra new line.



/**
* Special cache for instances current states.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not CurrentStateCache instead of building its own?



public class RestServiceDataProvider {
protected Map<String, PerClusterDataProvider> _clusterDataProviders ;
Copy link
Contributor

Choose a reason for hiding this comment

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

make it concurrent? What if remove cluster and read together?

@junkaixue
Copy link
Contributor

Is this still a valid change?

@xyuanlu xyuanlu closed this Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants