Skip to content
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

vtgate: schema tracker panic on generated point column #17678

Closed
derekperkins opened this issue Jan 31, 2025 · 0 comments · Fixed by #17680
Closed

vtgate: schema tracker panic on generated point column #17678

derekperkins opened this issue Jan 31, 2025 · 0 comments · Fixed by #17680
Labels
Component: VTGate Needs Triage This issue needs to be correctly labelled and triaged Type: Bug

Comments

@derekperkins
Copy link
Member

derekperkins commented Jan 31, 2025

Overview of the Issue

I triggered the same error as #17670 today with a generated point column. Here was the alter schema I ran, which successfully was processed through a vtgate connection, but then immediately brought down all vtgates.

alter table locations
add lat_long point as (
    point(
            geocode->>'$.geometry.location.lat',
            geocode->>'$.geometry.location.lng'
    )
)
SRID 4326 after geocodes;

I believe @dbussink already fixed the panic with #17659, but support still needs to be added

Related Issues:

Reproduction Steps

CREATE TABLE `locations` (
  `location_id` mediumint unsigned NOT NULL AUTO_INCREMENT,
  `country_code` binary(2) NOT NULL,
  `type` varbinary(22) NOT NULL,
  `location` varbinary(85) NOT NULL,
  `name_no_context` varbinary(85) NOT NULL,
  `country_location_id` mediumint unsigned NOT NULL,
  `geocode` json DEFAULT NULL,
  `geocodes` json DEFAULT NULL,
  `lat_long` point GENERATED ALWAYS AS (point(json_unquote(json_extract(`geocode`,_utf8mb4'$.geometry.location.lat')),json_unquote(json_extract(`geocode`,_utf8mb4'$.geometry.location.lng')))) VIRTUAL /*!80003 SRID 4326 */,
  `time_zone` json DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`location_id`),
  UNIQUE KEY `country_code__type__location__uq` (`country_code`,`type`,`location`),
  UNIQUE KEY `location_id__country_code__uq` (`location_id`,`country_code`),
  KEY `name_no_context__type` (`name_no_context`,`type`),
  KEY `type__name_no_context` (`type`,`name_no_context`),
  KEY `location__type` (`location`,`type`),
  KEY `type__location` (`type`,`location`),
  KEY `locations__country_location_id__location_id__fk` (`country_location_id`),
  CONSTRAINT `fk_Locations_Countries` FOREIGN KEY (`country_code`) REFERENCES `countries` (`country_code`),
  CONSTRAINT `locations__country_location_id__location_id__fk` FOREIGN KEY (`country_location_id`) REFERENCES `locations` (`location_id`)
) ENGINE=InnoDB AUTO_INCREMENT=314105 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

Binary Version

v21.0.1

Operating System and Environment details

GKE v1.31

Log Fragments

W0131 22:04:23.457072       1 parser.go:85] ignoring error parsing DDL syntax error at position 576 near 'SRID'
...
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0x1724e12]

goroutine 1 [running]:
vitess.io/vitess/go/exit.doRecover({0x1b80f40?, 0x378f650?}, 0x40?)
	vitess.io/vitess/go/exit/exit.go:92 +0x126
vitess.io/vitess/go/exit.Recover()
	vitess.io/vitess/go/exit/exit.go:69 +0x1f
panic({0x1b80f40?, 0x378f650?})
	runtime/panic.go:785 +0x132
vitess.io/vitess/go/vt/vtgate/schema.getTableCollation(0x19d0a2a?)
	vitess.io/vitess/go/vt/vtgate/schema/tracker.go:413 +0x12
vitess.io/vitess/go/vt/vtgate/schema.getColumns(0x0)
	vitess.io/vitess/go/vt/vtgate/schema/tracker.go:374 +0x2a
vitess.io/vitess/go/vt/vtgate/schema.(*Tracker).updateTables(0xc000dddc20, {0xc000bc031c, 0x9}, 0xc00134ccd0?)
	vitess.io/vitess/go/vt/vtgate/schema/tracker.go:367 +0xf3
