1818
1919package org .apache .hudi .client .functional ;
2020
21- import org .apache .avro .Schema ;
22- import org .apache .avro .generic .GenericRecord ;
23- import org .apache .avro .generic .IndexedRecord ;
24- import org .apache .hadoop .fs .FileStatus ;
25- import org .apache .hadoop .fs .Path ;
26- import org .apache .hadoop .hbase .io .hfile .CacheConfig ;
2721import org .apache .hudi .avro .HoodieAvroUtils ;
2822import org .apache .hudi .avro .model .HoodieMetadataRecord ;
2923import org .apache .hudi .common .config .HoodieMetadataConfig ;
5145import org .apache .hudi .metadata .MetadataPartitionType ;
5246import org .apache .hudi .table .HoodieSparkTable ;
5347import org .apache .hudi .table .HoodieTable ;
48+
49+ import org .apache .avro .Schema ;
50+ import org .apache .avro .generic .GenericRecord ;
51+ import org .apache .avro .generic .IndexedRecord ;
52+ import org .apache .hadoop .fs .FileStatus ;
53+ import org .apache .hadoop .fs .Path ;
54+ import org .apache .hadoop .hbase .io .hfile .CacheConfig ;
5455import org .apache .log4j .LogManager ;
5556import org .apache .log4j .Logger ;
5657import org .apache .parquet .avro .AvroSchemaConverter ;
5758import org .apache .parquet .schema .MessageType ;
58- import org .junit .jupiter .api .Test ;
5959import org .junit .jupiter .params .ParameterizedTest ;
6060import org .junit .jupiter .params .provider .EnumSource ;
61+ import org .junit .jupiter .params .provider .ValueSource ;
6162
6263import java .io .IOException ;
6364import java .util .ArrayList ;
@@ -81,23 +82,26 @@ public class TestHoodieBackedTableMetadata extends TestHoodieMetadataBase {
8182
8283 private static final Logger LOG = LogManager .getLogger (TestHoodieBackedTableMetadata .class );
8384
84- @ Test
85- public void testTableOperations () throws Exception {
85+ @ ParameterizedTest
86+ @ ValueSource (booleans = {true , false })
87+ public void testTableOperations (boolean reuseReaders ) throws Exception {
8688 HoodieTableType tableType = HoodieTableType .COPY_ON_WRITE ;
8789 init (tableType );
8890 doWriteInsertAndUpsert (testTable );
8991
9092 // trigger an upsert
9193 doWriteOperation (testTable , "0000003" );
92- verifyBaseMetadataTable ();
94+ verifyBaseMetadataTable (reuseReaders );
9395 }
9496
9597 private void doWriteInsertAndUpsert (HoodieTestTable testTable ) throws Exception {
9698 doWriteInsertAndUpsert (testTable , "0000001" , "0000002" , false );
9799 }
98100
99- private void verifyBaseMetadataTable () throws IOException {
100- HoodieBackedTableMetadata tableMetadata = new HoodieBackedTableMetadata (context , writeConfig .getMetadataConfig (), writeConfig .getBasePath (), writeConfig .getSpillableMapBasePath (), false );
101+ private void verifyBaseMetadataTable (boolean reuseMetadataReaders ) throws IOException {
102+ HoodieBackedTableMetadata tableMetadata = new HoodieBackedTableMetadata (
103+ context , writeConfig .getMetadataConfig (), writeConfig .getBasePath (),
104+ writeConfig .getSpillableMapBasePath (), reuseMetadataReaders );
101105 assertTrue (tableMetadata .enabled ());
102106 List <java .nio .file .Path > fsPartitionPaths = testTable .getAllPartitionPaths ();
103107 List <String > fsPartitions = new ArrayList <>();
0 commit comments