# Using `TiDB Lightning`: Prechecks

+ Precheck is enabled by default
+ Check items:
  + Cluster version and status
  + Permissions to access Cloud object storage services if any
  + Disk space by sampling the data source
  + Region distribution status
    + Check whether the Regions in the TiKV cluster are distributed evenly and whether there are too many empty Regions.
  + Exceedingly large (`10 GB`) `CSV` data source check
  + Resumable import by recovering from breakpoints check
  + Import into existing tables check
  + Empty target table check

-------------------------------------------------------------
Precheck contains following check items:

- Check whether the cluster can be connected in the configuration, and whether the `TiKV/PD/TiFlash`version supports the physical import mode.

- When the data source is `cloud` storage (`Amazon S3`), check whether `TiDB Lightning` has the necessary permissions and make sure that the import will not fail due to lack of permissions.

- Check whether there is enough space on the local disk and on the `TiKV` cluster for importing data. `TiDB Lightning` samples the data sources and estimates the percentage of the index size from the sample result. Because indexes are included in the estimation, there might be cases where the size of the source data is less than the available space on the local disk, but still, the check fails. In the physical import mode, `TiDB Lightning` also checks whether the local storage is sufficient because external sorting needs to be done locally. For more details about the `TiKV` cluster space and local storage space (controlled by `sort-kv-dir`).

- Check whether the `Regions` in the `TiKV` cluster are distributed evenly and whether there are too many empty `Regions`. If the number of empty `Regions` exceeds max(`1000`, number of tables * `3`), `i.e.` greater than the bigger one of "`1000`" or "3 times the number of tables ", then the import cannot be executed.

- When there are `CSV` files larger than `10 GiB` in the backup file and auto-slicing is not enabled (`StrictFormat=false`), it will impact the import performance. The purpose of this check is to remind you to ensure the data is in the right format and to enable auto-slicing.

- This check ensures that no changes are made to the source file or schema in the database during the breakpoint recovery process that would result in importing the wrong data.

- When importing into an already created table, it checks, as much as possible, whether the source file matches the existing table. Check if the number of columns matches. If the source file has column names, check if the column names match. When there are default columns in the source file, it checks if the default columns have Default Value, and if they have, the check passes.

- `TiDB Lightning` automatically exits with an error if the target table is not empty. If parallel import mode is enabled (`incremental-import = true`), this check item will be skipped.