dlavati commented on a change in pull request #807: HIVE-19261: Avro SerDe's InstanceCache should not be synchronized on retrieve URL: https://github.com/apache/hive/pull/807#discussion_r333403943
########## File path: serde/src/java/org/apache/hadoop/hive/serde2/avro/InstanceCache.java ########## @@ -51,20 +51,19 @@ public Instance retrieve(SeedObject hv) throws AvroSerdeException { * Retrieve (or create if it doesn't exist) the correct Instance for this * SeedObject using 'seenSchemas' to resolve circular references */ - public synchronized Instance retrieve(SeedObject hv, - Set<SeedObject> seenSchemas) throws AvroSerdeException { + public Instance retrieve(SeedObject hv, Set<SeedObject> seenSchemas) + throws AvroSerdeException { if(LOG.isDebugEnabled()) LOG.debug("Checking for hv: " + hv.toString()); if(cache.containsKey(hv)) { if(LOG.isDebugEnabled()) LOG.debug("Returning cache result."); return cache.get(hv); + } else { + if(LOG.isDebugEnabled()) LOG.debug("Creating new instance and storing in cache"); Review comment: @xhumanoid thanks for the contribution! I don't have committer rights to approve your patch, but LGTM with a few comments: - a small nitpick, but AFAIK, `isDebugEnabled` doesn't provide benefits here, only if you'd append/toString an expensive operation's result (yes, this is also ignored in a lot of places 😄) - to approve (+1) your changes, you'll have to become the assignee of the jira ticket that's currently under Fangshi Li (if that's fine with him) and change it's state with `Submit a patch` with an attached patch file (the previously attached file didn't get checked, as the issue state didn't change) - once all tests pass for it (might require a few reattachments/reruns), then someone will be able to approve it (also see https://cwiki.apache.org/confluence/display/Hive/HowToContribute#HowToContribute-CreatingaPatch) ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org