Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Don't user upsert to persist new one time keys #2053

Merged
merged 6 commits into from Mar 29, 2017

Conversation

Projects
None yet
2 participants
Owner

erikjohnston commented Mar 23, 2017

Instead we no-op duplicate one time key uploads, an error if the key_id
already exists but encodes a different key.

Don't user upsert to persist new one time keys
Instead we no-op duplicate one time key uploads, an error if the key_id
already exists but encodes a different key.
Owner

erikjohnston commented Mar 23, 2017

Oh, I suppose I should raise a more helpful exception

Owner

erikjohnston commented Mar 24, 2017

(I'm now raising a slightly more helpful exception)

can we change it to include the algorithm in the table key?

+ # First we check if we have already persisted any of the keys.
+ rows = yield self._simple_select_many_batch(
+ table="e2e_one_time_keys_json",
+ column="key_id",
@richvdh

richvdh Mar 24, 2017

Member

technically the algorithm is part of the key - so it's valid to have an "ed25519:aaaaa" as well as a "rot13:aaaaa". I rather hope the index reflects that, but haven't checked...

@erikjohnston

erikjohnston Mar 28, 2017

Owner

Oh bleurgh, thanks, have changed.

+ # We are protected from race between lookup and insertion due to
+ # a unique constraint. If there is a race of two calls to
+ # `add_e2e_one_time_keys` then they'll conflict and we will only
+ # insert one set.
@richvdh

richvdh Mar 24, 2017

Member

... and throw a 500 or something, presumably? I suppose that's fine because the client should retry on the 500 and hit the api again, at which point the lookup should conclude that it's all fine.

@richvdh richvdh assigned erikjohnston and unassigned richvdh Mar 24, 2017

@erikjohnston erikjohnston assigned richvdh and unassigned erikjohnston Mar 28, 2017

lgtm

Member

richvdh commented Mar 29, 2017

modulo test failures. what's all that about?

@richvdh richvdh assigned erikjohnston and unassigned richvdh Mar 29, 2017

erikjohnston added some commits Mar 29, 2017

Owner

erikjohnston commented Mar 29, 2017

Whoops, look like I was a crank. Hopefully fixed now.

@erikjohnston erikjohnston merged commit 2f8b580 into develop Mar 29, 2017

8 checks passed

Sytest Dendron (Commit) Build #1841 origin/erikj/e2e_one_time_upsert succeeded in 13 min
Details
Sytest Dendron (Merged PR) Build finished.
Details
Sytest Postgres (Commit) Build #2662 origin/erikj/e2e_one_time_upsert succeeded in 8 min 12 sec
Details
Sytest Postgres (Merged PR) Build finished.
Details
Sytest SQLite (Commit) Build #2736 origin/erikj/e2e_one_time_upsert succeeded in 7 min 21 sec
Details
Sytest SQLite (Merged PR) Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@erikjohnston erikjohnston deleted the erikj/e2e_one_time_upsert branch Oct 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment