palashc commented on code in PR #1506:
URL: https://github.com/apache/phoenix/pull/1506#discussion_r1017261682
##########
phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java:
##########
@@ -46,36 +48,52 @@ public class PMetaDataImpl implements PMetaData {
private PMetaDataCache metaData;
private final TimeKeeper timeKeeper;
private final PTableRefFactory tableRefFactory;
+ private final long updateCacheFrequency;
private HashMap<String, PTableKey> physicalNameToLogicalTableMap = new
HashMap<>();
+ private final Object metricsLock = new Object();
- public PMetaDataImpl(int initialCapacity, ReadOnlyProps props) {
- this(initialCapacity, TimeKeeper.SYSTEM, props);
+ public PMetaDataImpl(int initialCapacity, long updateCacheFrequency,
ReadOnlyProps props) {
+ this(initialCapacity, updateCacheFrequency, TimeKeeper.SYSTEM, props);
}
- public PMetaDataImpl(int initialCapacity, TimeKeeper timeKeeper,
ReadOnlyProps props) {
+ public PMetaDataImpl(int initialCapacity, long updateCacheFrequency,
TimeKeeper timeKeeper, ReadOnlyProps props) {
+
this(new PMetaDataCache(initialCapacity, props.getLong(
QueryServices.MAX_CLIENT_METADATA_CACHE_SIZE_ATTRIB,
- QueryServicesOptions.DEFAULT_MAX_CLIENT_METADATA_CACHE_SIZE),
timeKeeper,
- PTableRefFactory.getFactory(props)), timeKeeper,
PTableRefFactory.getFactory(props));
+ QueryServicesOptions.DEFAULT_MAX_CLIENT_METADATA_CACHE_SIZE),
timeKeeper),
+ timeKeeper, PTableRefFactory.getFactory(props),
+ updateCacheFrequency);
}
- private PMetaDataImpl(PMetaDataCache metaData, TimeKeeper timeKeeper,
PTableRefFactory tableRefFactory) {
+ private PMetaDataImpl(PMetaDataCache metaData, TimeKeeper timeKeeper,
+ PTableRefFactory tableRefFactory, long
updateCacheFrequency) {
this.timeKeeper = timeKeeper;
this.metaData = metaData;
this.tableRefFactory = tableRefFactory;
+ this.updateCacheFrequency = updateCacheFrequency;
}
- @Override
- public PMetaDataImpl clone() {
- return new PMetaDataImpl(new PMetaDataCache(this.metaData),
this.timeKeeper, this.tableRefFactory);
+ private void updateGlobalMetric(PTableRef pTableRef) {
Review Comment:
You're right, they are of type `AtomicMetric`. I will remove the lock I
added.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]