Couchbase lite 2.0 DP13 Android- 无效修订
Couchbase lite 2.0 DP13 Android- invalid revisions
我正在使用 Couchlite 2.0DP13 从 Android 上的服务器同步沙发数据库。我的复制代码如下所示:
URI uri = null;
try {
uri = new URI(my_url");
} catch (URISyntaxException e) {
e.printStackTrace();
}
ReplicatorConfiguration replConfig = new ReplicatorConfiguration(database, uri);
replConfig.setAuthenticator(new SessionAuthenticator(sessionInfo.cookieValue, sessionInfo.cookieDate, sessionInfo.cookieName));
replConfig.setContinuous(false);
replConfig.setReplicatorType(ReplicatorConfiguration.ReplicatorType.PULL);
replicator = new Replicator(replConfig);
replicator.addChangeListener(new ReplicatorChangeListener() {
@Override
public void changed(Replicator replicator, Replicator.Status status, CouchbaseLiteException error) {
Log.d("GABE", "status "+status.getActivityLevel()+" prog total "+status.getProgress().getTotal()+" prog comp "+status.getProgress().getCompleted()+" error "+error);
if ( error == null && status.getActivityLevel() == Replicator.ActivityLevel.STOPPED && status.getProgress().getTotal() == status.getProgress().getCompleted()) {
if (replicatorListener != null) {
replicatorListener.onFinished(true);
}
} else if (error != null) {
replicatorListener.onFinished(false);
}
}
});
replicator.start();
当 运行 它时,我看到两个问题:
1)我们收到无效的修订 ID
08-18 11:37:01.681 15333-16024/com.handshake.hsdm E/CBLWebSocket: WebSocketListener.onMessage() bytes -> 952c282301007265760073657175656e636500223230343937323a3230333734322200040005001f8b080000096e8800ff8451cb8edc2010fc95559fcd0a307e1e9391a2bdcf2917ab0ded0d5a1b2c8cad1945f9f7087b6766a33944e242553faaab7e43670db4d088bcea252a464249a686ba6675af244353229a021bd53790411768831604ab24e64555aa42d68ab4e6249a5a9452963d97648a1a3240adfdea22b4703a9ddf9c4ed09490ced8e59372eb383ee095a005fecaf9a374c65d5ed1fc83069ad03aebde9fea97b58f3ee2f8dc13f1f254fd597aa8e8ed385af7de450f2d40061a43b0146eb48e764afa241715e32513ea2c659b8b362f5e0b297ea68e350472fa7a6f5997e8a73402aac20c3549ce8a4110538492351521cb73c96555230dbc800c0c8d14c9403be0b8500666a50ee3b1b564bc61b23a73deee2f6d24176dbc9eaf7352f6e6366f3525f81229381cf76c0f2df6208fb4659ea784a6ff9fe47ca4e5f0c307f370630e76c348dd173ed040e9fc7de2e9db77c184aa54d394bc4a962fe4e27ecb3160ff0ec14f47f3fedd9dffe1b7cbabf6d30e862d691e69a37b4ccb2f3b7706237d7525870c2285294939adf4e2dd4b204d768e8908a83f52b2a3751fb73177d0ad537fbbebcfdf000000ffffb93dab3c0f030000
08-18 11:37:01.681 15333-16017/com.handshake.hsdm E/C4Replicator: documentErrorCallback() handle -> 513230938784, pushing -> false, docID -> null, domain -> 7, code -> 400, internalInfo -> 6507, trans -> false
08-18 11:37:01.681 15333-16024/com.handshake.hsdm E/C4Socket: C4Socket.callback.completedReceive() socket -> 0x777ee53810, byteCount -> 480
08-18 11:37:01.681 15333-16019/com.handshake.hsdm I/LiteCore [Actor]: Pull->blips:myurl/_blipsync performNextMessage
08-18 11:37:01.681 15333-16019/com.handshake.hsdm I/LiteCore [Actor]: BLIP[->blips:myurl/_blipsync] performNextMessage
08-18 11:37:01.682 15333-16024/com.handshake.hsdm E/CBLWebSocket: WebSocketListener.onMessage() bytes -> 962c282301007265760073657175656e636500223230343937323a3230333734332200040005001f8b080000096e8800ff8451cb8e9c3010fc95559ff1ca9897cd3513457b9f532ea8b19b8db5602363d08ca2fc7b64d899c96a0e917c71553faaab7e43670db440dae8bee69c19948a9575a59822d4acd29cfa7230a8b1810cba401bb4903385aa965ce180bc1c5453f7c5c00b2259944236283864805afbd54568e1743abf399da029219db1cb27e5d6717cc02b410bfc95f347e98cbbbca2fa82069ad03aebde9fea97b58f3ee2f8dc13f1f254fd597aa8e8ed385af7de450f2d40061a43b0146eb48e764afa04cf1bc66b96976721da226fabfcb596e267ea584320a7aff79675897e4a23a0a9cc204970560d39b1925030d510b2a2105c341269e015646068a44806da01c78532302b75188fad35e38a0975e6bcdd5fda482eda783d5fe7a4eccd6dde6a4af025527038eed91e5aec411e698b424ac860faff49ce475a0e3f7c300f37e660378cd4fdc3071a289dbf4ffc9eab6f2c2f9b2a975c2a01192ce4e27ecb3160ff0ec14f47f3fedd9dffe1b7cbabf6d30e862d691e69a37b4ccb2f3b7706237d7105328814a624e5b4d28b772f8134d9392622a0fe48c98ed67ddcc6dc41b74efdedae3f7f030000ffffcaa2a8a50f030000
08-18 11:37:01.682 15333-16019/com.handshake.hsdm I/LiteCore [Actor]: inc->blips:myurl/db/_blipsync performNextMessage
08-18 11:37:01.682 15333-16019/com.handshake.hsdm W/LiteCore [Sync]: {180} Got invalid revision
08-18 11:37:01.682 15333-16019/com.handshake.hsdm I/LiteCoreJNI: [NATIVE] C4Replicator.documentErrorCallback() repl -> 0x0x777ef2a2a0, pulling, received invalid revision
2)
我们收到与推送相关的消息,即使我将此设置为仅拉复制。另外,数据库中没有文档。
08-18 11:37:01.552 15333-16017/com.handshake.hsdm E/C4Replicator: documentErrorCallback() handle -> 513230938784, pushing -> false, docID -> null, domain -> 7, code -> 400, internalInfo -> 6302, trans -> false
有人见过这些错误吗?没有他们我无法继续前进。我什至很乐意弄清楚它是服务器端数据问题,还是我的代码或 SDK 中的客户端问题。
根据您的描述,您似乎是在与 Couch Db 而不是 SG/Couchbase 服务器对话。你能再确认一下吗?
因为 Couchbase Lite 2.0 实现了一个与 CouchDB 不兼容的新复制协议。
今天弄明白了,事实证明 DB13 中有一个破坏性的协议更改(甚至超过了 2.0 中的协议),需要更新服务器。
我正在使用 Couchlite 2.0DP13 从 Android 上的服务器同步沙发数据库。我的复制代码如下所示:
URI uri = null;
try {
uri = new URI(my_url");
} catch (URISyntaxException e) {
e.printStackTrace();
}
ReplicatorConfiguration replConfig = new ReplicatorConfiguration(database, uri);
replConfig.setAuthenticator(new SessionAuthenticator(sessionInfo.cookieValue, sessionInfo.cookieDate, sessionInfo.cookieName));
replConfig.setContinuous(false);
replConfig.setReplicatorType(ReplicatorConfiguration.ReplicatorType.PULL);
replicator = new Replicator(replConfig);
replicator.addChangeListener(new ReplicatorChangeListener() {
@Override
public void changed(Replicator replicator, Replicator.Status status, CouchbaseLiteException error) {
Log.d("GABE", "status "+status.getActivityLevel()+" prog total "+status.getProgress().getTotal()+" prog comp "+status.getProgress().getCompleted()+" error "+error);
if ( error == null && status.getActivityLevel() == Replicator.ActivityLevel.STOPPED && status.getProgress().getTotal() == status.getProgress().getCompleted()) {
if (replicatorListener != null) {
replicatorListener.onFinished(true);
}
} else if (error != null) {
replicatorListener.onFinished(false);
}
}
});
replicator.start();
当 运行 它时,我看到两个问题:
1)我们收到无效的修订 ID
08-18 11:37:01.681 15333-16024/com.handshake.hsdm E/CBLWebSocket: WebSocketListener.onMessage() bytes -> 952c282301007265760073657175656e636500223230343937323a3230333734322200040005001f8b080000096e8800ff8451cb8edc2010fc95559fcd0a307e1e9391a2bdcf2917ab0ded0d5a1b2c8cad1945f9f7087b6766a33944e242553faaab7e43670db4d088bcea252a464249a686ba6675af244353229a021bd53790411768831604ab24e64555aa42d68ab4e6249a5a9452963d97648a1a3240adfdea22b4703a9ddf9c4ed09490ced8e59372eb383ee095a005fecaf9a374c65d5ed1fc83069ad03aebde9fea97b58f3ee2f8dc13f1f254fd597aa8e8ed385af7de450f2d40061a43b0146eb48e764afa241715e32513ea2c659b8b362f5e0b297ea68e350472fa7a6f5997e8a73402aac20c3549ce8a4110538492351521cb73c96555230dbc800c0c8d14c9403be0b8500666a50ee3b1b564bc61b23a73deee2f6d24176dbc9eaf7352f6e6366f3525f81229381cf76c0f2df6208fb4659ea784a6ff9fe47ca4e5f0c307f370630e76c348dd173ed040e9fc7de2e9db77c184aa54d394bc4a962fe4e27ecb3160ff0ec14f47f3fedd9dffe1b7cbabf6d30e862d691e69a37b4ccb2f3b7706237d7525870c2285294939adf4e2dd4b204d768e8908a83f52b2a3751fb73177d0ad537fbbebcfdf000000ffffb93dab3c0f030000
08-18 11:37:01.681 15333-16017/com.handshake.hsdm E/C4Replicator: documentErrorCallback() handle -> 513230938784, pushing -> false, docID -> null, domain -> 7, code -> 400, internalInfo -> 6507, trans -> false
08-18 11:37:01.681 15333-16024/com.handshake.hsdm E/C4Socket: C4Socket.callback.completedReceive() socket -> 0x777ee53810, byteCount -> 480
08-18 11:37:01.681 15333-16019/com.handshake.hsdm I/LiteCore [Actor]: Pull->blips:myurl/_blipsync performNextMessage
08-18 11:37:01.681 15333-16019/com.handshake.hsdm I/LiteCore [Actor]: BLIP[->blips:myurl/_blipsync] performNextMessage
08-18 11:37:01.682 15333-16024/com.handshake.hsdm E/CBLWebSocket: WebSocketListener.onMessage() bytes -> 962c282301007265760073657175656e636500223230343937323a3230333734332200040005001f8b080000096e8800ff8451cb8e9c3010fc95559ff1ca9897cd3513457b9f532ea8b19b8db5602363d08ca2fc7b64d899c96a0e917c71553faaab7e43670db440dae8bee69c19948a9575a59822d4acd29cfa7230a8b1810cba401bb4903385aa965ce180bc1c5453f7c5c00b2259944236283864805afbd54568e1743abf399da029219db1cb27e5d6717cc02b410bfc95f347e98cbbbca2fa82069ad03aebde9fea97b58f3ee2f8dc13f1f254fd597aa8e8ed385af7de450f2d40061a43b0146eb48e764afa04cf1bc66b96976721da226fabfcb596e267ea584320a7aff79675897e4a23a0a9cc204970560d39b1925030d510b2a2105c341269e015646068a44806da01c78532302b75188fad35e38a0975e6bcdd5fda482eda783d5fe7a4eccd6dde6a4af025527038eed91e5aec411e698b424ac860faff49ce475a0e3f7c300f37e660378cd4fdc3071a289dbf4ffc9eab6f2c2f9b2a975c2a01192ce4e27ecb3160ff0ec14f47f3fedd9dffe1b7cbabf6d30e862d691e69a37b4ccb2f3b7706237d7105328814a624e5b4d28b772f8134d9392622a0fe48c98ed67ddcc6dc41b74efdedae3f7f030000ffffcaa2a8a50f030000
08-18 11:37:01.682 15333-16019/com.handshake.hsdm I/LiteCore [Actor]: inc->blips:myurl/db/_blipsync performNextMessage
08-18 11:37:01.682 15333-16019/com.handshake.hsdm W/LiteCore [Sync]: {180} Got invalid revision
08-18 11:37:01.682 15333-16019/com.handshake.hsdm I/LiteCoreJNI: [NATIVE] C4Replicator.documentErrorCallback() repl -> 0x0x777ef2a2a0, pulling, received invalid revision
2)
我们收到与推送相关的消息,即使我将此设置为仅拉复制。另外,数据库中没有文档。
08-18 11:37:01.552 15333-16017/com.handshake.hsdm E/C4Replicator: documentErrorCallback() handle -> 513230938784, pushing -> false, docID -> null, domain -> 7, code -> 400, internalInfo -> 6302, trans -> false
有人见过这些错误吗?没有他们我无法继续前进。我什至很乐意弄清楚它是服务器端数据问题,还是我的代码或 SDK 中的客户端问题。
根据您的描述,您似乎是在与 Couch Db 而不是 SG/Couchbase 服务器对话。你能再确认一下吗? 因为 Couchbase Lite 2.0 实现了一个与 CouchDB 不兼容的新复制协议。
今天弄明白了,事实证明 DB13 中有一个破坏性的协议更改(甚至超过了 2.0 中的协议),需要更新服务器。