serverutils: nil check system config cache#89419
serverutils: nil check system config cache#89419ajwerner wants to merge 1 commit intocockroachdb:masterfrom
Conversation
msirek
left a comment
There was a problem hiding this comment.
Thanks for fixing this!
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @ajwerner and @msirek)
pkg/testutils/serverutils/test_cluster_shim.go line 267 at r1 (raw file):
sysconfigProvider := cluster.Server(i).SystemConfigProvider() if sysconfig := sysconfigProvider.GetSystemConfig(); sysconfig != nil { sysconfig.PurgeZoneConfigCache()
If sysconfig could be nil, would you mind also fixing this location? :
cockroach/pkg/sql/logictest/logic.go
Lines 2263 to 2269 in e0e5911
|
Looking more closely, I don't think I understand #87391. It clears a cache but the cache's source data should be immutable. Every time the system config values change, we construct a new |
msirek
left a comment
There was a problem hiding this comment.
I am not sure about the details of how the zone config gets propagated, but I've seen the SystemConfig get created and be available, but at the time getZoneEntry is called for a database (as the referenced parent of a table), the zone config is not available yet, so calling thezoneConfigHook causes a nil ZoneConfig to be returned:
cockroach/pkg/sql/zone_config.go
Lines 197 to 199 in 4c43c2b
We cache the nil
ZoneConfig, so even if the config becomes available later, we won't load it because the nil is cached. Clearing out the cache causes future calls togetZoneEntry to look it up again and find it. I saw this comment in tests, not sure if it's related:Is it problematic for zone configs to not be immediately available if a table which depends on one is used? I don't know if there's a bigger issue here.
Reviewable status:
complete! 0 of 0 LGTMs obtained (waiting on @ajwerner and @msirek)
|
The part I don't get is that when the changes propagate, the object is replaced wholesale -- cache included. Do you know of a test which fails without the cache clearing change? |
Yes, |
|
Fixing this through #90802, including the |
See here
Release note: None