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

Add repository-url module and move URLRepository #22752

Merged
merged 31 commits into from
Jan 25, 2017

Conversation

Tim-Brooks
Copy link
Contributor

@Tim-Brooks Tim-Brooks commented Jan 23, 2017

This is related to #22116. URLRepository requires SocketPermission
connect. This commit introduces a new module called "repository-url"
where URLRepository will reside. With the new module, permissions can
be removed from core.

@rjernst
Copy link
Member

rjernst commented Jan 23, 2017

Is there any reason FSRepository would need to be in the same module as URL repository, or could it be separate when it is eventually moved? In which case, this can be called repository-url?

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

This looks good. I left a couple minor comments. The main thing I want to clear up is the name.

@@ -98,7 +91,8 @@ public void testRestoreOldSnapshots() throws Exception {
for (Version v : VersionUtils.allReleasedVersions()) {
if (VersionUtils.isSnapshot(v)) continue; // snapshots are unreleased, so there is no backcompat yet
if (v.isRelease() == false) continue; // no guarantees for prereleases
if (v.before(Version.CURRENT.minimumIndexCompatibilityVersion())) continue; // we only support versions N and N-1
if (v.before(Version.CURRENT.minimumIndexCompatibilityVersion()))
Copy link
Member

Choose a reason for hiding this comment

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

Why this change? If you are going to move the continue to the next line (breaking with the convention of the other loop shortcut statements here...), please open a block.

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'm not sure. I definitely did not intend that change. I'll revert that line.

classname 'org.elasticsearch.plugin.repositories.RepositoriesPlugin'
}

dependencies {
Copy link
Member

Choose a reason for hiding this comment

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

If there are no dependencies, you don't need a dependencies section.

compileJava.options.compilerArgs << "-Xlint:-unchecked,-rawtypes"
compileTestJava.options.compilerArgs << "-Xlint:-unchecked,-rawtypes"

thirdPartyAudit.excludes = [
Copy link
Member

Choose a reason for hiding this comment

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

Not necessary.


@Override
public Map<String, Repository.Factory> getRepositories(Environment env, NamedXContentRegistry namedXContentRegistry) {
return Collections.singletonMap(URLRepository.TYPE, (metadata) -> new URLRepository(metadata, env, namedXContentRegistry));
Copy link
Member

Choose a reason for hiding this comment

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

nit: the parens around metadata are not necessary.

@Tim-Brooks
Copy link
Contributor Author

I'll update the PR with the requested changes.

As for the name - when @s1monw and I originally talked about it, I was going to move both to a module named "repositories". But then this kind of blocked that from being a straightforward change.

So we agreed that while working on the SocketPermissions work I would only move the URLRepository. I kept the naming with the assumption that at some point we would move the FSRepository there also.

But there is no technical reason that I know of why they would need to be in the same module. If we want to specialize this module I can make those changes.

@rjernst
Copy link
Member

rjernst commented Jan 23, 2017

But there is no technical reason that I know of why they would need to be in the same module.

Since URLRepository will require network permission, but FSRepository will not, I think that would be a good split.

@jasontedor
Copy link
Member

Since URLRepository will require network permission, but FSRepository will not, I think that would be a good split.

+1

@Tim-Brooks Tim-Brooks changed the title Add repositories module and move URLRepository Add url-repository module and move URLRepository Jan 24, 2017
@Tim-Brooks
Copy link
Contributor Author

Tim-Brooks commented Jan 24, 2017

I renamed it to repository-url.

I also worked on fixing some integration tests. I moved a snapshot restore test that used the URLRepository to the new module. That test required a repository path and it looks like you can only call randomRepoPath() on ESIntegTestCase if you're an internal cluster?

In order to force that I a method I had to do this. I'm not sure if this was the correct approach? This was the first time I was dealing with the integration test harness, so let me know if there is something I should be doing instead.

And @s1monw I will need a separate PR to move around connect permissions for all modules/plugins. So I will handle the policy file aspect of this module there.

@jasontedor
Copy link
Member

jasontedor commented Jan 24, 2017

I renamed it to url-repository.

I'm really sorry to be a pain here, but I think that it should be repository-url (we have plugins already named repository-*, I think the module should be named consistently).

@Tim-Brooks
Copy link
Contributor Author

@jasontedor I mistyped the comment. repository-url is actually what I named it.

@jasontedor
Copy link
Member

I mistyped the comment. repository-url is actually what I named it.

Thank you. 😄

@Tim-Brooks Tim-Brooks changed the title Add url-repository module and move URLRepository Add repository-url module and move URLRepository Jan 24, 2017
@rjernst
Copy link
Member

rjernst commented Jan 24, 2017

@tbrooks8 I don't see where your ignoreExternalCluster() is actually called? But ESIntegTestCase subclasses do not use an external cluster (anymore, they did long ago), so I'm confused on what instigated this added boolean?

@Tim-Brooks
Copy link
Contributor Author

Tim-Brooks commented Jan 24, 2017

@rjernst Right here.

So when I run gradle :modules:repository-url:integTest without that , this exception is being thrown.

@rjernst
Copy link
Member

rjernst commented Jan 24, 2017

I think you need to rename that test. That exception is there for a reason. It means the test is running with an external cluster (which integTest does everywhere except in core, where the test was pulled from). In core, tests ending in IT extend from ESIntegTestCase. For all other modules, tests ending in IT mean they are running against an external cluster (a true integ test). If you rename the suffix of that test to Tests, it should work like a normal core integ test.

@Tim-Brooks
Copy link
Contributor Author

Thanks. That looks like it was my issue.

@Tim-Brooks
Copy link
Contributor Author

@jasontedor / @rjernst It looks like the build is passing at this point (now that I have worked out integration test issues). Can you update your reviews and approve it if everything looks alright?

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM

*/

esplugin {
description 'Module for generic repositories'
Copy link
Member

Choose a reason for hiding this comment

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

Should be URL repository?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep - just fixed

Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

Looks great, I left a question though.

}

compileJava.options.compilerArgs << "-Xlint:-unchecked,-rawtypes"
compileTestJava.options.compilerArgs << "-Xlint:-unchecked,-rawtypes"
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain why these are needed?

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 just copied an existing module and made appropriate modifications when I created this. I assume those are artifacts from that and I do not know any reason those are need. I'll remove them.

Copy link
Member

Choose a reason for hiding this comment

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

Cool, let's indeed see if we can drop them.

Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

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

LGTM. If the CI build passes, I'm good with it.

@Tim-Brooks
Copy link
Contributor Author

The CI build passed. So I'll merge this.

@Tim-Brooks Tim-Brooks merged commit 719e75b into elastic:master Jan 25, 2017
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Jan 26, 2017
* master: (47 commits)
  Remove non needed import
  use expectThrows instead of manually testing exception
  Fix checkstyle and a test
  Update after review
  Read ec2 discovery address from aws instance tags
  Invalidate cached query results if query timed out (elastic#22807)
  Add remaining generated painless API
  Generate reference links for painless API (elastic#22775)
  [TEST] Fix ElasticsearchExceptionTests
  Add parsing method for ElasticsearchException.generateThrowableXContent() (elastic#22783)
  Improve connection closing in `RemoteClusterConnection` (elastic#22804)
  Docs: Cluster allocation explain should be on one page
  Remove DFS_QUERY_AND_FETCH as a search type (elastic#22787)
  Add repository-url module and move URLRepository (elastic#22752)
  fix date-processor to a new default year for every new pipeline execution. (elastic#22601)
  Add tests for top_hits aggregation (elastic#22754)
  [TEST] Added this for 93a28b0 submitted via elastic#22772
  Fix typo in comment in OsProbe.java
  Add new ruby search library to community clients doc (elastic#22765)
  RangeQuery WITHIN case now normalises query (elastic#22431)
  ...
@Tim-Brooks Tim-Brooks deleted the url_repository_module branch November 14, 2018 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Core Core issues without another label >enhancement v6.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants