Comments (3)
如果确实16M限制,可以分开多个字段存储。
from skynet.
之前也遇到类似问题, 但这个不太好解决, 和 mysql 的 max_packet_size 等参数要同步
不然 lua 层面设的大, 但 mysql-server 小, 发到mysql那边也会报错。
from skynet.
如果确实16M限制,可以分开多个字段存储。
目前具体情况是这样的, 原有业务的确不应该 insert 如此长的数据. 但是设计已经产生, 业务逻辑升级优化的确是正确做法.
但是目前还是想改动这个 query, 支持 多行/多表数据 一次性投递到 mysql.
根据mysql的协议是支持的:
在源码中 socketchannel.lua channel:request(request, response, padding) 接口 padding就是拆分下来的消息包, 投递到mysql,mysql按照协议分包接收后 执行. 但是我已经拆分了, 且按照mysql的协议 依次在 mysql.lua中使 《self.packet_no》产生了消息ID递增, 重新填装了每个包的大小. 修改案例伪代码如下, 不知道为什么会出错? 现在完全和mysql协议对接不上.
local function _compose_query(self, query)
self.packet_no = -1
local cmd_packet = COM_QUERY .. query
local package_max_size = 8 * 1024 * 1024
local size = #cmd_packet
if size >= package_max_size then
--拆包处理
DEBUG("size = ", size)
DEBUG("package_max_size = ", package_max_size)
local pack_size = package_max_size
local rreq = string.sub(cmd_packet, 1, pack_size)
local ssize = #rreq
local request_pack = _compose_packet(self, rreq)
local req_tbl = {}
table.insert(req_tbl, request_pack)
size = size - pack_size
local offset = pack_size
while true do
self.packet_no = self.packet_no + 1
pack_size = package_max_size
if pack_size > size then
pack_size = size
end
rreq = string.sub(cmd_packet, offset + 1, offset + pack_size)
ssize = #rreq
rreq = COM_QUERY .. rreq
table.insert(req_tbl, _compose_packet(self, rreq))
offset = offset + pack_size
size = size - ssize
if size <= 0 then
DEBUG("END size = ", size)
break
end
end
return request_pack, req_tbl
end
return _compose_packet(self, cmd_packet)
end
from skynet.
Related Issues (20)
- skynet的actor问题
- 在压测过程中遇到jemalloc 内存利用率过低问题
- skynet加载自定义c模块成功,table也能打印出两个函数名称,但是调用时函数为nil HOT 7
- 关于skynet.sleep时间不准确的问题 HOT 1
- sharedata.flush 导致 coredump HOT 2
- 副本集主从切换问题 HOT 2
- 多agent,服务之间发送消息延迟过高
- http发送get请求收到服务器回复之后几分钟之后才返回
- 多agent,服务之间消息延迟很高 HOT 1
- redis 链接 假如的密码不对,好像内存会一直上涨。 HOT 1
- 为什么skynet.wait里生成session没有check? HOT 1
- 宕机了,恳请云风大大帮我看看
- symbol SSL_set_connect_state version OPENSSL_1.0.0 not defined in file libssl.so.1.0.0
- 阿里云服务器Debian12 出现一个必然崩溃bug,不链接jemalloc却没问题 HOT 1
- ./skynet examples/config.c1报错闪退 HOT 12
- ./skynet examples/config.c1 报错闪退
- clusteragent中`register_name_mt.__index`重入,导致请求结果"Invalid name"。 HOT 6
- skynet.send发送到一个无效地址时,是否抛出错误或者提示更合理?
- 你好,用了一年多skynet的mongodb存储很稳定,最近需要将mongodb连到mongodb+srv,使用云存储,我不太清楚如何处理,所以想请教下
- clusterd 接受一个连接,启动clusteragent时,forward失败,导致clusteragent服务创建失败,这时fd无法正常关闭 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from skynet.