diff --git a/orchagent/saihelper.cpp b/orchagent/saihelper.cpp index cafe7c70c314..15cb600a6f25 100644 --- a/orchagent/saihelper.cpp +++ b/orchagent/saihelper.cpp @@ -172,18 +172,10 @@ void initSaiRedis(const string &record_location) * to be performed, and they should be executed before creating switch. */ - /* Disable/enable SAI Redis recording */ sai_attribute_t attr; - attr.id = SAI_REDIS_SWITCH_ATTR_RECORD; - attr.value.booldata = gSairedisRecord; + sai_status_t status; - sai_status_t status = sai_switch_api->set_switch_attribute(gSwitchId, &attr); - if (status != SAI_STATUS_SUCCESS) - { - SWSS_LOG_ERROR("Failed to %s SAI Redis recording, rv:%d", - gSairedisRecord ? "enable" : "disable", status); - exit(EXIT_FAILURE); - } + /* set recording dir before enable recording */ if (gSairedisRecord) { @@ -200,6 +192,19 @@ void initSaiRedis(const string &record_location) } } + /* Disable/enable SAI Redis recording */ + + attr.id = SAI_REDIS_SWITCH_ATTR_RECORD; + attr.value.booldata = gSairedisRecord; + + status = sai_switch_api->set_switch_attribute(gSwitchId, &attr); + if (status != SAI_STATUS_SUCCESS) + { + SWSS_LOG_ERROR("Failed to %s SAI Redis recording, rv:%d", + gSairedisRecord ? "enable" : "disable", status); + exit(EXIT_FAILURE); + } + attr.id = SAI_REDIS_SWITCH_ATTR_USE_PIPELINE; attr.value.booldata = true;