drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinfengni <...@git.apache.org>
Subject [GitHub] drill pull request #569: DRILL-4846: Fix a few performance issues for metada...
Date Tue, 16 Aug 2016 23:05:27 GMT
Github user jinfengni commented on a diff in the pull request:

    https://github.com/apache/drill/pull/569#discussion_r75037246
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/store/parquet/Metadata.java
---
    @@ -470,41 +483,38 @@ private ParquetTableMetadataBase readBlockMeta(String path) throws
IOException {
         mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
         FSDataInputStream is = fs.open(p);
     
    -    ParquetTableMetadataBase parquetTableMetadata = mapper.readValue(is, ParquetTableMetadataBase.class);
    -    logger.info("Took {} ms to read metadata from cache file", timer.elapsed(TimeUnit.MILLISECONDS));
    -    timer.stop();
    -    if (tableModified(parquetTableMetadata, p)) {
    -      parquetTableMetadata =
    -          (createMetaFilesRecursively(Path.getPathWithoutSchemeAndAuthority(p.getParent()).toString())).getLeft();
    -    }
    -    return parquetTableMetadata;
    -  }
    -
    -  private ParquetTableMetadataDirs readMetadataDirs(String path) throws IOException {
    -    Stopwatch timer = Stopwatch.createStarted();
    -    Path p = new Path(path);
    -    ObjectMapper mapper = new ObjectMapper();
    -
    -    final SimpleModule serialModule = new SimpleModule();
    -    serialModule.addDeserializer(SchemaPath.class, new SchemaPath.De());
    -
    -    AfterburnerModule module = new AfterburnerModule();
    -    module.setUseOptimizedBeanDeserializer(true);
    +    boolean alreadyCheckedModification = false;
    +    boolean newMetadata = false;
     
    -    mapper.registerModule(serialModule);
    -    mapper.registerModule(module);
    -    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    -    FSDataInputStream is = fs.open(p);
    +    if (metaContext != null) {
    +      alreadyCheckedModification = metaContext.getStatus(parentDir.toString());
    +    }
     
    -    ParquetTableMetadataDirs parquetTableMetadataDirs = mapper.readValue(is, ParquetTableMetadataDirs.class);
    -    logger.info("Took {} ms to read directories from directory cache file", timer.elapsed(TimeUnit.MILLISECONDS));
    -    timer.stop();
    +    if (dirsOnly) {
    +      parquetTableMetadataDirs = mapper.readValue(is, ParquetTableMetadataDirs.class);
    +      logger.info("Took {} ms to read directories from directory cache file", timer.elapsed(TimeUnit.MILLISECONDS));
    +      timer.stop();
    +      if (!alreadyCheckedModification && tableModified(parquetTableMetadataDirs.getDirectories(),
p, parentDir, metaContext)) {
    --- End diff --
    
    tableModified compares the directory's modification time against metadata cache file's
modification time. 
    
    In 1st call,  the metadata file is .drill.parquet_metadata_directories. And we keep track
of the directory compared. In 2nd call, supposedly we should compare .drill.parquet_metadata
against directory. But MetaContext keeps track the comparison based on .drill.parquet_metadata_directories.
 Will this cause any potential problem, since .drill.parquet_metadata and .drill.parquet_metadata_directories
are different files?
     
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message