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: HiveEngineConn supports concurrency.(#4175) #4359

Conversation

CharlieYan24
Copy link
Contributor

What is the purpose of the change

HiveEngineConn supports concurrency.

Related issues/PRs

Related issues: #4175

Brief change log

  • Define the core class HiveEngineConcurrentConnExecutor which implements ConcurrentComputationExecutor interface to support concurrency.
  • Define the class HiveExecutionContextPropertyPrepareHook to pre prepare properties to use before execute code.
  • Modify class HiveEngineConnFactory createEngineConnSession method ,if hive engine support concurrent, hive session should init during execute code.

Checklist

  • I have read the Contributing Guidelines on pull requests.
  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the Linkis mailing list first)
  • If this is a code change: I have written unit tests to fully verify the new behavior.

@@ -40,4 +40,11 @@ object HiveEngineConfiguration {
).getValue

val HIVE_ENGINE_TYPE = CommonVars[String]("wds.linkis.hive.engine.type", "mr").getValue

val HIVE_ENGINE_CONCURRENT_LIMIT =
CommonVars[Int]("wds.linkis.hive.engineconn.concurrent.limit", 10).getValue
Copy link
Contributor

Choose a reason for hiding this comment

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

The new parameter can remove the wds prefix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok ,i will remove wds prefix, thanks for your remind.

@@ -34,6 +34,12 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis-common</artifactId>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this import necessary? I saw it was fine before

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 ,I forgot to revert it. I' ll fix it.

val options = engineCreationContext.getOptions
// if hive engine support concurrent, hive session should init later
if (HiveEngineConfiguration.HIVE_ENGINE_CONCURRENT_SUPPORT) {
return null
Copy link
Contributor

Choose a reason for hiding this comment

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

This should return a concurrent session better, so that newExecutor can case the new session and keep the case _

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea !

.toMap
var engineConnConf =
Map("ticketId" -> engineCreationContext.getTicketId, "user" -> engineCreationContext.getUser)
engineConnConf = engineConnConf ++: labels
Copy link
Contributor

Choose a reason for hiding this comment

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

labels can remove?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

labels can be remove ,thanks for your kind advice.

LOG.info(
s"beforeExecutorExecute engineExecutionContext addProperty key: ${kv._1} value: ${kv._2}"
)
engineExecutionContext.addProperty(kv._1, kv._2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the priority of engineExecutionContext higher than engineCreationContext?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Finally i reuse the hive session and remove the following class :HiveExecutionContextPropertyPrepareHook.scala.

…rent

* dev-1.4.0:
  support map string value (apache#4409)
  Improve exception information and add path information (apache#4351)
  [fix bug] The s3a file cannot be written because FileSystem is closed prematurely (apache#4375)
  Optimization of upload file interface in FsRestfulApi.java (apache#4357)
@CharlieYan24 CharlieYan24 force-pushed the dev-1.4.0-HiveEngineConn-support-concurrent branch from 1727f83 to ecdf1c6 Compare March 28, 2023 13:52
Copy link
Contributor

@peacewong peacewong left a comment

Choose a reason for hiding this comment

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

LGTM.

CommonVars[Int]("linkis.hive.engineconn.concurrent.limit", 10).getValue

val HIVE_ENGINE_CONCURRENT_SUPPORT =
CommonVars[Boolean]("linkis.hive.engineconn.concurrent.support", true).getValue
Copy link
Contributor

Choose a reason for hiding this comment

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

The first version is recommended to be set to false first, and then adjusted to the default concurrent execution

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your advice, I would change the default value to 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.

The first version is recommended to be set to false first, and then adjusted to the default concurrent execution

I have already changed the default linkis.hive.engineconn.concurrent.support value to false.

Copy link
Contributor

Choose a reason for hiding this comment

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

Get

Copy link
Contributor

@peacewong peacewong left a comment

Choose a reason for hiding this comment

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

LGTM.

@peacewong peacewong merged commit 6d1eed1 into apache:dev-1.4.0 Mar 29, 2023
5 of 7 checks passed
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.

None yet

3 participants