Hive Does ACID. Owen O September Page 1. Hortonworks Inc. 2015

Similar documents
Where is Hadoop Going Next?

Programming Hadoop 5-day, instructor-led BD-106. MapReduce Overview. Hadoop Overview

Apache HBase. Crazy dances on the elephant back

Hive Development. (~15 minutes) Yongqiang He Software Engineer. Facebook Data Infrastructure Team

Complete Java Classes Hadoop Syllabus Contact No:

HareDB HBase Client Web Version USER MANUAL HAREDB TEAM

Integration of Apache Hive and HBase

Hadoop Ecosystem B Y R A H I M A.

Delivering Intelligence to Publishers Through Big Data

Workshop on Hadoop with Big Data

docs.hortonworks.com

Actian SQL in Hadoop Buyer s Guide

Hadoop Ecosystem Overview. CMSC 491 Hadoop-Based Distributed Computing Spring 2015 Adam Shook

Lambda Architecture. Near Real-Time Big Data Analytics Using Hadoop. January Website:

Hadoop Job Oriented Training Agenda

Impala: A Modern, Open-Source SQL Engine for Hadoop. Marcel Kornacker Cloudera, Inc.

Data storing and data access

Apache Sentry. Prasad Mujumdar

Lecture 10: HBase! Claudia Hauff (Web Information Systems)!

BIG DATA TECHNOLOGY. Hadoop Ecosystem

Apache Hadoop: Past, Present, and Future

Qsoft Inc

Apache Hadoop: The Pla/orm for Big Data. Amr Awadallah CTO, Founder, Cloudera, Inc.

Peers Techno log ies Pv t. L td. HADOOP

THE DEVELOPER GUIDE TO BUILDING STREAMING DATA APPLICATIONS

The Hadoop Eco System Shanghai Data Science Meetup

HBase Schema Design. NoSQL Ma4ers, Cologne, April Lars George Director EMEA Services

Trafodion Operational SQL-on-Hadoop

Architectural patterns for building real time applications with Apache HBase. Andrew Purtell Committer and PMC, Apache HBase

Chase Wu New Jersey Ins0tute of Technology

MySQL and Hadoop. Percona Live 2014 Chris Schneider

Introduction to Big Data Training

Using distributed technologies to analyze Big Data

Can the Elephants Handle the NoSQL Onslaught?

How to Choose Between Hadoop, NoSQL and RDBMS

ISSN: (Online) Volume 3, Issue 4, April 2015 International Journal of Advance Research in Computer Science and Management Studies

HADOOP. Revised 10/19/2015

Big Data and Hadoop. Module 1: Introduction to Big Data and Hadoop. Module 2: Hadoop Distributed File System. Module 3: MapReduce

Systems Infrastructure for Data Science. Web Science Group Uni Freiburg WS 2012/13

Big Data Technology Core Hadoop: HDFS-YARN Internals

Data processing goes big

Using RDBMS, NoSQL or Hadoop?

International Journal of Advancements in Research & Technology, Volume 3, Issue 2, February ISSN

ESS event: Big Data in Official Statistics. Antonino Virgillito, Istat

Big Data With Hadoop

Creating a universe on Hive with Hortonworks HDP 2.0

Constructing a Data Lake: Hadoop and Oracle Database United!

HADOOP ADMINISTATION AND DEVELOPMENT TRAINING CURRICULUM

Apache Spark 11/10/15. Context. Reminder. Context. What is Spark? A GrowingStack

SQL on NoSQL (and all of the data) With Apache Drill

Toad for Oracle 8.6 SQL Tuning

Cloudera Certified Developer for Apache Hadoop

Comparing SQL and NOSQL databases

Data storing and data access

Big Data Development CASSANDRA NoSQL Training - Workshop. March 13 to am to 5 pm HOTEL DUBAI GRAND DUBAI

Data Security in Hadoop

Hadoop: Embracing future hardware

