History Database - Typical historical query requirements

Slides:



Advertisements
Similar presentations
Chen Zhang Hans De Sterck University of Waterloo
Advertisements

JTX Overview Overview of Job Tracking for ArcGIS (JTX)
CpSc 3220 File and Database Processing Lecture 17 Indexed Files.
© 2013 A. Haeberlen, Z. Ives Cloud Storage & Case Studies NETS 212: Scalable & Cloud Computing Fall 2014 Z. Ives University of Pennsylvania 1.
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
©Silberschatz, Korth and Sudarshan12.1Database System Concepts Chapter 12: Part A Part A:  Index Definition in SQL  Ordered Indices  Index Sequential.
Working with SQL and PL/SQL/ Session 1 / 1 of 27 SQL Server Architecture.
Distributed storage for structured data
Administration etc.. What is this ? This section is devoted to those bits that I could not find another home for… Again these may be useless, but humour.
13.6 Representing Block and Record Addresses
HBase A column-centered database 1. Overview An Apache project Influenced by Google’s BigTable Built on Hadoop ▫A distributed file system ▫Supports Map-Reduce.
Introduction: Databases and Database Users
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
SIMULATED UNIX FILE SYSTEM Implementation in C Tarek Youssef Bipanjit Sihra.
Discovering Computers Fundamentals Fifth Edition Chapter 9 Database Management.
Question of the Day  On a game show you’re given the choice of three doors: Behind one door is a car; behind the others, goats. After you pick a door,
Data in the Cloud – I Parallel Databases The Google File System Parallel File Systems.
JDBC Java and Databases. RHS – SOC 2 JDBC JDBC – Java DataBase Connectivity An API (i.e. a set of classes and methods), for working with databases in.
CS370 Spring 2007 CS 370 Database Systems Lecture 1 Overview of Database Systems.
Christopher M. Pascucci.NET Programming: Databases & ADO.NET.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Database structure and space Management. Segments The level of logical database storage above an extent is called a segment. A segment is a set of extents.
HBase Elke A. Rundensteiner Fall 2013
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
CE Operating Systems Lecture 17 File systems – interface and implementation.
Session 1 Module 1: Introduction to Data Integrity
Indexing Database Management Systems. Chapter 12: Indexing and Hashing Basic Concepts Ordered Indices B + -Tree Index Files File Organization 2.
Copyright (c) 2014 Pearson Education, Inc. Introduction to DBMS.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 5th Edition Copyright © 2015 John Wiley & Sons, Inc. All rights.
Description and exemplification use of a Data Dictionary. A data dictionary is a catalogue of all data items in a system. The data dictionary stores details.
Bigtable: A Distributed Storage System for Structured Data
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 4: Intermediate.
JDBC Java and Databases. SWC – JDBC JDBC – Java DataBase Connectivity An API (i.e. a set of classes and methods), for working with databases in.
Single Linked Lists Objectives In this lesson, you will learn to: *Define single linked list *Identify the following types of linked lists: Single linked.
SQL Basics Review Reviewing what we’ve learned so far…….
By: Eliav Menachi.  On Android, all application data (including files) are private to that application  Android provides a standard way for an application.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
HYPERLEDGER Fabric - Ledger v1 Data Architecture
HYPERLEDGER Fabric Pluggable/Queryable State Database
BRX Technical Training
Storage and File Organization
Module 11: File Structure
Indexing Goals: Store large files Support multiple search keys
Indexing and hashing.
Creation of a FHIR facade
Chapter 11: Storage and File Structure
MongoDB Distributed Write and Read
A Technical Overview of Microsoft® SQL Server™ 2005 High Availability Beta 2 Matthew Stephen IT Pro Evangelist (SQL Server)
OpenStorage API part II
Methodology – Physical Database Design for Relational Databases
Privacy Enabled Ledger
NOSQL databases and Big Data Storage Systems
Unit Test Pattern.
Hyperledger Fabric Private Data - Collection Types
File organization and Indexing
Chapter 11: Indexing and Hashing
Building a Database on S3
Introduction to Database Systems
Indexing and Hashing Basic Concepts Ordered Indices
Recitation Outline C++ STL associative containers Examples
Data Model.
ICOM 5016 – Introduction to Database Systems
Comparison of table-based and JSON-based chaincode
Chapter 11 Managing Databases with SQL Server 2000
Outline Introduction LSM-tree and LevelDB Architecture WiscKey.
Chapter 11: Indexing and Hashing
Index Structures Chapter 13 of GUW September 16, 2019
Presentation transcript:

History Database - Typical historical query requirements show history of values (states) for assetX show full transaction history for assetX, for example to understand what other assets were in the same transactions show assets that have been owned by Alice show assets that were at locationY show values/ownership at a certain point in time Simple provenance queries can be implemented in any key/value (LevelDB) or document datastore (CouchDB) Requires a datastore that supports rich query (e.g. CouchDB)

History Database - Typical historical query requirements Priority for v1 show history of values (states) for assetX show full transaction history for assetX, for example to understand what other assets were in the same transactions show assets that have been owned by Alice show assets that were at locationY show values/ownership at a certain point in time Simple provenance queries can be implemented in any key/value (LevelDB) or document datastore (CouchDB) Requires a datastore that supports rich query (e.g. CouchDB)

History of a Key - GetTransactionsForKey() API GetTransactionsForKey() API uses history database to return history for a key. Can be used for simple provenance scenarios. Expose to SDK and chaincode (similar to ExecuteQuery) Option to return historical values (states) or historical transaction details for a key.

History of a Key - GetTransactionsForKey() API Determining history (simple provenance) of a key is supported by API GetTransactionsForKey(). This API could be called from SDK or from within chaincode. To support this API, there will be an optional history database with a record for each historic key value. The history database is actually an ‘index’ or ‘materialized view’ of the blockchain, to handle historical queries more efficiently than scanning the entire blockchain data set. Some clients will want to know the history of key values only, other clients will want to know the full transaction context for each historic key value. Therefore the API will return a list of key modifications that includes summary information (txid, timestamp) and an option to return the value or full transaction details associated with the historical modification. Note: While the value itself can be found within the transaction details WriteSet, providing an option to return the value directly will be simpler for those applications that only need the history of values. Since this will be exposed to chaincode applications, this simplification is important. // GetTransactionsForKey returns an iterator that contains all the transactions that modified the given key. GetTransactionsForKey(namespace string, key string, includeValues bool, includeTransactions bool) (ResultsIterator, error) The returned ResultsIterator contains results of type KeyModification: type KeyModification struct{ Txid string TxTimestamp time.Time Value []byte Transaction ?.Transaction } Note: will likely need ordering service to provide a system timestamp at block level. All the transactions within the block would inherit the same timestamp. Optional in response. Optional in response. Note: I think we need to author a Transaction struct that is friendly for chaincode applications.

Implementation – Common approach for simple provenance History database is enabled via a config setting in core.yaml. In v1, store history records in LevelDB, regardless of state database choice. There is a record inserted into history database for each key value written to state database. Key for this record will be: namespace~key~blocknum~trannum (‘namespace’ represents chaincode name. ‘~’ represents null character.) (blocknum,trannum) ensures a unique key for each historical value. Example historical keys for a chaincode key that has been updated twice, at (block 123, tran 12) and (block 456, tran 7): chaincode1~key1~0000000000123~000000000012 chaincode1~key1~0000000000456~000000000007 GetTransactionsForKey() for (chaincode1,key1) would do a key range query on chaincode1~key1 to pick up all chaincode1~key1 records. Results will indicate the set of (blocknum,trannum) transactions that updated this key In the example above, that would be (block 123, tran 12) and (block 456, tran 7). Finally, build the API response by using the (blocknum,trannum) to pull the value and/or transaction details from blockchain block storage. There is no need to duplicate this info in the history database for simple provenance on goleveldb (historic key values can be null in history database) Note, a new block storage index will map (blocknum,trannum) to the file storage location for this block tran, similar in concept to the other block storage indexes: blocknum~trannum  Transaction SegNo + offset

History Database – CouchDB extensions (future) To support rich queries against historical data, when using queryable database such as CouchDB, in addition to storing the historic key updates, also store the key values at that point in time. For example: chaincode1~key1~0000000000123~000000000012  Value at block123, tran12 chaincode1~key1~0000000000456~000000000007  Value to block456, tran7 Storing the historic key values will support rich queries against the data history, for example using a new API such as ExecuteQueryHistory(queryString string). Example rich queries: show assets that were at locationY show assets that have been owned by Alice Also, with a copy of the value in history database, if GetTransactionsForKey() has includeValues only, then we can return the values from the CouchDB history database rather than looking up the values from block storage. CouchDB will not have the txid to return, potentially we will add that to the CouchDB data wrapper, in addition to version, so that it will be available to return efficiently.

History Database - Other details History database is separate from state database, to provide isolation in terms of resources, performance, scalability, pluggability, etc Same guarantees of consistency as state database Use savepoints to ensure consistency with blockchain block storage Peer startup checks savepoints to ensure consistency after peer crash Automatically rebuilt when deleted (for example if it has gotten corrupted)