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

Maintain daemon mode information for each daemon instance #466

Merged
merged 3 commits into from
May 10, 2023

Conversation

jiangliu
Copy link
Contributor

@jiangliu jiangliu commented May 6, 2023

Currently daemon mode is a global configuration, all daemon instances must be with the same daemon mode, which limits some possible usage scenarios. So add DaemonMode to daemon object, so daemons may have different daemon modes.

Aslo add an alias for daemon mode "multiple" as "dedicated".

@changweige
Copy link
Member

need rebase 🥺

@jiangliu jiangliu force-pushed the daemon-mode branch 5 times, most recently from 8a5c4cf to 98466c9 Compare May 6, 2023 08:59
@codecov-commenter
Copy link

codecov-commenter commented May 6, 2023

Codecov Report

Merging #466 (6109cdc) into main (7f8a719) will increase coverage by 0.26%.
The diff coverage is 33.70%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #466      +/-   ##
==========================================
+ Coverage   37.05%   37.31%   +0.26%     
==========================================
  Files          60       59       -1     
  Lines        6904     6960      +56     
==========================================
+ Hits         2558     2597      +39     
- Misses       4046     4052       +6     
- Partials      300      311      +11     
Impacted Files Coverage Δ
pkg/daemon/config.go 0.00% <0.00%> (ø)
pkg/daemon/daemon.go 0.00% <0.00%> (ø)
pkg/daemon/rafs.go 2.34% <0.00%> (-0.02%) ⬇️
pkg/manager/daemon_adaptor.go 0.00% <0.00%> (ø)
pkg/manager/manager.go 14.80% <0.00%> (+0.04%) ⬆️
config/global.go 33.33% <33.33%> (ø)
pkg/store/database.go 44.16% <40.00%> (+5.65%) ⬆️
pkg/store/database_compat.go 76.64% <61.76%> (-3.81%) ⬇️
config/config.go 34.40% <100.00%> (+1.06%) ⬆️
internal/flags/flags.go 100.00% <100.00%> (ø)

internal/flags/flags.go Outdated Show resolved Hide resolved
ID string
ProcessID int
APISocket string
LogDir string
LogLevel string
LogToStdout bool
DaemonMode config.DaemonMode
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to handle the compatibility if the newer nydus-snapshotter is loading old records in DB without DamonMode ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we need to migrate the database, that's on the todo list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently it works, but may get broken in future easily. So the safe way is to convert records in databases. Rafs will face the same situation in coming PRs, so let's delay support of data migration.

Copy link
Member

Choose a reason for hiding this comment

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

Um. I tend to tolerate the DB compatibility within this PR rather than make it a future work.
For the compatibility, I suppose it wouldn't be very complicated. Nydus-sanpshotter already has an experience on how to migrate different record formats in function tryTranslateRecords(). We can simply assign a DaemonMode by comparing daemon Mountpoint and HostRootMount and rewrite the daemon's record of state

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a patch to migrate the database.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks

jiangliu added 2 commits May 8, 2023 19:21
Introduce daemon mode `dedicated` as an alias for `multiple`.

Signed-off-by: Jiang Liu <[email protected]>
Currently the daemon mode is global and is recorded in manager, which
limits extensibility. So record daemon mode in every daemon instance,
so we can extend it later.

Signed-off-by: Jiang Liu <[email protected]>
Copy link
Member

@changweige changweige left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

@jiangliu jiangliu force-pushed the daemon-mode branch 3 times, most recently from 93b807e to 5c35107 Compare May 9, 2023 15:21
Migrate boltdb from old version to add `DaemonMode` field to daemon
object.

Signed-off-by: Jiang Liu <[email protected]>
@bergwolf
Copy link
Contributor

Aslo add an alias for daemon mode "multiple" as "dedicated".

Why do we need to introduce the alias?

@jiangliu
Copy link
Contributor Author

Aslo add an alias for daemon mode "multiple" as "dedicated".

Why do we need to introduce the alias?

We are planning to deprecated multiple.

@jiangliu jiangliu requested a review from changweige May 10, 2023 09:31
@changweige
Copy link
Member

Aslo add an alias for daemon mode "multiple" as "dedicated".

Why do we need to introduce the alias?

Feel like dedicated is more suggestive and descriptive 😀

@changweige changweige merged commit 895f77a into containerd:main May 10, 2023
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.

5 participants