2023-11-06 monetdb-事务-insert-delta缓存-分析

2023-11-06 16:28

本文主要是介绍2023-11-06 monetdb-事务-insert-delta缓存-分析,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

摘要:

monetdb在事务处理时, 会将数据写入delta缓存中, 然后在commit时将数据写入wal文件, 随后由控制器决定何时将wal中的数据真正的写入BAT列文件中.

本文从delta缓存入手, 分析monetdb在事务处理中的细节.

SQL:

DML:

create table t1 (a int);

事务DDL:

START TRANSACTION;
insert into t1 values (4);
COMMIT;

trace日志:

mserver启动后第一次执行insert:

ALGO     monetdb5/mal/mal_interpreter.c:716             runMALsequence       calling querylog.define
ALGO     monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.transaction_begin
ALGO     monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.exportOperationALGO     monetdb5/mal/mal_interpreter.c:716             runMALsequence       calling querylog.define
ALGO     monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.mvc
ALGO     monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.claim
ALGO     monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.append
IO_      gdk/gdk_bbp.c:3156                             getBBPdescriptor     load tmp_550
IO_      gdk/gdk_storage.c:637                          DESCload             DESCload: 05/550
IO_      gdk/gdk_storage.c:536                          GDKload              GDKload: name=05/550.tail, ext=, mode 1
IO_      gdk/gdk_storage.c:558                          GDKload              read(dst 0x7f01e8040cc0, n_expected 12, fd 9) = 12
ALGO     gdk/gdk_bat.c:1039                             BUNappendmulti       tmp_550#3@0[int]P appending 1 values
ALGO     monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.depend
ALGO     monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.affectedRowsALGO     monetdb5/mal/mal_interpreter.c:716             runMALsequence       calling querylog.define
ALGO     monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.transaction_commit
IO_      gdk/gdk_bbp.c:3156                             getBBPdescriptor     load tmp_551
IO_      gdk/gdk_storage.c:637                          DESCload             DESCload: 05/551
IO_      gdk/gdk_storage.c:536                          GDKload              GDKload: name=05/551.tail, ext=, mode 1
IO_      gdk/gdk_storage.c:558                          GDKload              read(dst 0x7f01e8037d30, n_expected 4, fd 9) = 4
ALGO     monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.exportOperation

mserver启动后第二次连续执行两次insert:

monetdb5/mal/mal_interpreter.c:716             runMALsequence       calling querylog.define
monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.transaction_begin
monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.exportOperationmonetdb5/mal/mal_interpreter.c:716             runMALsequence       calling querylog.define
monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.mvc
monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.claim
monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.append
gdk/gdk_bat.c:1039                             BUNappendmulti       tmp_550#4@0[int]P appending 1 values
monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.depend
monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.affectedRowsmonetdb5/mal/mal_interpreter.c:716             runMALsequence       calling querylog.define
monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.mvc
monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.claim
monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.append
gdk/gdk_bat.c:1039                             BUNappendmulti       tmp_550#5@0[int]P appending 1 values
monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.depend
monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.affectedRowsmonetdb5/mal/mal_interpreter.c:716             runMALsequence       calling querylog.define
monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.transaction_commit
monetdb5/mal/mal_interpreter.c:687             runMALsequence       calling sql.exportOperation

核心处理:

BUNappendmulti

#0  BUNappendmulti (b=0x1a366680, values=0x7f01e803c600, count=1, force=true) at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/gdk/gdk_bat.c:1028
#1  0x00007f0283fb03d6 in delta_append_val (tr=0x7f01e8004540, batp=0x7f027e1f51e8, id=7590, offset=6, i=0x7f01e803c600, cnt=1, storage_type=0x0, tt=6)at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/sql/storage/bat/bat_storage.c:2319
#2  0x00007f0283fb0688 in append_col_execute (tr=0x7f01e8004540, delta=0x7f027e1f51e8, id=7590, offset=6, offsets=0x0, incoming_data=0x7f01e803c600, cnt=1, tt=6, storage_type=0x0)at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/sql/storage/bat/bat_storage.c:2354
#3  0x00007f0283fb0969 in append_col (tr=0x7f01e8004540, c=0x1a571380, offset=6, offsets=0x0, data=0x7f01e803c600, cnt=1, tpe=6)at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/sql/storage/bat/bat_storage.c:2384
#4  0x00007f0283e38a3c in mvc_append_wrap (cntxt=0x237c610, mb=0x7f01e8035660, stk=0x7f01e803c4d0, pci=0x7f01e8045000)at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/sql/backends/monet5/sql.c:1842
#5  0x00007f0297637047 in runMALsequence (cntxt=0x237c610, mb=0x7f01e8035660, startpc=1, stoppc=0, stk=0x7f01e803c4d0, env=0x0, pcicaller=0x0)at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/monetdb5/mal/mal_interpreter.c:688
#6  0x00007f02976357be in runMAL (cntxt=0x237c610, mb=0x7f01e8035660, mbcaller=0x0, env=0x0) at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/monetdb5/mal/mal_interpreter.c:357
#7  0x00007f0283e5963b in SQLrun (c=0x237c610, m=0x7f01e80168d0) at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/sql/backends/monet5/sql_execute.c:259
#8  0x00007f0283e5af37 in SQLengineIntern (c=0x237c610, be=0x7f01e8036150) at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/sql/backends/monet5/sql_execute.c:709
#9  0x00007f0283e58505 in SQLengine (c=0x237c610) at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/sql/backends/monet5/sql_scenario.c:1358
#10 0x00007f02976568c0 in runPhase (c=0x237c610, phase=4) at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/monetdb5/mal/mal_scenario.c:453
#11 0x00007f0297656a2a in runScenarioBody (c=0x237c610, once=0) at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/monetdb5/mal/mal_scenario.c:479
#12 0x00007f0297656c36 in runScenario (c=0x237c610, once=0) at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/monetdb5/mal/mal_scenario.c:510
#13 0x00007f0297659048 in MSserveClient (c=0x237c610) at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/monetdb5/mal/mal_session.c:589
#14 0x00007f02976588c1 in MSscheduleClient (command=0x7f01e8000b70 '\333' <repeats 199 times>, <incomplete sequence \333>..., challenge=0x7f027e1f5ce3 "HJBNRi7c", fin=0x7f01e8002b90, fout=0x7f01f0003e20, protocol=PROTOCOL_9, blocksize=8190) at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/monetdb5/mal/mal_session.c:445
#15 0x00007f029771e232 in doChallenge (data=0x7f01f0000b70) at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/monetdb5/modules/mal/mal_mapi.c:222
#16 0x00007f0296fcf749 in THRstarter (a=0x7f01f0006310) at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/gdk/gdk_utils.c:1668
#17 0x00007f029704cb43 in thread_starter (arg=0x7f01f0006380) at /root/work/monetdb-dev/trunk/monetdb-sep2022_sp3_release/gdk/gdk_system.c:862
#18 0x00007f029658d1ca in start_thread () from /lib64/libpthread.so.0
#19 0x00007f02961f9e73 in clone () from /lib64/libc.so.6

