Skip to content

Instantly share code, notes, and snippets.

View rainerborene's full-sized avatar

Rainer Borene rainerborene

View GitHub Profile
**Issue**:
1) Start a long running query say ~5 minutes. Ex:
SELECT count(*) from github_events g1,github_events g2 WHERE g1.repo_id=g2.repo_id;
2) Terminate a worker whilst the query is running.
3) Now the system hangs indefinitely.
**Reasoning**
I think what's happening is that removing the network interface doesn't kill the connection. As a result, the coordinator node waits for a response from the worker node, which never comes.
Citus uses PostgreSQL's client connection library (libpq) to communicate between machines; and Postgres uses system defaults to timeout in this scenario. On Linux, I think the default TCP keepalive time (tcp_keepalive_time) is set to 7200 seconds.
@AtulKsol
AtulKsol / psql-error-fix.md
Last active September 30, 2025 18:28
Solution of psql: FATAL: Peer authentication failed for user “postgres” (or any user)

psql: FATAL: Peer authentication failed for user “postgres” (or any user)

The connection failed because by default psql connects over UNIX sockets using peer authentication, that requires the current UNIX user to have the same user name as psql. So you will have to create the UNIX user postgres and then login as postgres or use sudo -u postgres psql database-name for accessing the database (and psql should not ask for a password).

If you cannot or do not want to create the UNIX user, like if you just want to connect to your database for ad hoc queries, forcing a socket connection using psql --host=localhost --dbname=database-name --username=postgres (as pointed out by @meyerson answer) will solve your immediate problem.

But if you intend to force password authentication over Unix sockets instead of the peer method, try changing the following pg_hba.conf* line:

from

@zimuliu
zimuliu / nested_attributes_sync.rb
Last active June 30, 2021 12:37
#accepts_nested_attributes_sync_for: Instead of manually specifying _destroy: true for deletion, or id for update, it supports synchronizing an association, with respect to the given unique index in the association.
module Concerns
module NestedAttributesSync
extend ActiveSupport::Concern
included do
class_attribute :nested_attributes_sync_options, instance_writer: false
self.nested_attributes_sync_options = {}
end
class_methods do
@briankung
briankung / docker-pry-rails.md
Last active January 2, 2025 05:19
Using pry-rails with Docker
@mpneuried
mpneuried / Makefile
Last active August 29, 2025 08:17
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@lopezjurip
lopezjurip / Caddyfile
Last active August 5, 2025 00:24
Fix Too Many Redirect error using Caddy + Cloudflare
www.mysite.com, mysite.com {
proxy / webapp:3000 {
proxy_header Host {host}
proxy_header X-Real-IP {remote}
proxy_header X-Forwarded-Proto {scheme}
}
gzip
tls [email protected]
}
require 'benchmark/ips'
LONG_STRING = " this is a longer test
this is a longer test
this is a longer test
this is a longer test
this is a longer test"
class String
def original_blank?
@hadees
hadees / arel_helpers.rb
Created March 5, 2016 05:41
Arel Helpers
module ArelHelpers
extend self
def self.included(base)
base.extend self
end
def asterisk(arel_table_or_model)
arel_table, columns = case arel_table_or_model
when Arel::Table
@denji
denji / dmarc.rb
Created March 1, 2016 13:15 — forked from ab/AA_dmarc.rb_MOVED.md
DMARC analysis: some hacks to look at DMARC vendors
#!/usr/bin/env ruby
require 'resolv'
require 'set'
require 'thread'
require 'yaml'
KnownSelfDomains = [
'groupon.com',
'airbnb.com',
'citi.com',
@fredbenenson
fredbenenson / kickstarter_sql_style_guide.md
Last active December 21, 2025 05:33
Kickstarter SQL Style Guide
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose