Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: load saved inflight publishes on uplink restart #307

Merged
merged 3 commits into from
Nov 21, 2023

Conversation

Vilayat-Ali
Copy link
Contributor

@Vilayat-Ali Vilayat-Ali commented Nov 20, 2023

Closes #

Changes

Added reload_inflight method to the serializer module which reads from disk and publishes packets back onto EventLoop and deletes the file.

Why?

Graceful shutdown requires graceful recovery on restart, which means we need to load publishes back from file.

Trials Performed

Spinned up docker instance and used qa-scripts like qa-scripts/persistence.sh to test out the functionality.

2023-11-21T12:19:20.040174Z  INFO uplink::base::serializer: Switching to slow eventloop mode!!

  2023-11-21T12:19:20.040229Z DEBUG uplink::base::mqtt: Writing pending publishes to disk: /var/tmp/persistence/inflight

  2023-11-21T12:19:20.040599Z  INFO storage: Flushing data to disk for stoarge: /tenants/demo/devices/251/events/imu/jsonarray; path = "/var/tmp/persistence/imu/backup@0"

image

2023-11-21T12:34:54.530267Z  INFO uplink::base::serializer: Read and published inflight packets; removing file: /media/hp/Projects/bytebeam/uplink/.persistence/inflight

@de-sh de-sh changed the base branch from main to vilayat/task/graceful-shutdown November 20, 2023 12:28
@de-sh de-sh changed the title Vilayat/inflight persistence feat: load saved inflight publishes on uplink restart Nov 20, 2023
@de-sh
Copy link
Member

de-sh commented Nov 21, 2023

@Vilayat-Ali here are my suggestions:

  • Please use a standard commit message template, e.g. https://www.conventionalcommits.org
  • Add logs that showcase that inflight file was written onto disk and read back on restart

@de-sh de-sh removed the request for review from tekjar November 21, 2023 11:37
@de-sh de-sh merged commit ce3d6cb into vilayat/task/graceful-shutdown Nov 21, 2023
@de-sh de-sh deleted the vilayat/inflight-persistence branch November 21, 2023 20:14
de-sh added a commit that referenced this pull request Dec 1, 2023
* Implemeted reading from disk and publishing onto the network

* inflight persistence logic

* doc: make the code readable

---------

Co-authored-by: Devdutt Shenoi <devdutt@bytebeam.io>
de-sh added a commit that referenced this pull request Jan 4, 2024
* changes by vilayat

* changes by vilayat

* fix: basic implementation fixes, needs debugging

* doc: note on where to load inflight publishes

* fix: `EventLoop::clean` to force persist inflight

* chore: cleanup

* doc: remove outdated comments

* doc: don't disconnect, note why

* chore: rm unused loc

* feat: load saved inflight publishes on uplink restart (#307)

* Implemeted reading from disk and publishing onto the network

* inflight persistence logic

* doc: make the code readable

---------

Co-authored-by: Devdutt Shenoi <devdutt@bytebeam.io>

* chore: revert unrelated changes

* doc: make it clear what is happening

* doc: replace commented out code with TODO

* fix: `Error=PacketIdZero`

* chore: cargo update

* fix: handle incoming data during inflight recovery

* doc: describe undesired behavior

* refactor: DRY `PersistenceFile`

* log: add condition for successful completion

* doc: improve comments in `recovery`

* refactor: improve readability with placement

* fix: merge breaking code

* doc: code improvement TODO based on #311

* feat: `Ctrl` handles for `Mqtt`

* refactor: remove code that never gets hit

* refactor: load pending packets into eventloop

* fix: delete file once read

* refactor: error handling in recovery

* fix: glienicke bridge to limit inflight growth

* refactor: unnecessary copy

* style: don't log before success

* log: make sense

* fix: save pending files from getting lost

* fix: `VecDeque` to maintain order

* doc: revert update to illustration

* style: remove whitespace

* rm: unused directories

* chore: use main rumqtt

* doc: update note

* fix: don't change pkid of inflight

* log: improve messaging

* style: make it obvious

---------

Co-authored-by: vilayat-ali <vilayatcodemysite@gmail.com>
Co-authored-by: Syed Vilayat Ali Rizvi <73014428+Vilayat-Ali@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants