Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.4.0
    • Lustre 2.4.0
    • None
    • 3
    • 5779

    Description

      Once the "layout swap" support in LU-2017 (http://review.whamcloud.com/4507) is landed, the client will have an API to atomically swap the layout between two files.

      In order for this functionality to be useful for users, the llapi_layout_swap() function needs to be wrapped in some additional code compared to lfs swap_layouts to ensure that the file isn't changing during the copy, and to do the actual copy.

      I propose an lfs migrate command that takes the same arguments as lfs setstripe (calling into lfs_setstripe() to create the target file, for simplicity and compatibility, though with some option to make it an open-unlinked file via LU-2441), gets an exclusive lock on the file (group lock or client-side layout lock), and then copies the file contents from the source to the target. By reading the whole source file, this will natually cause any clients with unwritten data to flush their caches when their write-extent locks are cancelled. Once the copy is completed (optionally verifying the data checksum after flushing the client cache?) the llapi_layout_swap() function is called, and the "new" open-unlinked file descriptor layout (which now points to the old objects) is closed, causing those objects to be destroyed. The exclusive lock can be dropped.

      If the MDS does not support MDS_SWAP_LAYOUTS then lfs migrate should return an -EOPNOTSUPP error, so that users are aware that atomic layout swap is not available.

      The lfs_migrate script should call the lfs migrate command to do the migrate/copy (instead of rsync + mv). but lfs_migrate probably needs to fall back to rsync+mv again. The lfs_migrate script has not previously guaranteed atomic migration, so it should continue to work using rsync+mv as it has in the past if "lfs migrate" returns EOPNOTSUPP, with a comment to the effect that this functionality should be removed after Lustre 2.10 or so.

      Attachments

        Issue Links

          Activity

            [LU-2445] add "lfs migrate" support
            This is a first tentative because it does not add the support of O_EXCL as requested by Jinshan
            

            Exclusive open is lustre specific which is not simply O_EXCL. We should make it clear at initial start otherwise people will be confused.

            Andreas, would you suggest a name please?

            jay Jinshan Xiong (Inactive) added a comment - This is a first tentative because it does not add the support of O_EXCL as requested by Jinshan Exclusive open is lustre specific which is not simply O_EXCL. We should make it clear at initial start otherwise people will be confused. Andreas, would you suggest a name please?

            For use by the "lfs_migrate" script, this is sufficient for use today, since that script is already not safe for files being modified. It is better than the simple cp + checksum method, since it preserves the inode numbers and would also keep open file handles for read or write, so long as they are not actively writing during migration.

            "lfs migrate" probably needs a comment in the usage message to indicate it is not totally safe for files that are actively undergoing IO. It might also make sense to have an upper limit on the number of times it will try to migrate the file in the loop when the data version has changed, and continue to try any other files. It should save an error if this happens (maybe EBUSY) and return it at the end, so that it is clear to the user that the migrate was not totally successful.

            adilger Andreas Dilger added a comment - For use by the "lfs_migrate" script, this is sufficient for use today, since that script is already not safe for files being modified. It is better than the simple cp + checksum method, since it preserves the inode numbers and would also keep open file handles for read or write, so long as they are not actively writing during migration. "lfs migrate" probably needs a comment in the usage message to indicate it is not totally safe for files that are actively undergoing IO. It might also make sense to have an upper limit on the number of times it will try to migrate the file in the loop when the data version has changed, and continue to try any other files. It should save an error if this happens (maybe EBUSY) and return it at the end, so that it is clear to the user that the migrate was not totally successful.

            Patch at http://review.whamcloud.com/5620
            This is a first tentative because it does not add the support of O_EXCL as requested by Jinshan

            jcl jacques-charles lafoucriere added a comment - Patch at http://review.whamcloud.com/5620 This is a first tentative because it does not add the support of O_EXCL as requested by Jinshan

            let's start with lfs migrate, have it working and we will ask to the list later

            jcl jacques-charles lafoucriere added a comment - let's start with lfs migrate, have it working and we will ask to the list later

            JC, since the current behaviour of setstripe on an existing file is to return an error, it isn't clear to me if changing this to do internal migration and data copying would be "obvious" to users or not. It does have a certain appeal, however, so I think it should be discussed more.

            Could you please send and email (hpdd-discuss and lustre-discuss) to ask for done input on the user interface. I was thinking it makes more sense to require an explicit call to migrate the file data, since this may take a long time.

            If the setstripe approach is taken, it should definitely only migrate the file if a different layout is explicitly given.

            adilger Andreas Dilger added a comment - JC, since the current behaviour of setstripe on an existing file is to return an error, it isn't clear to me if changing this to do internal migration and data copying would be "obvious" to users or not. It does have a certain appeal, however, so I think it should be discussed more. Could you please send and email (hpdd-discuss and lustre-discuss) to ask for done input on the user interface. I was thinking it makes more sense to require an explicit call to migrate the file data, since this may take a long time. If the setstripe approach is taken, it should definitely only migrate the file if a different layout is explicitly given.

            OpenEx + dataversion is perfect I will implement this soon

            jcl jacques-charles lafoucriere added a comment - OpenEx + dataversion is perfect I will implement this soon

            Here is a flow chart for migration I proposed in Beijing. Please take a look.

            jay Jinshan Xiong (Inactive) added a comment - Here is a flow chart for migration I proposed in Beijing. Please take a look.

            I will initially implement it in lfs_setstripe() directly so any re-stripe call will do the migration. I think I have to take a group lock for force flush from others and get exclusive access during copy.

            jcl jacques-charles lafoucriere added a comment - I will initially implement it in lfs_setstripe() directly so any re-stripe call will do the migration. I think I have to take a group lock for force flush from others and get exclusive access during copy.

            Please assign me this LU (or to jody) , I will work on a patch

            jcl jacques-charles lafoucriere added a comment - Please assign me this LU (or to jody) , I will work on a patch
            rread Robert Read added a comment -

            If the new objects have earlier version numbers than the old objects (because they are on new OSTs perhaps), then will this have a effect on HSM? Will HSM still archive the data if the version looks older than what is currently in the archive?

            rread Robert Read added a comment - If the new objects have earlier version numbers than the old objects (because they are on new OSTs perhaps), then will this have a effect on HSM? Will HSM still archive the data if the version looks older than what is currently in the archive?

            Johann, can you please file a bug with the details of what still needs to be implemented for the full layout lock support, or if one already exists please link it to this bug.

            adilger Andreas Dilger added a comment - Johann, can you please file a bug with the details of what still needs to be implemented for the full layout lock support, or if one already exists please link it to this bug.

            People

              jay Jinshan Xiong (Inactive)
              adilger Andreas Dilger
              Votes:
              0 Vote for this issue
              Watchers:
              16 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: