File Manager
- BDBJE: Oracle Berkeley DB Java Edition. Distributed embedded database for persistent metadata in FE.
Basic concepts
Files are files created and saved by users in Doris.
A file is located by , catalog
, file_name
. At the same time, each file also has a globally unique ID (file_id), which serves as the identification in the system.
File creation and deletion can only be performed by users with admin
privileges. A file belongs to a database. Users who have access to a database (queries, imports, modifications, etc.) can use the files created under the database.
File management has three main commands: CREATE FILE
, SHOW FILE
and DROP FILE
, creating, viewing and deleting files respectively. The specific syntax of these three commands can be viewed by connecting to Doris and executing .
This statement is used to create and upload a file to the Doris cluster. For details, see CREATE FILE.
This statement can view the files that have been created successfully. For details, see SHOW FILE.
Examples:
This statement can view and delete an already created file. For specific operations, see DROP FILE.
Examples:
Implementation details
When the user executes the CREATE FILE
command, FE downloads the file from a given URL. The contents of the file are stored in FE memory directly in the form of Base64 encoding. At the same time, the file content and meta-information related to the file will be persisted in BDBJE. All created files, their meta-information and file content reside in FE memory. If the FE goes down and restarts, meta information and file content will also be loaded into memory from the BDBJE. When a file is deleted, the relevant information is deleted directly from FE memory and persistent information is deleted from BDBJE.
If the BE side needs to use the created file, BE will download the file content to the specified directory on BE through FE’s HTTP interface api/get_small_file
for use. At the same time, BE also records the information of the files that have been downloaded in memory. When BE requests a file, it first checks whether the local file exists and verifies it. If the validation passes, the local file path is returned directly. If the validation fails, the local file is deleted and downloaded from FE again. When BE restarts, local files are preloaded into memory.
Because the file meta-information and content are stored in FE memory. So by default, only files with size less than 1MB can be uploaded. And the total number of files is limited to 100. The configuration items described in the next section can be modified.
Relevant configuration
- FE configuration
Small_file_dir
: The path used to store uploaded files, defaulting to thesmall_files/
directory of the FE runtime directory.max_small_file_size_bytes
: A single file size limit in bytes. The default is 1MB. File creation larger than this configuration will be rejected.max_small_file_number
: The total number of files supported by a Doris cluster. The default is 100. When the number of files created exceeds this value, subsequent creation will be rejected.
- BE configuration
Small_file_dir
: The path used to store files downloaded from FE by default is in thelib/small_files/
directory of the BE runtime directory.
For more detailed syntax and best practices used by the file manager, see , DROP FILE and command manual, you can also enter HELP CREATE FILE
, HELP DROP FILE
and in the MySql client command line to get more help information.