Skip to content

Not following semver breaks node.js driver #5625

Open

Description

@andyburke

Today, with the release of 2.3.0, my node.js code stopped working against a 2.2.5 server:

undefined:1
ERROR: Received an unsupported protocol version. This port is for RethinkDB queries. Does your client driver version not match the server?
^
SyntaxError: Unexpected token E
   at Object.parse (native)
   at Socket.callback.rawSocket.once.handshake_callback (/code/node_modules/float-rethinkdb/node_modules/rethinkdb/net.js:624:35)
   at emitOne (events.js:77:13)
   at Socket.emit (events.js:169:7)
   at readableAddChunk (_stream_readable.js:146:16)
   at Socket.Readable.push (_stream_readable.js:110:10)
   at TCP.onread (net.js:523:20)

My package.json setup is:

    "rethinkdb": "^2.2.1"

This should allow upgrade to all 2.x.y releases. According to semver, those releases would not break compatibility. (Where major versions break compatibility, minor versions add functionality and patch versions fix bugs.)

Because 2.3.0 breaks compatibility with 2.2.x servers, this broke my setup.

I've since changed my package.json spec to:

    "rethinkdb": "~2.2.1"

Which will only update the patch version.

However, I felt I should open this issue to foster discussion of Rethinkdb not following semver. My personal opinion is that following semver makes it very easy and predictable for end users: major version changes are not compatible, minor version changes add functionality but are compatible, patch version changes only address bugs and do not affect functionality or compatibility.

What is the current thinking on Rethinkdb versioning? Is my change to only allow patch version changes really safe to do or do I need to lock things down to specific versions?

Activity

  1. danielmewes commented on Apr 6, 2016

    @danielmewes
    Member

    Thanks for bringing this up again @andyburke (we had some prior discussions about this in another issue, I have to look up which one it was). This is indeed a convincing example for why we should strongly consider switching to semver for our driver. The reason for why we don't use it at the moment is to keep the driver versions similar to the corresponding server versions, so you can easily tell which driver works with which server.

    We could use something like 23.0.0 instead of 2.3.0 maybe, or even 203.0.0 if we want to make sure that the version schema still works if we ever reach 2.10.x for the server.

  2. added this to the subsequent milestone on Apr 6, 2016
  3. andyburke commented on Apr 7, 2016

    @andyburke
    Author

    Is there a particular reason to avoid using semver on the server side? The semver concepts aren't really tied to javascript.

    It can lead to high version numbers if you are moving fast and breaking backward compatibility often, but that isn't a problem as long as you're ok with versions like 14.3.2.

  4. danielmewes commented on Apr 21, 2016

    @danielmewes
    Member

    @andyburke Switching server versioning over as well is worth considering. Though I think it is less important than for the drivers.
    Our current versioning scheme also has the advantage that we can point out particularly major milestones, such as the jump from 1.x.x to 2.x.x.

  5. andyburke commented on Apr 21, 2016

    @andyburke
    Author

    Sadly, version numbers have been imbued with this idea from a marketing perspective: 2.0 is better than 1.0, right?

    One way some people/companies are separating information/PR/marketing (none of which are bad) from versioning is to have named releases. It's fun, and it leaves the versions mostly out of it so they can be driven by the APIs and developer needs, eg:

    "Rocketship" (2.3.2)
      - Added fast new API!
    
    ...
    
    "Slothtoes" (2.7.0)
      - Added homomorphic encryption support
    

    In the example, backwards compatibility has been maintained, but major new features have also been added. By using names to call out the big bundles of work instead of a major version bump, code can continue to understand when it can and cannot interoperate.

    Thanks for considering and discussing the issue, I appreciate it.

  6. modified the milestones: subsequent, 2.4 on Apr 28, 2016
  7. mike-marcacci commented on Aug 24, 2016

    @mike-marcacci

    I just wanted to add another quick note that there is another factor at play here – having the same version shared across all client libs and the database itself is extremely useful. I know that elastica had such a problem with confusion from different versions that they're unifying everything in their stack under "5.0" shortly.

    At the same time, semver is critical in client libraries, since it's obeyed by just about every popular package manager.

    Perhaps "major" numbers should be shared by the database and all clients (and increment any time a database API change is made, breaking or not); "minor" and "patch" numbers could then follow the semantics of semver for each client library, while the server is more or less constrained to <major>.0.<patch>.

    Just an idea.

  8. modified the milestones: 2.4, 2.4-polish on Oct 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions