2015 09-02 - transaction log prototype

30
David Heath Publishing platform team Government Digital Service GDS Publishing platform team

Transcript of 2015 09-02 - transaction log prototype

Page 1: 2015 09-02 - transaction log prototype

David HeathPublishing platform teamGovernment Digital Service

GDSPublishing platform team

Page 2: 2015 09-02 - transaction log prototype

Transaction log prototype

2GDSPublishing platform team

Page 3: 2015 09-02 - transaction log prototype

Why?

3GDSPublishing platform team

Page 4: 2015 09-02 - transaction log prototype

Complexity

4GDSPublishing platform team

Page 5: 2015 09-02 - transaction log prototype

many bugs...

5GDSPublishing platform team

* many bugs and issues which we’ve experienced have been related to that

Page 6: 2015 09-02 - transaction log prototype

It's a master copyof every change or transaction

6GDSPublishing platform team

Page 7: 2015 09-02 - transaction log prototype

It’s an audit log

7GDSPublishing platform team

a feature we’d really like to have

Page 8: 2015 09-02 - transaction log prototype

Future-proof

8GDSPublishing platform team

if we have a log of every operation, it’s easy to adapt to possible future requirements, because we can easily add new “derived representations”

Page 9: 2015 09-02 - transaction log prototype

What is a derived representation?

9GDSPublishing platform team

Page 10: 2015 09-02 - transaction log prototype

Bank account

10GDSPublishing platform team

Date Description Amount

1/9/2015 Initial deposit £50

Balance: £50

Page 11: 2015 09-02 - transaction log prototype

Bank account

11GDSPublishing platform team

Date Description Amount

1/9/2015 Initial deposit £50

2/9/2015 Pod Ltd -£4.99

Balance: £45.01

Page 12: 2015 09-02 - transaction log prototype

Bank account

12GDSPublishing platform team

Date Description Amount

1/9/2015 Initial deposit £50

2/9/2015 Pod Ltd -£4.99

3/9/2015 Cheque 003 £20

Balance: £65.01

Page 13: 2015 09-02 - transaction log prototype

Bank account

13GDSPublishing platform team

Date Description Amount

1/9/2015 Initial deposit £50

2/9/2015 Pod Ltd -£4.99

3/9/2015 Cheque 003 £20

Balance: £65.01

Derived representation

Page 14: 2015 09-02 - transaction log prototype

In publishing…

GDSPublishing platform team

Event Log

Page 15: 2015 09-02 - transaction log prototype

In publishing…

GDSPublishing platform team

Event Log

Current documents

Page 16: 2015 09-02 - transaction log prototype

In publishing…

GDSPublishing platform team

Event Log

Current documents

History of published documents

Page 17: 2015 09-02 - transaction log prototype

In publishing…

GDSPublishing platform team

Event Log

Current documents

History of published documentsEditorial history and comments

Page 18: 2015 09-02 - transaction log prototype

GDSPublishing platform team

Event Log

Current documents

History of published documents

Editorial history and comments

Admin elasticsearch index

Message on message queue (asynchronous update)

(separate service/data store)

(Synchronously updated)Publishing API

* Derived representations may be in separate systems* Some things need to be updated synchronously, those would need to be in the same data store and updated using a database transaction to guarantee consistency.

Page 19: 2015 09-02 - transaction log prototype

What we did in the prototype

19GDSPublishing platform team

Page 20: 2015 09-02 - transaction log prototype

What we did in the prototype• event log

20GDSPublishing platform team

Page 21: 2015 09-02 - transaction log prototype

What we did in the prototype• event log• commands (for modification)

21GDSPublishing platform team

Page 22: 2015 09-02 - transaction log prototype

What we did in the prototype• event log• commands (for modification)• queries (read from derived

representation)

22GDSPublishing platform team

Page 23: 2015 09-02 - transaction log prototype

What we did in the prototype• event log• commands (for modification)• queries (read from derived

representation)• wired up to policy publisher

23GDSPublishing platform team

Page 24: 2015 09-02 - transaction log prototype

24GDSPublishing platform team

we used postgresql because it’s awesome- real transactions- JSON data type

Page 25: 2015 09-02 - transaction log prototype

Show me some code!

25GDSPublishing platform team

Page 26: 2015 09-02 - transaction log prototype

Remaining questions

26GDSPublishing platform team

• conceptual model of editing/workflow

Page 27: 2015 09-02 - transaction log prototype

Remaining questions

27GDSPublishing platform team

• conceptual model of editing/workflow

• how much validation?• use schemas?

Page 28: 2015 09-02 - transaction log prototype

Remaining questions

28GDSPublishing platform team

• conceptual model of editing/workflow

• how much validation?• use schemas?

• write performance

Page 29: 2015 09-02 - transaction log prototype

Remaining questions

29GDSPublishing platform team

• conceptual model of editing/workflow

• how much validation?• use schemas?

• write performance• replay, snapshotting etc

Page 30: 2015 09-02 - transaction log prototype

David HeathPublishing platform teamGovernment Digital Service

GDSPublishing platform team