marlin 三角洲

Let me start by introducing two problems that I have dealt time and again with my experience with Apache Spark:

首先,我介绍一下我在Apache Spark上的经历反复解决的两个问题:

  1. Data “overwrite” on the same path causing data loss in case of Job Failure.在作业失败的情况下,同一路径上的数据“覆盖”会导致数据丢失。
  2. Updates in the data.数据更新。

Sometimes I solved above with Design changes, sometimes with the introduction of another layer like Aerospike, or sometimes by maintaining historical incremental data.

有时我通过设计更改解决了上述问题,有时通过引入了诸如Aerospike的另一层,或者有时通过维护历史增量数据来解决。

Maintaining historical data is mostly an immediate solution but I don’t really like dealing with historical incremental data if it’s not really required as(at least for me) it introduces the pain of backfill in case of failures which may be unlikely but inevitable.

维护历史数据通常是一个立即解决方案,但是如果不是真正需要历史增量数据,我真的不喜欢处理它,因为(至少对我来说)这会带来回填的痛苦,以防止发生故障(虽然这不太可能,但不可避免)。

The above two problems are “problems” because Apache Spark does not really support ACID. I know it was never Spark’s use case to work with transactions(hello, you can’t have everything) but sometimes, there might be a scenario(like my two problems above) where ACID compliance would have come in handy.

以上两个问题是“问题”,因为Apache Spark并不真正支持ACID。 我知道这绝不是Spark处理事务的用例(您好,您不能拥有所有东西),但是有时候,在某些情况下(如上述两个问题),ACID合规性会派上用场。

When I read about Delta Lake and its ACID compliance, I saw it as one of the possible solutions for my two problems. Please read on to find out how the two problems are related to ACID compliance failure and how delta lake can be seen as a savior?

当我阅读Delta Lake及其ACID合规性时,我将其视为解决我的两个问题的可能解决方案之一。 请继续阅读,以找出这两个问题与ACID合规性失败之间的关系以及如何将三角洲湖视为救星?

什么是三角洲湖? (What is Delta Lake?)

Delta Lake Documentation introduces Delta lake as:

Delta Lake文档将Delta Lake引入为:

Delta Lake is an open source storage layer that brings reliability to data lakes. Delta Lake provides ACID transactions, scalable metadata handling, and unifies streaming and batch data processing. Delta Lake runs on top of your existing data lake and is fully compatible with Apache Spark APIs.

Delta Lake是一个开源存储层 ,可为数据湖带来可靠性。 Delta Lake提供ACID事务,可伸缩的元数据处理,并统一流和批处理数据处理。 Delta Lake在您现有的数据湖之上运行,并且与Apache Spark API完全兼容。

Delta Lake key points:

三角洲湖重点:

  • Supports ACID支持ACID
  • Enables Time travel启用时间旅行
  • Enables UPSERT启用UPSERT

Spark如何使ACID失败? (How Spark fails ACID?)

Consider the following piece of code to remove duplicates from a dataset:

考虑以下代码,从数据集中删除重复项:

# Read from HDFSdf = spark.read.parquet("/path/on/hdfs") # Line 1# Remove duplicatesdf = df.distinct() # Line 2# Overwrite the datadf.cache() # Line 3df.write.parquet("/path/on/hdfs", mode="overwrite") # Line 4

For my spark application running above piece of code consider a scenario where it fails on Line 4, that is while writing the data. This may or may not lead to data loss. [Problem #1: As mentioned above].You can replicate the scenario, by creating a test dataset and kill the job when it’s in the Write stage.

对于在上述代码段上运行的我的spark应用程序,请考虑一种情况,即它在第4行上失败,即在写入数据时。 这可能会或可能不会导致数据丢失。 [问题1:如上所述]。您可以通过创建测试数据集来复制方案,并在处于Write阶段时取消该作业。

Let us try to understand ACID failure in spark with the above scenario.

让我们尝试了解上述情况下火花中的ACID故障。

ACID中的A代表原子性, (A in ACID stands for Atomicity,)

  • What is Atomicity: Either all changes take place or none, the system is never in halfway state.

    什么是原子性:要么所有更改都发生,要么全部不发生,系统永远不会处于中间状态。

  • How spark fails: While writing data, (at Line 4 above), if a failure occurs at a stage where old data is removed and new data is not yet written, data loss occurs. We have lost old data and we were not able to write new data due to job failure, atomicity fails. [It can vary according to file output committer used, please do read about File output committer to see how data writing takes place, the scenario I explained is for v2]

    火花如何失败:在写入数据时(在上面的第4行),如果在删除旧数据而尚未写入新数据的阶段发生故障,则会发生数据丢失。 我们丢失了旧数据,并且由于作业失败,原子性失败而无法写入新数据。 [根据使用的文件输出提交程序,它可能有所不同,请阅读有关文件输出提交程序的信息,以了解如何进行数据写入,我所说明的场景适用于v2]

ACID中的C代表一致性, (C in ACID stands for Consistency,)

  • What is Consistency: Data must be consistent and valid in the system at all times.

    什么是一致性 :数据必须始终在系统中保持一致和有效。

  • How Spark fails: As seen above, in the case of failure and data loss, we are left with invalid data in the system, consistency fails.

    Spark如何失败:如上所示,在失败和数据丢失的情况下,我们在系统中留有无效数据,一致性失败。

ACID中的I代表隔离, (I in ACID stands for Isolation,)

  • What is Isolation: Multiple transactions occur in isolation

    什么是隔离:多个事务是隔离发生的

  • How spark fails: Consider two jobs running in parallel, one as described above and another which is also using the same dataset, if one job overwrites the dataset while other is still using it, failure might happen, isolation fails.

    Spark如何失败:考虑两个并行运行的作业,一个如上所述,另一个使用相同的数据集,如果一个作业覆盖了数据集而另一个仍在使用它,则可能会发生故障,隔离失败。

ACID中的D代表耐久性, (D in ACID stands for Durability,)

  • What is Durability: Changes once made are never lost, even in the case of system failure.

    什么是耐久性:即使系统发生故障,一旦进行更改也不会丢失。

  • How spark might fail: Spark really doesn’t affect the durability, it is mainly governed by the storage layer, but since we are losing data in case of job failures, in my opinion, it is a durability failure.

    Spark 可能如何失败: Spark确实不会影响持久性,它主要由存储层控制,但是由于我们在工作失败的情况下会丢失数据,因此我认为这是持久性失败。

Delta Lake如何支持ACID? (How Delta Lake supports ACID?)

Delta lake maintains a delta log in the path where data is written. Delta Log maintains details like:

Delta Lake在写入数据的路径中维护一个delta日志。 Delta Log维护以下详细信息:

  • Metadata like

    像元数据

    - Paths added in the write operation.

    -在写操作中添加的路径。

    - Paths removed in the write operation.

    -在写操作中删除了路径。

    - Data size

    -数据大小

    - Changes in data

    -数据变化

  • Data Schema数据架构
  • Commit information like

    提交信息,例如

    - Number of output rows

    -输出行数

    - Output bytes

    -输出字节

    - Timestamp

    -时间戳

Sample log file in _delta_log_ directory created after some operations:

某些操作后在_delta_log_目录中创建的示例日志文件:

After successful execution, a log file is created in the _delta_log_ directory. The important thing to note is when you save your data as delta, no files once written are removed. The concept is similar to versioning.

成功执行后,将在_delta_log_目录中创建一个日志文件。 需要注意的重要一点是,当您将数据另存为增量时,写入后不会删除任何文件。 该概念类似于版本控制。

By keeping track of paths removed, added and other metadata information in the _delta_log_, Delta lake is ACID-compliant.

通过跟踪_delta_log_中路径的删除,添加和其他元数据信息,Delta Lake符合ACID。

Versioning enables time travel property of Delta Lake, which is, I can go back to any state of data because all this information is being maintained in _delta_log_.

版本控制启用了Delta Lake的时间旅行属性,即,由于所有这些信息都保存在_delta_log_中,因此我可以返回到任何数据状态。

Delta Lake如何解决上述两个问题? (How Delta Lake solves my two problems mentioned above?)

  • With the support for ACID, if my job fails during the “overwrite” operation, data is not lost, as changes won’t be committed to the log file of _delta_log_ directory. Also, since Delta Lake, does not remove old files in the “overwrite operation”, old state of my data is maintained and there is no data loss. (Yes, I have tested it)有了ACID的支持,如果我的工作在“覆盖”操作期间失败,则数据不会丢失,因为更改不会提交到_delta_log_目录的日志文件中。 另外,由于Delta Lake不会在“覆盖操作”中删除旧文件,因此我的数据保持了旧状态,并且没有数据丢失。 (是的,我已经测试过了)
  • Delta lake supports Update operation as mentioned above so it makes dealing with updates in data easier.Delta Lake支持如上所述的Update操作,因此使数据更新更容易。

Until next time,Ciao.

直到下次,Ciao。

翻译自: https://towardsdatascience.com/delta-lake-with-spark-what-and-why-6d08bef7b963

marlin 三角洲


http://www.taodudu.cc/news/show-997460.html

相关文章:

  • eda分析_EDA理论指南
  • 简·雅各布斯指数第二部分:测试
  • 抑郁症损伤神经细胞吗_使用神经网络探索COVID-19与抑郁症之间的联系
  • 如何开始使用任何类型的数据? - 第1部分
  • 机器学习图像源代码_使用带有代码的机器学习进行快速房地产图像分类
  • COVID-19和世界幸福报告数据告诉我们什么?
  • lisp语言是最好的语言_Lisp可能不是数据科学的最佳语言,但是我们仍然可以从中学到什么呢?...
  • python pca主成分_超越“经典” PCA:功能主成分分析(FPCA)应用于使用Python的时间序列...
  • 大数据平台构建_如何像产品一样构建数据平台
  • 时间序列预测 时间因果建模_时间序列建模以预测投资基金的回报
  • 贝塞尔修正_贝塞尔修正背后的推理:n-1
  • php amazon-s3_推荐亚马逊电影-一种协作方法
  • 简述yolo1-yolo3_使用YOLO框架进行对象检测的综合指南-第一部分
  • 数据库:存储过程_数据科学过程:摘要
  • cnn对网络数据预处理_CNN中的数据预处理和网络构建
  • 消解原理推理_什么是推理统计中的Z检验及其工作原理?
  • 大学生信息安全_给大学生的信息
  • 特斯拉最安全的车_特斯拉现在是最受欢迎的租车选择
  • ml dl el学习_DeepChem —在生命科学和化学信息学中使用ML和DL的框架
  • 用户参与度与活跃度的区别_用户参与度突然下降
  • 数据草拟:使您的团队热爱数据的研讨会
  • c++ 时间序列工具包_我的时间序列工具包
  • adobe 书签怎么设置_让我们设置一些规则…没有Adobe Analytics处理规则
  • 分类预测回归预测_我们应该如何汇总分类预测?
  • 神经网络推理_分析神经网络推理性能的新工具
  • 27个机器学习图表翻译_使用机器学习的信息图表信息组织
  • 面向Tableau开发人员的Python简要介绍(第4部分)
  • 探索感染了COVID-19的动物的数据
  • 已知两点坐标拾取怎么操作_已知的操作员学习-第4部分
  • lime 模型_使用LIME的糖尿病预测模型解释— OneZeroBlog

marlin 三角洲_带火花的三角洲湖:什么和为什么?相关推荐

  1. 感悟人生的伤感日志_带着眼泪去流浪

    感悟人生的伤感日志_带着眼泪去流浪 - 感悟人生的伤感日志_带着眼泪去流浪 眼泪里不但包含了许多悲哀和伤痕,还包括了埋怨.嫉妒和轻视.展示伤痕,是痛苦的-- 人生里有许多悲哀.人生里有许多伤痕. 这些 ...

  2. 最新酒桌小游戏喝酒小程序源码_带流量主源码下载

    2022最新酒桌小游戏喝酒小程序源码_带流量主 喝酒神器3.6,我修改增加了广告位,根据文档直接替换即可,原版本没有广告位 直接上传源码到开发者端即可 通过后改广告代码,然后关闭广告展示提交,通过后打 ...

  3. 2022最新酒桌小游戏喝酒小程序源码_带流量主

    2022最新酒桌小游戏喝酒小程序源码_带流量主 喝酒神器3.6,我修改增加了广告位,根据文档直接替换即可,原版本没有广告位 直接上传源码到开发者端即可 通过后改广告代码,然后关闭广告展示提交,通过后打 ...

  4. 2023新版 多功能去水印工具微信小程序源码_带流量主功能(已更新)

    简介: 2023新版 多功能去水印工具微信小程序源码_带流量主功能 自带去水印接口的多功能小程序 支持各大平台短视频去水印 支持保存封面,图集,标题等等 支持本地图片去水印 支持图片拼接 支持九宫格切 ...

  5. 笑话与趣图微信小程序源码_带广告流量主

    笑话与趣图微信小程序源码_带流量主-PHP文档类资源-CSDN下载这是一款以笑话和趣味图为主的一款微信小程序源码更多下载资源.学习资料请访问CSDN下载频道.https://download.csdn ...

  6. 羊了个羊游戏网站源码_带前后端源码,带教程

    羊了个羊游戏源码_带前后端源码_及配置教程说明 这是啥游戏?据悉,这是一款卡通背景的消除闯关游戏.玩家们需要点击上方卡牌,被选中的卡牌会下移到底部的木框中,框内最多可以储存7张卡牌,当有3张相同的卡牌 ...

  7. marlin 三角洲_三角洲湖泊和数据湖泊-入门

    marlin 三角洲 Data lakes are becoming adopted in more and more companies seeking for efficient storage ...

  8. winform point数组带数值_带你学够浪:Go语言基础系列 - 8分钟学复合类型

    对于一般的语言使用者来说 ,20% 的语言特性就能够满足 80% 的使用需求,剩下在使用中掌握.基于这一理论,Go 基础系列的文章不会刻意追求面面俱到,但该有知识点都会覆盖,目的是带你快跑赶上 Gol ...

  9. sql输出带颜色的字段_带你走进MySQL数据库(MySQL入门详细总结一)

    导读:关于MySQL用三篇文章带你进入MySQL的世界. 文章目录 1.MySQL 2.MySQL的使用 3.MySQL概述 4.导入数据 5.sql语句 1.查询 2.排序(升序,降序) 3.分组函 ...

最新文章

  1. PolarSSL 1.2.0 发布,SSL 加密库
  2. JS 使用html2canvas实现截图功能的问题记录和解决方案
  3. 数据结构源码笔记(C语言):快速排序
  4. 服务外包技术培训——后端开发技术栈分析(Java)
  5. linux socket使用情况 ss -s ss -t -a | cat /proc/net/socketstat
  6. XSS之xssprotect
  7. SAP CRM product customizing下载的第四个队列
  8. swift中文文档_Flutter 中文文档:使用 Packages
  9. Configuration property name ‘fdfs.thumbImage‘ is not valid---springcloud工作笔记163
  10. C语言易混淆关键词详解-const, static, extern, typedef, 声明
  11. mybatis-plus 从2.x到3.x升级指南
  12. Android Multimedia框架总结(二十三)MediaCodec补充及MediaMuxer引入(附案例)
  13. 请不要滥用SharedPreference
  14. python水仙花数的编程代码-Python 求“水仙花数”的方法和具体代码
  15. Java入门学习笔记——郝斌(三)线程
  16. 有没有安卓4.0的java模拟器_手机java模拟器apk下载
  17. 大数据学习——Hadoop本地模式搭建
  18. device or resource busy问题处理
  19. 某广告SDK流量加解密-响应
  20. html360搜索框代码,HTML 代码标签

热门文章

  1. SQL实现当前行等于前面两行数据之和
  2. springboot集成redis使用redis作为session报错ClassNotFoundException类RememberMeServices
  3. codeforces CF438D The Child and Sequence 线段树
  4. 什么情况不能办理房产抵押贷款 房产抵押贷能贷多少?
  5. Android成长日记-Android监听事件的方法
  6. 努力做一名认真踏实的工程师
  7. Centos6.4 本地yum源配置
  8. 优秀的SharePoint 2013开发工具有哪些(二)
  9. 【转】ORACLE中的子查询 ---OCP--047--46
  10. ActionScript 3.0 学习笔记三