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

api: fix splice update operation #353

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

DerekBum
Copy link

@DerekBum DerekBum commented Nov 15, 2023

Splice update operation (:) accepts 5 and only 5 arguments. It was parsed and encoded incorrectly with only 3 argument (as every other update operations).
Also fixed the same operation for the crud.

Op struct made private.
Change all Upsert and Update requests to accept *tarantool.Operations as ops parameters instead of the interface{}.

I didn't forget about (remove if it is not applicable):

Closes #348

Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add examples of using the type Operations and []Op{} as update arguments.

(I see ExampleUpdateRequest, but that's not quite it).

CHANGELOG.md Outdated Show resolved Hide resolved
client_tools.go Show resolved Hide resolved
crud/operations.go Outdated Show resolved Hide resolved
@DerekBum DerekBum force-pushed the DerekBum/gh-348-fix-splice-update-operation branch from 15cb5f6 to ab4af57 Compare November 15, 2023 15:17
README.md Outdated Show resolved Hide resolved
client_tools.go Show resolved Hide resolved
request.go Outdated Show resolved Hide resolved
request.go Outdated Show resolved Hide resolved
crud/operations.go Outdated Show resolved Hide resolved
client_tools.go Show resolved Hide resolved
crud/tarantool_test.go Show resolved Hide resolved
@@ -200,6 +200,14 @@ func SkipIfWatchOnceUnsupported(t *testing.T) {
SkipIfFeatureUnsupported(t, "watch once", 3, 0, 0)
}

// SkipIfCrudSpliceUnsupported skips test run if Tarantool without support of
// crud splice update operation is used.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crud splice is core Tarantool splice

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But for some reason, using splice in crud is not supported for Tarantool < 2.0. While we can use splice from the core.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you show the exact error?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. For example:
https://github.com/tarantool/go-tarantool/actions/runs/6875782438/job/18700075402

    --- FAIL: TestCrudProcessData/Update (0.00s)
        tarantool_test.go:583: Failed to perform CRUD request on CRUD side: map[interface {}]interface {}{"class_name":"UpdateError", "err":"Failed to update: Unknown UPDATE operation", "file":"...ool/crud/testdata/.rocks/share/tarantool/crud/update.lua", "line":0xb0, "str":"UpdateError: Failed to update: Unknown UPDATE operation"}

But for the core:

PASS
ok  	github.com/tarantool/go-tarantool/v2	4.867s

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this one is more "broken" than "unsupported": tarantool/crud#397

Thank for the report. I think it's worth to add a link to the issue to skip helper.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated function name and added a link to an issue.

@DerekBum DerekBum force-pushed the DerekBum/gh-348-fix-splice-update-operation branch from ab4af57 to fa47071 Compare November 16, 2023 10:31
Copy link
Collaborator

@oleg-jukovec oleg-jukovec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the patch! Just few notes.

client_tools.go Outdated Show resolved Hide resolved
client_tools_test.go Outdated Show resolved Hide resolved
crud/operations.go Show resolved Hide resolved
@DerekBum DerekBum force-pushed the DerekBum/gh-348-fix-splice-update-operation branch 3 times, most recently from 5c6ff3a to 00fa43c Compare November 16, 2023 11:29
README.md Outdated Show resolved Hide resolved
@DerekBum DerekBum force-pushed the DerekBum/gh-348-fix-splice-update-operation branch from 00fa43c to 3a1a237 Compare November 16, 2023 11:54
Copy link
Member

@DifferentialOrange DifferentialOrange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix! No objections from my side after resolving the last discussion.

Splice update operation (`:`) accepts 5 and only 5 arguments.
It was parsed and encoded incorrectly with only 3 argument
(as every other update operations).
Also fixed the same operation for the crud.

Part of #348
`Op` struct made private.
Change all `Upsert` and `Update` requests to accept
`*tarantool.Operations` as `ops` parameters instead of
`interface{}`.

Closes #348
@DerekBum DerekBum force-pushed the DerekBum/gh-348-fix-splice-update-operation branch from 3a1a237 to 56b3c82 Compare November 17, 2023 10:17
@oleg-jukovec oleg-jukovec merged commit 6225ec4 into master Nov 17, 2023
22 checks passed
@oleg-jukovec oleg-jukovec deleted the DerekBum/gh-348-fix-splice-update-operation branch November 17, 2023 10:37
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

Successfully merging this pull request may close these issues.

v2: invalid delete(, insert?) and splice update operations
3 participants