> Understood. In the code example I provided, I am writing the same
> value, but I am doing so in quick succession, so perhaps a few second
> sleep might be helpful. It is worth noting also that the code I
> provided is only the second step 2 in the process. There is a php
> script that receives the post request from Paypal which inserts the
> IPN data into the IPN column family. Before it does this, it sets the
> "processed" column to "no"

Is it at all possible that this step happens twice? I have no idea
what Paypal does or document, but in general with an HTTP based
callback you (in Paypal's position) would either have to accept that
human intervention is necessary on any transaction where the callback
fails, or else implement some kind of re-try and keep submitting to
the customer until the callback is successful. Keep in mind that the
other end (meaning you in this case) can perceive to receive a
successful HTTP request and send back a response, even though Paypal
may perceive an error on their end.

If you haven't, I'd definitely recommend checking logs at this step,
or adding logging if required, to make sure that the callback is not
happening twice.

However, your code snippet looks good to me and the fact that you're
triggering the log entry suggest to me that the problem isn't
duplicate submission, since the time window is presumably very small
in between your put and your get (but see further below about clocks).

How much traffic do you have to this cluster? Is it feasable to run
Cassandra with full debug enabled (spammings lots of text in your
logs)? That might be one way to ascertain, once you have one of these
cases happening, whether Cassandra is mentioning any activity
pertaining to the row that might explain this, such as it being
re-written by a client.

Another suggestion: Is it possible you do not have clocks synchronized
among your clients? Suppose that that Paypal *is* submitting twice
sometimes, and e.g. one of your PHP front-ends (or whoever is talking
to Cassandra to insert the data) has clock drift. This would render
the insert from your code snippet obsolete, if there is already a
value inserted with a timestamp in the future.

-- 
/ Peter Schuller (@scode on twitter)

Reply via email to