@@ -135,7 +135,7 @@ public boolean validateTableStatusFunction(Properties props, Logger log, RefExec
135
135
.parallelStream ()
136
136
.map (proObjectMap -> {
137
137
log .info ("Begin to Check dataObject:" + proObjectMap .entrySet ().toString ());
138
- boolean checkRes = getDataCheckResult (proObjectMap , jobConn , bdpConn , dopsConn , props , log ,action , qualitisUtil );
138
+ boolean checkRes = getDataCheckResult (proObjectMap , jobConn , bdpConn , dopsConn , props , log ,qualitisUtil );
139
139
if (null != action .getExecutionRequestRefContext ()) {
140
140
if (checkRes ) {
141
141
action .getExecutionRequestRefContext ().appendLog ("Database table partition info : " + proObjectMap .get (DataChecker .DATA_OBJECT ) + " has arrived" );
@@ -176,7 +176,6 @@ private boolean getDataCheckResult(Map<String, String> proObjectMap,
176
176
Connection dopsConn ,
177
177
Properties props ,
178
178
Logger log ,
179
- RefExecutionAction action ,
180
179
QualitisUtil qualitisUtil ) {
181
180
String dataObjectStr = proObjectMap .get (DataChecker .DATA_OBJECT ) == null ? "" : proObjectMap .get (DataChecker .DATA_OBJECT );
182
181
if (StringUtils .isNotBlank (dataObjectStr )) {
@@ -207,31 +206,19 @@ private boolean getDataCheckResult(Map<String, String> proObjectMap,
207
206
Predicate <Map <String , String >> isCheckMask = (hasDataSource .and (isBdpDataSource )).or (hasNotDataSource .and (isOdsDB ));
208
207
boolean normalCheck ;
209
208
if (isCheckMetadata .test (proObjectMap )) {
210
- if (null != action .getExecutionRequestRefContext ()){
211
- action .getExecutionRequestRefContext ().appendLog ("start to check hive meta" );
212
- }
213
209
proObjectMap .put (DataChecker .SOURCE_TYPE , HIVE_SOURCE_TYPE );
214
210
normalCheck = getJobTotalCount (dataObject , jobConn , log ) > 0 ;
215
- if (null != action .getExecutionRequestRefContext ()){
216
- action .getExecutionRequestRefContext ().appendLog ("check hive meta end,check result:" +normalCheck );
217
- }
218
211
219
212
} else {
220
213
if (isCheckMask .test (proObjectMap )) {
221
- if (null != action .getExecutionRequestRefContext ()){
222
- action .getExecutionRequestRefContext ().appendLog ("start to check maskis" );
223
- }
224
214
proObjectMap .put (DataChecker .SOURCE_TYPE , MASK_SOURCE_TYPE );
225
215
normalCheck = (getBdpTotalCount (dataObject , bdpConn , log , props ) > 0 || "success" .equals (fetchMaskCode (dataObject , log , props ).get ("maskStatus" )));
226
- if (null != action .getExecutionRequestRefContext ()){
227
- action .getExecutionRequestRefContext ().appendLog ("check maskis end,check result:" +normalCheck );
228
- }
229
216
}else {
230
217
normalCheck = false ;
231
218
}
232
219
}
233
220
return normalCheck
234
- && checkQualitisData ( objectNum ,dataObject , log , action , props , dopsConn ,qualitisUtil );
221
+ && checkQualitisData ( objectNum ,dataObject , log , props , dopsConn ,qualitisUtil );
235
222
236
223
}
237
224
@@ -452,18 +439,13 @@ private int checkDops(CheckDataObject dataObject, Connection conn, Logger log){
452
439
/**
453
440
* 从qualitis去check数据
454
441
*/
455
- private boolean checkQualitisData (String objectNum ,CheckDataObject dataObject , Logger log , RefExecutionAction action , Properties props ,Connection conn , QualitisUtil qualitisUtil ) {
442
+ private boolean checkQualitisData (String objectNum ,CheckDataObject dataObject , Logger log , Properties props ,Connection conn , QualitisUtil qualitisUtil ) {
456
443
boolean systemCheck = Boolean .valueOf (props .getProperty (DataChecker .QUALITIS_SWITCH ));
457
444
String userCheckDefault =props .getProperty (DataChecker .QUALITIS_CHECK_DEFAULT );
458
445
boolean userCheck = Boolean .valueOf (props .getProperty (DataChecker .QUALITIS_CHECK , userCheckDefault ));
459
446
if (systemCheck && userCheck ) {
460
- if (null != action .getExecutionRequestRefContext ()){
461
- action .getExecutionRequestRefContext ().appendLog ("start to check dops" );
462
- }
447
+
463
448
int dopsState =checkDops (dataObject ,conn ,log );
464
- if (null != action .getExecutionRequestRefContext ()){
465
- action .getExecutionRequestRefContext ().appendLog ("check dops end,check result:" +dopsState );
466
- }
467
449
if (dopsState ==0 ){
468
450
//没找到记录,直接通过校验
469
451
return true ;
@@ -472,9 +454,6 @@ private boolean checkQualitisData(String objectNum,CheckDataObject dataObject, L
472
454
return false ;
473
455
}
474
456
// 其他情况,继续走qualitis校验
475
- if (null != action .getExecutionRequestRefContext ()){
476
- action .getExecutionRequestRefContext ().appendLog ("start to check qualitis" );
477
- }
478
457
log .info (
479
458
"=============================Data Check Qualitis Start==========================================" );
480
459
try {
@@ -487,7 +466,7 @@ private boolean checkQualitisData(String objectNum,CheckDataObject dataObject, L
487
466
String applicationId = qualitisUtil
488
467
.createAndSubmitRule (dataObject ,projectName ,ruleName ,user );
489
468
if (StringUtils .isEmpty (applicationId )) {
490
- throw new SQLException ( "applicationId is empty" ) ;
469
+ return false ;
491
470
}
492
471
long startTime = System .currentTimeMillis ();
493
472
while (System .currentTimeMillis () - startTime < Integer
@@ -506,28 +485,16 @@ private boolean checkQualitisData(String objectNum,CheckDataObject dataObject, L
506
485
}
507
486
break ;
508
487
case 4 :
509
- if (null != action .getExecutionRequestRefContext ()){
510
- action .getExecutionRequestRefContext ().appendLog ("check qualitis end,check result:true" );
511
- }
512
488
return true ;
513
489
default :
514
- if (null != action .getExecutionRequestRefContext ()){
515
- action .getExecutionRequestRefContext ().appendLog ("check qualitis end,check result:false" );
516
- }
517
490
return false ;
518
491
}
519
492
520
493
}
521
- if (null != action .getExecutionRequestRefContext ()){
522
- action .getExecutionRequestRefContext ().appendLog ("check qualitis time out,check result set to false" );
523
- }
524
494
log .info (
525
495
"=============================Data Check Qualitis time out==========================================" );
526
496
return false ;
527
497
} catch (Exception e ) {
528
- if (null != action .getExecutionRequestRefContext ()){
529
- action .getExecutionRequestRefContext ().appendLog ("check qualitis failed,check result set to false.cause by:" +e .getMessage ());
530
- }
531
498
log .error ("get datachecker result from qualitis failed" , e );
532
499
return false ;
533
500
}
0 commit comments