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

JAVA-2682: Create a Quarkus Cassandra extension #1

Merged
merged 44 commits into from
Apr 3, 2020
Merged

Conversation

tomekl007
Copy link
Contributor

No description provided.

@adutra
Copy link
Contributor

adutra commented Mar 29, 2020

General remark: I'm surprised by the general layout.

  1. Why do we need to inherit from JBoss parent POM?
  2. Why do we need a build-parent module, couldn't it be merged into the root POM?
  3. If poms/bom is the runtime BOM, can we name it bom-runtime for clarity?
  4. The runtime module is called cassandra-quarkus-client, shouldn't we rename it cassandra-quarkus-client-runtime for symmetry with cassandra-quarkus-client-deployment?
  5. Why do we need the intermediary cassandra-quarkus-extensions POM?
  6. Why is cassandra-quarkus-integration-tests a POM module with a child JAR module?
  7. Some properties are declared and only used in one place, I don't find it particularly useful and creates a level of indirection that makes it hard to understand the POMs.

I haven't looked more in detail but it seems that the general structure of the project could be much simpler.

poms/bom/pom.xml Outdated Show resolved Hide resolved
poms/bom/pom.xml Outdated Show resolved Hide resolved
@tomekl007
Copy link
Contributor Author

General remark: I'm surprised by the general layout.

  1. Why do we need to inherit from JBoss parent POM?
  2. Why do we need a build-parent module, couldn't it be merged into the root POM?
  3. If poms/bom is the runtime BOM, can we name it bom-runtime for clarity?
  4. The runtime module is called cassandra-quarkus-client, shouldn't we rename it cassandra-quarkus-client-runtime for symmetry with cassandra-quarkus-client-deployment?
  5. Why do we need the intermediary cassandra-quarkus-extensions POM?
  6. Why is cassandra-quarkus-integration-tests a POM module with a child JAR module?
  7. Some properties are declared and only used in one place, I don't find it particularly useful and creates a level of indirection that makes it hard to understand the POMs.

I haven't looked more in detail but it seems that the general structure of the project could be much simpler.

Overall, I wanted to mirror the structure from:

  1. quarkus and extensions are inheriting this JBoss parent so If we want to be compatible I think we should as well.
  2. The same situation - the quarkus project has dedicated build-parent module (and both extensions)
  3. It seems that in the quarkus, for the runtime the suffix is omitted. I think that it is because the deployment "contains" runtime so those dependencies are not only for runtime.
  4. It is the same situation - this is the naming pattern that I took from the quarkus repo.
  5. I think that we should unify it with quarkus and other extensions - for all of those, there is intermediary extensions module, and inside of it there are extensions (as a separate module, in our case it is cassandra-quarkus-extensions)
  6. Same as above.
  7. I can inline them, I don't have a preference here.

So I totally agree that it could be simplified, but If we want to be unified with quarkus repo, and other extensions, we should follow this structure. Please let me know what do you think.

…Item` and `JniRuntimeAccessBuildItem`. Set `TIMESTAMP_GENERATOR_FORCE_JAVA_CLOCK` to `true` because jnr is not supported
… to return always false. It will not call `Native.getProcessId` and JNR
…f to Native image, instead of additionalArgs in maven
@olim7t
Copy link

olim7t commented Mar 30, 2020

The runtime module is called cassandra-quarkus-client, shouldn't we rename it cassandra-quarkus-client-runtime for symmetry with cassandra-quarkus-client-deployment?

Omitting the suffix for the runtime module is a Quarkus naming convention, see the extension guide.

On that note, the Quarkus maven plugin has a create-extension goal to bootstrap a new extension, @tomekl007 did you use that to initialize the project? If not, we could at least check that the structure we use is consistent with what it would have generated.

EDIT - output of the Maven plugin (but I think it's intended for a project that already has the extensions/ module):

$ mvn io.quarkus:quarkus-maven-plugin:1.3.1.Final:create-extension -N \
    -Dquarkus.artifactIdBase=cassandra-client \
    -Dquarkus.groupId=com.datastax.oss \
    -Dquarkus.nameBase="Cassandra client" \
    -Dversion=1.0.0-SNAPSHOT
$ find cassandra-client -type f
cassandra-client/runtime/pom.xml
cassandra-client/pom.xml
cassandra-client/deployment/pom.xml
cassandra-client/deployment/src/main/java/com/datastax/oss/cassandra/client/deployment/CassandraClientProcessor.java

@tomekl007
Copy link
Contributor Author

The runtime module is called cassandra-quarkus-client, shouldn't we rename it cassandra-quarkus-client-runtime for symmetry with cassandra-quarkus-client-deployment?

Omitting the suffix for the runtime module is a Quarkus naming convention, see the extension guide.

On that note, the Quarkus maven plugin has a create-extension goal to bootstrap a new extension, @tomekl007 did you use that to initialize the project? If not, we could at least check that the structure we use is consistent with what it would have generated.

EDIT - output of the Maven plugin (but I think it's intended for a project that already has the extensions/ module):

$ mvn io.quarkus:quarkus-maven-plugin:1.3.1.Final:create-extension -N \
    -Dquarkus.artifactIdBase=cassandra-client \
    -Dquarkus.groupId=com.datastax.oss \
    -Dquarkus.nameBase="Cassandra client" \
    -Dversion=1.0.0-SNAPSHOT
$ find cassandra-client -type f
cassandra-client/runtime/pom.xml
cassandra-client/pom.xml
cassandra-client/deployment/pom.xml
cassandra-client/deployment/src/main/java/com/datastax/oss/cassandra/client/deployment/CassandraClientProcessor.java

Yes, I was using that, but exactly what you wrote " I think it's intended for a project that already has the extensions/ module", also this is intended only for extensions that are in the quarkus repo and rely on the structure that it's in that repo, so we cannot use it for our case.

@tomekl007 tomekl007 requested review from adutra and olim7t April 2, 2020 09:31
@adutra
Copy link
Contributor

adutra commented Apr 2, 2020

To reviewers: I pushed a few commits:

  1. Project structure was simplified a bit more, you may need to reimport the project in your IDE, my apologies for the trouble.
  2. Integration tests now run in the right Maven phase.
  3. If you want to run the native tests, do mvn clean verify -Dnative. Make sure you have GRAALVM_HOME set.

import com.oracle.svm.core.annotate.TargetClass;

@TargetClass(Native.class)
final class NativeSubstitutions {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm musing a bit here... do we want to include isCurrentTimeMicrosAvailable() here as well (with a constant return value of false) until we get the native stuff sorted out? We're side-stepping the issue entirely now by forcing the use of a Java clock but my thought was that that's an indirect consequence of not having native support.

On the other hand that clock is the only consumer of this functionality... so I can see a counter-argument which says adding it here is just one more thing we have to unset/change when we want to confirm native functionality is fine.

I guess I could go either way here.

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 will improve it - see my comments here:
https://datastax-oss.atlassian.net/browse/JAVA-2696
I think that Substitutions should be used only if there is no other way to tackle the problem.
For the isCurrentTimeMicrosAvailable we have force_java_clock setting so it should be ok to use it.

Copy link
Contributor

@absurdfarce absurdfarce left a comment

Choose a reason for hiding this comment

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

While working on other things I wasn't closely following the earlier conversations around simplifying the overall structure. But what we have now looks entirely reasonable to me; it seems like a robust skeleton on which we can base future work. All of my comments reflect future work; I don't see anything which prevents us from merging this PR now, especially since this is pretty foundational code.

@tomekl007 tomekl007 merged commit bffecaf into master Apr 3, 2020
@tomekl007
Copy link
Contributor Author

All pending comments were addressed as separate JIRA tickets, see:
https://datastax-oss.atlassian.net/browse/JAVA-2681

@tomekl007 tomekl007 deleted the java2682 branch April 3, 2020 07:46
absurdfarce pushed a commit that referenced this pull request Mar 24, 2023
* Set version to 1.2.0-alpha1-SNAPSHOT

* Upgrade to Quarkus 3.0.0.Alpha4

* Bulk replace javax.* with jakarta.*

* Update Mutiny code for Quarkus 3

* Add missing Override annotations

* Update to Quarkus 3.0.0.Beta1 (#1)

Co-authored-by: Madhavan Sridharan <madhavan.sridharan@datastax.com>

---------

Co-authored-by: Madhavan <msmygit@users.noreply.github.com>
Co-authored-by: Madhavan Sridharan <madhavan.sridharan@datastax.com>
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.

4 participants