4

I am working on this Heroku tutorial and I have a question about autovacuum process. There is still no tables or data and autovacuum launcher is hung for over half an hour now. Below is the cmd window.

I found a similar question here but could not find the answer. Does anyone know what is going on?

As a summary: After the last line LOG: autovacuum launcher started the cursor is blinking under the last line but nothing is happenning for over half an hour.

C:\Users\a>initdb pg
The files belonging to this database system will be owned by user "a".
This user must also own the server process.

The database cluster will be initialized with locale "English_United States.1252
".
The default database encoding has accordingly been set to "WIN1252".
The default text search configuration will be set to "english".

Data page checksums are disabled.

initdb: directory "pg" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "pg" or run initdb
with an argument other than "pg".

C:\Users\a>postgres -D pg &
LOG:  database system was interrupted; last known up at 2013-10-05 13:46:39 EDT
LOG:  database system was not properly shut down; automatic recovery in progress

LOG:  record with zero length at 0/17704F8
LOG:  redo is not required
LOG:  database system is ready to accept connections
LOG:  autovacuum launcher started

EDIT

As suggested in bma's comments, I removed the pg directory and the project directory and I did the same steps again and I got the same result: LOG: autovacuum launcher started and it hangs. What am I going wrong?


EDIT

I opened a new command window and started the repl there and I was able to execute

C:\Users\a\CLOJURE\shouter>lein repl

user=> (require '[clojure.java.jdbc :as sql])
nil

But the next command gave the following error:

user=> (sql/with-connection (System/getenv "DATABASE_URL")
  #_=>          (sql/create-table :testing [:data :text]))


user=> IllegalArgumentException db-spec null is missing a required parameter  cl
ojure.java.jdbc/get-connection (jdbc.clj:192)

How can I fix this?


EDIT

It turned out that 'export' is for unix and in Windows I needed to use 'set'. See this related question.

Community
  • 1
  • 1
Zeynel
  • 13,145
  • 31
  • 100
  • 145
  • 2
    Isn't that just log output? Why would that change unless there is something else to log? Can you see if the autovacuum process is running? By the looks of your steps there, it looks like you need to remove the "pg" directory and retry your steps -- I'm guessing that this is at least the second time you've tried those steps with the same directory named "pg". – bma Oct 05 '13 at 18:23
  • You are right, this is the second time. I guess I don't understand what `postgres -D pg &` does. I couldn't even find what `-D` stands for? How do I remove the "pg" directory? – Zeynel Oct 05 '13 at 18:34
  • I found some information here https://forum.linode.com/viewtopic.php?p=49670 but still I don't understand what's going on... – Zeynel Oct 05 '13 at 18:39
  • 1
    "pg" is the data directory under which the Postgres data/files are going to be stored, which is denoted by "-D". The following link will give some details about that: `http://www.postgresql.org/docs/current/static/app-initdb.html` – bma Oct 05 '13 at 18:45
  • Regarding removing the "pg" directory I don't know what the recommended method in Windows is -- can you just delete that folder and try again? – bma Oct 05 '13 at 18:46
  • 1
    Unless you can see the autovacuum process in the process list and it is not doing anything I would not worry about that. Autovacuum will abort if other user-initiated actions need to acquire a lock that it is holding (unless you are experiencing imminent wraparound, which you are not). Are you getting the same error messages as before about the "pg" directory existing? – bma Oct 05 '13 at 20:04
  • Yes, you are right. I opened a new command window and I was able to execute the next command but I could not create the table. I added the error code to the question. Thanks, for your help. – Zeynel Oct 05 '13 at 20:08

1 Answers1

4

What is happening is that you are starting postgres directly, with the pg directory, and seeing log output. It would be better to install it as a service on Windows, and use the default data directory. This is what the normal installer does.

However your current approach is going to just run the db until you close the terminal window at which point it will die (hence the recovery at the beginning). You don't have hung processes. That's just log output.

Chris Travers
  • 25,424
  • 6
  • 65
  • 182