• gerrit代码审核工具之“error unpack failed error Missing unknown”错误解决思路


    使用gerrit代码审核工具时遇到error: unpack failed: error Missing unknown d6d7c89bd1d77f44c5c8e99437aaffbfc0684e72 fatal: Unpack error, check server log To ssh://192.168.10.201:29418/MainWeb ! [remote rejected] HEAD -> refs/for/test (n/a (unpacker error)) error: failed to push some refs to 'ssh://admin@192.168.10.201:29418/MainWeb'
    问题应该如何解决

    • 在网上查阅资料,发现有一个共同点就是数据库里面有提示的这些对象,但是git仓库里面找不到对应的对象名所以报错了
    • 至于出现这样的现象可能是因为上次杋器意外掉电,导致仓库出现了问题
    • 解决思路,既然是数据库中的多余了,删了是否可靠,觉得可以试试看,因为我们数据库每天都有备份的
    • 错误提示如下
    ➜  MainWeb git:(test) git push --no-thin origin HEAD:refs/for/test
    Counting objects: 3, done.
    Delta compression using up to 2 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 645 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    error: unpack failed: error Missing unknown d6d7c89bd1d77f44c5c8e99437aaffbfc0684e72
    fatal: Unpack error, check server log
    To ssh://192.168.10.201:29418/MainWeb
     ! [remote rejected]   HEAD -> refs/for/test (n/a (unpacker error))
    error: failed to push some refs to 'ssh://admin@192.168.10.201:29418/MainWeb'
    
    • 操作步骤
    • 提交代码时出现了这个错误,注意关键地方,其实也可以一边操作一边查看后台日志
      //这里‘error Missing unknown d6d7c89bd1d77f44c5c8e99437aaffbfc0684e72’后面跟的那一串字符,对应数据库中gerrit_db.patch_sets表中的revision字段,
    # git push --no-thin origin HEAD:refs/for/test
    Counting objects: 3, done.
    Delta compression using up to 2 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 645 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    error: unpack failed: error Missing unknown d6d7c89bd1d77f44c5c8e99437aaffbfc0684e72
    fatal: Unpack error, check server log
    To ssh://192.168.10.201:29418/MainWeb
     ! [remote rejected]   HEAD -> refs/for/test (n/a (unpacker error))
    error: failed to push some refs to 'ssh://admin@192.168.10.201:29418/MainWeb'
    
    • 通过revision可以查到涉及到这个对象的change_id,如下
    mysql> select * from patch_sets where revision = 'd6d7c89bd1d77f44c5c8e99437aaffbfc0684e72'G
    *************************** 1. row ***************************
               revision: d6d7c89bd1d77f44c5c8e99437aaffbfc0684e72
    uploader_account_id: 1
             created_on: 2017-01-11 20:47:46
                  draft: Y
              change_id: 1176
           patch_set_id: 1
    1 row in set (0.00 sec)
    
    • 通过change_id可以查到changes相关的数据
    mysql> select * from changes where change_id = 1176 G
    *************************** 1. row ***************************
              change_key: I2c68f2b32537908e55eb19472dea5a418d26b187
              created_on: 2017-01-11 20:47:46
         last_updated_on: 2017-01-11 20:47:46
        owner_account_id: 1
       dest_project_name: MainWeb
        dest_branch_name: refs/meta/config
                  status: A
    current_patch_set_id: 1
                 subject: Edit Project Config
                   topic: NULL
        original_subject: Edit Project Config
             row_version: 1
               change_id: 1176
    1 row in set (0.00 sec)
    
    • 好了,可以尝试先将这两条记录删掉,看看报什么错
    mysql> delete from changes where change_id = 1176 ; 
    Query OK, 1 row affected (0.00 sec)
    
    mysql> select * from changes where change_id = 1176 G
    Empty set (0.00 sec)
    
    mysql> select * from patch_sets where revision = 'd6d7c89bd1d77f44c5c8e99437aaffbfc0684e72'G
    *************************** 1. row ***************************
               revision: d6d7c89bd1d77f44c5c8e99437aaffbfc0684e72
    uploader_account_id: 1
             created_on: 2017-01-11 20:47:46
                  draft: Y
              change_id: 1176
           patch_set_id: 1
    1 row in set (0.00 sec)
    
    mysql> delete from patch_sets where revision = 'd6d7c89bd1d77f44c5c8e99437aaffbfc0684e72';
    Query OK, 1 row affected (0.01 sec)
    
    mysql> select * from patch_sets where revision = 'd6d7c89bd1d77f44c5c8e99437aaffbfc0684e72'G
    Empty set (0.00 sec)
    
    mysql> select * from patch_sets where change_id =  1176;
    Empty set (0.00 sec)
    
    • 再提交,看看是否还会报错
    ➜  MainWeb git:(test) git push --no-thin origin HEAD:refs/for/test
    Counting objects: 3, done.
    Delta compression using up to 2 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 645 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    error: unpack failed: error Missing unknown d3b7b1a1b0f1250f7115a1173f7137aae5a0c9aa
    fatal: Unpack error, check server log
    To ssh://192.168.10.201:29418/MainWeb
     ! [remote rejected]   HEAD -> refs/for/test (n/a (unpacker error))
    error: failed to push some refs to 'ssh://admin@192.168.10.201:29418/MainWeb'
    
    • 额,看来还是类似的错误,那我就都删了再看看,操作完看是否可以正常工作了admin账号

    • 还是预期的那样,把库的多余的东西删掉之后就可以正常推送了,push 到远程仓库

    • 多备份下数据库还是有必要的,万一刚刚的操作出问题之后,最起码还是有后悔药的。嘿嘿

    ➜  MainWeb git:(test) git status 
    On branch test
    Your branch is ahead of 'origin/test' by 1 commit.
      (use "git push" to publish your local commits)
    nothing to commit, working tree clean
    ➜  MainWeb git:(test) git push origin                             
    Total 0 (delta 0), reused 0 (delta 0)
    remote: Processing changes: closed: 1, refs: 1, done    
    To ssh://192.168.10.201:29418/MainWeb
       4017e4bf..dae0d97d  test -> test
    
  • 相关阅读:
    lipo命令
    Eclipse安装ADT插件
    编译vo-aacenc遇到的问题
    双MIC安卓手机录音问题
    天天动听MP3解码器性能提升50%
    Sublime Text 2结合VS2010配置C C++编译
    讯飞语音语义接口测试
    讯飞语音接口注册
    iOS阶段学习第31天笔记(UINavigationBar介绍)
    iOS App上架AppStore 会遇到的坑
  • 原文地址:https://www.cnblogs.com/ZhangRuoXu/p/6483307.html
Copyright © 2020-2023  润新知