It's possible for `getZooKeeper()` to timeout if zookeeper host(s) can't
be reached. In such cases `Poco::Exception` is thrown after a connection
timeout - refer to `src/Common/ZooKeeper/ZooKeeperImpl.cpp:866` for more info.
Side effect of this is that the CreateQuery gets interrupted and it exits.
But the data Directories for the tables being created aren't cleaned up.
This unclean state will hinder table creation on any retries and will
complain that the Directory for table already exists.
To achieve a clean state on failed table creations, catch this error if
the exception is of type Poco::Exception and call `dropIfEmpty()` method,
then proceed throwing the exception. Without this, the Directory for the
tables need to be manually deleted before retrying the CreateQuery.
This PR improves the way the ClickHouse config path,
preprocessed_configs path etc are being joined inside
`ConfigProcessor.cpp`.
Uses `std::filesystem::path` to join the paths instead of
standard string concatenation. This would improve path concatenation.
Current method of concatenation results in:
```bash
➜ clickhouse-server ls -latr
total 68
-rw-r--r-- 1 root root 5587 Aug 31 05:00 users.xml
drwxr-xr-x 143 root root 12288 Sep 7 11:23 ..
lrwxrwxrwx 1 root root 41 Sep 7 11:23 preprocessed -> /var/lib/clickhouse//preprocessed_configs
drwxr-xr-x 2 root root 4096 Sep 7 11:23 users.d
-rw-r--r-- 1 root root 34252 Sep 7 11:28 config.xml
drwxr-xr-x 4 root root 4096 Sep 7 11:28 .
drwxr-xr-x 2 root root 4096 Sep 7 11:28 config.d
```
The symlink `/var/lib/clickhouse//preprocessed_configs` will still work.
amd this PR is an improvement to the current method of path
concatenation.