SlideShare a Scribd company logo
1 of 40
Download to read offline
Addressing Human Scalability Through
Multi-User Editing Using Revision Databases
John Rittenhouse
johnr@ccpgames.com
Overview


•   Introduction
•   The Problem
•   The Solution
•   Revisioned Database Overview
•   System Implementation Overview
•   Examples
•   Performance Hotspots
•   Issues
•   Summary
Who is CCP?


• Independent MMO Company with 600 employees
• Three MMO Projects
   – EVE – Sandbox space ship game with ~370k subscribers, 65k PCU
   – Dust 514 – FPS MMO set in the EVE Universe on the PS3
   – World of Darkness – MMO based on the White Wolf Property
• We need robust game editing solutions
Why address content scalability?


• Customers are seeking larger and more detailed gaming
  worlds
• Content teams are becoming larger
   – Generalist approach to content creation
       • General level designers focusing on smaller and smaller areas
   – Specialist approach to content creation
       • Level designers, lighters, scripters, etc.
       • Results in user clashing
            – Locked out files
            – Unable to see what others are doing
Possible Solutions


• Mergable File Formats
   – YAML or other text based file formats
   – Issue: Will often require a programmer to help merge
• Layered Levels
   – Different parts of the levels
   – Issue: Often different users will work on the same part and can’t see
     the changes that other users have made but have not submitted or
     synced to latest
• Realtime Multiuser Editing
   – Changes by users are visible to other users in real time
   – Issue: More complex to implement than other options
Multiple Users Editing Simultaneously
Minecraft Example
Problems to Tackle


• Synchronization of data amongst users
• How to lock the data
• Alerting systems of other user changes
CCP’s Problems to Tackle


•   Minimal server reboots (Live Editing)
•   Multiple users editing the same area
•   Backwards compatible with existing database tables
•   Support potentially up to 100 content developers
•   Ease of use for programmers
    – Transparent
    – Efficient
• System tolerable of high latency
    – Has to handle Trans-Atlantic latency
• Needs to be implemented in Stackless Python
Possible Implementations of MultiUser Editing


• Server Authoritative Editing
   – Server would know immediately when changes occurred
   – Relies on the server always being up for content developers
• Revisioned Database
   – Allows multiple users to see the same set of changes
   – Have to design an easy API to use
What are Revisioned Databases?


• Think of them as version control for databases
• Similar concepts as version control
   – Submitting/Reverting
   – Changelists
   – Locking
• Rows are your atomic unit
Revisioned Database Tables


• Revision Table
   – Tracks all revisions and in which table and key did they occur with
   – Each of them has a changelist id they are in
• Changelist Table
   – Tracks all the changelists and whether they have been submitted
• User Table
   – Who can edit the data
• Recent Changes Table
   – Tracks all recent changes for polling purposes
• Data Tables
   – Table with all the changes
Data Table Example


• Lets say we are labeling fruit
• So our columns for this table will be fruitID and fruitName
• Need also revisionID and changeType
Data Table Example

revisionID   fruitID        fruitName   changeType
0            0              Apple       Add




                       Table View
revisionID   fruitID        fruitName   changeType
0            0              Apple       Add
Data Table Example

revisionID   fruitID        fruitName    changeType
0            0              Apple        Add
1            0              Fuji Apple   Edit




                       Table View
revisionID   fruitID        fruitName    changeType
1            0              Fuji Apple   Edit
Data Table Example

revisionID   fruitID        fruitName    changeType
0            0              Apple        Add
1            0              Fuji Apple   Edit
2            1              Grape        Add




                       Table View
revisionID   fruitID        fruitName    changeType
1            0              Fuji Apple   Edit
2            1              Grape        Add
Data Table Example

revisionID   fruitID        fruitName       changeType
0            0              Apple           Add
1            0              Fuji Apple      Edit
2            1              Grape           Add
3            0              Red Delicious   Edit




                       Table View
revisionID   fruitID        fruitName       changeType
3            0              Red Delicious   Edit
2            1              Grape           Add
Data Table Example

revisionID   fruitID        fruitName       changeType
0            0              Apple           Add
1            0              Fuji Apple      Edit
2            1              Grape           Add
3            0              Red Delicious   Edit
4            2              Raspberry       Add



                       Table View
revisionID   fruitID        fruitName       changeType
3            0              Red Delicious   Edit
2            1              Grape           Add
4            2              Raspberry       Add
Data Table Example

revisionID   fruitID        fruitName       changeType
0            0              Apple           Add
1            0              Fuji Apple      Edit
2            1              Grape           Add
3            0              Red Delicious   Edit
4            2              Raspberry       Add
5            1              Grape           Delete

                       Table View
revisionID   fruitID        fruitName       changeType
3            0              Red Delicious   Edit
4            2              Raspberry       Add
Locking


• Locks occur on a row level
   – Only one user is allowed to change a row at a time
• If a row is not in a submitted change list then it is a locked
  row.
• Database should reject any changes on locked rows by other
  users
Syncing


• Copies data from one DB to another DB
• Filtered on
   – Submitted/Unsubmitted Changelists
   – Revision Number
   – Branch
Branching


• Works on the same database instead of trying to merge two
  databases together
• Change lists can be assigned to a particular branch
• Uses a promotion branch model
Brief Revisioned Database Summary


• Row changes
   – Tracked and stored with revision number and change list
   – Can be submitted or reverted through a change list
   – Rows are locked to other users till their associated change list are
     submitted or reverted
• Change Lists
• Syncing
• Branching
Handling Updates


• Remote Updates - Poll Recent Revisions Table
   – Retrieves table and keys of rows since last check
   – Tables informed to update those rows
• Scatter Update Events on Local/Remote Changes
   – Alerts systems that are listening to the table, rows, and columns that
     changed with previous and new values
   – Originally just alerted about tables and rows but not the actual data
     values that were changed (made it hard for systems to minimize
     processing)
CCP’s Revisioned Database System


• Called Branched Static Data (BSD)
   – Developed originally by Jörundur Matthíasson
• Beyond the Database we added layers to Python to ease
  usage by other programmers
Layer Overview


                DB Tables

Database
                BSD Layer



             BSD Table Service



 Python          BSDTable



                 BSDRow
Branched Static Data (BSD)

            • Internal CCP Revisioned Database
DB Tables      – Uses views to remain backwards compatible
               – Made of SQL tables, views, and stored procedures

BSD Layer
            • Per Row Operations
               – Add/Edit/Delete
               – Rows Locked to Single User
BSD Table   • Submit/Revert
 Service
            • History of Changes
               – Table with all Changes
BSDTable       – View with most recent
            • Branching/Syncing
BSDRow      • Recent Revisions Table
BSD Table Service


            • Holds references to each table
DB Tables
               – Each table is a Python Class
               – GetTable function
BSD Layer   • Responsible for Table Updates
               – Polls recent revisions table
BSD Table
               – Alerts tables
 Service       – Handles update tasklets


BSDTable



BSDRow
BSDTable Class


            • Loads the Table Data
DB Tables
               – Loads row data into BSDRows
               – Responsible for Indexing
BSD Layer   • Holds references to the Rows
               – GetRowByKey
BSD Table
               – GetRows (Filtering)
 Service    • Handles Adding/Deleting of Rows
               – AddRow
BSDTable       – DeleteRow(s)


BSDRow
BSDRow Class


            • Handles the data at the row level
DB Tables
            • Columns accessed via Properties
               – print row.columnName
BSD Layer      – row.columnName = 2
            • Responsible for data editing
BSD Table      – Threading
 Service       – Merging edits (bucketing)


BSDTable



BSDRow
Example – Table Definition

Schema   Table Name   Label   Key ID 1   Key ID 2
Example – Python Code