这篇关于2023-11-06 monetdb-事务-insert-delta缓存-分析的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/357731

相关文章

Go标准库常见错误分析和解决办法

《Go标准库常见错误分析和解决办法》Go语言的标准库为开发者提供了丰富且高效的工具,涵盖了从网络编程到文件操作等各个方面,然而,标准库虽好,使用不当却可能适得其反,正所谓工欲善其事,必先利其器,本文将... 目录1. 使用了错误的time.Duration2. time.After导致的内存泄漏3. jsO

SpringKafka消息发布之KafkaTemplate与事务支持功能

《SpringKafka消息发布之KafkaTemplate与事务支持功能》通过本文介绍的基本用法、序列化选项、事务支持、错误处理和性能优化技术,开发者可以构建高效可靠的Kafka消息发布系统,事务支... 目录引言一、KafkaTemplate基础二、消息序列化三、事务支持机制四、错误处理与重试五、性能优

Spring事务中@Transactional注解不生效的原因分析与解决

《Spring事务中@Transactional注解不生效的原因分析与解决》在Spring框架中,@Transactional注解是管理数据库事务的核心方式,本文将深入分析事务自调用的底层原理,解释为... 目录1. 引言2. 事务自调用问题重现2.1 示例代码2.2 问题现象3. 为什么事务自调用会失效3

MySQL INSERT语句实现当记录不存在时插入的几种方法

《MySQLINSERT语句实现当记录不存在时插入的几种方法》MySQL的INSERT语句是用于向数据库表中插入新记录的关键命令,下面:本文主要介绍MySQLINSERT语句实现当记录不存在时... 目录使用 INSERT IGNORE使用 ON DUPLICATE KEY UPDATE使用 REPLACE

找不到Anaconda prompt终端的原因分析及解决方案

《找不到Anacondaprompt终端的原因分析及解决方案》因为anaconda还没有初始化,在安装anaconda的过程中,有一行是否要添加anaconda到菜单目录中,由于没有勾选,导致没有菜... 目录问题原因问http://www.chinasem.cn题解决安装了 Anaconda 却找不到 An

Spring定时任务只执行一次的原因分析与解决方案

《Spring定时任务只执行一次的原因分析与解决方案》在使用Spring的@Scheduled定时任务时,你是否遇到过任务只执行一次,后续不再触发的情况?这种情况可能由多种原因导致,如未启用调度、线程... 目录1. 问题背景2. Spring定时任务的基本用法3. 为什么定时任务只执行一次?3.1 未启用

Linux修改pip和conda缓存路径的几种方法

《Linux修改pip和conda缓存路径的几种方法》在Python生态中,pip和conda是两种常见的软件包管理工具,它们在安装、更新和卸载软件包时都会使用缓存来提高效率,适当地修改它们的缓存路径... 目录一、pip 和 conda 的缓存机制1. pip 的缓存机制默认缓存路径2. conda 的缓

C++ 各种map特点对比分析

《C++各种map特点对比分析》文章比较了C++中不同类型的map(如std::map,std::unordered_map,std::multimap,std::unordered_multima... 目录特点比较C++ 示例代码 ​​​​​​代码解释特点比较1. std::map底层实现:基于红黑

Redis解决缓存击穿问题的两种方法

《Redis解决缓存击穿问题的两种方法》缓存击穿问题也叫热点Key问题,就是⼀个被高并发访问并且缓存重建业务较复杂的key突然失效了,无数的请求访问会在瞬间给数据库带来巨大的冲击,本文给大家介绍了Re... 目录引言解决办法互斥锁(强一致,性能差)逻辑过期(高可用,性能优)设计逻辑过期时间引言缓存击穿:给

Spring、Spring Boot、Spring Cloud 的区别与联系分析

《Spring、SpringBoot、SpringCloud的区别与联系分析》Spring、SpringBoot和SpringCloud是Java开发中常用的框架,分别针对企业级应用开发、快速开... 目录1. Spring 框架2. Spring Boot3. Spring Cloud总结1. Sprin