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

GEODE-8283: Provide REST interface for disk-store creation #5288

Merged
merged 10 commits into from Jun 26, 2020

Conversation

jmelchio
Copy link
Contributor

  • Provides create, get, list and delete operations
  • Can create with locator only running

Co-Authored-By: Jason Huynh jhuynh@vmware.com

Thank you for submitting a contribution to Apache Geode.

In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:

For all changes:

  • Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?

  • Has your PR been rebased against the latest commit within the target branch (typically develop)?

  • Is your initial contribution a single, squashed commit?

  • Does gradlew build run cleanly?

  • Have you written or updated unit tests to verify your changes?

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?

Note:

Please ensure that once the PR is submitted, check Concourse for build issues and
submit an update to your PR as soon as possible. If you need help, please send an
email to dev@geode.apache.org.

public static final String DISK_STORE_CONFIG_ENDPOINT = "/diskstores";

@JsonIgnore
private String id;
Copy link
Member

Choose a reason for hiding this comment

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

Does it need both id and name? Are all the attributes necessary in the rest interface? Rest interface is supposed to be a more simplified/opinionated interface than the xml. It doesn't have to repeat everything that xml object has. Rather only focus on the attributes that users would need to configure most. If having it there would confuse users rather than help them, better not provide it in the rest interface.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We weren't sure what would and would not be used often. If we have someone who can sound off on what to include I'm happy to trim the list of properties and revert to defaults where we don't have them.

Copy link
Member

Choose a reason for hiding this comment

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

What's your use case for needing these rest api? For now I would suggest just expose those attributes that you needed. It's always easy to add attributes to the config objects

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need it for setting up disk-stores in k8s.

Copy link
Member

Choose a reason for hiding this comment

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

Do you need to configure all the attributes in k8s? I am asking because of what we did for Region config object, we only expose what's critical to configure the region to simplify user experience. I would hope Diskstore would do the same. Maybe talk to Gang to find out what are the most used attributes when configuring diskstore and what are the user's pain point given the current set of options in gfsh


public class DiskDir implements Serializable, JsonSerializable {
private String name;
private String dirSize;
Copy link
Member

Choose a reason for hiding this comment

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

would an int/long be better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, probably better.

@Override
public void add(DiskStore config, CacheConfig existing) {
List<DiskStoreType> diskStoreTypes = existing.getDiskStores();
if (diskStoreTypes.stream().noneMatch(diskStoreType -> diskStoreType.getName()
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you need the check here. the pipeline should already make sure that there is no existing one that has the same id exists before it's calling this add

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, we'll check if we can drop these checks without side effects.


@Override
public void delete(DiskStore config, CacheConfig existing) {
existing.getDiskStores().stream()
Copy link
Member

Choose a reason for hiding this comment

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

same as add, no need to check

import org.apache.geode.management.runtime.DiskStoreInfo;

@Experimental
public class DiskStore extends GroupableConfiguration<DiskStoreInfo> {
Copy link
Member

Choose a reason for hiding this comment

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

If DiskStoreInfo is an empty class (no runtime info to gather for this configuration object), then you can declare this DiskStore as public class DiskStore extends GroupableConfiguration<RuntimeInfo>. This way, for get/list, the cms will not even issue the functions to the servers to try to retrieve an empty object.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In its current configuration it does list the servers to which the DiskStore has been applied. I'll try and see if this continues when we roll it into the DiskStore class. If that is the case we can drop the DiskStoreInfo class.

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 appears the DiskStoreRealizer needs a concrete implementation of RuntimeInfo.

Copy link
Member

Choose a reason for hiding this comment

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

If it returns null in the get method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would work but then we wouldn't even get a list of machines where the disk-stores live at run time.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see, you don't need further diskstore info on each server, but you do need the server id. I guess you can leave it as is.

jmelchio and others added 10 commits June 25, 2020 15:57
- Provides create, get, list and delete operations
- Can create with locator only running

Co-Authored-By: Jason Huynh <jhuynh@vmware.com>
* Updating assembly validation txt
Trying to remove disk store folders after test

* Attempt to clear out disk dirs between runs

* Added temporary folder and forced disk dirs to use the absolute path
* Updating assembly validation txt
Trying to remove disk store folders after test

* Attempt to clear out disk dirs between runs

* Added temporary folder and forced disk dirs to use the absolute path

* Added tests for groups
Prevent removal of disk store from specific groups to be consistent with region api
- Rebase against develop
Copy link
Member

@jinmeiliao jinmeiliao left a comment

Choose a reason for hiding this comment

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

LGTM

@jmelchio jmelchio merged commit c9ed7d7 into apache:develop Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants