Slide 1

Slide 1 text

Next Generation mongoDB Christoph Strobl | @stroblchristoph Jeff Yemin | @jeffyemin Sessions - Streams - Transactions 30min

Slide 2

Slide 2 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Next Generation MongoDB 2 Christoph Strobl Software Engineer, Spring Data Jeff Yemin Lead Engineer, Drivers Sessions - Streams - Transactions

Slide 3

Slide 3 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/

Slide 4

Slide 4 text

https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ 10,30 € incl. VAT
 Shipping information 4 $ http GET :8080/book/f430cb49 HTTP/1.1 200 OK Content-Length: 177 Content-Type: application/json;charset=UTF-8 { "authors": [ "Peter V. Brett" ], "id": "f430cb49", "language": "English", "pages": 880, "publishDate": "2017-28-09", "publisherId": "Harper Collins Publishers", "stock": 3, "title": "The Core" }

Slide 5

Slide 5 text

https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Cart Cart Register Shipping Payment Confirmation 3 copies available The Core 5 only 2 more copies available { _id: "f430cb49", title: "The Core", author: [ "Peter V. Brett" ], published_date: ISODate("2017-09-28"), pages: 880, language: "English", publisher_id: "Harper Collins", available: 2 checkout : [ {by : "cstrobl", date : "2018- ] } $ http POST :8080/book/f430cb49/order HTTP/1.1 200 OK Content-Length: 267 Content-Type: application/json;charset=UTF-8 { "books": [ { "authors": [ "Peter V. Brett" ], "id": "f430cb49", "language": "English", "pages": 880, "publishDate": "2017-28-09", "publisherId": "Harper Collins Publishers", "title": "The Core" } ], "customer": "cstrobl", "date": "2018-09-04" }

Slide 6

Slide 6 text

https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Cart Cart Register Shipping Payment Confirmation 3 copies available The Core $ http POST :8080/book/f430cb49/order HTTP/1.1 200 OK Content-Length: 267 Content-Type: application/json;charset=UTF-8 { "books": [ { "authors": [ "Peter V. Brett" ], "id": "f430cb49", "language": "English", "pages": 880, "publishDate": "2017-28-09", "publisherId": "Harper Collins Publishers", "title": "The Core" } ], "customer": "cstrobl", "date": "2018-09-04" } 6 only 2 more copies available { "_id" : "5b8ee10e", "by" : "cstrobl", "date" : ISODate("2018-09-04"), "books" : [ { "$ref" : "books", "$id" : "f430cb49" } ] } { _id: "f430cb49", title: "The Core", author: [ "Peter V. Brett" ], published_date: ISODate("2017-09-28"), pages: 880, language: "English", publisher_id: "Harper Collins", available: 2 }

Slide 7

Slide 7 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Multi Document Transactions

Slide 8

Slide 8 text

https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Requirements 8 // start transaction // update first collection // query second collection // update third collection // commit transaction • ACID • Conversational, multi-statement

Slide 9

Slide 9 text

https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ How To Get From There to Here 9 Wired Tiger MVCC 3.0 - 3.4

Slide 10

Slide 10 text

https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ How To Get From There to Here 10 Logical Sessions 3.6 Retryable Writes

Slide 11

Slide 11 text

https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ How To Get From There to Here 11 update : { lsid : 1, txnNum : 1}, updates: […] update : { lsid : 1, txnNum : 1}, updates: […] { ok : 1} Retryable Writes IO Exception

Slide 12

Slide 12 text

https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ How To Get From There to Here 12 Replica Set Transactions Sharded Cluster Transactions 4.0 4.2 (under development)

Slide 13

Slide 13 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ https://github.com/christophstrobl/mongodb-bookstore

Slide 14

Slide 14 text

https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Reactive Multi Document Transactions 14 return mongoOperations.inTransaction().execute(action "-> { return action.save(order) .flatMap(order "-> { return action.update(Book.class) .matching(query( where("id").is(book.id) .and("available").gt(0))) .apply(new Update().inc("available", -1)).first() .flatMap(result "-> { if (result.getModifiedCount() "== 0) { throw new BookSoldOutException(book); } return Mono.just(order); }); }); }).next(); Flux.usingWhen(() "-> session, ClientSession"::commitTransaction, ClientSession"::abortTransaction, session "-> … ) @Transactional public Mono insertDocuments() @Deprecated public ReactiveSessionScoped inTransaction()

Slide 15

Slide 15 text

https://pixnio.com/de/landschaften/blatt-blatter/grunes-blatt-flora-natur-baum-sommer-garten
 License: PD Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Summary & Outlook 15 Transactions are multi-document, multi-collection, conversational. They fit in well to existing Spring transaction paradigms.


Slide 16

Slide 16 text

> Stay Connected. MongoDB 4.0 & SpringData Lovelace Releases are out now!
 Get started with Spring Boot 2.1.M4. #springone @s1p https://www.mongodb.com/transactions http://projects.spring.io/spring-data-mongodb/

Slide 17

Slide 17 text

Unless otherwise indicated, these slides are © 2013-2018 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Safe Harbor Statement The following is intended to outline the general direction of Pivotal's offerings. It is intended for information purposes only and may not be incorporated into any contract. Any information regarding pre-release of Pivotal offerings, future updates or other planned modifications is subject to ongoing evaluation by Pivotal and is subject to change. This information is provided without warranty or any kind, express or implied, and is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions regarding Pivotal's offerings. These purchasing decisions should only be based on features currently available. The development, release, and timing of any features or functionality described for Pivotal's offerings in this presentation remain at the sole discretion of Pivotal. Pivotal has no obligation to update forward looking information in this presentation. 17