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

Deprecate upsert with a key (from tarantool 1.6.6) #248

Open
Totktonada opened this issue Nov 22, 2019 · 0 comments
Open

Deprecate upsert with a key (from tarantool 1.6.6) #248

Totktonada opened this issue Nov 22, 2019 · 0 comments
Labels
backlog code health Improve code readability, simplify maintenance and so on enhancement good first issue Good for newcomers prio1

Comments

@Totktonada
Copy link
Member

Tarantool-java version: 1.9.3.

Cited from Tarantool 1.6.7 release notes:

The syntax of upsert command has been changed and an extra key argument was removed from it. The primary key for look up is now always taken from the tuple, which is the second argument of upsert. upsert() was added fairly late at a release cycle and the design had an obvious bug which we had to fix. Sorry for this.

See also tarantool/tarantool#1070

The connector provides upsert() method with a key argument:

public Result upsert(Space space, Tuple key, Tuple def, Operation... args) {
return exec(Code.UPSERT, Key.SPACE, space, Key.KEY, key, Key.TUPLE, def, Key.UPSERT_OPS, args);
}

This is harmless, because those arguments are packed into a map and deprecated key field is ignored by tarantool 1.6.7 and above. However this API can confuse a user.

I propose to overload upsert method w/o key argument to don't bother a user with providing some value for key. This will also save some CPU cycles on encoding a request and several bytes in outgoing packets.

We also should cleanly state in javadoc that the old upsert method is deprecated and should be used only for tarantool 1.6.6 and below. We cannot remove the method, because the connector should be backward compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog code health Improve code readability, simplify maintenance and so on enhancement good first issue Good for newcomers prio1
Projects
None yet
Development

No branches or pull requests

2 participants