vitess.io/vitess/go/vt/vtgate/schema.(*Tracker).loadTables.func1(0xc00134ccd0)
	vitess.io/vitess/go/vt/vtgate/schema/tracker.go:120 +0x38
vitess.io/vitess/go/vt/vttablet/grpctabletconn.(*gRPCQueryClient).GetSchema(0xc000921080, {0x2406a68?, 0x3846c20?}, 0xc0012de7e0, 0x1, {0x0, 0x0, 0x0}, 0xc001109640)
	vitess.io/vitess/go/vt/vttablet/grpctabletconn/conn.go:1141 +0x218
vitess.io/vitess/go/vt/vttablet/queryservice.(*wrappedService).GetSchema.func1({0x2406a68, 0x3846c20}, 0xc001139f38?, {0x242d050?, 0xc000921080?})
	vitess.io/vitess/go/vt/vttablet/queryservice/wrapped.go:345 +0x50
vitess.io/vitess/go/vt/vtgate.(*TabletGateway).withRetry(0xc0000f6700, {0x2406a68, 0x3846c20}, 0xc0012de7e0, {0xc000b636a0?, 0x410be5?}, {0x30?, 0x1cad6a0?}, 0x0, 0xc000c38750)
	vitess.io/vitess/go/vt/vtgate/tabletgateway.go:411 +0x872
vitess.io/vitess/go/vt/vttablet/queryservice.(*wrappedService).GetSchema(0xc000714618, {0x2406a68, 0x3846c20}, 0xc0012de7e0, 0x1, {0x0, 0x0, 0x0}, 0xc001109640)
	vitess.io/vitess/go/vt/vttablet/queryservice/wrapped.go:344 +0xf9
vitess.io/vitess/go/vt/vtgate/schema.(*Tracker).loadTables(0xc000dddc20, {0x242ce30, 0xc0000f6700}, 0xc0012de7e0)
	vitess.io/vitess/go/vt/vtgate/schema/tracker.go:119 +0x1bb
vitess.io/vitess/go/vt/vtgate/schema.(*Tracker).LoadKeyspace(0xc000dddc20, {0x242ce30, 0xc0000f6700}, 0xc0012de7e0)
	vitess.io/vitess/go/vt/vtgate/schema/tracker.go:86 +0x2b
vitess.io/vitess/go/vt/vtgate/schema.(*Tracker).AddNewKeyspace(0xc000dddc20, {0x242ce30, 0xc0000f6700}, 0xc0012de7e0)
	vitess.io/vitess/go/vt/vtgate/schema/tracker.go:482 +0x167
vitess.io/vitess/go/vt/vtgate.resolveAndLoadKeyspace({0x2406b50?, 0xc0002ca370?}, 0xc0002ca370?, 0xc000dddc20, 0xc0000f6700, {0xc000bc031c, 0x9})
	vitess.io/vitess/go/vt/vtgate/vtgate.go:415 +0x29f
vitess.io/vitess/go/vt/vtgate.addKeyspacesToTracker({0x2406b50, 0xc0002ca370}, 0xc000efba40, 0xc000dddc20, 0xc0000f6700)
	vitess.io/vitess/go/vt/vtgate/vtgate.go:396 +0x145
vitess.io/vitess/go/vt/vtgate.Init({0x2406b50, 0xc0002ca370}, 0xc0006e7b90, {0x0?, 0x0?}, {0x240c300, 0xc0004ce160}, {0x7ffc1b62cf10, 0xa}, {0xc000988188, ...}, ...)
	vitess.io/vitess/go/vt/vtgate/vtgate.go:315 +0x9ca
@derekperkins derekperkins added Needs Triage This issue needs to be correctly labelled and triaged Type: Bug Component: VTGate labels Jan 31, 2025
@derekperkins derekperkins changed the title vtgate: vtgate: schema tracker panic on generated point column Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: VTGate Needs Triage This issue needs to be correctly labelled and triaged Type: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant