Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Building an IDE for Apache Cassandra
With Eclipse RCP, e4 and XText
Michaël Figuière
Software Architect
© 2014 DataStax, All Rights Reserved.
Cassandra Peer to Peer Architecture
2
Node
Node Node
Node
Node
Node
Clients can reac...
© 2014 DataStax, All Rights Reserved.
Cassandra Peer to Peer Architecture
3
Node
Node Replica
Replica
Replica
Node
Each pa...
© 2014 DataStax, All Rights Reserved.
Linear Scalability
4
Client Writes/s by Node Count - Replication Factor = 3
© 2014 DataStax, All Rights Reserved.
Cassandra Query Language (CQL)
• Similar to SQL, mostly a subset
• Without joins, su...
© 2014 DataStax, All Rights Reserved. 6
CQL: Create Table
CREATE TABLE users (
login text,
name text,
age int,
...
PRIMARY...
© 2014 DataStax, All Rights Reserved. 7
CQL: Clustered Table
CREATE TABLE mailbox (
login text,
message_id timeuuid,
inter...
© 2014 DataStax, All Rights Reserved. 8
CQL: Queries
SELECT * FROM mailbox
WHERE login = jdoe
AND message_id = '2014-09-25...
© 2014 DataStax, All Rights Reserved.
DataStax DevCenter
• Eclipse RCP standalone application
• Eclipse 3.x + e4
• CQL edi...
DataStax DevCenter
Demo
© 2014 DataStax, All Rights Reserved.
Xtext with CQL
11
ValidationCQL Grammar
Content Assist Quick Fixes
Syntax Highlighti...
© 2014 DataStax, All Rights Reserved. 12
Validation and Quick Fix
Validation
@Fix(CqlConstants.KEYSPACE_EXIST)
public void...
© 2014 DataStax, All Rights Reserved.
Cassandra + Script Context
13
© 2014 DataStax, All Rights Reserved.
Current Schema for Each Statement
14
© 2014 DataStax, All Rights Reserved. 15
Xtext Embedded Editor
@Inject
private EmbeddedEditorFactory factory;
editor = fac...
© 2014 DataStax, All Rights Reserved. 16
Benefits of e4
Dependency Injection
@Inject
IEventBroker broker;
public void doSo...
© 2014 DataStax, All Rights Reserved.
DevCenter and e4
• DevCenter cannot be a pure e4 application…
• Relies on Xtext and ...
© 2014 DataStax, All Rights Reserved.
E4 in a Eclipse 3.x Plugin
18
DIViewPart Adapter
E4View
Eclipse 3.x Plugin
Eclipse t...
Questions?
@mfiguiere
blog.datastax.com
github.com/datastax
Upcoming SlideShare
Loading in …5
×
Upcoming SlideShare
E(fx)clipse eclipse con
Next
Download to read offline and view in fullscreen.

0

Share

Download to read offline

EclipseCon - Building an IDE for Apache Cassandra

Download to read offline

Apache Cassandra is a distributed, scalable and highly available database used in many large scale infrastructures in companies such as Netflix, eBay, Instagram or Spotify. It comes with a SQL-like query language that reduces its learning curve, but in order to allow developers to have a similar productivity as with traditional RDBMS, several tools are required.

DataStax DevCenter is a standalone IDE built on top of the Eclipse RCP Platform, that makes it easier to create data models and scripts for Cassandra. It relies on Xtext to bring a modern editor with content assist, syntax highlighting, cross references, instant validation and quick fixes. Besides that, in order to build a sophisticated UI while keeping the codebase simple, e4 has been leveraged for dependency injection and event dispatching.

This presentation will provide an overview of the design challenges that we've faced and our experience putting together all these technologies.

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all
  • Be the first to like this

EclipseCon - Building an IDE for Apache Cassandra

  1. 1. Building an IDE for Apache Cassandra With Eclipse RCP, e4 and XText Michaël Figuière Software Architect
  2. 2. © 2014 DataStax, All Rights Reserved. Cassandra Peer to Peer Architecture 2 Node Node Node Node Node Node Clients can reach any of the Cassandra nodes Every node have the same role, there’s no Master or Slave
  3. 3. © 2014 DataStax, All Rights Reserved. Cassandra Peer to Peer Architecture 3 Node Node Replica Replica Replica Node Each partition is stored in several Replicas to ensure durability and high availability
  4. 4. © 2014 DataStax, All Rights Reserved. Linear Scalability 4 Client Writes/s by Node Count - Replication Factor = 3
  5. 5. © 2014 DataStax, All Rights Reserved. Cassandra Query Language (CQL) • Similar to SQL, mostly a subset • Without joins, sub-queries, and aggregations • Primary Key contains: • A Partition Key used to select the partition that will store the Row • Some Clustering Columns, used to define how Rows should be grouped and sorted on the disk • Supports Collections • Supports User Defined Types (UDT) 5
  6. 6. © 2014 DataStax, All Rights Reserved. 6 CQL: Create Table CREATE TABLE users ( login text, name text, age int, ... PRIMARY KEY (login)); login is the partition key, it will be hashed and rows will be spread over the cluster on different partitions Just like in SQL!
  7. 7. © 2014 DataStax, All Rights Reserved. 7 CQL: Clustered Table CREATE TABLE mailbox ( login text, message_id timeuuid, interlocutor text, message text, PRIMARY KEY(login, message_id) ); message_id is a clustering column, it means that all the rows with a same login will be grouped and sorted by message_id on the disk A TimeUUID is a UUID that can be sorted chronologically
  8. 8. © 2014 DataStax, All Rights Reserved. 8 CQL: Queries SELECT * FROM mailbox WHERE login = jdoe AND message_id = '2014-09-25 16:00:00'; Get message by user and message_id (date) SELECT * FROM mailbox WHERE login = jdoe AND message_id <= '2014-09-25 16:00:00' AND message_id >= '2014-09-20 16:00:00'; Get message by user and date interval WHERE clauses can only be constraints on the primary key and range queries are not possible on the partition key
  9. 9. © 2014 DataStax, All Rights Reserved. DataStax DevCenter • Eclipse RCP standalone application • Eclipse 3.x + e4 • CQL editor based on Xtext • 1.0.0 in October 2013 - 1.3.0 March 2015 • Supports Cassandra 1.2 - 2.1 • Tens of thousands of downloads / month 9
  10. 10. DataStax DevCenter Demo
  11. 11. © 2014 DataStax, All Rights Reserved. Xtext with CQL 11 ValidationCQL Grammar Content Assist Quick Fixes Syntax HighlightingFormatting Can be extracted as a standalone library
  12. 12. © 2014 DataStax, All Rights Reserved. 12 Validation and Quick Fix Validation @Fix(CqlConstants.KEYSPACE_EXIST) public void addIfNotExistst(final Issue issue, IssueResolutionAcceptor acceptor) { ... createKeyspaceStmt.setIfNotExists(true); ... } Quick Fix @Check public void checkKeyspaceNotExist(CreateKeyspaceStatement stmt) { if (context.isKeyspaceExistInDatabase(stmt.getKeyspaceEntity())) error(KEYSPACE_ALREADY_EXISTS, stmt, CqlConstants.KEYSPACE_EXIST); }
  13. 13. © 2014 DataStax, All Rights Reserved. Cassandra + Script Context 13
  14. 14. © 2014 DataStax, All Rights Reserved. Current Schema for Each Statement 14
  15. 15. © 2014 DataStax, All Rights Reserved. 15 Xtext Embedded Editor @Inject private EmbeddedEditorFactory factory; editor = factory .newEditor(resourceProvider) .readOnly() .withResourceValidator(resourceValidator) .processIssuesBy(issueProcessor) .withParent(container); partialEditor = editor.createPartialEditor(); Injected through Xtext’s Guice context The SWT Container the editor should be inserted in
  16. 16. © 2014 DataStax, All Rights Reserved. 16 Benefits of e4 Dependency Injection @Inject IEventBroker broker; public void doSomething() { broker.send(TOPIC, "some data"); } Events Handling @Inject public void create(Composite parent, IWorkbenchHelpSystem help) { Button button = ...; help.setHelp(button, "com.example.button.help.id"); } @Inject public void receive(@EventTopic(TOPIC) Object data) { fullRefresh(); }
  17. 17. © 2014 DataStax, All Rights Reserved. DevCenter and e4 • DevCenter cannot be a pure e4 application… • Relies on Xtext and Eclipse Editor • Eclipse IDE doesn’t rely on the e4 Application Model yet • …but can still use e4 through adapters on top of Eclipse 3.x 17
  18. 18. © 2014 DataStax, All Rights Reserved. E4 in a Eclipse 3.x Plugin 18 DIViewPart Adapter E4View Eclipse 3.x Plugin Eclipse technical code goes here Application logic sits here
  19. 19. Questions? @mfiguiere blog.datastax.com github.com/datastax

Apache Cassandra is a distributed, scalable and highly available database used in many large scale infrastructures in companies such as Netflix, eBay, Instagram or Spotify. It comes with a SQL-like query language that reduces its learning curve, but in order to allow developers to have a similar productivity as with traditional RDBMS, several tools are required. DataStax DevCenter is a standalone IDE built on top of the Eclipse RCP Platform, that makes it easier to create data models and scripts for Cassandra. It relies on Xtext to bring a modern editor with content assist, syntax highlighting, cross references, instant validation and quick fixes. Besides that, in order to build a sophisticated UI while keeping the codebase simple, e4 has been leveraged for dependency injection and event dispatching. This presentation will provide an overview of the design challenges that we've faced and our experience putting together all these technologies.

Views

Total views

2,218

On Slideshare

0

From embeds

0

Number of embeds

155

Actions

Downloads

12

Shares

0

Comments

0

Likes

0

×