Skip to content

Commit

Permalink
Fixes problems with database - swss - syncd synchronization. (#110)
Browse files Browse the repository at this point in the history
* [syncd.service] Make syncd starting after swss in order to eliminate race condition with database flush/set

* [swss.service] Make swss waiting for redis server start before cleaning the database

* Fixed review comments for changes in swss service file
  • Loading branch information
Vitaliy Senchyshyn authored and lguohan committed Feb 3, 2017
1 parent 12b4aeb commit a2ab261
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ansible/roles/sonicv2/templates/etc/systemd/system/swss.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ After=database.service

[Service]
User={{ sonicadmin_user }}
# Wait for redis server start before database clean
ExecStartPre=/bin/bash -c "while true; do if [ \"$(/usr/bin/docker exec database redis-cli ping)\" == \"PONG\" ]; then break; fi; sleep 1; done"
ExecStartPre=/usr/bin/docker exec database redis-cli -n 0 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 1 FLUSHDB
ExecStartPre=/usr/bin/docker exec database redis-cli -n 2 FLUSHDB
Expand Down
4 changes: 2 additions & 2 deletions ansible/roles/sonicv2/templates/etc/systemd/system/syncd.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=syncd container
Requires=database.service
After=database.service
Requires=database.service swss.service
After=database.service swss.service

[Service]
User=root
Expand Down

1 comment on commit a2ab261

@oleksandrivantsiv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this change be also added to sonic-buildimage?

Please sign in to comment.