Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Thibault Charbonnier
    @thibaultcha
    Hi @jbochi !
    Very nice :)
    Thibault Charbonnier
    @thibaultcha
    Fix for #50! jbochi/lua-resty-cassandra#52 :)
    Thibault Charbonnier
    @thibaultcha
    Could we deploy it @jbochi?
    Juarez Bochi
    @jbochi
    Thibault Charbonnier
    @thibaultcha
    Thank you!
    Mhhh it is missing a tag on the repo @jbochi :/
    Missing dependencies for kong:
    cassandra ~> 0.5-6
    
    Using https://rocks.moonscript.org/cassandra-0.5-6.rockspec... switching to 'build' mode
    Cloning into 'lua-resty-cassandra'...
    warning: Could not find remote branch v0.5-6 to clone.
    fatal: Remote branch v0.5-6 not found in upstream origin
    Juarez Bochi
    @jbochi
    Sorry. I forgot to push the tag
    It should work now
    Thibault Charbonnier
    @thibaultcha
    Let me try
    Yes, perfect, thank you!
    Juarez Bochi
    @jbochi
    Awesome!
    Thibault Charbonnier
    @thibaultcha
    v0.5-6 does not have the iterator fix @jbochi :/
    https://github.com/jbochi/lua-resty-cassandra/blob/v0.5-6/src/cassandra.lua
    Here is the diff between what the file should be and what cassandra.lua has in v0.5-6: https://www.diffchecker.com/upqytlz4
    On the left is the fix as proposed in the PR (commit) and on the right is the file as installed with the 0.5-6 tag on luarocks (link)
    Thibault Charbonnier
    @thibaultcha
    I found the issue. The v0.5-6 tag should be on commit c30df04a1d83ed6a08f0d9667fba7e8646c3f73c, but is instead on 9800a9d2b34a207f6aac1dbbaad93f629652df39, which I don't even see in the history.
    Juarez Bochi
    @jbochi
    Sorry for tag. It's pointing to the correct commit now
    that*
    Thibault Charbonnier
    @thibaultcha
    Alright!
    ndileep
    @ndileep
    Hi, I am trying to use lua-resty-cassandra with NginX (1.8.0) and LuaJIT 2.1.0-beta1. Cassandra version is 2.1.11. When I try to access the DB, session:connect(..., 9042) is successful. However, both session:execute and session.set_kespace do not work. Getting error ngx.say(ok, ":", err) gives bad argument #1 to 'say' (non-array table found)
    With lua-cassandra, the very first step require("cassandra") fails with a different error
    Thibault Charbonnier
    @thibaultcha
    Do you gave the exact errors?
    Have*
    ndileep
    @ndileep
    2015/10/31 22:51:24 [error] 27515#0: 1 lua entry thread aborted: runtime error: content_by_lua(wbxnginx.conf:35):21: bad argument #1 to 'say' (non-array table found)
    stack traceback:
    coroutine 0:
    [C]: in function 'say'
    content_by_lua(wbxnginx.conf:35):21: in function <content_by_lua(wbxnginx.conf:35):1>, client: 10.24.211.154, server: $host, request: "GET / HTTP/1.1", host: "ndileep-vm2.cisco.com"
    2015/10/31 23:00:07 [error] 6465#0:
    1 lua entry thread aborted: runtime error: /usr/local/luajit/share/luajit-2.1.0-beta1/_cassandra.lua:91: attempt to index local 'self' (a nil value)
    Thibault Charbonnier
    @thibaultcha
    I don't think those errors are related to the libraries themselves. Can you paste your code?
    ndileep
    @ndileep
        location / {
    
             default_type 'text/plain';
    
             content_by_lua '
    
                local start = os.date()
                ngx.say("Start time: ", start);
    
                if jit then
                        ngx.say("LuaJIT version: ", jit.version)
                else
                        ngx.say("Not LuaJIT!")
                end
    
                local cassandra = require "cassandra"
                local session = cassandra.new()
                session:set_timeout(1000)
    
                local connected, err = session:connect("127.0.0.1", 9042)
                ngx.say("Connected to cassandra: ", connected);
                ngx.say("Error during connect: ", err);
    
                local timeout = session:get_reused_times();
                ngx.say("timeout: ", timeout);
                local keyname, err = session:execute("select keyname from kms.keynames limit 1")
                ngx.say(err);
             ';
        }
    Thibault Charbonnier
    @thibaultcha
    You cannot call ngx.say like this.
    Check the docs
    ndileep
    @ndileep
    The last statement was ngx.say(keyname) that I changed to ngx.say(err)
    Thibault Charbonnier
    @thibaultcha
    And if ou are using Lua-Cassandra, the doc says Cassandra:new, not Cassandra.new
    Yeah it's wrong
    ndileep
    @ndileep
    Let me restore the lua-cassandra and I'll get back to you. Thanks for the quick response
    Thibault Charbonnier
    @thibaultcha
    ngx.say expects the 1argument to be the log level
    Thibault Charbonnier
    @thibaultcha
    Also timeout is not what you think it is (your variable). And you might want to call close or put the socket in the connection pool at the end. Check the docs
    ndileep
    @ndileep
    Thanks a lot. it works now!!
    ndileep
    @ndileep
    timeout variable was just for some quick debugging. Yes, I need to use a connection pool
    Thibault Charbonnier
    @thibaultcha
    I am rewriting lua-cassandra to be cluster aware and have load balancing and retry policies
    ndileep
    @ndileep
    When would it be available?
    Is lua-cassandra non blocking now? Also, optimized for luaJIT?
    Thibault Charbonnier
    @thibaultcha
    Both are
    In the next few weeks
    ndileep
    @ndileep
    Hi thibaultCha, isn't this a valid syntax to delete a row?
    ok, err = session:execute("delete from kms.keynames where keyname = (?)", {kn})
    kn is of type string and has a valid value
    I am getting ok as nil
    ndileep
    @ndileep
    Code snippet is
                local cassandra = require "cassandra"
    
                local session = cassandra:new()
                session:set_timeout(1000) -- 1000ms timeout
    
                local connected, err = session:connect("127.0.0.1", 9042)
                assert(connected)
    
                local keyname, err = session:execute("select keyname from kms.keynames limit 1")
                if (#keyname == 1) then
                        kn = keyname[1].keyname
                        ok, err = session:execute("delete from kms.keynames where keyname = (?)", {kn})
                end
                session:close()
    Thibault Charbonnier
    @thibaultcha
    why the parenthesis around “?” ?
    The docs does show proper examples.
    I’m not sure it’s valid