C*SC301 - Paxos, Tuples and UDTs
-
Upload
victor-anjos -
Category
Technology
-
view
277 -
download
1
Transcript of C*SC301 - Paxos, Tuples and UDTs
Tuples, LWTs and UDTs
S 301Paxos, Tuples and User Defined Types
Shameless Plug
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
From humble beginnings
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
CAP Theorem Refresher
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
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.
From humble beginnings
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
What about transactions?
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
What about transactions?
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
Why not transactions?
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
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.
Paxos… (in Cassandra)
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
Practical LWTs in C*
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
Space-time
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
Enter TuplesCartesian co-ordinates
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
Tracking the drone in real-time
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
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));
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" } } }}
Pre 2.1.3 - there’s a catch
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
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>>
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)
Did I mention…
We’re HIRING!
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc
Did I mention…
We’re HIRING!
@VictorFAnjos
@Cassandra
@FicstarSoftware
@BrightlaneInc