-
Notifications
You must be signed in to change notification settings - Fork 308
Clean up exchanges #4442
Comments
Turns out that we started using Stripe from payday 3 run on |
Ref: .#3912 |
The exchange records for payday 0, payday 1 and payday 2 run on 2012-06-01, 2012-06-08 and 2012-06-15 respectively. There is just one record that is out of place. |
For the Stripe exchanges exchange_routes.network = stripe Were have all of the necessary information in the logs directory under misc/3912/year/month/stripe. |
In the How did I check this? |
Turns out that the |
And also |
Additionally I want look more closely at the error statements at the end of the |
There seem to be no relation between the errors at the end of |
Not finding where we introduced the exchange_routes. 😱 |
Ok so here is the plan. Correct the How do I correct the |
Current
We will need to add |
#3807 & #2779 - Back filled the exchanges and created routes for Balanced transactions when we were refunding and/or Balanced shutdown. NB: In the payday log files we started recording This But the issue here is
But I think that we can backfill what we can and figure out how to resolve this issue after. There should only be a small amount of these cases. For now we can assume that all recorded transaction/exchanges with a After we have made finished backfilling we can always use the payday log files for payday #4 and onward to correct the status if necessary. |
Issues with data corruption that I need to research next before we go ahead...tomorrow |
Note the Not sure how that happened. The point I am making is that besides having to backfill |
So my conclusion after researching is that we are on the right track and we should continue implementing the back fill the way we were with a few changes. The main change is that we create new Thus the next step is to add |
Copied from here How to Backfill ExchangesFor each month in gratipay/finances#3:
|
Based on the current structure of the Here goes... |
exchanges
and exchange_routes
We plugged one Do any of the other three still leak? |
Are we leaking |
No! It has a |
Are we leaking |
Actually, back up: we've already backfilled all exchanges with a
|
Based on a review of ...
... I believe we're no longer leaking What about potentially erroneous networks? I.e., |
exchanges
and exchange_routes
Here's the end of the
and here's the end of the
|
Yeah, this doesn't look right. Braintree
Balanced
|
As expected, there is no |
But I do find |
The first transactions I find in the Braintree dashboard are on May 29, 2015, which is #3486. See esp. #3486 (comment): |
So at this point my best hunch is that I made a mistake during gratipay/inside.gratipay.com#308 and conflated |
Any further evidence to support that hypothesis? |
Alright, what the heck were we doing on 308 and how did we end up with those logfiles? |
Oh! Was it related to Balanced accounts that we migrated to Braintree? |
Do we still have the scripts that produced these logfiles? |
😕
|
Here's the migration: #3391. |
Notes from the bus ride ... Did I overload gratipay/inside.gratipay.com#308 with refunds? What was the ticket for refunds? All of the How about looking at old database backups to determine when these Search for What are the patterns in how these routes were set? What are the relative ids of these routes? Can we use that to infer a date range or anything else about the creation or updating of these routes? Huh! I ran a query to see the year of first exchange for these routes, and I'm seeing it only sparsely populated! Does SELECT er.id
, username
, address
, (SELECT substring(timestamp::text from 0 for 5)
FROM exchanges
WHERE route=er.id
ORDER BY timestamp asc
LIMIT 1
) AS year
FROM exchange_routes er
JOIN participants p
ON p.id= er.participant
WHERE network='braintree-cc'
ORDER BY er.id asc; Or are these routes that should be linked up to transactions but aren't yet? Many of the addresses look like they were migrated from Balanced ( These addresses in Balanced format—do we have a route for Balanced and a route for Braintree for the same address? |
So an update for this is the PR under review to take care of plugging last remaining leak: ref under MassPay and add |
Per IRL convo, we're getting to the point where I am going to need to be more involved in this ticket in order to continue making progress. Goal is to land #4518 asap, and then @kaguillera will work on other tickets while I am out traveling for the next couple months. We will revisit in the future. |
I have a collection of old backups. Idea: crawl them and extract usernames over time. Use |
Sound good to me...but it will be tedious |
@kaguillera and I talked IRL and are thinking that we should postpone this until we have revenue growth again, since without revenue growth we won't survive very long and backfilling exchanges won't matter. Well, but ... we should at least plug all leaks. The one remaining is the corrupt network issue (ticket description). What's up with that? Is it truly corrupt and are we continuing to introduce further corruption? |
Re: corruption ... maybe due to overeager matching on |
More apparent corruption with what route is linked to exchanges: gratipay/inside.gratipay.com#1164 (comment). |
Due to bad schema design we have missing values for some fields in our
exchanges
andexchange_routes
tables. We use eitherunknown
orNULL
to represent this missing info (we started usingunknown
in #3975 in order to make querying easier).exchanges
ref
NULL
exchanges
status
unknown
exchange_routes
network
unknown
Todo
network
is corrupt—Clean up exchanges #4442 (comment)ref
—Clean up exchanges #4442 (comment)status
—Clean up exchanges #4442 (comment)network
andaddress
—Clean up exchanges #4442 (comment)ref
to record an exchange -- Start recording ref when recording an exchange in masspay #4518ref
under MassPay —backfill remaining exchanges #3912 (comment)-- Start recording ref when recording an exchange in masspay #4518
ref
status
network
andaddress
NULL
,unknown
}ref
status
network
Original
Confused. So far.
- Payday 0 was run on 2012-06-01
- Payday 1 was run on 2012-06-08
- Payday 2 was run on 2012-06-15 which according to
gittip-3.log
(payday logs it was)- Payday 3 was run on 2012-06-22 but no log exist but there are records of exchanges in the
exchanges
table- Payday 4 was run on 2012-06-29 but is actually recorded in
gittip-4.log
exchanges
table. That is to say for example in payday logs for the payday run on 2012-06-15 ( recorded in gittp-3.log) 18 people were charged ( I am assuming via samurai since that was the vender we were using at that time) but only 3 exchanges were recorded. This possibly happened because of a database error since I am seeing some error statements at the end of the log file.The text was updated successfully, but these errors were encountered: