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

error: 'idIndex' is not allowed with 'autoIndexId' #400

Closed
yuwei43 opened this issue Aug 3, 2020 · 8 comments
Closed

error: 'idIndex' is not allowed with 'autoIndexId' #400

yuwei43 opened this issue Aug 3, 2020 · 8 comments
Labels
bug Something isn't working

Comments

@yuwei43
Copy link

yuwei43 commented Aug 3, 2020

No description provided.

@vinllen
Copy link
Collaborator

vinllen commented Aug 3, 2020

报错不会跳过,跳过将会影响正确性。你是什么场景,需要跳过报错?

@yuwei43
Copy link
Author

yuwei43 commented Aug 3, 2020

那请问如果增量同步报错了要怎么解决呢,需要重新进行一次同步吗

@vinllen
Copy link
Collaborator

vinllen commented Aug 3, 2020

看下报错的是啥,搜一下faq里面的对应处理

@yuwei43
Copy link
Author

yuwei43 commented Aug 5, 2020

(*Executor).execute:111) Replayer-0, executor-0, oplog for namespace[test.****(表名)] op[c] failed. error type[*mgo.QueryError] error['idIndex' is not allowed with 'autoIndexId':

我是副本集同步到单实例上, 看faq 这个问题还没修复吗?最新版本

@vinllen
Copy link
Collaborator

vinllen commented Aug 5, 2020

贴一下完整的oplog,还有源端和目的端的MongoDB版本号

@yuwei43
Copy link
Author

yuwei43 commented Aug 5, 2020

mongodb版本号都是3.6

[14:00:33 CST 2020/08/05] [CRIT] (mongoshake/executor.(*Executor).execute:111) Replayer-0, executor-0, oplog for namespace[test.action_counter_service.sjsdk.99.com_20200730] op[c] failed. error type[*mgo.QueryError] error['idIndex' is not allowed with 'autoIndexId': idIndex: { v: 2, key: { _id: 1 }, name: "_id_", ns: "test.action_counter_service.sjsdk.99.com_20200730" }], logs number[1], firstLog: 
{
    "ts":6856624188065579039,
    "op":"c",
    "g":"",
    "ns":"test.action_counter_service.sjsdk.99.com_20200730",
    "o":[
        {
            "Name":"create",
            "Value":"action_counter_service.sjsdk.99.com_20200730"
        },
        {
            "Name":"autoIndexId",
            "Value":true
        },
        {
            "Name":"idIndex",
            "Value":[
                {
                    "Name":"v",
                    "Value":2
                },
                {
                    "Name":"key",
                    "Value":[
                        {
                            "Name":"_id",
                            "Value":1
                        }
                    ]
                },
                {
                    "Name":"name",
                    "Value":"_id_"
                },
                {
                    "Name":"ns",
                    "Value":"test.action_counter_service.sjsdk.99.com_20200730"
                }
            ]
        }
    ],
    "o2":null,
    "uk":null,
    "lsid":null,
    "fromMigrate":false
}

image

@vinllen
Copy link
Collaborator

vinllen commented Aug 13, 2020

autoIndexId字段跟idIndex无法共存,如果源端创建collection时候携带了{autoIndexId: true},则生成的oplog同时会携带autoIndexId和idIndex。

image

对于MongoShake来说,此处可以进行判断,如果autoIndexId和idIndex同时存在,则去除autoIndexId字段,依靠idIndex进行创建_id索引。

@vinllen vinllen added the enhancement New feature or request label Aug 13, 2020
@vinllen vinllen changed the title 请问如果进行增量同步的时候报错了要怎么跳过呢 error: 'idIndex' is not allowed with 'autoIndexId' Aug 13, 2020
@vinllen vinllen added bug Something isn't working and removed enhancement New feature or request labels Aug 13, 2020
@vinllen
Copy link
Collaborator

vinllen commented Aug 14, 2020

2.4.10版本已经发布

@vinllen vinllen closed this as completed Aug 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants