Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rewrite) #15

Merged
merged 79 commits into from
Dec 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
e3ce828
starting rewrite. Skeleton for load balancing and retry policies
thibaultcha Oct 30, 2015
8fd0995
feat(rewrite) buffer/serializers and frame writers
thibaultcha Oct 31, 2015
f6589c6
chore(rewrite) isolate rewrite tests
thibaultcha Nov 2, 2015
1321639
feat(rewrite) implement startup flow
thibaultcha Nov 2, 2015
29b6bc6
fix(rewrite) use short for streamId in protocol 3+
thibaultcha Nov 2, 2015
d2bfe9e
feat(rewrite) support protocol decreasing
thibaultcha Nov 3, 2015
022b6e3
refactor(rewrite) CQL types buffering
thibaultcha Nov 4, 2015
6c32747
feat(rewrite) docker-compose.yml for test clusters
thibaultcha Nov 4, 2015
f6f9f1c
refactor(rewrite) move utils to utils folder
thibaultcha Nov 4, 2015
fbf3163
delete pre-rewrite files
thibaultcha Nov 4, 2015
df503a1
feat(rewrite) new cql types and more buffer specs
thibaultcha Nov 5, 2015
1204b4b
rewrite(buffer) cql_decoders grouped with decoder initializers
thibaultcha Nov 5, 2015
b2bb3ea
feat(rewrite) cluster info retrieval on init and logger object
thibaultcha Nov 5, 2015
94cd00a
fix(rewrite) gave tests some love
thibaultcha Nov 5, 2015
e3cd942
feat(rewrite) client shutdown
thibaultcha Nov 5, 2015
e3d1f00
feat(rewrite) execute() and load balancing policies
thibaultcha Nov 6, 2015
19b151e
feat(rewrite) request_handler takes node status in account
thibaultcha Nov 10, 2015
2e684e0
refactor(rewrite) lua-resty style
thibaultcha Nov 12, 2015
20b3d4e
rewrite: cleanup and moving split to utils
thibaultcha Nov 12, 2015
3172149
cleanup(rewrite) catch cache errors and renamings
thibaultcha Nov 12, 2015
67a32cc
feat(rewrite) timeout options for session + cleanup
thibaultcha Nov 13, 2015
4d85171
tests: add integration tests with Test::Nginx
thibaultcha Nov 13, 2015
5fdec2f
feat(rewrite) integration tests for non ngx_lua
thibaultcha Nov 15, 2015
b29691f
feat(rewrite) retry policy and error handling
thibaultcha Nov 16, 2015
95a7894
feat(rewrite) reconnection policies
thibaultcha Nov 17, 2015
65c0109
tests(rewrite) load balancing tests (ngx_lua + busted)
thibaultcha Nov 17, 2015
a883486
feat(rewrite) manual type inference, set keyspace, test
thibaultcha Nov 18, 2015
9d87dd5
fix(tests) include init.lua in ngx_lua tests' package.path
thibaultcha Nov 18, 2015
4d02208
cleanup(rewrite) gathering CQL constants in cassandra.types
thibaultcha Nov 18, 2015
dc1c4d4
feat(rewrite) avoid reconnection in luasocket mode
thibaultcha Nov 18, 2015
ed1350f
fix(tests) better tests for keyspace switching
thibaultcha Nov 18, 2015
754dc54
feat(rewrite) bigint type and options tests
thibaultcha Nov 19, 2015
581547c
feat(rewrite) more CQL types
thibaultcha Nov 19, 2015
4793525
feat(rewrite) implement missing CQL types + tests
thibaultcha Nov 19, 2015
026d633
feat(rewrite) pagination + tests
thibaultcha Nov 19, 2015
772905b
feat(rewrite) auto_paging option and iterator
thibaultcha Nov 19, 2015
07d0f54
feat(rewrite) prepared queries
thibaultcha Nov 20, 2015
b663803
perf(rewrite) inner_execute local function
thibaultcha Nov 20, 2015
89c03cd
feat(rewrite) batch statements (non-prepared)
thibaultcha Nov 21, 2015
a4c0adb
feat(rewrite) prepared batch statements
thibaultcha Nov 21, 2015
ae60202
feat(rewrite) waiting for schema consensus on schema_change
thibaultcha Nov 21, 2015
4dfd4e3
feat(rewrite) session:shutdown() and session:set_keep_alive()
thibaultcha Nov 22, 2015
e0628ed
feat(rewrite) use a separate shm for prepared statements
thibaultcha Nov 23, 2015
e6dffd8
feat(rewrite) SSL verify + client auth for LuaSocket
thibaultcha Nov 24, 2015
7e6e72d
feat(rewrite) authentication (plain text password)
thibaultcha Nov 24, 2015
aec9fe3
cleanup(rewrite) buffer and classic reorganization
thibaultcha Nov 24, 2015
b0b7c68
style(lint) make luacheck happy
thibaultcha Nov 24, 2015
890a127
feat(rewrite) drop const_mt, constants and introduce cluster instance
thibaultcha Nov 24, 2015
530a503
fix(retry) delay 1st retry and create a new socket
thibaultcha Nov 24, 2015
c22303c
docs: rewrite README and update LICENSE
thibaultcha Nov 25, 2015
6a0da78
fix(frame_reader) don't return columns metadata
thibaultcha Nov 25, 2015
cc4fe19
chore(rockspec) bump version to 0.4.0
thibaultcha Nov 25, 2015
22f09b6
feat: provide a cassandra.unset type
thibaultcha Nov 25, 2015
a18cb69
perf(prepared) mutex on prepare query to avoid cold cache
thibaultcha Nov 26, 2015
0e48ee0
improve driver under heavy load
thibaultcha Dec 7, 2015
81cd350
chore(ci) fix travis ci builds
thibaultcha Dec 7, 2015
d41764f
chore(ci) openresty integration tests
thibaultcha Dec 8, 2015
60096df
chore(ci) use installed luajit for OpenResty
thibaultcha Dec 8, 2015
446cb71
Merge pull request #19 from thibaultCha/chore/cleanup
thibaultcha Dec 8, 2015
07d2ff6
fix(load balancing) handle corrupted shm + tests
thibaultcha Dec 8, 2015
36f04b0
feat: refactor API (return obj, err), no more throws
thibaultcha Dec 9, 2015
cbb75d0
specs: more test and group error handling tests
thibaultcha Dec 9, 2015
f83070d
feat(shm) refresh hosts if cluster infos disappeared from the shm
thibaultcha Dec 9, 2015
7ce4872
fix(tests) increase timeout for schema consensus test
thibaultcha Dec 9, 2015
eced827
fix: boolean type inference + type inference tests
thibaultcha Dec 10, 2015
96c7141
feat(cluster) can now use sessions without cluster init
thibaultcha Dec 11, 2015
da7445e
feat: drop the lua-cjson depenency
thibaultcha Dec 11, 2015
9bc9c01
docs(readme) better example, test and tools doc
thibaultcha Dec 11, 2015
2d8207b
docs(ldoc) start documenting the main API
thibaultcha Dec 11, 2015
a7f321a
fix(resty/specs) catch resty.lock require
thibaultcha Dec 11, 2015
ac4fc02
feat(rewrite) allow to set log lvl and format from cassandra
thibaultcha Dec 12, 2015
4a56056
feat(rewrite) set_keep_alive() fallback to close()
thibaultcha Dec 12, 2015
b6fc8ea
feat(ssl) new enabled property for SSL options.
thibaultcha Dec 14, 2015
5503e06
fix(rewrite) typo + descriptive LuaSocket error
thibaultcha Dec 14, 2015
7b24d12
fix(retry) always throw on unavailable + better logs
thibaultcha Dec 15, 2015
e4f7802
feat(rewrite) expose consistencies and CQL errors
thibaultcha Dec 15, 2015
759289d
feat(rewrite) options for cosockets' setkeepalive()
thibaultcha Dec 15, 2015
b17b961
fix(setkeepalive) handle tcpsock:setkeepalive() not handling nil args
thibaultcha Dec 16, 2015
4a23097
fix(startup) if startup request failed, it might be bcause hose is down
thibaultcha Dec 18, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .ci/busted_print.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
local ansicolors = require 'ansicolors'

