# Backup Files Generated by `BR`

+ Backup output files
  + `SST` files: Stores the data that the `TiKV` node backs up
    + Naming for `Amazon S3` and local storage: **`{storeIDasPrefix}/{regionID}-{regionEpoch}-{keyHash}-{timestamp}-{cf}.sst`**
    + Naming for other storage: **`{storeID}-{regionID}-{regionEpoch}-{keyHash}-{timestamp}-{cf}.sst`**
  + `backupmeta`: Stores the metadata of a backup operation
  + `backup.lock`: Prevents multiple backup operations from storing data to the same directory

```
~!@// Non Amazon S3@!~
.
└── 20220621
    ├── backupmeta
    |—— backup.lock
    ├── {storeID}-{regionID}-{regionEpoch}-{keyHash}-{timestamp}-{cf}.sst
    ├── {storeID}-{regionID}-{regionEpoch}-{keyHash}-{timestamp}-{cf}.sst
    └── {storeID}-{regionID}-{regionEpoch}-{keyHash}-{timestamp}-{cf}.sst
```
```
~!@// Amazon S3@!~
.
└── 20220621
    ├── backupmeta
    |—— backup.lock
    ├── store1
    │   └── {regionID}-{regionEpoch}-{keyHash}-{timestamp}-{cf}.sst
    ├── store100
    │   └── {regionID}-{regionEpoch}-{keyHash}-{timestamp}-{cf}.sst
    ├── store2
    │   └── {regionID}-{regionEpoch}-{keyHash}-{timestamp}-{cf}.sst
    └── store3
```
---------------------------------------------------------------------------
The following file types will be generated by `BR`:
- `SST` file: Stores data information backed up by `TiKV`.
- `backupmeta` file: Stores the metadata of this backup, including the number of backup files, the key interval of the backup file, the backup file size, and the backup file hash `(sha256)` value.
- `backup.lock` file: Used to prevent multiple backups to the same directory.

Naming format of `SST` files:
When data is backed up to `Cloud` object storage, `SST` files are named in the format of `{storeID-regionID-regionEpoch-keyHash-timestamp-cf}`. And, when data is backed up to `Amazon S3` or a network disk, the `SST` files are named in the format of `{regionID-regionEpoch-keyHash-timestamp-cf}`.The fields in the format are explained as follows:
- `storeID` is the `TiKV` node ID.
- `regionID` is the `Region` ID.
- `regionEpoch` is the version number of a `Region`.
- `keyHash` is the Hash (`sha256)` value of the `startKey` of a range, which ensures the uniqueness of a key.
- `timestamp` is the `Unix` timestamp of an `SST` file when it is generated at `TiKV`.
- `cf` indicates the `Column Family` of `RocksDB` (`default` or `write` by default).