Output
Setting 'Ball' to the origin
Found 302 objects with the name 'chair_wood_windsorRes'
Added an object to worldSpaceID 8 with objectID 33 , but deleting it now
Performance Hotspot - Filtering


• Indexed on Columns
   – Initially indexed into lists but swapped to sets
       • Relational databases uses set theory to be fast so lets do the same
   – Choosing columns to index on
• Used to use the DB to filter if our data isn’t fully loaded
   – Resulted in a short term boost for a longer
• Future Changes
   – Case insensitive & delete/nondeleted Indexing
   – Caching/filtering using SQLite
Performance Hotspot - Transactions


• Operations often involve multiple rows
   – Adds often depend on the keys of previous adds
   – Occurs when there is a main table plus additional optionable tables
   – DB Latency makes waiting on responses to slow
• Allows merging of all BSD operations in a tasklet into a single
  DB query
• Provides traditional benefits of entire operations written at
  once to DB
• Easy to Use
   – TransactionStart()/TransactionEnd(transactionName)
   – with bsd.Transaction(transactionName):
Common Pitfalls for Programmers


• Writing Cacheless Algorithms
   – Relies on BSD Table Services for caches
   – Makes creating live systems easier
   – Often results in higher order algorithms
• Assuming Data is Loaded Transaction Based
   – Data written as a transaction isn’t guaranteed to be loaded in a single
     operation
   – Possible Solutions
       • Allow checking to see if a full Recent Revision Update is completed
       • Actually Setup Loading to be transaction based
Issues – Promotion Branching

• We have moved from a promotion to mainline branch model


       Promotion Branching                  Mainline Branching

            Branch A                                   Main

            Branch B
                                          Branch 1                Branch 2
            Branch C

            Branch D         Branch 1.1              Branch 2.1              Branch 2.2
Issues – Promotion Branching


• Causes issues with non-backwards compatible changes
  necessary in other branches
   – Handled with scripts to move the static data between branches
• Interlinked data needs to be set to the same branch
   – Hard to determine the issues without validation
   – Weird Testing flag which makes the issue even worse
Replacing with a Mainline Branch Model


• Databases
   – Main Database
       • Responsible for all table ID’s
   – All other DB’s derive from the Main DB
   – Databases will correspond to the equivalent Perforce Branch
• Code and Databases will be integrated together
   – Databases track the change list number they have been integrated
     from and to
   – Table merges occur automatically except for row conflicts
   – Conflicts at the row resolved by choosing one side or the other
   – Does not handle all potential issues
Summary


• Revisioned Databases work well for multiuser editing
   – Locking is often handled automatically within them
   – Easy to determine changes
• Ease of use is important for programmers
• For a large project assume the programmer won’t know what
  you consider to be the “normal” use case
   – Optimize based on use cases (programmers learn by example)
• DB branching model needs to match the code branching
CCP Is Hiring




Apply online at http://www.ccpgames.com/en/jobs.aspx

                 Jobs available in
                   Atlanta, USA
                 Reykjavik, Iceland
                  Shanghai, China

More Related Content

Similar to Test PDF

Capture the Streams of Database Changes
Capture the Streams of Database ChangesCapture the Streams of Database Changes
Capture the Streams of Database Changesconfluent
 
Evolutionary database design
Evolutionary database designEvolutionary database design
Evolutionary database designSalehein Syed
 
Oracle applications r12.2, ebr, online patching means lot of work for devel...
Oracle applications r12.2, ebr, online patching   means lot of work for devel...Oracle applications r12.2, ebr, online patching   means lot of work for devel...
Oracle applications r12.2, ebr, online patching means lot of work for devel...Ajith Narayanan
 
SAP BO and Teradata best practices
SAP BO and Teradata best practicesSAP BO and Teradata best practices
SAP BO and Teradata best practicesDmitry Anoshin
 
OBIEE11g Multi User Development - MUD
OBIEE11g  Multi User Development - MUDOBIEE11g  Multi User Development - MUD
OBIEE11g Multi User Development - MUDadivasoft
 
