rename persistency to persistent

This commit is contained in:
Vxider 2020-09-18 20:58:27 +08:00
parent 0c535062fc
commit c9249f77c7
10 changed files with 40 additions and 40 deletions

View File

@ -10,7 +10,7 @@ class ASTStorage;
#define JOIN_RELATED_SETTINGS(M) \
M(Bool, persistency, true, "Disable setting to avoid the overhead of writing to disk for StorageJoin", 0)
M(Bool, persistent, true, "Disable setting to avoid the overhead of writing to disk for StorageJoin", 0)
#define LIST_OF_JOIN_SETTINGS(M) \
JOIN_RELATED_SETTINGS(M) \

View File

@ -10,7 +10,7 @@ class ASTStorage;
#define SET_RELATED_SETTINGS(M) \
M(Bool, persistency, true, "Disable setting to avoid the overhead of writing to disk for StorageSet", 0)
M(Bool, persistent, true, "Disable setting to avoid the overhead of writing to disk for StorageSet", 0)
#define LIST_OF_SET_SETTINGS(M) \
SET_RELATED_SETTINGS(M) \

View File

@ -45,8 +45,8 @@ StorageJoin::StorageJoin(
const ConstraintsDescription & constraints_,
bool overwrite_,
const Context & context_,
bool persistency_)
: StorageSetOrJoinBase{relative_path_, table_id_, columns_, constraints_, context_, persistency_}
bool persistent_)
: StorageSetOrJoinBase{relative_path_, table_id_, columns_, constraints_, context_, persistent_}
, key_names(key_names_)
, use_nulls(use_nulls_)
, limits(limits_)
@ -119,7 +119,7 @@ void registerStorageJoin(StorageFactory & factory)
auto join_overflow_mode = settings.join_overflow_mode;
auto join_any_take_last_row = settings.join_any_take_last_row;
auto old_any_join = settings.any_join_distinct_right_table_keys;
bool persistency_ = true;
bool persistent_ = true;
if (args.storage_def && args.storage_def->settings)
{
@ -137,11 +137,11 @@ void registerStorageJoin(StorageFactory & factory)
join_any_take_last_row = setting.value;
else if (setting.name == "any_join_distinct_right_table_keys")
old_any_join = setting.value;
else if (setting.name == "persistency")
else if (setting.name == "persistent")
{
auto join_settings = std::make_unique<JoinSettings>();
join_settings->loadFromQuery(*args.storage_def);
persistency_ = join_settings->persistency;
persistent_ = join_settings->persistent;
}
else
throw Exception(
@ -226,7 +226,7 @@ void registerStorageJoin(StorageFactory & factory)
args.constraints,
join_any_take_last_row,
args.context,
persistency_);
persistent_);
};
factory.registerStorage("Join", creator_fn, StorageFactory::StorageFeatures{ .supports_settings = true, });

View File

@ -74,7 +74,7 @@ protected:
const ConstraintsDescription & constraints_,
bool overwrite,
const Context & context_,
bool persistency_);
bool persistent_);
};
}

View File

@ -37,7 +37,7 @@ public:
SetOrJoinBlockOutputStream(
StorageSetOrJoinBase & table_, const StorageMetadataPtr & metadata_snapshot_,
const String & backup_path_, const String & backup_tmp_path_,
const String & backup_file_name_, bool persistency_);
const String & backup_file_name_, bool persistent_);
Block getHeader() const override { return metadata_snapshot->getSampleBlock(); }
void write(const Block & block) override;
@ -52,7 +52,7 @@ private:
WriteBufferFromFile backup_buf;
CompressedWriteBuffer compressed_backup_buf;
NativeBlockOutputStream backup_stream;
bool persistency;
bool persistent;
};
@ -62,7 +62,7 @@ SetOrJoinBlockOutputStream::SetOrJoinBlockOutputStream(
const String & backup_path_,
const String & backup_tmp_path_,
const String & backup_file_name_,
bool persistency_)
bool persistent_)
: table(table_)
, metadata_snapshot(metadata_snapshot_)
, backup_path(backup_path_)
@ -71,7 +71,7 @@ SetOrJoinBlockOutputStream::SetOrJoinBlockOutputStream(
, backup_buf(backup_tmp_path + backup_file_name)
, compressed_backup_buf(backup_buf)
, backup_stream(compressed_backup_buf, 0, metadata_snapshot->getSampleBlock())
, persistency(persistency_)
, persistent(persistent_)
{
}
@ -81,14 +81,14 @@ void SetOrJoinBlockOutputStream::write(const Block & block)
Block sorted_block = block.sortColumns();
table.insertBlock(sorted_block);
if (persistency)
if (persistent)
backup_stream.write(sorted_block);
}
void SetOrJoinBlockOutputStream::writeSuffix()
{
table.finishInsert();
if (persistency)
if (persistent)
{
backup_stream.flush();
compressed_backup_buf.next();
@ -102,7 +102,7 @@ void SetOrJoinBlockOutputStream::writeSuffix()
BlockOutputStreamPtr StorageSetOrJoinBase::write(const ASTPtr & /*query*/, const StorageMetadataPtr & metadata_snapshot, const Context & /*context*/)
{
UInt64 id = ++increment;
return std::make_shared<SetOrJoinBlockOutputStream>(*this, metadata_snapshot, path, path + "tmp/", toString(id) + ".bin", persistency);
return std::make_shared<SetOrJoinBlockOutputStream>(*this, metadata_snapshot, path, path + "tmp/", toString(id) + ".bin", persistent);
}
@ -112,9 +112,9 @@ StorageSetOrJoinBase::StorageSetOrJoinBase(
const ColumnsDescription & columns_,
const ConstraintsDescription & constraints_,
const Context & context_,
bool persistency_)
bool persistent_)
: IStorage(table_id_),
persistency(persistency_)
persistent(persistent_)
{
StorageInMemoryMetadata storage_metadata;
storage_metadata.setColumns(columns_);
@ -136,8 +136,8 @@ StorageSet::StorageSet(
const ColumnsDescription & columns_,
const ConstraintsDescription & constraints_,
const Context & context_,
bool persistency_)
: StorageSetOrJoinBase{relative_path_, table_id_, columns_, constraints_, context_, persistency_},
bool persistent_)
: StorageSetOrJoinBase{relative_path_, table_id_, columns_, constraints_, context_, persistent_},
set(std::make_shared<Set>(SizeLimits(), false, true))
{
@ -249,7 +249,7 @@ void registerStorageSet(StorageFactory & factory)
set_settings->loadFromQuery(*args.storage_def);
}
return StorageSet::create(args.relative_data_path, args.table_id, args.columns, args.constraints, args.context, set_settings->persistency);
return StorageSet::create(args.relative_data_path, args.table_id, args.columns, args.constraints, args.context, set_settings->persistent);
}, StorageFactory::StorageFeatures{ .supports_settings = true, });
}

