[ https://issues.apache.org/jira/browse/CASSANDRA-14677?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16597219#comment-16597219 ]
Aleksey Yeschenko commented on CASSANDRA-14677: ----------------------------------------------- bq. Previously, we had memoized auditLogEnabled in the parent Request class in order read the volatile auditLogManager.isAuditingEnabled() only once per instance. With this refactor, you are calling auditLogManager.isAuditingEnabled() every time you need to check if logging is still enabled, which references a volatile variable (AuditLogManager.isAuditLogEnabled). You might consider memoizing the value again. I can only sigh at this. It seems to me like the author of the patch didn't really know the cost of reading a volatile field, if they chose to add entire three fields to every request object just to avoid it. Hint: the cost is negligible in comparison, it might merely prevent some reordering. Additionally: 1. {{AuditLogManager.instance}} itself is a final field, why was it memoized? 2. Instead of hoisting them, the original author could still just read them once as local variables in {{execute()}} implementations, as they aren't used outside. > Clean up Message.Request implementations > ---------------------------------------- > > Key: CASSANDRA-14677 > URL: https://issues.apache.org/jira/browse/CASSANDRA-14677 > Project: Cassandra > Issue Type: Improvement > Reporter: Aleksey Yeschenko > Assignee: Aleksey Yeschenko > Priority: Minor > Fix For: 4.0.x > > > First tracing support, many years ago, then most recently audit log, made a > big mess out of {{Message.Request.execute()}} implementations. > This patch tries to clean up some of it by removing tracing logic from > {{QueryState}} and moving shared tracing functionality to > {{Message.Request.perform()}}. It also moves out tracing and audit log boiler > plate into their own small methods instead of polluting {{execute()}} > implementations. -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org