Skip to content

Conversation

@HoustonPutman
Copy link
Contributor

https://issues.apache.org/jira/browse/SOLR-18072

There are no functionality changes here. Just test improvements, and refactoring of the APIs.

I'm also happy to call AdminCmdContext something else, that's a very easy change.

Copy link
Contributor

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

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

I overall like the proposal of an Admin API context class for these APIs.

I've been looking in this PR for where SubResponseAccumulatingJerseyResponse is defined but can't find it; maybe because Safari/GitHub is completely choking on this massive PR. I don't love the name of that thing. Can you please self-review to identify it?

CollectionAdminRequest.RequestStatus requestStatus =
CollectionAdminRequest.requestStatus(asyncId);
CollectionAdminRequest.RequestStatusResponse rsp = null;
TimeOut timeoutCheck = new TimeOut(timeout, TimeSource.NANO_TIME);
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm; we also have org.apache.solr.common.util.RetryUtil utility. Maybe that should at least cross-link.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can switch over to that.

import org.mockito.ArgumentCaptor;

/**
* Abstract test class to setup shared mocks for unit testing v2 API calls that go to the Overseer.
Copy link
Contributor

Choose a reason for hiding this comment

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

false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Overseer or DistributedCollectionConfigSetCommandRunner, fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Based on the content here, this seems actually for SolrCloud. If so; maybe the name or package should reflect that. Any way, this class is peculiar to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could move it, but all of these test classes already lived here, and this is just an abstract (will change) class to help with the mocking for most of the other test classes in this package.

@HoustonPutman
Copy link
Contributor Author

I've been looking in this PR for where SubResponseAccumulatingJerseyResponse is defined but can't find it; maybe because Safari/GitHub is completely choking on this massive PR. I don't love the name of that thing. Can you please self-review to identify it?

This response class already exists, and the method that populated it already existed too. I just expanded the use of it, so that we weren't doing the same thing across each API independently. That's why you can't find it in the PR. We can change the name independently if you dislike it, but not really in the scope of this PR.

Copy link
Contributor

@dsmiley dsmiley left a comment

Choose a reason for hiding this comment

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

Thanks.

}
fail("Async request " + asyncId + " did not complete within duration: " + timeout.toString());
return rsp;
final AtomicReference<CollectionAdminRequest.RequestStatusResponse> rsp =
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks worse. I guess TimeOut is simpler in part due to no try-catch needed in some cases (like this) and no AtomicReference needed either. Dodging the try-catch need is unusual... normally a failing request propagates an exception but I see the API you are using doesn't do that. I think that's a known GAP in our APIs that I had been chatting with Jason about solving.

Any way, do as you please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, agreed.

Ok at first I was going to just revert the change. But then I decided adding an additional retry utility that would return a response, that is validated, would be better. The method looks MUCH better now.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants