recovering postgres from a time machine backup

Last night, I needed to do a full Time Machine restore on my Mac. I messed up installing things and made the problem far worse in my attempt to “fix” it. Then I tried to rollback a fraction of the disk. The laptop predicted 11 hours to rollback the files. It was easier to rollback to the state a few hours earlier. The only time I did a full Time Machine restore was when I got a new computer. That was going forward in calendar time though. This is the first time I went backwards.

For the most part, it was easy. The Mac prompted me on whether it was ok to erase the disk and restore. That took about two hours. My computer was pretty much set up on restore. It remembered lots down to my internet connection and github key. I got re-prompted from my Dropbox credentials (and for two factor.) No big deal.

Then there was Postgres. Every few seconds, I got the message “Do you want the application “postgres” to accept incoming network connections?” The message only appeared for about a second. Even if I was fast enough to click on it, it was back a few seconds later.

I tried signing the app based on some internet posts. No luck.

Temporary Relief

I got temporarily relief while I looked into the problem by blocking all connections:

  • System Preferences
  • Security & Preferences
  • Click the lock to make changes
  • My password
  • Click unlock
  • Firewall Options
  • Click “Block all incoming connections”
  • Ok

This is not helpful in the long run, but it let me look at things without going crazy.

The problem

I checked the database logs in /Library/PostgreSQL/8.4/datapg_log and found a file every few seconds with:

2016-04-25 20:39:15 EDT LOG:  database system was interrupted; last known up at 2016-04-24 09:18:51 EDT
2016-04-25 20:39:15 EDT LOG:  record with zero length at 0/5C42472C
2016-04-25 20:39:15 EDT LOG:  invalid primary checkpoint record
2016-04-25 20:39:15 EDT LOG:  record with zero length at 0/5C4246E8
2016-04-25 20:39:15 EDT LOG:  invalid secondary checkpoint record
2016-04-25 20:39:15 EDT PANIC:  could not locate a valid checkpoint record
2016-04-25 20:39:15 EDT LOG:  startup process (PID 2326) was terminated by signal 6: Abort trap
2016-04-25 20:39:15 EDT LOG:  aborting startup due to startup process failure

Ah ha! That makes perfect sense. I jumped around in time which would confuse a transaction log. Now,t hat’s something I know how to fix. I did a forced reset of the transaction log:

  1. sudo su postgres
  2. cd /Library/PostgreSQL/8.4/bin
  3. ./pg_resetxlog -f /Library/PostgreSQL/8.4/data

And all better! I turned the firewall connections back to the way they were before I started and good as new.

technical speaking – getting better over time

I recently needed to find a video of myself speaking. This caused me to notice that I’ve gotten much better (and more comfortable) speaking since 2007.

2007 – Google Test Automation Conference

In 2007, I attended the Google Test Automation Conference. They had 5 minute lightning talks and I signed up. This mean that I “wrote” what I was going to say that day and wasn’t prepared. More importantly, at that point, I’d only spoken once or twice before in front of a large audience and only internally at work. I remember being scared and worried about going over time (if you went over, they threw stuff at you)

That said, I was substantially better in 2007 then I was in 2002! I remember having to give a presentation in 2003 or so at work. I memorized every word I was going to say!

What I noticed rewatching the video

  • I didn’t sound confident in the intro
  • I fiddled with my hands a lot at the beginning
  • Once I got into the tech content, I started looking around and gesturing more
  • I stuck to that podium like glue
  • I didn’t know to hold my fingers up when listing points yet

2009

In 2009, I joined Toastmasters. I realized I wanted to get better at engaging the audience. My focus was improving at “humorous technical content”. Because if you can make someone laugh, you get their attention!

2014

In 2014, I gave a presentation about Java to high school students and they were kind enough to record it. This time I was prepared. And more importantly, I had skills to draw from. In addition to Toastmasters, I had given many more presentations at work.

This time I noticed:

  • I looked at my laptop less
  • I moved around and engaged the audience more
  • I was able to make impromptu jokes
  • I looked more confident

2015

In 2015, I gave a 10 minute talk about Agile. Again, I was prepared. And again, I noticed many of the same skills. I was comfortable and able to make jokes. For this one, I was involving the audience, so I can really see how well I was adapting to what was going on around me.

(not sure what happened to the video)