Skip to content

Instantly share code, notes, and snippets.

View a-robinson's full-sized avatar

Alex Robinson a-robinson

View GitHub Profile
package cgosleep
/*
#include "unistd.h"
void sleepMicros(unsigned int micros) {
usleep(micros);
}
*/
import "C"
diff --git a/google.golang.org/grpc/call.go b/google.golang.org/grpc/call.go
index c1588c63..e1286dda 100644
--- a/google.golang.org/grpc/call.go
+++ b/google.golang.org/grpc/call.go
@@ -35,6 +35,7 @@ package grpc
import (
"bytes"
+ "fmt"
"io"
# Make sure that you’ve installed minikube and run `minikube start` to get your Kubernetes cluster running.
minikube version (should be at least 0.19.0)
minikube start
kubectl version (should be at least 1.6.0 for both client and server)
-------------------
# Create the CockroachDB cluster and other relevant resources
kubectl create -f https://bit.ly/crdb-k8s-yaml
package main
import (
"crypto/rand"
"fmt"
"os"
"os/exec"
)
func main() {
apiVersion: v1
kind: Service
metadata:
# This service is meant to be used by clients of the database. It exposes a ClusterIP that will
# automatically load balance connections to the different database pods.
name: cockroachdb-public
labels:
app: cockroachdb
spec:
ports:
apiVersion: v1
kind: Service
metadata:
# This service is meant to be used by clients of the database. It exposes a ClusterIP that will
# automatically load balance connections to the different database pods.
name: cockroachdb-public
labels:
app: cockroachdb
spec:
ports:
crl-ssh alex-chaos all 'grep "process[ei][dn]g* compaction" logs/cockroach.alex-chaos-*'
1: alex@35.196.44.2
logs/cockroach.alex-chaos-0001.root.2018-01-18T03_25_59Z.011338.log:I180118 04:59:13.091160 10505 storage/compactor/compactor.go:308 [n1,s1] processing compaction #1-23/179 (/System/""-/Table/51) for 284 MiB
logs/cockroach.alex-chaos-0001.root.2018-01-18T03_25_59Z.011338.log:I180118 04:59:53.415386 10505 storage/compactor/compactor.go:316 [n1,s1] processed compaction #1-23/179 (/System/""-/Table/51) for 284 MiB in 40.324252369s
logs/cockroach.alex-chaos-0001.root.2018-01-18T03_25_59Z.011338.log:I180118 05:20:58.034031 10505 storage/compactor/compactor.go:308 [n1,s1] processing compaction #110-116/177 (/Table/51/1/579472353641439108-/Table/51/1/865982641441952695) for 260 MiB
logs/cockroach.alex-chaos-0001.root.2018-01-18T03_25_59Z.011338.log:I180118 05:39:51.074715 10505 storage/compactor/compactor.go:316 [n1,s1] processed compaction #110-116/177 (/Table/51/1/579472353641439108-/Table/51/1/86598264
@a-robinson
a-robinson / cleanup.sh
Created February 5, 2018 21:18
Introduce delay between two cockroachdb nodes in a 3-node docker cluster
docker kill node1
docker kill node2
docker kill node3
docker rm node1
docker rm node2
docker rm node3
docker network rm net1
docker network rm net2
docker network rm net3
rm -rf ./cockroach-data
@a-robinson
a-robinson / disconnect-dc.sh
Last active November 20, 2022 06:33
Docker compose file for 3-datacenter cockroachdb cluster with 2 nodes in each datacenter
docker network disconnect "${PWD##*/}_shared" roach-4
docker network disconnect "${PWD##*/}_shared" roach-5
CREATE TABLE customers (
id integer PRIMARY KEY,
name text
);
CREATE TABLE accounts (
customer_id integer REFERENCES customers(id),
id integer PRIMARY KEY,
balance numeric,
CONSTRAINT accounts_balance_check CHECK ((balance > (0)::numeric))