mon: disable snap id allocation for fsmap pools#47753
mon: disable snap id allocation for fsmap pools#47753rishabh-d-dave merged 4 commits intoceph:mainfrom
Conversation
320fa67 to
afac3a1
Compare
ajarr
left a comment
There was a problem hiding this comment.
I guess this PR is WIP/draft , and you'll add tests later.
|
|
||
| const pg_pool_t *pool = osdmap.get_pg_pool(m->pool); | ||
|
|
||
| if (m->op == POOL_OP_CREATE_SNAP || |
There was a problem hiding this comment.
Can you please explain in the commit message why we disallow pool level snaps for FS pools?
There was a problem hiding this comment.
thinking about it more ... since pool level snap IDs are assigned by mons and FS level snap IDs are assigned by the MDS itself, I wonder how the snap IDs may clash causing problems ... which was the main driving factor for this PR
since MDS is never going to talk to the mon for manging FS snaps ... I think I may be lacking a bit of context
@gregsfortytwo could you elaborate on this please
There was a problem hiding this comment.
The snapids are a shared resource and when you delete a snapshot, you insert it into the osdmap. Any overlap is bad since it would delete both...
There was a problem hiding this comment.
@gregsfortytwo could you point me to the piece of code on the mds side which initiates the propagation of the deleted snapid to the osdmap
There was a problem hiding this comment.
so @vshankar mentions that the reason for creating MDS managed snapshots was to implement a finer granularity (dir level) snaps rather than using the pool level snaps for the data pool in the fs
the collision happens since each write op to the data pool has to be handed a snap context (snapid) to write the data to and when pool level snaps are allowed along side MDS level snaps for the same pool, a "remove snap" from the mds could encounter a collision with pool level snap IDs and cause the unintentional removal of pool level data rather then dir level data as the MDS intended to remove
src/mds/Server.cc
Outdated
| { | ||
| /* Since we don't allow to create pool level snaps for all pools associated | ||
| * with a CephFS, we also block a pool with pre-existing snaps to be attached | ||
| * to a CephFS. |
There was a problem hiding this comment.
Does that mean we want to prevent a pool that has pre-existing snaps to be used as a FS data pool using 'add_data_pool' or 'fs new' command? So we will want this check in "FileSystemCommandHandler::_check_pool() as well?
There was a problem hiding this comment.
Yes; we'd need a check there as well. But I want others to comment on this specific issue.
There was a problem hiding this comment.
I think that would be an ideal thing to do.
src/mds/Server.cc
Outdated
| * to a CephFS. | ||
| */ | ||
| if (const auto *p = osdmap.get_pg_pool(pool_id); p->snaps.size() > 0) { | ||
| dout(20) << "pool(" << pool_id << ") already has snaps; can't attach to fs" << dendl; |
There was a problem hiding this comment.
this is not a fatal error, so its not a good idea to tag it as ERR in the logs
in fact we are avoiding errors by blocking the addition of such pools to the fs
src/mds/Server.cc
Outdated
| } | ||
|
|
||
| // XATTRS | ||
| int Server::check_if_pool_is_empty(const OSDMap& osdmap, int64_t pool_id) |
There was a problem hiding this comment.
Is it better to rename the function as check_if_pool_has_snaps instead ?
There was a problem hiding this comment.
renamed function to check_for_pool_snaps()
afac3a1 to
043c7a3
Compare
src/mds/Server.cc
Outdated
| { | ||
| /* Since we don't allow to create pool level snaps for all pools associated | ||
| * with a CephFS, we also block a pool with pre-existing snaps to be attached | ||
| * to a CephFS. |
There was a problem hiding this comment.
I think that would be an ideal thing to do.
043c7a3 to
eb0f530
Compare
4cb8673 to
86e6af3
Compare
|
@mchangir I guess this is ready for QA? |
yes, its ready for QA |
gregsfortytwo
left a comment
There was a problem hiding this comment.
Reviewed-by: Greg Farnum gfarnum@redhat.com
|
FYI, I will pick this for fs suite runs soon -- I am currently trying to merge pending PRs which are running tests, however, I'm frequently running into teuthology related issues. |
rishabh-d-dave
left a comment
There was a problem hiding this comment.
IMHO it'll be great to add a note about this in CephFS docs.
| pass | ||
| self.delete_dir_and_snaps("accounts", new_limit + 1) | ||
|
|
||
| def test_disallow_monitor_managed_snaps_for_fs_pools(self): |
There was a problem hiding this comment.
Moving this test to a new class, say TestMonSnapsAndFsPools (subclass of TestSnapshots), would allow us to quickly test how monitor-managed snapshots are treated on FS pools conveniently.
There was a problem hiding this comment.
added new class to test specifically for mon-managed snaps
src/mon/FSCommands.cc
Outdated
| } | ||
|
|
||
| if (pool->has_snaps()) { | ||
| *ss << "pool(" << pool_id << ") already has snaps; can't attach to fs"; |
There was a problem hiding this comment.
Would it be worth it to write "mon-managed snaps" instead of just "snaps" here for clarity of CephFS users?
There was a problem hiding this comment.
fixed debug log to mention "mon-managed snaps"
|
Ceph testing infra is down for last few weeks, I'll put this PR through testing as soon as it's fine again. |
| self.assertEqual(ret, errno.EOPNOTSUPP) | ||
|
|
||
| # cleanup | ||
| self.fs.rados(["rmsnap", "snap3"], pool=test_pool_name) |
There was a problem hiding this comment.
nit: delete {test_pool_name}
There was a problem hiding this comment.
@kotreshhr do you want me to replace {test_pool_name} with snap-test-pool ?
There was a problem hiding this comment.
Nope, I meant cleanup is missing. The pool needs to deleted.
There was a problem hiding this comment.
Isn't cleaning up redundant for since all FSs and related pools are deleted after every test case unconditionally?
There was a problem hiding this comment.
added pool cleanup
Signed-off-by: Milind Changire <mchangir@redhat.com>
Signed-off-by: Milind Changire <mchangir@redhat.com>
Signed-off-by: Milind Changire <mchangir@redhat.com>
86e6af3 to
d8c55ed
Compare
doc/dev/cephfs-snapshots.rst
Outdated
| invisible, not throwing errors to the user.) If each FS gets its own | ||
| pool things probably work, but this isn't tested and may not be true. | ||
|
|
||
| .. Note:: To avoid snap id collision between mon-managed snapshots and file-system |
There was a problem hiding this comment.
There has been some contention about "filesystem" vs "file system" vs "file-system". The powers that be prefer "file system", so I suggest taking out the - in these three instances.
There was a problem hiding this comment.
corrected to file system
Signed-off-by: Milind Changire <mchangir@redhat.com>
96915f1 to
a81c0b3
Compare
|
jenkins test make check arm64 |
|
jenkins test windows |
|
Since PRs from this testing batch are waiting on required CI jobs to be green, I'll wait on this one too for a couple of hours. |
Requested change has been incorporated.
Fixes: https://tracker.ceph.com/issues/16745
Signed-off-by: Milind Changire mchangir@redhat.com
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "pacific"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windows