mirror of
https://github.com/apache/impala.git
synced 2026-01-27 15:03:20 -05:00
Minor compactions can compact several delta directories into a single
delta directory. The current directory filtering algorithm had to be
modified to handle minor compacted directories and prefer those over
plain delta directories. This happens in the Frontend, mostly in
AcidUtils.java.
Hive Streaming Ingestion writes similar delta directories, but they
might contain rows Impala cannot see based on its valid write id list.
E.g. we can have the following delta directory:
full_acid/delta_0000001_0000010/0000 # minWriteId: 1
# maxWriteId: 10
This delta dir contains rows with write ids between 1 and 10. But maybe
we are only allowed to see write ids less than 5. Therefore we need to
check the ACID write id column (named originalTransaction) to determine
which rows are valid.
Delta directories written by Hive Streaming don't have a visibility txn
id, so we can recognize them based on the directory name. If there's
a visibilityTxnId and it is committed => every row is valid:
full_acid/delta_0000001_0000010_v01234 # has visibilityTxnId
# every row is valid
If there's no visibilityTxnId then it was created via Hive Streaming,
therefore we need to validate rows. Fortunately Hive Streaming writes
rows with different write ids into different ORC stripes, therefore we
don't need to validate the write id per row. If we had statistics,
we could validate per stripe, but since Hive Streaming doesn't write
statistics we validate the write id per ORC row batch (an alternative
could be to do a 2-pass read, first we'd read a single value from each
stripe's 'currentTransaction' field, then we'd read the stripe if the
write id is valid).
Testing
* the frontend logic is tested in AcidUtilsTest
* the backend row validation is tested in test_acid_row_validation
Change-Id: I5ed74585a2d73ebbcee763b0545be4412926299d
Reviewed-on: http://gerrit.cloudera.org:8080/15818
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
88 lines
1.8 KiB
Plaintext
88 lines
1.8 KiB
Plaintext
====
|
|
---- QUERY
|
|
alter table functional.insert_only_transactional_table change column x y bigint;
|
|
---- CATCH
|
|
AnalysisException: ALTER TABLE not supported on transactional (ACID) table: functional.insert_only_transactional_table
|
|
====
|
|
---- QUERY
|
|
drop stats functional.insert_only_transactional_table;
|
|
---- CATCH
|
|
AnalysisException: DROP STATS not supported on transactional (ACID) table: functional.insert_only_transactional_table
|
|
====
|
|
---- QUERY
|
|
insert into functional_orc_def.full_transactional_table values (1);
|
|
---- CATCH
|
|
AnalysisException: INSERT not supported on full transactional (ACID) table: functional_orc_def.full_transactional_table
|
|
====
|
|
---- QUERY
|
|
truncate table functional_orc_def.full_transactional_table;
|
|
---- CATCH
|
|
AnalysisException: TRUNCATE not supported on full transactional (ACID) table: functional_orc_def.full_transactional_table
|
|
====
|
|
---- QUERY
|
|
create table acid (i int) stored as orc tblproperties('transactional'='true');
|
|
====
|
|
---- HIVE_QUERY
|
|
use $DATABASE;
|
|
insert into acid values (1), (2), (3);
|
|
delete from acid where i = 2;
|
|
====
|
|
---- QUERY
|
|
refresh acid;
|
|
select * from acid;
|
|
---- CATCH
|
|
TableLoadingException
|
|
====
|
|
---- HIVE_QUERY
|
|
alter table $DATABASE.acid compact 'major' and wait;
|
|
====
|
|
---- QUERY
|
|
invalidate metadata acid;
|
|
select * from acid;
|
|
---- RESULTS
|
|
1
|
|
3
|
|
---- TYPES
|
|
INT
|
|
====
|
|
---- HIVE_QUERY
|
|
use $DATABASE;
|
|
insert into acid values (5);
|
|
insert into acid values (5);
|
|
insert into acid values (5);
|
|
====
|
|
---- QUERY
|
|
refresh acid;
|
|
select * from acid;
|
|
---- RESULTS
|
|
1
|
|
3
|
|
5
|
|
5
|
|
5
|
|
---- TYPES
|
|
INT
|
|
====
|
|
---- HIVE_QUERY
|
|
alter table $DATABASE.acid compact 'major' and wait;
|
|
====
|
|
---- QUERY
|
|
refresh acid;
|
|
show files in acid;
|
|
---- RESULTS
|
|
row_regex:'$NAMENODE/$MANAGED_WAREHOUSE_DIR/$DATABASE.db/acid/base_0000005_v\d+/bucket_\d+','\d+K?B',''
|
|
---- TYPES
|
|
STRING,STRING,STRING
|
|
====
|
|
---- QUERY
|
|
select * from acid;
|
|
---- RESULTS
|
|
1
|
|
3
|
|
5
|
|
5
|
|
5
|
|
---- TYPES
|
|
INT
|
|
====
|