zeroshade commented on code in PR #38797:
URL: https://github.com/apache/arrow/pull/38797#discussion_r1400831750
##########
go/arrow/datatype_fixedwidth.go:
##########
@@ -398,10 +402,15 @@ func (t *TimestampType) ClearCachedLocation() {
// so if you change the value of TimeZone after calling this, make sure to call
// ClearCachedLocation.
func (t *TimestampType) GetZone() (*time.Location, error) {
+ t.mx.RLock()
if t.loc != nil {
+ defer t.mx.RUnlock()
return t.loc, nil
}
+ t.mx.RUnlock()
+ t.mx.Lock()
+ defer t.mx.Unlock()
Review Comment:
I'll add the check of `t.loc` after the write lock is acquired for now. My
original attempt at this was to use `atomic.Pointer` for the loc but it made
the test initialization for some of the tests annoying since you can't copy an
`atomic.Pointer` and I didn't want to deal with refactoring the tests right
now.
For now, the `RWMutex` should be good enough with the added check to avoid
the duplicate work. Nice catch!
--
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]