tidb icon indicating copy to clipboard operation
tidb copied to clipboard

lightning: refine the error message of lightning `DiskQuota` precheck

Open joechenrh opened this issue 6 months ago • 7 comments

Enhancement

Currently, during the precheck phase, if the disk capacity is less than disk quota, precheck will failed. But the error message is a bit misleading:

+----+------------------------------------------------------------------------------------------------------------------------------------+-------------+--------+
|  6 | local disk space may not enough to finish import, estimate sorted data size is XXX, but local available is XXX, please s | critical    | false  |
|    | et `tikv-importer.disk-quota` to a smaller value than XXX or change `mydumper.sorted-kv-dir` to another disk with enough spac |             |        |
|    | e to finish imports                                                                                                                |             |        |                                                                                                             |             |        |
+----+------------------------------------------------------------------------------------------------------------------------------------+-------------+--------+

This check has nothing to do with estimated sorted size, but it's outputed at the beginning of the error message. If users don't read the error message carefully, they may misunderstand it.

https://github.com/pingcap/tidb/blob/0d8e2bb4c57ecfaaee14a42a693f9e41f34cda34/lightning/pkg/importer/precheck_impl.go#L591-L598

joechenrh avatar Jun 06 '25 03:06 joechenrh

/cc @alastori @OliverS929

joechenrh avatar Jun 06 '25 03:06 joechenrh

Please include "Lightning: xxx" in issue title please. Thanks!

OliverS929 avatar Jun 06 '25 05:06 OliverS929

Hey, I'd like to take this on, can someone assign it to me.

abrarr21 avatar Jun 06 '25 07:06 abrarr21

Hey, I'd like to take this on, can someone assign it to me.

Hi, the fix itself is simple, but I thinks we need to discuss with PM about the output.

joechenrh avatar Jun 06 '25 08:06 joechenrh

@joechenrh Got it, thanks! I’ve already made the proposed changes locally — updated the error message for clarity, and also added a warning log in case tikv-importer.disk-quota is set to 0 or a negative value (which could cause misleading results). Happy to wait for the PM’s input before opening a PR.

abrarr21 avatar Jun 06 '25 11:06 abrarr21

Hi @abrarr21, @alastori is our PM on migration tools and we would need him to help us define user-related behavior and error messages.

OliverS929 avatar Jun 11 '25 04:06 OliverS929

Hi @abrarr21,

Thank you for your initiative on this and for patiently waiting for feedback. I agree with your proposed changes.

Here is my suggestion for the new error message:

"Local disk space is insufficient to meet the configured disk-quota. Available space: [actual available space], Configured disk-quota: [configured quota value]. Please increase the available disk space or adjust the tikv-importer.disk-quota setting to a value lower than the available space and try again."

Regarding the warning for when tikv-importer.disk-quota is set to 0 or a negative value, I think that's a great idea. Please include that in the pull request, and we can review the specific implementation and wording there.

We appreciate your contribution! Please proceed with creating the PR when you are ready.

alastori avatar Jun 18 '25 00:06 alastori

@joechenrh @OliverS929 Review the changes and provide the feedback!

abrarr21 avatar Jun 18 '25 19:06 abrarr21