Apache Iceberg: An Architectural Look Under the Covers
Apache Iceberg: An Architectural Look Under the CoversApache Iceberg: An Architectural Look Under the Covers
Apache Iceberg: An Architectural Look Under the CoversScyllaDB
 
Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...
Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...
Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...Alex Gorbachev
 
Db2 migration -_tips,_tricks,_and_pitfalls
Db2 migration -_tips,_tricks,_and_pitfallsDb2 migration -_tips,_tricks,_and_pitfalls
Db2 migration -_tips,_tricks,_and_pitfallssam2sung2
 
From Windows to Linux: Converting a Distributed Perforce Helix Infrastructure
From Windows to Linux: Converting a Distributed Perforce Helix InfrastructureFrom Windows to Linux: Converting a Distributed Perforce Helix Infrastructure
From Windows to Linux: Converting a Distributed Perforce Helix InfrastructurePerforce
 
What's New in File-AID 16.03
What's New in File-AID 16.03What's New in File-AID 16.03
What's New in File-AID 16.03Compuware
 
CS101- Introduction to Computing- Lecture 37
CS101- Introduction to Computing- Lecture 37CS101- Introduction to Computing- Lecture 37
CS101- Introduction to Computing- Lecture 37Bilal Ahmed
 
SQL Server 2014 Memory Optimised Tables - Advanced
SQL Server 2014 Memory Optimised Tables - AdvancedSQL Server 2014 Memory Optimised Tables - Advanced
SQL Server 2014 Memory Optimised Tables - AdvancedTony Rogerson
 
Rails Database Migration, Season 2
Rails Database Migration, Season 2Rails Database Migration, Season 2
Rails Database Migration, Season 2RORLAB
 
Making Session Stores More Intelligent
Making Session Stores More IntelligentMaking Session Stores More Intelligent
Making Session Stores More IntelligentKyle Davis
 
DataBase Management systems (IM).pptx
DataBase Management systems (IM).pptxDataBase Management systems (IM).pptx
DataBase Management systems (IM).pptxGooglePay16
 
Stream Analytics with SQL on Apache Flink
 Stream Analytics with SQL on Apache Flink Stream Analytics with SQL on Apache Flink
Stream Analytics with SQL on Apache FlinkFabian Hueske
 
Continuous DB Changes Delivery With Liquibase
Continuous DB Changes Delivery With LiquibaseContinuous DB Changes Delivery With Liquibase
Continuous DB Changes Delivery With LiquibaseAidas Dragūnas
 

Similar to Test PDF (19)

Capture the Streams of Database Changes
Capture the Streams of Database ChangesCapture the Streams of Database Changes
Capture the Streams of Database Changes
 
Evolutionary database design
Evolutionary database designEvolutionary database design
Evolutionary database design
 
Oracle applications r12.2, ebr, online patching means lot of work for devel...
Oracle applications r12.2, ebr, online patching   means lot of work for devel...Oracle applications r12.2, ebr, online patching   means lot of work for devel...
Oracle applications r12.2, ebr, online patching means lot of work for devel...
 
SAP BO and Teradata best practices
SAP BO and Teradata best practicesSAP BO and Teradata best practices
SAP BO and Teradata best practices
 
OBIEE11g Multi User Development - MUD
OBIEE11g  Multi User Development - MUDOBIEE11g  Multi User Development - MUD
OBIEE11g Multi User Development - MUD
 
Apache Iceberg: An Architectural Look Under the Covers
Apache Iceberg: An Architectural Look Under the CoversApache Iceberg: An Architectural Look Under the Covers
Apache Iceberg: An Architectural Look Under the Covers
 
Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...
Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...
Under The Hood of Pluggable Databases by Alex Gorbachev, Pythian, Oracle OpeW...
 
Db2 migration -_tips,_tricks,_and_pitfalls
Db2 migration -_tips,_tricks,_and_pitfallsDb2 migration -_tips,_tricks,_and_pitfalls
Db2 migration -_tips,_tricks,_and_pitfalls
 
From Windows to Linux: Converting a Distributed Perforce Helix Infrastructure
From Windows to Linux: Converting a Distributed Perforce Helix InfrastructureFrom Windows to Linux: Converting a Distributed Perforce Helix Infrastructure
From Windows to Linux: Converting a Distributed Perforce Helix Infrastructure
 
What's New in File-AID 16.03
What's New in File-AID 16.03What's New in File-AID 16.03
What's New in File-AID 16.03
 
Howmysqlworks
HowmysqlworksHowmysqlworks
Howmysqlworks
 
CS101- Introduction to Computing- Lecture 37
CS101- Introduction to Computing- Lecture 37CS101- Introduction to Computing- Lecture 37
CS101- Introduction to Computing- Lecture 37
 
SQL Server 2014 Memory Optimised Tables - Advanced
SQL Server 2014 Memory Optimised Tables - AdvancedSQL Server 2014 Memory Optimised Tables - Advanced
SQL Server 2014 Memory Optimised Tables - Advanced
 
Rails Database Migration, Season 2
Rails Database Migration, Season 2Rails Database Migration, Season 2
Rails Database Migration, Season 2
 
Making Session Stores More Intelligent
Making Session Stores More IntelligentMaking Session Stores More Intelligent
Making Session Stores More Intelligent
 
MS ACCESS.pptx
MS ACCESS.pptxMS ACCESS.pptx
MS ACCESS.pptx
 
DataBase Management systems (IM).pptx
DataBase Management systems (IM).pptxDataBase Management systems (IM).pptx
DataBase Management systems (IM).pptx
 
Stream Analytics with SQL on Apache Flink
 Stream Analytics with SQL on Apache Flink Stream Analytics with SQL on Apache Flink
Stream Analytics with SQL on Apache Flink
 
Continuous DB Changes Delivery With Liquibase
Continuous DB Changes Delivery With LiquibaseContinuous DB Changes Delivery With Liquibase
Continuous DB Changes Delivery With Liquibase
 

More from maiden1988

Pedulla Bass Owner's Manual
Pedulla Bass Owner's ManualPedulla Bass Owner's Manual
Pedulla Bass Owner's Manualmaiden1988
 
BMW M5 Brochure (2013)
BMW M5 Brochure (2013)BMW M5 Brochure (2013)
BMW M5 Brochure (2013)maiden1988
 
Porsche Brochure
Porsche BrochurePorsche Brochure
Porsche Brochuremaiden1988
 
Porsche Brochure
Porsche BrochurePorsche Brochure
Porsche Brochuremaiden1988
 
Porsche Brochure
Porsche BrochurePorsche Brochure
Porsche Brochuremaiden1988
 
Nick's Test Presentation
Nick's Test PresentationNick's Test Presentation
Nick's Test Presentationmaiden1988
 
ChamberLinked Webinars
ChamberLinked WebinarsChamberLinked Webinars
ChamberLinked Webinarsmaiden1988
 
Programming Addressing Human Scalability
Programming Addressing Human ScalabilityProgramming Addressing Human Scalability
Programming Addressing Human Scalabilitymaiden1988
 
Programming Addressing Human Scalability
Programming Addressing Human ScalabilityProgramming Addressing Human Scalability
Programming Addressing Human Scalabilitymaiden1988
 
Programming Addressing Human Scalability
Programming Addressing Human ScalabilityProgramming Addressing Human Scalability
Programming Addressing Human Scalabilitymaiden1988
 
John Rittenhouse - Programming Addressing Human Scalability
John Rittenhouse - Programming Addressing Human ScalabilityJohn Rittenhouse - Programming Addressing Human Scalability
John Rittenhouse - Programming Addressing Human Scalabilitymaiden1988
 
Another Test 32423423
Another Test 32423423Another Test 32423423
Another Test 32423423maiden1988
 

More from maiden1988 (20)

Pedulla Bass Owner's Manual
Pedulla Bass Owner's ManualPedulla Bass Owner's Manual
Pedulla Bass Owner's Manual
 
Testing
TestingTesting
Testing
 
BMW M5 Brochure (2013)
BMW M5 Brochure (2013)BMW M5 Brochure (2013)
BMW M5 Brochure (2013)
 
Porsche Brochure
Porsche BrochurePorsche Brochure
Porsche Brochure
 
Porsche Brochure
Porsche BrochurePorsche Brochure
Porsche Brochure
 
Porsche Brochure
Porsche BrochurePorsche Brochure
Porsche Brochure
 
Nick's Test Presentation
Nick's Test PresentationNick's Test Presentation
Nick's Test Presentation
 
ChamberLinked Webinars
ChamberLinked WebinarsChamberLinked Webinars
ChamberLinked Webinars
 
Test 2
Test 2Test 2
Test 2
 
Programming Addressing Human Scalability
Programming Addressing Human ScalabilityProgramming Addressing Human Scalability
Programming Addressing Human Scalability
 
Programming Addressing Human Scalability
Programming Addressing Human ScalabilityProgramming Addressing Human Scalability
Programming Addressing Human Scalability
 
Programming Addressing Human Scalability
Programming Addressing Human ScalabilityProgramming Addressing Human Scalability
Programming Addressing Human Scalability
 
John Rittenhouse - Programming Addressing Human Scalability
John Rittenhouse - Programming Addressing Human ScalabilityJohn Rittenhouse - Programming Addressing Human Scalability
John Rittenhouse - Programming Addressing Human Scalability
 
Another Test 32423423
Another Test 32423423Another Test 32423423
Another Test 32423423
 
Another Test
Another TestAnother Test
Another Test
 
Another Test
Another TestAnother Test
Another Test
 
GDC
GDCGDC
GDC
 
GDC
GDCGDC
GDC
 
GDC
GDCGDC
GDC
 
GDC
GDCGDC
GDC
 