Big Data Course Highlights

Infomatics. Big-Data and Hadoop Developer Training with Oracle WDP

Reusable Data Access Patterns

BIG DATA HADOOP TRAINING

Pro Apache Hadoop. Second Edition. Sameer Wadkar. Madhu Siddalingaiah

COURSE CONTENT Big Data and Hadoop Training

CitusDB Architecture for Real-Time Big Data

Big Data and Scripting Systems build on top of Hadoop

brief contents PART 1 BACKGROUND AND FUNDAMENTALS...1 PART 2 PART 3 BIG DATA PATTERNS PART 4 BEYOND MAPREDUCE...385

11/18/15 CS q Hadoop was not designed to migrate data from traditional relational databases to its HDFS. q This is where Hive comes in.

Hadoop in the Enterprise

Certified Big Data and Apache Hadoop Developer VS-1221

CSE 590: Special Topics Course ( Supercomputing ) Lecture 10 ( MapReduce& Hadoop)

David Dye. Extract, Transform, Load

HBase A Comprehensive Introduction. James Chin, Zikai Wang Monday, March 14, 2011 CS 227 (Topics in Database Management) CIT 367

Scaling Up 2 CSE 6242 / CX Duen Horng (Polo) Chau Georgia Tech. HBase, Hive

Spring,2015. Apache Hive BY NATIA MAMAIASHVILI, LASHA AMASHUKELI & ALEKO CHAKHVASHVILI SUPERVAIZOR: PROF. NODAR MOMTSELIDZE

Data Domain Profiling and Data Masking for Hadoop

Hadoop: The Definitive Guide

Building Scalable Big Data Infrastructure Using Open Source Software. Sam William

W I S E. SQL Server 2008/2008 R2 Advanced DBA Performance & WISE LTD.

Hadoop Distributed File System. Dhruba Borthakur Apache Hadoop Project Management Committee

Oracle s Big Data solutions. Roger Wullschleger. <Insert Picture Here>

Chapter 11 Map-Reduce, Hadoop, HDFS, Hbase, MongoDB, Apache HIVE, and Related

Apache HBase: the Hadoop Database

SAP HANA - Main Memory Technology: A Challenge for Development of Business Applications. Jürgen Primsch, SAP AG July 2011

Non-Stop for Apache HBase: Active-active region server clusters TECHNICAL BRIEF

Getting Started with Hadoop. Raanan Dagan Paul Tibaldi

Hadoop Introduction. Olivier Renault Solution Engineer - Hortonworks

Facebook: Cassandra. Smruti R. Sarangi. Department of Computer Science Indian Institute of Technology New Delhi, India. Overview Design Evaluation

Hive Interview Questions

EXPERIMENTATION. HARRISON CARRANZA School of Computer Science and Mathematics

ETL Process in Data Warehouse. G.Lakshmi Priya & Razia Sultana.A Assistant Professor/IT

Real-time Big Data Analytics with Storm

Cloudera Enterprise Reference Architecture for Google Cloud Platform Deployments

Upcoming Announcements

MS SQL Performance (Tuning) Best Practices:

Big Data Too Big To Ignore

Data Integrator Performance Optimization Guide

The Hadoop Distributed File System

Big Data Patterns. Ron Bodkin Founder and President, Think Big

[Type text] Week. National summer training program on. Big Data & Hadoop. Why big data & Hadoop is important?

Transcription:

Hive Does ACID Owen O Malley owen@hortonworks.com @owen_omalley September 2015 Hortonworks Inc. 2015 Page 1

History Hive only updated partitions INSERT...OVERWRITE rewrote an entire partition Forced daily or even hourly partitions Could add files to partition directory, but no file compaction What about concurrent readers? Ok for inserts, but overwrite caused races There is a zookeeper lock manager, but No way to delete or update rows No INSERT INTO T VALUES Breaks some tools Hortonworks Inc. 2015 Page 2

Why is ACID Critical? Hadoop and Hive have always Worked without ACID Perceived as tradeoff for performance But, your data isn t static It changes daily, hourly, or faster Ad hoc solutions require a lot of work Managing change makes the user s life better Hortonworks Inc. 2015 Page 3

Use Cases NOT OLTP!!! Updating a Dimension Table Changing a customer s address Delete Old Records Remove records for compliance Update/Restate Large Fact Tables Fix problems after they are in the warehouse Streaming Data Ingest A continual stream of data coming in Typically from Flume or Storm NOT OLTP!!! Hortonworks Inc. 2015 Page 4

New SQL in Hive 0.14 New DML INSERT INTO T VALUES(1, fred,...); UPDATE T SET (x = 5[,...]) WHERE... DELETE FROM T WHERE... Supports partitioned and non-partitioned tables, WHERE clause can specify partition but not required Restrictions Table must have format that extends AcidInputFormat currently ORC work started on Parquet (HIVE-8123) Table must be bucketed and not sorted can use 1 bucket but this will restrict write parallelism Table must be marked transactional create table T(...) clustered by (a) into 2 buckets stored as orc TBLPROPERTIES ('transactional'='true'); Hortonworks Inc. 2015 Page 5

Design HDFS Does Not Allow Arbitrary Writes Store changes as delta files Stitched together by client on read Writes get a Transaction ID Sequentially assigned by Metastore Reads get Committed Transactions Provides snapshot consistency No locks required Provide a snapshot of data from start of query Hortonworks Inc. 2015 Page 6

Why Not HBase? Good Handles compactions for us Already has similar data model with LSM Bad No cross row transactions Would require us to write a transaction manager over HBase, doable, but not less work Hfile is column family based rather than columnar HBase focused on point lookups and range scans Warehousing requires full scans Hortonworks Inc. 2015 Page 7

Stitching Buckets Together Hortonworks Inc. 2015 Page 8

HDFS Layout Partition locations remain unchanged Still warehouse/$db/$tbl/$part Bucket Files Structured By Transactions Base files $part/base_$tid/bucket_* Delta files $part/delta_$tid_$tid/bucket_* Hortonworks Inc. 2015 Page 9

Input and Output Formats Created new AcidInput/OutputFormat Unique key is transaction, bucket, row Reader returns correct version of row based on transaction state Also Added Raw API for Compactor Provides previous events as well ORC implements new API Extends records with change metadata Add operation (d, u, i), transaction and key Hortonworks Inc. 2015 Page 10

Distributing the Work Need to split buckets for MapReduce Need to split base and deltas the same way Use key ranges Use indexes Hortonworks Inc. 2015 Page 11

Transaction Manager Existing lock managers In memory - not durable ZooKeeper - requires additional components to install, administer, etc. Locks need to be integrated with transactions commit/rollback must atomically release locks We sort of have this database lying around which has ACID characteristics (metastore) Transactions and locks stored in metastore Uses metastore DB to provide unique, ascending ids for transactions and locks Hortonworks Inc. 2015 Page 12

Transaction Model In Hive 0.14 DML statements are auto-commit Working on adding BEGIN, COMMIT, ROLLBACK Snapshot isolation Reader will see consistent data for the duration of his/ her query May extend to other isolation levels in the future Current transactions can be displayed using new SHOW TRANSACTIONS statement Hortonworks Inc. 2015 Page 13

Locking Model Three types of locks shared semi-shared (can co-exist with shared, but not other semi-shared) exclusive Operations require different locks SELECT, INSERT shared UPDATE, DELETE semi-shared DROP, INSERT OVERWRITE exclusive Hortonworks Inc. 2015 Page 14

Compactor Each transaction (or batch of transactions in streaming ingest) creates a new delta file Too many files = NameNode! Need a way to Collect many deltas into one delta minor compaction Rewrite base and delta to new base major compaction Hortonworks Inc. 2015 Page 15

