From 21f71985e9c060e20c373d21fd72912ef9646428 Mon Sep 17 00:00:00 2001 From: He Wang Date: Wed, 15 Jun 2022 20:33:35 +0800 Subject: [PATCH] add workingMode to common configs (#46) * add workingMode to common configs * modify doc --- docs/quickstart/logproxy-client-tutorial.md | 8 ++------ .../clogproxy/client/config/ObReaderConfig.java | 13 +++++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/quickstart/logproxy-client-tutorial.md b/docs/quickstart/logproxy-client-tutorial.md index 36976aa..126cd22 100644 --- a/docs/quickstart/logproxy-client-tutorial.md +++ b/docs/quickstart/logproxy-client-tutorial.md @@ -61,18 +61,14 @@ To connect to LogProxy, there are some parameters to set in `ObReaderConfig`: - *tb_white_list*: Table whitelist in format `tenant_name.database_name.table_name`, `*` indicates any value, and multiple values can be separated by `|`. Default is `*.*.*`. - *tb_black_list*: Table blacklist in the same format with whitelist. Default is `|`. - *timezone*: Timezone offset from UTC. Default value is `+8:00`. +- *working_mode*: Working mode. Can be `storage` (default value, supported from `obcdc` 3.1.3) or `memory`. These parameters are used in `obcdc` (former `liboblog`), and the items not listed above can be passed to `obcdc` through the `ObReaderConfig` constructor with parameters. Here is an example to set `ObReaderConfig` with OceanBase Community Edition: ```java -// obcdc params that are not listed above can be passed through the constructor -Map extraConfigs = new HashMap<>(); -extraConfigs.put("working_mode", "storage"); - -// set 'rootserver_list' and other params -ObReaderConfig config = new ObReaderConfig(extraConfigs); +ObReaderConfig config = new ObReaderConfig(); config.setRsList("127.0.0.1:2882:2881"); config.setUsername("username"); config.setPassword("password"); diff --git a/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/config/ObReaderConfig.java b/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/config/ObReaderConfig.java index 5f4912e..b2ce514 100644 --- a/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/config/ObReaderConfig.java +++ b/logproxy-client/src/main/java/com/oceanbase/clogproxy/client/config/ObReaderConfig.java @@ -54,6 +54,10 @@ public class ObReaderConfig extends AbstractConnectionConfig { /** Timezone offset. */ private static final ConfigItem TIME_ZONE = new ConfigItem<>("timezone", "+8:00"); + /** Working mode. */ + private static final ConfigItem WORKING_MODE = + new ConfigItem<>("working_mode", "storage"); + /** Constructor with empty arguments. */ public ObReaderConfig() { super(new HashMap<>()); @@ -212,4 +216,13 @@ public class ObReaderConfig extends AbstractConnectionConfig { public void setTimezone(String timezone) { TIME_ZONE.set(timezone); } + + /** + * Set working mode. + * + * @param workingMode Working mode, can be 'memory' or 'storage'. + */ + public void setWorkingMode(String workingMode) { + WORKING_MODE.set(workingMode); + } } -- GitLab