Merge pull request #28428 from kssenii/fix-database-ordinary-test

Fix 01457_create_as_table_function_structure
This commit is contained in:
Kseniia Sumarokova 2021-09-04 11:07:42 +03:00 committed by GitHub
commit 04b26d26bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -101,7 +101,7 @@ public:
void flush() override; void flush() override;
void drop() override; void drop() override;
bool storesDataOnDisk() const override { return true; } bool storesDataOnDisk() const override { return data_volume != nullptr; }
Strings getDataPaths() const override; Strings getDataPaths() const override;
ActionLock getActionLock(StorageActionBlockType type) override; ActionLock getActionLock(StorageActionBlockType type) override;

View File

@ -32,7 +32,7 @@ public:
setInMemoryMetadata(cached_metadata); setInMemoryMetadata(cached_metadata);
} }
StoragePtr getNested() const override StoragePtr getNestedImpl() const
{ {
std::lock_guard lock{nested_mutex}; std::lock_guard lock{nested_mutex};
if (nested) if (nested)
@ -46,6 +46,20 @@ public:
return nested; return nested;
} }
StoragePtr getNested() const override
{
StoragePtr nested_storage = getNestedImpl();
assert(!nested_storage->getStoragePolicy());
assert(!nested_storage->storesDataOnDisk());
return nested_storage;
}
/// Table functions cannot have storage policy and cannot store data on disk.
/// We may check if table is readonly or stores data on disk on DROP TABLE.
/// Avoid loading nested table by returning nullptr/false for all table functions.
StoragePolicyPtr getStoragePolicy() const override { return nullptr; }
bool storesDataOnDisk() const override { return false; }
String getName() const override String getName() const override
{ {
std::lock_guard lock{nested_mutex}; std::lock_guard lock{nested_mutex};