操作并发
DDL和DML中的操作,执行前,需要获取对应的锁,各操作需要获取锁的情况见表1 操作获取锁一览表,√表示需要获取该锁,一个操作仅在获取到所有需要获取的锁后,才能继续执行。
任意两个操作是否可以并发执行,可以通过如下方法确定:表1两行代表两个操作,这两行没有任意一列都标记√,即不存在某一列两行全为√。
操作 |
METADATA_LOCK |
COMPACTION_LOCK |
DROP_TABLE_LOCK |
DELETE_SEGMENT_LOCK |
CLEAN_FILES_LOCK |
ALTER_PARTITION_LOCK |
UPDATE_LOCK |
STREAMING_LOCK |
CONCURRENT_LOAD_LOCK |
SEGMENT_LOCK |
---|---|---|---|---|---|---|---|---|---|---|
CREATE TABLE |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
CREATE TABLE As SELECT |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
DROP TABLE |
√ |
- |
√ |
- |
- |
- |
- |
√ |
- |
- |
ALTER TABLE COMPACTION |
- |
√ |
- |
- |
- |
- |
√ |
- |
- |
- |
TABLE RENAME |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
ADD COLUMNS |
√ |
√ |
- |
- |
- |
- |
- |
- |
- |
- |
DROP COLUMNS |
√ |
√ |
- |
- |
- |
- |
- |
- |
- |
- |
CHANGE DATA TYPE |
√ |
√ |
- |
- |
- |
- |
- |
- |
- |
- |
REFRESH TABLE |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
REGISTER INDEX TABLE |
√ |
- |
- |
- |
- |
- |
- |
- |
- |
- |
REFRESH INDEX |
- |
√ |
- |
- |
- |
- |
- |
- |
- |
- |
LOAD DATA/INSERT INTO |
- |
- |
- |
- |
- |
- |
- |
- |
√ |
√ |
UPDATE CARBON TABLE |
√ |
√ |
- |
- |
- |
- |
√ |
- |
- |
- |
DELETE RECORDS from CARBON TABLE |
√ |
√ |
- |
- |
- |
- |
√ |
- |
- |
- |
DELETE SEGMENT by ID |
- |
- |
- |
√ |
√ |
- |
- |
- |
- |
- |
DELETE SEGMENT by DATE |
- |
- |
- |
√ |
√ |
- |
- |
- |
- |
- |
SHOW SEGMENTS |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
CREATE SECONDARY INDEX |
√ |
√ |
- |
√ |
- |
- |
- |
- |
- |
- |
SHOW SECONDARY INDEXES |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
DROP SECONDARY INDEX |
√ |
- |
√ |
- |
- |
- |
- |
- |
- |
- |
CLEAN FILES |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
SET/RESET |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
Add Hive Partition |
- |
- |
- |
- |
- |
- |
- |
- |
- |
- |
Drop Hive Partition |
√ |
√ |
√ |
√ |
√ |
√ |
- |
- |
- |
- |
Drop Partition |
√ |
√ |
√ |
√ |
√ |
√ |
- |
- |
- |
- |
Alter table set |
√ |
√ |
- |
- |
- |
- |
- |
- |
- |
- |