File tree 4 files changed +19
-10
lines changed
4 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ int gBatchSize = DEFAULT_BATCH_SIZE;
47
47
bool gSairedisRecord = true ;
48
48
bool gSwssRecord = true ;
49
49
bool gLogRotate = false ;
50
+ bool gSaiRedisLogRotate = false ;
50
51
bool gSyncMode = false ;
51
52
52
53
ofstream gRecordOfs ;
@@ -73,15 +74,7 @@ void sighup_handler(int signo)
73
74
* Don't do any logging since they are using mutexes.
74
75
*/
75
76
gLogRotate = true ;
76
-
77
- sai_attribute_t attr;
78
- attr.id = SAI_REDIS_SWITCH_ATTR_PERFORM_LOG_ROTATE;
79
- attr.value .booldata = true ;
80
-
81
- if (sai_switch_api != NULL )
82
- {
83
- sai_switch_api->set_switch_attribute (gSwitchId , &attr);
84
- }
77
+ gSaiRedisLogRotate = true ;
85
78
}
86
79
87
80
void syncd_apply_view ()
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ using namespace swss;
19
19
20
20
extern sai_switch_api_t * sai_switch_api;
21
21
extern sai_object_id_t gSwitchId ;
22
+ extern bool gSaiRedisLogRotate ;
22
23
23
24
extern void syncd_apply_view ();
24
25
/*
@@ -400,6 +401,19 @@ void OrchDaemon::flush()
400
401
SWSS_LOG_ERROR (" Failed to flush redis pipeline %d" , status);
401
402
exit (EXIT_FAILURE);
402
403
}
404
+
405
+ // check if logroate is requested
406
+ if (gSaiRedisLogRotate )
407
+ {
408
+ SWSS_LOG_NOTICE (" performing log rotate" );
409
+
410
+ gSaiRedisLogRotate = false ;
411
+
412
+ attr.id = SAI_REDIS_SWITCH_ATTR_PERFORM_LOG_ROTATE;
413
+ attr.value .booldata = true ;
414
+
415
+ sai_switch_api->set_switch_attribute (gSwitchId , &attr);
416
+ }
403
417
}
404
418
405
419
void OrchDaemon::start ()
Original file line number Diff line number Diff line change @@ -18,10 +18,11 @@ int gBatchSize = DEFAULT_BATCH_SIZE;
18
18
bool gSairedisRecord = true ;
19
19
bool gSwssRecord = true ;
20
20
bool gLogRotate = false ;
21
+ bool gSaiRedisLogRotate = false ;
21
22
ofstream gRecordOfs ;
22
23
string gRecordFile ;
23
24
24
25
MirrorOrch *gMirrorOrch ;
25
26
VRFOrch *gVrfOrch ;
26
27
27
- void syncd_apply_view () {}
28
+ void syncd_apply_view () {}
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ extern int gBatchSize;
19
19
extern bool gSwssRecord ;
20
20
extern bool gSairedisRecord ;
21
21
extern bool gLogRotate ;
22
+ extern bool gSaiRedisLogRotate ;
22
23
extern ofstream gRecordOfs ;
23
24
extern string gRecordFile ;
24
25
You can’t perform that action at this time.
0 commit comments