SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
@AYeschenko
Aleksey Yeschenko
Apache Cassandra Committer, Engineer @DataStax
What’s New in Cassandra 2.0
What’s new in Cassandra 2.0
• Lightweight transactions (CAS)
• Eager retries
• Native protocol V2
• Notable Internal improvements
• New CQL3 features
• Triggers (prototype!)
CAS
CAS: When
SELECT * FROM users
WHERE username = ’jbellis’
[empty resultset]
INSERT INTO users (...)
VALUES (’jbellis’, ...)
Session 1
SELECT * FROM users
WHERE username = ’jbellis’
[empty resultset]
INSERT INTO users (...)
VALUES (’jbellis’, ...)
Session 2
When you absolutely require linearizable consistency
(think - safely creating a user with a unique username)
CAS: How
• Based on the Paxos consensus protocol
• Paxos state is durable
• All operations are quorum-based
• Immediate consistency with no leader election or failover
• Relatively expensive - requires 4 round trips vs. 1 for regular
updates. Use only in the parts of your application where it’s really
needed
• ConsistencyLevel.SERIAL
CAS: CQL3
// Insert a user with a unique username
INSERT INTO USERS (username, email, name)
VALUES ('jbellis', 'jbellis@datastax.com', 'Jonathan Ellis')
IF NOT EXISTS
// Reset user’s password transactionally
UPDATE users
SET reset_token = null AND password = ‘newpassword’
IF reset_token = ‘some-generated-reset-token’
CAS: Further Reading
• http://www.datastax.com/dev/blog/lightweight-transactions-in-
cassandra-2-0
• Paxos Made Simple: http://www.cs.utexas.edu/users/lorenzo/
corsi/cs380d/past/03F/notes/paxos-simple.pdf
• http://the-paper-trail.org/blog/consensus-protocols-paxos/
Eager Retries
Eager Retries
• New per-table setting: speculative_retry (NONE|Xpercentile|Xms|
ALWAYS)
• Will issue extra read commands to other replicas behind the scenes
if the current one(s) isn’t (aren’t) responding within the configured
milliseconds/percentile
• Minimizes read latencies, reduces the occurrence of read timeouts
if one or several of the replicas crash or become overloaded
• https://issues.apache.org/jira/browse/CASSANDRA-4705
Native Proto V2
Native Proto V2
• Paging (cursors)
• Batching prepared statements
• Parametrized statements without the explicit prepare phase
Native Proto V2: Paging
Statement stmt = new SimpleStatement("SELECT * FROM images");
stmt.setFetchSize(100);
ResultSet result = session.execute(stmt);
// Iterate over the ResultSet here (will transparently fetch new pages)
for (Row row : result) {
handleRow(row);
}
Native Proto V2: Paging
Native Proto V2: Paging
• Paging state = last seen partition key + last seen cell name +
remaining, opaque
• https://issues.apache.org/jira/browse/CASSANDRA-4415
Native Proto V2: Batching Prepared
PreparedStatement ps = session.prepare("INSERT INTO messages (user_id, msg_id,
title, body) VALUES (?, ?, ?, ?)");
BatchStatement batch = new BatchStatement();
batch.add(ps.bind(uid, mid1, title1, body1));
batch.add(ps.bind(uid, mid2, title2, body2));
batch.add(ps.bind(uid, mid3, title3, body3));
session.execute(batch);
Native Proto V2: Batching Prepared
• Variable statements count
• Can mix prepared and non-prepared statements in a single batch
• Fast
• https://issues.apache.org/jira/browse/CASSANDRA-4693
Native Proto V2: Parametrized Queries
// execute(String query, Object... values)
// executeAsync(String query, Object... values)
session.execute(
"INSERT INTO images (image_id, title, bytes) VALUES (?, ?, ?)",
imageId, imageTitle, imageBytes
);
Native Proto V2: Parametrized Queries
• One-off prepare+execute w/out the explicit prepare phase
• No need to escape the values
• No need to serialize non-string data as strings
• Esp. handy for blobs
• https://issues.apache.org/jira/browse/CASSANDRA-5349
(Some) Notable Internal Improvements
• Rewritten Streaming (CASSANDRA-5286)
• Tracking max/min values on clustering columns for optimized
reads (CASSANDRA-5514)
• Single pass compaction roughly doubling compaction speed for
large partitions (CASSANDRA-4180)
• Size-tiered compaction for LCS L0 when it gets behind
(CASSANDRA-5371)
• Default LCS sstable size increased to 160MB (from 5MB)
(CASSANDRA-5727)
• http://www.datastax.com/dev/blog/whats-under-the-hood-in-
cassandra-2-0
New CQL3 Features
New CQL3 Features
• ALTER TABLE DROP
• 2i on PRIMARY KEY columns
• Preparing TIMESTAMP, TTL and LIMIT
• Listing partition keys
CQL3: ALTER TABLE DROP
ALTER TABLE <table> DROP <column>;
// Immediately removes the column from table’s metadata
// Lazily gets rid of the data during compaction
CQL3: 2i on PRIMARY KEY columns
CREATE TABLE timeline (
event_id uuid,
week_in_year int,
created_at timeuuid,
content blob,
PRIMARY KEY ((event_id, week_in_year), created_at)
);
-- Invalid in C* 1.2, valid now in C* 2.0:
CREATE INDEX ON demo (event_id);
CREATE INDEX ON demo (week_in_year);
CREATE INDEX ON demo (created_at);
CQL3: Preparing Query Options
// Preparing LIMIT
session.prepare("SELECT * FROM foo LIMIT ?");
// Preparing TIMESTAMP and TTL
session.prepare("UPDATE foo USING TIMESTAMP ? AND TTL ? SET bar = ? WHERE baz = ?");
CQL3: Listing Partition Keys
SELECT event_id, week_in_year FROM timeline;
event_id | week_in_year
--------------------------------------+--------------
b27288fa-a4cd-4c1d-b0eb-55a8fe0f9ec0 | 1
b27288fa-a4cd-4c1d-b0eb-55a8fe0f9ec0 | 1
eb58d408-b264-41b9-928e-dd6c0e52888e | 1
eb58d408-b264-41b9-928e-dd6c0e52888e | 1
b27288fa-a4cd-4c1d-b0eb-55a8fe0f9ec0 | 2
b27288fa-a4cd-4c1d-b0eb-55a8fe0f9ec0 | 2
SELECT DISTINCT event_id, week_in_year FROM timeline;
event_id | week_in_year
--------------------------------------+--------------
b27288fa-a4cd-4c1d-b0eb-55a8fe0f9ec0 | 1
eb58d408-b264-41b9-928e-dd6c0e52888e | 1
b27288fa-a4cd-4c1d-b0eb-55a8fe0f9ec0 | 2
Triggers (Prototype!)
Triggers Interface
public interface ITrigger
{
/**
* Called exactly once per CF update, returned mutations are atomically
updated.
*
* @param key - Row Key for the update.
* @param update - Update received for the CF
* @return modifications to be applied, null if no action to be performed.
*/
public Collection<RowMutation> augment(ByteBuffer key, ColumnFamily update);
}
Triggers DML
CREATE TRIGGER <name> ON <table> USING <classname>;
DROP TRIGGER <name> ON <table>;
Triggers Summary
• Prototype
• Relies on logged batches
• Exposes internal classes - RowMutation, ColumnFamily
• Expect changes in 2.1
• http://www.datastax.com/dev/blog/whats-new-in-
cassandra-2-0-prototype-triggers-support
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

React, Redux and es6/7
React, Redux and es6/7React, Redux and es6/7
React, Redux and es6/7Dongho Cho
 
PGConf.ASIA 2017 Logical Replication Internals (English)
PGConf.ASIA 2017 Logical Replication Internals (English)PGConf.ASIA 2017 Logical Replication Internals (English)
PGConf.ASIA 2017 Logical Replication Internals (English)Noriyoshi Shinoda
 
知っておきたいSpring Batch Tips
知っておきたいSpring Batch Tips知っておきたいSpring Batch Tips
知っておきたいSpring Batch Tipsikeyat
 
Flashback (Practical Test)
Flashback (Practical Test)Flashback (Practical Test)
Flashback (Practical Test)Anar Godjaev
 
Apache Spark Structured Streaming + Apache Kafka = ♡
Apache Spark Structured Streaming + Apache Kafka = ♡Apache Spark Structured Streaming + Apache Kafka = ♡
Apache Spark Structured Streaming + Apache Kafka = ♡Bartosz Konieczny
 
Cassandra Data Modeling
Cassandra Data ModelingCassandra Data Modeling
Cassandra Data ModelingMatthew Dennis
 
Data Processing Inside PostgreSQL
Data Processing Inside PostgreSQLData Processing Inside PostgreSQL
Data Processing Inside PostgreSQLEDB
 
MySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELKMySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELKI Goo Lee
 
Using Apache Spark to Solve Sessionization Problem in Batch and Streaming
Using Apache Spark to Solve Sessionization Problem in Batch and StreamingUsing Apache Spark to Solve Sessionization Problem in Batch and Streaming
Using Apache Spark to Solve Sessionization Problem in Batch and StreamingDatabricks
 
Cassandra summit 2013 - DataStax Java Driver Unleashed!
Cassandra summit 2013 - DataStax Java Driver Unleashed!Cassandra summit 2013 - DataStax Java Driver Unleashed!
Cassandra summit 2013 - DataStax Java Driver Unleashed!Michaël Figuière
 
Introduction to apache zoo keeper
Introduction to apache zoo keeper Introduction to apache zoo keeper
Introduction to apache zoo keeper Omid Vahdaty
 
【Maclean liu技术分享】拨开oracle cbo优化器迷雾,探究histogram直方图之秘 0321
【Maclean liu技术分享】拨开oracle cbo优化器迷雾,探究histogram直方图之秘 0321【Maclean liu技术分享】拨开oracle cbo优化器迷雾,探究histogram直方图之秘 0321
【Maclean liu技术分享】拨开oracle cbo优化器迷雾,探究histogram直方图之秘 0321maclean liu
 
Python and cassandra
Python and cassandraPython and cassandra
Python and cassandraJon Haddad
 
An Introduction To PostgreSQL Triggers
An Introduction To PostgreSQL TriggersAn Introduction To PostgreSQL Triggers
An Introduction To PostgreSQL TriggersJim Mlodgenski
 
Administering and Monitoring SolrCloud Clusters
Administering and Monitoring SolrCloud ClustersAdministering and Monitoring SolrCloud Clusters
Administering and Monitoring SolrCloud Clusterslucenerevolution
 

Was ist angesagt? (18)

Casestudy
CasestudyCasestudy
Casestudy
 
React, Redux and es6/7
React, Redux and es6/7React, Redux and es6/7
React, Redux and es6/7
 
PGConf.ASIA 2017 Logical Replication Internals (English)
PGConf.ASIA 2017 Logical Replication Internals (English)PGConf.ASIA 2017 Logical Replication Internals (English)
PGConf.ASIA 2017 Logical Replication Internals (English)
 
知っておきたいSpring Batch Tips
知っておきたいSpring Batch Tips知っておきたいSpring Batch Tips
知っておきたいSpring Batch Tips
 
Flashback (Practical Test)
Flashback (Practical Test)Flashback (Practical Test)
Flashback (Practical Test)
 
Apache Spark Structured Streaming + Apache Kafka = ♡
Apache Spark Structured Streaming + Apache Kafka = ♡Apache Spark Structured Streaming + Apache Kafka = ♡
Apache Spark Structured Streaming + Apache Kafka = ♡
 
Cassandra Data Modeling
Cassandra Data ModelingCassandra Data Modeling
Cassandra Data Modeling
 
Data Processing Inside PostgreSQL
Data Processing Inside PostgreSQLData Processing Inside PostgreSQL
Data Processing Inside PostgreSQL
 
MySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELKMySQL Audit using Percona audit plugin and ELK
MySQL Audit using Percona audit plugin and ELK
 
Zookeeper
ZookeeperZookeeper
Zookeeper
 
Using Apache Spark to Solve Sessionization Problem in Batch and Streaming
Using Apache Spark to Solve Sessionization Problem in Batch and StreamingUsing Apache Spark to Solve Sessionization Problem in Batch and Streaming
Using Apache Spark to Solve Sessionization Problem in Batch and Streaming
 
MySQL 5.5 Guide to InnoDB Status
MySQL 5.5 Guide to InnoDB StatusMySQL 5.5 Guide to InnoDB Status
MySQL 5.5 Guide to InnoDB Status
 
Cassandra summit 2013 - DataStax Java Driver Unleashed!
Cassandra summit 2013 - DataStax Java Driver Unleashed!Cassandra summit 2013 - DataStax Java Driver Unleashed!
Cassandra summit 2013 - DataStax Java Driver Unleashed!
 
Introduction to apache zoo keeper
Introduction to apache zoo keeper Introduction to apache zoo keeper
Introduction to apache zoo keeper
 
【Maclean liu技术分享】拨开oracle cbo优化器迷雾,探究histogram直方图之秘 0321
【Maclean liu技术分享】拨开oracle cbo优化器迷雾,探究histogram直方图之秘 0321【Maclean liu技术分享】拨开oracle cbo优化器迷雾,探究histogram直方图之秘 0321
【Maclean liu技术分享】拨开oracle cbo优化器迷雾,探究histogram直方图之秘 0321
 
Python and cassandra
Python and cassandraPython and cassandra
Python and cassandra
 
An Introduction To PostgreSQL Triggers
An Introduction To PostgreSQL TriggersAn Introduction To PostgreSQL Triggers
An Introduction To PostgreSQL Triggers
 
Administering and Monitoring SolrCloud Clusters
Administering and Monitoring SolrCloud ClustersAdministering and Monitoring SolrCloud Clusters
Administering and Monitoring SolrCloud Clusters
 

Andere mochten auch

Isabelle: Not Only a Proof Assistant
Isabelle: Not Only a Proof AssistantIsabelle: Not Only a Proof Assistant
Isabelle: Not Only a Proof AssistantAchim D. Brucker
 
A Framework for Secure Service Composition
A Framework for Secure Service CompositionA Framework for Secure Service Composition
A Framework for Secure Service CompositionAchim D. Brucker
 
Integrating Application Security into a Software Development Process
Integrating Application Security into a Software Development ProcessIntegrating Application Security into a Software Development Process
Integrating Application Security into a Software Development ProcessAchim D. Brucker
 
On the Static Analysis of Hybrid Mobile Apps: A Report on the State of Apache...
On the Static Analysis of Hybrid Mobile Apps: A Report on the State of Apache...On the Static Analysis of Hybrid Mobile Apps: A Report on the State of Apache...
On the Static Analysis of Hybrid Mobile Apps: A Report on the State of Apache...Achim D. Brucker
 
Thermal power plant1
Thermal power plant1Thermal power plant1
Thermal power plant1Nikhil Kumar
 
Effluent treatment plants
Effluent treatment plantsEffluent treatment plants
Effluent treatment plantsNikhil Kumar
 
Agile Secure Software Development in a Large Software Development Organisatio...
Agile Secure Software Development in a Large Software Development Organisatio...Agile Secure Software Development in a Large Software Development Organisatio...
Agile Secure Software Development in a Large Software Development Organisatio...Achim D. Brucker
 
Springs-mechanical engineering
Springs-mechanical engineeringSprings-mechanical engineering
Springs-mechanical engineeringNikhil Kumar
 
Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...
Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...
Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...Achim D. Brucker
 
Self compacting concrete
Self compacting concreteSelf compacting concrete
Self compacting concreteNikhil Kumar
 
civil engineering-Contracts
civil engineering-Contractscivil engineering-Contracts
civil engineering-ContractsNikhil Kumar
 
Sistem Persamaan Linear dua variable
Sistem Persamaan Linear dua variableSistem Persamaan Linear dua variable
Sistem Persamaan Linear dua variableMawar Defi Anggraini
 
Daur hidup virus
Daur hidup virusDaur hidup virus
Daur hidup virusAyang WL'rs
 
Tugas presentasi system teknik informatika kelompok iii
Tugas presentasi system teknik informatika kelompok iiiTugas presentasi system teknik informatika kelompok iii
Tugas presentasi system teknik informatika kelompok iiiPuji Prasetyo
 

Andere mochten auch (17)

Isabelle: Not Only a Proof Assistant
Isabelle: Not Only a Proof AssistantIsabelle: Not Only a Proof Assistant
Isabelle: Not Only a Proof Assistant
 
A Framework for Secure Service Composition
A Framework for Secure Service CompositionA Framework for Secure Service Composition
A Framework for Secure Service Composition
 
Integrating Application Security into a Software Development Process
Integrating Application Security into a Software Development ProcessIntegrating Application Security into a Software Development Process
Integrating Application Security into a Software Development Process
 
On the Static Analysis of Hybrid Mobile Apps: A Report on the State of Apache...
On the Static Analysis of Hybrid Mobile Apps: A Report on the State of Apache...On the Static Analysis of Hybrid Mobile Apps: A Report on the State of Apache...
On the Static Analysis of Hybrid Mobile Apps: A Report on the State of Apache...
 
Thermal power plant1
Thermal power plant1Thermal power plant1
Thermal power plant1
 
r3-4-2009f_xts5000_new
r3-4-2009f_xts5000_newr3-4-2009f_xts5000_new
r3-4-2009f_xts5000_new
 
Effluent treatment plants
Effluent treatment plantsEffluent treatment plants
Effluent treatment plants
 
Agile Secure Software Development in a Large Software Development Organisatio...
Agile Secure Software Development in a Large Software Development Organisatio...Agile Secure Software Development in a Large Software Development Organisatio...
Agile Secure Software Development in a Large Software Development Organisatio...
 
Springs-mechanical engineering
Springs-mechanical engineeringSprings-mechanical engineering
Springs-mechanical engineering
 
Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...
Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...
Security Testing: Myths, Challenges, and Opportunities - Experiences in Integ...
 
Self compacting concrete
Self compacting concreteSelf compacting concrete
Self compacting concrete
 
Sugar mill
Sugar millSugar mill
Sugar mill
 
civil engineering-Contracts
civil engineering-Contractscivil engineering-Contracts
civil engineering-Contracts
 
Sistem Persamaan Linear dua variable
Sistem Persamaan Linear dua variableSistem Persamaan Linear dua variable
Sistem Persamaan Linear dua variable
 
Dimensi Tiga
Dimensi TigaDimensi Tiga
Dimensi Tiga
 
Daur hidup virus
Daur hidup virusDaur hidup virus
Daur hidup virus
 
Tugas presentasi system teknik informatika kelompok iii
Tugas presentasi system teknik informatika kelompok iiiTugas presentasi system teknik informatika kelompok iii
Tugas presentasi system teknik informatika kelompok iii
 

Ähnlich wie What's new in Cassandra 2.0

Linuxfest Northwest 2022 - MySQL 8.0 Nre Features
Linuxfest Northwest 2022 - MySQL 8.0 Nre FeaturesLinuxfest Northwest 2022 - MySQL 8.0 Nre Features
Linuxfest Northwest 2022 - MySQL 8.0 Nre FeaturesDave Stokes
 
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitMySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitDave Stokes
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11gfcamachob
 
11thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp0111thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp01Karam Abuataya
 
Oracle database 12.2 new features
Oracle database 12.2 new featuresOracle database 12.2 new features
Oracle database 12.2 new featuresAlfredo Krieg
 
Integration-Monday-Stateful-Programming-Models-Serverless-Functions
Integration-Monday-Stateful-Programming-Models-Serverless-FunctionsIntegration-Monday-Stateful-Programming-Models-Serverless-Functions
Integration-Monday-Stateful-Programming-Models-Serverless-FunctionsBizTalk360
 
Custom faultpolicies
Custom faultpoliciesCustom faultpolicies
Custom faultpoliciesxavier john
 
Custom faultpolicies
Custom faultpoliciesCustom faultpolicies
Custom faultpoliciesxavier john
 
ETL With Cassandra Streaming Bulk Loading
ETL With Cassandra Streaming Bulk LoadingETL With Cassandra Streaming Bulk Loading
ETL With Cassandra Streaming Bulk Loadingalex_araujo
 
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1MariaDB plc
 
NET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptxNET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptxpetabridge
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2Alex Zaballa
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2Alex Zaballa
 
PgQ Generic high-performance queue for PostgreSQL
PgQ Generic high-performance queue for PostgreSQLPgQ Generic high-performance queue for PostgreSQL
PgQ Generic high-performance queue for PostgreSQLelliando dias
 
Windowing in Kafka Streams and Flink SQL
Windowing in Kafka Streams and Flink SQLWindowing in Kafka Streams and Flink SQL
Windowing in Kafka Streams and Flink SQLHostedbyConfluent
 
Introduction to Kafka Streams
Introduction to Kafka StreamsIntroduction to Kafka Streams
Introduction to Kafka StreamsGuozhang Wang
 
10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQLSatoshi Nagayasu
 
Introduction to-mongo db-execution-plan-optimizer-final
Introduction to-mongo db-execution-plan-optimizer-finalIntroduction to-mongo db-execution-plan-optimizer-final
Introduction to-mongo db-execution-plan-optimizer-finalM Malai
 

Ähnlich wie What's new in Cassandra 2.0 (20)

Linuxfest Northwest 2022 - MySQL 8.0 Nre Features
Linuxfest Northwest 2022 - MySQL 8.0 Nre FeaturesLinuxfest Northwest 2022 - MySQL 8.0 Nre Features
Linuxfest Northwest 2022 - MySQL 8.0 Nre Features
 
Dun ddd
Dun dddDun ddd
Dun ddd
 
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source SummitMySQL 8.0 New Features -- September 27th presentation for Open Source Summit
MySQL 8.0 New Features -- September 27th presentation for Open Source Summit
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11g
 
11thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp0111thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp01
 
Stream Processing made simple with Kafka
Stream Processing made simple with KafkaStream Processing made simple with Kafka
Stream Processing made simple with Kafka
 
Oracle database 12.2 new features
Oracle database 12.2 new featuresOracle database 12.2 new features
Oracle database 12.2 new features
 
Integration-Monday-Stateful-Programming-Models-Serverless-Functions
Integration-Monday-Stateful-Programming-Models-Serverless-FunctionsIntegration-Monday-Stateful-Programming-Models-Serverless-Functions
Integration-Monday-Stateful-Programming-Models-Serverless-Functions
 
Custom faultpolicies
Custom faultpoliciesCustom faultpolicies
Custom faultpolicies
 
Custom faultpolicies
Custom faultpoliciesCustom faultpolicies
Custom faultpolicies
 
ETL With Cassandra Streaming Bulk Loading
ETL With Cassandra Streaming Bulk LoadingETL With Cassandra Streaming Bulk Loading
ETL With Cassandra Streaming Bulk Loading
 
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
Die Neuheiten in MariaDB 10.2 und MaxScale 2.1
 
NET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptxNET Systems Programming Learned the Hard Way.pptx
NET Systems Programming Learned the Hard Way.pptx
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2
 
PgQ Generic high-performance queue for PostgreSQL
PgQ Generic high-performance queue for PostgreSQLPgQ Generic high-performance queue for PostgreSQL
PgQ Generic high-performance queue for PostgreSQL
 
Windowing in Kafka Streams and Flink SQL
Windowing in Kafka Streams and Flink SQLWindowing in Kafka Streams and Flink SQL
Windowing in Kafka Streams and Flink SQL
 
Introduction to Kafka Streams
Introduction to Kafka StreamsIntroduction to Kafka Streams
Introduction to Kafka Streams
 
10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL
 
Introduction to-mongo db-execution-plan-optimizer-final
Introduction to-mongo db-execution-plan-optimizer-finalIntroduction to-mongo db-execution-plan-optimizer-final
Introduction to-mongo db-execution-plan-optimizer-final
 

Kürzlich hochgeladen

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Kürzlich hochgeladen (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

What's new in Cassandra 2.0

  • 1. @AYeschenko Aleksey Yeschenko Apache Cassandra Committer, Engineer @DataStax What’s New in Cassandra 2.0
  • 2. What’s new in Cassandra 2.0 • Lightweight transactions (CAS) • Eager retries • Native protocol V2 • Notable Internal improvements • New CQL3 features • Triggers (prototype!)
  • 3. CAS
  • 4. CAS: When SELECT * FROM users WHERE username = ’jbellis’ [empty resultset] INSERT INTO users (...) VALUES (’jbellis’, ...) Session 1 SELECT * FROM users WHERE username = ’jbellis’ [empty resultset] INSERT INTO users (...) VALUES (’jbellis’, ...) Session 2 When you absolutely require linearizable consistency (think - safely creating a user with a unique username)
  • 5. CAS: How • Based on the Paxos consensus protocol • Paxos state is durable • All operations are quorum-based • Immediate consistency with no leader election or failover • Relatively expensive - requires 4 round trips vs. 1 for regular updates. Use only in the parts of your application where it’s really needed • ConsistencyLevel.SERIAL
  • 6. CAS: CQL3 // Insert a user with a unique username INSERT INTO USERS (username, email, name) VALUES ('jbellis', 'jbellis@datastax.com', 'Jonathan Ellis') IF NOT EXISTS // Reset user’s password transactionally UPDATE users SET reset_token = null AND password = ‘newpassword’ IF reset_token = ‘some-generated-reset-token’
  • 7. CAS: Further Reading • http://www.datastax.com/dev/blog/lightweight-transactions-in- cassandra-2-0 • Paxos Made Simple: http://www.cs.utexas.edu/users/lorenzo/ corsi/cs380d/past/03F/notes/paxos-simple.pdf • http://the-paper-trail.org/blog/consensus-protocols-paxos/
  • 9. Eager Retries • New per-table setting: speculative_retry (NONE|Xpercentile|Xms| ALWAYS) • Will issue extra read commands to other replicas behind the scenes if the current one(s) isn’t (aren’t) responding within the configured milliseconds/percentile • Minimizes read latencies, reduces the occurrence of read timeouts if one or several of the replicas crash or become overloaded • https://issues.apache.org/jira/browse/CASSANDRA-4705
  • 11. Native Proto V2 • Paging (cursors) • Batching prepared statements • Parametrized statements without the explicit prepare phase
  • 12. Native Proto V2: Paging Statement stmt = new SimpleStatement("SELECT * FROM images"); stmt.setFetchSize(100); ResultSet result = session.execute(stmt); // Iterate over the ResultSet here (will transparently fetch new pages) for (Row row : result) { handleRow(row); }
  • 14. Native Proto V2: Paging • Paging state = last seen partition key + last seen cell name + remaining, opaque • https://issues.apache.org/jira/browse/CASSANDRA-4415
  • 15. Native Proto V2: Batching Prepared PreparedStatement ps = session.prepare("INSERT INTO messages (user_id, msg_id, title, body) VALUES (?, ?, ?, ?)"); BatchStatement batch = new BatchStatement(); batch.add(ps.bind(uid, mid1, title1, body1)); batch.add(ps.bind(uid, mid2, title2, body2)); batch.add(ps.bind(uid, mid3, title3, body3)); session.execute(batch);
  • 16. Native Proto V2: Batching Prepared • Variable statements count • Can mix prepared and non-prepared statements in a single batch • Fast • https://issues.apache.org/jira/browse/CASSANDRA-4693
  • 17. Native Proto V2: Parametrized Queries // execute(String query, Object... values) // executeAsync(String query, Object... values) session.execute( "INSERT INTO images (image_id, title, bytes) VALUES (?, ?, ?)", imageId, imageTitle, imageBytes );
  • 18. Native Proto V2: Parametrized Queries • One-off prepare+execute w/out the explicit prepare phase • No need to escape the values • No need to serialize non-string data as strings • Esp. handy for blobs • https://issues.apache.org/jira/browse/CASSANDRA-5349
  • 19. (Some) Notable Internal Improvements • Rewritten Streaming (CASSANDRA-5286) • Tracking max/min values on clustering columns for optimized reads (CASSANDRA-5514) • Single pass compaction roughly doubling compaction speed for large partitions (CASSANDRA-4180) • Size-tiered compaction for LCS L0 when it gets behind (CASSANDRA-5371) • Default LCS sstable size increased to 160MB (from 5MB) (CASSANDRA-5727) • http://www.datastax.com/dev/blog/whats-under-the-hood-in- cassandra-2-0
  • 21. New CQL3 Features • ALTER TABLE DROP • 2i on PRIMARY KEY columns • Preparing TIMESTAMP, TTL and LIMIT • Listing partition keys
  • 22. CQL3: ALTER TABLE DROP ALTER TABLE <table> DROP <column>; // Immediately removes the column from table’s metadata // Lazily gets rid of the data during compaction
  • 23. CQL3: 2i on PRIMARY KEY columns CREATE TABLE timeline ( event_id uuid, week_in_year int, created_at timeuuid, content blob, PRIMARY KEY ((event_id, week_in_year), created_at) ); -- Invalid in C* 1.2, valid now in C* 2.0: CREATE INDEX ON demo (event_id); CREATE INDEX ON demo (week_in_year); CREATE INDEX ON demo (created_at);
  • 24. CQL3: Preparing Query Options // Preparing LIMIT session.prepare("SELECT * FROM foo LIMIT ?"); // Preparing TIMESTAMP and TTL session.prepare("UPDATE foo USING TIMESTAMP ? AND TTL ? SET bar = ? WHERE baz = ?");
  • 25. CQL3: Listing Partition Keys SELECT event_id, week_in_year FROM timeline; event_id | week_in_year --------------------------------------+-------------- b27288fa-a4cd-4c1d-b0eb-55a8fe0f9ec0 | 1 b27288fa-a4cd-4c1d-b0eb-55a8fe0f9ec0 | 1 eb58d408-b264-41b9-928e-dd6c0e52888e | 1 eb58d408-b264-41b9-928e-dd6c0e52888e | 1 b27288fa-a4cd-4c1d-b0eb-55a8fe0f9ec0 | 2 b27288fa-a4cd-4c1d-b0eb-55a8fe0f9ec0 | 2 SELECT DISTINCT event_id, week_in_year FROM timeline; event_id | week_in_year --------------------------------------+-------------- b27288fa-a4cd-4c1d-b0eb-55a8fe0f9ec0 | 1 eb58d408-b264-41b9-928e-dd6c0e52888e | 1 b27288fa-a4cd-4c1d-b0eb-55a8fe0f9ec0 | 2
  • 27. Triggers Interface public interface ITrigger { /** * Called exactly once per CF update, returned mutations are atomically updated. * * @param key - Row Key for the update. * @param update - Update received for the CF * @return modifications to be applied, null if no action to be performed. */ public Collection<RowMutation> augment(ByteBuffer key, ColumnFamily update); }
  • 28. Triggers DML CREATE TRIGGER <name> ON <table> USING <classname>; DROP TRIGGER <name> ON <table>;
  • 29. Triggers Summary • Prototype • Relies on logged batches • Exposes internal classes - RowMutation, ColumnFamily • Expect changes in 2.1 • http://www.datastax.com/dev/blog/whats-new-in- cassandra-2-0-prototype-triggers-support