You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am running into hard-to-understand errors from VTGate when parsing different SQL queries. Specifically, the errors refer to unknown column. The column/table/schema all exist - the main issue is figuring out what kind of SQL will actually work in each given case.
CREATETABLE `plans` (
`plan_id`bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`site_id`bigint(20) unsigned NOT NULL,
`dunning_campaign_id`bigint(20) unsigned DEFAULT NULL,
`name`varchar(255) NOT NULL,
`merchant_plan_id`varchar(50) NOT NULL,
`description`text,
`status` enum('ACTIVE','INACTIVE','REQUESTED','BANNED','DELETED') NOT NULL DEFAULT 'ACTIVE',
`created_at` datetime NOT NULL,
`modified_at` datetime NOT NULL,
`deleted_at` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
`trial_period_id`bigint(20) unsigned DEFAULT NULL,
`trial_requires_billing_info`tinyint(1) NOT NULL DEFAULT '1',
`total_billing_cycles`int(11) DEFAULT NULL,
`auto_renew`tinyint(1) DEFAULT '1',
`send_renewal_reminders`tinyint(1) unsigned NOT NULL DEFAULT '0',
`send_trial_reminders`tinyint(1) unsigned NOT NULL DEFAULT '0',
`notify_days_before_trial`int(11) unsigned NOT NULL DEFAULT '3',
`bypass_hosted_confirmation`tinyint(1) NOT NULL DEFAULT '0',
`display_donation_amounts`tinyint(1) NOT NULL DEFAULT '0',
`success_url`varchar(255) DEFAULT NULL,
`cancel_url`varchar(255) DEFAULT NULL,
`unit_name`varchar(50) NOT NULL DEFAULT 'unit',
`target_version_id_for_existing_subscriptions`bigint(20) unsigned DEFAULT NULL,
`display_phone_number`tinyint(1) NOT NULL DEFAULT '0',
`payment_page_tos_link`varchar(255) DEFAULT NULL,
`backfilled_for_terms`tinyint(1) NOT NULL DEFAULT '0',
`allow_any_item_on_subscriptions`tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`plan_id`),
UNIQUE KEY `index_plans_on_site_id_merchant_plan_id_status_deleted_at` (`site_id`,`merchant_plan_id`,`status`,`deleted_at`),
KEY `index_plans_on_modified_at` (`modified_at`),
KEY `index_plans_on_site_id_and_status_and_created_at` (`site_id`,`status`,`created_at`),
KEY `index_plans_on_site_id_and_status_and_modified_at` (`site_id`,`status`,`modified_at`),
KEY `index_plans_on_trial_period_id_and_status` (`trial_period_id`,`status`),
KEY `index_plans_on_dunning_campaign_id` (`dunning_campaign_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3398989776339835630 DEFAULT CHARSET=utf8
another keyspace I have is called recurly which has MoveTables workflows replicating the above tables into it
There are associated RoutingRules for these tables, as they are being migrated from external and catalog keyspaces into recurly. The routing rules currently move only replica and rdonly traffic into recurly keyspace
mysql -A -h 127.0.0.1 -P 3306 -u root catalog -e 'select * from catalog.plans where catalog.plans.site_id = 988673674913 limit 2'
ERROR 1054 (42S22) at line 1: target: catalog.-.master: vttablet: rpc error: code = NotFound desc = Unknown column 'catalog.plans.site_id' in 'where clause' (errno 1054) (sqlstate 42S22) (CallerID: root): Sql: "select plans.plan_id as plan_id, plans.site_id as site_id, plans.dunning_campaign_id as dunning_campaign_id, plans.`name` as `name`, plans.merchant_plan_id as merchant_plan_id, plans.description as description, plans.`status` as `status`, plans.created_at as created_at, plans.modified_at as modified_at, plans.deleted_at as delet
and
Execute: symbol plans.merchant_plan_id not found, request: map[BindVariables:map[vtg1:type:INT64 value:"3398944155452550579" vtg2:type:VARBINARY value:"mtm-arrears" vtg3:type:INT64 value:"1"] Session:autocommit:true target_string:"external" options:{included_fields:ALL client_found_rows:true workload:OLTP} found_rows:1 row_count:-1 DDLStrategy:"direct" SessionUUID:"e7023dee-3cba-11ec-ac30-a228c8bc1979" Sql:SELECT `subscriptions`.* FROM `subscriptions` INNER JOIN `catalog`.`plans` ON `catalog`.`plans`.`plan_id` = `subscriptions`.`plan_id` WHERE `subscriptions`.`account_id` = 3398944155452550579 AND `subscriptions`.`is_live` = TRUE AND `plans`.`merchant_plan_id` != 'mtm-arrears' ORDER BY `subscriptions`.`id` ASC LIMIT 1]
Errors seem to depend on if each column is fully qualified <keyspace>.<table>.<column>; but the first example query will work if only <table>.<column> are specified in the WHERE clause (which doesn't quite make sense)
Binary version
Example:
vitess@vitess-cluster-uscentral1b0-vtgate-c8b546d6-7dc7f9dfb9-pdtvq:/$ vtgate --version
ERROR: logging before flag.Parse: E1103 18:09:47.025244 20 syslogger.go:149] can't connect to syslogVersion: 11.0.0 (Git revision aa798b854a branch 'HEAD') built on Wed Oct 27 19:05:24 UTC 2021 by vitess@48e958bfcb18 using go1.15.6 linux/amd64
Operating system and Environment details
OS, Architecture, and any other information you can provide
about the environment.
VTGate doesn't seem to log these query errors with gen4 planner.
The text was updated successfully, but these errors were encountered:
artemvovk
changed the title
"Unknown column" errors with gen3 and gen4 planners
RoutingRules: "Unknown column" errors with gen3 and gen4 planners
Nov 3, 2021
Overview of the Issue
I am running into hard-to-understand errors from VTGate when parsing different SQL queries. Specifically, the errors refer to
unknown column
. The column/table/schema all exist - the main issue is figuring out what kind of SQL will actually work in each given case.seems related: #8054
Reproduction Steps
All queries have been tested using v3 and gen4fallback planners.
Steps to reproduce this issue, example:
schema
:external
keyspace:another keyspace I have is called
recurly
which has MoveTables workflows replicating the above tables into itexternal
andcatalog
keyspaces intorecurly
. The routing rules currently move onlyreplica
andrdonly
traffic intorecurly
keyspaceand
<keyspace>.<table>.<column>
; but the first example query will work if only<table>.<column>
are specified in theWHERE
clause (which doesn't quite make sense)Binary version
Example:
Operating system and Environment details
OS, Architecture, and any other information you can provide
about the environment.
Log Fragments
VTGate doesn't seem to log these query errors with gen4 planner.
The text was updated successfully, but these errors were encountered: