# `sync-diff-inspector` Output Files

+ **`output-dir:`** Output files are saved under output directory specified by **`output-dir`** parameter under `Task Config` 
+ **`sync_diff.log:`** Log file
+ **`sync_diff_checkpoints.pb:`** Task progress will be updated every 10 seconds to this checkpoint file
+ **`summary.txt:`** Result file
+ **`SQL scripts under fix-on-{target}:`** `SQL` statements to fix inconsistent data in downstream target 

```
~!@output/@!~
|-- checkpoint
| |-- {config_hash}
│ |-- DO_NOT_EDIT_THIS_DIR
│ └-- sync_diff_checkpoints.pb
|
|-- fix-on-{target}
| |-- xxx.sql
| |-- xxx.sql
| └-- xxx.sql
|
|-- summary.txt
└-- sync_diff.log
```
-------------------------------------------------------------
Log
- The log of `sync-diff-inspector` is saved in `${output}/sync_diff.log`, among which `${output}` is the value of `output-dir` in the `config.toml` file.

Progress
- The running `sync-diff-inspector` periodically (every 10 seconds) prints the progress in checkpoint, which is located at `${output}/checkpoint/sync_diff_checkpoints.pb`, among which `${output}` is the value of `output-dir` in the `config.toml` file.

Result
- After the check is finished, `sync-diff-inspector` outputs a report. It is located at `${output}/summary.txt`, and `${output}` is the value of `output-dir` in the `config.toml file`.
    - `TABLE:` The corresponding database and table names
    - `STRUCTURE EQUALITY:` Checks whether the table structure is the same
    - `DATA DIFF ROWS:` `rowAdd/rowDelete` indicates the number of rows that need to be `added/deleted` to fix the table

SQL statements to fix inconsistent data
- If different rows exist during the data checking process, the `SQL` statements will be generated to fix them. If the data inconsistency exists in a chunk, a `SQL` file named by chunk.Index will be generated. The SQL file is located at `${output}/fix-on-${instance}`, and `${instance}` is the value of `task.target-instance` in the `config.toml` file.
- A `SQL` file contains the tale to which the chunk belong and the range information. For the `SQL` files, you should consider the following three situations:
    - If the rows in the downstream database are missing, `REPLACE` statements will be applied
    - If the rows in the downstream database are redundant, `DELETE` statements will be applied
    - If some data of the rows in the downstream database is inconsistent, `REPLACE` statements will be applied and inconsistent columns will be marked with annotation in the `SQL` file