Skip to content

Eliminate the table lock between reading, writing and DDL operators #1162

@flowbehappy

Description

@flowbehappy

Currently in DAGQueryBlockInterpreter::executeTS, a table structure read lock is created by table_lock = storage->lockStructure(false, __PRETTY_FUNCTION__) and kept holding in pipeline.transform([&](auto & stream) { stream->addTableLock(table_lock); });. And SchemaBuilder<Getter, NameMapper>::applyAlterPhysicalTable need to obtain a table structure write lock. The current design could block parallel reads towards a table if the table's schema got updated.

Actually by the design of DT, after the read() return an InputStream, we already have a snapshot of the storage. So we don't need to hold the table structure read lock during the life time of the InputStream.

Metadata

Metadata

Assignees

Labels

type/enhancementThe issue or PR belongs to an enhancement.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions