basho / riak-erlang-client

The Riak client for Erlang.
Apache License 2.0
311 stars 188 forks source link

riakc_pb_socket:use_native_encoding/2 needs to be per-client, not process-wide [JIRA: CLIENTS-794] #266

Closed erikleitch closed 8 years ago

erikleitch commented 8 years ago

Modifications to support t2b encoding on the client-side included adding a call to set the encoding, via: riakc_pb_socket:use_native_encoding(Client, UseNativeEncoding). This function sends a message to the server to toggle the encoding on a per-connection basis, but also stores the encoding in the process dictionary on the calling process' side.

This latter logic is erroneous: for example if you instantiate two clients in the same process, and set the encoding differently for each one, only the last state is stored in the calling process' process dictionary. The state is process-wide instead of per-client-connection.

The code should be reworked so that the encoding type for each client is stored in metadata carried by the client object, not in the process dictionary for the calling process.

Basho-JIRA commented 8 years ago

In a set of PRs that I'm about to unleash on the world, I've conceptually reworked how T2B message encoding is handled, from a separate protocol that is imposed on top of the same set of messages used for PB encoding, to a protocol that is linked to to a separate set of messages. In short, PB messages use PB-encoding, and T2B messages use T2B-encoding.

What this means is that clients can now do whatever they want -- they can happily send interleaved PB and T2B messages if they want to, for example (and also that sending the encoding toggle message is no longer necessary).

So there are now (at least) three ways of solving the particular problem that I created this issue for:

(the latter could be implemented even if we still choose to do one of the first two options)

Thoughts?

_[posted via JIRA by Erik Leitch]_

Basho-JIRA commented 8 years ago

In a set of PRs that I'm about to unleash on the world, I've conceptually reworked how T2B message encoding is handled, from a separate protocol that is imposed on top of the same set of messages used for PB encoding, to a protocol that is linked to to a separate set of messages. In short, PB messages use PB-encoding, and T2B messages use T2B-encoding.

What this means is that clients can now do whatever they want -- they can happily send interleaved PB and T2B messages if they want to, for example (and also that sending the encoding toggle message is no longer necessary).

So there are now (at least) three ways of solving the particular problem that I created this issue for:

(the latter could be implemented even if we still choose to do one of the first two options)

Thoughts?

_[posted via JIRA by Erik Leitch]_

Basho-JIRA commented 8 years ago

In a set of PRs that I'm about to unleash on the world, I've conceptually reworked how T2B message encoding is handled, from a separate protocol that is imposed on top of the same set of messages used for PB encoding, to a protocol that is linked to to a separate set of messages. In short, PB messages use PB-encoding, and T2B messages use T2B-encoding.

What this means is that clients can now do whatever they want -- they can happily send interleaved PB and T2B messages if they want to, for example (and also that sending the encoding toggle message is no longer necessary).

So there are now (at least) three ways of solving the particular problem that I created this issue for:

(the latter could be implemented even if we still choose to do one of the first two options)

Thoughts?

_[posted via JIRA by Erik Leitch]_

Basho-JIRA commented 8 years ago

In a set of PRs that I'm about to unleash on the world, I've conceptually reworked how T2B message encoding is handled, from a separate protocol that is imposed on top of the same set of messages used for PB encoding, to a protocol that is linked to to a separate set of messages. In short, PB messages use PB-encoding, and T2B messages use T2B-encoding.

What this means is that clients can now do whatever they want -- they can happily send interleaved PB and T2B messages if they want to, for example (and also that sending the encoding toggle message is no longer necessary).

So there are now (at least) three ways of solving the particular problem that I created this issue for:

(the latter could be implemented even if we still choose to do one of the first two options)

Thoughts?

_[posted via JIRA by Erik Leitch]_

Basho-JIRA commented 8 years ago

In a set of PRs that I'm about to unleash on the world, I've conceptually reworked how T2B message encoding is handled, from a separate protocol that is imposed on top of the same set of messages used for PB encoding, to a protocol that is linked to to a separate set of messages. In short, PB messages use PB-encoding, and T2B messages use T2B-encoding.

What this means is that clients can now do whatever they want -- they can happily send interleaved PB and T2B messages if they want to, for example (and also that sending the encoding toggle message is no longer necessary).

So there are now (at least) three ways of solving the particular problem that I created this issue for:

(the latter could be implemented even if we still choose to do one of the first two options)

Thoughts?

_[posted via JIRA by Erik Leitch]_

Basho-JIRA commented 8 years ago

In a set of PRs that I'm about to unleash on the world, I've conceptually reworked how T2B message encoding is handled, from a separate protocol that is imposed on top of the same set of messages used for PB encoding, to a protocol that is linked to to a separate set of messages. In short, PB messages use PB-encoding, and T2B messages use T2B-encoding.

What this means is that clients can now do whatever they want -- they can happily send interleaved PB and T2B messages if they want to, for example (and also that sending the encoding toggle message is no longer necessary).

So there are now (at least) three ways of solving the particular problem that I created this issue for:

(Note: the latter could also be implemented in addition to either of the first two options)

Thoughts?

_[posted via JIRA by Erik Leitch]_

Basho-JIRA commented 8 years ago

In a set of PRs that I'm about to unleash on the world, I've conceptually reworked how T2B message encoding is handled, from a separate protocol that is imposed on top of the same set of messages used for PB encoding, to a protocol that is linked to to a separate set of messages. In short, PB messages use PB-encoding, and T2B messages use T2B-encoding.

What this means is that clients can now do whatever they want -- they can happily send interleaved PB and T2B messages if they want to, for example (and also that sending the encoding toggle message is no longer necessary).

So there are now (at least) three ways of solving the particular problem that I created this issue for:

(Note: the latter could also be implemented in addition to either of the first two options)

Thoughts?

_[posted via JIRA by Erik Leitch]_

Basho-JIRA commented 8 years ago

In a set of PRs that I'm about to unleash on the world, I've conceptually reworked how T2B message encoding is handled, from a separate protocol that is imposed on top of the same set of messages used for PB encoding, to a protocol that is linked to to a separate set of messages. In short, PB messages use PB-encoding, and T2B messages use T2B-encoding.

What this means is that clients can now do whatever they want -- they can happily send interleaved PB and T2B messages if they want to, for example (and also that sending the encoding toggle message is no longer necessary).

So there are now (at least) three ways of solving the particular problem that I created this issue for:

(Note: the latter could also be implemented in addition to either of the first two options)

Thoughts?

_[posted via JIRA by Erik Leitch]_

Basho-JIRA commented 8 years ago

I'm using the "behind-the-scenes" method in the Python client and default to using TTB encoding. The user can override this by passing options to the client when it's being constructed, but I doubt anyone will.

_[posted via JIRA by Luke Bakken]_

Basho-JIRA commented 8 years ago

Closing since the implementation uses the proplist option {{use_ttb}} rather than this method.

_[posted via JIRA by Luke Bakken]_