-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stats for metastore partition cache
- Loading branch information
1 parent
5589e6d
commit 10211d4
Showing
10 changed files
with
173 additions
and
15 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
57 changes: 57 additions & 0 deletions
57
...e-metastore/src/main/java/com/facebook/presto/hive/metastore/HiveMetastoreCacheStats.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,57 @@ | ||
/* | ||
* Licensed 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 com.facebook.presto.hive.metastore; | ||
|
||
import com.google.common.cache.LoadingCache; | ||
import org.weakref.jmx.Managed; | ||
|
||
public class HiveMetastoreCacheStats | ||
implements MetastoreCacheStats | ||
{ | ||
private LoadingCache<?, ?> partitionCache; | ||
|
||
@Override | ||
public void setPartitionCache(LoadingCache<?, ?> partitionCache) | ||
{ | ||
this.partitionCache = partitionCache; | ||
} | ||
|
||
@Managed | ||
@Override | ||
public long getPartitionCacheHit() | ||
{ | ||
return partitionCache.stats().hitCount(); | ||
} | ||
|
||
@Managed | ||
@Override | ||
public long getPartitionCacheMiss() | ||
{ | ||
return partitionCache.stats().missCount(); | ||
} | ||
|
||
@Managed | ||
@Override | ||
public long getPartitionCacheEviction() | ||
{ | ||
return partitionCache.stats().evictionCount(); | ||
} | ||
|
||
@Managed | ||
@Override | ||
public long getPartitionCacheSize() | ||
{ | ||
return partitionCache.size(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/MetastoreCacheStats.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,29 @@ | ||
/* | ||
* Licensed 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 com.facebook.presto.hive.metastore; | ||
|
||
import com.google.common.cache.LoadingCache; | ||
|
||
public interface MetastoreCacheStats | ||
{ | ||
void setPartitionCache(LoadingCache<?, ?> partitionCache); | ||
|
||
long getPartitionCacheHit(); | ||
|
||
long getPartitionCacheMiss(); | ||
|
||
long getPartitionCacheEviction(); | ||
|
||
long getPartitionCacheSize(); | ||
} |
46 changes: 46 additions & 0 deletions
46
...e-metastore/src/main/java/com/facebook/presto/hive/metastore/NoopMetastoreCacheStats.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,46 @@ | ||
/* | ||
* Licensed 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 com.facebook.presto.hive.metastore; | ||
|
||
import com.google.common.cache.LoadingCache; | ||
|
||
public class NoopMetastoreCacheStats | ||
implements MetastoreCacheStats | ||
{ | ||
public static final NoopMetastoreCacheStats NOOP_METASTORE_CACHE_STATS = new NoopMetastoreCacheStats(); | ||
|
||
public void setPartitionCache(LoadingCache<?, ?> partitionCache) | ||
{ | ||
} | ||
|
||
public long getPartitionCacheHit() | ||
{ | ||
return 0; | ||
} | ||
|
||
public long getPartitionCacheMiss() | ||
{ | ||
return 0; | ||
} | ||
|
||
public long getPartitionCacheEviction() | ||
{ | ||
return 0; | ||
} | ||
|
||
public long getPartitionCacheSize() | ||
{ | ||
return 0; | ||
} | ||
} |
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