Skip to content

Instantly share code, notes, and snippets.

View sync-shutdown-errors.txt
2020-10-13T02:27:23.961Z WARN [c.z.h.p.ProxyConnection] PDBReadPool - Connection org.postgresql.jdbc.PgConnection@2a9abd86 marked as broken because of SQLSTATE(08006), ErrorCode(0)
org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
at org.postgresql.core.v3.QueryExecutorImpl.fetch(QueryExecutorImpl.java:2465)
at org.postgresql.jdbc.PgResultSet.next(PgResultSet.java:1845)
at com.zaxxer.hikari.pool.HikariProxyResultSet.next(HikariProxyResultSet.java)
at clojure.java.jdbc$result_set_seq$thisfn__25210.invoke(jdbc.clj:547)
at clojure.java.jdbc$result_set_seq$thisfn__25210$fn__25211.invoke(jdbc.clj:548)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:51)
at clojure.lang.RT.seq(RT.java:535)
@Zak-Kent
Zak-Kent / reset-pdb-access-privileges.txt
Last active Jul 28, 2020
reset-pdb-access-privileges
View reset-pdb-access-privileges.txt
Current state of customer's pe-puppetdb privileges as seen in psql via \l:
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------------------------------------------------------------------------------
pe-puppetdb | pe-puppetdb | UTF8 | en_US.utf8 | en_US.utf8 | =T/"pe-puppetdb"
"pe-puppetdb"=CTc/"pe-puppetdb"
"pe-puppetdb-migrator"=c*/"pe-puppetdb"
"pe-puppetdb"=c/"pe-puppetdb-migrator"
In newer vesions of PE we expect that pe-postgres owns all of the PE database objects. It's possible
View make-sync-work-locally.md

setting up pgcrypto, rbac and pdb_activity dbs

give superuser to puppetdb

- ext/dep/puppetdb/ext/bin/pdbbox-env psql -d puppetdb -U postgres
- ALTER USER puppetdb WITH SUPERUSER;

create aux dbs that pdbext needs

- ext/dep/puppetdb/ext/bin/pdbbox-env createdb -U puppetdb -E UTF8 -O puppetdb puppetdb_rbac
- ext/dep/puppetdb/ext/bin/pdbbox-env createdb -U puppetdb -E UTF8 -O puppetdb puppetdb_activity
@Zak-Kent
Zak-Kent / word_count_solutions.py
Created Jul 11, 2017
Possible solutions to word count problem
View word_count_solutions.py
import collections
import re
import string
# ----------------------------------------------------
# Below are two different ways to prep the string and turn it into a list
# without punctuation. We'll go over using regex in the coming weeks.
# It's not necessary to move this string prep piece into its own function
# but doing so can help with code reusability.
View compare_data.clj
;; fake data in the testing db with a full catalog query
{:catalog_uuid "68b08e2a-eeb1-4322-b241-bfdf151d294b",
:producer "mom.com",
:hash "1d205efd414af8ac082912442a64322bc58159d4",
:transaction_uuid "68b08e2a-eeb1-4322-b241-bfdf151d294b",
:producer_timestamp #inst "2014-07-10T22:33:54.781000000-00:00",
:environment "DEV",
:code_id nil,
:version "123456789",
:resources
View nested-resolvers?.clj
(def my-games {
"game1" {:key "gamey-1" :name "hello-game" :created 2017 :sub-game ["foo1" "bar2"]}
"game2" {:key "gamey-2" :name "goodbye-game" :created 2019 :sub-game ["bar3" "baz8"]}
})
(def my-sub-games {
"foo1" {:name "foo game 1"}
"bar2" {:name "bar game 2"}
"bar3" {:name "bar game 3"}
"baz8" {:name "baz game 8"}