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

Binding name should be treated case-insensitive #3

Open
varuntechie opened this issue May 2, 2019 · 1 comment
Open

Binding name should be treated case-insensitive #3

varuntechie opened this issue May 2, 2019 · 1 comment

Comments

@varuntechie
Copy link
Contributor

varuntechie commented May 2, 2019

What I Did
My codes:
stmt, _ := tx.PrepareContext(ctx, "/cmd/insert into test_simple_table_2 (accountID, Name, Status) VALUES(:accountID, :Name, :Status)")
_, err = stmt.Exec(sql.Named("accountID", "12345"), sql.Named("Name", "Steve"), sql.Named("status", "done"))

What I Expected
The above codes have ":Status" in PrepareContext and "status" (lower case) in stmt.Exec
I expect Hera to do case-insensitive matching check for binding name, query should be executed successfully

What I Saw Instead
Error: bindname not found in query: :status - processing 2 8:2 status,

Here is log:
14:22:33.483756 verbose: [WORKER shd3 0 workerservice.go:169] worker_sp0 : occworker read <<< 11:2 accountID,
14:22:33.483759 debug: [WORKER shd0 0 cmdprocessor.go:541] query result 236
14:22:33.483786 debug: [WORKER shd3 0 cmdprocessor.go:173] process command 11:2 accountID,
14:22:33.483826 verbose: [WORKER shd3 0 workerservice.go:169] worker_sp0 : occworker read <<< 7:3 12345,
14:22:33.483825 debug: [WORKER shd0 0 cmdprocessor.go:541] query result 1
14:22:33.483843 debug: [WORKER shd3 0 cmdprocessor.go:173] process command 7:3 12345,
14:22:33.483875 debug: [WORKER shd0 0 cmdprocessor.go:541] query result Y
14:22:33.483901 debug: [WORKER shd0 0 cmdprocessor.go:541] query result Y
14:22:33.483903 verbose: [WORKER shd3 0 cmdprocessor.go:313] BindValue: :accountID : 0 : {12345 true}
14:22:33.483921 verbose: [WORKER shd3 0 workerservice.go:169] worker_sp0 : occworker read <<< 6:2 Name,
14:22:33.483929 debug: [WORKER shd0 0 cmdprocessor.go:541] query result 237
14:22:33.483933 debug: [WORKER shd3 0 cmdprocessor.go:173] process command 6:2 Name,
14:22:33.483949 verbose: [WORKER shd3 0 workerservice.go:169] worker_sp0 : occworker read <<< 7:3 Steve,
14:22:33.483954 debug: [WORKER shd0 0 cmdprocessor.go:541] query result 2
14:22:33.483962 debug: [WORKER shd3 0 cmdprocessor.go:173] process command 7:3 Steve,
14:22:33.483978 debug: [WORKER shd0 0 cmdprocessor.go:541] query result Y
14:22:33.483998 verbose: [WORKER shd3 0 cmdprocessor.go:313] BindValue: :Name : 0 : {Steve true}
14:22:33.484002 debug: [WORKER shd0 0 cmdprocessor.go:541] query result Y
14:22:33.484015 verbose: [WORKER shd3 0 workerservice.go:169] worker_sp0 : occworker read <<< 8:2 status,
14:22:33.484028 debug: [WORKER shd3 0 cmdprocessor.go:173] process command 8:2 status,
14:22:33.484029 debug: [WORKER shd0 0 cmdprocessor.go:541] query result 238
14:22:33.484063 warn: [WORKER shd3 0 cmdprocessor.go:253] nonexisting bindname :status
14:22:33.484067 debug: [WORKER shd0 0 cmdprocessor.go:541] query result 3
14:22:33.484117 warn: [WORKER shd3 0 workerservice.go:181] Error: bindname not found in query: :status - processing 2 8:2 status,
14:22:33.484124 debug: [WORKER shd0 0 cmdprocessor.go:541] query result Y

Or when changing case for binding name from :accountID to AccountID, I get this error:
14:55:15.571877 debug: [WORKER shd3 0 cmdprocessor.go:173] process command 11:2 AccountID,
14:55:15.571915 warn: [WORKER shd3 0 cmdprocessor.go:253] nonexisting bindname :AccountID
14:55:15.571947 warn: [WORKER shd3 0 workerservice.go:181] Error: bindname not found in query: :AccountID - processing 2 11:2 AccountID,

@ModEtchFill
Copy link
Contributor

We are inconsistent. For shard key name matching, we do case insensitive check, isShardKey https://github.com/paypal/hera/blob/af6bc1d04dfc16241f851ef25ca925df1cd839a8/lib/coordinatorsharding.go#L261C1-L274C44

The error comes from
https://github.com/paypal/hera/blob/main/worker/shared/cmdprocessor.go#L335

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants