for node in {1..3}; do ~/riak_ts/dev/dev$node/bin/riak stop; done
for node in {1..3}; do ~/riak_ts/dev/dev$node/bin/riak start; donefor node in {2..3}; do ~/riak_ts/dev/dev$node/bin/riak-admin cluster join '[email protected]'; done
~/riak_ts/dev/dev1/bin/riak-admin cluster plan
~/riak_ts/dev/dev1/bin/riak-admin cluster commit
~/riak_ts/dev/dev1/bin/riak-admin member-statusAll SQL examples can be executed through the Riak Shell.
~/riak_ts/dev/dev1/bin/riak-shellOnce the cluster is up, start erlyberly.
java -jar ~/erlyberly/target/*runnable.jarerlyberly is a java process that connects to Riak TS just as if it is another erlang node. The cluster is configured with these node names and cookies.
| Node Name | Cookie |
|---|---|
[email protected] |
riak |
[email protected] |
riak |
[email protected] |
riak |
Now choose one or more of the three debugging tracks, or do your own thing!
CREATE TABLE mytable (a SINT64 NOT NULL, b TIMESTAMP NOT NULL, PRIMARY KEY ((a,quantum(b,1,'s')),a,b));The full allowed syntax is documented here. A table name can only be used once, and dropping tables is not supported. Use different tables names to create new tables.
riak_ql_parser:ql_parse/1transforms stringCREATE TABLEstatements into an erlang record.riak_kv_metadata_store_listener:handle_event/2handles events where the ring metadata has changed, this is received by other nodes in the cluster.riak_ql_ddl_compiler:compiler/1compiles the erlang table records (ddl_v1{}) into erlang modules on each node. Reload the modules and filter on table name, try decompiling the source.
First, create the table mytable above before writing data.
INSERT INTO mytable VALUES (1,1000);
INSERT INTO mytable VALUES (1,1100);
INSERT INTO mytable VALUES (1,1200);
INSERT INTO mytable VALUES (1,1300);
INSERT INTO mytable VALUES (1,1400);
INSERT INTO mytable VALUES (1,1500);
INSERT INTO mytable VALUES (1,1600);
INSERT INTO mytable VALUES (1,1700);
INSERT INTO mytable VALUES (1,1800);
INSERT INTO mytable VALUES (1,1900);
INSERT INTO mytable VALUES (1,2000);
INSERT INTO mytable VALUES (1,2100);
INSERT INTO mytable VALUES (1,2200);
INSERT INTO mytable VALUES (1,2300);
INSERT INTO mytable VALUES (1,2400);
INSERT INTO mytable VALUES (1,2500);
INSERT INTO mytable VALUES (1,2600);
INSERT INTO mytable VALUES (1,2700);
INSERT INTO mytable VALUES (1,2800);
INSERT INTO mytable VALUES (1,2900);
INSERT INTO mytable VALUES (1,3000);riak_kv_w1c_worker:async_put/8andriak_kv_w1c_worker:ts_batch_put/8.riak_kv_vnode:handle_command/3riak_kv_w1c_worker:handle_put_reply/3
First, create the table mytable and write some data before issuing a query.
SELECT * FROM mytable WHERE a = 1 AND b >= 1200 and b <= 4000;Documentation on Riak TS queries is here.
riak_ql_parser:ql_parse/1transforms stringCREATE TABLEstatements into an erlang record.riak_kv_qry_compiler:compiler/3splits the query into multiple sub queries to be executed around the cluster.riak_kv_qry_coverage_plan:create_plan/5andriak_kv_qry_coverage_plan:create_plan/6decides which nodes execute the sub queries.riak_kv_qry_worker:add_subquery_result/3handles the results from the sub queries.