return function(options)
local handler = require 'busted.outputHandlers.utfTerminal'(options)

handler.fileStart = function(file)
io.write('\n' .. ansicolors('%{cyan}' .. file.name) .. ':')
end

handler.testStart = function(element, parent, status, debug)
io.write('\n ' .. handler.getFullName(element) .. ' ... ')
io.flush()
end

local busted = require 'busted'

busted.subscribe({ 'file', 'start' }, handler.fileStart)
busted.subscribe({ 'test', 'start' }, handler.testStart)

return handler
end
File renamed without changes.
11 changes: 11 additions & 0 deletions .ci/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -e

if [ "$OPENRESTY_TESTS" != "yes" ]; then
busted -v --coverage -o .ci/busted_print.lua
make lint
luacov-coveralls -i cassandra
else
prove -l t
fi
12 changes: 12 additions & 0 deletions .ci/setup_cassandra.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

arr=(${HOSTS//,/ })

pip install --user PyYAML six
git clone https://github.com/pcmanus/ccm.git
pushd ccm
./setup.py install --user
popd
ccm create test -v binary:$CASSANDRA_VERSION -n ${#arr[@]} -d
ccm start -v
ccm status
100 changes: 100 additions & 0 deletions .ci/setup_lua.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/bin/bash

# A script for setting up environment for travis-ci testing.
# Sets up Lua and Luarocks.
# LUA must be "lua5.1", "lua5.2" or "luajit".
# luajit2.0 - master v2.0
# luajit2.1 - master v2.1

LUAJIT="no"

source .ci/platform.sh

############
# Lua/LuaJIT
############

if [ "$LUA" == "luajit" ]; then
LUAJIT="yes"
LUA="luajit-2.0"
elif [ "$LUA" == "luajit-2.0" ]; then
LUAJIT="yes"
elif [ "$LUA" == "luajit-2.1" ]; then
LUAJIT="yes"
fi

if [ "$LUAJIT" == "yes" ]; then
mkdir -p $LUAJIT_DIR

# If cache is empty, download and compile
if [ ! "$(ls -A $LUAJIT_DIR)" ]; then
git clone http://luajit.org/git/luajit-2.0.git
pushd luajit-2.0

if [ "$LUA" == "luajit-2.0" ]; then
git checkout v2.0.4
elif [ "$LUA" == "luajit-2.1" ]; then
git checkout v2.1
fi

make
make install PREFIX=$LUAJIT_DIR
popd

if [ "$LUA" == "luajit-2.1" ]; then
ln -sf $LUAJIT_DIR/bin/luajit-2.1.0-beta1 $LUAJIT_DIR/bin/luajit
fi

ln -sf $LUAJIT_DIR/bin/luajit $LUAJIT_DIR/bin/lua
fi

LUA_INCLUDE="$LUAJIT_DIR/include/$LUA"
else
if [ "$LUA" == "lua5.1" ]; then
curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz
pushd lua-5.1.5
elif [ "$LUA" == "lua5.2" ]; then
curl http://www.lua.org/ftp/lua-5.2.3.tar.gz | tar xz
pushd lua-5.2.3
elif [ "$LUA" == "lua5.3" ]; then
curl http://www.lua.org/ftp/lua-5.3.0.tar.gz | tar xz
pushd lua-5.3.0
fi

make $PLATFORM
make install INSTALL_TOP=$LUA_DIR
popd

LUA_INCLUDE="$LUA_DIR/include"
fi

##########
# Luarocks
##########

LUAROCKS_BASE=luarocks-$LUAROCKS_VERSION
CONFIGURE_FLAGS=""

git clone https://github.com/keplerproject/luarocks.git $LUAROCKS_BASE

pushd $LUAROCKS_BASE
git checkout v$LUAROCKS_VERSION

if [ "$LUAJIT" == "yes" ]; then
LUA_DIR=$LUAJIT_DIR
elif [ "$LUA" == "lua5.1" ]; then
CONFIGURE_FLAGS=$CONFIGURE_FLAGS" --lua-version=5.1"
elif [ "$LUA" == "lua5.2" ]; then
CONFIGURE_FLAGS=$CONFIGURE_FLAGS" --lua-version=5.2"
elif [ "$LUA" == "lua5.3" ]; then
CONFIGURE_FLAGS=$CONFIGURE_FLAGS" --lua-version=5.3"
fi

./configure \
--prefix=$LUAROCKS_DIR \
--with-lua-bin=$LUA_DIR/bin \
--with-lua-include=$LUA_INCLUDE \
$CONFIGURE_FLAGS

make build && make install
popd
43 changes: 43 additions & 0 deletions .ci/setup_openresty.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

if [ "$OPENRESTY_TESTS" != "yes" ]; then
exit
echo "Exiting, no openresty tests"
fi

set -e

mkdir -p $OPENRESTY_DIR

if [ ! "$(ls -A $OPENRESTY_DIR)" ]; then
OPENRESTY_BASE=ngx_openresty-$OPENRESTY_VERSION

curl https://openresty.org/download/$OPENRESTY_BASE.tar.gz | tar xz
pushd $OPENRESTY_BASE

./configure \
--prefix=$OPENRESTY_DIR \
--with-luajit=$LUAJIT_DIR \
--without-http_coolkit_module \
--without-lua_resty_dns \
--without-lua_resty_lrucache \
--without-lua_resty_upstream_healthcheck \
--without-lua_resty_websocket \
--without-lua_resty_upload \
--without-lua_resty_string \
--without-lua_resty_mysql \
--without-lua_resty_redis \
--without-http_redis_module \
--without-http_redis2_module \
--without-lua_redis_parser

make
make install
popd
fi

git clone git://github.com/travis-perl/helpers travis-perl-helpers
pushd travis-perl-helpers
source ./init
popd
cpan-install Test::Nginx::Socket
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
nginx_tmp
t/servroot
3 changes: 2 additions & 1 deletion .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
unused_args = false
globals = {"ngx", "describe", "setup", "teardown", "it", "pending"}
redefined = false
globals = {"ngx", "describe", "setup", "teardown", "it", "pending", "before_each", "after_each", "finally", "spy", "mock"}
62 changes: 43 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,50 @@
language: erlang

language: perl
perl: "5.18"
sudo: false
notifications:
email: false
addons:
apt:
packages:
- libreadline-dev
- libncurses5-dev
- libpcre3-dev
- libssl-dev
- build-essential
env:
global:
- LUAROCKS=2.2.2
- CASSANDRA_VERSION=2.1.8
- CASSANDRA_VERSION=2.1.9
- LUAROCKS_VERSION=2.2.2
- OPENRESTY_VERSION=1.9.3.1
- LUA_DIR=$HOME/lua
- LUAJIT_DIR=$HOME/luajit
- LUAROCKS_DIR=$HOME/luarocks
- OPENRESTY_DIR=$HOME/openresty
- "HOSTS=127.0.0.1,127.0.0.2,127.0.0.3"
- SMALL_LOAD=true
matrix:
- LUA=lua5.1
- LUA=lua5.2
- LUA=lua5.3
- LUA=luajit

- LUA=luajit-2.1
- OPENRESTY_TESTS: "yes"
LUA: "luajit-2.1"
before_install:
- bash .travis/setup_lua.sh
- bash .travis/setup_cassandra.sh
- sudo luarocks install luasocket
- sudo make dev

script:
- "busted -v --coverage"
- "make lint"

after_success: "luacov-coveralls -i cassandra"

notifications:
email: false
- bash .ci/setup_cassandra.sh
- bash .ci/setup_lua.sh
- bash .ci/setup_openresty.sh
- export PATH=$LUA_DIR/src:$LUAJIT_DIR/bin:$LUAROCKS_DIR/bin:$OPENRESTY_DIR/nginx/sbin:$PATH
- export LUA_PATH="./?.lua;$LUAROCKS_DIR/share/lua/5.1/?.lua;$LUAROCKS_DIR/share/lua/5.1/?/init.lua;$LUAROCKS_DIR/lib/lua/5.1/?.lua;$LUA_PATH"
- export LUA_CPATH="$LUAROCKS_DIR/lib/lua/5.1/?.so;$LUA_CPATH"
install:
- make dev
- luarocks install ansicolors
script: .ci/run_tests.sh
cache:
cpan: true
apt: true
pip: true
directories:
- $LUAJIT_DIR
- $OPENRESTY_DIR
- $HOME/.ccm/repository/
7 changes: 0 additions & 7 deletions .travis/setup_cassandra.sh

This file was deleted.

101 changes: 0 additions & 101 deletions .travis/setup_lua.sh

This file was deleted.

4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License (MIT)

Original work Copyright (c) 2014 Juarez Bochi
Modified work Copyright 2015 Thibault Charbonnier
Original work Copyright (c) 2015 Thibault Charbonnier
Based on the work of Juarez Bochi Copyright 2014

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
Loading