当前位置:网站首页>An online duplicate of a hidden bug
An online duplicate of a hidden bug
2022-07-26 11:47:00 【Wu_ Candy】
Preface
A previous project has been online for a long time , Recently, there was a sudden explosion Bug, Finally, the scope of impact will be evaluated Bug Upgraded to failure , Just because the amount of data affected is 10000 Bar or so , It has a certain impact on the business side .
But because it does not involve financial losses ,Bug Repair the data after repair , So the final level is also low .
Today I share with you this hidden online Bug, It can also be used for reference in work projects ~
Demand background
The theme : B & B check-in return visit questionnaire
describe :
For customers staying in B & B , You need to send the return visit questionnaire of this B & B check-in to the customer on the same day or the next day after leaving the hotel , In order to collect customers' comments or suggestions on the check-in experience
explain :
Because of the large amount of data , It's using Hive Inventory storage data and logical processing
Problem analysis
1. Business logic
t2 surface : Storage ( Yesterday, + At this time today ) Check out customer list information
t3 surface : Store the customer list information that has sent the follow-up questionnaire
appear Bug The core business logic of is as follows :

The equivalent association field used is :
t2.id = t3.primary_id
from t2 surface Filter out t3 surface Data in , By using t2 surface As the main table left join Sub table t3 surface
And then determine t3.primary_id is null, The description has not been sent .
2. Problems arise
t2.id Field type is :string type
t3.primary_id Field type is :bigint type
When two different types of fields are equivalently associated , When t3.primary_id The actual value is more than 16 The value of bit is in MapReduce The field type is changed from bigint Type conversion to double type , At this point, there is a lack of accuracy .

for example :
# This is just an example , Does not represent the actual true value
t2.id = 1000110000000000
t3.primary_id = 10001100000000009
The above example ,t3 surface There is already primary_id = 10001100000000009 The record of sent a follow-up questionnaire
here t3.primary_id = 10001100000000009 The value of exceeds 16 position , Convert it to double Type , The value is truncated and then correlated equivalently
Will appear t3.primary_id = 1000110000000000( Will end with 9 Get rid of ) And again t2 surface Medium id relation
There are already primary_id = 10001100000000009 The record of , So I think this record should not send a follow-up questionnaire , Directly filtered out
In the actual business, this record is not in the record form of the sent return visit questionnaire , Only because of the lack of precision, the two records on the inappropriate association are truncated and wrongly associated
result : Lead to customers who should send a follow-up questionnaire , Not sent
Solution
1.Bug solve
At that time, this appeared online Bug The first solution is : Type the equivalent associated fields , All converted to string Type and then conduct equivalent Association
Use cast function Do type conversion , This can solve the problem of lack of accuracy

2. Missing data processing
The modified code logic at the equivalent connection , According to the time range of business data affected , Do it again , Find out that you should have sent a follow-up questionnaire, but so Bug And the unsent customer list , Send a follow-up questionnaire .
summary
Through the previous analysis , You can see the online Bug More hidden , If you are not clear about the implicit conversion rules , This problem is likely to occur .
Today I will share with you this implicit transformation Bug, I hope that we can learn from one or two when there are similar problems in future work projects .
Except for Bug Remedial measures after , What can we do in advance in future projects ?
Once there is equivalent Correlation , You need to consider whether the field types of associated fields are consistent ; When defining tables , It is necessary to consider the data range of the possible maximum value in combination with specific business conditions ; Don't be afraid of this problem , Without thinking , As long as the equivalence relation is used cast functionConduct string Conversion of type ;
边栏推荐
- Swagger2.9.2 tutorial and swagger3.0.0 tutorial
- X 2 earn must rely on Ponzi startup? Where is the way out for gamefi? (top)
- 系统调用捕获和分—Ring3层LD_PRELOAD机制进行库函数劫持
- ESP8266-Arduino编程实例-开发环境搭建(基于Arduino IDE)
- Initial learning experience of SQL Server database
- SQL statement of SQL server creates database
- 五万美元的年薪是如何花光的
- 如何使用数据管道实现测试现代化
- 线上一个隐匿 Bug 的复盘
- DP的基本递归方程
猜你喜欢

QT——LCDNumber

QT - connect USB camera

。。。。。。

LeetCode / Scala - 两数,三数,四数,N数之和

Real time streaming protocol --rtsp

梅科尔工作室-华为14天鸿蒙设备开发实战笔记八

哈希表

3.2 创建菜单与游戏页面(下)

Practice of microservice in solving Library Download business problems

Getting started step by step using g2o to solve ICP problems - estimating the transformation relationship between two sets of 3D point sets with matching relationship
随机推荐
Understanding of Abstract Programming
MongoDB-使用$type查询某个字段的类型是否为xxx
李宏毅《机器学习》丨2. Regression(回归)
PostgreSQL在Linux和Windows安装和入门基础教程
Static routing and dynamic routing
安科瑞余压监控系统在住宅小区的应用方案
[cloud resident co creation] decrypt how sparkrtc realizes ultra-low latency interaction globally
c语言代码量统计工具
Esp8266 Arduino programming example - know esp8266
Application scheme of ankerui residual pressure monitoring system in residential quarter
[communication principle] Chapter 1 -- Introduction
Wulin headlines - station building expert competition
GA-RPN:引导锚点的建议区域网络
服务器内存故障预测居然可以这样做!
System call capture and analysis conclusion making system call log collection system
MongoDN数据库以URL形式连接
Server memory failure prediction can actually do this!
Modeling essay series 150 SCLC engineering experiment 3-srule
五万美元的年薪是如何花光的
Mlx90640 infrared thermal imager temperature sensor module development notes (6)