Skip to content

Instantly share code, notes, and snippets.

bpot@zoho.bpot.io
bpotimaptest@outlook.com
bpotimaptest@yandex.com

Kafka failures when sending to a single topic:

  • We can't connect to any brokers
  • We connect to a broker but cluster metadata fetch fails
  • Metadata doesn't know about topic
  • Metadata has no leader for that partition we want to send to
  • There is a leader for the partition but we can't connect to it
  • There is a leader for the partition and we sent the request but we timedout or the connection broke (unclear if success)
  • There is a leader for the partition and we sent the request but the broker returned an error
  • There is a leader for the partition, required_acks > 1 and we sent the request but the leader didn't receive acks in time.
ms.cio.huge@gmail.com
@bpot
bpot / freeze.rb
Created March 6, 2015 01:56
Freezing MRI with FFI
require 'ffi'
module Block
extend FFI::Library
ffi_lib FFI::Library::LIBC
attach_function :sleep, [:uint], :void
end
require 'rubygems'
require 'spec'
include Spec::Matchers
a = (1..10).to_a
b = (5..15).to_a
matcher = MatchArray.new(a)
matcher.matches?(b) # => false
require 'rubygems'
require 'eventmachine'
require 'dataflow'
# Experimenting with dataflow + EM
def do_pop_stuff
pop_client = EventMachine::POP::POP3Client.new('pop.gmail.com', 995, true, 'username', 'password')
print "stat: #{pop_client.stat}\n"
pop_client.mails.each do |m|
print m.raw + "\n"
require 'rubygems'
require 'eventmachine'
require 'em-http'
require 'dataflow'
Thread.new {
EM.run{}
}
module EventMachine
require 'rubygems'
require 'mysqlplus'
m = Mysql.real_connect('localhost','root')
m.send_query("SELECT 1")
p m.stat # should raise error?
m.get_result() # hangs
cursor = 0
a = (1..5).to_a
b = []
stack = []
while true
if cursor < a.size
b << a[cursor]
stack << cursor
# mixin to measure up/down rate for an EM::Connection
module RateMeasure
RATE_PERIOD = 5
def post_init
setup_meters
super
end
def receive_data data
update_meter(data.length, @download_meter)