git意味着什么,“无法将对象迁移到永久存储器”? [英] What does git mean by, "unable to migrate objects to permanent storage"?

查看:1294
本文介绍了git意味着什么,“无法将对象迁移到永久存储器”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

git是什么意思,无法将对象迁移到永久存储?

 计数对象:4,完成。 
使用多达8个线程的增量压缩。
压缩对象:100%(4/4),完成。
写入对象:100%(4/4),956字节| 0字节/秒,完成。
总计4(增量2),重用0(增量0)
错误:未能将某些裁判推送到'https://git.patrikx3.tk/server-scripts.git'
到https://git.patrikx3.tk/server-scripts.git
! refs / heads / master:refs / heads / master [远程拒绝](无法将对象迁移到永久存储)
完成

$ b $您可以在中引入错误消息无法将对象迁移到永久存储 href =https://github.com/git/git/commit/722ff7f876c8a2ad99c42434f58af098e61b96e8 =nofollow noreferrer> commit 722ff7f for Git 2.11 in October。



解释是:


接收包:隔离对象直到 pre-receive 接受



当客户端向我们推送对象时, index-pack 检查对象本身,然后将它们安装到位。

如果我们然后拒绝由于预先接收挂钩,我们不能只删除packfile;其他进程可能取决于它。我们必须通过 git gc 来做一个正常的可达性检查。



但是这样的对象可能会停留在周由于 gc.pruneExpire 宽限期。更糟糕的是,在那段时间里,它们可能会从包装中爆炸成效率低下的松散物体。



相反,这个补丁教导 receive-pack 将新对象放入隔离临时目录中。
我们使这些对象可用于连接检查和预接收

代码是:


$ b

/ *
*我们将开始写出refs,这意味着对象需要
*才能处于最终位置,以便其他进程可以看到它们。如果(tmp_objdir_migrate(tmp_objdir)<0){
for(cmd = commands; cmd; cmd = cmd-> next){
if(!cmd)
* /
- > error_string)
cmd-> error_string =无法将对象迁移到永久存储器;
}
return;
}
tmp_objdir = NULL;

tmp_objdir_migrate()函数来自< a href =https://github.com/git/git/commit/2564d994c9c91aea58d59565d68d42bbc017f536 =nofollow noreferrer> commit 2564d99 (仍然适用于Git 2.11)


它可以帮助调用者在对象目录中创建一个临时目录,并且可以将临时环境传递给子程序以请求它们在那里写入(原始对象目录仍可作为如上所述,这可能是由于权限问题(或磁盘空间问题)造成的。



另外,使用(在服务器端)一个git 2.10可能会导致错误消失。






Git 2.13(2017年第2季度)将扩大隔离概念:

请参阅提交d8f4481 commit eaeed07 commit 36​​0244a (2017年4月10日)作者:杰夫金( peff

(由合并Junio C Hamano - gitster - 提交9f1384f ,2017年4月24日) $ b git receive-pack 手册页现在包括:
$ b


隔离环境



receive-包 tak es在对象中,它们被放置在 $ GIT_DIR / objects 目录中的临时
隔离区目录中,
仅迁移到主对象存储中在 pre-receive 挂钩
完成之后。如果在此之前推送失败,临时目录完全被删除



这有几个用户可见的效果和注意事项:


  1. 推送由于传入包的问题而失败,缺少
    对象或由于预接收 hook不会留下任何
    磁盘数据。这通常有助于防止重复失败的
    填满磁盘,但可以使调试更具挑战性。

  2. 任何对象由 pre-receive 钩子创建,将在
    隔离目录中创建(仅在成功时迁移)。


  3. 预接收挂钩绝不能更新任何指向
    隔离对象的引用。其他访问存储库的程序会使
    无法看到对象(如果 pre-receive 挂钩失败,那么
    这些ref会被破坏) 。




What does git mean by, "unable to migrate objects to permanent storage"?

 Counting objects: 4, done.
 Delta compression using up to 8 threads.
 Compressing objects: 100% (4/4), done.
 Writing objects: 100% (4/4), 956 bytes | 0 bytes/s, done.
 Total 4 (delta 2), reused 0 (delta 0)
 error: failed to push some refs to 'https://git.patrikx3.tk/server-scripts.git'
 To https://git.patrikx3.tk/server-scripts.git
 !  refs/heads/master:refs/heads/master [remote rejected] (unable to migrate objects to permanent storage)
 Done

解决方案

You can see the error message "unable to migrate objects to permanent storage" introduced in commit 722ff7f for Git 2.11 in Oct. 2016.

The explanation is:

receive-pack: quarantine objects until pre-receive accepts

When a client pushes objects to us, index-pack checks the objects themselves and then installs them into place.
If we then reject the push due to a pre-receive hook, we cannot just delete the packfile; other processes may be depending on it. We have to do a normal reachability check at this point via git gc.

But such objects may hang around for weeks due to the gc.pruneExpire grace period. And worse, during that time they may be exploded from the pack into inefficient loose objects.

Instead, this patch teaches receive-pack to put the new objects into a "quarantine" temporary directory.
We make these objects available to the connectivity check and to the pre-receive hook, and then install them into place only if it is successful (and otherwise remove them as tempfiles).

The code is:

    /*
     * Now we'll start writing out refs, which means the objects need
     * to be in their final positions so that other processes can see them.
     */
    if (tmp_objdir_migrate(tmp_objdir) < 0) {
        for (cmd = commands; cmd; cmd = cmd->next) {
            if (!cmd->error_string)
                cmd->error_string = "unable to migrate objects to permanent storage";
        }
        return;
    }
tmp_objdir = NULL;

The tmp_objdir_migrate() function comes from commit 2564d99 (still for Git 2.11)

it helps callers create a temporary directory inside the object directory, and a temporary environment which can be passed to sub-programs to ask them to write there (the original object directory remains accessible as an alternate of the temporary one).

As mentioned, this could result from a permission issue (or disk space issue)

Also, using (on the server side) a git 2.10 would likely make that error disappear.


Git 2.13 (Q2 2017) will expand on that quarantine notion:
See commit d8f4481, commit eaeed07, commit 360244a (10 Apr 2017) by Jeff King (peff).
(Merged by Junio C Hamano -- gitster -- in commit 9f1384f, 24 Apr 2017)

git receive-pack man page now includes:

Quarantine Environment

When receive-pack takes in objects, they are placed into a temporary "quarantine" directory within the $GIT_DIR/objects directory and migrated into the main object store only after the pre-receive hook has completed. If the push fails before then, the temporary directory is removed entirely.

This has a few user-visible effects and caveats:

  1. Pushes which fail due to problems with the incoming pack, missing objects, or due to the pre-receive hook will not leave any on-disk data. This is usually helpful to prevent repeated failed pushes from filling up your disk, but can make debugging more challenging.

  2. Any objects created by the pre-receive hook will be created in the quarantine directory (and migrated only if it succeeds).

  3. The pre-receive hook MUST NOT update any refs to point to quarantined objects. Other programs accessing the repository will not be able to see the objects (and if the pre-receive hook fails, those refs would become corrupted).

这篇关于git意味着什么,“无法将对象迁移到永久存储器”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