ClickHouse / ClickHouse/ClickHouse

[RFC] Merge arrays in configs

Open
#70,636 2 comments 0 reactions 0 assignees View on GitHub
comp-config unexpected behaviour
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
21h 32m
Merged PRs (30d)
515

Description

Suppose you have the following **two http handlers** in two override files:

```xml
==> programs/server/config.d/00-handlers.xml <==



/foo

redirect
/?query=SELECT+'bar'


==> programs/server/config.d/90-handlers.xml <==



/ping

ping


```

So **expected behavior** that you will have **two HTTP handlers** - `/ping` and `/foo`, **but instead, you will got only one**:

```xml


/ping

ping
/?query=SELECT+'bar'

```

The problem is that **XML does not support arrays**, and so it just "merges" key by key.

YAML has the same problem, even though it has array type, internally all configs are stored in XML, so they will have the same problem.

So to address this problem ClickHouse could **extend XML syntax**, like it does for `remove`/`replace`/`from_env`/`...`, i.e **`type=array`**

_Note, there is one **workaround** for this is to add unique `attr=value` pair._

workaround

```xml
==> programs/server/config.d/00-handlers.xml <==



/foo

redirect
/?query=SELECT+'bar'


==> programs/server/config.d/90-handlers.xml <==



/ping

ping


```

```xml


/foo

redirect
/?query=SELECT+'bar'


/ping

ping

```

Thoughts?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.