# Using TiDB Lightning - Precheck

__*Using Lightning*__
__*Lightning precheck*__

+ Whether the cluster version/status is normal
+ Whether you have permission to read data
+ Is there enough space for the import
+ Region distribution status
+ Does the data file have a large CSV file
+ Is it possible to recover from a breakpoint
+ Is it possible to import data into an existing data table
+ Whether the target table to be imported is empty

-------------------------------------------------------------
1. Whether the cluster version/status is normal
Check if the cluster is reachable in the configuration, and if the back-end mode is Local, check whether the TikV/PD/TiFlash version supports Local import mode.
2. Whether you have permission to read data
When reading data from cloud storage (Amazon S3), check if there are corresponding privilege to ensure that the import is not interrupted due to missing privilege.
3. Is there enough space for the import
Check if the TiKV cluster has enough space to import data. The data source is sampled during the inspection, and the index size ratio is estimated from the sampling results. Because indexes are taken into account in the estimate, there may be cases where the data source size is smaller than the available space on the local disk but fails the detection. When the backend is Local, it also checks if the local storage is sufficient because external sorting is required locally.
4. Region distribution status
Check whether the region distribution of the TiKV cluster is uniform and whether there are a large number of empty regions. If the number of empty regions is greater than max (1000, the number of tables* 3), that is, the larger of "1000" and "3 times the number of tables", TiDB Lightning Unable to perform the import.
5. Does the data file have a large CSV file
When a CSV file larger than 10 GiB is present in the backup file and cannot be automatically split (StrictFormat=false), the import performance will degrade. The purpose of this check is to remind the user to turn on the automatic CSV segmentation function if the data format is ensured.
6. Is it possible to recover from a breakpoint
This check ensures that the schema in the source file and database are not modify during breakpoint recover, causing incorrect data to be imported.
7. Is it possible to import data into an existing data table
When importing into a data table that has already been created, the check checks to see if the source file for this import matches the existing data table as much as possible. Checks if the number of columns matches, and if column names exist in the source file, the column names match. If a default column exists in the source file, checks if the default column has a Default Value in the data table, and if so, passes.
8. Whether the target table to be imported is empty
If the target table of the import is not empty, TiDB Lightning will automatically abort with an error; if the parallel import mode is enabled (incremental-import = true), this check item is skipped.