mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 16:50:48 +00:00
Fix erase
This commit is contained in:
parent
7771249730
commit
2ee3f70330
@ -20,7 +20,6 @@ namespace ErrorCodes
|
|||||||
{
|
{
|
||||||
extern const int UNKNOWN_FORMAT_VERSION;
|
extern const int UNKNOWN_FORMAT_VERSION;
|
||||||
extern const int UNKNOWN_SNAPSHOT;
|
extern const int UNKNOWN_SNAPSHOT;
|
||||||
extern const int LOGICAL_ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -171,7 +170,7 @@ void KeeperStorageSnapshot::serialize(const KeeperStorageSnapshot & snapshot, Wr
|
|||||||
const auto & node = it->value;
|
const auto & node = it->value;
|
||||||
/// Benign race condition possible while taking snapshot: NuRaft decide to create snapshot at some log id
|
/// Benign race condition possible while taking snapshot: NuRaft decide to create snapshot at some log id
|
||||||
/// and only after some time we lock storage and enable snapshot mode. So snapshot_container_size can be
|
/// and only after some time we lock storage and enable snapshot mode. So snapshot_container_size can be
|
||||||
/// slighly bigger than required.
|
/// slightly bigger than required.
|
||||||
if (static_cast<size_t>(node.stat.mzxid) > snapshot.snapshot_meta->get_last_log_idx())
|
if (static_cast<size_t>(node.stat.mzxid) > snapshot.snapshot_meta->get_last_log_idx())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -663,6 +663,7 @@ struct KeeperStorageListRequestProcessor final : public KeeperStorageRequestProc
|
|||||||
Coordination::ZooKeeperResponsePtr response_ptr = zk_request->makeResponse();
|
Coordination::ZooKeeperResponsePtr response_ptr = zk_request->makeResponse();
|
||||||
Coordination::ZooKeeperListResponse & response = dynamic_cast<Coordination::ZooKeeperListResponse &>(*response_ptr);
|
Coordination::ZooKeeperListResponse & response = dynamic_cast<Coordination::ZooKeeperListResponse &>(*response_ptr);
|
||||||
Coordination::ZooKeeperListRequest & request = dynamic_cast<Coordination::ZooKeeperListRequest &>(*zk_request);
|
Coordination::ZooKeeperListRequest & request = dynamic_cast<Coordination::ZooKeeperListRequest &>(*zk_request);
|
||||||
|
|
||||||
auto it = container.find(request.path);
|
auto it = container.find(request.path);
|
||||||
if (it == container.end())
|
if (it == container.end())
|
||||||
{
|
{
|
||||||
@ -677,9 +678,7 @@ struct KeeperStorageListRequestProcessor final : public KeeperStorageRequestProc
|
|||||||
response.names.reserve(it->value.children.size());
|
response.names.reserve(it->value.children.size());
|
||||||
|
|
||||||
for (const auto child : it->value.children)
|
for (const auto child : it->value.children)
|
||||||
{
|
|
||||||
response.names.push_back(child.toString());
|
response.names.push_back(child.toString());
|
||||||
}
|
|
||||||
|
|
||||||
response.stat = it->value.stat;
|
response.stat = it->value.stat;
|
||||||
response.error = Coordination::Error::ZOK;
|
response.error = Coordination::Error::ZOK;
|
||||||
@ -1088,7 +1087,6 @@ KeeperStorage::ResponsesForSessions KeeperStorage::processRequest(const Coordina
|
|||||||
{
|
{
|
||||||
for (const auto & ephemeral_path : it->second)
|
for (const auto & ephemeral_path : it->second)
|
||||||
{
|
{
|
||||||
container.erase(ephemeral_path);
|
|
||||||
container.updateValue(parentPath(ephemeral_path), [&ephemeral_path] (KeeperStorage::Node & parent)
|
container.updateValue(parentPath(ephemeral_path), [&ephemeral_path] (KeeperStorage::Node & parent)
|
||||||
{
|
{
|
||||||
--parent.stat.numChildren;
|
--parent.stat.numChildren;
|
||||||
@ -1098,6 +1096,8 @@ KeeperStorage::ResponsesForSessions KeeperStorage::processRequest(const Coordina
|
|||||||
parent.size_bytes -= base_name.size;
|
parent.size_bytes -= base_name.size;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
container.erase(ephemeral_path);
|
||||||
|
|
||||||
auto responses = processWatchesImpl(ephemeral_path, watches, list_watches, Coordination::Event::DELETED);
|
auto responses = processWatchesImpl(ephemeral_path, watches, list_watches, Coordination::Event::DELETED);
|
||||||
results.insert(results.end(), responses.begin(), responses.end());
|
results.insert(results.end(), responses.begin(), responses.end());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user