Test PDF

  • 1. Addressing Human Scalability Through Multi-User Editing Using Revision Databases John Rittenhouse johnr@ccpgames.com
  • 2. Overview • Introduction • The Problem • The Solution • Revisioned Database Overview • System Implementation Overview • Examples • Performance Hotspots • Issues • Summary
  • 3. Who is CCP? • Independent MMO Company with 600 employees • Three MMO Projects – EVE – Sandbox space ship game with ~370k subscribers, 65k PCU – Dust 514 – FPS MMO set in the EVE Universe on the PS3 – World of Darkness – MMO based on the White Wolf Property • We need robust game editing solutions
  • 4. Why address content scalability? • Customers are seeking larger and more detailed gaming worlds • Content teams are becoming larger – Generalist approach to content creation • General level designers focusing on smaller and smaller areas – Specialist approach to content creation • Level designers, lighters, scripters, etc. • Results in user clashing – Locked out files – Unable to see what others are doing
  • 5. Possible Solutions • Mergable File Formats – YAML or other text based file formats – Issue: Will often require a programmer to help merge • Layered Levels – Different parts of the levels – Issue: Often different users will work on the same part and can’t see the changes that other users have made but have not submitted or synced to latest • Realtime Multiuser Editing – Changes by users are visible to other users in real time – Issue: More complex to implement than other options
  • 6. Multiple Users Editing Simultaneously
  • 8. Problems to Tackle • Synchronization of data amongst users • How to lock the data • Alerting systems of other user changes
  • 9. CCP’s Problems to Tackle • Minimal server reboots (Live Editing) • Multiple users editing the same area • Backwards compatible with existing database tables • Support potentially up to 100 content developers • Ease of use for programmers – Transparent – Efficient • System tolerable of high latency – Has to handle Trans-Atlantic latency • Needs to be implemented in Stackless Python
  • 10. Possible Implementations of MultiUser Editing • Server Authoritative Editing – Server would know immediately when changes occurred – Relies on the server always being up for content developers • Revisioned Database – Allows multiple users to see the same set of changes – Have to design an easy API to use
  • 11. What are Revisioned Databases? • Think of them as version control for databases • Similar concepts as version control – Submitting/Reverting – Changelists – Locking • Rows are your atomic unit
  • 12. Revisioned Database Tables • Revision Table – Tracks all revisions and in which table and key did they occur with – Each of them has a changelist id they are in • Changelist Table – Tracks all the changelists and whether they have been submitted • User Table – Who can edit the data • Recent Changes Table – Tracks all recent changes for polling purposes • Data Tables – Table with all the changes
  • 13. Data Table Example • Lets say we are labeling fruit • So our columns for this table will be fruitID and fruitName • Need also revisionID and changeType
  • 14. Data Table Example revisionID fruitID fruitName changeType 0 0 Apple Add Table View revisionID fruitID fruitName changeType 0 0 Apple Add
  • 15. Data Table Example revisionID fruitID fruitName changeType 0 0 Apple Add 1 0 Fuji Apple Edit Table View revisionID fruitID fruitName changeType 1 0 Fuji Apple Edit
  • 16. Data Table Example revisionID fruitID fruitName changeType 0 0 Apple Add 1 0 Fuji Apple Edit 2 1 Grape Add Table View revisionID fruitID fruitName changeType 1 0 Fuji Apple Edit 2 1 Grape Add
  • 17. Data Table Example revisionID fruitID fruitName changeType 0 0 Apple Add 1 0 Fuji Apple Edit 2 1 Grape Add 3 0 Red Delicious Edit Table View revisionID fruitID fruitName changeType 3 0 Red Delicious Edit 2 1 Grape Add
  • 18. Data Table Example revisionID fruitID fruitName changeType 0 0 Apple Add 1 0 Fuji Apple Edit 2 1 Grape Add 3 0 Red Delicious Edit 4 2 Raspberry Add Table View revisionID fruitID fruitName changeType 3 0 Red Delicious Edit 2 1 Grape Add 4 2 Raspberry Add
  • 19. Data Table Example revisionID fruitID fruitName changeType 0 0 Apple Add 1 0 Fuji Apple Edit 2 1 Grape Add 3 0 Red Delicious Edit 4 2 Raspberry Add 5 1 Grape Delete Table View revisionID fruitID fruitName changeType 3 0 Red Delicious Edit 4 2 Raspberry Add
  • 20. Locking • Locks occur on a row level – Only one user is allowed to change a row at a time • If a row is not in a submitted change list then it is a locked row. • Database should reject any changes on locked rows by other users
  • 21. Syncing • Copies data from one DB to another DB • Filtered on – Submitted/Unsubmitted Changelists – Revision Number – Branch
  • 22. Branching • Works on the same database instead of trying to merge two databases together • Change lists can be assigned to a particular branch • Uses a promotion branch model
  • 23. Brief Revisioned Database Summary • Row changes – Tracked and stored with revision number and change list – Can be submitted or reverted through a change list – Rows are locked to other users till their associated change list are submitted or reverted • Change Lists • Syncing • Branching
  • 24. Handling Updates • Remote Updates - Poll Recent Revisions Table – Retrieves table and keys of rows since last check – Tables informed to update those rows • Scatter Update Events on Local/Remote Changes – Alerts systems that are listening to the table, rows, and columns that changed with previous and new values – Originally just alerted about tables and rows but not the actual data values that were changed (made it hard for systems to minimize processing)
  • 25. CCP’s Revisioned Database System • Called Branched Static Data (BSD) – Developed originally by Jörundur Matthíasson • Beyond the Database we added layers to Python to ease usage by other programmers
  • 26. Layer Overview DB Tables Database BSD Layer BSD Table Service Python BSDTable BSDRow
  • 27. Branched Static Data (BSD) • Internal CCP Revisioned Database DB Tables – Uses views to remain backwards compatible – Made of SQL tables, views, and stored procedures BSD Layer • Per Row Operations – Add/Edit/Delete – Rows Locked to Single User BSD Table • Submit/Revert Service • History of Changes – Table with all Changes BSDTable – View with most recent • Branching/Syncing BSDRow • Recent Revisions Table
  • 28. BSD Table Service • Holds references to each table DB Tables – Each table is a Python Class – GetTable function BSD Layer • Responsible for Table Updates – Polls recent revisions table BSD Table – Alerts tables Service – Handles update tasklets BSDTable BSDRow
  • 29. BSDTable Class • Loads the Table Data DB Tables – Loads row data into BSDRows – Responsible for Indexing BSD Layer • Holds references to the Rows – GetRowByKey BSD Table – GetRows (Filtering) Service • Handles Adding/Deleting of Rows – AddRow BSDTable – DeleteRow(s) BSDRow
  • 30. BSDRow Class • Handles the data at the row level DB Tables • Columns accessed via Properties – print row.columnName BSD Layer – row.columnName = 2 • Responsible for data editing BSD Table – Threading Service – Merging edits (bucketing) BSDTable BSDRow
  • 31. Example – Table Definition Schema Table Name Label Key ID 1 Key ID 2
  • 32. Example – Python Code Output Setting 'Ball' to the origin Found 302 objects with the name 'chair_wood_windsorRes' Added an object to worldSpaceID 8 with objectID 33 , but deleting it now
  • 33. Performance Hotspot - Filtering • Indexed on Columns – Initially indexed into lists but swapped to sets • Relational databases uses set theory to be fast so lets do the same – Choosing columns to index on • Used to use the DB to filter if our data isn’t fully loaded – Resulted in a short term boost for a longer • Future Changes – Case insensitive & delete/nondeleted Indexing – Caching/filtering using SQLite
  • 34. Performance Hotspot - Transactions • Operations often involve multiple rows – Adds often depend on the keys of previous adds – Occurs when there is a main table plus additional optionable tables – DB Latency makes waiting on responses to slow • Allows merging of all BSD operations in a tasklet into a single DB query • Provides traditional benefits of entire operations written at once to DB • Easy to Use – TransactionStart()/TransactionEnd(transactionName) – with bsd.Transaction(transactionName):
  • 35. Common Pitfalls for Programmers • Writing Cacheless Algorithms – Relies on BSD Table Services for caches – Makes creating live systems easier – Often results in higher order algorithms • Assuming Data is Loaded Transaction Based – Data written as a transaction isn’t guaranteed to be loaded in a single operation – Possible Solutions • Allow checking to see if a full Recent Revision Update is completed • Actually Setup Loading to be transaction based
  • 36. Issues – Promotion Branching • We have moved from a promotion to mainline branch model Promotion Branching Mainline Branching Branch A Main Branch B Branch 1 Branch 2 Branch C Branch D Branch 1.1 Branch 2.1 Branch 2.2
  • 37. Issues – Promotion Branching • Causes issues with non-backwards compatible changes necessary in other branches – Handled with scripts to move the static data between branches • Interlinked data needs to be set to the same branch – Hard to determine the issues without validation – Weird Testing flag which makes the issue even worse
  • 38. Replacing with a Mainline Branch Model • Databases – Main Database • Responsible for all table ID’s – All other DB’s derive from the Main DB – Databases will correspond to the equivalent Perforce Branch • Code and Databases will be integrated together – Databases track the change list number they have been integrated from and to – Table merges occur automatically except for row conflicts – Conflicts at the row resolved by choosing one side or the other – Does not handle all potential issues
  • 39. Summary • Revisioned Databases work well for multiuser editing – Locking is often handled automatically within them – Easy to determine changes • Ease of use is important for programmers • For a large project assume the programmer won’t know what you consider to be the “normal” use case – Optimize based on use cases (programmers learn by example) • DB branching model needs to match the code branching
  • 40. CCP Is Hiring Apply online at http://www.ccpgames.com/en/jobs.aspx Jobs available in Atlanta, USA Reykjavik, Iceland Shanghai, China