Menu

Newer versions (0.6+) are not quite compatible...

We have not yet provided a newer version (0.6) but we changed the code quite a bit to do two things:

1) make use of CQL instead of thrift
2) have an intermediate proxy so the website system can connect to the proxy, really fast, instead of directly connecting to ONE Cassandra node which could be dead at that time (i.e. the proxy can connect to any number of nodes at leisure and let you free of dealing with that problem.) What this gives a snap_child process is the ability to connect to one place and get database answers from any number of databases. This generally makes it a lot faster.

The CQL works using the C/C++ driver so we should have minimal support needed on that side. However, the snapdbproxy daemon is part of the snapwebsites/lib and snapwebsites/src/snapdbproxy directories from the snapcpp project. This is why we are not going to provide a new download any time soon.

The existing version (0.5.22) runs with thrift and we won't be supporting it anymore. Sorry. But Cassandra is really going with CQL so we do think that the old interface is not going to continue to work "forever".

Note that the users of the library should see no difference except for the IP address and port used to connect. Everything else is still 99% compatible. However, we may change that soon, especially for the way to gather the data about the cluster (it's actually very slow and we want to avoid it.)

Posted by Alexis Wilke 2016-05-02
  • Samuel

    Samuel - 2016-10-05

    And when will the new version be released?

     
  • Alexis Wilke

    Alexis Wilke - 2016-10-05

    We are hesitating as the new version is mostly compatible with the old one, but it has some "strange" feature and requires another library and daemon to work (snapdbproxy).

    So it is rather complicated to make a viable release with the new version at this point.

     
  • Alexis Wilke

    Alexis Wilke - 2016-10-05

    Just in case, the source code can be found in snapcpp on github.

     
    • Samuel

      Samuel - 2016-10-10

      :D thats a real huge project, why keep everything in one repository, its hard to find them

       
      • Alexis Wilke

        Alexis Wilke - 2016-10-10

        Well, as far as Snap! C++ is concerned, it makes it easier for the build system to keep everything up to date. All of those projects are not (yet) in Debian so it allows one who wants to recompile all of the snapcpp environment to do so easily...

         
  • Samuel

    Samuel - 2016-10-15

    😂how many dependencies needed for this library

     
  • Samuel

    Samuel - 2016-10-17

    I tried to build the missing dependencies, and when i was building advgetopt, it asked for Doxygen and SnapDoxygen, the document generating tool? Is that necessary?😂

     
  • Samuel

    Samuel - 2016-10-17

    I am not good at Linux or CMake, actually I am not a programmer at all.😂

     
  • Alexis Wilke

    Alexis Wilke - 2016-10-17

    Well... if you are not a programmer, I'm not too sure you'd want to have libQtCassandra in the first place... That's really only for programmers.

    Now, version 0.5 used Thrift and had an interface that encompassed thrift well. On the other hand, 0.6 uses CQL. The nice scheme we had with Thrift is fairly broken. The way CQL functions is quite different and either way we really needed to have a proxy for two reasons:

    1. It is slow to connect to a Cassandra node each time you want to retrieve some data (especially if you happen to try to connect to a node that's currently down.)
    2. The cassandra C++ driver, without asking you, uses threads. In itself it's fine, but when you have an application that runs with fork(), it breaks really bad.

    Anyway, the dependencies are numerous. If you want to use libQtCassandra as it was used in 0.5, with the Cassandra, Context, Table, Row, Cell objects, then you need everything in snapcpp, pretty much:

    • The libQtCassandra itself does not depend on another library anymore (we now have removed the need for controlledvars), however, it still requires the top cmake folder to run cmake against it.
    • To run snapdbproxy, you need to compile it which requires advgetopt and libsnapwebsites
    • To communicate with snapdbproxy you need the snapcommunicator daemon too (yes, snapdbproxy and snapcommunicator are both daemons)
    • The libsnapwebsites library depends on as2js, csspp, log4cplus, libtld, libQtSerialization, and libQtCassandra (more or less, all of the contrib folder...)

    So the easiest is probably to recompile all of the snapcpp environment.

    This should work by first retrieving all the files and then running two scripts:

    mkdir snap-environment
    cd snap-environment
    git clone https://github.com/m2osw/snapcpp.git snapcpp
    snapcpp/bin/snap-ubuntu-packages
    snapcpp/bin/build-snap
    

    You may want to check out the two scripts before running them to make sure it will work on your machine.

    The snap-ubuntu-packages makes sure all the system packages (stuff not included in your contrib folder) is installed on your machine and thus everything runs. If you want absolutely everything (including the documentation which is supposed to be option, indeed) then you can use the --optional flag as in:

    snapcpp/bin/snap-ubuntu-packages --optional
    

    Yet again, if you are not a programmer, I'm not too sure why you'd want to go through all of this trouble... B-)

     
  • Samuel

    Samuel - 2016-10-18

    That's 2 C++ drivers mentioned in Cassandra Documentation, I don't know which is easier to learn, I picked this one just cause you said it follows Qt syntax, and I thought it should be easy for a Qt learner to get started. Or will you recommend me to use the other one?

     
    • R. Douglas Barbieri

      Hi Samuel,

      The QCassandraSession and QCassandraQuery objects give you a truly
      object-oriented, C++ friendly interface, where I've wrapped all of the
      major calls provided by the cassandra-cpp driver. I find their
      interface, which is a mix of object-orientation with a C-only syntax, to
      be difficult to work with (their documentation leaves a lot to be desired).

      So if you want to play with creating databases, tables, and rows and
      adding and selecting data, I recommend you start there.

       
  • Alexis Wilke

    Alexis Wilke - 2016-10-18

    Ah. I see.

    Yes. I would suggest you use version 0.5 if you do not mind using Thrift. However, they are deprecating that interface. Many little things won't work quite right.

    libQtCassandra 0.6 has two sides, one part which offers the Cassandra, Context, Table, Row, Cell tree. If you ignore that side completely, then you could use it but you will also need the other C++ driver. So 0.6 is a wrapper of the C++ driver that comes from the Cassandra people.They wrote the code in C++, but made their interface only accessible through C-like functions. Our library transforms that in an object oriented Qt compatible library. In this case the object you deal with are main Session and Query objects. There is MetaData which let you get the structure of the database (the name of contexts, tables, columns.)

    So, if you want to use CQL, you probably want to use their driver only because either way you'd have to have both with libQtCassandra 0.6+.

     
  • Alexis Wilke

    Alexis Wilke - 2016-10-19

    I've found a more user friendly documentation for the C/C++ driver here:

    http://datastax.github.io/cpp-driver/topics/

    It is just like the documentation in the code, it does not really tell you that much, but it is easy to follow. That being said, it does not help the fact that this is C and not C++... unfortunately.

     
    • Samuel

      Samuel - 2016-10-19

      This seemed simpler but isn't it another driver——nothing to do with yours?

       
  • Alexis Wilke

    Alexis Wilke - 2016-10-19

    libQtCassandra 0.6 is a wrapper around the datastax C/C++ driver.

    C looks simpler until you understand how to use C++ properly. Then it becomes dramatically harder.

     
    • Samuel

      Samuel - 2016-10-19

      😂I'm sorry I am not good at English, neither.
      Did you mean C is hard for a C++ user?

       

      Last edit: Samuel 2016-10-19
  • Alexis Wilke

    Alexis Wilke - 2016-10-19

    Yes. C++ offers one thing called RAII which makes is dead easy to do certain things which are otherwise extremely tedious in C.

    Say one of your functions deals with 3 files and 10 memory buffers. In C, if you detect an error, you will have to make sure that those 13 resources are released before you call the return statement. If you have 20 return statements in your function, now you need 20 times the code used to release those 13 resources. Either that, or you use the goto instruction (which many people do).

    In C++, all those resources are in your objects. When you throw an exception, use the return statement or exit the function some other way, "magic" happens... all the resources are automatically released for you. You need ZERO thinking power to remember to release anything. Once you are used to that, switching back to C is a terribly difficult move.

     
    • Samuel

      Samuel - 2016-10-19

      Same problem happened to DataStax?

       

Log in to post a comment.