Skip to content

Conversation

@yaooqinn
Copy link
Member

What changes were proposed in this pull request?

Log error/warn message only once at the server-side for both sync and async modes

Why are the changes needed?

In b151194 we make the error logging for SparkExecuteStatementOperation with runInBackground=true not duplicated, but the operations with runInBackground=false and other metadata operation still will be log twice which happened in the operation's runInternal method and ThriftCLIService.

In this PR, I propose to reflect the logic to get a unified error handling approach.

Does this PR introduce any user-facing change?

Yes, when spark.sql.hive.thriftServer.async=false and people call sync APIs the error message will be logged only once at server-side.

How was this patch tested?

locally verified the result in target/unit-test.log

add unit tests.

@SparkQA
Copy link

SparkQA commented Jul 23, 2020

Test build #126411 has finished for PR 29204 at commit 91e8f28.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

}
previousFetchEndOffset = resultOffset
log.info(s"Returning result set with ${curRow} rows from offsets " +
logInfo(s"Returning result set with ${curRow} rows from offsets " +
Copy link
Contributor

Choose a reason for hiding this comment

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

is log.info and logInfo the same?

Copy link
Member Author

Choose a reason for hiding this comment

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

logInfo will check log.isInfoEnabled

throw new HiveSQLException("The background threadpool cannot accept" +
" new task for execution, please retry the operation", rejected)
case NonFatal(e) =>
logError(s"Error executing query in background", e)
Copy link
Contributor

@cloud-fan cloud-fan Jul 23, 2020

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, we can keep this.

@SparkQA
Copy link

SparkQA commented Jul 24, 2020

Test build #126463 has finished for PR 29204 at commit 2726f48.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor

cc @juliuszsompolski

@SparkQA
Copy link

SparkQA commented Jul 24, 2020

Test build #126479 has finished for PR 29204 at commit 5663f98.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yaooqinn
Copy link
Member Author

retest this please

@SparkQA
Copy link

SparkQA commented Jul 27, 2020

Test build #126606 has finished for PR 29204 at commit 5663f98.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

protected def sqlContext: SQLContext

protected var statementId = getHandle().getHandleIdentifier().getPublicId().toString()
protected val statementId: String = getHandle.getHandleIdentifier.toString
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we revert this change? I see places that use statementId = UUID.randomUUID().toString. It's better to have a separated PR to unify this part.

Copy link
Member Author

Choose a reason for hiding this comment

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

HandleIdentifer.publicId is actually UUID.randomUUID() too

Copy link
Member Author

Choose a reason for hiding this comment

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

I will revert this change in this pr

@SparkQA
Copy link

SparkQA commented Jul 27, 2020

Test build #126622 has finished for PR 29204 at commit dae9bec.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

throw new HiveSQLException("The background threadpool cannot accept" +
" new task for execution, please retry the operation", rejected)
case _ =>
val tips = if (shouldRunAsync()) "in background" else ""
Copy link
Contributor

Choose a reason for hiding this comment

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

val tips = if (shouldRunAsync()) " in background" else "" and ...$getType$tips ${e.getMessage}, to avoid extra space.

@SparkQA
Copy link

SparkQA commented Jul 27, 2020

Test build #126633 has finished for PR 29204 at commit 5011314.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yaooqinn
Copy link
Member Author

gentle ping @cloud-fan

@cloud-fan
Copy link
Contributor

thanks, merging to master!

@cloud-fan cloud-fan closed this in 510a165 Jul 30, 2020
" new task for execution, please retry the operation", rejected)
case _ =>
val tips = if (shouldRunAsync()) " in background" else ""
throw new HiveSQLException(s"Error operating $getType$tips: ${e.getMessage}", e)
Copy link
Contributor

Choose a reason for hiding this comment

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

it looks like we missed some details:

  1. Shall we expose the internal details (getType) to users or just say Error running query:?
  2. Shall we include the full exception string (e.toString like https://github.com/apache/spark/pull/29204/files#diff-72dcd8f81a51c8a815159fdf0332acdcL316), not just the message?

Since the PR is small, can we revert and resend it after proper discussion?

Copy link
Member

Choose a reason for hiding this comment

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

+1

cloud-fan pushed a commit that referenced this pull request Aug 25, 2020
…er operations"

### What changes were proposed in this pull request?

This reverts commit 510a165.

### Why are the changes needed?

see #29204 (comment)

### Does this PR introduce _any_ user-facing change?

NO

### How was this patch tested?

pass ci tools

Closes #29531 from yaooqinn/revert.

Authored-by: Kent Yao <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants