Skip to content

Instantly share code, notes, and snippets.

@josephglanville
josephglanville / schema.avsc
Last active August 6, 2020 03:07
Avro example file
{
"type": "record",
"name": "SomeAvroDatum",
"namespace": "org.apache.druid.data.input",
"fields": [
{
"name": "timestamp",
"type": "long"
},
{
@josephglanville
josephglanville / decimal.go
Created December 26, 2019 08:41
Logical encoding/decoding of Avro Decimal
package logical
import (
"github.com/shopspring/decimal"
"math"
"math/big"
)
func EncodeDecimal(d decimal.Decimal, scale int32) []byte {
unscaled := d.Coefficient()
@josephglanville
josephglanville / keybase.md
Last active July 24, 2019 05:43
keybase.md

Keybase proof

I hereby claim:

  • I am josephglanville on github.
  • I am josephglanville (https://keybase.io/josephglanville) on keybase.
  • I have a public key ASAfQCkcrZrfBRdgMV7uis1HK-DhzarGYfjSGKbOfs_s9wo

To claim this, I am signing this object:

@josephglanville
josephglanville / keybase.md
Created December 17, 2018 00:44
Keybase verification

Keybase proof

I hereby claim:

  • I am josephglanville on github.
  • I am josephglanville (https://keybase.io/josephglanville) on keybase.
  • I have a public key ASCOkmQCfNrA4--oPD35T2SPabIGX0jWRZAToxu76olhvAo

To claim this, I am signing this object:

@josephglanville
josephglanville / car.py
Created April 21, 2018 09:51
Example programs BKK NHL
class Car:
def __init__(self, wheels, color, speed):
self.wheels = wheels
self.color = color
self.speed = speed
self.distance = 0
def drive(self, how_long):
self.distance = self.distance + (self.speed * how_long)
This file has been truncated, but you can view the full file.
^[[B2016-09-12 19:18:53.274 UTC DEBUG: postgres: PostmasterMain: initial environment dump:
2016-09-12 19:18:53.274 UTC DEBUG: -----------------------------------------
2016-09-12 19:18:53.274 UTC DEBUG: PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
2016-09-12 19:18:53.274 UTC DEBUG: PG_GRANDPARENT_PID=10560
2016-09-12 19:18:53.274 UTC DEBUG: PGLOCALEDIR=/usr/share/locale
2016-09-12 19:18:53.274 UTC DEBUG: PGSYSCONFDIR=/etc/postgresql-common
2016-09-12 19:18:53.274 UTC DEBUG: PWD=/var/lib/postgresql
2016-09-12 19:18:53.274 UTC DEBUG: PGDATA=/pgdata
2016-09-12 19:18:53.275 UTC DEBUG: LC_COLLATE=C
2016-09-12 19:18:53.275 UTC DEBUG: LC_CTYPE=C
diff --git a/sql/log.cc b/sql/log.cc
index 7efec98..b77a6b3 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -7712,7 +7712,7 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
last= current->next == NULL;
if (!current->error &&
RUN_HOOK(binlog_storage, after_sync,
- (current->thd, log_file_name,
+ (current->thd, current->cache_mngr->last_commit_pos_file,
@josephglanville
josephglanville / README.md
Created August 13, 2016 03:29
MariaDB semi-sync hang reproduction scripts

Download scripts to directory and execute in this order:

  1. master.sh
  2. slave.sh
  3. trigger.sh

The trigger script will download a smallish dump from the Wikimedia dataset which is large enough to trigger tha hang reliably with the smaller binlog settings.

@josephglanville
josephglanville / README.md
Last active July 30, 2016 08:17
MariaDB semi-sync hang

The files are prefixed with the server they originate from, either master or slave.

@josephglanville
josephglanville / master_mariadb-bin.000005
Last active July 29, 2016 07:23
MariaDB semi-sync status