Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

stats don't match database #11

Open
bjmgeek opened this issue Jul 8, 2015 · 11 comments
Open

stats don't match database #11

bjmgeek opened this issue Jul 8, 2015 · 11 comments
Assignees
Milestone

Comments

@bjmgeek
Copy link

bjmgeek commented Jul 8, 2015

I'm using hockeypuck 2.0b4 on Debian unstable on amd64, and I had to recreate my /var/lib/hockeypuck directory (including the recon db) due to a failed hard drive. I've still got the postgresql db, and it shows the correct number of keys:

select count(*) from keys;
  count  
---------
 3953468
(1 row)

but the stats page shows

Statistics
Total number of keys: 97 

Is there a way to make the stats re-read the database?

@bjmgeek
Copy link
Author

bjmgeek commented Jul 8, 2015

or should I just reload a dump?

@cmars
Copy link
Member

cmars commented Jul 9, 2015

You should be able to fix this by rebuilding the prefix tree, similar to an sks pbuild:

hockeypuck-pbuild -config /path/to/hockeypuck.conf

@cmars
Copy link
Member

cmars commented Jul 9, 2015

Once the ptree is rebuilt, remove the old .ptree.stats file and restart the hockeypuck service. Hockeypuck will then rebuild the stats file from the prefix tree.

@cmars
Copy link
Member

cmars commented Jul 9, 2015

Couple of things I need to fix:

  1. Add documentation on hockeypuck-pbuild command.
  2. Remove that stats file at exit for hockeypuck-load & hockeypuck-pbuild.

@cmars
Copy link
Member

cmars commented Jul 9, 2015

.ptree.stats will typically be located a directory up from your ptree directory.

@cmars cmars self-assigned this Jul 9, 2015
@bjmgeek
Copy link
Author

bjmgeek commented Jul 10, 2015

I tried that and got an error:

hockeypuck@hockeypuck:~$ /usr/bin/hockeypuck-pbuild
-config=/etc/hockeypuck/hockeypuck.conf
WARN[0000] error executing "ALTER TABLE keys ADD CONSTRAINT keys_pk PRIMARY
KEY (rfingerprint);": pq: multiple primary keys for table "keys" are not
allowed
WARN[0000] error executing "ALTER TABLE keys ADD CONSTRAINT keys_md5 UNIQUE
(md5);": pq: relation "keys_md5" already exists
WARN[0000] error executing "CREATE INDEX keys_rfp ON keys(rfingerprint
text_pattern_ops);": pq: relation "keys_rfp" already exists
WARN[0000] error executing "CREATE INDEX keys_ctime ON keys (ctime);": pq:
relation "keys_ctime" already exists
WARN[0000] error executing "CREATE INDEX keys_mtime ON keys (mtime);": pq:
relation "keys_mtime" already exists
WARN[0000] error executing "CREATE INDEX keys_keywords ON keys USING
gin(keywords);": pq: relation "keys_keywords" already exists
WARN[0000] error executing "ALTER TABLE subkeys ADD CONSTRAINT subkeys_pk
PRIMARY KEY (rsubfp);": pq: multiple primary keys for table "subkeys" are
not allowed
WARN[0000] error executing "ALTER TABLE subkeys ADD CONSTRAINT subkeys_fk
FOREIGN KEY (rfingerprint) REFERENCES keys(rfingerprint);": pq: constraint
"subkeys_fk" for relation "subkeys" already exists
WARN[0000] error executing "CREATE INDEX subkeys_rfp ON subkeys(rsubfp
text_pattern_ops);": pq: relation "subkeys_rfp" already exists
[{/home/cmars/hkp/gopath/src/
github.com/hockeypuck/packaging/src/github.com/hockeypuck/server/cmd/hockeypuck-pbuild/main.go:103:
} {/home/cmars/hkp/gopath/src/
github.com/hockeypuck/packaging/src/gopkg.in/hockeypuck/pghkp.v1/storage.go:604:
} {sql: Scan error on column index 0: unsupported driver -> Scan pair:
[]uint8 -> *struct { MD5 string "bson:"md5"" }}]

On Thu, Jul 9, 2015 at 3:32 PM, Casey Marshall [email protected]
wrote:

You should be able to fix this by rebuilding the prefix tree, similar to
an sks pbuild:

hockeypuck-pbuild -config /path/to/hockeypuck.conf


Reply to this email directly or view it on GitHub
#11 (comment).

@bjmgeek
Copy link
Author

bjmgeek commented Jul 10, 2015

Do you mean the .recon.db.stats file?

On Thu, Jul 9, 2015 at 3:37 PM, Casey Marshall [email protected]
wrote:

Once the ptree is rebuilt, remove the old .ptree.stats file and restart
the hockeypuck service. Hockeypuck will then rebuild the stats file from
the prefix tree.


Reply to this email directly or view it on GitHub
#11 (comment).

@cmars
Copy link
Member

cmars commented Jul 10, 2015

Yes, it'd be .recon.db.stats if the prefix tree dir was named recon.db.

@cmars
Copy link
Member

cmars commented Jul 10, 2015

Uh-oh, that looks like a likely bug in hockeypuck-pbuild, need to test it with postgres-json storage.

This was referenced Jul 19, 2015
@cmars cmars closed this as completed in #13 Jul 19, 2015
@cmars
Copy link
Member

cmars commented Jul 19, 2015

Still need to update docs, reopening.

@cmars cmars reopened this Jul 19, 2015
@bjmgeek
Copy link
Author

bjmgeek commented Jan 7, 2016

I'm actually still seeing this issue

I've tried rebuilding the PTree, reloading from a dump, etc. My server has been running for several days, and I don't see any activity on the Stats page except for one key I manually added. I can see that it's gossiping with my sks server, and my peers (both sks and hockeypuck), but no updates on the stats page

Statistics
Total number of keys: 4102179
Daily Histogram

Day New Keys Updated Keys
2016-01-04 4102178 0
2016-01-05 1 1

Hourly Histogram

Hour New Keys Updated Keys
2016-01-05 19 1 0
2016-01-05 20 0 1

This for a server that is still running at the present, so it should have had some activity today.

@cmars cmars added this to the 16.03 milestone Feb 5, 2016
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