View File

@ -33,11 +33,11 @@ protected:
const ColumnsDescription & columns_,
const ConstraintsDescription & constraints_,
const Context & context_,
bool persistency_);
bool persistent_);
String base_path;
String path;
bool persistency;
bool persistent;
std::atomic<UInt64> increment = 0; /// For the backup file names.
@ -86,7 +86,7 @@ protected:
const ColumnsDescription & columns_,
const ConstraintsDescription & constraints_,
const Context & context_,
bool persistency_);
bool persistent_);
};
}

View File

@ -1,5 +1,5 @@
----- Default Settings -----
1
----- Settings persistency=1 -----
----- Settings persistent=1 -----
1
----- Settings persistency=0 -----
----- Settings persistent=0 -----

View File

@ -13,20 +13,20 @@ SELECT number FROM number WHERE number IN set LIMIT 1;
DROP TABLE set;
SELECT '----- Settings persistency=1 -----';
CREATE TABLE set (val UInt64) ENGINE = Set() SETTINGS persistency=1;
SELECT '----- Settings persistent=1 -----';
CREATE TABLE set (val UInt64) ENGINE = Set() SETTINGS persistent=1;
INSERT INTO set VALUES (1);
DETACH TABLE set;
ATTACH TABLE set (val UInt64) ENGINE = Set() SETTINGS persistency=1;
ATTACH TABLE set (val UInt64) ENGINE = Set() SETTINGS persistent=1;
SELECT number FROM number WHERE number IN set LIMIT 1;
DROP TABLE set;
SELECT '----- Settings persistency=0 -----';
CREATE TABLE set (val UInt64) ENGINE = Set() SETTINGS persistency=0;
SELECT '----- Settings persistent=0 -----';
CREATE TABLE set (val UInt64) ENGINE = Set() SETTINGS persistent=0;
INSERT INTO set VALUES (1);
DETACH TABLE set;
ATTACH TABLE set (val UInt64) ENGINE = Set() SETTINGS persistency=0;
ATTACH TABLE set (val UInt64) ENGINE = Set() SETTINGS persistent=0;
SELECT number FROM number WHERE number IN set LIMIT 1;
DROP TABLE set;

View File

@ -1,5 +1,5 @@
----- Default Settings -----
1 21
----- Settings persistency=1 -----
----- Settings persistent=1 -----
1 21
----- Settings persistency=0 -----
----- Settings persistent=0 -----

View File

@ -9,20 +9,20 @@ SELECT * from join;
DROP TABLE join;
SELECT '----- Settings persistency=1 -----';
CREATE TABLE join (k UInt64, s String) ENGINE = Join(ANY, LEFT, k) SETTINGS persistency=1;
SELECT '----- Settings persistent=1 -----';
CREATE TABLE join (k UInt64, s String) ENGINE = Join(ANY, LEFT, k) SETTINGS persistent=1;
INSERT INTO join VALUES (1,21);
DETACH TABLE join;
ATTACH TABLE join (k UInt64, s String) ENGINE = Join(ANY, LEFT, k) SETTINGS persistency=1;
ATTACH TABLE join (k UInt64, s String) ENGINE = Join(ANY, LEFT, k) SETTINGS persistent=1;
SELECT * from join;
DROP TABLE join;
SELECT '----- Settings persistency=0 -----';
CREATE TABLE join (k UInt64, s String) ENGINE = Join(ANY, LEFT, k) SETTINGS persistency=0;
SELECT '----- Settings persistent=0 -----';
CREATE TABLE join (k UInt64, s String) ENGINE = Join(ANY, LEFT, k) SETTINGS persistent=0;
INSERT INTO join VALUES (1,21);
DETACH TABLE join;
ATTACH TABLE join (k UInt64, s String) ENGINE = Join(ANY, LEFT, k) SETTINGS persistency=0;
ATTACH TABLE join (k UInt64, s String) ENGINE = Join(ANY, LEFT, k) SETTINGS persistent=0;
SELECT * from join;
DROP TABLE join;