Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

run Gittip 77 #1684

Closed
chadwhitacre opened this issue Nov 21, 2013 · 33 comments
Closed

run Gittip 77 #1684

chadwhitacre opened this issue Nov 21, 2013 · 33 comments

Comments

@chadwhitacre
Copy link
Contributor

76

@chadwhitacre
Copy link
Contributor Author

104 accounts reviewed.

@chadwhitacre
Copy link
Contributor Author

1 account reviewed(!).

@chadwhitacre
Copy link
Contributor Author

Backup started.

@chadwhitacre
Copy link
Contributor Author

Yikes! Backup is much faster now that we switched from Verizon DSL to Comcast. :-)

@chadwhitacre
Copy link
Contributor Author

Droplet created and updated.

@chadwhitacre
Copy link
Contributor Author

Script started, parent shell kill 6ed.

@chadwhitacre
Copy link
Contributor Author

Okay! :-)

@tshepang
Copy link
Contributor

What does 1 account reviewed(!) mean? I ask since it comes after 104 accounts reviewed

@chadwhitacre
Copy link
Contributor Author

Exception. :-/

@chadwhitacre
Copy link
Contributor Author

@tshepang I refreshed the account review page after reviewing the 104 accounts, and found one new account to review.

@chadwhitacre
Copy link
Contributor Author

Traceback (most recent call last):
  File "/home/whit537/www.gittip.com/gittip/cli.py", line 32, in payday
    Payday(db).run()
  File "/home/whit537/www.gittip.com/gittip/billing/payday.py", line 136, in run
    self.move_pending_to_balance_for_teams()
  File "/home/whit537/www.gittip.com/gittip/billing/payday.py", line 324, in move_pending_to_balance_for_teams
    """)
  File "/home/whit537/www.gittip.com/env/local/lib/python2.7/site-packages/postgres/__init__.py", line 357, in run
    cursor.run(sql, parameters)
  File "/home/whit537/www.gittip.com/env/local/lib/python2.7/site-packages/postgres/cursors.py", line 92, in run
    self.execute(sql, parameters)
  File "/home/whit537/www.gittip.com/env/local/lib/python2.7/site-packages/psycopg2/extras.py", line 288, in execute
    return super(NamedTupleCursor, self).execute(query, vars)
IntegrityError: null value in column "balance" violates not-null constraint

@tshepang
Copy link
Contributor

ok

@chadwhitacre
Copy link
Contributor Author

Okay! Deep dive ...

@chadwhitacre
Copy link
Contributor Author

We saw this before, way back.

@chadwhitacre
Copy link
Contributor Author

#170

@chadwhitacre
Copy link
Contributor Author

Hypothesis: someone created a team during payday last week.

Per move_pending_to_balance_for_teams, we don't constrain the movement of pending to balance for teams based on pending, as #170 called for for the movement of pending to balance for participants generally, which we do in clear_pending_to_balance.

@chadwhitacre
Copy link
Contributor Author

The non-NULL constraint on balance was added in #170. That's what we're tripping now, and we're tripping it in move_pending_to_balance_for_teams.

@chadwhitacre
Copy link
Contributor Author

If we're tripping it in move_pending_to_balance_for_teams, I believe that means that (balance + pending) must evaluate to NULL, which means that either balance or pending is NULL (but not both).

@chadwhitacre
Copy link
Contributor Author

Exploring NULL and addition:

gittip-test=# select 0 + null;
┌──────────┐
│ ?column? │
├──────────┤
│        ¤ │
└──────────┘
(1 row)

gittip-test=# select null + 0;
┌──────────┐
│ ?column? │
├──────────┤
│        ¤ │
└──────────┘
(1 row)

gittip-test=# select null + null;
ERROR:  operator is not unique: unknown + unknown
LINE 1: select null + null;
                    ^
HINT:  Could not choose a best candidate operator. You might need to add explicit type casts.
gittip-test=#

@chadwhitacre
Copy link
Contributor Author

Indeed:

=> select count(*) from participants where number='plural' and pending is null;
┌───────┐
│ count │
├───────┤
│     2 │
└───────┘
(1 row)

=> select count(*) from participants where number='plural' and balance is null;
┌───────┐
│ count │
├───────┤
│     0 │
└───────┘
(1 row)

@chadwhitacre
Copy link
Contributor Author

Okay! We're on the right track.

@chadwhitacre
Copy link
Contributor Author

So those two accounts were created while payday was running?

@chadwhitacre
Copy link
Contributor Author

One of the two accounts has pending null and number plural because they were a team and then asked to be deactivated. There are 31354 singular accounts with pending null, and 31338 singular unclaimed accounts with pending null.

@chadwhitacre
Copy link
Contributor Author

The other account was indeed claimed while payday was running. Okay!

@chadwhitacre
Copy link
Contributor Author

So ...

@chadwhitacre
Copy link
Contributor Author

I believe we just need to fix that UPDATE query in move_pending_to_balance_for_teams and rerun payday. There isn't any database corruption to repair, because the non-NULL constraint we added in #170 prevented that for us (it would have manifest next week in the manner of #169 had we not caught it here).

@chadwhitacre
Copy link
Contributor Author

A test!

@chadwhitacre
Copy link
Contributor Author

Updated to the branch from #1685 on the payday droplet, script running again ...

@chadwhitacre
Copy link
Contributor Author

Script ran for {age} (0:48:40.294031).

@chadwhitacre
Copy link
Contributor Author

Tweet tweeted on Twitter.

@chadwhitacre
Copy link
Contributor Author

Droplet destroyed.

@chadwhitacre
Copy link
Contributor Author

MassPay done for 13 users.

@chadwhitacre
Copy link
Contributor Author

Moved $2,000 from New Alliance to PayPal. ~$8,000 left in New Alliance.

Seems like a good policy is to keep 2x the current day's MassPay in PayPal, and 4x in New Alliance. That should let us burst to PayPal as needed in a given week without keeping too much there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants