-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stats: break Gossip dependency #47925
Comments
Deprecated() calls are blocking phase 2, but the ones made optional here were not. Touches cockroachdb#47900. Touches cockroachdb#47925. Release note: None
Deprecated() calls are blocking phase 2, but the ones made optional here were not. Touches cockroachdb#47900. Touches cockroachdb#47925. Release note: None
@RaduBerinde I feel like you told me before but can you write down what the consequences would be of not doing this. Would stats just arrive on the node with a delay? |
Currently they won't be updated at all without gossip (except on the local node where they are generated). There is no "polling" in place for table stats. |
For Phase 2, I believe things would just work without Gossip, as we also notify the local stats cache directly (this was to guarantee in tests that the next statement would use new stats). |
I'm trying to run the
I wondered whether it had anything to do with disabling auto stats on the backing kv cluster and (since setting cluster settings on a tenant only affect the in-memory setting), but enabling that doesn't result in a difference. To reproduce paste the above logictest into a |
The logs show this error:
I guess the stats plan can't be fused into a single processor. @andreimatei I think you ran into this at some point and fixed something, do you remember? |
I think maybe this is what #52621 is trying to address. |
@asubiotto I don't understand why you expect this to work when there is a known issue that you have a PR out for? Or is the problem still happening with your PR? |
Woops, I did not see the logs. I just posted here since I saw no stats and that the expectation was that this should work. #52621 should fix this, sorry for the noise. |
Should be fixed now then, right? Can we confirm, add the test, and close? |
|
The INJECT STATS statement still uses gossip in a way that refers to this issue. |
CREATE STATS too |
So just to confirm, the remaining work here is to remove all references to Gossip in stats for post-Phase 2, in which tenants may have multiple SQL servers? What is the timeline for this? Is the suggested solution to use polling? Are there other DB features that have moved from Gossip to polling? Or have they used something else? |
54256: sql: make multi-tenancy errors report to telemetry r=asubiotto a=knz Fixes #48164. Issues referenced, I also added the X-anchored-telemetry label to them on github (we keep those issues open on github until their reference in the code is removed): #54254 #54255 #54250 #54251 #54252 #49854 #48274 #47150 #47971 #47970 #47900 #47925 Co-authored-by: Raphael 'kena' Poss <knz@thaumogen.net>
There is a new subsystem alongside gossip called "gossip subscriptions". |
Got it - thanks! |
It looks like the best option is to set up a RangeFeed on the entire |
We currently use gossip to keep table stats caches updated when new statistics become available. This mechanism is not available in multi-tenant configurations (currently we only support single SQL nodes in that configuration and we refresh the cache on the same node out of band). This commit changes this mechanism to use a range feed that listens for updates to system.table_statistics. This is a cleaner mechanism as it doesn't require any out-of-band coordination. The range feed events are on a row-by-row basis; a statistics collection typically inserts multiple rows. We handle this by remembering the timestamp of the table_statistics row that triggered the last update. In addition, we remember information about the last event to avoid unnecessary overhead. Note that we continue to send gossip updates when new statistics are available, to keep things working for mixed-version clusters during upgrade. Fixes cockroachdb#47925. Release note: None
We currently use gossip to keep table stats caches updated when new statistics become available. This mechanism is not available in multi-tenant configurations (currently we only support single SQL nodes in that configuration and we refresh the cache on the same node out of band). This commit changes this mechanism to use a range feed that listens for updates to system.table_statistics. This is a cleaner mechanism as it doesn't require any out-of-band coordination. The range feed events are on a row-by-row basis; a statistics collection typically inserts multiple rows. We handle this by remembering the timestamp of the table_statistics row that triggered the last update. In addition, we remember information about the last event to avoid unnecessary overhead. Note that we continue to send gossip updates when new statistics are available, to keep things working for mixed-version clusters during upgrade. Fixes cockroachdb#47925. Release note: None
62563: sql: use a range feed for refreshing the table stats cache r=RaduBerinde a=RaduBerinde We currently use gossip to keep table stats caches updated when new statistics become available. This mechanism is not available in multi-tenant configurations (currently we only support single SQL nodes in that configuration and we refresh the cache on the same node out of band). This commit changes this mechanism to use a range feed that listens for updates to system.table_statistics. This is a cleaner mechanism as it doesn't require any out-of-band coordination. The range feed events are on a row-by-row basis; a statistics collection typically inserts multiple rows. We handle this by remembering the timestamp of the table_statistics row that triggered the last update. In addition, we remember information about the last event to avoid unnecessary overhead. Note that we continue to send gossip updates when new statistics are available, to keep things working for mixed-version clusters during upgrade. Fixes #47925. Release note: None Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
Keeping open until we have something backported. |
This is a modified backport of cockroachdb#62563 (description below). The difference is that we keep both mechanisms and only use the range cache when gossip is not available (i.e. multi-tenant). This avoids potential regressions caused by the new mechanism. --- We currently use gossip to keep table stats caches updated when new statistics become available. This mechanism is not available in multi-tenant configurations (currently we only support single SQL nodes in that configuration and we refresh the cache on the same node out of band). This commit changes this mechanism to use a range feed that listens for updates to system.table_statistics. This is a cleaner mechanism as it doesn't require any out-of-band coordination. The range feed events are on a row-by-row basis; a statistics collection typically inserts multiple rows. We handle this by remembering the timestamp of the table_statistics row that triggered the last update. In addition, we remember information about the last event to avoid unnecessary overhead. Note that we continue to send gossip updates when new statistics are available, to keep things working for mixed-version clusters during upgrade. Fixes cockroachdb#47925. Release note: None
This is a modified backport of cockroachdb#62563 (description below). The difference is that we keep both mechanisms and only use the range cache when gossip is not available (i.e. multi-tenant). This avoids potential regressions caused by the new mechanism. --- We currently use gossip to keep table stats caches updated when new statistics become available. This mechanism is not available in multi-tenant configurations (currently we only support single SQL nodes in that configuration and we refresh the cache on the same node out of band). This commit changes this mechanism to use a range feed that listens for updates to system.table_statistics. This is a cleaner mechanism as it doesn't require any out-of-band coordination. The range feed events are on a row-by-row basis; a statistics collection typically inserts multiple rows. We handle this by remembering the timestamp of the table_statistics row that triggered the last update. In addition, we remember information about the last event to avoid unnecessary overhead. Note that we continue to send gossip updates when new statistics are available, to keep things working for mixed-version clusters during upgrade. Fixes cockroachdb#47925. Release note: None
The backport merged in #64360. |
Table stats uses gossip to notify the nodes about new statistics:
cockroach/pkg/sql/stats/stats_cache.go
Line 79 in f176a39
Multi-tenancy Phase 2 won't have gossip available. On the plus side, there will only be a single SQL server running on behalf of a tenant (meaning the use of Gossip is not necessary, you just need to notify the running process).
Post phase 2, when we consider multiple SQL servers for a given tenant, we need to properly substitute the use of Gossip, but for now here the work is to use Gossip only when it's available, but to unconditionally notify the local server. This suggests that the statistics cache should not know about gossip but should operate on a suitable notifier abstraction.
Tentatively marking as a blocker since I think we'll want to avoid disabling stats, even for the small workloads we expect to support in the beginning.
The text was updated successfully, but these errors were encountered: