-
Notifications
You must be signed in to change notification settings - Fork 1.3k
chore(core): add preferences to /settings
#5621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
core/src/main/java/io/questdb/preferences/PreferencesParser.java
Outdated
Show resolved
Hide resolved
core/src/main/java/io/questdb/cutlass/http/processors/PreferencesProcessorState.java
Outdated
Show resolved
Hide resolved
core/src/main/java/io/questdb/cutlass/http/processors/PreferencesProcessor.java
Outdated
Show resolved
Hide resolved
core/src/main/java/io/questdb/cutlass/http/processors/PreferencesProcessor.java
Outdated
Show resolved
Hide resolved
core/src/main/java/io/questdb/cutlass/http/HttpFullFatServerConfiguration.java
Outdated
Show resolved
Hide resolved
core/src/test/java/io/questdb/test/preferences/PreferencesStoreConcurrentTest.java
Outdated
Show resolved
Hide resolved
core/src/main/java/io/questdb/preferences/PreferencesStore.java
Outdated
Show resolved
Hide resolved
core/src/test/java/io/questdb/test/cutlass/http/line/LineHttpFailureTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/io/questdb/test/preferences/PreferencesParserTest.java
Show resolved
Hide resolved
core/src/test/java/io/questdb/test/cutlass/http/line/LineHttpSenderTest.java
Show resolved
Hide resolved
core/src/test/java/io/questdb/test/cutlass/http/line/LineHttpSenderTest.java
Show resolved
Hide resolved
@glasstiger this is a very good PR, fragmentation works, optimistic locking works, all good! One small thing, which could be a "nit": The error response from PUT call is text, e.g. when version is mismatched. Perhaps we should make this response JSON too for the Web Console? To make it easier have intelligent response to server error? |
in fact Web Console does expect JSON from 400 already. It just errors out in the console right now. |
Changed it in 341eede to return HTTP 409 (Conflict) instead of HTTP 400 (Bad Request). |
[PR Coverage check]😍 pass : 491 / 511 (96.09%) file detail
|
Functionality to save key-value pairs (currently referred to as preferences) on the server into a file via a POST or PUT request sent to the
/settings
endpoint.The saved preferences returned back to the client in the response of a GET request sent to the
/settings
endpoint.server.conf
and preferencesPreferences are sent/received in json format, and versioned.
When preferences are updated, the version on which the changes are based has to be sent to the server.
If the base version is not matching with the current version, meaning another update was already processed, the update request is rejected.
The client has to query the latest version of preferences, and re-send any changes it wants to make.
The web console will use this to save instance name, description and colour as the first step, and the server will take these from preferences instead of env variables.
Later we can move reloadable configuration or other environment variables into preferences, and build a screen in the web console to manage them.
This PR also contains some refactorings:
Example API calls:
Required by:
https://github.com/questdb/questdb-enterprise/pull/614
questdb/ui#427
TODO:
/settings
endpoint - @glasstigermode
which can have two values:overwrite
andmerge
.overwrite
replaces the config with the one sent,merge
is treated as an incremental update with dedup (new value wins) - @glasstiger