当前位置:网站首页>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 ;
边栏推荐
- Practice of microservice in solving Library Download business problems
- Win10 uses NVM to install node, NPM, and cnpm
- 28. Implementation of file directory parsing code
- Understanding of Abstract Programming
- MySQL locking mechanism
- 安科瑞余压监控系统在住宅小区的应用方案
- Summary of common cmake commands
- 外包干了四年,废了...
- Data center construction (II): brief introduction to data center
- Application scheme of ankerui residual pressure monitoring system in residential quarter
猜你喜欢

了解 useRef 一篇就够了

。。。。。。

swagger2.9.2教程 与swagger3.0.0教程

Pytoch -- error based on mmseg/mmdet training: runtimeerror: expected to have finished reduction in the priority iteration

Big view +500 cases, software teams should improve R & D efficiency in this way!

哈希表

js使用WebUploader做大文件的分块和断点续传

7月27日19:30直播预告:HarmonyOS3及华为全场景新品发布会

JS use webuploader to do blocking and breakpoint continuation of large files

安科瑞余压监控系统在住宅小区的应用方案
随机推荐
Machine learning by Li Hongyi 2. Regression
【万字长文】使用 LSM-Tree 思想基于.Net 6.0 C# 实现 KV 数据库(案例版)
滴滴被罚80亿!拿用户数据赚钱的时代结束了
MongoDN数据库以URL形式连接
7月27日19:30直播预告:HarmonyOS3及华为全场景新品发布会
Record errors encountered by individuals
了解 useRef 一篇就够了
MLX90640 红外热成像仪测温传感器模块开发笔记(六)
X 2 earn must rely on Ponzi startup? Where is the way out for gamefi? (top)
【通信原理】第二章 -- 确知信号
.....
QT - connect USB camera
702马力破百仅4.5秒!最强皮卡来袭,安全、舒适一个不落
安科瑞余压监控系统在住宅小区的应用方案
Application scheme of ankerui residual pressure monitoring system in residential quarter
五万美元的年薪是如何花光的
Build neural network from simple to deep
Caused by: scala. MatchError: None (of class scala.None$)
[cloud resident co creation] decrypt how sparkrtc realizes ultra-low latency interaction globally
【通信原理】第一章 -- 绪论