mysql8 sql语法错误,错误信息是怎么通过网络发送给客户端的,C++源码展示
在 MySQL 8 中,错误信息通过网络发送给客户端的过程涉及多个步骤,主要包括错误信息的生成、格式化、以及通过网络协议(如 TCP/IP)将错误信息发送给客户端。以下是详细的流程和相关代码分析:
1. 错误信息的生成
当 MySQL 服务器遇到错误时,会调用 my_error
函数来生成错误信息。my_error
函数会根据错误编号(nr
)和格式化参数(MyFlags
)生成具体的错误信息。
my_error
函数
cpp
void my_error(int nr, myf MyFlags, ...) {const char *format;char ebuff[ERRMSGSIZE];DBUG_TRACE;DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno));if (!(format = my_get_err_msg(nr)))(void)snprintf(ebuff, sizeof(ebuff), "Unknown error %d", nr);else {va_list args;va_start(args, MyFlags);(void)vsnprintf(ebuff, sizeof(ebuff), format, args);va_end(args);}/*Since this function is an error function, it will frequently be givenvalues that are too long (and thus truncated on byte boundaries,not code point or grapheme boundaries), values that are binary, etc.. Go through and replace every malformed UTF-8 byte with a question mark,so that the result is safe to send to the client and makes sense to readfor the user.*/for (char *ptr = ebuff, *end = ebuff + strlen(ebuff); ptr != end;) {my_wc_t ignored;int len = my_mb_wc_utf8mb4(&ignored, pointer_cast<const uchar *>(ptr),pointer_cast<const uchar *>(end));if (len > 0) {ptr += len;} else {*ptr++ = '?';}}(*error_handler_hook)(nr, ebuff, MyFlags);
}
2. 错误信息的处理
my_error
函数会调用 error_handler_hook
,这是一个全局变量,指向处理错误信息的函数。在 MySQL 服务器中,error_handler_hook
通常被设置为 my_message_sql
函数。
my_message_sql
函数
cpp
void my_message_sql(uint error, const char *str, myf MyFlags) {THD *thd = current_thd;DBUG_TRACE;DBUG_PRINT("error", ("error: %u message: '%s'", error, str));assert(str != nullptr);if (error == 0) {/* At least, prevent new abuse ... */assert(strncmp(str, "MyISAM table", 12) == 0);error = ER_UNKNOWN_ERROR;}if (thd) {(void)thd->raise_condition(error, nullptr, Sql_condition::SL_ERROR, str,MyFlags & ME_FATALERROR);}if (MyFlags & ME_ERRORLOG) {if (error < ER_SERVER_RANGE_START) {LogEvent().type(LOG_TYPE_ERROR).prio(ERROR_LEVEL).errcode(ER_ERROR_INFO_FROM_DA).lookup(ER_ERROR_INFO_FROM_DA, error, str);} else {LogEvent().type(LOG_TYPE_ERROR).prio(ERROR_LEVEL).errcode(error).verbatim(str);}} else if (!thd) {LogEvent().type(LOG_TYPE_ERROR).subsys(LOG_SUBSYSTEM_TAG).prio(ERROR_LEVEL).errcode((error < ER_SERVER_RANGE_START)? ER_SERVER_NO_SESSION_TO_SEND_TO: error).lookup(ER_SERVER_NO_SESSION_TO_SEND_TO, error, str);}
}
3. 错误信息发送给客户端
在 my_message_sql
函数中,如果存在一个连接的客户端(thd
不为 nullptr
),会调用 thd->raise_condition
方法来处理错误信息。raise_condition
方法会将错误信息发送给客户端。
C++源码
##
int mysqld_main(int argc, char **argv) {
error_handler_hook = my_message_sql;
}
##
##
/**Fill in and print a previously registered error message.@noteGoes through the (sole) function registered in error_handler_hook@param nr error number@param MyFlags Flags@param ... variable list matching that error format string
*/void my_error(int nr, myf MyFlags, ...) {const char *format;char ebuff[ERRMSGSIZE];DBUG_TRACE;DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno));if (!(format = my_get_err_msg(nr)))(void)snprintf(ebuff, sizeof(ebuff), "Unknown error %d", nr);else {va_list args;va_start(args, MyFlags);(void)vsnprintf(ebuff, sizeof(ebuff), format, args);va_end(args);}/*Since this function is an error function, it will frequently be givenvalues that are too long (and thus truncated on byte boundaries,not code point or grapheme boundaries), values that are binary, etc..Go through and replace every malformed UTF-8 byte with a question mark,so that the result is safe to send to the client and makes sense to readfor the user.*/for (char *ptr = ebuff, *end = ebuff + strlen(ebuff); ptr != end;) {my_wc_t ignored;int len = my_mb_wc_utf8mb4(&ignored, pointer_cast<const uchar *>(ptr),pointer_cast<const uchar *>(end));if (len > 0) {ptr += len;} else {*ptr++ = '?';}}(*error_handler_hook)(nr, ebuff, MyFlags);
}
##
/**All global error messages are sent here where the first one is storedfor the client.
*/
/* ARGSUSED */
extern "C" void my_message_sql(uint error, const char *str, myf MyFlags);void my_message_sql(uint error, const char *str, myf MyFlags) {THD *thd = current_thd;DBUG_TRACE;DBUG_PRINT("error", ("error: %u message: '%s'", error, str));assert(str != nullptr);/*An error should have a valid error number (!= 0), so it can be caughtin stored procedures by SQL exception handlers.Calling my_error() with error == 0 is a bug.Remaining known places to fix:- storage/myisam/mi_create.c, my_printf_error()TODO:assert(error != 0);*/if (error == 0) {/* At least, prevent new abuse ... */assert(strncmp(str, "MyISAM table", 12) == 0);error = ER_UNKNOWN_ERROR;}/* Caller wishes to inform client, and one is attached. */if (thd) {(void)thd->raise_condition(error, nullptr, Sql_condition::SL_ERROR, str,MyFlags & ME_FATALERROR);/*Now for an argument check.We're asserting after rather than before raising thecondition to make the culprit easier to track down.Messages intended for the error-log are in the rangestarting at ER_SERVER_RANGE_START (error_code 10,000);messages intended for sending to a client are in therange below ER_SERVER_RANGE_START. If a message is tobe sent to both a client and the error log, it mustbe added twice (once in each range), and two separatecalls (e.g. my_error() and LogErr()) must be added tothe code.Only error-codes from the client range should be seenin this if(). If your patch asserts here, one of twothings probably happened:- You added a new message to messages_to_error_log.txt:The message was added to the server range, but codewas added that tries to send the message to a client(my_error(), push_warning_printf(), etc.).=> Move the new message to messages_to_clients.txt.The copied message should be added at the end ofthe range for the lowest server version you're addingthe message to.Rebuild the server; rerun your test.- You used an existing message:The existing message is intended for use withthe error-log (it appears in messages_to_error_log.txt),but the new code tries to send it to a client (my_error(),push_warning_printf(), etc.).=> Copy the existing message to messages_to_clients.txt.- The copied message should be added at the end ofthe range for the lowest server version you're addingthe message to.- The copied message will need its own symbol;if in doubt, call the copy of ER_EXAMPLE_MESSAGEER_DA_EXAMPLE_MESSAGE (as this version is for usewith the diagnostics area).Then make sure that your new code referencesthis new symbol when it sends the messageto a client.Rebuild the server; rerun your test.We'll assert this here (rather than in raise_condition) asSQL's SIGNAL command also calls raise_condition, and SIGNALis currently allowed to set any error-code (regardless ofrange). SIGNALing an error-code from the error-log rangewill not result in writing to that log to prevent abuse.*/assert(error < ER_SERVER_RANGE_START);}/* When simulating OOM, skip writing to error log to avoid mtr errors */DBUG_EXECUTE_IF("simulate_out_of_memory", return;);/*Caller wishes to send to both the client and the error-log.This is legacy behaviour that is no longer legal as errors flaggedto a client and those sent to the error-log are in differentnumeric ranges now. If you own code that does this, see aboutupdating it by splitting it into two calls, one sending statusto the client, the other sending it to the error-log usingLogErr() and friends.*/if (MyFlags & ME_ERRORLOG) {/*We've removed most uses of ME_ERRORLOG in the server.This leaves three possible cases, in which we'll rewritethe error-code from one in the client-range to one inthe error-log range here:- EE_OUTOFMEMORY: Correct to ER_SERVER_OUT_OF_RESOURCES somysys can remain logger-agnostic.- HA_* range: Correct to catch-all ER_SERVER_HANDLER_ERROR.- otherwise: Flag as using info from the diagnostics area(ER_ERROR_INFO_FROM_DA). This is a failsafe;if your code triggers it, your code is probablywrong.*/if ((error == EE_OUTOFMEMORY) || (error == HA_ERR_OUT_OF_MEM))error = ER_SERVER_OUT_OF_RESOURCES;else if (error <= HA_ERR_LAST)error = ER_SERVER_HANDLER_ERROR;if (error < ER_SERVER_RANGE_START)LogEvent().type(LOG_TYPE_ERROR).prio(ERROR_LEVEL).errcode(ER_ERROR_INFO_FROM_DA).lookup(ER_ERROR_INFO_FROM_DA, error, str);elseLogEvent().type(LOG_TYPE_ERROR).prio(ERROR_LEVEL).errcode(error).verbatim(str);/*This is no longer supported behaviour except for the casesoutlined above, so flag anything else in debug builds!(We're bailing after rather than before printing to make theculprit easier to track down.)*/assert((error == ER_FEATURE_NOT_AVAILABLE) ||(error >= ER_SERVER_RANGE_START));}/*Caller wishes to send to client, but none is attached, so we sendto error-log instead.*/else if (!thd) {LogEvent().type(LOG_TYPE_ERROR).subsys(LOG_SUBSYSTEM_TAG).prio(ERROR_LEVEL).errcode((error < ER_SERVER_RANGE_START)? ER_SERVER_NO_SESSION_TO_SEND_TO: error).lookup(ER_SERVER_NO_SESSION_TO_SEND_TO, error, str);}
}
##gdb调用栈
#0 my_message_sql (error=1118,str=0x71f16e5fa830 "Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs", MyFlags=0) at /home/yym/mysql8/mysql-8.1.0/sql/mysqld.cc:3830
#1 0x00005f5a64be63bc in my_error (nr=1118, MyFlags=0) at /home/yym/mysql8/mysql-8.1.0/mysys/my_error.cc:249
#2 0x00005f5a63444e00 in mysql_prepare_create_table (thd=0x71f078000f10, error_schema_name=0x71f0783d2018 "grey", error_table_name=0x71f0783a1010 "o2o_hot_marketing_test",create_info=0x71f16e5fc2a0, alter_info=0x71f16e5fc3e0, file=0x71f0784426f0, is_partitioned=false, key_info_buffer=0x71f16e5fb470, key_count=0x71f16e5fb468,fk_key_info_buffer=0x71f16e5fb450, fk_key_count=0x71f16e5fb44c, existing_fks=0x0, existing_fks_count=0, existing_fks_table=0x0, fk_max_generated_name_number=0,select_field_count=0, find_parent_keys=true) at /home/yym/mysql8/mysql-8.1.0/sql/sql_table.cc:8349
#3 0x00005f5a63446fa2 in create_table_impl (thd=0x71f078000f10, schema=..., db=0x71f0783d2018 "grey", table_name=0x71f0783a1010 "o2o_hot_marketing_test",error_table_name=0x71f0783a1010 "o2o_hot_marketing_test", path=0x71f16e5fb550 "./grey/o2o_hot_marketing_test", create_info=0x71f16e5fc2a0, alter_info=0x71f16e5fc3e0,internal_tmp_table=false, select_field_count=0, find_parent_keys=true, no_ha_table=false, do_not_store_in_dd=false, is_trans=0x71f16e5fb7d7, key_info=0x71f16e5fb470,key_count=0x71f16e5fb468, keys_onoff=Alter_info::ENABLE, fk_key_info=0x71f16e5fb450, fk_key_count=0x71f16e5fb44c, existing_fk_info=0x0, existing_fk_count=0,existing_fk_table=0x0, fk_max_generated_name_number=0, table_def=0x71f16e5fb458, post_ddl_ht=0x71f16e5fb7e0) at /home/yym/mysql8/mysql-8.1.0/sql/sql_table.cc:8916
#4 0x00005f5a6344835d in mysql_create_table_no_lock (thd=0x71f078000f10, db=0x71f0783d2018 "grey", table_name=0x71f0783a1010 "o2o_hot_marketing_test",create_info=0x71f16e5fc2a0, alter_info=0x71f16e5fc3e0, select_field_count=0, find_parent_keys=true, is_trans=0x71f16e5fb7d7, post_ddl_ht=0x71f16e5fb7e0)at /home/yym/mysql8/mysql-8.1.0/sql/sql_table.cc:9231
#5 0x00005f5a6344bf2d in mysql_create_table (thd=0x71f078000f10, create_table=0x71f0783d19c0, create_info=0x71f16e5fc2a0, alter_info=0x71f16e5fc3e0)at /home/yym/mysql8/mysql-8.1.0/sql/sql_table.cc:10148
#6 0x00005f5a63b44239 in Sql_cmd_create_table::execute (this=0x71f0783d3508, thd=0x71f078000f10) at /home/yym/mysql8/mysql-8.1.0/sql/sql_cmd_ddl_table.cc:435
#7 0x00005f5a63366fbb in mysql_execute_command (thd=0x71f078000f10, first_level=true) at /home/yym/mysql8/mysql-8.1.0/sql/sql_parse.cc:3736
#8 0x00005f5a6336ccb3 in dispatch_sql_command (thd=0x71f078000f10, parser_state=0x71f16e5fd9f0) at /home/yym/mysql8/mysql-8.1.0/sql/sql_parse.cc:5447
#9 0x00005f5a633620d7 in dispatch_command (thd=0x71f078000f10, com_data=0x71f16e5fe340, command=COM_QUERY) at /home/yym/mysql8/mysql-8.1.0/sql/sql_parse.cc:2112
#10 0x00005f5a6335ff77 in do_command (thd=0x71f078000f10) at /home/yym/mysql8/mysql-8.1.0/sql/sql_parse.cc:1459
#11 0x00005f5a635b7835 in handle_connection (arg=0x5f5a6c557d70) at /home/yym/mysql8/mysql-8.1.0/sql/conn_handler/connection_handler_per_thread.cc:303
#12 0x00005f5a654f6bdc in pfs_spawn_thread (arg=0x5f5a6c52c670) at /home/yym/mysql8/mysql-8.1.0/storage/perfschema/pfs.cc:3043
#13 0x000071f17d494ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#14 0x000071f17d526850 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
##gdb调用栈
(gdb) bt
#0 Protocol_classic::send_error (this=0x71f0784347c0, sql_errno=1118,err_msg=0x71f078003960 "Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs", sql_state=0x71f078003b60 "42000") at /home/yym/mysql8/mysql-8.1.0/sql/protocol_classic.cc:1344
#1 0x00005f5a63263b3d in THD::send_statement_status (this=0x71f078000f10) at /home/yym/mysql8/mysql-8.1.0/sql/sql_class.cc:2904
#2 0x00005f5a6336379e in dispatch_command (thd=0x71f078000f10, com_data=0x71f16e5fe340, command=COM_QUERY) at /home/yym/mysql8/mysql-8.1.0/sql/sql_parse.cc:2501
#3 0x00005f5a6335ff77 in do_command (thd=0x71f078000f10) at /home/yym/mysql8/mysql-8.1.0/sql/sql_parse.cc:1459
#4 0x00005f5a635b7835 in handle_connection (arg=0x5f5a6c557d70) at /home/yym/mysql8/mysql-8.1.0/sql/conn_handler/connection_handler_per_thread.cc:303
#5 0x00005f5a654f6bdc in pfs_spawn_thread (arg=0x5f5a6c52c670) at /home/yym/mysql8/mysql-8.1.0/storage/perfschema/pfs.cc:3043
#6 0x000071f17d494ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#7 0x000071f17d526850 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
##gdb调用栈网络发送sql错误信息
(gdb) bt
#0 net_write_buff (net=0x71f078002d48,packet=0x71f16e5fd500 "^\004#42000Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLO"..., len=202) at /home/yym/mysql8/mysql-8.1.0/sql-common/net_serv.cc:937
#1 0x00005f5a635883ac in net_write_command (net=0x71f078002d48, command=255 '\377', header=0x5f5a664abad0 "", head_len=0,packet=0x71f16e5fd500 "^\004#42000Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLO"..., len=202) at /home/yym/mysql8/mysql-8.1.0/sql-common/net_serv.cc:907
#2 0x00005f5a63abb524 in net_send_error_packet (net=0x71f078002d48, sql_errno=1118,err=0x71f078003960 "Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs", sqlstate=0x71f078003b60 "42000", bootstrap=false, client_capabilities=2147656357,character_set_results=0x5f5a6867d520 <my_charset_utf8mb3_general_ci>) at /home/yym/mysql8/mysql-8.1.0/sql/protocol_classic.cc:1236
#3 0x00005f5a63abb31d in net_send_error_packet (thd=0x71f078000f10, sql_errno=1118,err=0x71f078003960 "Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs", sqlstate=0x71f078003b60 "42000") at /home/yym/mysql8/mysql-8.1.0/sql/protocol_classic.cc:1177
#4 0x00005f5a63abb965 in Protocol_classic::send_error (this=0x71f0784347c0, sql_errno=1118,err_msg=0x71f078003960 "Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs", sql_state=0x71f078003b60 "42000") at /home/yym/mysql8/mysql-8.1.0/sql/protocol_classic.cc:1347
#5 0x00005f5a63263b3d in THD::send_statement_status (this=0x71f078000f10) at /home/yym/mysql8/mysql-8.1.0/sql/sql_class.cc:2904
#6 0x00005f5a6336379e in dispatch_command (thd=0x71f078000f10, com_data=0x71f16e5fe340, command=COM_QUERY) at /home/yym/mysql8/mysql-8.1.0/sql/sql_parse.cc:2501
#7 0x00005f5a6335ff77 in do_command (thd=0x71f078000f10) at /home/yym/mysql8/mysql-8.1.0/sql/sql_parse.cc:1459
#8 0x00005f5a635b7835 in handle_connection (arg=0x5f5a6c557d70) at /home/yym/mysql8/mysql-8.1.0/sql/conn_handler/connection_handler_per_thread.cc:303
#9 0x00005f5a654f6bdc in pfs_spawn_thread (arg=0x5f5a6c52c670) at /home/yym/mysql8/mysql-8.1.0/storage/perfschema/pfs.cc:3043
#10 0x000071f17d494ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#11 0x000071f17d526850 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
相关文章:
mysql8 sql语法错误,错误信息是怎么通过网络发送给客户端的,C++源码展示
在 MySQL 8 中,错误信息通过网络发送给客户端的过程涉及多个步骤,主要包括错误信息的生成、格式化、以及通过网络协议(如 TCP/IP)将错误信息发送给客户端。以下是详细的流程和相关代码分析: 1. 错误信息的生成 当 My…...
人工智能D* Lite 算法-动态障碍物处理、多步预测和启发式函数优化
在智能驾驶领域,D* Lite 算法是一种高效的动态路径规划算法,适用于处理环境变化时的路径重规划问题。以下将为你展示 D* Lite 算法的高级用法,包含动态障碍物处理、多步预测和启发式函数优化等方面的代码实现。 代码实现 import heapq impo…...
【学术投稿】第五届计算机网络安全与软件工程(CNSSE 2025)
重要信息 官网:www.cnsse.org 时间:2025年2月21-23日 地点:中国-青岛 简介 第五届计算机网络安全与软件工程(CNSSE 2025)将于2025年2月21-23日在中国-青岛举行。CNSSE 2025专注于计算机网络安全、软件工程、信号处…...
spring学习(spring 配置文件详解)
一 了解如何创建基本的spring 配置文件 步骤 1 导入 spring-context 依赖 <!-- https://mvnrepository.com/artifact/org.springframework/spring-context --><dependency><groupId>org.springframework</groupId><artifactId>spring-context&l…...
创建一个javaWeb Project
文章目录 前言一、eclipse创建web工程二、web.xmlservlet.xml< mvc:annotation-driven/ > Spring MVC 驱动< context:component - scan >:扫描< bean > ... < /bean >< import > config/beans.xml beans.xmlmybatis.xml 前言 javaWe…...
大模型推理——MLA实现方案
1.整体流程 先上一张图来整体理解下MLA的计算过程 2.实现代码 import math import torch import torch.nn as nn# rms归一化 class RMSNorm(nn.Module):""""""def __init__(self, hidden_size, eps1e-6):super().__init__()self.weight nn.Pa…...
洛谷网站: P3029 [USACO11NOV] Cow Lineup S 题解
题目传送门: P3029 [USACO11NOV] Cow Lineup S - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 前言: 这道题的核心问题是在一条直线上分布着不同品种的牛,要找出一个连续区间,使得这个区间内包含所有不同品种的牛,…...
DeepSeek-R1 云环境搭建部署流程
DeepSeek横空出世,在国际AI圈备受关注,作为个人开发者,AI的应用可以有效地提高个人开发效率。除此之外,DeepSeek的思考过程、思考能力是开放的,这对我们对结果调优有很好的帮助效果。 DeepSeek是一个基于人工智能技术…...
【Go语言快速上手】第二部分:Go语言进阶
文章目录 并发编程goroutine:创建和调度 goroutinechannel:无缓冲 channel、有缓冲 channel、select 语句无缓冲 channel有缓冲 channelselect 语句 sync 包:Mutex、RWMutex、WaitGroup 等同步原语Mutex:互斥锁RWMutex:…...
自定义多功能输入对话框:基于 Qt 打造灵活交互界面
一、引言 在使用 Qt 进行应用程序开发时,我们经常需要与用户进行交互,获取他们输入的各种信息。QInputDialog 是 Qt 提供的一个便捷工具,可用于简单的输入场景,但当需求变得复杂,需要支持更多类型的输入控件࿰…...
计算机毕业设计SparkStreaming+Kafka广告推荐系统 广告预测 广告数据分析可视化 广告爬虫 大数据毕业设计 深度学习 机器学习
温馨提示:文末有 CSDN 平台官方提供的学长联系方式的名片! 温馨提示:文末有 CSDN 平台官方提供的学长联系方式的名片! 温馨提示:文末有 CSDN 平台官方提供的学长联系方式的名片! 作者简介:Java领…...
企业FTP替代升级,实现传输大文件提升100倍!
随着信息技术的飞速发展,网络安全环境也变得越来越复杂。在这种背景下,传统的FTP(文件传输协议)已经很难满足现代企业对文件传输的需求了。FTP虽然用起来简单,但它的局限性和安全漏洞让它在面对高效、安全的数据交换时…...
盘姬工具箱:完全免费的电脑工具箱
今天给大家介绍一个非常好用的系统工具箱,里面内含100多个工具,完全免费使用,而且没有广告,非常的棒。 盘姬工具箱:完全免费的电脑工具箱 盘姬工具箱是一款完全免费的电脑工具箱,功能丰富且实用。软件下载并…...
【个人开发】macbook m1 Lora微调qwen大模型
本项目参考网上各类教程整理而成,为个人学习记录。 项目github源码地址:Lora微调大模型 项目中微调模型为:qwen/Qwen1.5-4B-Chat。 去年新发布的Qwen/Qwen2.5-3B-Instruct同样也适用。 微调步骤 step0: 环境准备 conda create --name fin…...
开源项目OpenIM单机部署生产环境异常处理及数据恢复
在生产环境中,通常会采用集群部署来保证组件和服务的高可用性。然而,在资源有限的情况下,一些开发者可能会选择在生产环境中进行单机部署(使用源码部署或docker容器)。本文将介绍在单机部署环境下如何进行数据备份、异…...
天津三石峰科技——汽车生产厂的设备振动检测项目案例
汽车产线有很多传动设备需要长期在线运行,会出现老化、疲劳、磨损等 问题,为了避免意外停机造成损失,需要加装一些健康监测设备,监测设备运 行状态。天津三石峰科技采用 12 通道振动信号采集卡(下图 1)对…...
MySQL-5.7.44安装(CentOS7)
目录 1、下载安装包并解压 2、创建数据目录与日志目录 3、设置环境变量 4、刷新环境变量 5、执行初始化 6、创建配置文件目录 7、新建配置文件 8、为安装目录赋予可执行权限 9、创建服务启动脚本 10、启动服务并将启动脚本加入开机自启动 11、查看服务状态 12、创建…...
什么是网络安全
1) 什么是网络安全 作为程序员,主要是面向产品的安全的问题。比如sql注入,xss,csrf,cookie窃取等等,都值得我们去思考。保证网站运行正常,客户数据安全。 2) sql注入 简单的说,就是利用表单提…...
即时通讯开源项目OpenIM配置离线推送全攻略
如何进行二次开发 如果您需要基于 OpenIM 开发新特性,首先要确定是针对业务侧还是即时通讯核心逻辑。 由于 OpenIM 系统本身已经做好了比较多的抽象,大部分聊天的功能已经具备了,不建议修改 IM 本身。 如果需要增加 IM 的能力,可以…...
快速上手——.net封装使用DeekSeek-V3 模型
📢欢迎点赞 :👍 收藏 ⭐留言 📝 如有错误敬请指正,赐人玫瑰,手留余香!📢本文作者:由webmote 原创📢作者格言:新的征程,用爱发电,去丈量人心,是否能达到人机合一?开工大吉 新的一年就这么水灵灵的开始了,在这里,祝各位读者新春快乐,万事如意! 新年伊…...
【原创】Android Studio Ladybug 中Gradle配置
使用Android Studio创建项目后,由于需要下载的一下文件在国外,加上网速的问题,以及防火墙的问题,不少文件难以下载。常常导致项目创建后,要等很长时间,各种折腾,结果一个demo都跑不起来。 经过…...
Java版本与JDK版本
两者关联 Java版本指的Java语言和平台的版本,例如Java8、Java11、Java17等,每个版本会引入新特性、改进和修复。 JDK(Java Development Kit)版本则是开发工具包,包含编译器、调试器等工具,通常与Java版本对应,例如JDK…...
【GeeRPC】Day3:服务注册(Service Register)
Day3:服务注册(Service Register) 今天的任务是: 通过反射实现服务注册功能;在服务端实现服务调用,代码约 150 行; 结构体映射为服务 RPC 框架的一个基本能力是:像调用本地程序一…...
c/c++蓝桥杯经典编程题100道(17)二叉树遍历
二叉树遍历 ->返回c/c蓝桥杯经典编程题100道-目录 目录 二叉树遍历 一、题型解释 二、例题问题描述 三、C语言实现 解法1:递归前序遍历(难度★) 解法2:迭代中序遍历(难度★★) 解法3:…...
mysql系统库介绍,数据字典(介绍,存储方式,常见表,访问权限),系统表(介绍,不同功能的表)
目录 mysql系统库 介绍 数据字典 介绍 不同版本下的存储方式 常见的数据字典表 访问权限 系统表 介绍 权限授予系统表 对象信息系统表 服务器端帮助系统表 时区系统表 mysql系统库 介绍 MySQL 默认创建 的特殊数据库,主要用于存储服务器运行时所需的信…...
如何在macOS上安装Ollama
安装Ollama 安装Ollama的步骤相对简单,以下是基本的安装指南: 访问官方网站:打开浏览器,访问Ollama的官方网站。 下载安装包:根据你的操作系统,选择相应的安装包进行下载。 运行安装程序:下载完…...
【JavaScript】《JavaScript高级程序设计 (第4版) 》笔记-Chapter6-集合引用类型
六、集合引用类型 Object 是 ECMAScript 中最常用的类型之一。虽然 Object 的实例没有多少功能,但很适合存储和在应用程序间交换数据。 显式地创建 Object 的实例有两种方式。第一种是使用 new 操作符和 Object 构造函数。另一种方式是使用对象字面量(ob…...
Spring Boot Actuator使用
说明:本文介绍Spring Boot Actuator的使用,关于Spring Boot Actuator介绍,下面这篇博客写得很好,珠玉在前,我就不多介绍了。 Spring Boot Actuator 简单使用 项目里引入下面这个依赖 <!--Spring Boot Actuator依…...
SwanLab x verl:可视化LLM强化学习后训练教程
文章目录 介绍Verl和SwanLab1. 环境安装2. 使用方法3. 查看训练日志 介绍Verl和SwanLab verl 是一个灵活、高效且可用于生产环境的强化学习(RL)训练框架,专为大型语言模型(LLMs)的后训练设计。它由字节跳动火山引擎团…...
linux安装oracle19c
安装 安装前检查配置: 挂载50g盘: vgcreate oravg /dev/sdb lvcreate -L 49.8G -n oralv oravg lvscan mkfs.xfs /dev/oravg/oralv 查看uuid blkid 复制分区表 cp /etc/fstab /etc/fstab.bakvi /etc/fstab内容为: /dev/oravg/oralv /u01 xfs defau…...
半导体制造工艺讲解
目录 一、半导体制造工艺的概述 二、单晶硅片的制造 1.单晶硅的制造 2.晶棒的切割、研磨 3.晶棒的切片、倒角和打磨 4.晶圆的检测和清洗 三、晶圆制造 1.氧化与涂胶 2.光刻与显影 3.刻蚀与脱胶 4.掺杂与退火 5.薄膜沉积、金属化和晶圆减薄 6.MOSFET在晶圆表面的形…...
VMware下Linux和macOS安装VSCode一些总结
本文介绍VMware下Linux和macOS安装VSCode的一些内容,包括VSCode编译器显示中文以及安装.NET环境和Python环境。 VSCode下载地址:Download Visual Studio Code - Mac, Linux, Windows 一.Linux系统下 1.安装中文包 按 Ctrl Shift P 打开命令面板。输…...
STC51 单片机中,定时器 / 计数器相关的寄存器
在 STC51 单片机中,定时器 / 计数器相关的寄存器主要有定时器控制寄存器(TCON)、定时器工作方式寄存器(TMOD)以及定时器初值寄存器(TH0、TL0、TH1、TL1),下面详细解释这些寄存器各位…...
DeepSeek与人工智能的结合:探索搜索技术的未来
云边有个稻草人-CSDN博客 目录 引言 一、DeepSeek的技术背景 1.1 传统搜索引擎的局限性 1.2 深度学习在搜索中的优势 二、DeepSeek与人工智能的结合 2.1 自然语言处理(NLP) 示例代码:基于BERT的语义搜索 2.2 多模态搜索 示例代码&…...
OpenCV:图像修复
目录 简述 1. 原理说明 1.1 Navier-Stokes方法(INPAINT_NS) 1.2 快速行进方法(INPAINT_TELEA) 2. 实现步骤 2.1 输入图像和掩膜(Mask) 2.2 调用cv2.inpaint()函数 2.3 完整代码示例 2.4 运行结果 …...
解决基于FastAPI Swagger UI的文档打不开的问题
基于FastAPI Swagger UI的文档链接/docs和/redoc在没有外网的状态下无法打开,原因是Swagger依赖的JS和CSS来自CDN。 https://cdn.jsdelivr.net/npm/swagger-ui-dist5/swagger-ui-bundle.js https://cdn.jsdelivr.net/npm/swagger-ui-dist5/swagger-ui.css https://…...
前端开发知识梳理 - HTMLCSS
1. 盒模型 由内容区(content)、内边距(padding)、边框(border)和外边距(margin)组成。 (1)标准盒模型(box-sizing默认值, content-boxÿ…...
Win10环境使用ChatBox集成Deep Seek解锁更多玩法
Win10环境使用ChatBox集成Deep Seek解锁更多玩法 前言 之前部署了14b的Deep Seek小模型,已经验证了命令行及接口方式的可行性。但是纯命令行或者PostMan方式调用接口显然不是那么友好: https://lizhiyong.blog.csdn.net/article/details/145505686 纯…...
LM Studio 部署本地大语言模型
一、下载安装 1.搜索:lm studio LM Studio - Discover, download, and run local LLMs 2.下载 3.安装 4.更改成中文 二、下载模型(软件内下载) 1.选择使用代理,否则无法下载 2.更改模型下载目录 默认下载位置 C:\Users\用户名\.lmstudio\models 3.搜…...
Qt:QWidget核心属性
目录 QWidget核心属性 enab geometry WindowFrame的影响 windowTitle windowIcon qrc文件管理资源 windowOpacity cursor font toolTip focusPolicy styleSheet QWidget核心属性 在Qt中使用QWidget类表示"控件",如按钮、视图、输入框、滚动…...
unity学习29:摄像机camera相关skybox 和 Render Texture测试效果
目录 1 摄像机 1.1 每个Scene里都自带一个摄像机 camera 1.2 可以创建多个camera 1.3 下面先看backgroundtype: 2 backgroundtype: 天空盒 skybox 2.1 清除标志,清除:天空盒 自选天空盒 2.2 window /Asset Store 2.3 导入skybox 3 backgroundtype: 纯色…...
吴恩达深度学习——卷积神经网络的特殊应用
内容来自https://www.bilibili.com/video/BV1FT4y1E74V,仅为本人学习使用。 文章目录 人脸识别相关定义Similarity函数使用Siamese网络实现函数d使用Triplet损失学习参数 神经风格迁移深度卷积网络可视化神经风格迁移的代价函数内容损失函数风格损失函数 人脸识别 …...
go语言文件和目录
打开和关闭文件 os.Open()函数能够打开一个文件,返回一个*File 和一个 err。操作完成文件对象以后一定要记得关闭文件。 package mainimport ("fmt""os" )func main() {// 只读方式打开当前目录下的 main.go 文件file, err : os.Open(".…...
c++ 面试题
C 面试题通常涵盖基础知识、面向对象编程、内存管理、模板、STL(标准模板库)等方面。以下是一些常见的 C 面试题及其简要解答,供你参考: 1. C 基础知识 1.1 C 和 C 的区别是什么? C 是 C 的超集,支持面向…...
JAVA安全—FastJson反序列化利用链跟踪autoType绕过
前言 FastJson这个漏洞我们之前讲过了,今天主要是对它的链条进行分析一下,明白链条的构造原理。 Java安全—log4j日志&FastJson序列化&JNDI注入_log4j漏洞-CSDN博客 漏洞版本 1.2.24及以下没有对序列化的类做校验,导致漏洞产生 1.2.25-1.2.41增加了黑名单限制,…...
Java Stream API:高效数据处理的利器引言
Java Stream API:高效数据处理的利器引言 在 Java 编程中,数据处理是一项极为常见且关键的任务。传统的 for 循环在处理数据集合时,往往会导致代码变得冗长、复杂,这不仅增加了代码的编写难度,还降低了代码的可读性和…...
kubeadm构建k8s源码阅读环境
目标 前面看了minikube的源码了解到其本质是调用了kubeadm来启动k8s集群,并没有达到最初看代码的目的。 所以继续看看kubeadm的代码,看看能否用来方便地构建源码调试环境。 k8s源码编译 kubeadm源码在k8s源码库中,所以要先克隆k8s源码。之…...
Java架构设计亿级流量场景下的本地缓存方案选型
在当今的互联网时代,亿级流量的应用场景已经司空见惯。无论是大型电商平台的促销活动,还是热门社交应用的日常运营,都可能面临每秒数万甚至数十万的请求流量。在这样的高并发、高流量场景下,系统的性能和稳定性面临着巨大的挑战。…...
ChatGPT怎么回事?
纯属发现,调侃一下~ 这段时间deepseek不是特别火吗,尤其是它的推理功能,突发奇想,想用deepseek回答一些问题,回答一个问题之后就回复服务器繁忙(估计还在被攻击吧~_~) 然后就转向了GPT…...
离线安装Appium Server
1、问题概述? 安装Appium通常有两种方式: 第一种:下载exe安装包,这种是Appium Server GUI安装方式,缺点是通过命令启动不方便。 第二种:通过cmd安装appium server,可以通过命令方式启动,比较方便。 问题:在没有外网的情况下,无法通过命令在cmd中安装appium server…...