mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-16 11:22:12 +00:00
caffc144b5
In #33291 final part commit had been defered, and now it can take significantly more time, that may lead to "Part directory doesn't exist" error during INSERT: 2022.02.21 18:18:06.979881 [ 11329 ] {insert} <Debug> executeQuery: (from 127.1:24572, user: default) INSERT INTO db.table (...) VALUES 2022.02.21 20:58:03.933593 [ 11329 ] {insert} <Trace> db.table: Renaming temporary part tmp_insert_20220214_18044_18044_0 to 20220214_270654_270654_0. 2022.02.21 21:16:50.961917 [ 11329 ] {insert} <Trace> db.table: Renaming temporary part tmp_insert_20220214_18197_18197_0 to 20220214_270689_270689_0. ... 2022.02.22 21:16:57.632221 [ 64878 ] {} <Warning> db.table: Removing temporary directory /clickhouse/data/db/table/tmp_insert_20220214_18232_18232_0/ ... 2022.02.23 12:23:56.277480 [ 11329 ] {insert} <Trace> db.table: Renaming temporary part tmp_insert_20220214_18232_18232_0 to 20220214_273459_273459_0. 2022.02.23 12:23:56.299218 [ 11329 ] {insert} <Error> executeQuery: Code: 107. DB::Exception: Part directory /clickhouse/data/db/table/tmp_insert_20220214_18232_18232_0/ doesn't exist. Most likely it is a logical error. (FILE_DOESNT_EXIST) (version 22.2.1.1) (from 127.1:24572) (in query: INSERT INTO db.table (...) VALUES), Stack trace (when copying this message, always include the lines below): Follow-up for: #28760 Refs: #33291 Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
34 lines
840 B
C++
34 lines
840 B
C++
#pragma once
|
|
|
|
#include <boost/noncopyable.hpp>
|
|
#include <mutex>
|
|
#include <string>
|
|
#include <unordered_set>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
/// Manages set of active temporary paths that should not be cleaned by background thread.
|
|
class TemporaryParts : private boost::noncopyable
|
|
{
|
|
private:
|
|
/// To add const qualifier for contains()
|
|
mutable std::mutex mutex;
|
|
|
|
/// NOTE: It is pretty short, so use STL is fine.
|
|
std::unordered_set<std::string> parts;
|
|
|
|
public:
|
|
/// Returns true if passed part name is active.
|
|
/// (is the destination for one of active mutation/merge).
|
|
///
|
|
/// NOTE: that it accept basename (i.e. dirname), not the path,
|
|
/// since later requires canonical form.
|
|
bool contains(const std::string & basename) const;
|
|
|
|
void add(std::string basename);
|
|
void remove(const std::string & basename);
|
|
};
|
|
|
|
}
|