Minor Compaction Run when there are 10 or more deltas (configurable) Results in base + 1 delta /hive/warehouse/purchaselog/ds=201403311000/base_0028000 /hive/warehouse/purchaselog/ds=201403311000/delta_0028001_0028100 /hive/warehouse/purchaselog/ds=201403311000/delta_0028101_0028200 /hive/warehouse/purchaselog/ds=201403311000/delta_0028201_0028300 /hive/warehouse/purchaselog/ds=201403311000/delta_0028301_0028400 /hive/warehouse/purchaselog/ds=201403311000/delta_0028401_0028500 /hive/warehouse/purchaselog/ds=201403311000/base_0028000 /hive/warehouse/purchaselog/ds=201403311000/delta_0028001_0028500 Hortonworks Inc. 2015 Page 16

Major Compaction Run when deltas are 10% the size of base (configurable) Results in new base /hive/warehouse/purchaselog/ds=201403311000/base_0028000 /hive/warehouse/purchaselog/ds=201403311000/delta_0028001_0028100 /hive/warehouse/purchaselog/ds=201403311000/delta_0028101_0028200 /hive/warehouse/purchaselog/ds=201403311000/delta_0028201_0028300 /hive/warehouse/purchaselog/ds=201403311000/delta_0028301_0028400 /hive/warehouse/purchaselog/ds=201403311000/delta_0028401_0028500 /hive/warehouse/purchaselog/ds=201403311000/base_0028500 Hortonworks Inc. 2015 Page 17

Compactor Continued Metastore thrift server will schedule and execute compactions No need for user to schedule User can initiate via ALTER TABLE COMPACT statement No locking required, compactions run at same time as select and DML Compactor aware of readers, does not remove old files until readers have finished with them Current compactions can be viewed using new SHOW COMPACTIONS statement Hortonworks Inc. 2015 Page 18

Application: Streaming Ingest Data is flowing in from generators in a stream Without this, you have to add it to Hive in batches, often every hour Thus your users have to wait an hour before they can see their data New interface in hive.hcatalog.streaming lets applications write small batches of records and commit them Users can now see data within a few seconds of it arriving from the data generators Available for Apache Flume in HDP 2.1 and Storm in HDP 2.2 Hortonworks Inc. 2015 Page 19

Phases of Development Hive 0.13 Transaction and new lock manager ORC file support Automatic and manual compaction Snapshot isolation Streaming ingest via Flume Hive 0.14 INSERT VALUES, UPDATE, DELETE Hive 1.2 Add support for only some columns in insert (HIVE-9481, will be in Hive 1.2) INSERT into T (a, b) select c, d from U; Future (all speculative based on user feedback) MERGE Integration with HCatalog Versioned or point in time queries Additional isolation levels such as dirty read or read committed Hortonworks Inc. 2015 Page 20

Current Work Multi-statement transactions BEGIN, COMMIT, ROLLBACK (HIVE-9675) Add support for update/delete in streaming ingest (HIVE-10165) Add support for Parquet files (HIVE-8123) Hortonworks Inc. 2015 Page 21

Next: MERGE Standard SQL, added 2003 Allows upserts Use case: bring in batch from transactinal/front end systesm Apply as insert or updates (as appropriate) in one read/write pass Hortonworks Inc. 2015 Page 22

What Next? Better performance In Tez not doing split combination efficiently in delta only case (fixed in Tez 0.7) Predicate push down not applied to deltas Better usability Remove requirements for bucketing Remove need to mark table transactional Hortonworks Inc. 2015 Page 23

Conclusion JIRA: HIVE-5317 Adds ACID semantics to Hive Uses SQL standard commands INSERT, UPDATE, DELETE Provides scalable read and write access Hortonworks Inc. 2015 Page 24

Thank You! Hortonworks Inc. 2015 Page 25