Comments (3)
I think that we should be using
protojson.Unmarshal
which supports both the json names and the proto names.
This seems wrong. json2
calls protojson
if the given target is a proto.Message
and it adds more human readable / better error messages. We should be using json2
really and I'm very confused why it doesn't work then. I think we should understand that first before it's changed to protojson
(and we might have bugs like this in more places if there's some way json2
doesn't work as expected).
Lines 35 to 38 in 6fb0f0e
from vitess.
The problem is here: https://github.com/vitessio/vitess/blob/main/go/cmd/vtctldclient/command/routing_rules.go#L84-L87
I think that we should be using protojson.Unmarshal
which supports both the json names and the proto names.
Test case that fails on main:
git checkout main && make build
pushd examples/local
./101_initial_cluster.sh
vtctldclient ApplyRoutingRules --rules '{
"rules": [
{
"fromTable": "sbtest1",
"toTables": [
"sbtest.sbtest1"
]
}
]
}'
That same test case works as expected after this patch/fix:
diff --git a/go/cmd/vtctldclient/command/routing_rules.go b/go/cmd/vtctldclient/command/routing_rules.go
index 0ffee0c2c2..119c8dbb41 100644
--- a/go/cmd/vtctldclient/command/routing_rules.go
+++ b/go/cmd/vtctldclient/command/routing_rules.go
@@ -23,9 +23,9 @@ import (
"strings"
"github.com/spf13/cobra"
+ "google.golang.org/protobuf/encoding/protojson"
"vitess.io/vitess/go/cmd/vtctldclient/cli"
- "vitess.io/vitess/go/json2"
vschemapb "vitess.io/vitess/go/vt/proto/vschema"
vtctldatapb "vitess.io/vitess/go/vt/proto/vtctldata"
@@ -82,7 +82,7 @@ func commandApplyRoutingRules(cmd *cobra.Command, args []string) error {
}
rr := &vschemapb.RoutingRules{}
- if err := json2.Unmarshal(rulesBytes, &rr); err != nil {
+ if err := protojson.Unmarshal(rulesBytes, rr); err != nil {
return err
}
I'm not sure if that's the right/best ultimate fix, but it points to the problem space.
from vitess.
fixed via #16096
from vitess.
Related Issues (20)
- UNION with literals and grouping fails planning
- Online DDL: switch unique key and column logic to declarative `schemadiff` analysis
- Bug Report: `Group_concat` with separator crashes vtgate during planning
- Bug Report: `show vitess_migrations` not supported from inside a transaction
- Feature Request: `txthrottler` to poll replication lag on `PRIMARY` only
- Investigate GOGC performance impact
- RFC: Atomic Distributed Transactions HOT 4
- Bug Report: Json_ArrayAgg and Json_ObjectAgg not working in having clause HOT 1
- DECIMAL Values returned as BIGINT
- Wrong results from query with GROUP BY and LIMIT
- RFC: Improve Topology Server Locking
- Feature Request: Better aggregation planning
- `mysqlbinlog` not found during incremental backup in v19.x and v20.x HOT 1
- Bug Report: vtctldclient Reshard panic when target shard has no PRIMARY tablet
- Feature Request: `vitess/vtctldclient` container image
- Feature Request: MySQL Shell Logical Backups
- Reverse workflows fail in some MoveTables workflows in FKManaged clusters HOT 1
- vtorc/vttablet: can't downgrade from v20 to v19
- Bug Report: long GTIDs cause xtrabackup backups to fail
- Feature Request: make VDiff support multi-tenant migrations HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vitess.