Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DRILL-4846: Fix a few performance issues for metadata access:
- Create a MetadataContext that can be shared among multiple invocations of the Metadata APIs. - Check directory modification time only if not previously checked. - Remove a redundant call for metadata read. - Added more logging. - Consolidate couple of metadata methods. close #569
- Loading branch information
Aman Sinha
committed
Aug 17, 2016
1 parent
0a4c21c
commit 57dc9f4
Showing
10 changed files
with
202 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/MetadataContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.drill.exec.store.dfs; | ||
|
||
import java.util.Map; | ||
|
||
import com.google.common.collect.Maps; | ||
|
||
/** | ||
* A metadata context that holds state across multiple invocations of | ||
* the Parquet metadata APIs. | ||
*/ | ||
public class MetadataContext { | ||
|
||
/** Map of directory path to the status of whether modification time was already checked. | ||
* Note: the #directories is typically a small percentage of the #files, so the memory footprint | ||
* is expected to be relatively small. | ||
*/ | ||
private Map<String, Boolean> dirModifCheckMap = Maps.newHashMap(); | ||
|
||
public MetadataContext() { | ||
} | ||
|
||
public void setStatus(String dir) { | ||
dirModifCheckMap.put(dir, true); | ||
} | ||
|
||
public void clearStatus(String dir) { | ||
dirModifCheckMap.put(dir, false); | ||
} | ||
|
||
public boolean getStatus(String dir) { | ||
if (dirModifCheckMap.containsKey(dir)) { | ||
return dirModifCheckMap.get(dir); | ||
} | ||
return false; | ||
} | ||
|
||
public void clear() { | ||
dirModifCheckMap.clear(); | ||
} | ||
|
||
} | ||
|
||
|
Oops, something went wrong.