mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-17 20:02:05 +00:00
08f4f45fd9
CI founds after LSan had been fixed [1]: 01889_sqlite_read_write: [ FAIL ] 8.32 sec. - return code: 1 ================================================================= ==20649==ERROR: LeakSanitizer: detected memory leaks Indirect leak of 1968 byte(s) in 1 object(s) allocated from: 0 0xc5c1ffd in operator new(unsigned long) (/usr/bin/clickhouse+0xc5c1ffd) 1 0x25e32d0d in std::__1::__unique_if<DB::StorageInMemoryMetadata>::__unique_single std::__1::make_unique<DB::StorageInMemoryMetadata, DB::StorageInMemoryMetadata const&>(DB::StorageInMemoryMetadata c> 2 0x25e32d0d in DB::IStorage::setInMemoryMetadata(DB::StorageInMemoryMetadata const&) obj-x86_64-linux-gnu/../src/Storages/IStorage.h:194:22 3 0x29bdee98 in DB::StorageSQLite::StorageSQLite(DB::StorageID const&, std::__1::shared_ptr<sqlite3>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std:> 4 0x25ee61d6 in std::__1::shared_ptr<DB::StorageSQLite> shared_ptr_helper<DB::StorageSQLite>::create<DB::StorageID, std::__1::shared_ptr<sqlite3> const&, std::__1::basic_string<char, std::__1::char_tr> 5 0x25ee61d6 in DB::TableFunctionSQLite::executeImpl(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context const>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1:> SUMMARY: AddressSanitizer: 171256 byte(s) leaked in 130 allocation(s). [1]: https://github.com/ClickHouse/ClickHouse/runs/4929706698?check_suite_focus=true Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include "config_core.h"
|
|
|
|
#if USE_SQLITE
|
|
#include <base/shared_ptr_helper.h>
|
|
#include <Storages/IStorage.h>
|
|
|
|
#include <sqlite3.h>
|
|
|
|
namespace Poco
|
|
{
|
|
class Logger;
|
|
}
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class StorageSQLite final : public shared_ptr_helper<StorageSQLite>, public IStorage, public WithContext
|
|
{
|
|
friend struct shared_ptr_helper<StorageSQLite>;
|
|
|
|
public:
|
|
using SQLitePtr = std::shared_ptr<sqlite3>;
|
|
|
|
StorageSQLite(
|
|
const StorageID & table_id_,
|
|
SQLitePtr sqlite_db_,
|
|
const String & database_path_,
|
|
const String & remote_table_name_,
|
|
const ColumnsDescription & columns_,
|
|
const ConstraintsDescription & constraints_,
|
|
ContextPtr context_);
|
|
|
|
std::string getName() const override { return "SQLite"; }
|
|
|
|
Pipe read(
|
|
const Names & column_names,
|
|
const StorageMetadataPtr & /*metadata_snapshot*/,
|
|
SelectQueryInfo & query_info,
|
|
ContextPtr context,
|
|
QueryProcessingStage::Enum processed_stage,
|
|
size_t max_block_size,
|
|
unsigned num_streams) override;
|
|
|
|
SinkToStoragePtr write(const ASTPtr & query, const StorageMetadataPtr & /*metadata_snapshot*/, ContextPtr context) override;
|
|
|
|
private:
|
|
String remote_table_name;
|
|
String database_path;
|
|
SQLitePtr sqlite_db;
|
|
Poco::Logger * log;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|