Skip to content
This repository has been archived by the owner on Nov 18, 2017. It is now read-only.

error in helpers/etcd.py #12

Closed
tvb opened this issue May 15, 2015 · 6 comments
Closed

error in helpers/etcd.py #12

tvb opened this issue May 15, 2015 · 6 comments

Comments

@tvb
Copy link

tvb commented May 15, 2015

Found a typo in helpers/etcd.py:

            self.put_client_path("/optime/leader", {"value": state_handler.last_operation()})

Line should read:

            self.put_client_path("/optime/leader", {"value": state_handler.last_leader_operation()})
@Winslett
Copy link
Contributor

@tvb, Good catch! This will probably be a catalyst for a test suite, which I've been pondering on.

@Winslett
Copy link
Contributor

Actually, I reverted that change because it wasn't a typo, it was just confusing code.

The call to last_operation at https://github.com/compose/governor/blob/master/helpers/etcd.py#L85 is calling the last_operation method on the state_handler(), which retrieves an xlog location from Postgres.

The last_leader_operation method at https://github.com/compose/governor/blob/master/helpers/etcd.py#L90 is a call to etcd, which retrieves the last recorded xlog location stored in etcd.

The method names should be refactored to avoid confusion.

@tvb
Copy link
Author

tvb commented May 15, 2015

Hmmm then I have another issue:

Traceback (most recent call last):
  File "./governor.py", line 61, in <module>
    logging.info(ha.run_cycle())
  File "/var/lib/postgresql/governor/helpers/ha.py", line 70, in run_cycle
    self.update_lock()
  File "/var/lib/postgresql/governor/helpers/ha.py", line 25, in update_lock
    return self.etcd.update_leader(self.state_handler)
  File "/var/lib/postgresql/governor/helpers/etcd.py", line 85, in update_leader
    self.put_client_path("/optime/leader", {"value": state_handler.last_operation()})
AttributeError: Postgresql instance has no attribute 'last_operation'
LOG:  received fast shutdown request
waiting for server to shut down....LOG:  aborting any active transactions
LOG:  autovacuum launcher shutting down
LOG:  shutting down
LOG:  database system is shut down
 done
server stopped

Changed that line and now I get:

Traceback (most recent call last):
  File "./governor.py", line 57, in <module>
    postgresql.follow_no_leader()
AttributeError: Postgresql instance has no attribute 'follow_no_leader'
pg_ctl: PID file "data/postgres/postmaster.pid" does not exist
Is server running?

@Winslett
Copy link
Contributor

Create a new master branch, and see if the problem persists.

git fetch origin && git checkout origin/master -b new_master

I force pushed to erase the change. I'll quit doing that.

@tvb
Copy link
Author

tvb commented May 15, 2015

I have not pulled the latest changes you made today.

@Winslett
Copy link
Contributor

That method has existed since 3 days ago: https://github.com/compose/governor/blob/master/helpers/postgresql.py#L210

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