Skip to content

Conversation

@morningman
Copy link
Contributor

@morningman morningman commented Oct 7, 2020

Proposed changes

Support persistence of configuration items modified at runtime via HTTP API.

FE:
GET /api/_set_config?key=value&persist=true

BE
POST /api/update_config?key=value&persist=true

The modified config will be saved in fe_custom.conf or be_custom.conf.
And when process starts, it will load fe.conf/be.conf first, then fe_custom.conf/be_custom.conf.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

@morningman morningman added kind/feature Categorizes issue or PR as related to a new feature. area/config Issues or PRs related to configuration labels Oct 7, 2020
@morningman morningman self-assigned this Oct 7, 2020
std::ofstream out(conffile);
out << "# THIS IS AN AUTO GENERATED CONFIG FILE.\n";
out << "# You can modify this file manually, and the configurations in this file\n";
out << "# will overwrite the configurations in fe.conf\n";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
out << "# will overwrite the configurations in fe.conf\n";
out << "# will overwrite the configurations in be.conf\n";

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

// So the number of query params should at most be 2.
if (req->params()->size() > 2 || req->params()->size() < 1) {
s = Status::InvalidArgument("");
msg = "Now only support to set a single config once, via 'config_name=new_value'";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should also describe the optional parameter persist in error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

} else if (req->params()->size() == 2) {
if (req->params()->find(PERSIST_PARAM) == req->params()->end()) {
s = Status::InvalidArgument("");
msg = "Now only support to set a single config once, via 'config_name=new_value'";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok


This document mainly introduces the relevant configuration items of BE.

The BE configuration file `be.conf` is usually stored in the `conf/` directory of the BE deployment path. In version 0.14, another configuration file `be_custom.conf` will be introduced. The configuration file is used to record the configuration items that are dynamically configured and persisted by the user during operation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... is used for recording ... ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is translated by Google Translator... So, I think it is correct ^^

**Configuration items modified in this way will become invalid after the BE process restarts. **
```
curl -X POST http://{be_ip}:{be_http_port}/api/update_config?{key}={value}&persis=true'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
curl -X POST http://{be_ip}:{be_http_port}/api/update_config?{key}={value}&persis=true'
curl -X POST http://{be_ip}:{be_http_port}/api/update_config?{key}={value}&persist=true'

在 0.13 版本及之前,通过该方式修改的配置项将在 BE 进程重启后失效。在 0.14 及之后版本中,可以通过以下命令持久化修改后的配置。修改后的配置项存储在 `be_custom.conf` 文件中。

```
curl -X POST http://{be_ip}:{be_http_port}/api/update_config?{key}={value}&persis=true'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
curl -X POST http://{be_ip}:{be_http_port}/api/update_config?{key}={value}&persis=true'
curl -X POST http://{be_ip}:{be_http_port}/api/update_config?{key}={value}&persist=true'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

}

try (FileOutputStream fos = new FileOutputStream(file)) {
props.store(fos, "THIS IS AN AUTO GENERATED CONFIG FILE. DO NOT EDIT IT!\n\n" +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think users can edit this file if they need to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

yangzhg
yangzhg previously approved these changes Oct 20, 2020
Copy link
Member

@yangzhg yangzhg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@morningman morningman added the approved Indicates a PR has been approved by one committer. label Oct 20, 2020
@morningman morningman requested a review from yangzhg October 20, 2020 16:02
Copy link
Member

@yangzhg yangzhg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@morningman morningman merged commit 0213e93 into apache:master Oct 22, 2020
@yangzhg yangzhg mentioned this pull request Feb 9, 2021
Hastyshell pushed a commit to Hastyshell/doris that referenced this pull request Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. area/config Issues or PRs related to configuration kind/feature Categorizes issue or PR as related to a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proposal] Support persistence of configuration items modified at runtime

5 participants