sanjeet006py commented on code in PR #2041:
URL: https://github.com/apache/phoenix/pull/2041#discussion_r1887109367
##########
phoenix-core-client/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java:
##########
@@ -83,14 +83,27 @@ private void updateGlobalMetric(PTableRef pTableRef) {
@Override
public PTableRef getTableRef(PTableKey key) throws TableNotFoundException {
+ return getTableRef(key, false);
+ }
+
+ @Override
+ public PTableRef getTableRefNoTNFE(PTableKey key) {
+ try {
+ return getTableRef(key, true);
+ } catch (TableNotFoundException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ private PTableRef getTableRef(PTableKey key, boolean skipTNFE) throws
TableNotFoundException {
if (physicalNameToLogicalTableMap.containsKey(key.getName())) {
key = physicalNameToLogicalTableMap.get(key.getName());
}
PTableRef ref = metaData.get(key);
if (!key.getName().contains(QueryConstants.SYSTEM_SCHEMA_NAME)) {
updateGlobalMetric(ref);
}
- if (ref == null) {
+ if (ref == null && ! skipTNFE) {
Review Comment:
Actually, creating Exception object here slows down the time taken by upsert
calls by 30-40%. In fact, @haridsv highlighted to me that Exception as control
flow is a common anti pattern and this is slowing down upserts for tenant
connection by 30-40%.
--
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]