-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Errors after upgrade to 22.1.1 #82576
Comments
Hello, I am Blathers. I am here to help you get the issue triaged. Hoot - a bug! Though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here. I have CC'd a few people who may be able to assist you:
If we have not gotten back to your issue within a few business days, you can try the following:
🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is otan. |
Has this cluster been upgraded from many versions ago? We know of such a problem when creating this relation in 19.2 or earlier, but I don't think we know of such a corruption bug from later creations. Is this such a case? |
FWIW, we can happily help you to repair this situation. Sorry you've hit it! |
I have performed upgrade from 21.1.3 -> 21.2.12 -> 22.1.1. Cluster - single node. |
Any update? I have the same issue when updating to version 22.1.1. I neither can rollback to the previous version due to this error |
Yeah, we'll provide a query to do a repair and patch the next 22.1 point release. That's as good as I think we can do. Sorry you hit this. Working on it now. |
Okay, here's the repair query for the case where you have exactly the error reported above. If in doubt, don't run it and ask for advice here. The query will find the corruption where we failed to properly record the column ID for the sequence reference. It should only be run on version 22.1. WITH tables AS (
SELECT *
FROM (
SELECT id,
crdb_internal.pb_to_json(
'cockroach.sql.sqlbase.Descriptor',
descriptor
)->'table' AS tab
FROM system.descriptor
)
WHERE tab IS NOT NULL
),
columns_using_sequence_ids AS (
SELECT table_id,
(c->'id')::INT8 AS column_id,
json_array_elements(c->'usesSequenceIds')::INT8 AS seq_id
FROM (
SELECT id AS table_id, c
FROM tables,
ROWS FROM (json_array_elements(tab->'columns')) AS t
(c)
)
WHERE (c->'usesSequenceIds') IS NOT NULL
AND json_array_length(c->'usesSequenceIds') = 1
),
sequences_with_missing_depended_on_by AS (
SELECT seq_id, (dep->>'id')::INT8 AS table_id, ord, dep
FROM (
SELECT id AS seq_id, dep, ord - 1 AS ord
FROM tables,
ROWS FROM (
json_array_elements(tab->'dependedOnBy')
) WITH ORDINALITY AS t (dep, ord)
WHERE (tab->'sequenceOpts') IS NOT NULL
AND EXISTS(
SELECT *
FROM ROWS FROM (
json_array_elements(
tab->'dependedOnBy'
)
) AS t (dep)
WHERE dep->'columnIds' @> '[0]'::JSONB
)
)
WHERE (dep->>'byId')::BOOL
),
depended_on_by_entries AS (
SELECT s.seq_id, ord, json_agg(t.column_id) AS column_ids
FROM columns_using_sequence_ids AS t
JOIN sequences_with_missing_depended_on_by AS s ON t.table_id
= s.table_id
AND t.seq_id
= s.seq_id
GROUP BY s.seq_id, s.table_id, ord
),
updated_entries AS (
SELECT seq_id, ord, json_set(d, ARRAY['columnIds'], column_ids) AS d
FROM depended_on_by_entries
JOIN tables ON seq_id = tables.id
JOIN ROWS FROM (
json_array_elements(tab->'dependedOnBy')
) WITH ORDINALITY AS jae (d, idx) ON ord = idx - 1
),
depended_on_by_arrs AS (
SELECT seq_id, json_agg(d ORDER BY ord ASC) AS depended_on_by
FROM updated_entries
GROUP BY seq_id
)
SELECT crdb_internal.unsafe_upsert_descriptor(
seq_id,
crdb_internal.json_to_pb(
'cockroach.sql.sqlbase.Descriptor',
json_build_object(
'table',
json_remove_path(
json_set(
json_set(tab, ARRAY['dependedOnBy'], depended_on_by),
ARRAY['version'],
((tab->>'version')::INT8 + 1)::STRING::JSONB
),
ARRAY['modificationTime']
)
)
),
true
)
FROM depended_on_by_arrs JOIN tables ON id = seq_id; |
@minhdang241 your issue is not the same as this one. We communicated in the community slack regarding your issue. I'll do something for that too. |
82724: spanconfig: reset job run_stats to avoid job system backoff r=[irfansharif,adityamaru] a=stevendanna If the coordinator of the span configuration job dies, another node will adopt the job. However, when doing so it will bump the num_runs run stat. As this number increases, the job system will delay future resumptions of this job. We solve this here by resetting the job's run_stats at the beginning of the job. We've yet again handled this in the job directly rather than adjusting the behavior of the job system. In this case, my justification is that this solution is fit for backporting. Fixes #82689 Release note (bug fix): Fix a bug where the startup of an internal component after a server restart could result in the delayed application of zone configuration. 82814: backupccl: small error message nitpicks r=adityamaru a=stevendanna I noticed these when reading through the RESTORE code. Release note: None 82833: sql/catalog/tabledesc: permit zero-valued column IDs in DependedOnBy r=ajwerner a=ajwerner In 21.1 there was a bug whereby we would store a 0-value column ID in the sequence's DependedOnBy because we'd add the depedency before allocating an ID to the column. This bug was fixed in 21.2. Below is a reproduction I've used to play with this bug: ```bash roachprod wipe local roachprod stage local release v21.1.3 roachprod run local -- mv cockroach cockroach-v21.1.3 roachprod stage local release v21.2.10 roachprod run local -- mv cockroach cockroach-v21.2.10 roachprod stage local release v22.1.1 roachprod run local -- mv cockroach cockroach-v22.1.1 roachprod start local --binary cockroach-v21.1.3 roachprod sql local -- -e "create table t1( i int primary key); create table t2(i int primary key); create sequence s1; create sequence s2; ALTER TABLE t1 ADD c1 BIGINT DEFAULT nextval('s1') NOT NULL; ALTER TABLE t1 ADD c2 BIGINT DEFAULT nextval('s2') NOT NULL; ALTER TABLE t2 ADD c1 BIGINT DEFAULT nextval('s1') NOT NULL;" roachprod stop local roachprod start local --binary cockroach-v21.2.10 while ! { roachprod sql local -- -e 'show cluster setting version' | grep 21.2 ; }; do sleep 1; done roachprod sql local -- -e "alter table t1 add column c3 int default nextval('s1'); create table t3 (i int primary key); alter table t3 add column c1 int default nextval('s1');" roachprod stop local roachprod start local --binary cockroach-v22.1.1 while ! { roachprod sql local -- -e 'show cluster setting version' | grep 22.1 ; }; do sleep 1; done ``` For now, for the rest of 22.1 we'll let this slide. As follow-up work, we'll perform a migration to repair this situation and add back this validation once the migration has been performed. Relates to #82576. Release note (bug fix): In earlier 22.1 releases of cockroach, added validation could cause problems for descriptors which carried invalid backreferences due to an earlier bug in 21.1. This stricter validation could result in a variety of query failures. This patch weakens the validation to permit the corruption as we know it. A subsequent patch in 22.2 will be created to repair the invalid reference. Co-authored-by: Steven Danna <[email protected]> Co-authored-by: Andrew Werner <[email protected]>
Fixed by #82859. |
This upgrade attempts to update invalid column IDs in sequence back references, if any, on a best-effort basis. The context of the need for such an upgrade can be found in cockroachdb#82576. The summary there is bugs in prior versions might cause sequence descriptor corruption where their back references might contain a column ID 0. We ought to figure out what the actual column ID is and update such invalid column IDs.
This upgrade attempts to update invalid column IDs in sequence back references, if any, on a best-effort basis. The context of the need for such an upgrade can be found in cockroachdb#82576. The summary there is bugs in prior versions might cause sequence descriptor corruption where their back references might contain a column ID 0. We ought to figure out what the actual column ID is and update such invalid column IDs.
This upgrade attempts to update invalid column IDs in sequence back references, if any, on a best-effort basis. The context of the need for such an upgrade can be found in cockroachdb#82576. The summary there is bugs in prior versions might cause sequence descriptor corruption where their back references might contain a column ID 0. We ought to figure out what the actual column ID is and update such invalid column IDs.
This upgrade attempts to update invalid column IDs in sequence back references, if any, on a best-effort basis. The context of the need for such an upgrade can be found in cockroachdb#82576. The summary there is bugs in prior versions might cause sequence descriptor corruption where their back references might contain a column ID 0. We ought to figure out what the actual column ID is and update such invalid column IDs.
This upgrade attempts to update invalid column IDs in sequence back references, if any, on a best-effort basis. The context of the need for such an upgrade can be found in cockroachdb#82576. The summary there is bugs in prior versions might cause sequence descriptor corruption where their back references might contain a column ID 0. We ought to figure out what the actual column ID is and update such invalid column IDs.
This upgrade attempts to update invalid column IDs in sequence back references, if any, on a best-effort basis. The context of the need for such an upgrade can be found in cockroachdb#82576. The summary there is bugs in prior versions might cause sequence descriptor corruption where their back references might contain a column ID 0. We ought to figure out what the actual column ID is and update such invalid column IDs.
This upgrade attempts to update invalid column IDs in sequence back references, if any, on a best-effort basis. The context of the need for such an upgrade can be found in cockroachdb#82576. The summary there is bugs in prior versions might cause sequence descriptor corruption where their back references might contain a column ID 0. We ought to figure out what the actual column ID is and update such invalid column IDs.
This upgrade attempts to update invalid column IDs in sequence back references, if any, on a best-effort basis. The context of the need for such an upgrade can be found in cockroachdb#82576. The summary there is bugs in prior versions might cause sequence descriptor corruption where their back references might contain a column ID 0. We ought to figure out what the actual column ID is and update such invalid column IDs.
This upgrade attempts to update invalid column IDs in sequence back references, if any, on a best-effort basis. The context of the need for such an upgrade can be found in cockroachdb#82576. The summary there is bugs in prior versions might cause sequence descriptor corruption where their back references might contain a column ID 0. We ought to figure out what the actual column ID is and update such invalid column IDs.
This upgrade attempts to update invalid column IDs in sequence back references, if any, on a best-effort basis. The context of the need for such an upgrade can be found in cockroachdb#82576. The summary there is bugs in prior versions might cause sequence descriptor corruption where their back references might contain a column ID 0. We ought to figure out what the actual column ID is and update such invalid column IDs.
This upgrade attempts to update invalid column IDs in sequence back references, if any, on a best-effort basis. The context of the need for such an upgrade can be found in cockroachdb#82576. The summary there is bugs in prior versions might cause sequence descriptor corruption where their back references might contain a column ID 0. We ought to figure out what the actual column ID is and update such invalid column IDs.
Describe the problem
I have upgraded my cockroach from 21.2.12 to 22.1.1. After that I have met an issue
To Reproduce
In database we have:
Expected behavior
No error messages
Environment:
Jira issue: CRDB-16567
The text was updated successfully, but these errors were encountered: