c*sc301 - paxos, tuples and udts
TRANSCRIPT
![Page 1: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/1.jpg)
Tuples, LWTs and UDTs
S 301Paxos, Tuples and User Defined Types
![Page 2: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/2.jpg)
Shameless Plug
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
![Page 3: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/3.jpg)
From humble beginnings
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
![Page 4: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/4.jpg)
CAP Theorem Refresher
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
![Page 5: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/5.jpg)
Planning your Data Model
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
Start with Queries
Denormalize to Optimize
Planning for Concurrent Writes
Who is jbellis a subscriber of?
Blog entry will have a body, user and category.
![Page 6: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/6.jpg)
From humble beginnings
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
![Page 7: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/7.jpg)
What about transactions?
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
![Page 8: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/8.jpg)
What about transactions?
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
![Page 9: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/9.jpg)
Why not transactions?
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
![Page 10: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/10.jpg)
Enter PaxosLight Weight Transactions
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
Prepares a proposal that is sent to a number of Acceptors.Waits on a an acknowledgement (in form of promise) from Acceptors.Sends accept message to Quorum of Acceptors with new value to commit.Returns success? completion to client.
Determines if proposal is newer than what it has seen.Acknowledges/agree with its own highest proposal value seen AND the current value (of what is to be set).Receive message to commit new value.Accept and return on successful commit of value.
![Page 11: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/11.jpg)
Paxos… (in Cassandra)
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
![Page 12: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/12.jpg)
Practical LWTs in C*
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
![Page 13: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/13.jpg)
Space-time
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
![Page 14: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/14.jpg)
Enter TuplesCartesian co-ordinates
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
![Page 15: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/15.jpg)
Tracking the drone in real-time
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
![Page 16: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/16.jpg)
Embedding metadataComplex Data Types & JSON
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
{ "mls_number": "C1818310", "address": { "street_number": 44, "street_name": "kennedy road", "unit": "" }, "listing_price": 459999, "description": "Victorian house set on the gorgeous park...", "date_listed": "2013-06-21", "rooms": { { "room": "kitchen", "dimensions": { "width": "14.2", "length": "16.8", "units": "feet" } }, { "room": "bedroom", "dimensions": { "width": "13.2", "length": "19.6", "units": "feet" } } }}
CREATE TABLE listings ( mls_number text, address text, listing_price double, description text, date_listed timestamp, PRIMARY KEY (mls_number));
CREATE TABLE room_data ( mls_number text, room_id uuid, room_name text, PRIMARY KEY (mls_number, room_id));
CREATE TABLE room_dimensions ( room_id uuid, width double, length double, units text, PRIMARY KEY (room_id));
![Page 17: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/17.jpg)
User Defined Types cont...
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
{ "mls_number": "C1818310", "address": { "street_number": 44, "street_name": "kennedy road", "unit": "" }, "listing_price": 459999, "description": "Victorian house set on the gorgeous park...", "date_listed": "2013-06-21", "rooms": { { "room": "kitchen", "dimensions": { "width": "14.2", "length": "16.8", "units": "feet" } }, { "room": "bedroom", "dimensions": { "width": "13.2", "length": "19.6", "units": "feet" } } }}
{ "mls_number": "C1818310", "address": { "street_number": 44, "street_name": "kennedy road", "unit": "" }, "listing_price": 459999, "description": "Victorian house set on the gorgeous park...", "date_listed": "2013-06-21", "rooms": { { "room": "kitchen", "dimensions": { "width": "14.2", "length": "16.8", "units": "feet" } }, { "room": "bedroom", "dimensions": { "width": "13.2", "length": "19.6", "units": "feet" } } }}
CREATE TYPE room_dimensions ( width double, length double, units text);
{ "mls_number": "C1818310", "address": { "street_number": 44, "street_name": "kennedy road", "unit": "" }, "listing_price": 459999, "description": "Victorian house set on the gorgeous park...", "date_listed": "2013-06-21", "rooms": { { "room": "kitchen", "dimensions": { "width": "14.2", "length": "16.8", "units": "feet" } }, { "room": "bedroom", "dimensions": { "width": "13.2", "length": "19.6", "units": "feet" } } }}
CREATE TYPE mls_address ( street_number int, street_name text, unit text);
CREATE TABLE listings ( mls_number text, address frozen <mls_address>, listing_price double, description text, date_listed timestamp, rooms map <text, frozen <room_dimensions>>, PRIMARY KEY (mls_number));
{ "mls_number": "C1818310", "address": { "street_number": 44, "street_name": "kennedy road", "unit": "" }, "listing_price": 459999, "description": "Victorian house set on the gorgeous park...", "date_listed": "2013-06-21", "rooms": { { "room": "kitchen", "dimensions": { "width": "14.2", "length": "16.8", "units": "feet" } }, { "room": "bedroom", "dimensions": { "width": "13.2", "length": "19.6", "units": "feet" } } }}
![Page 18: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/18.jpg)
Pre 2.1.3 - there’s a catch
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
![Page 19: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/19.jpg)
User Defined Types cont...
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
INSERT INTO listings (mls_number, listing_price, date_listed, description, address, rooms)VALUES (‘C1818310’,459999, ‘2013-06-21’, 'Victorian house set on the gorgeous park...', { street_number: 44, street_name: ‘Kennedy Road’, unit: ‘’ }, { ‘kitchen’: { width: 14.2, length: 16.8, unit: ‘feet’, }, ‘bedroom’: { width: 13.2, length: 19.6, unit: ‘feet’, } });
address frozen <mls_address>,
rooms map <text, frozen <room_dimensions>>
![Page 20: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/20.jpg)
Selecting UDTs
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
cqlsh:msl_test>SELECT kitchen.width, kitchen.length FROM listings WHERE mls_number = ‘C1818310’
kitchen.width | kitchen.length---------------------------------------------------------- 14.2 | 16.8
(1 rows)
cqlsh:msl_test>SELECT address FROM listings WHERE mls_number = ‘C1818310’
address--------------------------------------------------------------------------------{street_number: 44, street_name: ‘Kennedy Road’, unit: ‘’}
(1 rows)
![Page 21: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/21.jpg)
Did I mention…
We’re HIRING!
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
![Page 22: C*SC301 - Paxos, Tuples and UDTs](https://reader036.vdocuments.us/reader036/viewer/2022062401/58f0ed161a28ab7f458b460f/html5/thumbnails/22.jpg)
Did I mention…
We’re HIRING!
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc