Skip to content

Instantly share code, notes, and snippets.

View dkhenry's full-sized avatar

Daniel Kozlowski dkhenry

View GitHub Profile
@dkhenry
dkhenry / lockcheck.org
Created May 6, 2022 21:30
Why do we even have that lock

Row Level Locks Interacting with Gap Locks

Here is a simple example meant to show how a row level lock can conflict wiht a `gap lock` and cause unexpected locking behavour

Create the Base Schema

For this we will use a very basic schema a simple table with a timestmp and condition.

BEGIN;
CREATE TYPE ProcessStep AS ENUM('submitted','completed');
---
apiVersion: "planetscale.com/v1alpha1"
kind: "PsCluster"
metadata:
name: "example"
spec:
containers:
vtgate: "registry.planetscale.com/vitess/base:beta"
vttablet: "registry.planetscale.com/vitess/base:beta"
mysql: "registry.planetscale.com/vitess/base:beta"
#!/bin/bash
yum -y update
yum -y install jq docker
systemctl start docker
systemctl enable docker
packet-block-storage-attach -m queue
mount -t ext4 /dev/mapper/volume-14171d6f1 /data
/data/startup.sh
@dkhenry
dkhenry / vitess.crd.yaml
Created August 13, 2018 23:55
Custom Resources for Vitess Cluster
---
apiVersion: vitess.io/v1alpha2
kind: VitessCluster
metadata:
name: superawesomecluster
labels:
app: vitess
spec:
lockserver:
type: etcd3
This file has been truncated, but you can view the full file.
execve("/usr/local/bin/cargo", ["cargo", "build"], [/* 56 vars */]) = 0
brk(0) = 0x7f2d717cd000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d6fba4000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=49275, ...}) = 0
mmap(NULL, 49275, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2d6f4a8000
close(3) = 0
open("/lib64/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\"\300\2719\0\0\0@\0\0\0\0\0\0\0\250\256\0\0\0\0\0\0\0\0\0\0@\0008\0\t\0@\0*\0)\0\6\0\0\0\5\0\0\0@\0\0\0\0\0\0\0@\0\300\2719\0\0\0@\0\300\2719\0\0\0\370\1\0\0\0\0\0\0\370\1\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0\20R\0\0\0\0\0\0\20R\300\2719\0\0\0\20R\300\2719\0\0\0\34\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\300\2719\0\0\0\0\0\300\2719\0\0\0\30d\0\0\
@dkhenry
dkhenry / README.md
Last active December 24, 2015 02:29
Using git-deploy and systemd to deploy Play2 webdsites

This uses systemd to control a play2 service

I also am including the git-deploy configuration to update and restart the service from a devleopment machine

  • play2.service

    The SystemD script Place in /etc/systemd/system/

  • after_push

    The after push configuration file > goes in /deploy

@dkhenry
dkhenry / AggregateionFramework.scala
Created March 9, 2013 19:25
Using the Aggregation framework for MongoDB in scala to bucketize time stamped data
import com.mongodb.casbah.Imports._
/**
* Scheme has this general format ( amongst other fields )
* { "_id" : ObjectId("5138c8bd5e0ee06dd30a6ee1"),
* "LAST_SIZE" : NumberLong(200),
* "SYMBOL" : "AAPL",
* "LAST_PRICE" : 428.31,
* "TOTAL_VOLUME" : NumberLong(8923961),
* "TIMESTAMP" : ISODate("2013-03-07T17:05:01.144Z"),
*}
@dkhenry
dkhenry / gist:4696023
Created February 2, 2013 03:41
Install rethinkdb on Fedora 18 ( as of Feb 1st 2013 )
# Install the build deps
sudo yum install --enablerepo=updates-testing --skip-broken gcc-c++ protobuf-compiler protobuf-c protobuf-c-devel protobuf-devel boost-devel openssl-devel v8-devel gperftools-devel nodejs npm curl ctags-etags m4 rubygems protobuf-static boost-static
# install the ruby deps
sudo gem install ruby_protobuf
# install npm manuall ( yum is broken currently )
git clone https://github.com/isaacs/npm.git
cd npm
make
@dkhenry
dkhenry / play2.service
Created January 6, 2013 21:28
Systemd script for the Play Framework
[Unit]
Description=Play2 Server for <site>
After=network.target
 
[Service]
Type=simple
PIDFile=<path>/RUNNING_PID
 
ExecStartPre=/bin/sh -c 'cd <path> ;/bin/rm RUNNING_PID ; sbt clean compile stage'
ExecStart=<path>/target/start
@dkhenry
dkhenry / deferred_data.php
Created June 27, 2012 15:06
SevOne deferred data example
<?php
/**
Program to upload data to SevOne using the Deferred Data API
@author DK (dkozlowski@sevone.com)
@version 0.1
@since 27-June-2012
*/
//! The Appliance IP