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-6117: Makes modules out of geode-core and geode-cq #2915

Merged
merged 18 commits into from
Dec 7, 2018

Conversation

jake-at-work
Copy link
Contributor

  • Moves all o.a.g.internal.cq(ish) classes to o.a.g.cq.internal.
  • Fixes dependencies
  • Temporarily removes runtime dependency on Shiro to fix client modules.

Co-authored-by: Jacob Barrett jbarrett@pivotal.io
Co-authored-by: Owen Nichols onichols@pivotal.io

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, you check travis-ci 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.

jake-at-work and others added 13 commits November 28, 2018 20:35
- Moves all o.a.g.internal.cq(ish) classes to o.a.g.cq.internal.
- Fixes dependencies
- Temporarily removes runtime dependency on Shiro to fix client modules.

Co-authored-by: Jacob Barrett <jbarrett@pivotal.io>
Co-authored-by: Owen Nichols <onichols@pivotal.io>
Authored-by: Jacob Barrett <jbarrett@pivotal.io>
Authored-by: Jacob Barrett <jbarrett@pivotal.io>
Co-authored-by: Jacob Barrett <jbarrett@pivotal.io>
Co-authored-by: Owen Nichols <onichols@pivotal.io>
Co-authored-by: Jacob Barrett <jbarrett@pivotal.io>
Co-authored-by: Owen Nichols <onichols@pivotal.io>
Co-authored-by: Jacob Barrett <jbarrett@pivotal.io>
Co-authored-by: Owen Nichols <onichols@pivotal.io>
Authored-by: Jacob Barrett <jbarrett@pivotal.io>
Authored-by: Jacob Barrett <jbarrett@pivotal.io>
@jake-at-work jake-at-work changed the title NO REVIEW: Makes modules out of geode-core and geode-cq Makes modules out of geode-core and geode-cq Nov 30, 2018
@jake-at-work jake-at-work changed the title Makes modules out of geode-core and geode-cq GEODE-6117: Makes modules out of geode-core and geode-cq Nov 30, 2018
@@ -66,7 +66,7 @@ private QueryOp() {
/**
* Note: this class is extended by CreateCQWithIROpImpl.
*/
protected static class QueryOpImpl extends AbstractOp {
public static class QueryOpImpl extends AbstractOp {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this need to be public now? I suppose it is part of an internal package, so does that mean we don't need to worry about this being a public API change? Mainly I'm just curious why this became public, I'm not seeing the corresponding usage that requires it to be public in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a class in the geode-cq that inherits from this inner class. Tt was able to before because it was in the same package but to support modules we can't split packages across jars anymore. In order for the geode-cq class to access this class it must now be public. Since it is "internal" it should not be considered public API. In fact it isn't exported in a way that any module other than geode-cq can access it in the module-info.java.

@@ -287,6 +287,9 @@ public static String processIncomingClassName(String name) {
if (name.startsWith(oldPackage)) {
return newPackage + name.substring(oldPackage.length());
}
if (name.equals("org.apache.geode.cache.query.internal.cq.ServerCQImpl")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This string and the one below it are used twice in this class. Maybe extract them into static final fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure could. Was staying consistent with the other swizzle happening here.

}

private String removeModuleFromGradlePath(String classpath, String module) {
// geode-cq/build/classes/java/main
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure this comment is very helpful

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 isn't, got left on accident. Thanks!

@jake-at-work
Copy link
Contributor Author

@mcmellawatt can we get a re-review and blessing?

* limitations under the License.
*/

jar.enabled = false
Copy link
Contributor

Choose a reason for hiding this comment

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

No changes needed, but it would be nice if the build didn't assume that every subdirectory is a java project.

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 know right? This is a result of us putting java in a subproject block. Gradle treats all directories as projects so all directories are Java!

Copy link
Contributor

@kirklund kirklund left a comment

Choose a reason for hiding this comment

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

I don't think org.apache.geode.cq is a good package name. We're moving these classes from org.apache.geode.cache.query.internal.cq and cq (Continuous Query) is a sub-feature of query. I think it should be:

org.apache.geode.cache.query.cq

@jake-at-work
Copy link
Contributor Author

jake-at-work commented Dec 6, 2018

@kirklund I tried to keep the package names, module names and project names consistent. I am up for any naming really but we need consistency that we don't have today. The rational for package org.apache.geode.cq is that fits with the Maven coordinate of org.apache.geode:geode-cq and the module name of org.apache.geode.cq.

So you are asking for classes in org.apache.geode.cache.query.internal.cq to move to org.apache.geode.cache.query.cq.internal?

I think over time what we will see then is that stuff in gemfire-core at org.apache.geode.cache.query.internal.cq should migrate to org.apache.geode.cache.query.cq.spi and things in geode-cq that implement those SPIs will move to org.apache.geode.cache.query.cq.impl or something like that.

Feels a little verbose but works for me I guess. What module name would you suggest?

Copy link
Member

@PurelyApplied PurelyApplied left a comment

Choose a reason for hiding this comment

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

Looks solid. My only real complaint is with the ext. in the gradles. Great cleanups throughout in addition to the moves.

@@ -91,7 +91,7 @@ If you are deploying an ear file:
lib/fastutil-7.0.2.jar
lib/geode-core-1.0.0.jar
lib/geode-json-1.0.0.jar
lib/javax.transaction-api-1.2.jar
lib/javax.transaction-api-1.3.jar
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 really know what this file is documenting, but every other version here is wildly out of date

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are the minimum changes to get modules working from a client. Yes other deps may be old but out of scope for this work.

"org.apache.geode.distributed.internal.tcpserver";
private static final String POST_GEODE_190_SERVER_CQIMPL =
"org.apache.geode.cq.internal.cache.query.ServerCQImpl";
private static final String PRE_GEODE_190_SERVER_CQIMPL =
Copy link
Member

Choose a reason for hiding this comment

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

Always love to see these simple sorts of cleanups.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

private String[] buildJavaCommand(int vmNum, int namingPort, String version) {
String cmd = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
String cmd = System.getProperty("java.home") + File.separator
+ "bin" + File.separator + "java";
Copy link
Member

Choose a reason for hiding this comment

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

Just a reminder that, by popular request, spotless will no longer remove extra whitespace within a line, even if the result will no longer exceed the 80-width limit. For instance, this line's diff isn't necessary for spotless (but I assume it was at some point during your iteration).

@@ -104,6 +104,8 @@ task createVersionPropertiesFile(dependsOn: ':writeBuildInfo') {
}
}

ext.moduleName = group + '.core'
Copy link
Member

Choose a reason for hiding this comment

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

I'm really not a fan of bloating out the ext in our project / subprojects. Is there a reason this shouldn't just be in-lined below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The modules "plugin" expects it project. It is consistent with the experimental plugin from Gradle. Eventually they will have first level support for 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.

Should also mention that it goes away completely with the upcoming module-info.java changes.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, makes sense and good to hear.

@@ -60,3 +60,12 @@ dependencies {

upgradeTestRuntime(project(':geode-old-versions'))
}

ext.moduleName = group + '.cq'
Copy link
Member

Choose a reason for hiding this comment

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

Ditto ext comment in core.

@kirklund
Copy link
Contributor

kirklund commented Dec 6, 2018

I forgot geode-cq is a module but geode-query is not [edited]. It still seems like cq is part of query(ing) though. We can't use org.apache.geode.cache.query.cq inside geode-cq? Or is that just convention? Would we ever create geode-query to contain org.apache.geode.cache.query and then geode-cq adds cq onto that?

I'm thinking that geode-core will eventually contain org.apache.geode.logging to contain our LogService and SPI for the LogWriter and Alert appenders (or even move that to geode-logging). Then geode-log4j would contain our default impls of that SPI which are the LogWriter and Alert appenders that are written with log4j-core. Then geode-core uses geode-logging and geode-log4j is an optional provider to the SPI in geode-logging. Or is that too many sub-modules (I'm new to modules!)?

So, my input on cq is based mainly on cq being something that builds on query. If org.apache.geode.cache.query.cq is ugly because of geode-cq or if we would never split out query to geode-query then my suggestion probably isn't very relevant. Either way I'll mark my request as resolved and let you decide which way to go.

[I edited the package names to include ".cache."]

Copy link
Contributor

@kirklund kirklund left a comment

Choose a reason for hiding this comment

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

See my latest comment on the PR itself.

@jake-at-work
Copy link
Contributor Author

jake-at-work commented Dec 6, 2018

@kirklund

We can't use org.apache.geode.cache.query.cq inside geode-cq? Or is that just convention?

Since packageorg.apache.geode.cache.query.cq is not in the geode-core module we could use that package in geode-cq module. It is convention to keep package, module and artifact names similar. There are certainly good reasons to deviate and plenty of examples in the wild where people have. I would be most inclined to keep the module name and artifact name in sync since that is what module automatic naming would do anyway. So artifact geode-cq.jar would be automatic module geode.cq. So for consistency I would just append the group name, minus redundancy, to get module org.apache.geode.cq. In doing that I lean towards keeping the root package name the same, but eh... I do feel like the cache part of o.a.geode.cache.cq is redundant though. What's he argument for cache?

Would we ever create geode-query to contain org.apache.geode.cache.query and then geode-cq adds cq onto that?

Maybe... We can alway refactor later if we do and it feels better to have cq someone logically grouped under query at that point. Having two modules that contain the same bits with different names would be fine as long as one and only one is on the module path at any time. You would simply stop including the deprecated on in the BOM.

I'm thinking that geode-core will eventually contain org.apache.geode.logging to contain our LogService and SPI for the LogWriter and Alert appenders (or even move that to geode-logging). Then geode-log4j would contain our default impls of that SPI which are the LogWriter and Alert appenders that are written with log4j-core. Then geode-core uses geode-logging and geode-log4j is an optional provider to the SPI in geode-logging. Or is that too many sub-modules (I'm new to modules!)?

No, that sounds perfect.

So, my input on cq is based mainly on cq being something that builds on query. If org.apache.geode.cache.query.cq is ugly because of geode-cq or if we would never split out query to geode-query then my suggestion probably isn't very relevant. Either way I'll mark my request as resolved and let you decide which way to go.

All valid thoughts. It would be good for us to get it right and not have to deprecate and refactor a module later.

I guess I could fall sort of in the middle. I wouldn't have the package name to deviate too far from the module name unless there is a really strong argument. To me the "cache" part feels redundant since Geode is the "cache". So I could see module and package name of o.a.geode.query.cq and deviating only in the artifact name not match at this point and remaining geode-cq. But in my mind adding the "query" part is redundant to the "cq" part and removing it makes all 3 names consistent. Hmmm...

Any additional thoughts before I flip a coin?

@kirklund
Copy link
Contributor

kirklund commented Dec 7, 2018

The difference between org.apache.geode.cache.query and org.apache.geode.query is fairly small but they are non-internal User APIs. So for fixing modularization I would lean away from changing the User packages -- or do so as little as possible. The impression I got on the dev-list was that we were just shuffling around internal packages without reshaping our non-internal User packages. You should probably be more explicit about exposing or altering User packages (especially on the dev-list). That's also why I was asking for org.apache.geode.cache.query.cq instead of org.apache.geode.cq -- because I feel like we're making a pretty permanent decision that impacts the User API/package for CQ. It'll be next to impossible to change that after Geode 1.9.0 releases.

@jake-at-work
Copy link
Contributor Author

@kirklund
No user facing public API packages are being altered in this PR. I think if I had to put my sticking point somewhere it would be on keeping module and artifact names consistent. I am less sticky on the package names inside the modules being consistent with the module name. There is precedent for that even in Java where they have packages javax.foo in modules named java.foo.

So lets do this:
Artifact: org.apache.geode:geode-cq (no change from previous releases)
Module: org.apache.geode.cq
Root package: org.apache.geode.cache.query.cq.internal

Yes?

@kirklund
Copy link
Contributor

kirklund commented Dec 7, 2018

Thumbs up! Already approved.

@jake-at-work jake-at-work merged commit 22a5017 into apache:develop Dec 7, 2018
@jake-at-work jake-at-work deleted the wip/modules-client branch December 7, 2018 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants