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

feat(connector): init embedded connector node #12122

Merged
merged 56 commits into from
Sep 12, 2023

Conversation

chenzl25
Copy link
Contributor

@chenzl25 chenzl25 commented Sep 6, 2023

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.

What's changed and what's your intention?

  • Initialize a JVM to run a embedded connector node in compute nodes and meta nodes.
  • Environment variable CONNECTOR_LIBS_PATH needs to be specified to tell the JVM where to load connector libs.
  • After initializing the JVM, we will register native methods for it.
  • In this PR, only one RPC GetEventStream is replaced with JNI. See more details in the codes.
  • Related issue Tracking: embedded connector node #12090

Checklist

  • I have written necessary rustdoc comments
  • I have added necessary unit tests and integration tests
  • I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934).
  • My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
  • All checks passed in ./risedev check (or alias, ./risedev c)
  • My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)
  • My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

  • My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note

If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

Copy link
Contributor

@StrikeW StrikeW left a comment

Choose a reason for hiding this comment

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

Rest LGTM

src/jni_core/src/lib.rs Show resolved Hide resolved
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has totally checked 4080 files.

Valid Invalid Ignored Fixed
1800 1 2279 0
Click to see the invalid file list
  • java/java-binding/src/main/java/com/risingwave/java/binding/CdcJniChannel.java

@chenzl25 chenzl25 requested a review from wenym1 September 8, 2023 09:30
…cJniChannel.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@chenzl25
Copy link
Contributor Author

chenzl25 commented Sep 8, 2023

cc @arkbriar In this PR, we introduce CONNECTOR_LIBS_PATH and JVM_HEAP_SIZE two environment variables.

  • CONNECTOR_LIBS_PATH needs to be specified to tell the JVM where to load connector libs. IIRC, it should be set to /risingwave/bin/connector-node/libs/ for our cloud development.

  • JVM_HEAP_SIZE needs to be specified to restrict the max heap size for the JVM. it could be any string or number accepted by the JVM -Xmx argument.

Copy link
Contributor

@wenym1 wenym1 left a comment

Choose a reason for hiding this comment

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

Rest LGTM!

@arkbriar
Copy link
Contributor

arkbriar commented Sep 11, 2023

cc @arkbriar In this PR, we introduce CONNECTOR_LIBS_PATH and JVM_HEAP_SIZE two environment variables.

  • CONNECTOR_LIBS_PATH needs to be specified to tell the JVM where to load connector libs. IIRC, it should be set to /risingwave/bin/connector-node/libs/ for our cloud development.
  • JVM_HEAP_SIZE needs to be specified to restrict the max heap size for the JVM. it could be any string or number accepted by the JVM -Xmx argument.

Sounds great! Two questions:

  1. Will the CONNECTOR_LIBS_PATH be shipped with the image?
  2. Is there any recommended value for JVM_HEAP_SIZE? e.g., is there a minimum requirement?

Copy link
Contributor

@wenym1 wenym1 left a comment

Choose a reason for hiding this comment

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

LGTM!

@chenzl25
Copy link
Contributor Author

Will the CONNECTOR_LIBS_PATH be shipped with the image?

I got what you mean. We can set CONNECTOR_LIBS_PATH to /risingwave/bin/connector-node/libs/ in the dockerfile, so we don't need to set it in the k8s yaml, right?

Is there any recommended value for JVM_HEAP_SIZE? e.g., is there a minimum requirement?

If we don't set it explicitly, it would use 10% of total memory by default. I think a value between 10%-20% looks good to me. As for the minimum requirement, I think 256m is enough.

@chenzl25 chenzl25 added this pull request to the merge queue Sep 11, 2023
@chenzl25 chenzl25 removed this pull request from the merge queue due to a manual request Sep 11, 2023
Comment on lines +67 to +68
# Set default connector libs path
ENV CONNECTOR_LIBS_PATH /risingwave/bin/connector-node/libs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add default CONNECTOR_LIBS_PATH to the Dockerfile.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do I miss any other Dockerfiles? cc @fuyufjh @BugenZhao

Copy link
Member

Choose a reason for hiding this comment

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

AFAIK this is the only one

Comment on lines +91 to +92
# Set default connector libs path
ENV CONNECTOR_LIBS_PATH /risingwave/bin/connector-node/libs
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add default CONNECTOR_LIBS_PATH to the Dockerfile.

Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC, opandal also uses jni to start a jvm when supporting hdfs access. May need to test whether it will conflict with the embedded connector node. cc @wcy-fdu

@@ -151,24 +151,33 @@ where

let channel_ptr = Box::into_raw(tx) as i64;
Copy link
Contributor

Choose a reason for hiding this comment

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

For current code, we don't even need wrapping the channel with box, since the tx variable is dropped after the method is called. We can pass channel_ptr as &tx as *const Sender as i64.

@chenzl25 chenzl25 enabled auto-merge September 12, 2023 08:01
@chenzl25 chenzl25 added this pull request to the merge queue Sep 12, 2023
Merged via the queue into main with commit 62901e1 Sep 12, 2023
7 of 8 checks passed
@chenzl25 chenzl25 deleted the dylan/init_embedded_connector_node branch September 12, 2023 10:55
Li0k pushed a commit that referenced this pull request Sep 15, 2023
Co-authored-by: Eric Fu <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
StrikeW added a commit that referenced this pull request Sep 25, 2023
StrikeW added a commit that referenced this pull request Oct 6, 2023
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.

6 participants