Merge branch 'master' of github.com:yandex/ClickHouse

This commit is contained in:
Alexey Milovidov 2017-11-11 04:04:39 +03:00
commit d305f6190e
4 changed files with 28 additions and 19 deletions

View File

@ -441,13 +441,7 @@ int32_t ZooKeeper::existsImpl(const std::string & path, Stat * stat_, WatchCallb
bool ZooKeeper::exists(const std::string & path, Stat * stat_, const EventPtr & watch) bool ZooKeeper::exists(const std::string & path, Stat * stat_, const EventPtr & watch)
{ {
int32_t code = retry(std::bind(&ZooKeeper::existsImpl, this, path, stat_, callbackForEvent(watch))); return existsWatch(path, stat_, callbackForEvent(watch));
if (!(code == ZOK || code == ZNONODE))
throw KeeperException(code, path);
if (code == ZNONODE)
return false;
return true;
} }
bool ZooKeeper::existsWatch(const std::string & path, Stat * stat_, const WatchCallback & watch_callback) bool ZooKeeper::existsWatch(const std::string & path, Stat * stat_, const WatchCallback & watch_callback)
@ -507,15 +501,7 @@ std::string ZooKeeper::get(const std::string & path, Stat * stat, const EventPtr
bool ZooKeeper::tryGet(const std::string & path, std::string & res, Stat * stat_, const EventPtr & watch, int * return_code) bool ZooKeeper::tryGet(const std::string & path, std::string & res, Stat * stat_, const EventPtr & watch, int * return_code)
{ {
int32_t code = retry(std::bind(&ZooKeeper::getImpl, this, std::ref(path), std::ref(res), stat_, callbackForEvent(watch))); return tryGetWatch(path, res, stat_, callbackForEvent(watch), return_code);
if (!(code == ZOK || code == ZNONODE))
throw KeeperException(code, path);
if (return_code)
*return_code = code;
return code == ZOK;
} }
bool ZooKeeper::tryGetWatch(const std::string & path, std::string & res, Stat * stat_, const WatchCallback & watch_callback, int * return_code) bool ZooKeeper::tryGetWatch(const std::string & path, std::string & res, Stat * stat_, const WatchCallback & watch_callback, int * return_code)

View File

@ -8,9 +8,13 @@ CLICKHOUSE_LOGDIR=/var/log/clickhouse-server
if [ "$1" = configure ]; then if [ "$1" = configure ]; then
if [ -x "/bin/systemctl" ] && [ -f /etc/systemd/system/clickhouse-server.service ]; then
if [ -x "/etc/init.d/clickhouse-server" ]; then /bin/systemctl daemon-reload
update-rc.d clickhouse-server defaults 19 19 >/dev/null || exit $? /bin/systemctl enable clickhouse-server
else
if [ -x "/etc/init.d/clickhouse-server" ]; then
update-rc.d clickhouse-server defaults 19 19 >/dev/null || exit $?
fi
fi fi
# Make sure the administrative user exists # Make sure the administrative user exists

15
debian/clickhouse-server.service vendored Normal file
View File

@ -0,0 +1,15 @@
[Unit]
Description=ClickHouse Server (analytic DBMS for big data)
[Service]
Type=simple
User=clickhouse
Group=clickhouse
Restart=always
RestartSec=30
ExecStart=/usr/bin/clickhouse-server --config=/etc/clickhouse-server/config.xml
LimitCORE=infinity
LimitNOFILE=500000
[Install]
WantedBy=multi-user.target

4
debian/rules vendored
View File

@ -77,6 +77,10 @@ override_dh_install:
# todo: remove after renaming package: # todo: remove after renaming package:
mkdir -p $(DESTDIR)/etc/init.d mkdir -p $(DESTDIR)/etc/init.d
cp debian/clickhouse-server.init $(DESTDIR)/etc/init.d/clickhouse-server cp debian/clickhouse-server.init $(DESTDIR)/etc/init.d/clickhouse-server
# systemd compatibility
mkdir -p $(DESTDIR)/etc/systemd/system/
cp debian/clickhouse-server.service $(DESTDIR)/etc/systemd/system/
mkdir -p $(DESTDIR)/etc/cron.d mkdir -p $(DESTDIR)/etc/cron.d
cp debian/clickhouse-server.cron.d $(DESTDIR)/etc/cron.d/clickhouse-server cp debian/clickhouse-server.cron.d $(DESTDIR)/etc/cron.d/clickhouse-server